id
stringlengths
33
34
updated
unknown
published
unknown
title
stringlengths
9
212
summary
stringlengths
75
2.46k
author
sequence
arxiv:doi
stringlengths
0
71
link
list
arxiv:journal_ref
sequence
arxiv:primary_category
dict
category
sequence
content
stringlengths
0
1.25M
http://arxiv.org/abs/2310.04941v1
"2023-10-07T23:21:25"
"2023-10-07T23:21:25"
Reliable Test-Time Adaptation via Agreement-on-the-Line
Test-time adaptation (TTA) methods aim to improve robustness to distribution shifts by adapting models using unlabeled data from the shifted test distribution. However, there remain unresolved challenges that undermine the reliability of TTA, which include difficulties in evaluating TTA performance, miscalibration after TTA, and unreliable hyperparameter tuning for adaptation. In this work, we make a notable and surprising observation that TTAed models strongly show the agreement-on-the-line phenomenon (Baek et al., 2022) across a wide range of distribution shifts. We find such linear trends occur consistently in a wide range of models adapted with various hyperparameters, and persist in distributions where the phenomenon fails to hold in vanilla models (i.e., before adaptation). We leverage these observations to make TTA methods more reliable in three perspectives: (i) estimating OOD accuracy (without labeled data) to determine when TTA helps and when it hurts, (ii) calibrating TTAed models without label information, and (iii) reliably determining hyperparameters for TTA without any labeled validation data. Through extensive experiments, we demonstrate that various TTA methods can be precisely evaluated, both in terms of their improvements and degradations. Moreover, our proposed methods on unsupervised calibration and hyperparameters tuning for TTA achieve results close to the ones assuming access to ground-truth labels, in terms of both OOD accuracy and calibration error.
[ "Eungyeup Kim", "Mingjie Sun", "Aditi Raghunathan", "Zico Kolter" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04941v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04941v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 1 4 9 4 0 . 0 1 3 2 : v i X r a RELIABLE TEST-TIME ADAPTATION VIA AGREEMENT-ON-THE-LINE Eungyeup Kim1 Mingjie Sun1 Aditi Raghunathan1 1Carnegie Mellon University 2Bosch Center for AI {eungyeuk, mingjies, raditi, zkolter}@cs.cmu.edu J. Zico Kolter1,2 ABSTRACT Test-time adaptation (TTA) methods aim to improve robustness to distribution shifts by adapting models using unlabeled data from the shifted test distribution. However, there remain unresolved challenges that undermine the reliability of TTA, which include difficulties in evaluating TTA performance, miscalibration after TTA, and unreliable hyperparameter tuning for adaptation. In this work, we make a notable and surprising observation that TTAed models strongly show the agreement-on-the-line phenomenon (Baek et al., 2022) across a wide range of dis- tribution shifts. We find such linear trends occur consistently in a wide range of models adapted with various hyperparameters, and persist in distributions where the phenomenon fails to hold in vanilla models (i.e., before adaptation). We lever- age these observations to make TTA methods more reliable in three perspectives: (i) estimating OOD accuracy (without labeled data) to determine when TTA helps and when it hurts, (ii) calibrating TTAed models without label information, and (iii) reliably determining hyperparameters for TTA without any labeled validation data. Through extensive experiments, we demonstrate that various TTA methods can be precisely evaluated, both in terms of their improvements and degradations. Moreover, our proposed methods on unsupervised calibration and hyperparame- ters tuning for TTA achieve results close to the ones assuming access to ground- truth labels, in terms of both OOD accuracy and calibration error. 1 INTRODUCTION Machine learning models often fail to generalize to new distributions (Arjovsky et al., 2020; Gulra- jani & Lopez-Paz, 2021; Sagawa et al., 2022) – so-called out-of-distribution (OOD) data - which differ from the one they were trained on, referred to as in-distribution (ID) data. This can lead to a significant degradation in their performance during test time. Recently, there has been a surge in re- search on test-time adaptation (TTA), a technique that adapts models to the target distribution using only unlabeled test data. These involve adaptation strategies including estimating test-time feature statistics (Schneider et al., 2020), self-supervision (Sun et al., 2020; Liu et al., 2021; Gandelsaman et al., 2022), entropy minimization (Liang et al., 2020; Wang et al., 2021; Zhang et al., 2022; Niu et al., 2022; 2023), and self-training with pseudo-labels (Liang et al., 2020; Rusak et al., 2022; Goyal et al., 2022). These efforts have aimed to enhance model robustness in the face of distribution shifts where labeled data is unavailable. Despite the progress in TTA, several critical bottlenecks persist, undermining the reliable applica- tions of such adaptation methods in practice. Firstly, TTA is not universally effective for all dis- tribution shifts and can sometimes lead to performance degradation (Wang et al., 2021; Liu et al., 2021; Zhao et al., 2023). Moreover, the absence of labeled test data hinders the evaluation of model performance in practice, thereby making it unclear in advance whether these methods will work or not. Secondly, TTA methods often result in poorly calibrated models (Eastwood et al., 2022; Chen et al., 2022; Rusak et al., 2022), posing potential risks in safety-critical applications. Thirdly, TTA methods are often extremely sensitive to their hyperparameters during adaptation (Boudiaf et al., 2022; Zhao et al., 2023), and their tuning procedures lack clarity. Most of them often follow the same settings of the previous studies (Niu et al., 2022; 2023), or rely on some held-out labeled data (Iwasawa & Matsuo, 2021; Zhang et al., 2022; Goyal et al., 2022), which might be unavailable 1 Figure 1: Various TTA methods make the correlations in agreement and accuracy notably stronger than their base counterparts, with their R2 values substantially increased. We test SHOT, TENT, and ETA on CIFAR10 (first row) and ImageNet (second row) against their Gaussian Noise corruption. Each blue point indicates the accuracy of the models, while pink denotes the agreement between a pair of them. The axes are probit scaled. Additional results are provided in appendix A.5. in practice. To our knowledge, there is little work addressing these shortcomings given no access to the labels during test time. In a separate line of work, Baek et al. (2022) show that the ID and OOD agreement between clas- sifiers (i.e., the average extent to which two classifiers make the same prediction on an unlabeled datasets) show a strong linear correlation, akin to the same phenomenon showed for ID vs. OOD accuracy, demonstrated by Miller et al. (2021). Taken together, these phenomena, the so-called agreement-on-the-line (AGL) and accuracy-on-the-line (ACL) present a method for assessing OOD accuracy without labeled data. In this paper, we observe a noteworthy phenomenon: after applying TTA, AGL and ACL persist or even hold to a stronger degree than in their base counterparts. In other words, when we assess the accuracies and agreements of the models adapted to OOD data, the strong correlations in ID vs. OOD consistently hold across distribution shifts, including those where vanilla models do not exhibit such trends. Interestingly, these correlations occur not only when TTA improves OOD accuracy, but also when it fails to enhance or even negatively affects OOD accuracy, especially under real-world shifts. We observe such trends not just among the models with different architectures, but within those with same architecture but adapted with varying values of their adaptation hyperparameters, including learning rates, the number of adaptation steps, and others. These findings, with strong AGL and ACL after TTA, lead to the enhancement of TTA methods for improved reliability. We can first predict the effectiveness of TTA methods, i.e., whether they succeed or fail and to what extent, across distribution shifts. Specifically, our approach uses the ALine-S and ALine-D techniques from Baek et al. (2022), and applies them to test-time adapted models. The result is that, without any labeled data at all, we can estimate the accuracy of TTAed models better than we can for vanilla models, especially for shifts where vanilla falls short (estimation error of 14.22% in vanilla vs. 1.51% after TENT (Wang et al., 2021) on CIFAR10-C Gaussian Noise). Such estimation results also enable the identification of shifts where TTA methods might potentially struggle to improve accuracy, such as in ImageNetV2 (Recht et al., 2019). Second, we introduce a novel variant of the temperature-scaling method, which achieves model calibration solely through estimated accuracy, representing an unsupervised approach that eliminates the need for labeled data as required by the original temperature scaling (Guo et al., 2017). We observe that it effectively reduces the expected calibration error (ECE) (Guo et al., 2017) close to the best achievable lower- bound using ground-truth labels. Finally, we introduce the reliable hyperparameter optimization strategy for adaptations without access to labels: selecting model with the highest ID accuracy. Across all TTA baselines we employ, the majority of models chosen through our approach exhibit performance comparable to those selected using ground-truth labels, with an accuracy gap of less than 1% on CIFAR10-C. To summarize our contributions: 2 0.70.9CIFAR-10 Test0.10.30.50.70.9Gaussian NoiseVanillaAgreement, R2:0.16Accuracy, R2:0.00y=x0.50.70.9CIFAR-10 Test0.30.50.70.9SHOTAgreement, R2:0.84Accuracy, R2:0.850.50.70.9CIFAR-10 Test0.30.50.70.9TENTAgreement, R2:0.93Accuracy, R2:0.910.50.70.9CIFAR-10 Test0.30.50.70.9ETAAgreement, R2:0.95Accuracy, R2:0.950.30.50.70.9ImageNet Test0.10.30.5Gaussian NoiseVanillaAgreement, R2:0.01Accuracy, R2:0.35y=x0.30.50.70.9ImageNet Test0.10.30.50.7SHOTAgreement, R2:0.91Accuracy, R2:0.930.30.50.70.9ImageNet Test0.10.30.50.7TENTAgreement, R2:0.90Accuracy, R2:0.920.10.30.50.70.9ImageNet Test0.10.30.50.7ETAAgreement, R2:0.98Accuracy, R2:0.98 Figure 2: Across real-world shifts, such as CIFAR10.1, ImageNetV2, ImageNet-R, and FMoW- WILDS, the models after TTA maintain their strong linear trends. Notably, this observation also holds true despite possible accuracy degradation, e.g., on CIFAR10.1 and ImageNetV2 (See Ta- ble 2). • We observe that AGL and ACL trends between TTAed models persist or can be stronger than those before adaptation, and such trends robustly occur across models with different architectures and TTA setups under both synthetic and real-world shift datasets. • By leveraging this phenomenon in TTA, we enhance TTA methods in OOD accuracy pre- dictions, calibration, and reliable hyperparameter tuning-all without the need for labels. Our methods enhance OOD accuracy estimation for TTAed models across a broader range of shifts compared to those before adaptations, while also enabling the selection of highly accurate, well-calibrated models comparable to those using ground-truth labels. 2 STRONG AGREEMENT-ON-THE-LINE AFTER TTA This section presents the motivating finding of the paper, an empirical study highlighting the fact that TTAed models often exhibit better AGL than their vanilla counterparts. 2.1 EXPERIMENTAL SETUP Datasets and models. We evaluate on both synthetic corruptions (CIFAR10-C, CIFAR100-C, ImageNet-C (Hendrycks & Dietterich, 2019)) with highest severity, datasets reproductions (CI- FAR10.1 (Recht et al., 2018), CIFAR10.2 (Lu et al., 2020), ImageNetV2 (Recht et al., 2019)), and real-world shifts (ImageNet-R (Hendrycks et al., 2021), FMoW-WILDS (Christie et al., 2018; Sagawa et al., 2022)). We leverage a variety of different network architectures, which encompass ResNet (He et al., 2016; Zagoruyko & Komodakis, 2017), ResNext (Xie et al., 2016), VGG (Si- monyan & Zisserman, 2015), GoogLeNet (Szegedy et al., 2014), DenseNet (Huang et al., 2017), and MobileNet (Sandler et al., 2018) with differing depths and widths. For evaluation on ImageNet and its shifts, we use pretrained weights publicly accessible from torchvision1, except for ConjPL, which require training with polylos (Leng et al., 2022). We train models for the other datasets. Test-time adaptation baselines. To gain generality, we test TTA methods that involve differ- ent update parameters (e.g., batch normalization (BN) layers, entire encoder parameters), objec- tives (e.g., entropy minimization, self-supervision task), and source-training objectives (e.g., cross- entropy loss, polyloss). These include BN Adapt (Schneider et al., 2020), SHOT (Liang et al., 2020), TTT (Sun et al., 2020), TENT (Wang et al., 2021), ConjPL (Goyal et al., 2022), ETA (Niu et al., 2022), and SAR (Niu et al., 2023). We examine their key adaptation hyperparameters that are shared among all baselines, including learning rates, number of adapt steps, and batch size. We also test different checkpoints of the source-trained model as another possible hyperparameter to select. 1https://pytorch.org/vision/stable/models.html 3 0.70.9CIFAR-10 Test0.50.70.9CIFAR-10.1 TestVanillaAgreement, R2:0.85Accuracy, R2:0.89y=x0.70.9CIFAR-10 Test0.50.70.9TENTAgreement, R2:0.90Accuracy, R2:0.900.50.70.9ImageNet Test0.30.50.70.9ImageNetV2 TestVanillaAgreement, R2:0.97Accuracy, R2:0.960.50.70.9ImageNet Test0.30.50.70.9TENTAgreement, R2:0.98Accuracy, R2:0.990.50.70.9ImageNet Test0.10.30.50.70.9ImageNet-R TestVanillaAgreement, R2:0.78Accuracy, R2:0.830.50.70.9ImageNet Test0.10.30.50.70.9TENTAgreement, R2:0.96Accuracy, R2:0.910.30.50.70.9FMoW Test0.10.30.50.70.9FMoW-OOD TestVanillaAgreement, R2:0.97Accuracy, R2:0.960.30.50.70.9FMoW Test0.10.30.50.70.9TENTAgreement, R2:0.93Accuracy, R2:0.91 Figure 3: We observe strong AGL and ACL among models adapted with varying values of TTA setups, including learning rates, the number of adapt steps, batch sizes, and checkpoints of the source-trained model. We plot the results of TENT-adapted models on CIFAR10-C Gaussian Noise in the first row, and ETA-adapted models on ImageNet-C Gaussian Noise in the second row. Each point denote models using different values in each hyperparameter. Calculating agreement. Given any pair of models (h, h′) ∈ H that are tested on distribution D, the expected agreement of the models is defined as Agreement(h, h′) = E x∼D where h(x) and h′(x) are final classification outputs of models h and h′ given data x. Follow- ing Miller et al. (2021) and Baek et al. (2022), we apply the inverse of the cumulative density func- tion of the standard Gaussian distribution, namely probit-transformation (Φ−1 : [0, 1] → [−∞, ∞]), on the axes of accuracy and agreement, for a better linear fit. (cid:2)1{h(x) = h′(x)}(cid:3), (1) Additional details on experimental setups are provided in appendix A.1. 2.2 MAIN OBSERVATION Agreement (and accuracy) on-the-line persists or holds stronger after TTA. We find that after TTA methods, there are strong correlations in agreement (and accuracy) between ID and OOD across both synthetic and real-world shifts. Most importantly, we notice that such trends become more persistent after adaptations, exhibiting strong correlations even across datasets where the models before adaptations have failed to have, as noted in Miller et al. (2021) and Baek et al. (2022). We show such phenomenon in Figure 1, when tested on CIFAR10 test vs. Gaussian Noise cor- ruption, models with different architectures have weak correlations with their coefficients of de- termination (R2) values being significantly low. After applying various TTA methods, SHOT, TENT, and ETA, these models consistently have much stronger AGL and ACL (e.g., R2 improves 0.16 → 0.95, 0.00 → 0.95 after ETA), as well as the alignment between the lines. Furthermore, these linear trends also occur in real-world shifts, where TTA sometimes even fails to improve OOD accuracy, as shown in Figure 2. Here, we examine on CIFAR10.1, ImageNetV2, and ImageNet-R, and FMoW-WILDS, where models before and after TENT have similar linear trends and maintain high R2 values. In particular, as seen in the plots of CIFAR10.1 and ImageNetV2, TENT does not improve generalization, or even results in degradation (Wang et al., 2021; Zhao et al., 2023). This highlights the consistent AGL and ACL trends across TTA methods, irrespective of TTA's actual performance improvement across diverse distribution shifts where it may succeed or falter. Such linear trends are also observed when varying TTA hyperparameters. We find that these trends in TTA can also be obtained by leveraging models adapted with varying values of certain hyperparameters. As mentioned in Section 2.1, we examine learning rates, the number of adaptation steps, batch size, and the checkpoints of the source-trained model. Here we fix the model architecture while systematically varying specific hyperparameters within defined ranges (See appendix A.1). Figure 3 shows that models adapted with different hyperparam- eter values exhibit strong AGL trends among them, with their R2 values close to 1, when tested on 4 0.10.30.50.70.9CIFAR10 Test0.10.30.50.70.9Gaussian NoiseLearning RateAgreement, R2:1.00Accuracy, R2:1.000.10.30.50.70.9CIFAR10 Test0.10.30.50.70.9Adapt StepAgreement, R2:1.00Accuracy, R2:1.000.10.30.50.70.9CIFAR10 Test0.10.30.50.70.9Batch SizeAgreement, R2:1.00Accuracy, R2:1.000.50.70.9CIFAR10 Test0.30.50.70.9CheckpointAgreement, R2:0.98Accuracy, R2:0.960.10.30.50.70.9ImageNet Test0.10.30.50.70.9Gaussian NoiseLearning RateAgreement, R2:0.91Accuracy, R2:0.990.10.30.50.70.9ImageNet Test0.10.30.50.7Adapt StepAgreement, R2:0.90Accuracy, R2:0.990.10.30.50.70.9ImageNet Test0.10.30.50.70.9Batch SizeAgreement, R2:0.75Accuracy, R2:0.850.10.30.50.70.9ImageNet Test0.10.30.50.70.9CheckpointAgreement, R2:0.95Accuracy, R2:0.92 Dataset CIFAR10-C CIFAR100-C ImageNet-C ImageNet-R Method ATC DOC-feat 9.26 Vanilla 2.91 SHOT 9.21 TENT 10.18 ETA 1.14 SAR 5.20 Vanilla 4.49 SHOT 19.17 TENT 25.40 ETA 1.85 SAR 4.27 Vanilla 5.83 SHOT 10.92 TENT 6.34 ETA 7.04 SAR 1.72 Vanilla 5.29 SHOT 9.14 TENT 11.71 ETA 3.78 SAR 14.44 5.32 5.32 5.10 4.71 10.42 6.57 6.53 4.10 3.48 13.47 4.46 6.30 5.94 3.86 14.31 12.91 14.94 12.61 9.44 AC 16.74 9.94 10.08 11.02 7.76 14.35 18.34 21.96 28.32 16.68 17.76 9.84 20.25 23.56 11.00 17.74 17.85 24.10 34.12 13.49 Agreement ALine-S ALine-D 5.50 0.73 0.73 0.71 0.89 8.37 0.84 0.82 0.70 0.90 5.87 4.17 4.16 4.00 4.31 7.62 3.22 3.44 2.33 2.82 7.70 1.48 1.51 1.50 1.79 15.07 4.87 5.16 6.18 4.54 22.28 14.74 13.74 13.20 12.27 21.56 17.92 18.30 17.49 16.11 5.17 0.56 0.53 0.56 0.77 8.20 0.69 0.67 1.07 0.77 5.87 4.13 4.18 4.21 5.25 7.62 3.22 3.44 2.17 2.44 Table 1: Mean absolute error (MAE) (%) of the accuracy estimation on TTAed models with different architectures. ALine-S/D on TTAed models lead to substantially lower errors in accuracy estimation, compared to ALine-S/D applied on the vanilla models as well as other estimation baselines. CIFAR10 and ImageNet against their Gaussian Noise corruptions. The resulting TTA performances vary according to the different hyperparameter values, and they seem sensitive particularly in terms of learning rates and batch sizes. Still, these results, improved or degraded, lie on the same positive correlation line in both agreement and accuracy. Such linear trends are of significant practical value in TTA. Specifically, leveraging models with different architectures necessitates the training of them separately in advance, while simply using different values of hyperparameters on a single model can eliminate such unnecessary prerequisites. 3 RELIABLE TEST-TIME ADAPTATION Based on these observations, we investigate the enhancement of existing TTA methods in three ways: (i) accurate estimation of OOD accuracy, (ii) calibration after TTA, and (iii) reliable hyperparameter optimization – all performed without assuming access to the labels. 3.1 ACCURACY ESTIMATION Algorithm 1 Accurate Estimation of TTA 1: Inputs: Labeled ID data XID, YID, unlabeled OOD data XOOD, a set of ID-trained n models H = {hθ, ..., hθ}, sets PID = ∅, POOD = ∅. In this section, we illustrate how the strong AGL trend shown among TTAed models en- ables the precise accuracy estimation on tar- get OOD data. We employ the estima- tion methods, ALine-S and ALine-D in Baek et al. (2022), but utilize them within the context of TTA models. Specifically, we leverage the stronger correlations and align- ments in agreement and accuracy exhibited by TTAed models to enhance the effective- ness of these estimation methods. The de- tails of our TTA accuracy estimation proce- dure are described in Algorithm 1. This ap- proach yields improved accuracy estimation compared to vanilla models and other estimation baselines (Table 1). More importantly, we demon- strate the forecastability of TTAed models using the estimated accuracy, across various distribution shifts (Table 2). Details of ALine-S/D are provided in appendix A.2. 2: Algorithms: TTA objective LTTA(*), ALine-S/D(*). 3: 4: for batch xID, xOOD in XID, XOOD do 5: 6: 7: 8: 9: 10: end for 11: return ALine-S/D(cid:0)PID, YID, POOD θ ← θ − η∇LTTA(hθ(xOOD)) ▷ Apply TTA PID = PID ∪ hθ(xID) POOD = POOD ∪ hθ(xOOD) for hθ ∈ H do end for (cid:1) 5 Dataset SHOT TENT ETA SAR GT Est. GT Est. GT Est. GT Est. CIFAR10C-Snow CIFAR100C-Bright ImageNetC-Gauss ImageNet-R CIFAR10.1 CIFAR10.2 ImageNetV2 FMoW-WILDS +3.94 +6.59 +24.53 +6.94 -2.30 -1.70 -0.27 -0.22 +4.32 +8.28 +13.45 +2.70 -1.51 -1.64 -2.50 -0.73 +4.09 +6.79 +25.79 +6.19 -2.10 -1.80 -1.18 +0.37 +4.45 +8.24 +14.64 +2.52 -1.68 -1.65 -3.42 +1.03 +4.51 7.55 +30.25 +10.35 -2.25 -1.40 -10.34 +0.29 +4.69 +8.72 +22.82 +5.30 -1.33 -0.66 -12.60 +0.70 +2.54 +7.34 +31.28 +8.9 -2.30 -1.90 -0.21 +0.62 +2.80 +8.29 +22.19 +2.44 -1.56 -1.44 -2.40 +0.85 Table 2: Actual (GT) and estimated (Est.) improvement/degradation (%) in OOD accuracy after applying each TTA method with respect to their base counterparts. The values with green indicate the improvement, whiled red is the degradation. Our estimations consistently have the same predic- tions (i.e., colors) on whether TTA methods enhance or diminish accuracy across distribution shifts, enabling to forecast their generalizations without labeled data. Strong ACL and AGL in TTA lead to precise accuracy estimation. Table 1 reports the mean absolute error (MAE) between the actual and the estimated OOD accuracy for both vanilla and the adapted models using various TTA baselines. We evaluate them on widely used benchmarking distribution shifts in TTA literature, including CIFAR10-C, CIFAR100-C, ImageNet-C (averaged over corruptions), and ImageNet-R. Of particular note is that, especially in CIFAR10-C and CIFAR100-C, applying ALine-S/D on TTAed models achieve substantially lower MAE compared to that of vanilla models (e.g., 5.17% → 0.53% of ALine-D after TENT on CIFAR10-C). This suggests that application of ALine-S/D can be significantly more effective in estimating accuracy of the TTAed models, primarily attributed to their stronger AGL than vanilla models. We also compare them with other estimation baselines, such as average thresholded confidence (ATC) (Garg et al., 2021), difference of confidence (DOC)- feat (Guillory et al., 2021), average confidence (Hendrycks & Gimpel, 2017), and agreement (Jiang et al., 2022). We find that across different datasets, ALine-S and ALine-D consistently outperform existing baselines on estimating TTA performance. TTA effectiveness is forecastable given OOD datasets in the wild. Here, we extend to vari- ous datasets that include common corruptions in CIFAR10-C, CIFAR100-C, ImageNet-C, and real- world shifts, such as ImageNet-R, CIFAR10.1, CIFAR10.2, ImageNetV2, and FMoW-WILDS. In Table 2, we present actual and estimated OOD accuracy improvement or degradation by each TTA baseline, including SHOT, TENT, ETA, and SAR, with respect to their base counterparts. Specifi- cally, we first obtain the actual (by using ground-truth labels) and estimated OOD accuracy of both TTAed models and vanilla models, and calculate the differences between them. We initially observe that TTA methods sometimes fail to enhance generalization under real-world shifts, e.g., CIFAR10.1, CIFAR10.2 and ImageNetV2, as shown as red in columns of "GT", con- strated with their effectiveness in synthetic datasets, denoted as green. Interestingly, the overall trend of such relative accuracy changes after TTA, represented by red or green, in estimated OOD accuracy in the "Est." columns closely mirrors that of GT columns. For instance, the generalization trends of different TTA methods on FMoW-WILDS precisely align with those revealed in the esti- mated results, i.e., all TTA baselines except SHOT improve accuracy. This underscores the potential of our accuracy estimation on TTA, which offers practical guidance for selecting or determining the suitability of TTA methods in the face of distribution shifts from the wild, with no labeled data. We provide the details of estimation baselines (A.2) as well as additional analysis on accuracy esti- mation results (A.3, A.4) in appendix. 3.2 UNSUPERVISED CALIBRATION Proposed method. In this section, we introduce a variant of temperature-scaling (Guo et al., 2017) that calibrates models only with the estimated accuracy of the model, without any need for labeled data. Specifically, let X denote the random variable for input data and f (X) be the logit output of the neural network f given input X for classifying among c categories. We define a simple root-finding 6 Method CIFAR10-C Ours Uncalib. Oracle Uncalib. Oracle Uncalib. CIFAR100-C Ours ImageNet-C Ours Vanilla BN Adapt TENT ETA Vanilla∗ ConjPL 17.48 7.99 7.76 7.72 21.80 11.89 9.71 2.73 3.11 3.13 12.99 4.43 3.42 2.49 2.77 2.74 3.96 3.56 15.25 9.59 13.40 15.66 25.70 25.48 15.82 2.85 2.10 4.93 15.66 3.01 3.09 2.37 2.06 4.48 2.90 3.00 14.97 3.21 7.38 12.80 30.32 17.13 7.92 1.98 4.56 8.23 11.63 5.50 Oracle 1.79 1.67 2.94 7.40 2.03 3.84 Table 3: Expected calibration error (ECE) (%) of the vanilla, BN Adapt, TENT, ETA, and ConjPL without calibration method (named as "Uncalib."), using our method (named as "Ours") and the oracle lower-bound using ground-truth labels (named as "Oracle"). Vanilla and Vanilla∗ denote pretrained models with cross-entropy loss and polyloss respectively. After various TTA methods, our unsupervised calibration method significantly reduces the ECE compared to that of vanilla, manifesting negligible gap comparable to oracle-bound results. problem that finds an optimal temperature value τ which scales the model's averaged confidence to match the estimated accuracy Accest. This can be written as Find τ such that E (cid:20) max c softmax (cid:19)(cid:21) (cid:18) f (X) τ = Accest, (2) and we use Newton's method to solve this problem. Once the optimal τ is found, we then temperature-scale the f (X) using this value to have final prediction probability. Note that, instead of the negative log-likelihood loss used in the original temperature scaling method (Guo et al., 2017), our approach minimizes discrepancies between the model's averaged confidence and accuracy over the entire test set. This formulation bears analogy to the definition of the ECE metric (Guo et al., 2017), which calculates (a weighted average of) such discrepancies but within multiple confidence intervals. Our method can be regarded as directly minimizing such calibration error metric but using a single bin that includes the entire samples. Furthermore, it is worth noting that the standard temperature scaling methods (Guo et al., 2017) rely on a held-out labeled validation set for calibration predictions on test data, while our method leverages unlabeled test data directly for calibration. Experimental results. In Table 3, we present a comparison of the calibration error between vanilla and adapted models using various TTA methods, including BN Adapt, TENT, ETA, and ConjPL. In this experiment, we employ different checkpoints of a source-trained model, one of the hyperpa- rameters we observed for having strong AGL and ACL (Figure 3). Note that for ConjPL, we use the pretrained model with polyloss (Leng et al., 2022), thus we have "Vanilla" and "Vanilla∗" to dif- ferentiate models that are pretrained with cross-entropy and polyloss, respectively. For each model, we provide ECE values for (i) no calibration, (ii) calibration using our method, and (iii) calibration using an oracle approach. The "oracle" approach represents the lower-bound of the best achievable ECE through temperature scaling, where we sweep over the grids of temperature candidates and find τ that minimizes ECE using ground-truth labels. The results first demonstrate that adaptations via minimizing entropy can result in worse calibration, as evidenced by the "Uncalib." results for CIFAR100-C and ImageNet-C. In these cases, TENT, ETA, and ConjPL lead to an increase in ECE compared to that of BN Adapt. This indicates that models make overconfident predictions, particularly on samples that are incorrectly classified. This is mainly attributed to entropy minimization employed in TENT, ETA, and ConjPL, applied across all samples regardless of their correctness (Prabhu et al., 2021; Rusak et al., 2022; Chen et al., 2022). After applying our calibration method, however, their calibration errors substantially decrease to Interestingly, when we levels close to the lower-bound achieved by the oracle in every dataset. apply our method to vanilla models, where the presence of AGL and ACL are less pronounced, a substantial disparity still remains in the calibration results between our method and the lower bound represented by the oracle. This emphasizes the effectiveness of our unsupervised calibration method specifically in the setting of TTA where we observe prominent AGL and ACL. 7 HyperParameter TTA Method BN Adapt SHOT TENT ETA ConjPL SAR TTT Learning Rate Adapt Step Architecture Batch Size Checkpoints – – 0.21 0.0 0.0 0.65 0.23 0.03 0.73 0.07 0.72 0.23 0.03 0.77 0.05 0.72 0.24 0.01 0.77 0.01 0.42 0.12 0.04 0.18 0.11 0.24 0.43 0.20 0.06 0.01 3.71 0.04 0.49 – 0.48 Table 4: Mean Absolute Error (MAE) (%) between accuracies of models selected by our method vs. ground-truth, tested on the CIFAR10-C dataset. Since BN Adapt do not involve parameter updates, we exclude learning rate and the adaptation steps. In addition, TTT uses a single batch, and we exclude the batch size as well. Our analysis demonstrates that across TTA methods, our hyperparameter selection method consistently identifies hyperparameters that lead to TTAed models achieving OOD accuracy levels comparable to those selected using ground-truth labels. 3.3 RELIABLE HYPERPARAMETER OPTIMIZATION Given the ACL phenomena of TTAed models across varying hyperparameter values, as depicted in Figure 3, selecting the best-performing model on ID data emerges as a straightforward and effective strategy for model selection in OOD shifts. While this strategy has been acknowledged in a few prior studies (Miller et al., 2021; Wenzel et al., 2022), our contribution lies in its novel application for optimizing hyperparameters within the TTA framework. Notably, hyperparameter tuning has remained a significant challenge even in the most recent TTA studies (Boudiaf et al., 2022; Zhao et al., 2023), owing to the absence of OOD test data. To find the best hyperparameters, we first explore a wide range of hyperparameter candidates, by systematically sweeping through various values for each parameter. Then, we simply select the model that best performs in ID. Table 4 reports the OOD accuracy gap between the models selected by our approach vs. best- performing in OOD using ground-truth labels, tested on CIFAR10-C. The results show that across different corruptions and TTA baselines, selecting the best-performing hyperparameters in ID con- sistently results in models with high OOD accuracy less than 1% MAE compared to those selected with labeled data. Even for sensitive hyperparameters, such as learning rates and batch sizes, where incorrect selections can lead to significant performance degradation (as shown in Figure 3), our ap- proach consistently identifies near-optimal parameters for different TTA baselines. Still, in TTT where we vary different learning rates, our method fails to select optimal hyperparameters, resulting in large MAE. This failure is primarily attributed to the absence of a strong ACL among models us- ing varying learning rates, which is evidenced by Figure 4. We will discuss this failure case further in Section 5. 4 RELATED WORK Test-time adaptation and its pitfalls of reliability Test-time adaptation (TTA) enhances model robustness by adapting models to unlabeled test data. One research direction uses self-supervision tasks during both training and testing (Sun et al., 2020; Liu et al., 2021; Gandelsaman et al., 2022), while another explores "fully" test-time adaptations that require no specific pretraining procedures, relying on objectives such as entropy minimization (Wang et al., 2021; Niu et al., 2022; 2023), data augmentation invariance (Zhang et al., 2022; Chen et al., 2022), and self-training with pseudo- labels (Rusak et al., 2022; Goyal et al., 2022; Wang & Wibisono, 2023). Some studies have extended their evaluation beyond corruptions to include more challenging shifts, such as datasets reproductions (Liu et al., 2021; Zhang et al., 2022), domain generalization bench- marks (Iwasawa & Matsuo, 2021; Zhao et al., 2023), and WILDS (Rusak et al., 2022). Yet, as pointed out in Zhao et al. (2023), TTA methods may not effectively address the full spectrum of distribution shifts in the wild. Another persistent issue is that TTA, especially those based on en- tropy minimization, can lead to overconfident predictions. Specifically, while Nado et al. (2021) showed that using test-time batch statistics enhances calibration under distribution shifts (Ovadia et al., 2019), several work (Rusak et al., 2022; Chen et al., 2022) observed that entropy minimiza- tion diminishes this effect. Moreover, the performance of TTA methods can be severely impacted by the negligent selection of hyperparameters such as learning rates (Boudiaf et al., 2022; Zhao et al., 8 2023), adaptation steps (Zhao et al., 2023), or batch sizes (Niu et al., 2023; Khurana et al., 2022). A recent study (Boudiaf et al., 2022) addresses this issue by adapting only the model's outputs in- stead of its parameters. Our study leverages the remarkable observation of the agreement-on-the-line phenomena within TTA, offering promising solutions to these reliability issues. Accuracy and agreement-on-the-line As mentioned above, the basic accuracy-on-the-line and agreement-on-the-line phenomena were first identified in Miller et al. (2021) and Baek et al. (2022) respectively. However, the underlying reason for such phenomenon remain unclear, and certain datasets reveal weak accuracy and agreement-on-the-line trends, as observed in CIFAR10 test vs. Gaussian Noise corruption in CIFAR10-C. Recent work (Wenzel et al., 2022; Teney et al., 2023; Liang et al., 2023) have investigated the broader types of distribution shifts, identifying shifts that show different trends beyond the linear correlations. In this study, we investigate the impact of model adaptation on reinforcing (or maintaining) linear correlations, and identify novel conditions that lead to such trends–adapting with varying TTA hyperparameters. 5 LIMITATIONS Even though we consistently observe the linear trends across various models and distribution shifts during TTA, we also find an exceptional case where such trends do not manifest. As shown in Figure 4 right, we empirically observe that varying learning rates in TTT (Sun et al., 2020) exhibits that the ID and OOD accuracies are negatively correlated, leading to a complete misalignment with the agreement line. While in other experimental setups, such as using dif- ferent architectures, we still observe the strong AGL and ACL among the models, as shown in Figure 4 left. Such negative correlation results in the accuracy of the models selected using our method, i.e., best-performing ID accuracy, suf- fer significant deviation from the best-performing OOD accuracy, as shown in Table 4. Figure 4: Compared to the adapted models with varying architectures, using learning rates in TTT (Sun et al., 2020) shows negative correlation in accuracy, resulting in misalignment between agreement and accuracy lines. 6 CONCLUSION AND DISCUSSIONS In this work, we observe that adapting models during test time maintains or even reinforces the strong linear ID vs. OOD correlations in their accuracy and agreement, across models and dis- tributions. Such observations motivate us to enhance the TTA methods' reliability in surprisingly simple but effective ways, specifically in three perspectives: accurate performance estimation of TTA methods, calibration of confidence in TTAed models, and reliable hyperparameter tuning, all without need for labels. We conduct extensive experiments across distribution shifts, TTA baselines and their hyperparameters, and demonstrate the effective estimation of the TTAed models' perfor- mances. We then forecast their successes (as well as their possible failures) of generalization under various shifts including real-world datasets. Moreover, we perform model calibration and reliable hyperparameter optimization, achieving results comparable to the level of those assuming access to the ground-truth labels. Our results show that existing adaptation strategies under distribution shifts lead to strong AGL and ACL linear trends. This naturally raises questions about how to theoretically characterize the conditions under which adaptations enhance these linear trends. We believe this is a promising future research directions that can ascertain the reliable observations of AGL, leading to reliable TTA across any types of distribution shifts. Additionally, we recognize that, to observe AGL and ACL, access to ID test data (and its labels for ACL) is required. This might raise privacy concerns due to the potential inclusion of sensitive information, and also demand additional computational resources. Therefore, overcoming such dependencies on ID data and exploring "fully" test-time approach of observing AGL and ACL remain promising directions for future research. 9 0.70.9CIFAR10 Test0.70.9Gaussian NoiseArchitectureAgreement, R2:0.91Accuracy, R2:0.860.70.9CIFAR10 Test0.50.70.9Learning RateAgreement, R2:0.86Accuracy, R2:0.64 Acknowledgments. Eungyeup Kim and Mingjie Sun are supported by funding from the Bosch Center for Artificial Intelligence. Aditi Raghunathan gratefully acknowledges support from Open Philanthropy, Google, Apple and Schmidt AI2050 Early Career Fellowship. REFERENCES Martin Arjovsky, L ́eon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization, 2020. 1 Christina Baek, Yiding Jiang, Aditi Raghunathan, and J. Zico Kolter. Agreement-on-the-line: Pre- dicting the performance of neural networks under distribution shift. In Advances in Neural Infor- mation Processing Systems, volume 35, pp. 19274–19289, 2022. 1, 2, 4, 5, 9, 14 Malik Boudiaf, Romain Mueller, Ismail Ben Ayed, and Luca Bertinetto. Parameter-free online test- time adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 8344–8353, June 2022. 1, 8, 9 Dian Chen, Dequan Wang, Trevor Darrell, and Sayna Ebrahimi. Contrastive test-time adaptation. In CVPR, 2022. 1, 7, 8 Gordon Christie, Neil Fendley, James Wilson, and Ryan Mukherjee. Functional map of the world. In CVPR, 2018. 3 Cian Eastwood, Ian Mason, Christopher K. I. Williams, and Bernhard Sch ̈olkopf. Source-free adap- In International Conference on tation to measurement shift via bottom-up feature restoration. Learning Representations, 2022. 1 Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimiza- tion for efficiently improving generalization. In International Conference on Learning Represen- tations, 2021. 13 Yossi Gandelsaman, Yu Sun, Xinlei Chen, and Alexei A. Efros. Test-time training with masked autoencoders. In Advances in Neural Information Processing Systems, 2022. 1, 8 Saurabh Garg, Sivaraman Balakrishnan, Zachary Chase Lipton, Behnam Neyshabur, and Hanie Sedghi. Leveraging unlabeled data to predict out-of-distribution performance. In NeurIPS 2021 Workshop on Distribution Shifts: Connecting Methods and Applications, 2021. 6, 14 Sachin Goyal, Mingjie Sun, Aditi Raghunanthan, and Zico Kolter. Test-time adaptation via conju- gate pseudo-labels. Advances in Neural Information Processing Systems, 2022. 1, 3, 8, 13 Devin Guillory, Vaishaal Shankar, Sayna Ebrahimi, Trevor Darrell, and Ludwig Schmidt. Predicting with confidence on unseen distributions. In Proceedings of the IEEE/CVF International Confer- ence on Computer Vision (ICCV), pp. 1134–1144, October 2021. 6, 14 Ishaan Gulrajani and David Lopez-Paz. In search of lost domain generalization. In International Conference on Learning Representations, 2021. 1 Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger. On calibration of modern neural networks. In Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 1321–1330. PMLR, 06–11 Aug 2017. 2, 6, 7 Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. In Proceedings of 2016 IEEE Conference on Computer Vision and Pattern Recog- nition, CVPR '16, pp. 770–778. IEEE, June 2016. doi: 10.1109/CVPR.2016.90. 3, 13 Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common cor- ruptions and perturbations. Proceedings of the International Conference on Learning Represen- tations, 2019. 3, 13 Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. Proceedings of International Conference on Learning Representa- tions, 2017. 6, 14 10 Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, Dawn Song, Jacob Steinhardt, and Justin Gilmer. The many faces of robustness: A critical analysis of out-of-distribution generalization. ICCV, 2021. 3, 13 Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2017. 3, 13 Yusuke Iwasawa and Yutaka Matsuo. Test-time classifier adjustment module for model-agnostic domain generalization. In Advances in Neural Information Processing Systems, volume 34, pp. 2427–2440. Curran Associates, Inc., 2021. 1, 8 Yiding Jiang, Vaishnavh Nagarajan, Christina Baek, and J Zico Kolter. Assessing generalization of SGD via disagreement. In International Conference on Learning Representations, 2022. 6, 14 Ansh Khurana, Sujoy Paul, Piyush Rai, Soma Biswas, and Gaurav Aggarwal. Sita: Single image test-time adaptation, 2022. 9 Zhaoqi Leng, Mingxing Tan, Chenxi Liu, Ekin Dogus Cubuk, Jay Shi, Shuyang Cheng, and Dragomir Anguelov. Polyloss: A polynomial expansion perspective of classification loss func- tions. In International Conference on Learning Representations, 2022. 3, 7 Jian Liang, Dapeng Hu, and Jiashi Feng. Do we really need to access the source data? source hypothesis transfer for unsupervised domain adaptation. In International Conference on Machine Learning (ICML), pp. 6028–6039, 2020. 1, 3, 13 Weixin Liang, Yining Mao, Yongchan Kwon, Xinyu Yang, and James Zou. Accuracy on the curve: On the nonlinear correlation of ml performance between data subpopulations, 2023. 9 Yuejiang Liu, Parth Kothari, Bastien Germain van Delft, Baptiste Bellot-Gurlet, Taylor Mordan, and Alexandre Alahi. Ttt++: When does self-supervised test-time training fail or thrive? In Thirty-Fifth Conference on Neural Information Processing Systems, 2021. 1, 8, 13 Shangyun Lu, Bradley Nott, Aaron Olson, Alberto Todeschini, Hossein Vahabi, Yair Carmon, and Ludwig Schmidt. Harder or different? a closer look at distribution shift in dataset reproduction. In ICML Workshop on Uncertainty and Robustness in Deep Learning, 2020. 3, 13 John P Miller, Rohan Taori, Aditi Raghunathan, Shiori Sagawa, Pang Wei Koh, Vaishaal Shankar, Percy Liang, Yair Carmon, and Ludwig Schmidt. Accuracy on the line: on the strong corre- lation between out-of-distribution and in-distribution generalization. In Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 7721–7735. PMLR, 18–24 Jul 2021. 2, 4, 8, 9, 13 Zachary Nado, Shreyas Padhy, D. Sculley, Alexander D'Amour, Balaji Lakshminarayanan, and Jasper Snoek. Evaluating prediction-time batch normalization for robustness under covariate shift, 2021. 8 Shuaicheng Niu, Jiaxiang Wu, Yifan Zhang, Yaofo Chen, Shijian Zheng, Peilin Zhao, and Mingkui Tan. Efficient test-time model adaptation without forgetting. In The Internetional Conference on Machine Learning, 2022. 1, 3, 8, 13 Shuaicheng Niu, Jiaxiang Wu, Yifan Zhang, Zhiquan Wen, Yaofo Chen, Peilin Zhao, and Mingkui Tan. Towards stable test-time adaptation in dynamic wild world. In Internetional Conference on Learning Representations, 2023. 1, 3, 8, 9, 13 Yaniv Ovadia, Emily Fertig, Jie Ren, Zachary Nado, D. Sculley, Sebastian Nowozin, Joshua Dillon, Balaji Lakshminarayanan, and Jasper Snoek. Can you trust your model's uncertainty? evaluating predictive uncertainty under dataset shift. In Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. 8 Viraj Prabhu, Shivam Khare, Deeksha Kartik, and Judy Hoffman. Sentry: Selective entropy opti- mization via committee consistency for unsupervised domain adaptation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 8558–8567, 2021. 7 11 Benjamin Recht, Rebecca Roelofs, Ludwig Schimidt, and Vaishaal Shankar. Do cifar-10 classifiers generalize to cifar-10? arXiv preprint arXiv: 1806.00451, 2018. 3, 13 Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do ImageNet classifiers generalize to ImageNet? In Proceedings of the 36th International Conference on Machine Learn- ing, volume 97 of Proceedings of Machine Learning Research, pp. 5389–5400. PMLR, 09–15 Jun 2019. 2, 3, 13 Evgenia. Rusak, Steffen Schneider, George Pachitariu, Luisa Eck, Peter Gehler, Oliver Bringmann, Wieland Brendel, and Matthias Bethge. If your data distribution shifts, use self-learning. Trans- actions of Machine Learning Research, 2022. 1, 7, 8 Shiori Sagawa, Pang Wei Koh, Tony Lee, Irena Gao, Sang Michael Xie, Kendrick Shen, Ananya Kumar, Weihua Hu, Michihiro Yasunaga, Henrik Marklund, Sara Beery, Etienne David, Ian Stavness, Wei Guo, Jure Leskovec, Kate Saenko, Tatsunori Hashimoto, Sergey Levine, Chelsea Finn, and Percy Liang. Extending the wilds benchmark for unsupervised adaptation. In Interna- tional Conference on Learning Representations (ICLR), 2022. 1, 3, 13 Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mo- bilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018. 3, 13 Steffen Schneider, Evgenia Rusak, Luisa Eck, Oliver Bringmann, Wieland Brendel, and Matthias Bethge. In Advances in Neural Information Processing Systems, volume 33, pp. 11539–11551. Curran As- sociates, Inc., 2020. 1, 3, 13 Improving robustness against common corruptions by covariate shift adaptation. Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations, 2015. 3, 13 Yu Sun, Xiaolong Wang, Zhuang Liu, John Miller, Alexei A. Efros, and Moritz Hardt. Test-time training with self-supervision for generalization under distribution shifts. In International Con- ference on Machine Learning (ICML), 2020. 1, 3, 8, 9, 13 Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Du- mitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions, 2014. 3 Damien Teney, Yong Lin, Seong Joon Oh, and Ehsan Abbasnejad. sometimes inversely correlated on real-world datasets, 2023. 9 Id and ood performance are Dequan Wang, Evan Shelhamer, Shaoteng Liu, Bruno Olshausen, and Trevor Darrell. Tent: Fully test-time adaptation by entropy minimization. In International Conference on Learning Repre- sentations, 2021. 1, 2, 3, 4, 8, 13 Jun-Kun Wang and Andre Wibisono. Towards understanding gd with hard and conjugate pseudo- labels for test-time adaptation. In Internetional Conference on Learning Representations, 2023. 8 Florian Wenzel, Andrea Dittadi, Peter V. Gehler, Carl-Johann Simon-Gabriel, Max Horn, Dominik Zietlow, David Kernert, Chris Russell, Thomas Brox, Bernt Schiele, Bernhard Sch ̈olkopf, and Francesco Locatello. Assaying out-of-distribution generalization in transfer learning. In Neural Information Processing Systems, 2022. 8, 9 Saining Xie, Ross Girshick, Piotr Doll ́ar, Zhuowen Tu, and Kaiming He. Aggregated residual trans- formations for deep neural networks. arXiv preprint arXiv:1611.05431, 2016. 3, 13 Sergey Zagoruyko and Nikos Komodakis. Wide residual networks, 2017. 3, 13 Marvin Zhang, Sergey Levine, and Chelsea Finn. MEMO: Test time robustness via adaptation and augmentation. In Advances in Neural Information Processing Systems, 2022. 1, 8 Hao Zhao, Yuejiang Liu, Alexandre Alahi, and Tao Lin. On pitfalls of test-time adaptation. In International Conference on Machine Learning (ICML), 2023. 1, 4, 8, 9, 13 12 A APPENDIX A.1 EXPERIMENTAL SETUP This section provides the experimental details used throughout the paper, including distribution shifts, network architectures, and adaptation setups. Distribution shifts. We test the models on 8 different distribution shifts that include synthetic corruptions and real-world shifts. Synthetic corruptions datasets, CIFAR10-C, CIFAR100-C, and ImageNet-C (Hendrycks & Dietterich, 2019) are designed to apply the 15 different types of cor- ruptions, such as Gaussian Noise, on their original dataset counterparts. We use the most severe corruptions, which have severity of 5, in all experiments. These corruptions datasets are most com- monly evalutated distribution shifts in a wide range of TTA papers (Schneider et al., 2020; Sun et al., 2020; Liu et al., 2021; Liang et al., 2020; Wang et al., 2021; Goyal et al., 2022; Niu et al., 2022; 2023; Zhao et al., 2023). We also test on real-world shifts, which include CIFAR10.1 (Recht et al., 2018), CIFAR10.2 (Lu et al., 2020), ImageNetV2 (Recht et al., 2019), ImageNet-R (Hendrycks et al., 2021), and FMoW- WILDS (Sagawa et al., 2022). CIFAR10.1, CIFAR10.2, and ImageNetV2 are the reproduced datasets of their base counterparts by following the original dataset creation procedures. ImageNet- R is the variant of ImageNet which contains the images with renditions of various styles, such as paintings or cartoons. FMoW-WILDS (Sagawa et al., 2022) contains the spatio-temporal satellite imagery of 62 different use of land or building categories, where distribution shifts originate from the years that the imagery is taken. Specifically, following Miller et al. (2021), we use ID set consists of images taken from 2002 to 2013, and OOD set taken between 2013 and 2016. Network architectures. We use a different set of the network architectures for specific datasets and their shifts in Sections 2 and 3.1. Specifically, for CIFAR10 and CIFAR100 vs. their OOD shifts, we use ResNet-18,26,34,50,101 (He et al., 2016), WideResNet-28-10 (Zagoruyko & Komodakis, 2017), MobileNetV2 (Sandler et al., 2018), VGG11,13,16,19 (Simonyan & Zis- serman, 2015). For ImageNet and FMoW-WILDS vs. their OOD shifts, we leverage ResNet- 18,34,50,101,152, WideResNet-50,101, DenseNet121 (Huang et al., 2017), ResNeXt50-32x4d (Xie et al., 2016). As mentioned in Section 2.1, we use the pretrained model weights from torchvision, except for TTT (Sun et al., 2020) and ConjPL (Goyal et al., 2022). In addition, since TTT requires the rotation-prediction task during pretraining on source data, we train them ourselves using ResNet- 14,26,32,50,104, and 152, which are available in their original implementation2 and use them for Section 3.3. For Figure 3 and Tables 2, 3, and 4, we use the default network architecture, which is ResNet-26 for CIFAR10 and CIFAR100, and ResNet-50 for ImageNet and FMoW. Optimizer and learning rates. We use SGD optimizer with momentum of 0.9 for all TTA base- lines except for SAR, which uses sharpness-aware minimization (SAM) optimizer (Foret et al., 2021). For Tables 1, 4, and Figure 3, we adapt the models adapted with different learning rates. Specifically, for Table 1, we evaluate the models with different architectures but adapted with the same learning rates, and then we average their estimation results across learning rates. For Ta- ble 4 and Figure 3, we evaluate the models (with same architecture) adapted with different learn- ing rates, and observe the linear trends. For these experiments, we sweep over in the grid of {10−4, 2 * 10−4, 5 * 10−4, 10−3, 2 * 10−3, 5 * 10−3, 10−2} for CIFAR10, CIFAR100, and their OOD shifts, while using {5 * 10−5, 10−4, 2 * 10−4, 5 * 10−4, 10−3, 2 * 10−3, 5 * 10−3} for ImageNet and their OOD counterparts. For Figures 1, 2 and Tables 2, 3, we use the fixed learning rates of 10−3 for CIFAR10, CIFAR100 and their OOD counterparts, and 2.5 * 10−4 for ImageNet, FMoW and their counterparts. Batch sizes. In Figure 3 and Table 4, we test a wide spectrum of different values of batch sizes, by sweeping over the grid of {1, 2, 4, 8, 16, 32, 64, 128, 256, 512}. For the rest of the experiments, we fix the batch size of 128 for TTA on CIFAR10, CIFAR100 and their OOD, and 64 on ImageNet, FMoW for their OOD. Note that for TTT, we use a single batch following the original paper setup. 2https://github.com/yueatsprograms/ttt cifar release 13 Algorithm 2 ALine-S and ALine-D 1: Input: ID predictions PID and labels YID, OOD predictions POOD. 2: Function: Probit transform Φ−1(*), Linear regression F(*). 3: 4: ˆa, ˆb = F(Φ−1(Agr(PID)), Φ−1(Agr(POOD))) OOD = Φ(ˆa * Acc(PID, yID) + ˆb) 5: (cid:100)Acc 6: Initialize A ∈ R n(n−1) 7: i=0 8: for (pj,ID, pk,ID), (pj,OOD, pk,OOD) ∈ PID, POOD do 9: 2 ×n, b = R n(n−1) S 2 2 , Aik = 1 Aij = 1 bi = Φ−1(Agr(pj,OOD, pk,OOD))+ ˆa*(cid:0) Φ−1(Acc(pj,ID,yID)+Φ−1(Acc(pk,ID,yID)) i=i+1 2 , Ail = 0∀l /∈ j, k 2 10: 11: 12: end for 13: w∗ = arg minw∈Rn ||Aw − b||2 14: (cid:100)Acc 15: return (cid:100)Acc D OOD = Φ(w∗ S OOD, (cid:100)Acc i )∀i ∈ [n] D OOD 2 ▷ Estimate slope and bias of linear fit ▷ ALine-S −Φ−1(Agr(pj,ID, pk,ID))(cid:1) ▷ ALine-D Number of adapt steps. In Figure 3 and Table 4, we sweep through one to five adaptation steps for every TTA baseline we use. For the rest of the experiments, we use a single step of the adaptations. We utilize the online adaptation (i.e., no initialization for each batch) strategy for all baselines. A.2 OOD ACCURACY ESTIMATION METHODS ALine-S and ALine-D Baek et al. (2022) propose ALine-S and ALine-D, which assess the mod- els' OOD accuracy without access to labels by leveraging the agreement-on-the-line among models. We provide the detailed algorithm of ALine-S and ALine-D in Algorithm 2. Average thresholded confidence (ATC) Garg et al. (2021) introduce OOD accuracy estimation method, ATC, which learns the confidence threshold and predicts the OOD accuracy by using the fraction of unlabeled OOD samples for which model's negative entropy is less that threshold. Specif- ically, let h(x) ∈ Rc denote the softmax output of model h given data x from XOOD for classifying among c classes. The method can be written as below: (cid:100)AccOOD = E (cid:2)1{s(h(x)) < t}(cid:3), where s is the negative entropy, i.e., s(h(x)) = (cid:80) c hc(x) log(hc(x)), and t satisfies E (cid:2)1{s(h(x)) < t}(cid:3) = E (cid:2)1(cid:8) arg max c hc(x) ̸= y(cid:9)(cid:3). (3) (4) Difference of confidence (DOC)-feat Guillory et al. (2021) observe that the shift of distributions is encoded in the difference of model's confidences between them. Based on this observation, they leverage such differences in confidences as the accuracy gap under distribution shifts for calculating the final OOD accuracy. Specifically, (cid:100)AccOOD = AccID − (cid:18) E (cid:2) max c hc(xID)(cid:3) − E (cid:2) max c (cid:19) hc(xOOD)(cid:3) (5) Average confidence (AC) Hendrycks & Gimpel (2017) estimate the OOD accuracy based on model's averaged confidence, which can be written as (cid:100)AccOOD = E (cid:2) max h(xOOD)(cid:3). (6) c Agreement Jiang et al. (2022) observe that disagreement between the models that are trained with different setups closely tracks the error of models in ID. We adopt this as the baseline for assessing generalization under distribution shifts, where we can estimate (cid:100)AccOOD = Agr(POOD), where POOD denotes the set of predictions of the models on OOD data XOOD. 14 Figure 5: Comparison of GT vs. estimated OOD accuracy of vanilla and TTAed models under real- world shifts. Each pink dot represents vanilla, blue the TENT, orange the ETA, and gray the SAR results. The dotted y = x line denotes the perfect estimation line, where the closer dots are located to the line, the more accurate the estimations are. Figure 6: Distribution of MAE of accuracy estimation over different number of models. We test models adapted with different TTA setups. The results on first row are those adapted by TENT on CIFAR10-C Gaussian Noise, and those on second row are adapted by ETA on ImageNet-C Gaussian Noise. A.3 ACCURACY ESTIMATION RESULTS ON REAL-WORLD SHIFTS. Given the strong AGL and ACL trends that persist under real-world shifts (Figure 2), we demonstrate the estimation results of the TTAed models' OOD accuracy by comparing them with the ground- truth accuracy on such shifts. In Figure 5, we compare the estimated and ground-truth OOD accuracy of vanilla and the adapted models using TENT, ETA, and SAR. It shows that their accuracies can be closely estimated to the actual accuracies (i.e., closer to y = x) on CIFAR10.1, ImageNetV2, ImageNet-R, and FMoW-WILDS. In particular, as shown in ImageNetV2 and ImageNet-R, the estimation results of TTAed models are located closer to y = x than those of vanilla, indicating TTAed models' accurate estimation performances compared to those of vanilla models. A.4 ANALYSIS ON THE NUMBER OF TTAED MODELS FOR ACCURATE ESTIMATION. In this section, we investigate how the accuracy estimation of test-time adapted model's perfor- mances change as we vary the number of the models used in estimation. To this end, we examine the models with different architectures as well as the hyperparameters examined in Section 3.3, which include learning rates, batch sizes, and the checkpoints of the source-trained models. We vary the size of models, n, and for each size, we calculate all possible sets of models' estimation error. Figure 6 illustrates the changes of the distributions of the estimation error (MAE) with respect to the number of models used for implementing AGL and ACL. We test TENT on CIFAR10 test vs. ImageNet-C Gaussian Noise. We CIFAR10-C Gaussian Noise, and ETA on ImageNet test vs. observe that even using the minimum number of models for estimation, which is three, the estimation results achieve the low MAE, particularly when using different architectures or the checkpoints of the source-trained models. In addition, we note the rapid decrease in MAE is easily attainable by adding only a small number of additional models, which is pronounced when using learning rates 15 0.70.9GT OOD Acc0.9Est. OOD AccCIFAR-10.1vanillatentetasary=x0.50.7GT OOD Acc0.50.7ImageNetV2vanillatentetasar0.30.5GT OOD Acc0.5ImageNet-Rvanillatentetasar0.5GT OOD Acc0.5FMoW-WILDSvanillatentetasar3456789101112Number of Models1.01.52.02.53.0MAE (%)ArchitectureALine-SALine-D345678910Number of Models0510152025Learning RateALine-SALine-D3456789Number of Models1234Batch SizeALine-SALine-D345678910Number of Models0.250.500.751.001.251.50CheckpointALine-SALine-D3456789Number of Models1234MAE (%)ArchitectureALine-SALine-D34567Number of Models2.55.07.510.012.515.0Learning RateALine-SALine-D345678Number of Models0246810Batch SizeALine-SALine-D345678910Number of Models02468CheckpointALine-SALine-D or batch size (in ImageNet-C). These results indicate that during TTA, accurate estimation of OOD accuracy can be achieved with a reasonable number of models, each with different hyperparameter values, thereby offering practical feasibility during testing. A.5 ADDITIONAL EXPERIMENTAL RESULTS Strong ACL and AGL after TTA. In this section, we supplement the Section 2 by providing additional results of TTAed models exhibiting strong AGL and ACL linear trends across datasets and TTA methods. Specifically, in Figures 7 and 8, we provide the results of SHOT, TENT, ETA, and SAR comparing with those of vanilla, across every corruption types of CIFAR10-C with highest severity. The axes are probit-scaled, and each blue and pink dot represent the accuracy and agree- ment of the model, respectively. In Figure 9, we add the results on CIFAR10.2 along with other TTA methods' results on the real-world shifts to supplement the Figure 2. We consistently observe that AGL and ACL consistently persist or even become stronger than vanilla models, when apply- ing various TTA methods across distribution shifts, evidenced by the high R2 values in most of the cases. 16 Figure 7: Additional results across every corruption types of CIFAR10-C, where models after TTA show strong AGL and ACL than vanilla models. 17 0.70.9CIFAR-10 Test0.10.30.50.70.9Gaussian NoiseVanillaAgreement, R2:0.09Accuracy, R2:0.07y=x0.50.70.9CIFAR-10 Test0.30.50.70.9SHOTAgreement, R2:0.77Accuracy, R2:0.660.50.70.9CIFAR-10 Test0.30.50.70.9TENTAgreement, R2:0.80Accuracy, R2:0.680.50.70.9CIFAR-10 Test0.30.50.70.9ETAAgreement, R2:0.94Accuracy, R2:0.900.50.70.9CIFAR-10 Test0.50.70.9SARAgreement, R2:0.54Accuracy, R2:0.370.70.9CIFAR-10 Test0.10.30.50.70.9Shot NoiseAgreement, R2:0.10Accuracy, R2:0.05y=x0.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.82Accuracy, R2:0.720.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.84Accuracy, R2:0.750.50.70.9CIFAR-10 Test0.30.50.70.9Agreement, R2:0.89Accuracy, R2:0.890.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.65Accuracy, R2:0.570.70.9CIFAR-10 Test0.10.30.50.70.9Impulse NoiseAgreement, R2:0.19Accuracy, R2:0.16y=x0.50.70.9CIFAR-10 Test0.30.50.70.9Agreement, R2:0.86Accuracy, R2:0.750.50.70.9CIFAR-10 Test0.30.50.70.9Agreement, R2:0.92Accuracy, R2:0.750.50.70.9CIFAR-10 Test0.30.50.70.9Agreement, R2:0.91Accuracy, R2:0.880.50.70.9CIFAR-10 Test0.30.50.70.9Agreement, R2:0.68Accuracy, R2:0.530.70.9CIFAR-10 Test0.50.70.9Defocus BlurAgreement, R2:0.91Accuracy, R2:0.94y=x0.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.95Accuracy, R2:0.940.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.94Accuracy, R2:0.940.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.91Accuracy, R2:0.930.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.94Accuracy, R2:0.930.70.9CIFAR-10 Test0.30.50.70.9Glass BlurAgreement, R2:0.00Accuracy, R2:0.64y=x0.50.70.9CIFAR-10 Test0.30.50.70.9Agreement, R2:0.85Accuracy, R2:0.690.50.70.9CIFAR-10 Test0.30.50.70.9Agreement, R2:0.76Accuracy, R2:0.540.50.70.9CIFAR-10 Test0.30.50.70.9Agreement, R2:0.94Accuracy, R2:0.930.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.85Accuracy, R2:0.700.70.9CIFAR-10 Test0.50.70.9Motion BlurAgreement, R2:0.57Accuracy, R2:0.01y=x0.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.93Accuracy, R2:0.960.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.86Accuracy, R2:0.900.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.95Accuracy, R2:0.960.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.93Accuracy, R2:0.910.70.9CIFAR-10 Test0.50.70.9Zoom blurAgreement, R2:0.83Accuracy, R2:0.81y=x0.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.90Accuracy, R2:0.940.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.88Accuracy, R2:0.890.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.94Accuracy, R2:0.950.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.93Accuracy, R2:0.94 Figure 8: Additional results across every corruption types of CIFAR10-C, where models after TTA show strong AGL and ACL than vanilla models. 18 0.70.9CIFAR-10 Test0.50.70.9SnowVanillaAgreement, R2:0.74Accuracy, R2:0.66y=x0.50.70.9CIFAR-10 Test0.50.70.9SHOTAgreement, R2:0.92Accuracy, R2:0.920.50.70.9CIFAR-10 Test0.50.70.9TENTAgreement, R2:0.94Accuracy, R2:0.910.50.70.9CIFAR-10 Test0.50.70.9ETAAgreement, R2:0.96Accuracy, R2:0.960.70.9CIFAR-10 Test0.50.70.9SARAgreement, R2:0.95Accuracy, R2:0.940.70.9CIFAR-10 Test0.50.70.9FrostAgreement, R2:0.39Accuracy, R2:0.24y=x0.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.94Accuracy, R2:0.950.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.88Accuracy, R2:0.920.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.98Accuracy, R2:0.980.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.91Accuracy, R2:0.910.70.9CIFAR-10 Test0.30.50.70.9FogAgreement, R2:0.71Accuracy, R2:0.54y=x0.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.94Accuracy, R2:0.900.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.94Accuracy, R2:0.900.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.91Accuracy, R2:0.920.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.91Accuracy, R2:0.860.70.9CIFAR-10 Test0.50.70.9BrightnessAgreement, R2:0.91Accuracy, R2:0.88y=x0.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.93Accuracy, R2:0.960.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.94Accuracy, R2:0.950.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.97Accuracy, R2:0.960.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.96Accuracy, R2:0.970.70.9CIFAR-10 Test0.10.30.50.70.9ContrastAgreement, R2:0.77Accuracy, R2:0.51y=x0.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.92Accuracy, R2:0.920.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.89Accuracy, R2:0.860.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.91Accuracy, R2:0.900.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.89Accuracy, R2:0.870.70.9CIFAR-10 Test0.50.70.9Elastic TransformAgreement, R2:0.45Accuracy, R2:0.00y=x0.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.86Accuracy, R2:0.710.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.75Accuracy, R2:0.650.50.70.9CIFAR-10 Test0.30.50.70.9Agreement, R2:0.93Accuracy, R2:0.890.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.78Accuracy, R2:0.910.70.9CIFAR-10 Test0.30.50.70.9PixelateAgreement, R2:0.22Accuracy, R2:0.16y=x0.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.90Accuracy, R2:0.930.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.85Accuracy, R2:0.920.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.96Accuracy, R2:0.970.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.97Accuracy, R2:0.970.70.9CIFAR-10 Test0.50.70.9Jpeg CompressionAgreement, R2:0.29Accuracy, R2:0.30y=x0.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.74Accuracy, R2:0.540.50.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.83Accuracy, R2:0.730.50.70.9CIFAR-10 Test0.30.50.70.9Agreement, R2:0.90Accuracy, R2:0.840.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.51Accuracy, R2:0.05 Figure 9: Additional TTA baselines' results under real-world shifts, CIFAR10.1, CIFAR10.2, Ima- geNetV2, ImageNet-R, and FMoW-WILDS, where models after TTA persist strong AGL and ACL. 19 0.70.9CIFAR-10 Test0.70.9CIFAR-10.1VanillaAgreement, R2:0.85Accuracy, R2:0.89y=x0.70.9CIFAR-10 Test0.70.9SHOTAgreement, R2:0.83Accuracy, R2:0.810.70.9CIFAR-10 Test0.70.9TENTAgreement, R2:0.82Accuracy, R2:0.810.70.9CIFAR-10 Test0.70.9ETAAgreement, R2:0.77Accuracy, R2:0.800.70.9CIFAR-10 Test0.50.70.9SARAgreement, R2:0.90Accuracy, R2:0.890.70.9CIFAR-10 Test0.50.70.9CIFAR-10.2Agreement, R2:0.77Accuracy, R2:0.910.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.80Accuracy, R2:0.660.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.79Accuracy, R2:0.700.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.82Accuracy, R2:0.720.70.9CIFAR-10 Test0.50.70.9Agreement, R2:0.83Accuracy, R2:0.840.50.70.9ImageNet Test0.30.50.70.9ImageNetV2Agreement, R2:0.97Accuracy, R2:0.960.50.70.9ImageNet Test0.30.50.70.9Agreement, R2:0.97Accuracy, R2:0.990.50.70.9ImageNet Test0.30.50.70.9Agreement, R2:0.98Accuracy, R2:0.990.50.70.9ImageNet Test0.30.50.70.9Agreement, R2:0.98Accuracy, R2:0.990.50.70.9ImageNet Test0.30.50.70.9Agreement, R2:0.98Accuracy, R2:0.990.50.70.9ImageNet Test0.10.30.50.7ImageNet-RAgreement, R2:0.78Accuracy, R2:0.830.50.70.9ImageNet Test0.10.30.50.7Agreement, R2:0.94Accuracy, R2:0.900.50.70.9ImageNet Test0.10.30.50.70.9Agreement, R2:0.95Accuracy, R2:0.900.50.70.9ImageNet Test0.10.30.50.70.9Agreement, R2:0.96Accuracy, R2:0.910.50.70.9ImageNet Test0.10.30.50.7Agreement, R2:0.86Accuracy, R2:0.810.30.50.70.9FMoW Test0.30.50.7FMoW-OODAgreement, R2:0.97Accuracy, R2:0.960.30.50.7FMoW Test0.30.50.7Agreement, R2:0.94Accuracy, R2:0.940.30.50.7FMoW Test0.30.50.7Agreement, R2:0.95Accuracy, R2:0.950.30.50.7FMoW Test0.30.50.7Agreement, R2:0.93Accuracy, R2:0.910.30.50.7FMoW Test0.30.50.7Agreement, R2:0.96Accuracy, R2:0.95
http://arxiv.org/abs/2310.04935v1
"2023-10-07T22:35:26"
"2023-10-07T22:35:26"
Statistical Guarantees for Variational Autoencoders using PAC-Bayesian Theory
Since their inception, Variational Autoencoders (VAEs) have become central in machine learning. Despite their widespread use, numerous questions regarding their theoretical properties remain open. Using PAC-Bayesian theory, this work develops statistical guarantees for VAEs. First, we derive the first PAC-Bayesian bound for posterior distributions conditioned on individual samples from the data-generating distribution. Then, we utilize this result to develop generalization guarantees for the VAE's reconstruction loss, as well as upper bounds on the distance between the input and the regenerated distributions. More importantly, we provide upper bounds on the Wasserstein distance between the input distribution and the distribution defined by the VAE's generative model.
[ "Sokhna Diarra Mbacke", "Florence Clerc", "Pascal Germain" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04935v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04935v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "stat.ML" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 5 3 9 4 0 . 0 1 3 2 : v i X r a Statistical Guarantees for Variational Autoencoders using PAC-Bayesian Theory Sokhna Diarra Mbacke Université Laval sokhna-diarra.mbacke.1@ulaval.ca Florence Clerc McGill University florence.clerc@mail.mcgill.ca Pascal Germain Université Laval pascal.germain@ift.ulaval.ca Abstract Since their inception, Variational Autoencoders (VAEs) have become central in machine learning. Despite their widespread use, numerous questions regarding their theoretical properties remain open. Using PAC-Bayesian theory, this work develops statistical guarantees for VAEs. First, we derive the first PAC-Bayesian bound for posterior distributions conditioned on individual samples from the data- generating distribution. Then, we utilize this result to develop generalization guarantees for the VAE's reconstruction loss, as well as upper bounds on the distance between the input and the regenerated distributions. More importantly, we provide upper bounds on the Wasserstein distance between the input distribution and the distribution defined by the VAE's generative model. 1 Introduction In recent years, deep generative models have exhibited tremendous empirical success. Two of the most important families of generative models are Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) and Variational Autoencoders (Kingma and Welling, 2014; Rezende et al., 2014). GANs take an adversarial approach, whereas VAEs are based on maximum likelihood estimation and variational inference. VAEs comprise two main components: an encoder which parameterizes an approximation of the posterior distribution over the latent variables, and a decoder which parameterizes the likelihood. In addition to generative modelling tasks such as image generation (Vahdat and Kautz, 2020) and text generation (Bowman et al., 2016), VAEs have been successfully applied to other topics such as semi-supervised learning (Kingma et al., 2014), anomaly detection (An and Cho, 2015), and dimensionality reduction (Kaur et al., 2021). However, despite their empirical success, the question of statistical guarantees for the performance of VAEs remains largely open. Namely, how can one certify that VAEs generalize well, both in terms of reconstruction and generation? PAC-Bayesian theory (McAllester, 1999; Catoni, 2003) is an influential tool of statistical learning theory dedicated to providing generalization bounds for machine learning models. PAC-Bayes has been applied to a wide variety of problems such as classification (Germain et al., 2009; Parrado- Hernández et al., 2012), meta-learning (Amit and Meir, 2018), co-clustering (Seldin and Tishby, 2010), domain adaptation (Germain et al., 2020), and online learning (Haddouche and Guedj, 2022). In recent years, PAC-Bayes has been used to derive non-vacuous generalization bounds for supervised learning algorithms based on neural networks (Dziugaite and Roy, 2018; Pérez-Ortiz et al., 2021). See Guedj (2019) and Alquier (2021) for excellent surveys. 37th Conference on Neural Information Processing Systems (NeurIPS 2023). The objective of this work is to utilize PAC-Bayesian theory to derive statistical guarantees for VAEs. Our generalization bounds investigate the reconstruction, regeneration, as well as the generation properties of VAEs. 1.1 Related Works In order to explain the empirical success of deep generative models, a lot of attention has been put into deriving theoretical guarantees for these models. Most of the results, however, have been dedicated to GANs and their variants (Arora et al., 2017; Zhang et al., 2018; Liang, 2021; Singh et al., 2018; Schreuder et al., 2021; Biau et al., 2021; Mbacke et al., 2023). A possible explanation for this plethora of theoretical results is the adversarial loss function, which directly offers an estimation of the discrepancy between the input distribution and the generator's distribution. Despite being central tools in modern machine learning, VAEs have not benefited from such a thorough theoretical analysis (Chakrabarty and Das, 2021). The work of Chakrabarty and Das (2021) studies the regeneration properties of Wasserstein autoen- coders (WAEs) (Tolstikhin et al., 2018), which come from the same family as VAEs. Using VC theory, Chakrabarty and Das (2021) derive rates of convergence for the Wasserstein distance between the input distribution and the distribution regenerated by the WAE, as well as the total variation distance between the empirical latent distribution and the latent prior. Taking a more empirical approach, Chérief-Abdellatif et al. (2022) use PAC-Bayes to study the generalization properties of stochastic reconstruction models. They define a [0, 1]-bounded reconstruction loss function, then utilize McAllester's bound (McAllester, 2003) to formulate a generalization bound for models with probabilistic neural networks (Langford and Caruana, 2001). Then, they re-scale their loss and compare the empirical results to the reconstruction of standard VAEs on benchmark datasets. We also mention the work of Mbacke et al. (2023), who developed PAC-Bayesian bounds for the analysis of adversarial generative models. Using McDiarmid's inequality, they proved upper bounds on the distance between the input distribution and the generator's distribution, for WGANs (Arjovsky et al., 2017) and EBGANs (Zhao et al., 2017). 1.2 Our Contributions In this work, we derive theoretical guarantees for variational autoencoders using PAC-Bayesian theory. We provide three types of guarantees: reconstruction guarantees showing that VAEs can successfully reconstruct unseen samples from the input distribution; regeneration guarantees proving upper bounds on the Wasserstein distance between the input distribution and the distribution regenerated by the VAE, given the training set as input; and finally, generation guarantees showing upper bounds on the Wasserstein distance between the data-generating distribution and the VAE's generated distribution defined by the latent prior and the decoder. To the best of our knowledge, these are the first generalization bounds for the standard VAE's reconstruction and regeneration properties, as well as the first statistical guarantees for the VAE's generative model. In our analysis, the PAC-Bayesian posterior coincides with the variational posterior, which requires the PAC-Bayesian posterior to be conditional. Since, to the best of our knowledge, such PAC-Bayes bounds do not exist in the literature, we start by developing the first PAC-Bayesian bound for conditional posterior distributions. Then, we provide upper bounds for the VAE's performance under two main assumptions: we start by assuming the instance space is bounded, then we take advantage of the manifold hypothesis. Our bounds are functions of the optimization objective of the VAE, namely, the empirical reconstruction loss, and the empirical KL-loss. The remainder of this paper is organized as follows. In Section 2, we define some preliminary concepts, then briefly introduce VAEs and PAC-Bayesian theory. Section 3 presents our general PAC- Bayesian theorem for conditional posteriors. Then, in Sections 4 and 5, we present our generalization bounds for the reconstruction loss, and the regeneration and generation guarantees. 2 2 Preliminaries 2.1 Definitions and Notations Given metric spaces (X , d) and (Y, d′), and a real number K > 0, a function f : X → Y is K-Lipschitz continuous if for any x, y ∈ X , we have d′(f (x), f (y)) ≤ Kd(x, y). The smallest K such that this condition is satisfied is called the Lipschitz norm or Lipschitz constant of f and is denoted ∥f ∥Lip. Moreover, the set of K-Lipschitz continuous functions f : X → Y is denoted LipK(X , Y) (the underlying metrics will be clear from the context). Throughout the paper, we use lower case letters p, q to denote both probability distributions and their densities w.r.t. the Lebesgue measure. We may add variables between parentheses to improve readability (e.g. p(z) to emphasize that p is a distribution on the space of variables z, and q(z|x) to indicate that q is a conditional distribution). The set of probability measures on a space X is denoted M1 +(X ) is denoted KL(p || q). We omit the absolute continuity condition p ≪ q in the statements of the results below, since if it is not satisfied, then one may assume the KL divergence is infinite and the bounds hold trivially. +(X ). The Kullback–Leibler (KL) divergence between p, q ∈ M1 Integral Probability Metrics (IPM, see Müller (1997)) are a class of pseudo-metrics defined on the space of probability measures. Given a family F of real-valued functions defined on X , the IPM defined by F is denoted dF and defined as dF (p, q) = sup f ∈F (cid:90) (cid:12) (cid:12) (cid:12) (cid:12) f dp − (cid:90) f dq (cid:12) (cid:12) (cid:12) (cid:12) , ∀p, q ∈ M1 +(X ). (1) Stemming from the theory of optimal transportation (Villani, 2009), the Wasserstein distances (see Definition A.2) are a class of metrics between probability measures. The Wasserstein distance of order 1, also referred to simply as the Wasserstein distance, is the IPM defined by the set F = {f : X → R s.t. ∥f ∥Lip ≤ 1}. Finally, we recall the definition of a pushforward measure. Let p be a probability distribution on a space Z and g : Z → X be a measurable function. The pushforward measure defined by g and p and denoted g♯p is a probability distribution on X defined as g♯p(A) = p(g−1(A)), for any measurable set A ⊆ X . In other words, sampling x ∼ g♯p means sampling z ∼ p first, then setting x = g(z). 2.2 Variational Autoencoders We consider a Euclidean observation space X , a data-generating distribution μ ∈ M1 +(X ), and a latent space Z = RdZ . VAEs comprise two main components: the encoder network whose parameters are denoted φ, and the decoder network whose parameters are denoted θ. For simplicity, we may refer to φ and θ as the encoder and decoder respectively. The encoder parameterizes a distribution qφ(z|x) over the latent space Z, which is a variational approximation of the Bayesian posterior pθ(z|x). The likelihood pθ(x|z) is parameterized by the decoder network. In this work, we consider the standard VAE, with a standard Gaussian prior p(z) = N (0, I) on Z and Gaussian latent distributions qφ(z|x). More precisely, for any x ∈ X , the distribution qφ(z|x) is a Gaussian distribution with a diagonal covariance matrix N (μφ (x) , diag(σ2 φ (x))), where μφ : X → Z = RdZ and σφ : X → RdZ ≥0. Note that diag(σ) denotes the diagonal matrix whose main diagonal is the vector σ. In order to simplify some of the expressions below, it may be useful to express the encoder network as a function Qφ : X → R2dZ , where Qφ (x) = (cid:21) (cid:20)μφ (x) σφ (x) . (2) We express the decoder as a parametric function gθ : Z → X . For any x ∈ X , upon receiving z ∼ qφ(z|x), the decoder's output gθ(z) is a reconstruction of x. Given a training set S = {x1, . . . , xn}, the encoder and decoder networks are jointly trained by minimizing the following objective: LVAE(φ, θ) = 1 n n (cid:88) i=1 (cid:20) E z∼qφ(z|xi) [− log pθ(xi|z)] + βKL(qφ(z|xi) || p(z)) (cid:21) , (3) 3 where the first part of (3) is the reconstruction loss and the second part is the KL-divergence between the latent distributions (associated to the training samples) and the prior over the latent space, weighted by a hyperparameter β > 0 (Higgins et al., 2017). The reconstruction loss measures the similarity between x and its reconstruction gθ(z), and can be defined in many ways. With a Gaussian likelihood, the reconstruction loss is the squared L2 norm ∥x − gθ(z)∥2. After training, the VAE defines a generative model using the prior p(z) and the decoder gθ (Kingma and Welling, 2014). The distribution gθ♯p(z) ∈ M1 +(X ) allows one to generate new samples by first sampling a latent vector from the prior, then passing it through the decoder. We refer to gθ♯p(z) as the VAE's generated distribution. 2.3 A Brief Introduction to PAC-Bayesian Theory Dating back to McAllester (1999), PAC-Bayesian theory develops high-probability generalization bounds for machine learning algorithms. In essence, PAC-Bayes frames the output of such algorithm as a posterior distribution over a class of hypotheses, and provides an upper bound on the discrepancy between a model's empirical risk and its population risk. PAC-Bayes considers the following concepts: a hypothesis class H, a training set S = {x1, . . . , xn} iid sampled from an unknown distribution μ over an instance space X 1, and a real-valued loss function l : H × X → [0, ∞). Moreover, the primary goal of PAC-Bayes is to provide generalization bounds uniformly valid for any posterior q ∈ M1 +(H). These bounds are dependent on the empirical performance of q and its closeness to a chosen prior distribution p ∈ M1 +(H), as measured by the KL-divergence. The empirical and true risks of a posterior distribution q ∈ M1 +(H) are defined as ˆRS(q) = E h∼q(h) (cid:34) 1 n n (cid:88) i=1 (cid:35) l(h, xi) and R(q) = E h∼q(h) (cid:20) E x∼μ (cid:21) l(h, x) . As an illustration, consider the following PAC-Bayesian bound for bounded loss functions developed by Catoni (2003). Theorem 2.1. Given a probability measure μ on X , a hypothesis class H, a prior distribution p on H, a loss function l : H × X → [0, 1], real numbers δ ∈ (0, 1) and λ > 0, with probability at least 1 − δ over the random draw of S ∼ μ⊗n, the following holds for any posterior q ∈ M1 +(H): R(q) ≤ ˆRS(q) + λ 8n + KL(q || p) + log 1 δ λ . The connection between PAC-Bayesian theory and Bayesian inference was highlighted by Grünwald (2012) and Germain et al. (2016), who showed that with a proper choice of λ and the negative log-likelihood as the loss function l, the optimal posterior minimizing the right-hand side of Catoni's bound is the Bayesian posterior. Note that although the Bayesian posterior is unique (for a given prior and likelihood), a "PAC-Bayesian posterior" could be, in principle, any distribution over H. In our PAC-Bayesian analysis of VAEs, we will use the latent space Z as our hypothesis class, so that the VAE's prior will coincide with the PAC-Bayesian prior and the variational posterior qφ(z|x) will stand for our PAC-Bayesian posterior. An immediate concern with this approach is that the encoder's distributions are conditioned on individual samples x ∼ μ, whereas the usual PAC-Bayesian bounds hold for unconditional posteriors q(h). We address this issue in the next section, by developing a novel PAC-Bayesian bound for posterior distributions q(*|x). This general result will be later utilized to analyze VAEs. 3 A General PAC-Bayesian Bound with a Conditional Posterior In this section, we present our general PAC-Bayesian bound with a conditional posterior distribution. Note that the novelty of this result is not the conditioning on observations, since this can be achieved by exploiting the existing PAC-Bayesian bounds. Indeed, Haddouche and Guedj (2022) utilized the general theorem of Rivasplata et al. (2020) to derive bounds for the online learning framework. 1In supervised learning, the instance space has the form X × Y where X is a set of features, and Y a set of labels. We use a more general formulation to encompass the unsupervised learning setting. 4 Instead, the contribution of Theorem 3.1 is to predict the behavior of q(h|x), for any (previously unseen) x ∼ μ, when the posterior q was only learned using the training samples {x1, . . . , xn}. To the best of our knowledge, this is the first PAC-Bayesian bound where the posterior distribution is a conditional distribution conditioned on individual elements from the instance space. This bound will require the posterior q and the loss function l to satisfy the following technical assumption. Assumption 1. We say that a distribution q(*|x) and a loss function l satisfy Assumption 1 with a constant K > 0 if there exists a family E of functions H → R such that the following properties hold. 1. The function x (cid:55)→ q(*|x) is continuous in the following sense: for any x1, x2 ∈ X , dE (q(h|x1), q(h|x2)) ≤ Kd(x1, x2). 2. For any x ∈ X , the function l(*, x) : H → R is in E: l(*, x) ∈ E, for any x ∈ X . Before stating the general result, let us pause and discuss this assumption. Intuitively, the goal of a generalization bound is to predict the behavior of the posterior distribution q(h|x) on previously unseen examples x ∼ μ. Since the posterior q(h|x) is learned by minimizing the loss function l on the training samples S = {x1, . . . , xn}, one may need two things to be true. First, the mapping x (cid:55)→ q(h|x) has to be somewhat continuous. This is ensured by the first part of Assumption 1, which states that the posterior q is Lipschitz-continuous2 with respect to the IPM dE and the underlying metric d on X . Indeed, this tells us that if x1 and x2 are close w.r.t. the underlying metric on X , then q(h|x1) and q(h|x2) are close, w.r.t. the IPM dE . Second, that continuity has to be "understood" by the loss function l, which corresponds to the second part of the assumption. It states that the loss function's discriminative power is weaker than the one defined by the IPM dE . In other words, the discrepancy measure used to measure the similarity between the distributions q(h|x1) and q(h|x2) needs to be just strong enough to fool the loss function into thinking that the distributions are close to each other. An alternate formulation of Assumption 1 is provided in the supplementary material (Remark F.1). Finally, we emphasize that Assumption 1 is not as restrictive as it may seem at first. For instance, it is satisfied by a VAE's variational posterior, when the encoder and decoder networks have finite Lipschitz norms and the reconstruction loss is defined with the L2 norm (see Proposition 4.1). We are ready to state our first result. Theorem 3.1. Let (X , d) be a metric space. Consider a probability measure μ on X , a hypothesis class H, a prior distribution p(h) on H, a loss function l : H×X →R, real numbers δ ∈ (0, 1) and λ > 0. With probability at least 1 − δ over the random draw of S ∼ μ⊗n, the following holds for any conditional posterior q(h|x) such that Assumption 1 is satisfied by q(h|x) and l with constant K > 0: E x∼μ E h∼q(h|x) l(h, x) − 1 n n (cid:88) i=1 E h∼q(h|xi) l(h, xi) ≤ log 1 λ 1 δ (cid:34) n (cid:88) i=1 KL(q(h|xi) || p(h)) + n (cid:88) λK n E x∼μ d(x, xi) + i=1 eλ(Ex∼μ[l(h,x)]− 1 n (cid:80)n i=1 l(h,xi)) (cid:21) . + log E S∼μ⊗n E h∼p(h) In order to prove Theorem 3.1, we start by deriving a bound where the expected loss for samples x ∼ μ is computed w.r.t. distributions q(h|xi) associated to the training samples (see Lemma B.1). This result uses standard PAC-Bayesian techniques, with a key difference: we start with n iid hypotheses from the prior p(h), then we perform the change of measure with n posteriors qφ(z|x1), . . . , qφ(z|xn), and show that the resulting exponential moment is equal to the one in Theorem 3.1. Moreover, one of the original aspects of this work comes from Assumption 1, which enables us to obtain a bound where the expected loss for x ∼ μ is computed w.r.t. the posterior q(h|x), associated to x itself instead of all the training samples. However, the price to pay for having a posterior q(h|x) for each x ∈ X is that the bound depends on 1 n Ex∼μ d(x, xi), which we refer to as the average distance. (cid:80)n i=1 2dE is a pseudo-metric in the general case, so we abuse the definition by calling this Lipschitz continuity, since the latter concept is only defined for metric spaces. 5 Applied to supervised learning, Theorem 3.1 bounds the expected risk of a Gibbs posterior q which, upon receiving a previously unseen datapoint x ∼ μ, samples a predictor h dependent on x, and uses it to make a prediction. Note that the family E from Assumption 1 does not appear in the bound, which has nice consequences in practice. Indeed one may pick a loss function l that fits the problem, and then find a family E for which the continuity assumption is satisfied with constant K that is as small as possible. Note also that, in the tradition of PAC-Bayesian bounds, Theorem 3.1 does not make any assumptions on the nature of the elements of H (e.g. H could be a class of functions, a set of neural network's parameters, etc). Therefore, the theorem is very general and could be applied to different domains and models. In the following sections, we will use a specific kind of hypothesis class H = Z, in order to capture the VAE's latent space. 4 Generalization bounds for the Reconstruction Loss For the remainder of this work, ∥*∥ denotes the L2 norm, and we assume the instance space X is Euclidean, and the latent space Z = RdZ , where dZ > 0. Both X and Z are equipped with the Euclidean distance as the underlying metric. Therefore, if x, x′ ∈ X , d(x, x′) = ∥x − x′∥. The following assumption states that the encoder and decoder networks have finite Lipschitz norms. Assumption 2. The encoder and decoder are Lipschitz-continuous w.r.t. their inputs, meaning there exist real numbers Kφ, Kθ > 0 such that for any x1, x2 ∈ X and z1, z2 ∈ Z, and ∥Qφ (x1) − Qφ (x2)∥ ≤ Kφ ∥x1 − x2∥ ∥gθ(z1) − gθ(z2)∥ ≤ Kθ ∥z1 − z2∥ . (4) (5) Recall the definition of Qφ from Equation (2). Note that in practice, one can estimate the Lipschitz constant of trained networks (Fazlyab et al., 2019; Latorre et al., 2020) or train the VAE with preset Lipschitz constants (Barrett et al., 2022). Moreover, we define the reconstruction loss lθ rec with the L2 norm, instead of the squared L2 norm, which enables us to exploit the properties of a metric. We discuss this choice in Section 6. In order to be consistent with the PAC-Bayesian framework, we define the loss function as follows: lθ rec : Z × X → [0, ∞), lθ rec(z, x) = ∥x − gθ(z)∥ . (6) Our goal is to apply the general bound of Theorem 3.1 to the VAE model. But first, since Theorem 3.1 requires Assumption 1 to be satisfied, we start by showing that if the encoder and decoder networks have finite Lipschitz norms, then Assumption 1 holds. Proposition 4.1. Consider a VAE with parameters φ and θ and let Kφ, Kθ ∈ R be the Lipschitz norms of the encoder and decoder respectively. Then the variational distribution qφ(z|x) satisfies Assumption 1, with E = {f : Z → R s.t. ∥f ∥Lip ≤ Kθ}, l = lθ rec, and K = KφKθ. Proof idea. The proof of Proposition 4.1 is in Appendix C, we provide a brief summary here. To prove the first part of Assumption 1, we first notice that if E is the set of real-valued Kθ-Lipschitz continuous functions, then dE is a scaling of the Wasserstein distance. In addition, since W1 ≤ W2, using the closed form of the Wasserstein-2 distance between Gaussian distributions, one can show that dE (qφ(*|x1), qφ(*|x2)) ≤ KφKθ ∥x1 − x2∥. Finally, the second part of the assumption is a consequence of the definition of the loss function and the Lipschitz continuity of the decoder. Proposition 4.1 tells us that Assumption 1 holds for VAEs. Consequently, we can utilize our general bound of Theorem 3.1 to obtain generalization guarantees. This leads to the following general PAC-Bayesian bound for the VAE's reconstruction loss. Theorem 4.2. Let X be the instance space, μ ∈ M1 latent space, p(z) ∈ M1 +(X ) the data-generating distribution, Z the +(Z) the prior distribution on the latent space, θ the decoder's parameters, 6 δ ∈ (0, 1), λ > 0 be real numbers. With probability at least 1 − δ over the random draw of S ∼ μ⊗n, the following holds for any posterior qφ(z|x): E x∼μ E qφ(z|x) lθ rec(z, x) ≤ 1 n n (cid:88) i=1 E qφ(z|xi) lθ rec(z, xi) + 1 λ (cid:34) n (cid:88) i=1 KL(qφ(z|xi) || p(z))+ λKφKθ n n (cid:88) i=1 E x∼μ d(x, xi) + log 1 δ + log E S∼μ⊗n E z∼p(z) eλ(Ex∼μ[lθ rec(z,x)]− 1 n (cid:80)n i=1 lθ rec(z,xi)) (cid:35) , where Kφ and Kθ are the Lipschitz norms of the encoder and the decoder (see (4) and (5)) and Eqφ(z|x) is a shorthand for Ez∼qφ(z|x) . Note that the choice of the hyperparameter β in the VAE's optimization objective (3) correlates with the choice of the hyperparameter λ in Theorem 4.2 (e.g. λ = n corresponds to β = 1). Note also that the encoder and decoder are not treated the same way in Theorem 4.2. Indeed, the inequality holds for a given decoder, but uniformly for any encoder. We discuss this subtle difference and its practical consequences in Section 6. Theorem 4.2 can be seen as a general framework. In order to obtain a useful upper bound, one needs to bound the average distance and the exponential moment on the right-hand side. In the sections below, we provide upper bounds for these terms under various assumptions on the instance space. 4.1 Reconstruction Guarantees for Bounded Instance Spaces In the following theorem, we provide a special case of Theorem 4.2 when the instance space's diameter ∆ def= supx,x′∈X d(x, x′) is finite (see Section C.2 for the proof). Theorem 4.3. Let X be the instance space, ∆ < ∞ its diameter, μ ∈ M1 +(X ) the data-generating distribution, Z the latent space, p(z) ∈ M1 +(Z) the prior on the latent space, θ the decoder's parameters, δ ∈ (0, 1), λ > 0 be real numbers. With probability at least 1 − δ over the random draw of S ∼ μ⊗n, the following holds for any posterior qφ(z|x): E x∼μ E qφ(z|x) lθ rec(z, x) ≤ 1 n n (cid:88) (cid:26) i=1 E qφ(z|xi) (cid:27) lθ rec(z, xi) + 1 λ (cid:32) n (cid:88) i=1 KL(qφ(z|xi) || p(z)) + λKφKθ∆ + log 1 δ + (cid:19) . λ2∆2 8n The left-hand side of this inequality is the expected reconstruction loss for samples x ∼ μ, while the right-hand side is the empirical reconstruction and KL losses, plus an additional term depending on the Lipschitz constants of the VAE and the model's diameter. Note that for real-life datasets, the diameter of the instance space might be very large and non- representative of the structure and complexity of the data. Indeed, it is common to scale image datasets in order to utilize a specific architecture (Radford et al., 2016). In the following section, we provide a special case of Theorem 4.2 under the manifold hypothesis on the data-generating process. 4.2 Reconstruction Guarantees under the Manifold Assumption The manifold assumption (Fodor, 2002; Narayanan and Mitter, 2010; Fefferman et al., 2016) states that most high-dimensional datasets encountered in practice lie close to low-dimensional manifolds. This assumption is exploited by latent variable generative models such as GANs and VAEs, which approximate high-dimensional datasets using transformations of distributions on a low-dimensional space. The works of Schreuder et al. (2021) and Mbacke et al. (2023) provide generalization bounds for GANs, by assuming that the data-generating distribution is a smooth transformation of the uniform distribution on [0, 1]d∗ , where d∗ is the intrinsic dimension. However, since the standard VAE calls for a standard Gaussian prior, in the following theorem, we assume μ is a smooth transformation of the standard Gaussian distribution p∗ on Rd∗ . We consider the case when p∗ is the uniform distribution on [0, 1]d∗ in the supplementary material. 7 Theorem 4.4. Let X be the instance space, μ ∈ M1 +(X ) the data-generating distribution, Z the latent space, p(z) ∈ M1 +(Z) the prior distribution on the latent space, θ the decoder's parameters, δ ∈ (0, 1), λ > 0, a > 0 real numbers. Assume the data-generating distribution μ = g∗♯p∗, where p∗ is the standard Gaussian distribution on Rd∗ and g∗ ∈ LipK∗ , X ). With probability at least 1 − δ − nd∗ 2 e−a2/2 over the random draw of S ∼ μ⊗n, the following holds for any posterior qφ(z|x): (Rd∗ E x∼μ E qφ(z|x) lθ rec(z, x) ≤ 1 n n (cid:88) (cid:26) i=1 E qφ(z|xi) (cid:27) lθ rec(z, xi) + 1 λ (cid:32) n (cid:88) i=1 KL(qφ(z|xi) || p(z)) + λKφKθK∗ (cid:112)(1 + a2)d∗ + log 1 δ + (cid:19) . λ2K 2 ∗ 2n Let us clarify the role of the new parameter a > 0. Each training sample xi ∈ S can be expressed as xi = g∗(wi), where wi ∼ p∗. Since p∗ is the standard Gaussian distribution on Rd∗ , all samples wi will be inside a hypercube [−a, a]d∗ , with high probability. This uncertainty is reflected in the lowered confidence (from 1 − δ in Theorem 4.2 to 1 − δ − nd∗ 2 e−a2/2 in Theorem 4.4), and can be controlled by choosing a large enough value of a. The proof of Theorem 4.4 is in the supplementary material (Section C.3), we provide a short summary below. Proof idea. The proof starts with Theorem 4.2, and uses the assumptions of Theorem 4.4 to obtain upper bounds on the exponential moment and the average distance. To derive the upper bound on the exponential moment, we observe that the function z (cid:55)→ lθ rec(z, x) is K∗-Lipschitz continuous, then we use a dimension-free upper bound on the MGF of Lipschitz-continuous functions of Gaussian random Ex∼μ ∥x − xi∥, variables. Furthermore, we obtain the upper bound on the average distance 1 n by using Holder's inequality and the expectation of a non-central χ2 distribution. Then, we upper- bound the probability that wi ∈ [−a, a]d∗ for all 1 ≤ i ≤ n using the error function and Bernoulli's inequality. Finally, we use the union bound to update the overall confidence. (cid:80)n i=1 5 Generalization Bounds for Regeneration and Generation Let ˆμφ,θ be the empirical regenerated distribution, meaning ˆμφ,θ = 1 n (cid:80)n i=1 gθ♯qφ(z|xi). (7) In other words, sampling x ∼ ˆμφ,θ is done by sampling z ∼ qφ(z|xi) where i is uniformly sampled from {1, . . . , n}, then passing z through the decoder: x = gθ(z). It is therefore the distribution regenerated by the VAE, given the training set S = {x1, . . . , xn} as input. In this section, we provide statistical guarantees on the regenerative and generative properties of VAEs. More precisely, we derive upper bounds for the quantities W1(μ, ˆμφ,θ) and W1(μ, gθ♯p(z)). Note that the average distance term does not appear in the bounds of this section. This is because instead of relying on Theorem 3.1, the results of this section depend upon a preliminary lemma (Lemma B.1), which does not necessitate Assumption 1. 5.1 Regeneration and Generation Guarantees for Bounded Instance Spaces The following theorem presents our first upper bound on the distance between the input distribution and the empirical regenerated distribution. Theorem 5.1. Under the definitions and assumptions of Theorem 4.3, we have that with probability at least 1 − δ over the random draw of S ∼ μ⊗n, the following holds for any posterior qφ(z|x): (cid:33) W1(μ, ˆμφ,θ) ≤ 1 n n (cid:88) (cid:26) i=1 E qφ(z|xi) lθ rec(z, xi) (cid:27) + 1 λ (cid:32) n (cid:88) i=1 KL(qφ(z|xi) || p(z)) + log + 1 δ λ2∆2 8n . As we can see, the right-hand side of Theorem 5.1 depends on the empirical reconstruction loss and KL-divergence. This guarantees that as the VAE's empirical risk decreases, the regenerated distribution gets closer to the data-generating distribution. The proof of Theorem 5.1 exploits the fact 8 that the underlying metric on X is the Euclidean distance d(x, x′) = ∥x − x′∥, which is also used to define the reconstruction loss lθ rec (see Equation 6). The full proof can be found in Appendix D. The following theorem provides an upper bound of the distance between the input distribution and the VAE's generated distribution. Theorem 5.2. Under the definitions and assumptions of Theorem 4.3, we have that with probability at least 1 − δ over the random draw of S ∼ μ⊗n, the following holds for any posterior qφ(z|x): W1(μ, gθ♯p(z)) ≤ 1 n n (cid:88) (cid:26) i=1 E qφ(z|xi) (cid:27) lθ rec(z, xi) log + 1 δ (cid:19) + λ2∆2 8n Kθ n n (cid:88) i=1 where ⃗1 ∈ RdZ denotes the vector whose entries are all 1. + 1 λ (cid:114) (cid:32) n (cid:88) i=1 KL(qφ(z|xi) || p(z))+ ∥μφ (xi)∥2 + (cid:13) (cid:13)σφ (xi) − ⃗1 (cid:13) (cid:13) 2 (cid:13) (cid:13) , The right-hand side of Theorem 5.2 is equal to the right-hand side of Theorem 5.1, plus an additional term depending on the Wasserstein-2 distance W2(qφ(z|xi), p(z)), which is used in the proof because of its closed form for Gaussian distributions. Hence, the right-hand side of Theorem 5.2 augments the VAE's optimization objective with W2(qφ(z|xi), p(z)), suggesting that a good generative perfor- mance may require the latent codes to be even closer to the prior. This is consistent with the findings of Zhao et al. (2019), who showed that in order to improve generative performance, the latent codes need to be much closer to the prior, which may disrupt the balance between reconstruction loss and KL-loss. 5.2 Regeneration and Generation Guarantees under the Manifold Assumption Similar to what we did in Section 4.2, we assume that the data-generating distribution is a smooth transformation of the standard Gaussian distribution on Rd∗ , where d∗ is the intrinsic dimension of the dataset. This yields the following results. Theorem 5.3. Under the definitions and assumptions of Theorem 4.4, with probability at least 1 − δ over the random draw of S ∼ μ⊗n, the following holds for any posterior qφ(z|x): W1(μ, ˆμφ,θ) ≤ 1 n n (cid:88) (cid:26) i=1 E qφ(z|xi) (cid:27) lθ rec(z, xi) + 1 λ (cid:32) n (cid:88) i=1 KL(qφ(z|xi) || p(z)) + log 1 δ + λ2K 2 ∗ 2n (cid:33) . Note that the intrinsic and extrinsic dimensions do not explicitly appear in this inequality, although they may affect the reconstruction and KL loss. We now present our last result, an upper bound on the Wasserstein distance between the input distribution and the VAE's generated distribution, under the manifold assumption. Theorem 5.4. Under the definitions and assumptions of Theorem 4.4, with probability at least 1 − δ over the random draw of S ∼ μ⊗n, the following holds for any posterior qφ(z|x) : W1(μ, gθ♯p(z)) ≤ 1 n n (cid:88) (cid:26) i=1 log E qφ(z|xi) lθ rec(z, xi) 1 δ + λ2K 2 ∗ 2n (cid:19) + Kθ n (cid:27) + n (cid:88) 1 λ (cid:114) (cid:32) n (cid:88) i=1 KL(qφ(z|xi) || p(z)) + ∥μφ (xi)∥2 + (cid:13) (cid:13)σφ (xi) − ⃗1 (cid:13) (cid:13) 2 (cid:13) (cid:13) , i=1 where ⃗1 ∈ RdZ denotes the vector whose entries are all 1. Theorem 5.2 and Theorem 5.4 show that by minimizing the VAE's objective, one is also minimizing the Wasserstein distance between the input distribution and the VAE's generated distribution. √ From the upper bounds given by Theorems 5.1 and 5.3, one can deduce rates of convergence of O(n−1/2) (when λ ≈ n) for the empirical regenerated distribution. Note that λ ≈ n leads to the much faster rate of n−1, but then the bounds do not converge to the empirical risk, but to a larger positive number, dependent on the input distribution. Similarly, Theorems 5.2 and 5.4 provide rates of convergence of O(n−1/2) for the VAE's generated distribution. 9 6 Discussion and Conclusion The different treatments of θ and φ. The bounds we've presented in this work hold for a given decoder θ, but uniformly for all encoders. In practice, this means that the risk certificate has to be computed using samples different from the ones used to train the VAE. This is different from the usual PAC-Bayesian trick (Germain et al., 2009; Parrado-Hernández et al., 2012; Pérez-Ortiz et al., 2021, see also Remark F.2) of splitting the training set to learn the prior, then training the model on the whole training set, because the decoder and encoder are jointly optimized. Instead, one has to make sure that the model is only trained on samples distinct from the ones used to compute the bound. The same method would be necessary when computing the risk certificates given by the recent PAC-Bayesian bounds of Rivasplata et al. (2020) and Haddouche and Guedj (2022), since those bounds are not uniformly valid for any posterior. In our bounds, the reconstruction loss is the L2 norm (RMSE), instead The reconstruction loss. of the squared L2 norm (MSE). In practice, one can still optimize a VAE with the MSE (or any other reconstruction loss, e.g. the cross entropy loss), and then compute the bounds using the RMSE. However, if the reconstruction loss is not the RMSE, then the optima of the chosen optimization objective might differ from the ones minimizing the right-hand side of the bounds. Therefore, if the goal is to minimize the bounds, one should utilize the RMSE as the reconstruction loss. Conclusion. It is common, when applying PAC-Bayesian theory to new problems, to add additional stochasticity in order to account for the PAC-Bayesian distributions on the hypothesis class. For instance, Mbacke et al. (2023) added distributions on the parameters of a WGAN's generator, in order to perform a PAC-Bayesian analysis. However, because of the seamless integration of the PAC-Bayesian and VAE frameworks, such modification to the original problem has been avoided in this work. We matched the prior and posterior distributions on the VAE's latent space to the PAC-Bayesian prior and posterior, which allowed us to recover the VAE's optimization objective. We provide preliminary experiments on synthetic datasets in the supplementary material. This work is a humble contribution to the theoretical understanding of VAEs. We developed novel PAC-Bayesian bounds suited to the analysis of VAEs and provided generalizations bounds for the VAE's reconstruction loss. In addition, we also derived upper bounds on the Wasserstein distance between the input distribution and the VAE's generative model's distribution. These bounds depend on the VAE's empirical optimization objective and the data-generating process. By integrating the VAE and PAC-Bayesian frameworks, we hope to establish PAC-Bayesian theory as a prime tool for the theoretical analysis of VAEs. Acknowledgements This research is supported by the Canada CIFAR AI Chair Program, and the NSERC Discovery grant RGPIN-2020- 07223. F. Clerc is funded by IVADO through the DEEL Project CRDPJ 537462 18 and by a grant from NSERC. References Alquier, P. (2021). arXiv:2110.11216. User-friendly introduction to PAC-Bayes bounds. arXiv preprint Amit, R. and Meir, R. (2018). Meta-learning by adjusting priors based on extended PAC-Bayes theory. In International Conference on Machine Learning, pages 205–214. PMLR. An, J. and Cho, S. (2015). Variational autoencoder based anomaly detection using reconstruction probability. Special Lecture on IE, 2(1):1–18. Anil, C., Lucas, J., and Grosse, R. (2019). Sorting out Lipschitz function approximation. In International Conference on Machine Learning, pages 291–301. PMLR. Arjovsky, M., Chintala, S., and Bottou, L. (2017). Wasserstein generative adversarial networks. In International Conference on Machine Learning, pages 214–223. PMLR. 10 Arora, S., Ge, R., Liang, Y., Ma, T., and Zhang, Y. (2017). Generalization and equilibrium in generative adversarial nets (GANs). In International Conference on Machine Learning, pages 224–232. PMLR. Barrett, B., Camuto, A., Willetts, M., and Rainforth, T. (2022). Certifiably robust variational autoencoders. In International Conference on Artificial Intelligence and Statistics, pages 3663– 3683. PMLR. Biau, G., Sangnier, M., and Tanielian, U. (2021). Some theoretical insights into Wasserstein GANs. Journal of Machine Learning Research. Björck, Å. and Bowie, C. (1971). An iterative algorithm for computing the best estimate of an orthogonal matrix. SIAM Journal on Numerical Analysis, 8(2):358–364. Boucheron, S., Lugosi, G., and Massart, P. (2013). Concentration inequalities: A nonasymptotic theory of independence. Oxford university press. Bowman, S. R., Vilnis, L., Vinyals, O., Dai, A. M., Józefowicz, R., and Bengio, S. (2016). Generating sentences from a continuous space. In Conference on Computational Natural Language Learning, CoNLL, pages 10–21. ACL. Catoni, O. (2003). A PAC-Bayesian approach to adaptive classification. preprint LPMA, 840. Chakrabarty, A. and Das, S. (2021). Statistical regeneration guarantees of the Wasserstein autoencoder with latent space consistency. In Advances in Neural Information Processing Systems. Chérief-Abdellatif, B.-E., Shi, Y., Doucet, A., and Guedj, B. (2022). On PAC-Bayesian reconstruction guarantees for VAEs. In International Conference on Artificial Intelligence and Statistics, pages 3066–3079. PMLR. Chu, J. T. (1955). On bounds for the normal integral. Biometrika, 42(1/2):263–265. Donsker, M. D. and Varadhan, S. S. (1976). Asymptotic evaluation of certain markov process expectations for large time-iii. Communications on pure and applied Mathematics, 29(4):389– 461. Dziugaite, G. K. and Roy, D. M. (2018). Data-dependent PAC-Bayes priors via differential privacy. In Advances in Neural Information Processing Systems, volume 31. Fazlyab, M., Robey, A., Hassani, H., Morari, M., and Pappas, G. (2019). Efficient and accurate estimation of Lipschitz constants for deep neural networks. In Advances in Neural Information Processing Systems, volume 32. Fefferman, C., Mitter, S., and Narayanan, H. (2016). Testing the manifold hypothesis. Journal of the American Mathematical Society, 29(4):983–1049. Fodor, I. K. (2002). A survey of dimension reduction techniques. Technical report, Lawrence Livermore National Lab., CA (US). Germain, P., Bach, F., Lacoste, A., and Lacoste-Julien, S. (2016). PAC-Bayesian theory meets Bayesian inference. In Advances in Neural Information Processing Systems, volume 29. Germain, P., Habrard, A., Laviolette, F., and Morvant, E. (2020). PAC-Bayes and domain adaptation. Neurocomputing, 379:379–397. Germain, P., Lacasse, A., Laviolette, F., and Marchand, M. (2009). PAC-Bayesian learning of linear classifiers. In International Conference on Machine Learning, page 353–360. Givens, C. R. and Shortt, R. M. (1984). A class of Wasserstein metrics for probability distributions. Michigan Mathematical Journal, 31(2):231–240. Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., and Bengio, Y. (2014). Generative adversarial nets. In Advances in Neural Information Processing Systems, volume 27. 11 Grünwald, P. (2012). The safe Bayesian - learning the learning rate via the mixability gap. In Algorithmic Learning Theory, volume 7568 of Lecture Notes in Computer Science, pages 169–183. Springer. Guedj, B. (2019). A primer on PAC-Bayesian learning. In Proceedings of the French Mathematical Society, volume 33, pages 391–414. Société Mathématique de France. Haddouche, M. and Guedj, B. (2022). Online PAC-Bayes learning. In Advances in Neural Information Processing Systems. Higgins, I., Matthey, L., Pal, A., Burgess, C., Glorot, X., Botvinick, M., Mohamed, S., and Lerchner, A. (2017). beta-VAE: Learning basic visual concepts with a constrained variational framework. In International Conference on Learning Representations. Kaur, D., Islam, S. N., and Mahmud, M. A. (2021). A variational autoencoder-based dimensionality In 2021 IEEE reduction technique for generation forecasting in cyber-physical smart grids. International Conference on Communications Workshops (ICC Workshops), pages 1–6. IEEE. Kingma, D. P., Mohamed, S., Jimenez Rezende, D., and Welling, M. (2014). Semi-supervised learning with deep generative models. In Advances in Neural Information Processing Systems, volume 27. Kingma, D. P. and Welling, M. (2014). Auto-encoding Variational Bayes. In International Conference on Learning Representations. Langford, J. and Caruana, R. (2001). (not) bounding the true error. In Advances in Neural Information Processing Systems, volume 14. Latorre, F., Rolland, P., and Cevher, V. (2020). Lipschitz constant estimation of neural networks via sparse polynomial optimization. In International Conference on Learning Representations. Liang, T. (2021). How well generative adversarial networks learn distributions. Journal of Machine Learning Research, 22(228):1–41. Mbacke, S. D., Clerc, F., and Germain, P. (2023). PAC-Bayesian generalization bounds for adversarial generative models. In International Conference on Machine Learning, volume 202, pages 24271– 24290. PMLR. McAllester, D. A. (1999). Some PAC-Bayesian theorems. Machine Learning, 37(3):355–363. McAllester, D. A. (2003). PAC-Bayesian stochastic model selection. Machine Learning, 51(1):5–21. Mitrinovic, D. S. and Vasic, P. M. (1970). Analytic inequalities, volume 1. Springer. Müller, A. (1997). Integral probability metrics and their generating classes of functions. Advances in Applied Probability, 29(2):429–443. Narayanan, H. and Mitter, S. (2010). Sample complexity of testing the manifold hypothesis. In Advances in Neural Information Processing Systems, volume 23. Parrado-Hernández, E., Ambroladze, A., Shawe-Taylor, J., and Sun, S. (2012). PAC-Bayes bounds with data dependent priors. Journal of Machine Learning Research, 13(1):3507–3531. Pérez-Ortiz, M., Rivasplata, O., Shawe-Taylor, J., and Szepesvári, C. (2021). Tighter risk certificates for neural networks. Journal of Machine Learning Research, 22. Petersen, K. B. and Pedersen, M. S. (2008). The matrix cookbook. Version 20081110. Radford, A., Metz, L., and Chintala, S. (2016). Unsupervised representation learning with deep convolutional generative adversarial networks. In International Conference on Learning Represen- tations. Rezende, D. J., Mohamed, S., and Wierstra, D. (2014). Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning, pages 1278–1286. PMLR. 12 Rivasplata, O., Kuzborskij, I., Szepesvári, C., and Shawe-Taylor, J. (2020). PAC-Bayes analysis beyond the usual bounds. In Advances in Neural Information Processing Systems, volume 33, pages 16833–16845. Schreuder, N., Brunel, V.-E., and Dalalyan, A. (2021). Statistical guarantees for generative models without domination. In Algorithmic Learning Theory, pages 1051–1071. PMLR. Seeger, M. (2002). PAC-Bayesian generalisation error bounds for Gaussian process classification. Journal of Machine Learning Research, 3(Oct):233–269. Seldin, Y. and Tishby, N. (2010). PAC-Bayesian analysis of co-clustering and beyond. Journal of Machine Learning Research, 11(12). Singh, S., Uppal, A., Li, B., Li, C.-L., Zaheer, M., and Póczos, B. (2018). Nonparametric density In Advances in Neural Information Processing Systems, estimation under adversarial losses. volume 31. Thiemann, N., Igel, C., Wintenberger, O., and Seldin, Y. (2017). A strongly quasiconvex PAC- Bayesian bound. In International Conference on Algorithmic Learning Theory, volume 76, pages 466–492. PMLR. Tolstikhin, I., Bousquet, O., Gelly, S., and Schoelkopf, B. (2018). Wasserstein auto-encoders. In International Conference on Learning Representations. Vahdat, A. and Kautz, J. (2020). NVAE: A deep hierarchical variational autoencoder. In Advances in Neural Information Processing Systems, volume 33, pages 19667–19679. Villani, C. (2009). Optimal transport: old and new, volume 338. Springer. Zhang, P., Liu, Q., Zhou, D., Xu, T., and He, X. (2018). On the discrimination-generalization tradeoff in GANs. In International Conference on Learning Representations. Zhao, J., Mathieu, M., and LeCun, Y. (2017). Energy-based generative adversarial networks. In International Conference on Learning Representations. Zhao, S., Song, J., and Ermon, S. (2019). InfoVAE: Balancing learning and inference in variational autoencoders. In AAAI Conference on Artificial Intelligence, volume 33, pages 5885–5892. 13 Statistical Guarantees for Variational Autoencoders using PAC-Bayesian Theory: Supplementary Material Sokhna Diarra Mbacke Université Laval sokhna-diarra.mbacke.1@ulaval.ca Florence Clerc McGill University florence.clerc@mail.mcgill.ca Pascal Germain Université Laval pascal.germain@ift.ulaval.ca A Preliminaries Definition A.1 (Coupling). Let p, q ∈ M1 +(X ). A distribution γ on X × X is a coupling (Villani, 2009) of p and q if for every measurable set B ⊂ X , γ(B × X ) = p(B) and γ(X × B) = q(B). In other words, a coupling of p and q is a distribution on X × X whose marginals are p and q respectively. For example, the product measure p ⊗ q is a coupling of p and q. Definition A.2 (Wasserstein distances). Let (X , d) be a Polish metric space and p, q ∈ M1 Given a real number k ≥ 1, the Wasserstein-k distance Wk is defined as +(X ) (cid:18) Wk(p, q) = inf π∈Γ(p,q) (cid:90) d(x, y)k dπ(x, y) (cid:19)1/k , where Γ(p, q) denotes the set of couplings of p and q (see Definition A.1 above). As stated in the main paper, W1 is referred to as the Wasserstein distance. Given two Gaussian distributions p = N (μ1, Σ1) and q = N (μ2, Σ2) on Rd∗ distance has the following closed form (Givens and Shortt, 1984): , the Wasserstein-2 W2(p, q)2 = ∥μ1 − μ2∥2 + Tr (cid:18) Σ1 + Σ2 − 2 (cid:16) 1 Σ2Σ1/2 Σ1/2 1 (cid:17)1/2(cid:19) . (A.1) This expression can be greatly simplified when the distributions have diagonal covariance matrices. Indeed, if Σ1 = diag(σ2 , then the product of the covariance matrices commutes Σ1Σ2 = Σ2Σ1 and we get 2) where σ1, σ2 ∈ Rd∗ 1) and Σ2 = diag(σ2 (cid:16) 1 Σ2Σ1/2 Σ1/2 1 (cid:17)1/2 = Σ1/2 1 Σ1/2 2 , which, combined with the symmetry of covariance matrices and the definition of the Frobenius norm ∥*∥Fr (Petersen and Pedersen, 2008), implies (cid:18) Tr Σ1 + Σ2 − 2 (cid:16) 1 Σ2Σ1/2 Σ1/2 1 (cid:17)1/2(cid:19) = (cid:13) (cid:13)Σ1/2 (cid:13) 1 − Σ1/2 2 (cid:13) 2 (cid:13) (cid:13) Fr = ∥σ1 − σ2∥2 . Hence, if p = N (μ1, diag(σ2 p and q is 1)) and q = N (μ2, diag(σ2 2)), then the Wasserstein-2 distance between W2(p, q) = ∥μ1 − μ2∥2 + ∥σ1 − σ2∥2 . (A.2) We will use this equality to prove some of the results of Section 5. 14 The following change of measure theorem dates back to Donsker and Varadhan (1976) and has been used in the proof of many PAC-Bayesian theorems. A proof can be found in Boucheron et al. (2013, Corollary 4.15). Proposition A.1 (Donsker-Varadhan change of measure). Let p, q be probability measures on a space H such that q ≪ p, and let g : H → R be a function such that Eh∼p eg(h) < ∞. Then, eg(h) ≥ eEh∼q[g(h)]−KL(q || p). E h∼p There are many different formulations of this proposition, we chose a formulation that facilitates readability of the proof of the following lemma. B Proofs of the results in Section 3 We state and prove our first result. Note that the following lemma does not use Assumption 1. Moreover, the main difference between the inequality of this lemma and the one of Theorem 3.1 is the left-hand side. In Lemma B.1, the expected loss for samples x ∼ μ is computed w.r.t. distributions q(h|xi) associated to the training samples. In contrast, in Theorem 3.1, the expected loss for each x ∼ μ is computed w.r.t. the distribution q(h|x) associated to x itself. Lemma B.1. Let X be the instance space, μ ∈ M1 +(X ) the data-generating distribution, H the hypothesis class, l : H × X → R the loss function, p(h) ∈ M1 +(H) the prior distribution and δ ∈ (0, 1), λ > 0 real numbers. Then with probability at least 1 − δ over the random draw of the training set S = {x1, . . . , xn} ∼ μ⊗n, the following holds for any conditional posterior q(h|x) ∈ M1 +(H): 1 n n (cid:88) (cid:26) i=1 E h∼q(h|xi) E x∼μ (cid:27) l(h, x) ≤ 1 n n (cid:88) (cid:26) E h∼q(h|xi) (cid:27) l(h, xi) + 1 λ (cid:34) n (cid:88) KL(q(h|xi) || p(h))+ i=1 1 δ log + log E S∼μ⊗n E h∼p(h) i=1 eλ(Ex∼μ[l(h,x)]− 1 n (cid:80)n i=1 l(h,xi)) (cid:21) . (B.1) Proof. First, we consider a set H = {h1, . . . , hn} ∼ p(h)⊗n iid sampled from p(h). By applying Markov's inequality to the positive random variable Y , defined as Y def= E H∼p(h)⊗n exp (cid:34) λ n n (cid:88) (cid:26) i=1 E x∼μ [l(hi, x)] − l(hi, xi) , (cid:27)(cid:35) we obtain that with probability at least 1 − δ over the draw of S ∼ μ⊗n, Y ≤ 1 δ E [Y ], meaning E H∼p(h)⊗n exp (cid:34) λ n 1 δ n (cid:88) (cid:26) i=1 E x∼μ [l(hi, x)] − l(hi, xi) ≤ (cid:27)(cid:35) E S∼μ⊗n E H∼p(h)⊗n exp (cid:34) λ n n (cid:88) (cid:26) i=1 E x∼μ 15 [l(hi, x)] − l(hi, xi) . (cid:27)(cid:35) (B.2) Let us focus on the left-hand side of (B.2). We have E H∼p(h)⊗n exp (cid:34) λ n n (cid:88) (cid:26) i=1 E x∼μ [l(hi, x)] − l(hi, xi) (cid:27)(cid:35) = E H∼p(h)⊗n n (cid:89) i=1 exp (cid:18) (cid:20) λ n E x∼μ [l(hi, x)] − l(hi, xi) (cid:19)(cid:21) = = ≥ n (cid:89) i=1 n (cid:89) i=1 n (cid:89) i=1 E hi∼p(h) exp (cid:18) (cid:20) λ n E x∼μ [l(hi, x)] − l(hi, xi) (cid:19)(cid:21) E h∼p(h) exp (cid:18) (cid:20) λ n E x∼μ [l(h, x)] − l(h, xi) (cid:19)(cid:21) exp (cid:20) E h∼q(h|xi) (cid:20) λ n (cid:18) E x∼μ [l(h, x)] − l(h, xi) − KL(q(h|xi) || p(h)) (cid:19)(cid:21) (cid:21) , where the inequality uses the Donsker-Varadhan change of measure theorem (Proposition A.1). Applying the logarithm, we obtain n (cid:88) (cid:26) E x∼μ [l(hi, x)] − l(hi, xi) (cid:27)(cid:35) log E H∼p(h)⊗n exp (cid:34) λ n ≥ log n (cid:89) i=1 exp (cid:20) E h∼q(h|xi) i=1 (cid:20) λ n (cid:18) E x∼μ [l(h, x)] − l(h, xi) − KL(q(h|xi) || p(h)) (cid:19)(cid:21) (cid:21) = = n (cid:88) (cid:18) i=1 E h∼q(h|xi) (cid:18) (cid:20) λ n E x∼μ [l(h, x)] − l(h, xi) − KL(q(h|xi) || p(h)) (cid:19)(cid:21) (cid:19) n (cid:88) λ n (cid:20) E h∼q(h|xi) E x∼μ [l(h, x)] − l(h, xi) − (cid:21) n (cid:88) i=1 KL(q(h|xi) || p(h)). i=1 This, combined with (B.2) yields λ n n (cid:88) i=1 E h∼q(h|xi) (cid:20) E x∼μ (cid:21) [l(h, x)] − l(h, xi) − n (cid:88) KL(q(h|xi) || p(h)) ≤ 1 δ E S∼μ⊗n E H∼p(h)⊗n exp (cid:34) λ n n (cid:88) (cid:26) i=1 E x∼μ i=1 [l(hi, x)] − l(hi, xi) . (cid:27)(cid:35) (B.3) It remains to show that the exponential moment on the right-hand side of Equation (B.3) can be modified by replacing the expectation w.r.t. p(h)⊗n with an expectation w.r.t. p(h). Similar to what we did in the first part of the first derivation, we can use Fubini's theorem to obtain E H∼p(h)⊗n exp = n (cid:89) i=1 E h∼p(h) exp = E h∼p(h) n (cid:89) i=1 exp (cid:34) λ n (cid:20) λ n (cid:20) λ n (cid:34) (cid:32) n (cid:88) (cid:26) i=1 E x∼μ [l(hi, x)] − l(hi, xi) (cid:27)(cid:35) (cid:18) (cid:18) E x∼μ E x∼μ [l(h, x)] − l(h, xi) (cid:19)(cid:21) [l(h, x)] − l(h, xi) (cid:19)(cid:21) (cid:33)(cid:35) l(h, xi) . 1 n n (cid:88) i=1 = E h∼p(h) exp λ E x∼μ [l(h, x)] − 16 Combining this equation with Equation (B.3) yields the theorem. The reader familiar with PAC-Bayes bounds may notice that the proof of Lemma B.1 is similar to the usual derivation of PAC-Bayesian bounds, with a key difference. We start with an iid set of n hypotheses sampled from the prior, which allows us to apply the change of measure theorem to n posteriors q(h|x1), . . . , q(h|xn). Then, we show that the exponential moment obtained with n hypotheses instead of one is equal to the exponential moment obtained with one hypothesis. B.1 Proof of Theorem 3.1 The first summand on the left-hand side of Lemma B.1 is the risk on samples x ∼ μ, when the hypotheses are uniformly sampled from q(h|xi), 1 ≤ i ≤ n. In order to replace q(h|xi) by q(h|x) in that term and derive Theorem 3.1, we utilize Assumption 1. First, recall that Theorem 3.1 states that under the assumptions of Lemma B.1, if Assumption 1 holds with a constant K > 0, then the following inequality holds with probability at least 1 − δ: E x∼μ E h∼q(h|x) l(h, x) − 1 n n (cid:88) i=1 E h∼q(h|xi) l(h, xi) ≤ log 1 λ 1 δ (cid:34) n (cid:88) i=1 + log E S∼μ⊗n E h∼p(h) n (cid:88) λK n E x∼μ i=1 eλ(Ex∼μ[l(h,x)]− 1 n KL(q(h|xi) || p(h)) + [d(x, xi)]+ (cid:80)n i=1 l(h,xi)) (cid:21) . (B.4) Proof of Theorem 3.1. Using the definition of an IPM and Assumption 1, for any xi ∈ S, x ∈ X , we have E h∼q(h|x) l(h, x) − E h∼q(h|xi) l(h, x) ≤ dE (q(h|x), q(h|xi)) ≤ Kd(x, xi). Combined with Fubini's theorem, we obtain n (cid:88) n (cid:88) (cid:20) E h∼q(h|xi) E x∼μ l(h, x) = E x∼μ E h∼q(h|xi) i=1 i=1 (cid:21) l(h, x) ≥ n (cid:88) i=1 E x∼μ (cid:20) E h∼q(h|x) l(h, x) − Kd(x, xi) (cid:21) . Combining this with Lemma B.1, yields Theorem 3.1. C Proofs of the results in Section 4 C.1 Proof of Proposition 4.1 First, we recall the statement of Proposition 4.1. Proposition C.1 (Restatement of Proposition 4.1). If there exists positive real numbers Kφ and Kθ such that the encoder and decoder are respectively Kφ-Lipschitz and Kθ-Lipschitz continuous, then dE (qφ(z|x1), qφ(z|x2)) ≤ KφKθ ∥x1 − x2∥ , (C.1) and where E = LipKθ Proof. for any x ∈ X . (C.2) (Z, R) is the set of real-valued Kθ-Lipschitz continuous functions defined on Z. l(*, x) ∈ E, 1. Let us prove (C.1). First, since qφ(z|xi) = N (μφ (xi) , diag(σ2 φ (xi))), by (A.2), the Wasserstein-2 distance W2(qφ(z|x1), qφ(z|x2)) has the following closed form: W2(qφ(z|x1), qφ(z|x2))2 = ∥μφ (x1) − μφ (x2)∥2 + ∥σφ (x1) − σφ (x2)∥2 , which, combined with the definition Qφ (x) = (cid:20)μφ (x) σφ (x) (cid:21) , yields ∥Qφ (x1) − Qφ (x2)∥2 = W2(qφ(z|x1), qφ(z|x2))2. 17 Since Qφ is Kφ-Lipschitz continuous, we have ∥Qφ (x1) − Qφ (x2)∥ ≤ Kφ ∥x1 − x2∥, and W2(qφ(z|x1), qφ(z|x2)) ≤ Kφ ∥x1 − x2∥ . (C.3) On the other hand, the definition E = LipKθ (Z, R) and the Kantorovich duality imply dE (qφ(z|x1), qφ(z|x2)) = KθW1(qφ(z|x1), qφ(z|x2)). Since W1 ≤ W2, this equation, combined with (C.3) yields dE (qφ(z|x1), qφ(z|x2)) ≤ KθKφ ∥x1 − x2∥ . 2. Now, we shall prove (C.2), meaning, we show that l(*, x) ∈ LipKθ z1, z2 ∈ Z. We have (Z, R) . Let x ∈ X and l(z1, x) − l(z2, x) = ∥x − gθ(z1)∥ − ∥x − gθ(z2)∥ = ∥x − gθ(z1) + gθ(z2) − gθ(z2)∥ − ∥x − gθ(z2)∥ ≤ ∥x − gθ(z2)∥ + ∥gθ(z2) − gθ(z1)∥ − ∥x − gθ(z2)∥ = ∥gθ(z2) − gθ(z1)∥ ≤ Kθ ∥z1 − z2∥ , where the first inequality uses the triangle inequality and the second uses the Lipschitz assumption on gθ. C.2 Proof of Theorem 4.3 Proof of Theorem 4.3. In order to prove Theorem 4.3, we need to upper bound the average distance and the exponential moment of Theorem 4.2, under the finite diameter assumption: More precisely, we need to prove the two following inequalities. d(x, x′) = ∆ < ∞. sup x,x′∈X n (cid:88) i=1 E x∼μ d(x, xi) ≤ n∆ and (cid:34) (cid:32) E z∼p(z) E S∼μ⊗n exp λ E x∼μ (cid:2)lθ rec(z, x)(cid:3) − 1 n n (cid:88) i=1 (cid:33)(cid:35) lθ rec(z, xi) ≤ exp (cid:20) λ2∆2 8n (cid:21) . (C.4) (C.5) (C.6) First, (C.5) is a direct consequence of the definition of the diameter ∆. Now, let us prove (C.6). Let z ∈ Z. Since lθ between x and gθ(z), the definition of ∆ implies lθ Hoeffding's lemma on the random variables li = lθ rec(z, x)(cid:3) − lθ rec(z, x) = ∥x − gθ(z)∥ = d(x, gθ(z)) is the distance rec(z, x) ∈ [0, ∆], for any x ∈ X . Hence, applying rec(z, xi) ∈ [0, ∆], we obtain (cid:20) λ2∆2 (cid:21) 8n2 rec(z, xi) E xi∼μ (cid:20) λ n E x∼μ ≤ exp (cid:2)lθ exp (cid:19)(cid:21) (cid:18) . Using Fubini's theorem, we have that: (cid:34) (cid:32) E S∼μ⊗n exp λ E x∼μ (cid:2)lθ rec(z, x)(cid:3) − (cid:33)(cid:35) lθ rec(z, xi) 1 n n (cid:88) i=1 = n (cid:89) i=1 E xi∼μ exp (cid:20) λ n (cid:18) E x∼μ (cid:2)lθ rec(z, x)(cid:3) − lθ rec(z, xi) (cid:19)(cid:21) which leads to (cid:34) (cid:32) E S∼μ⊗n exp λ E x∼μ (cid:2)lθ rec(z, x)(cid:3) − (cid:33)(cid:35) lθ rec(z, xi) 1 n n (cid:88) i=1 (cid:18) ≤ exp (cid:20) λ2∆2 8n2 (cid:21)(cid:19)n = exp (cid:21) (cid:20) λ2∆2 8n 18 C.3 Proof of Theorem 4.4 We need to bound the average distance and the exponential moment of Theorem 4.2, under the assumption μ = g∗♯p∗, with p∗ = N (0, I) is the standard Gaussian distribution on Rd∗ , and g∗ ∈ LipK∗ Lemma C.2. Under the hypotheses of Theorem 4.4, the following inequality holds: (Rd∗ , X ). (cid:34) (cid:32) log E z∼p(z) E S∼μ⊗n exp λ E x∼μ (cid:2)lθ rec(z, x)(cid:3) − 1 n n (cid:88) i=1 (cid:33)(cid:35) lθ rec(z, xi) ≤ λ2K 2 ∗ 2n . (C.7) Proof. We have (cid:34) (cid:32) E S∼μ⊗n exp λ E x∼μ (cid:2)lθ rec(z, x)(cid:3) − (cid:33)(cid:35) lθ rec(z, xi) 1 n n (cid:88) i=1 (cid:34) (cid:32) = E S∼μ⊗n exp λ E x∼μ [∥x − gθ(z)∥] − (cid:33)(cid:35) ∥xi − gθ(z)∥ 1 n n (cid:88) i=1 (cid:19)(cid:35) (cid:18) E x∼μ = E S∼μ⊗n exp = E S∼μ⊗n n (cid:89) i=1 exp (cid:34) n (cid:88) i=1 λ n (cid:20) λ n [∥x − gθ(z)∥] − ∥xi − gθ(z)∥ (cid:18) E x∼μ [∥x − gθ(z)∥] − ∥xi − gθ(z)∥ (cid:19)(cid:21) Since all the xi are samples iid, we can use Fubini's theorem to obtain: E S∼μ⊗n = n (cid:89) i=1 eλ(Ex∼μ[lθ rec(z,x)]− 1 n (cid:80)n i=1 lθ rec(z,xi)) E xi∼μ exp (cid:20) λ n (cid:18) E x∼μ [∥x − gθ(z)∥] − ∥xi − gθ(z)∥ (cid:19)(cid:21) Recall that μ = g∗♯p∗, where p∗ is the standard Gaussian distribution on Rd∗ and g∗ is K∗-Lipschitz continuous. This means we can rewrite an expectation wrt xi ∼ μ as an expectation wrt wi ∼ p∗ as follows: (cid:34) (cid:32) E S∼μ⊗n exp λ E x∼μ (cid:2)lθ rec(z, x)(cid:3) − (cid:33)(cid:35) lθ rec(z, xi) 1 n n (cid:88) i=1 = = n (cid:89) i=1 n (cid:89) i=1 (cid:20) exp (cid:20) λ n E xi∼μ (cid:18) E x∼μ [∥x − gθ(z)∥] − ∥xi − gθ(z)∥ (cid:19)(cid:21)(cid:21) E wi∼p∗ (cid:18) (cid:20) exp (cid:20) λ n E w′∼p∗ [∥g∗(w′) − gθ(z)∥] − ∥g∗(wi) − gθ(z)∥ (cid:19)(cid:21)(cid:21) (∗) ≤ n (cid:89) i=1 exp (cid:21) (cid:20) λ2K 2 ∗ 2n2 = exp (cid:21) (cid:20) λ2K 2 ∗ 2n We still need to justify (∗) ≤ . Define for any arbitrary α ∈ X the function f : Rd∗ → R as: f (w) = ∥g∗(w) − α∥ . 19 Since g∗ ∈ LipK∗ (Rd∗ , X ), the function f is K∗-Lipschitz. Indeed, for any w1, w2 ∈ Rd∗ , f (w1) − f (w2) = ∥g∗(w1) − α∥ − ∥g∗(w2) − α∥ = ∥g∗(w1) − α + g∗(w2) − g∗(w2)∥ − ∥g∗(w2) − α∥ ≤ ∥g∗(w1) − g∗(w2)∥ + ∥g∗(w2) − α∥ − ∥g∗(w2) − α∥ = ∥g∗(w1) − g∗(w2)∥ ≤ K∗ ∥w1 − w2∥ Moreover, it is known (see Theorem 5.5 of Boucheron et al. (2013)) that if f is a K∗-Lipschitz function of a standard normal random variable z, then E eλ(E[f (z)]−f (z)) ≤ e λ2K2 ∗ 2 . Hence, E wi∼p∗ (cid:20) exp (cid:20) λ n (cid:18) E w′∼p∗ [∥g∗(w′) − gθ(z)∥] − ∥g∗(wi) − gθ(z)∥ (cid:19)(cid:21)(cid:21) ≤ exp (cid:20) λ2K 2 ∗ 2n2 (cid:21) , which proves (∗) ≤ and concludes this proof. Lemma C.3. Under the hypotheses of Theorem 4.4, with probability at least 1 − nd∗ 2 e random draw of S, n (cid:88) i=1 d(x, xi) ≤ nK∗ (cid:112)(1 + a2)d∗ E x∼μ −a2 2 over the (C.8) Proof. First, since the training set S = {x1, . . . , xn} iid∼ μ, for each 1 ≤ i ≤ n, there exists wi ∼ p∗ such that xi = g∗(wi). Let a > 0 be a positive real number. By definition of p∗, we have P (cid:104) ∀i, wi ∈ [−a, a]d∗ (cid:105) (cid:18) = erf (cid:18) a √ 2 (cid:19)(cid:19)nd∗ , where erf (*) denotes the error function. Since the error function verifies (see Chu (1955)) erf (cid:18) a √ 2 (cid:19) (cid:113) ≥ 1 − e −a2 2 , we can use Bernoulli's inequality (see Section 2.4 of Mitrinovic and Vasic (1970)) to obtain (cid:16) (cid:17)nd∗/2 P ∀i, wi ∈ [−a, a]d∗ (cid:105) (cid:104) ≥ 1 − e −a2 2 ≥ 1 − nd∗ 2 −a2 2 . e Now we assume wi ∈ [−a, a]d∗ for all 1 ≤ i ≤ n and we shall prove the desired inequality: n (cid:88) d(x, xi) ≤ nK∗ (cid:112)(1 + a2)d∗ E x∼μ Let us prove (C.10). We have i=1 (C.9) (C.10) E x∼μ d(x, xi) = E x∼μ ∥x − xi∥ = E w∼p∗ ∥g∗(w) − g∗(wi)∥ ≤ K∗ E w∼p∗ ∥w − wi∥ , (C.11) where the inequality follows from the assumption g∗ ∈ LipK∗ , X ). Using Holder's inequality, the fact that ∥w − wi∥2 is a non-central χ2 random variable with d∗ degrees of freedom and non- centrality coefficient ∥wi∥2, and the assumption wi ∈ [−a, a]d∗ , we obtain (Rd∗ E w∼p∗ ∥w − wi∥ ≤ (cid:18) E w∼p∗ ∥w − wi∥2 (cid:19)1/2 d∗ + ∥wi∥2(cid:17)1/2 (cid:16) = ≤ (cid:0)d∗ + a2d∗(cid:1)1/2 . Hence, which proves (C.10). ∥x − xi∥ ≤ K∗ (cid:112)(1 + a2)d∗ E x∼μ 20 Proof of Theorem 4.4. Lemmas C.2 and C.3 applied to the result from Theorem 4.2 provide us with the inequality of Theorem 4.4. Finally, the confidence of 1 − δ − nd∗ 2 e is obtained by using the union bound: the inequality in Theorem 4.2 holds with probability at least 1 − δ, whereas the inequality appearing in Lemma C.3 holds with probability at least 1 − nd∗ 2 e −a2 2 . −a2 2 , instead of the standard Gaussian distribution on Rd∗ In the following proposition, we provide an alternate version of Theorem 4.4, where the distribution p∗ is the uniform distribution3 on [0, 1]d∗ Proposition C.4. Let X be the instance space, Z the latent space, p(z) ∈ M1 +(Z) the prior distribution, θ the parameters of the decoder, δ ∈ (0, 1), λ > 0, a > 0 be real numbers. Assume the data-generating distribution μ = g∗♯p∗, where p∗ = U([0, 1]d∗ ) is the uniform distribution on [0, 1]d∗ , X ) is K∗-Lipschitz continuous. With probability at least 1 − δ over the random draw of S, the following holds for any posterior qφ(z|x): (cid:32) n (cid:88) and g∗ ∈ LipK∗ (Rd∗ n (cid:88) (cid:26) (cid:27) . E x∼μ E qφ(z|x) lθ rec(z, x) − 1 n i=1 E qφ(z|xi) lθ rec(z, xi) ≤ 1 λ KL(qφ(z|xi) || p(z))+ i=1 √ λKφKθK∗ d∗ + log 1 δ + (cid:19) . λ2K 2 ∗ 2n Proof. Let {w1, . . . , wn} ⊆ [0, 1]d∗ of [0, 1]d∗ √ is d∗, using the assumptions on μ and g∗, we obtain be such that for all 1 ≤ i ≤ n, xi = g∗(wi). Since the diameter n (cid:88) i=1 E x∼μ d(x, xi) = n (cid:88) i=1 E w∼p∗ d(g∗(w), g∗(wi)) ≤ K∗ n (cid:88) i=1 E w∼p∗ ∥w − wi∥ ≤ nK∗ √ d∗. Applying the inequality above to Theorem 4.2 yields the desired result. Note that unlike Theorem 4.4, the confidence 1 − δ of Theorem 4.2 is not lowered in Proposition C.4. D Proofs of the results in Section 5 To simplify the proofs of the theorems of Section 5, we start by proving Lemmas D.1 and D.2 below. First, recall the definition of ˆμφ,θ: ˆμφ,θ = 1 n n (cid:88) i=1 gθ♯qφ(z|xi). The triangle inequality implies W1(μ, gθ♯p(z)) ≤ W1(μ, ˆμφ,θ) + W1(ˆμφ,θ, gθ♯p(z)). (D.1) Let us state and prove the first lemma of this section. Lemma D.1. The following inequality holds with probability at least 1 − δ over the random draw of S ∼ μ⊗n: λW1(μ, ˆμφ,θ) ≤ λ n n (cid:88) i=1 (cid:18) E z∼q(z|xi) (cid:19) lθ rec(z, xi) + n (cid:88) i=1 KL(q(z|xi) || p(z))+ log 1 δ + log E S∼μ⊗n E z∼p(z) eλ(Ex∼μ[lθ rec(z,x)]− 1 n (cid:80)n i=1 lθ rec(z,xi)). Proof. Recall the expression for the Wasserstein distance based on couplings: W1(μ, ˆμφ,θ) = inf π∈Γ(μ,ˆμφ,θ) (cid:90) X ×X ∥x − y∥ dπ(x, y) 3Note that the result holds for any distribution on [0, 1]d∗ , not just the uniform distribution. 21 In particular, W1(μ, ˆμφ,θ) is less than the right-hand side obtained by the product coupling which can be rewritten, using Fubini's theorem, as: W1(μ, ˆμφ,θ) ≤ (cid:90) ∥x − y∥ dμ(x)dˆμφ,θ(y) X ×X = E y∼ˆμφ,θ E x∼μ ∥x − y∥ . Using the derivation above and the definition of ˆμφ,θ, we obtain W1(μ, ˆμφ,θ) ≤ E y∼ˆμφ,θ E x∼μ ∥x − y∥ = = 1 n 1 n n (cid:88) i=1 n (cid:88) i=1 (cid:18) E z∼qφ(z|xi) (cid:18) E z∼qφ(z|xi) E x∼μ E x∼μ (cid:19) ∥x − gθ(z)∥ (cid:19) lθ rec(z, x) . We can upper bound this expression using Lemma B.1 with H = Z and l = lθ probability at least 1 − δ over the random draw of S ∼ μ⊗n: rec. We get that with λ n n (cid:88) i=1 (cid:18) E z∼q(z|xi) E x∼μ lθ rec(z, x) (cid:19) ≤ λ n n (cid:88) (cid:18) i=1 E z∼q(z|xi) (cid:19) lθ rec(z, xi) + n (cid:88) i=1 KL(q(z|xi) || p(z))+ log 1 δ + log E S∼μ⊗n E z∼p(z) eλ(Ex∼μ[lθ rec(z,x)]− 1 n (cid:80)n i=1 lθ rec(z,xi)). Therefore, using the upper bounds on the exponential moment from Section 4, we can prove Theorems 5.1 and 5.3 in the following sections. Next, we prove the following lemma. Lemma D.2. The following inequality holds. W1(ˆμφ,θ, gθ♯p(z)) ≤ Kθ n n (cid:88) i=1 (cid:114) ∥μφ (xi)∥2 + (cid:13) (cid:13)σφ (xi) − ⃗1 (cid:13) (cid:13) 2 (cid:13) (cid:13) , where ⃗1 ∈ RdZ denotes the vector whose entries are all 1. Proof. Defining the mixture of measures ˆqφ(z) = 1 n n (cid:88) i=1 qφ(z|xi), the definition of ˆμφ,θ and the definition of a pushforward measures yield ˆμφ,θ = 1 n n (cid:88) i=1 gθ♯qφ(z|xi) = gθ♯ˆqφ(z). Using the dual formulation of the Wasserstein distance, we have W1(ˆμφ,θ, gθ♯p(z)) = W1 (gθ♯ˆqφ(z), gθ♯p(z)) = sup f ∈Lip1(X ,R) (cid:20)(cid:90) Z f ◦ gθ(z) dˆqφ(z) − (cid:90) (cid:21) f ◦ gθ(z) dp(z) = sup g∈Gθ (cid:20)(cid:90) Z g(z) dˆqφ(z) − Z (cid:21) g(z) dp(z) (cid:90) Z ≤ sup g∈LipKθ (Z,R) (cid:20)(cid:90) Z g(z) dˆqφ(z) − (cid:21) g(z) dp(z) (cid:90) Z = KθW1(ˆqφ(z), p(z)), 22 where Gθ = {g : Z → R s.t. g = f ◦ gθ and f ∈ Lip1(X , R)} and the inequality holds because (Z, R), since gθ : Z → X is Kθ-Lipschitz. Now, since (p, q) (cid:55)→ W1(p, q) is convex, Gθ ⊆ LipKθ the definition of ˆqφ(z) implies W1(ˆqφ(z), p(z)) ≤ 1 n n (cid:88) i=1 W1(qφ(z|xi), p(z)) ≤ 1 n n (cid:88) i=1 W2(qφ(z|xi), p(z)). (D.2) Since, by Equation (A.2), we obtain W2(qφ(z|xi), p(z))2 = ∥μφ (xi)∥2 + (cid:13) (cid:13) 2 (cid:13)σφ (xi) − ⃗1 (cid:13) (cid:13) (cid:13) , W1(ˆμφ,θ, gθ♯p(z)) ≤ Kθ n n (cid:88) i=1 (cid:114) ∥μφ (xi)∥2 + (cid:13) (cid:13)σφ (xi) − ⃗1 (cid:13) (cid:13) 2 (cid:13) (cid:13) . D.1 Proof of Theorem 5.1 Proof of Theorem 5.1. Recall from Lemma D.1 that with probability at least 1 − δ over the random draw of S ∼ μ⊗n, λW1(μ, ˆμφ,θ) ≤ λ n n (cid:88) i=1 (cid:18) E z∼q(z|xi) (cid:19) lθ rec(z, xi) + n (cid:88) i=1 KL(q(z|xi) || p(z))+ log 1 δ + log E S∼μ⊗n E z∼p(z) eλ(Ex∼μ[lθ rec(z,x)]− 1 n (cid:80)n i=1 lθ rec(z,xi)). (D.3) In order to prove Theorem 4.3 in section C.2, we proved that (cid:34) (cid:32) E S∼μ⊗n exp λ E x∼μ (cid:2)lθ rec(z, x)(cid:3) − 1 n n (cid:88) i=1 (cid:33)(cid:35) lθ rec(z, xi) ≤ exp (cid:20) λ2∆2 8n (cid:21) . Now, we can reuse this inequality to upper-bound the last term on the right-hand side of Equation (D.3). We obtain the desired theorem: under the assumptions of Theorem 4.3, with probability at least 1 − δ over the random draw of S ∼ μ⊗n, the following holds for any posterior qφ(z|x): W1(μ, ˆμφ,θ) ≤ 1 n n (cid:88) (cid:26) i=1 E qφ(z|xi) lθ rec(z, xi) (cid:27) + 1 λ (cid:32) n (cid:88) i=1 KL(qφ(z|xi) || p(z)) + log 1 δ + λ2∆2 8n (cid:33) . D.2 Proof of Theorem 5.2 Proof of Theorem 5.2. Theorem 5.2 is a direct consequence of Theorem 5.1 and Lemma D.2 applied to Equation (D.1). D.3 Proof of Theorem 5.3 Proof of Theorem 5.3. Recall from Lemma D.1 that with probability at least 1 − δ over the random draw of S ∼ μ⊗n, λW1(μ, ˆμφ,θ) ≤ λ n n (cid:88) i=1 (cid:18) E z∼q(z|xi) (cid:19) lθ rec(z, xi) + n (cid:88) i=1 KL(q(z|xi) || p(z))+ log 1 δ + log E S∼μ⊗n E z∼p(z) eλ(Ex∼μ[lθ rec(z,x)]− 1 n (cid:80)n i=1 lθ rec(z,xi)). We can then use Lemma C.2 which stated that (cid:34) (cid:32) log E z∼p(z) E S∼μ⊗n exp λ E x∼μ (cid:2)lθ rec(z, x)(cid:3) − 23 1 n n (cid:88) i=1 (cid:33)(cid:35) lθ rec(z, xi) ≤ λ2K 2 ∗ 2n . (D.4) Figure 1: Samples from the real datasets The expectations over z and S can be swapped using Fubini's Theorem. Hence, combining Lemma C.2 and Lemma D.1, we obtain Theorem 5.3: with probability at least 1 − δ over the random draw of S ∼ μ⊗n, the following holds for any posterior qφ(z|x). W1(μ, ˆμφ,θ) ≤ 1 n n (cid:88) (cid:26) i=1 E qφ(z|xi) lθ rec(z, xi) (cid:27) + 1 λ (cid:32) n (cid:88) i=1 KL(qφ(z|xi) || p(z)) + log 1 δ + λ2K 2 ∗ 2n (cid:33) . D.4 Proof of Theorem 5.4 Proof of Theorem 5.4. Theorem 5.4 is a direct consequence of Theorem 5.3 and Lemma D.2 applied to Equation (D.1). E Numerical Experiments We computed the numerical value of the bound of Theorem 4.3. We performed the experiments on two 2-dimensional synthetic datasets. The first one is a mixture of two isotropic Gaussian distributions on R2 centered at (−1, 0) and (1, 0) respectively, and with standard deviation σ = 0.1 and null covariances. The second dataset consists of noisy samples arranged in a circle centered at the origin, with radius 1.5 and standard deviation σ = 0.1. Both datasets are truncated so that no sample is over 4 standard deviations away from its corresponding mean. This is to formally ensure that the diameter of the instance spaces is finite, as required by Theorem 4.3. The sizes of the training, validation and test sets are respectively 50,000, 20,000 and 20,000. Samples from the two datasets are shown in Figure 1. We used the same architecture and hyperparameters for both datasets. The encoder and decoder are fully connected networks with 3 hidden layers and 100 hidden units per layer. We also set the Lipschitz constants of the encoder and decoder networks to Kφ = Kθ = 2. In order to enforce Lipschitz continuity, we used Björk orthonormalization (Björck and Bowie, 1971) with GroupSort activations (Anil et al., 2019), and we utilized the implementation of Lipschitz layers by Anil et al. (2019). Note that Barrett et al. (2022) performed experiments with VAEs with fixed Lipschitz constants, but we did not directly use their implementation because of a difference in the definition of the Lipschitz norm of the encoder, which affects the implementation. Note also that unlike the usual computations of PAC-Bayesian bounds (Pérez-Ortiz et al., 2021), our implementation does not use probabilistic neural networks. It uses deterministic networks, as it is usual for VAEs, because our analysis did not include additional stochasticity. We used the MSE as the reconstruction loss during training, and computed the bounds on validation datasets. The samples from the different models are displayed in Figure 2. 24 Figure 2: Samples from the models trained on the 2-Gaussian dataset (top) and the Circle dataset (bottom). λ n/0.01 n/0.025 n/0.05 n/0.075 n/0.1 n/0.25 n/0.5 n/0.75 n/1 Test Rec. loss Emp. Rec. loss Emp. KL loss Exp. moment Bound 99.80 46.45 28.70 22.83 19.92 14.89 13.63 13.54 13.78 0.1107 0.1228 0.1299 0.1388 0.1425 0.1707 0.2120 0.2718 0.3586 0.1110 0.1237 0.1299 0.1403 0.1436 0.1732 0.2162 0.2725 0.3596 0.0192 0.0505 0.1010 0.1511 0.2003 0.4883 0.9602 1.4122 1.8593 89.00 35.60 17.80 11.867 8.900 3.560 1.780 1.1868 0.8901 Table 1: Table showing the values of the different quantities of Equation E.1 for the "2-Gaussian" dataset. The upper bound on the average distance term is 10.67. Recall the inequality of Theorem 4.3: lθ rec(z, x) E x∼μ (cid:124) E qφ(z|x) (cid:123)(cid:122) Test Rec. Loss (cid:125) ≤ n (cid:88) i=1 1 n (cid:124) (cid:26) lθ rec(z, xi) E qφ(z|xi) (cid:123)(cid:122) Emp. Rec. Loss (cid:27) (cid:125) n (cid:88) i=1 + 1 λ (cid:124) KL(qφ(z|xi) || p(z)) + (cid:123)(cid:122) Emp. KL loss λ∆2 8n (cid:124) (cid:123)(cid:122) (cid:125) Exp. moment (cid:125) (E.1) + 1 λ log 1 δ . + KφKθ∆ (cid:124) (cid:123)(cid:122) (cid:125) Avg distance Tables 1 and 2 show the numerical values of the bound of Theorem 4.3 for different values of λ. The first column is approximated using the test set, and the last one refers to all the right-hand side of (E.1). The empirical reconstruction and KL losses are computed using the validation set, since, as mentioned in the main paper, the bounds need to be computed using a set independent from the training set. From Tables 1 and 2, once can see that the bounds are dominated by two terms: the average distance and the exponential moment. Although as λ approaches n, the exponential moment gets smaller and the main influence comes from the upper bound on the average distance. Hence, in order to tighten the bound, one may need to derive tighter upper bounds on the average distance, or derive versions of Theorem 4.3 where this term is replaced by a numerically smaller one. 25 λ n/0.01 n/0.025 n/0.05 n/0.075 n/0.1 n/0.25 n/0.5 n/0.75 n/1 Test Rec. loss Emp. Rec. loss Emp. KL loss Exp. moment Bound 195.81 87.59 51.58 39.63 33.69 23.28 20.30 19.691 19.686 0.095 0.1354 0.1785 0.2005 0.2245 0.3498 0.5026 0.6171 0.7513 180.50 72.20 36.10 24.07 18.05 7.220 3.610 2.406 1.805 0.0959 0.1362 0.1783 0.2020 0.2247 0.3486 0.4940 0.6154 0.7499 0.0197 0.0525 0.1058 0.1587 0.2117 0.5160 0.9997 1.4691 1.9314 Table 2: Table showing the values of the different quantities of Equation E.1 for the "Circle" dataset. The upper bound on the average distance term is 15.2. F Additional Results and Remarks This section contains additional remarks and discussions. We start with possible extensions of our results. F.1 The variance of the likelihood Our definition of the decoder network's output (the function gθ : Z → X ) only considers the deterministic part of the decoder. In other words, our results only apply to VAEs whose likelihood has constant variance. However, they can be extended to cases when the variance of the likelihood is optimized, but at a cost. We discuss separately the two cases where the variance depends on individual datapoints or not. If the standard deviation σ of the decoder is fixed, then we have Instance-independent variance. σ ∝ n λ , (recall the hyperparameter λ from Theorem 3.1 and subsequent theorems). Hence, optimizing σ corresponds to optimizing λ, which is non-trivial in PAC-Bayes. Indeed, most PAC-Bayes bounds (including ours) do not directly allow one to optimize λ (see Section 2.1.4 of Alquier (2021)). Although there are some ways around this restriction, we are not aware of any results that allow one to optimize in the general case (meaning continuous values of λ and unbounded loss). For [0, 1]-bounded loss functions, Thiemann et al. (2017) developed a PAC-Bayes bound uniformly valid for a trade-off parameter λ′, and show that one can optimize w.r.t. both the posterior and λ′, under certain assumptions. For unbounded losses, if one assumes λ ∈ Λ, where |Λ| is finite, a union bound argument allows one to make the bound uniform with respect to λ, at the cost of log |Λ| (see Alquier (2021)). One can still optimize with respect to a continuous set Λ, by considering a grid. For instance, if one considers Λ ∩ {1, . . . , n}, then the penalty is log n and if one considers Λ ∩ {ek : 1 ≤ k ≤ n}, the penalty is log log n. Instance-dependent variance. Now, assume the standard deviation is dependent on individual instances. Say we define the reconstruction loss as lθ(z, x) = 1 σθ(z) ∥x − gθ(z)∥, where σθ : Z → R>0. Because of the division by σθ(z), let us assume that there is a fixed upper bound σ1 > 0 such that σθ(z) > σ1, for any z ∈ Z. There are two main tasks: making sure Assumption 1 is satisfied, and bounding the exponential moment of Theorem 4.2, with this new loss function. Verifying Assumption 1 is equivalent to showing that Proposition 4.1 is verified for this new loss function lθ. The second part of the proof of Proposition 4.1 tells us that we need to show that lθ is Lipschitz-continuous. Note that in general, the product of real-valued Lipschitz functions is not Lipschitz. Hence, we assume, in addition, that ∥x − gθ(z)∥ ≤ M < ∞. The following proposition shows that Assumption 1 is satisfied with the constant K = Kφ Proposition F.1. Consider a VAE with parameters φ and θ and let Kφ, Kθ ∈ R be the Lipschitz rec : Z × X → R norms of the encoder and decoder respectively. Also, consider the loss function lθ defined as (cid:16) KσM σ2 1 + Kθ σ1 (cid:17) . lθ rec(z, x) = ∥x − gθ(z)∥ 1 σθ(z) 26 where σθ : Z → R>0 is Kσ-Lipschitz. Assume and for all z ∈ Z, σθ(z) > σ1 and ∥x − gθ(z)∥ ≤ M for some fixed 0 < σ1 < 1 and M > 0. Then the variational distribution qφ(z|x) satisfies Assumption 1 with E = {f : Z → R : ∥f ∥Lip ≤ KσM σ2 1 (cid:16) KσM σ2 1 , and l = lθ }, K = Kφ + Kθ σ1 + Kθ σ1 rec. (cid:17) Proof. The first part of Assumption 1 is satisfied, since KσM σ2 1 of Assumption 1, we need to show that lθ -Lipschitz continuous. First, + Kθ σ1 > Kθ. Now, for the second part rec is KσM σ2 1 + Kθ σ1 (cid:12) (cid:12) (cid:12) (cid:12) 1 σθ(z1) − 1 σθ(z2) (cid:12) (cid:12) (cid:12) (cid:12) = (cid:12) (cid:12) (cid:12) (cid:12) σθ(z2) − σθ(z1) σθ(z1)σθ(z2) (cid:12) (cid:12) (cid:12) (cid:12) ≤ Kσ ∥z1 − z2∥ σ2 1 . We have (cid:12) rec(z1, x) − lθ (cid:12)lθ rec(z2, x(cid:12) (cid:12) = = ≤ = (cid:12) 1 (cid:12) (cid:12) σθ(z1) (cid:12) (cid:12) 1 (cid:12) (cid:12) σθ(z1) (cid:12) KσM σ2 1 (cid:18) KσM σ2 1 ∥x − gθ(z1)∥ − 1 σθ(z2) (cid:12) (cid:12) ∥x − gθ(z2)∥ (cid:12) (cid:12) − 1 σθ(z2) (cid:12) (cid:12) (cid:12) (cid:12) ∥z1 − z2∥ + 1 σθ(z2) ∥x − gθ(z1)∥ + Kθ σ1 ∥z1 − z2∥ |∥x − gθ(z1)∥ − ∥x − gθ(z2)∥| (cid:19) + Kθ σ1 ∥z1 − z2∥ Now, let us focus on bounding the exponential moment. In this case, when the instance space is bounded, the upper bound on the exponential moment (in the proof of Theorem 4.3) is: λ2∆2 8nσ2 1 , instead of λ2∆2 8n . And under the manifold assumption, we get the following upper bound (in the proof of Theorem 4.4): λ2K 2 ∗ 2nσ2 1 , instead of λ2K 2 ∗ 2n Note that although the upper bounds on the average distance remain unchanged, the coefficient KφKθ is replaced by Kφ , which is larger, specially if σ1 is very small. (cid:17) (cid:16) KσM σ2 1 + Kθ σ1 F.2 Uniformity with respect to θ As mentioned in the main paper, although our bounds hold uniformly for any encoder φ, they only hold for a given decoder θ. the consequence of this limitation is that the numerical computations of the bounds need to be done on a sample set disjoint from the training set (e.g. a validation or test set). Let Θ denote a set of decoder parameters over which the optimization is performed. From a theoretical perspective, the union bound can be used to circumvent this issue, when we consider a finite set of parameters Θ. In that case, the log 1 δ , which loosens the bound. Moreover, since Θ denotes a set of neural network parameters, this assumption may not be appropriate unless one chooses a very large set Θ, which can significantly loosen the bound. δ in Theorem 3.1 becomes log |Θ| Another option would be to make assumptions on the complexity of the set of loss functions {lθ rec : θ ∈ Θ} parameterized by decoder parameters θ ∈ Θ (e.g. the Rademacher complexity), in order to obtain uniform bounds in a more general case. We leave such explorations to future works. F.3 Additional Remarks Remark F.1 (Alternate formulation of Assumption 1). We can provide an equivalent formulation of Assumption 1. A posterior q(h|x) and a loss function l satisfy Assumption 1 with a constant K > 0 27 if and only if for any x ∈ X , (cid:12) (cid:12) (cid:12) (cid:12) E h∼q(h|x1) l(h, x) − E h∼q(h|x2) l(h, x) (cid:12) (cid:12) (cid:12) (cid:12) ≤ Kd(x1, x2). The formulation given in the paper is more intuitive, but this expression shows that the specific choice of E does not matter. The equivalence of the two formulations is a consequence of the definition of an IPM. Remark F.2 (Prior Learning in PAC-Bayes). The majority of PAC-Bayesian bounds (McAllester, 1999; Seeger, 2002; Germain et al., 2009; Mbacke et al., 2023) require the prior distribution p on the hypothesis class to be independent of the training set4. In practice, this means one has to use data-free priors when minimizing PAC-Bayes bounds. Since, in that case, the learned posterior is likely very far from the prior, the KL-divergence tends to be orders of magnitude larger than the empirical risk. In practice, this means the optimization is monopolized by the KL-divergence, leading to a poor performance of the learning algorithm. In order to avoid this issue and still obtain a valid certificate, the following "prior learning trick" is used. Split the training set S = {x1, . . . , xn} in two disjoint subsets S1, S2, where |S1| = n0, |S2| = n − n0 with n0 < n. Then, learn the prior p on S1, learn the posterior q on S (the whole training set), and compute the certificate on S2. The reason why this trick cannot be directly applied to circumvent the fact that our bounds are valid for a given decoder, is that the encoder and the decoder are jointly optimized in VAEs. Hence, one has to make sure the samples used to learn the encoder (hence, train the model) are not used in the computation of the risk certificate. We emphasize that in our case, the issue does not lie in the learning of the prior (the standard VAE considers a standard Gaussian prior), but of the loss function lθ rec, which is dependent on the decoder's parameters θ. 4PAC-Bayesian bounds with data-dependent priors were developed by Dziugaite and Roy (2018); Rivasplata et al. (2020). 28
http://arxiv.org/abs/2310.04930v2
"2023-10-10T01:36:56"
"2023-10-07T22:01:49"
Diff-Transfer: Model-based Robotic Manipulation Skill Transfer via Differentiable Physics Simulation
The capability to transfer mastered skills to accomplish a range of similar yet novel tasks is crucial for intelligent robots. In this work, we introduce $\textit{Diff-Transfer}$, a novel framework leveraging differentiable physics simulation to efficiently transfer robotic skills. Specifically, $\textit{Diff-Transfer}$ discovers a feasible path within the task space that brings the source task to the target task. At each pair of adjacent points along this task path, which is two sub-tasks, $\textit{Diff-Transfer}$ adapts known actions from one sub-task to tackle the other sub-task successfully. The adaptation is guided by the gradient information from differentiable physics simulations. We propose a novel path-planning method to generate sub-tasks, leveraging $Q$-learning with a task-level state and reward. We implement our framework in simulation experiments and execute four challenging transfer tasks on robotic manipulation, demonstrating the efficacy of $\textit{Diff-Transfer}$ through comprehensive experiments. Supplementary and Videos are on the website https://sites.google.com/view/difftransfer
[ "Yuqi Xiang", "Feitong Chen", "Qinsi Wang", "Yang Gang", "Xiang Zhang", "Xinghao Zhu", "Xingyu Liu", "Lin Shao" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04930v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04930v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.RO", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.RO", "cs.AI", "cs.LG" ]
Preprint DIFF-TRANSFER: MODEL-BASED ROBOTIC MANIP- ULATION SKILL TRANSFER VIA DIFFERENTIABLE PHYSICS SIMULATION Yuqi Xiang1, Feitong Chen2, Qinsi Wang3, Yang Gang2, Xiang Zhang4, Xinghao Zhu4, Xingyu Liu5, Lin Shao2 1Nanjing University 3University of Science and Technology of China 5Carnegie Mellon University 4University of California, Berkeley 2National University of Singapore 3 2 0 2 t c O 0 1 ] O R . s c [ 2 v 0 3 9 4 0 . 0 1 3 2 : v i X r a ABSTRACT The capability to transfer mastered skills to accomplish a range of similar yet In this work, we introduce Diff- novel tasks is crucial for intelligent robots. Transfer, a novel framework leveraging differentiable physics simulation to ef- ficiently transfer robotic skills. Specifically, Diff-Transfer discovers a feasible path within the task space that brings the source task to the target task. At each pair of adjacent points along this task path, which is two sub-tasks, Diff- Transfer adapts known actions from one sub-task to tackle the other sub-task successfully. The adaptation is guided by the gradient information from differ- entiable physics simulations. We propose a novel path-planning method to gen- erate sub-tasks, leveraging Q-learning with a task-level state and reward. We im- plement our framework in simulation experiments and execute four challenging transfer tasks on robotic manipulation, demonstrating the efficacy of Diff-Transfer through comprehensive experiments. Supplementary and Videos are on the web- site https://sites.google.com/view/difftransfer 1 INTRODUCTION The capacity for rapidly acquiring new skills in object manipulation is crucial for intelligent robots operating in real-world environments. One might wonder, how can robots efficiently learn manip- ulation skills across diverse objects? A straightforward approach would involve teaching a robot a new manipulation skill for every distinct object and task. However, this method lacks efficiency and is infeasible due to the vast variety of objects and possible robot interactions. Nonetheless, we could also notice that different manipulation skills may share common properties. As shown in Fig. 1, the one-directional pushing skill could be correlated to an object reorientation skill. Thus, it may be feasible to leverage prior knowledge acquired from one task to aid in learning another similar task. Transferring this prior knowledge and acquired skill set to new tasks could greatly enhance learning efficiency compared to starting from scratch. Our intuition to solve this transfer learning problem is that Newton's Laws apply universally in our physical world. Therefore, when involved in similar tasks where objects are moved by similar poses, robots should interact with objects in similar ways. In this way, efficiently leveraging the local information hidden in the variation of manipulation tasks could be the key to efficient task transfer learning. In this paper, we investigate the problem of transferring manipulation skills between two object manipulation tasks. Our proposed framework is depicted in Fig. 1. We approach this problem by interpolating the source task and target task by producing a large number of intermediate sub- tasks between them which gradually transform from the source task toward the target task. These continuously and gradually transforming intermediate sub-tasks act as the bridge for transferring the action sequence from the source task to the target task. To better leverage the physical property associated with the object shape and pose transformation, we leverage differentiable simulation to capture model-based gradient information and use it in 1 Preprint Figure 1: The overall approach of Diff-Transfer includes a path of L − 1 sub-tasks. Diff-Transfer leverages Local Sampler, Q-function Network and argmax function to select the best candidate to generate the (i+1)th sub-task given the ith sub-task, and learn the action sequence via differentiable physics simulation. transforming robot action sequences. We introduce a refined Q-learning method for path planning in the pose transfer problem, where we use a high-level state and a well-designed reward to generate the path of seamlessly connected sub-tasks with a sample-based searching method. We execute a series of challenging manipulation tasks using Jade(Yang et al., 2023), a differen- tiable physics simulator designed for articulated rigid bodies. We undertake four tasks: Close Grill, Change Clock, Open Door, and Open Drawer. The outcomes demonstrate that our system surpasses prevalent baselines for transfer learning and direct transfer without path planning through differen- tiable simulation, highlighting the efficacy and merits of our approach. Additionally, we perform several ablation studies. In summary, we make the following contributions: • We propose a systematic framework for model-based transfer learning, leveraging the dif- ferentiable physics-based simulation and applying our framework for pose transfer and object shape transfer. • We propose a novel path planning method for generating multiple sub-tasks in the task space and learning an action sequence for a new sub-task with the proximity property and leveraging Q-learning and differentiable physics simulation. • We conduct comprehensive experiments to demonstrate the effectiveness of our proposed transfer learning framework. 2 RELATED WORK 2.1 DIFFERENTIABLE SIMULATION FOR MANIPULATION. Significant advancements have been achieved in the field of differentiable physics engines, thanks to the evolution of automatic differentiation techniques (Paszke et al., 2019; Team et al., 2016; Hu et al., 2019a; Bell, 2020; Bradbury et al., 2018; Agarwal et al.). Various differentiable physics simulations have been developed for specific applications, such as rigid bodies (de Avila Belbute-Peres et al., 2018; Degrave et al., 2019; Yang et al., 2023), soft bodies (Hu et al., 2019a;b; Jatavallabhula et al., 2021; Geilinger et al., 2020; Du et al., 2021), cloth (Liang et al., 2019; Qiao et al., 2020; Li et al., 2022; Yu et al., 2023), articulated bodies (Werling et al., 2021; Ha et al., 2017; Qiao et al., 2021), 2 Q-functionNetwork0.10.90.5argmaxSub-Task Accomlishmentvia Differentiable SimulationLocalSamplerith sub-taskscoresSampled candidatesfor (i+1)th sub-task(i+1)th sub-taskbestcandidatesource tasktarget task0.9 Preprint and fluids (Um et al., 2020; Wandel et al., 2020; Holl et al., 2020; Takahashi et al., 2021). Sev- eral studies have applied differentiable physics simulations to robotic manipulations. Turpin et al. (2022) focused on multi-fingered grasp synthesis, while Lv et al. (2022) guided robots in manipu- lating articulated objects. Zhu et al. (2023a;b) enabled model-based learning from demonstrations by optimizing over dynamics, and Lin et al. (2022a;b) targeted deformable object manipulation. Yang et al. (2023) developed a differentiable simulation called Jade for articulated rigid bodies with Intersection-Free Frictional Contact. However, the incorporation of contact dynamics often results in non-convex optimization challenges due to discontinuities from contact mode switching (Suh et al., 2022; Antonova et al., 2022; Zhu et al., 2023a). To mitigate this, contact-centric trajectory planning has been proposed (Mordatch et al., 2012; Marcucci et al., 2017; Cheng et al., 2021; Gabiccini et al., 2018; Zhu et al., 2023a; Chen et al., 2021; Huo et al., 2023), which plans both contact points and forces and generate manipula- tion actions afterward. Additionally, Pang et al. (2022) introduced smoothing techniques for contact gradients and employed a convex quasi-dynamics model for feasible action searching. In align- ment with existing research, our study utilizes differentiable physics simulations for the purpose of transferring robotic manipulation skills across different task spaces. 2.2 TRANSFER LEARNING IN ROBOTICS. Transfer learning has become a cornerstone in robotics, aiming to generalize skills across varying tasks, environments, or robotic platforms. Although still an open challenge, the majority of re- search has employed reinforcement learning (RL) for skill transfer (Taylor & Stone, 2009). Several approaches have been proposed to address this challenge. Lazaric et al. (2008); Xu et al. (2021); Jian et al. (2021); Zhang et al. (2022; 2023b) utilize domain randomization during training to en- hance agent robustness across diverse physical environments and to focus on task-relevant features. Tirinzoni et al. (2018); Hu et al. (2023) fine-tune reward and value functions on new tasks, while Konidaris & Barto (2007), Liu et al. (2021), Zhang et al. (2023a), and Zhao et al. (2022) directly adapt policies to new environments. Finn et al. (2017) introduces a meta-learning framework to improve agent adaptability across various tasks. Chi et al. (2022) employs an iterative policy and approximates residual dynamics for runtime adaptation. Liu et al. (2022a;b) use continuous robot in- terpolation and sequentially fine-tune RL policy to transfer skills from one robot to another. Distinct from these approaches, our work adopts a model-based perspective for policy transfer. We utilize differentiable simulations to approximate physical dynamics and directly optimize pre-existing poli- cies. We address the key differences between source and target environments as rewards where we accommodate varying manipulation goals that yield different reward functions. 3 PROBLEM STATEMENT r,source, s(t) We consider two object manipulation tasks on a robot with m joints. We assume the source ma- nipulation task is specified by the goal of object pose change ∆ssource ∈ R6. Suppose applying a given expert action sequence Asource = [a(t) t=1 on the task would yield a state-action trajectory o,source ∈ R6, a(t) r,source ∈ Rm, s(t) τsource = [(s(t) source ∈ Rm denotes robot state, object state and robot action at time t. We assume action sequence Asource can suc- cessfully complete the task, i.e. moving the object from the starting pose s(1) o,source to the goal pose o,source = s(1) s(T ) t=1 that can successfully complete a new target manipulation task ∆starget specified by the goal of object pose change ∆starget. o,source + ∆ssource. Our objective is to derive an action sequence Atarget = [a(t) source]T t=1 where s(t) o,source, a(t) source)]T target]T 4 TECHNICAL APPROACH We approach this problem by defining a path consisting of L tasks P = [∆s1, ∆s2, . . . , ∆sL] (1) that connects the source and target tasks where ∆s1 = ∆ssource is the source task and ∆sL = ∆starget is the target task. Our approach consists of L − 1 steps of action transfer. At step i, our goal is to transfer a well-optimized action sequence Ai on task ∆si to be a well-optimized action sequence 3 Preprint Ai+1 on the next task in the sequence ∆si+1. For any i, we assume the difference between tasks ∆si and ∆si+1 is sufficiently small so that the it is relatively easy to use local information such as differentiable simulation gradient to optimization for actions transfer. ||∆si − ∆si+1|| < ε1 (2) where ε1 denotes the upper limit between the final object state for two consecutive sub-tasks. This property is crucial to our gradient-based method in the following sub-section. 4.1 HOW TO ACCOMPLISH A SUB-TASK Our approach to deduce the requisite actions is through a gradient-based methodology. Under the assumption that the subsequent sub-task goal pose deviates from the current goal pose with a limited distance as described in Eq. 2, we posit that the actions for the sub-task are in close proximity to the actions of the source. This postulation naturally lends itself to the application of gradient descent for optimization. We aim to optimize our current action sequence {a(t) t=1, denoted as Acur, with its initialization of Ai. The rollout trajectory based on Acur is denoted τcur = {(s(t) To elaborate, for each specific task, we introduce a loss function, Ltask. o,cur, a(t) r,cur, s(t) cur)}T cur}T t=1 Ltask = ||∆scur − ∆si+1||2 (3) where ∆starget is the object pose change of (i + 1)th sub-task goal and ∆scur is the object pose change of our rollout trajectory. We regard the task as accomplished if Ltask is smaller than a certain threshold εt. Utilizing the capabilities of the differentiable simulation framework Jade, we compute the gradient (cid:26) ∂Ltask ∂a(t) cur . Subsequently, the current actions Acur are updated to minimize ∂Ltask ∂Acur , denoted as (cid:27)T t=1 the task loss Ltask. Acur ← Acur − η ∂Ltask ∂Acur (4) Thus we introduce Algorithm 1 as a function TRANSFERSTEP, since we will reuse this function in Section 4.1. It takes the trajectory τi for ith sub-task and the object pose change ∆si+1 for (i + 1)th sub-task as input. And it will output the optimized task loss Ltask, the boolean value X indicating if the sub-task is successfully completed, and the rollout trajectory τi+1 based on the optimized actions Acur. If X is True, then Acur is the desired Ai+1. This algorithm iteratively refines the action sequence Acur over a maximum of nepoch iterations or until a convergence criterion is met. 4.2 SUB-TASKS GENERATION Given Algorithm 1 and the path P, it is easy to compute the optimized actions At for our target task, since we can use dynamic programming to optimize Ai+1 based on Ai. The only problem is to generate one feasible path P where not only the property in Eq. 2 holds but also the Algorithm 1 tends to return the successful result with optimized action sequence Ai+1 and the corresponding trajectory τi+1 for (i + 1)th sub-task for each index i. This reduces the problem into a path planning problem in the goal pose space where each node in the space denotes a goal final object state and we aim to build a path connecting the source goal pose and the target one. While there are lots of traditional path-planning algorithms in 3-D Euclidean space, they fail to solve our problem because the goal pose space is in a higher dimension and the obstacle is harder to detect. We introduce our innovative reinforcement learning method by predicting the difficulty of sub-tasks using a refined Q-function neural network Q(x; θ) parameterized by θ. Instead of taking input of the conventional state and action at time t, the network takes a high-level state input x, which could be any object pose change like ∆starget. The output r would be the estimated reward. 4 Preprint t=1, ∆si+1 i )}T o,i, a(t) Algorithm 1 Sub-Task Accomplishment 1: Input: τi = {(s(t) r,i , s(t) 2: Output: Ltask, X, τi+1 3: function TRANSFERSTEP(τs, ∆si+1) s(1) r,i , a(t) r,cur ← s(1) 4: for e in 1, 2, . . . , nepoch do 5: 6: 7: for t in 1, 2, . . . , T − 1 do r,cur , s(t+1) cur ← a(t) i , t = 1, 2, . . . , T o,cur ) ← simulate(s(t) r,cur, s(t) o,cur, a(t) cur) (s(t+1) ∆scur ← s(T ) o,cur − s(1) o,cur Ltask ← ||∆scur − ∆si+1||2 Acur ← Acur − η if Ltask ≤ εt then ∂Ltask ∂Acur return Ltask, True, {(s(t) r,cur, s(t) return Ltask, False, {(s(t) r,cur, s(t) o,cur, a(t) o,cur, a(t) cur)}T t=1 cur)}T t=1 8: 9: 10: 11: 12: 13: Unlike traditional RL problems with clear task rewards, the reward in our problem needs an elaborate design because we are performing path planning on a higher task-space level. We introduce the reward function as r(x) = −(λt * Ltask + λd * ||x − ∆starget||2) (5) To illustrate this equation, the first term Ltask is computed using Eq. 3 where ∆si+1 is given as x and ∆scur is given by the optimized actions Acur for sub-task goal x. The second term ||x − ∆starget||2, shortly as Ldis, describes the distance from pose change x to the target pose change ∆starget. Finally, λt and λd are weight coefficients to balance these two terms. Therefore, such reward results in a better path-planning algorithm because when the reward is high, both the task loss Ltask and the distance to target goal Ldis are low. Suppose we have the accurate Q(x; θ) network, we can generate the path P in either a gradient-based way or a sample-based way. We employ the sampled-based approach for the current pose transfer problem to increase the robustness of stochastic noise from the inaccurate network in reality. In detail, given ith sub-task with a pose change ∆si, we sample n vectors {xj}n j=1, denoted as S, in the task space in the neighbourhood of the ith sub-task goal ∆si, so that ||∆si − xj|| < εsample, j = 1, 2, . . . , n (6) where εsample is the radius of the neighbourhood. In these n candidates for the (i + 1) sub-task, we choose the best one k based on our current knowledge to maximize the reward rk k = arg max j rj, j = 1, 2, . . . , n (7) Once we get the best candidate xk, we call the function TRANSFERSTEP in Algorithm 1, in an attempt to optimize an action sequence Ai+1 for the given (i + 1)th sub-task. Should this process be successful, we shall continue to generate the next sub-task recursively until the target goal is attained. Otherwise, we shall discard this candidate xk and find an alternative best candidate from S iteratively, as is shown in Algorithm 2. To learn an approximate network Q(x; θ), we maintain a dataset D dynamically during the path- planning process. Each time after we call the TRANSFERSTEP function and get more information about the task space, we add the data pair (xk, rk) into D, update θ with the Q-learning method to gain a better network and proceed on path planning. 5 Preprint 4.3 IMPLEMENTATION DETAILS In this section, we discuss the implementation details of Diff-Transfer in Algorithm 2. To begin with, we pre-train our network Q(x; θ) with a refined initial reward in Eq. 5, where Ltask is set to a certain constant ct because we cannot know the difficulty of any sub-task beforehand. Specifically, we generate labels (xpre, rpre) randomly to build a dataset Dpre and use it to fit θ using a supervised learning method via minimizing the loss lpre(θ) = ||Q(xpre; θ) − rpre||2. With online dataset D = {(xk, rk)}m k=1 collected during execution of our path-planning method, network parameters θ will be fine-tuned to minimize the loss l(θ) = ||Q(xk; θ)−rk||2. It is worth noting that D doesn't contain data from Dpre because data in D collected from rollouts in simulation reflect the actual rewards of sub-tasks while Dpre just provides a rough estimation under the hypothesis that all sub-tasks have same difficulties, which is hardly true in the real transfer problem. j=1 in the neighbourhood of ∆si return τi if ||∆si − ∆starget|| ≤ εpose then Randomly sample n vectors S ← {xj}n rj ← Qθ(xj), j = 1, 2...n. while S ̸= ∅ do Algorithm 2 Q-function Network Guided Path Planning 1: function PATHSEARCH(τi, ∆starget) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: k ← arg maxj rj Ltask, X, τi+1 ← TRANSFERSTEP(τi, xk) Ldis ← ||xk − ∆starget||2 rk ← −(λt * Ltask + λd * Ldis) D ← D ∪ {(xk, rk)} Update θ using dataset D if X = True then S ← S − {xk} continue PATHSEARCH(τi+1, ∆starget) return failure else 5 EXPERIMENTS In this section, we present a rigorous experimental framework meticulously designed to elucidate the effectiveness of our proposed system Diff-Transfer. This exhaustive evaluation encompasses an assessment of the system's performance across diverse conditions, while also subjecting it to rigor- ous scrutiny in the presence of unforeseen challenges. The tests conducted in this study are geared towards offering a comprehensive panorama of the system's capabilities. Our foremost objective is to substantiate the theoretical foundations expounded earlier and establish a seamless connection between theory and practical implementation, thereby affirming the system's scalability and adapt- ability across a multitude of application domains. 5.1 EXPERIMENTAL SETUP 5.1.1 SIMULATION SETTING We choose multiple manipulation tasks from RLBench (James et al., 2020) and adapt the environ- ment to the Jade(Yang et al., 2023) simulation. Specifically, we acquire the trajectory of states for each task, along with the objects' Unified Robot Description Format (URDF) files and correspond- ing mesh files. Actions are computed utilizing inverse dynamics and optimization within Jade, providing us with a comprehensive initial trajectory of both states and actions, denoted as τsource. 6 Preprint (a) (b) (c) (d) Figure 2: Source Task (grey object) and Target Task (orange object) for (a) Change Clock, (b) Close Grill, (c) Open Door, and (d) Open Drawer. 5.1.2 EVALUATION METRIC We employ the number of iterations N in the optimization loop to evaluate the efficiency of our methods and compare the results. We also report the distance d, which is a task-related metric describing the completeness of manipulation. For each specific manipulation task, we run 5 times our method to reduce the effect of randomness and report the mean value for both the iterative steps and the distance as ̄N and ̄d, and the standard deviation as σN and σd. 5.1.3 MANIPULATION SKILL TRANSFER TASKS Close Grill The robot is required to close a grill lid. This task is considered successful if the grill lid has been rotated to close. The distance d describes the distance from the final angle of the grill lid joint to the target angle, with a unit of degrees. Change Clock The robot is required to change a clock. This task is considered successful if the clock pointer has been revoluted to a specific orientation. The distance d describes the distance from the final angle of the clock pointer to the target angle, with a unit of degrees. Open Door The robot is required to open a door. This task is considered successful if the door has been rotated to a specific orientation from the door frame. The distance d describes the distance from the final angle of the door to the target angle, with a unit of degrees. Open Drawer The robot is required to open a drawer. The chest has 3 drawers. This task is considered successful if the specific drawer has been pulled out from the chest. The distance d describes the distance from the final translation of the drawer to the target angle, with a unit of meters. 5.1.4 IMPLEMENTATION DETAILS To illustrate the details presented in Section 4, we define ∆si, the objective of the ith sub-task, as the base pose change of the manipulated object from its pose in the source task. This definition slightly diverges from the description in Section 3, as these intricate manipulation tasks require the robot to manipulate the object's joint, rather than altering its pose by pushing. We employ a three-layer MLP to implement the Q-function network Q(x; θ). Rather than directly utilizing the reward function in Eq. 5, we characterize the output network as an estimated loss with a value of −r(x), explaining why the landscapes in Fig. 3 exhibit a minimum area instead of a maximum, a point to be discussed in subsequent Section 5.3. 5.2 BASELINE DMP DMP (Dynamic Movement Primitives) is a method for learning and reproducing complex dynamic movement skills in robots and other systems, making it easier for them to perform tasks such as reaching and grasping objects. Specifically, for a transfer task, we use the robot trajectory of the source task to fit the dmp function, modify the object target on the target task and reproduce the motion trajectory. 7 Preprint Method Task Name Change Clock Close Grill Open Door Open Drawer Diff-Transfer (Ours) MAML DMG Direct Transfer ̄N 55.6 66.4 57.8 123.8 σN 61.1 11.5 38.2 103.9 ̄d 3.72 1.80 0.64 0.06 σd 1.38 0.55 0.43 0.00 d success d success N d success 10.27 18.54 9.20 0.08 × × × × 27.46 56.71 41.91 0.18 × × × × 1000+ 1000+ 255 1000+ 19.66 8.53 1.40 0.12 × × ✓ × Table 1: Experiment Results for MAML, DMG, Direct Transfer and our Diff-Transfer. Diff-Transfer is executed using 5 distinct random seeds. Method Task Name Change Clock Close grill Open Door Open Drawer Diff-Transfer ̄d 3.72 1.80 0.64 0.06 σN 61.1 11.5 38.2 103.9 ̄N 55.6 66.4 57.8 123.8 Diff-Transfer (λt = 0) Linear Interpolation σd 1.38 0.55 0.43 0.00 ̄N 51.0 96.6 185.4 527.0 σN 28.7 28.4 118.3 712.0 ̄d 3.23 2.45 2.78 0.06 σd 1.70 0.55 2.16 0.00 N 68.0 157.0 113.0 309.0 success ✓ ✓ ✓ × d 5.43 3.36 4.11 0.38 Table 2: Experiment Results for Diff-Transfer (Ours), Diff-Transfer (λt = 0), and Linear Interpola- tion. Both Diff-Transfer and Diff-Transfer (λt = 0) are executed using 5 distinct random seeds. MAML Model-agnostic meta-learning (MAML) is a meta-learning algorithm that enables ma- chine learning models to quickly adapt to new tasks with minimal training data by learning good initializations that can be fine-tuned for specific tasks, making it highly applicable to a variety of applications. application. Specifically, for a transfer task, we perform learning on 4 source tasks and perform trajectory prediction on a target task. In our experiments, the trained policy is a two-layer MLP network with 128 hidden units in each layer. We use the adam optimizer and SGD loss function to train the policy for 1000 epochs. In each epoch, we perform task-level training and meta-training. During each task-level training, we sample 20 trajectories on four source tasks to update the param- eters of the task-level strategy. During each meta-training, we use task-level update parameters to sample 5 trajectories on 4 source tasks and update the policy parameters. We will train the final trained policy on the target task for 20 epochs to fine-tune the parameters, and calculate whether the policy given at this time can complete the target task. Direct Transfer To demonstrate the efficacy of our path-searching method, we assess the direct transferring technique on each task, using it as one of the baselines, denoted as Direct Transfer. Contrary to constructing a path where the source task and the target task are cohesively linked via several intermediate sub-tasks as in Algorithm 2, Direct Transfer solely endeavors to optimize an action sequence for the target task, directly drawing from the source task trajectory through differentiable simulation, as outlined in Algorithm 1. 5.3 EXPERIMENT RESULTS The iteration counts N and distances d are detailed in Table 1 for Diff-Transfer, MAML, DMG, and Direct Transfer. As illustrated in the table, our algorithm manifests superior efficacy across all eval- uated tasks. While MAML and DMG are unable to successfully accomplish any of the four tasks, and Direct Transfer only yields a successful outcome in the Open Door task, our Diff-Transfer manages to fulfill all four tasks, achieving a success rate of 100% across 5 varied random seeds. Additionally, Diff-Transfer requires significantly fewer iterative steps compared to Direct Transfer to accomplish the transfer task, underscoring the criticality of constructing a seamless path to mitigate the complex- ity of each sub-task transfer, and highlighting that attempts to transfer via brute force are frequently either impractical or necessitate more iterations. Regarding MAML and DMG, these methods, being somewhat antiquated, struggle to finalize this innovative transfer task within a reasonable time. To confirm the validity of our path-planning approach, we have depicted the landscape of our Q- function network in Fig. 3. In each depiction, the horizontal axis denotes the translation, and the vertical axis denotes the orientation, together constituting a task space for any alterations in pose. The origin represents the target pose change ∆starget while the top right corner represents the source 8 Preprint (a) (b) (c) (d) Figure 3: Visualization of learned Q-function Landscapes for (a) Change Clock, (b) Close Grill, (c) Open Door, and (d) Open Drawer. The x-axis represents translation, and the y-axis represents orientation. The origin symbolizes the change in target pose, ∆starget, while the top right corner denotes the change in source task pose, ∆ssource. task pose change ∆ssource. As exhibited in the images, there exists a minimum area surrounding the origin, indicating that the network directs correctly toward the target task. Moreover, this area does not necessarily need to be precisely at the origin; given the varying complexities of different tasks, completing a sub-task pose near the ∆ssource is often more feasible, resulting in a lower value of Ltask in Eq. 3 and, subsequently, contributing to a reduced total loss. This task-level characteristic elucidates why these landscapes exhibit a similar pattern with the aforementioned minimum area around the origin, aligning with our anticipations, even though the low-level manipulations might significantly diverge. 5.4 ABLATION STUDY: Employ Different Path-Planning Methods We conduct two different ablation tests for Diff-Transfer with distinct path-planning methods. 1. We remove the Q-learning network and replace it with a deterministic linear interpolation method between ∆ssource and ∆starget, denoted as Linear Interpolation. 2. We refine the reward function in Eq. 5 by removing the task loss term, with λt = 0, denoted as Diff-Transfer (λt = 0). Our experiment results for the ablation study are presented in Table 2. Generally speaking, both Diff-Transfer and Diff-Transfer (λt = 0) achieve a 100% success rate across four tasks, employing 5 distinct random seeds, while Linear Interpolation succeeds in three out of the four transfer tasks. This denotes that path planning, even by naive methods, can substantially elevate the success rate in transferring manipulation tasks. To elaborate, the data reveals that our Diff-Transfer excels in tasks such as Close grill, Open Door, and Open Drawer, exhibiting quicker convergence (smaller N ) and heightened precision in manipulation outcomes (smaller d) compared to Diff-Transfer (λt = 0) and Linear Interpolation. Regarding the Change Clock task, Diff-Transfer, ablation, and Linear Interpo- lation display comparable performance, suggesting that accomplishing this transfer task via differen- tiable physics simulation is relatively uncomplicated. In conclusion, the path-planning methodology employed in Diff-Transfer is imperative and efficient, leading to enhanced success rates and reduced time expenditures in most instances. 6 CONCLUSION In this paper, we introduced an advanced framework aiming to revolutionize the paradigm of robotic manipulation skill acquisition through transfer learning. Drawing inspiration from the omnipresence of Newtonian principles, our method centers on the potential to generalize manipulation strategies across object poses in 3-D Euclidean space. To navigate the complex landscape, we instigate a bridge mechanism, employing a continuum of intermediate sub-tasks as conduits for the seamless relay of skills between distinct object poses, where the path of sub-tasks is generated through a re- fined Q-function network with task-level states and rewards. This focus is further bolstered by our integration of differentiable simulation, affording us an intricate understanding of the physical in- tricacies inherent in pose transformations. The compelling results from our meticulous experiments 9 Preprint underscore the robustness and efficacy of our proposed framework. In summation, our pioneering contributions herald a new era in robotic adaptability, reducing the dependency on ground-up learn- ing and accelerating the skill transfer processes, particularly in the realms of manipulations with different object poses. REFERENCES Sameer Agarwal, Keir Mierle, and Others. Ceres solver. http://ceres-solver.org. Rika Antonova, Jingyun Yang, Krishna Murthy Jatavallabhula, and Jeannette Bohg. Rethinking optimization with differentiable simulation from a global perspective. In 6th Annual Conference on Robot Learning, 2022. Bradley Bell. Cppad: a package for c++ algorithmic differentiation. http://www.coin-or. org/CppAD, 2020. James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao JAX: composable transformations of Python+NumPy programs, 2018. URL http: Zhang. //github.com/google/jax. Claire Chen, Preston Culbertson, Marion Lepert, Mac Schwager, and Jeannette Bohg. Trajectotree: Trajectory optimization meets tree search for planning multi-contact dexterous manipulation. In 2021 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 8262– 8268, 2021. doi: 10.1109/IROS51168.2021.9636346. Xianyi Cheng, Eric Huang, Yifan Hou, and Matthew T. Mason. Contact mode guided sampling- based planning for quasistatic dexterous manipulation in 2d. In 2021 IEEE International Confer- ence on Robotics and Automation (ICRA), pp. 6520–6526, 2021. doi: 10.1109/ICRA48506.2021. 9560766. Cheng Chi, Benjamin Burchfiel, Eric Cousineau, Siyuan Feng, and Shuran Song. Iterative resid- ual policy for goal-conditioned dynamic manipulation of deformable objects. In Proceedings of Robotics: Science and Systems (RSS), 2022. End-to-end differentiable physics Filipe de Avila Belbute-Peres, Kevin Smith, Kelsey Allen, Josh Tenenbaum, and J. Zico In S. Ben- Kolter. and R. Garnett gio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, (eds.), Advances in Neural Information Processing Systems, volume 31. Curran Asso- ciates, Inc., 2018. URL https://proceedings.neurips.cc/paper/2018/file/ 842424a1d0595b76ec4fa03c46e8d755-Paper.pdf. learning and control. for Jonas Degrave, Michiel Hermans, Joni Dambre, et al. A differentiable physics engine for deep learning in robotics. Frontiers in neurorobotics, pp. 6, 2019. Tao Du, Kui Wu, Pingchuan Ma, Sebastien Wah, Andrew Spielberg, Daniela Rus, and Wojciech Matusik. Diffpd: Differentiable projective dynamics. ACM Trans. Graph., 41(2), nov 2021. ISSN 0730-0301. doi: 10.1145/3490168. URL https://doi.org/10.1145/3490168. Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International conference on machine learning, pp. 1126–1135. PMLR, 2017. Marco Gabiccini, Alessio Artoni, Gabriele Pannocchia, and Joris Gillis. A Computational Frame- work for Environment-Aware Robotic Manipulation Planning, pp. 363–385. Springer Interna- tional Publishing, 2018. ISBN 978-3-319-60916-4. doi: 10.1007/978-3-319-60916-4 21. Moritz Geilinger, David Hahn, Jonas Zehnder, Moritz B ̈acher, Bernhard Thomaszewski, and Stelian Coros. Add: Analytically differentiable dynamics for multi-body systems with frictional contact. ACM Transactions on Graphics (TOG), 39(6):1–15, 2020. 10 Preprint Sehoon Ha, Stelian Coros, Alexander Alspach, Joohyung Kim, and Katsu Yamane. Joint optimiza- tion of robot design and motion parameters using the implicit function theorem. In Siddhartha Srinivasa, Nora Ayanian, Nancy Amato, and Scott Kuindersma (eds.), Robotics, Robotics: Sci- ence and Systems, United States, 2017. MIT Press Journals. doi: 10.15607/rss.2017.xiii.003. Publisher Copyright: © 2017 MIT Press Journals. All rights reserved.; 2017 Robotics: Science and Systems, RSS 2017 ; Conference date: 12-07-2017 Through 16-07-2017. Philipp Holl, Vladlen Koltun, and Nils Thuerey. Learning to control pdes with differentiable physics. arXiv preprint arXiv:2001.07457, 2020. Yuanming Hu, Tzu-Mao Li, Luke Anderson, Jonathan Ragan-Kelley, and Fr ́edo Durand. Taichi: a language for high-performance computation on spatially sparse data structures. ACM Transac- tions on Graphics (TOG), 38(6):201, 2019a. Yuanming Hu, Jiancheng Liu, Andrew Spielberg, Joshua B Tenenbaum, William T Freeman, Jiajun Wu, Daniela Rus, and Wojciech Matusik. Chainqueen: A real-time differentiable physical simu- lator for soft robotics. In 2019 International conference on robotics and automation (ICRA), pp. 6265–6271. IEEE, 2019b. Zheyuan Hu, Aaron Rovinsky, Jianlan Luo, Vikash Kumar, Abhishek Gupta, and Sergey Levine. Reboot: Reuse data for bootstrapping efficient real-world dexterous manipulation. arXiv preprint arXiv:2309.03322, 2023. Mingxiao Huo, Mingyu Ding, Chenfeng Xu, Thomas Tian, Xinghao Zhu, Yao Mu, Lingfeng Sun, Masayoshi Tomizuka, and Wei Zhan. Human-oriented Representation Learning for Robotic Ma- nipulation. arXiv e-prints, art. arXiv:2310.03023, October 2023. Stephen James, Zicong Ma, David Rovick Arrojo, and Andrew J Davison. Rlbench: The robot learning benchmark & learning environment. IEEE Robotics and Automation Letters, 5(2):3019– 3026, 2020. Krishna Murthy Jatavallabhula, Miles Macklin, Florian Golemo, Vikram Voleti, Linda Petrini, Mar- tin Weiss, Breandan Considine, J ́erˆome Parent-L ́evesque, Kevin Xie, Kenny Erleben, et al. grad- sim: Differentiable simulation for system identification and visuomotor control. arXiv preprint arXiv:2104.02646, 2021. Pingcheng Jian, Chao Yang, Di Guo, Huaping Liu, and Fuchun Sun. Adversarial skill learning for robust manipulation. In 2021 IEEE International Conference on Robotics and Automation (ICRA), pp. 2555–2561. IEEE, 2021. George Dimitri Konidaris and Andrew G Barto. Building portable options: Skill transfer in rein- forcement learning. In Ijcai, volume 7, pp. 895–900, 2007. Alessandro Lazaric, Marcello Restelli, and Andrea Bonarini. Transfer of samples in batch rein- forcement learning. In Proceedings of the 25th international conference on Machine learning, pp. 544–551, 2008. Yifei Li, Tao Du, Kui Wu, Jie Xu, and Wojciech Matusik. Diffcloth: Differentiable cloth simulation ISSN 0730-0301. doi: 10.1145/ with dry frictional contact. ACM Trans. Graph., mar 2022. 3527660. URL https://doi.org/10.1145/3527660. Just Accepted. Junbang Liang, Ming Lin, and Vladlen Koltun. Differentiable cloth simulation for inverse prob- In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alch ́e-Buc, E. Fox, and R. Gar- lems. nett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Asso- ciates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/ 28f0b864598a1291557bed248a998d4e-Paper.pdf. Xingyu Lin, Zhiao Huang, Yunzhu Li, Joshua B. Tenenbaum, David Held, and Chuang Gan. Diff- skill: Skill abstraction from differentiable physics for deformable object manipulations with tools. 2022a. 11 Preprint Xingyu Lin, Carl Qi, Yunchu Zhang, Zhiao Huang, Katerina Fragkiadaki, Yunzhu Li, Chuang Gan, and David Held. Planning with spatial-temporal abstraction from point clouds for deformable object manipulation. In 6th Annual Conference on Robot Learning, 2022b. URL https:// openreview.net/forum?id=tyxyBj2w4vw. Chenyu Liu, Yan Zhang, Yi Shen, and Michael M Zavlanos. Learning without knowing: Unobserved context in continuous transfer reinforcement learning. In Learning for Dynamics and Control, pp. 791–802. PMLR, 2021. Xingyu Liu, Deepak Pathak, and Kris Kitani. Revolver: Continuous evolutionary models for robot- to-robot policy transfer. In International Conference on Machine Learning, pp. 13995–14007. PMLR, 2022a. Xingyu Liu, Deepak Pathak, and Kris M Kitani. Herd: Continuous human-to-robot evolution for learning from human demonstration. In 6th Annual Conference on Robot Learning, 2022b. Jun Lv, Qiaojun Yu, Lin Shao, Wenhai Liu, Wenqiang Xu, and Cewu Lu. Sagci-system: Towards In 2022 IEEE sample-efficient, generalizable, compositional, and incremental robot learning. International Conference on Robotics and Automation (ICRA). IEEE, 2022. Tobia Marcucci, Marco Gabiccini, and Alessio Artoni. A two-stage trajectory optimization strat- egy for articulated bodies with unscheduled contact sequences. IEEE Robotics and Automation Letters, 2(1):104–111, 2017. doi: 10.1109/LRA.2016.2547024. Igor Mordatch, Zoran Popovi ́c, and Emanuel Todorov. Contact-invariant optimization for hand manipulation. In Proceedings of the ACM SIGGRAPH/Eurographics Symposium on Computer Animation, SCA '12, pp. 137–144. Eurographics Association, 2012. ISBN 9783905674378. Tao Pang, H. J. Terry Suh, Lujie Yang, and Russ Tedrake. Global planning for contact-rich manipu- lation via local smoothing of quasi-dynamic contact models, 2022. Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32: 8026–8037, 2019. Yi-Ling Qiao, Junbang Liang, Vladlen Koltun, and Ming C Lin. Scalable differentiable physics for learning and control. arXiv preprint arXiv:2007.02168, 2020. Yi-Ling Qiao, Junbang Liang, Vladlen Koltun, and Ming C Lin. Efficient differentiable simulation of articulated bodies. In International Conference on Machine Learning, pp. 8661–8671. PMLR, 2021. Hyung Ju Suh, Max Simchowitz, Kaiqing Zhang, and Russ Tedrake. Do differentiable simulators give better policy gradients? In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepes- vari, Gang Niu, and Sivan Sabato (eds.), Proceedings of the 39th International Conference on Ma- chine Learning, volume 162 of Proceedings of Machine Learning Research, pp. 20668–20696. PMLR, 17–23 Jul 2022. Tetsuya Takahashi, Junbang Liang, Yi-Ling Qiao, and Ming C. Lin. Differentiable fluids with solid coupling for learning and control. Proceedings of the AAAI Conference on Artificial Intelligence, 35(7):6138–6146, May 2021. doi: 10.1609/aaai.v35i7.16764. URL https://ojs.aaai. org/index.php/AAAI/article/view/16764. Matthew E Taylor and Peter Stone. Transfer learning for reinforcement learning domains: A survey. Journal of Machine Learning Research, 10(7), 2009. The Theano Development Team, Rami Al-Rfou, Guillaume Alain, Amjad Almahairi, Christof Angermueller, Dzmitry Bahdanau, Nicolas Ballas, Fr ́ed ́eric Bastien, Justin Bayer, Anatoly Be- likov, et al. Theano: A python framework for fast computation of mathematical expressions. arXiv preprint arXiv:1605.02688, 2016. 12 Preprint Andrea Tirinzoni, Rafael Rodriguez Sanchez, and Marcello Restelli. Transfer of value functions via variational methods. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 31. Cur- ran Associates, Inc., 2018. URL https://proceedings.neurips.cc/paper_files/ paper/2018/file/9023effe3c16b0477df9b93e26d57e2c-Paper.pdf. Dylan Turpin, Liquan Wang, Eric Heiden, Yun-Chun Chen, Miles Macklin, Stavros Tsogkas, Sven Dickinson, and Animesh Garg. Grasp'd: Differentiable contact-rich grasp synthesis for multi- fingered hands. In Computer Vision–ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23–27, 2022, Proceedings, Part VI, pp. 201–221. Springer, 2022. Kiwon Um, Robert Brand, Yun Raymond Fei, Philipp Holl, and Nils Thuerey. Solver-in-the-loop: Learning from differentiable physics to interact with iterative pde-solvers. Advances in Neural Information Processing Systems, 33:6111–6122, 2020. Nils Wandel, Michael Weinmann, and Reinhard Klein. Learning incompressible fluid dynam- arXiv preprint ics from scratch–towards fast, differentiable fluid models that generalize. arXiv:2006.08762, 2020. Keenon Werling, Dalton Omens, Jeongseok Lee, Ioannis Exarchos, and C Karen Liu. Fast and feature-complete differentiable physics for articulated rigid bodies with contact. In Proceedings of Robotics: Science and Systems (RSS), July 2021. Zhuo Xu, Wenhao Yu, Alexander Herzog, Wenlong Lu, Chuyuan Fu, Masayoshi Tomizuka, Yunfei Bai, C Karen Liu, and Daniel Ho. Cocoi: Contact-aware online context inference for generaliz- able non-planar pushing. In 2021 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 176–182. IEEE, 2021. Gang Yang, Siyuan Luo, and Lin Shao. Jade: A differentiable physics engine for articulated rigid bodies with intersection-free frictional contact. arXiv preprint arXiv:2309.04710, 2023. Xinyuan Yu, Siheng Zhao, Siyuan Luo, Gang Yang, and Lin Shao. Diffclothai: Differentiable cloth simulation with intersection-free frictional contact and differentiable two-way coupling with articulated rigid bodies. In 2023 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2023. Xiang Zhang, Shiyu Jin, Changhao Wang, Xinghao Zhu, and Masayoshi Tomizuka. Learning inser- tion primitives with discrete-continuous hybrid action space for robotic assembly tasks. In 2022 International Conference on Robotics and Automation (ICRA), pp. 9881–9887. IEEE, 2022. Xiang Zhang, Siddarth Jain, Baichuan Huang, Masayoshi Tomizuka, and Diego Romeres. Learning generalizable pivoting skills. arXiv preprint arXiv:2305.02554, 2023a. Xiang Zhang, Changhao Wang, Lingfeng Sun, Zheng Wu, Xinghao Zhu, and Masayoshi Tomizuka. Efficient sim-to-real transfer of contact-rich manipulation skills with online admittance residual learning. In 7th Annual Conference on Robot Learning, 2023b. Tony Z. Zhao, Jianlan Luo, Oleg Sushkov, Rugile Pevceviciute, Nicolas Heess, Jon Scholz, Stefan Schaal, and Sergey Levine. Offline meta-reinforcement learning for industrial insertion. In 2022 International Conference on Robotics and Automation (ICRA), pp. 6386–6393, 2022. doi: 10. 1109/ICRA46639.2022.9812312. Xinghao Zhu, JingHan Ke, Zhixuan Xu, Zhixin Sun, Bizhe Bai, Jun Lv, Qingtao Liu, Yuwei Zeng, Qi Ye, Cewu Lu, Masayoshi Tomizuka, and Lin Shao. Diff-lfd: Contact-aware model-based learning from visual demonstration for robotic manipulation via differentiable physics-based sim- ulation and rendering. In Conference on Robot Learning. PMLR, 2023a. Xinghao Zhu, Wenzhao Lian, Bodi Yuan, C. Daniel Freeman, and Masayoshi Tomizuka. Allowing safe contact in robotic goal-reaching: Planning and tracking in operational and null spaces. In 2023 IEEE International Conference on Robotics and Automation (ICRA), pp. 8120–8126, 2023b. doi: 10.1109/ICRA48891.2023.10160649. 13
http://arxiv.org/abs/2310.04929v1
"2023-10-07T21:57:23"
"2023-10-07T21:57:23"
DISCOVER: Making Vision Networks Interpretable via Competition and Dissection
Modern deep networks are highly complex and their inferential outcome very hard to interpret. This is a serious obstacle to their transparent deployment in safety-critical or bias-aware applications. This work contributes to post-hoc interpretability, and specifically Network Dissection. Our goal is to present a framework that makes it easier to discover the individual functionality of each neuron in a network trained on a vision task; discovery is performed in terms of textual description generation. To achieve this objective, we leverage: (i) recent advances in multimodal vision-text models and (ii) network layers founded upon the novel concept of stochastic local competition between linear units. In this setting, only a small subset of layer neurons are activated for a given input, leading to extremely high activation sparsity (as low as only $\approx 4\%$). Crucially, our proposed method infers (sparse) neuron activation patterns that enables the neurons to activate/specialize to inputs with specific characteristics, diversifying their individual functionality. This capacity of our method supercharges the potential of dissection processes: human understandable descriptions are generated only for the very few active neurons, thus facilitating the direct investigation of the network's decision process. As we experimentally show, our approach: (i) yields Vision Networks that retain or improve classification performance, and (ii) realizes a principled framework for text-based description and examination of the generated neuronal representations.
[ "Konstantinos P. Panousis", "Sotirios Chatzis" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04929v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04929v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.LG", "stat.ML" ]
3 2 0 2 t c O 7 ] V C . s c [ 1 v 9 2 9 4 0 . 0 1 3 2 : v i X r a DISCOVER: Making Vision Networks Interpretable via Competition and Dissection Konstantinos Panousis Department of Electrical Eng., Computer Eng., and Informatics Cyprus University of Technology Limassol 3036, Cyprus k.panousis@cut.ac.cy Sotirios Chatzis Department of Electrical Eng., Computer Eng., and Informatics Cyprus University of Technology Limassol 3036, Cyprus sotirios.chatzis@cut.ac.cy Abstract Modern deep networks are highly complex and their inferential outcome very hard to interpret. This is a serious obstacle to their transparent deployment in safety-critical or bias-aware applications. This work contributes to post-hoc inter- pretability, and specifically Network Dissection. Our goal is to present a framework that makes it easier to discover the individual functionality of each neuron in a net- work trained on a vision task; discovery is performed in terms of textual description generation. To achieve this objective, we leverage: (i) recent advances in multi- modal vision-text models and (ii) network layers founded upon the novel concept of stochastic local competition between linear units. In this setting, only a small subset of layer neurons are activated for a given input, leading to extremely high activation sparsity (as low as only ≈ 4%). Crucially, our proposed method infers (sparse) neuron activation patterns that enables the neurons to activate/specialize to inputs with specific characteristics, diversifying their individual functionality. This capacity of our method supercharges the potential of dissection processes: human understandable descriptions are generated only for the very few active neurons, thus facilitating the direct investigation of the network's decision process. As we experimentally show, our approach: (i) yields Vision Networks that retain or improve classification performance, and (ii) realizes a principled framework for text-based description and examination of the generated neuronal representations. 1 Introduction In recent years, Deep Neural Networks (DNNs) have exhibited an overwhelming success in a variety of tasks and applications, achieving state-of-the-art results in Machine Vision, Automatic Speech Recognition, and NLP. This unprecedented success is however accompanied with a limited capacity to audit them in view of reliability standards. Indeed, due to the immense complexity of their architectures, DNNs are usually employed as off-the-shelf solutions for a variety of applications. However, their vast and highly accelerated adoption rate emphasizes the importance of being able to explain how DNNs function and interpret how predictions are made. This process will allow for 37th Conference on Neural Information Processing Systems (NeurIPS 2023). uncovering their inherent biases and even for correcting the failures in their decision making process, facilitating a safe, trustworthy and robust real-world deployment in safety-critical applications. Fortunately, this limitation has recently received a lot of attention in the Deep Learning (DL) research community, leading to the development of ways forward towards Interpretable Deep Networks. In this context, we can identify two major approaches: ante- and post-hoc methods. In the former, the main rationale is to build networks from scratch, that integrate intepretability components into the network itself; Concept Bottleneck Models (CBMs) are a characteristic case [13, 17, 19, 25]. In post-hoc approaches, backbone architectures are augmented with novel frameworks aiming to provide explanations of the prediction process, e.g. saliency maps [15, 27] and Network Dissection [2, 9]. Each approach exhibits its own advantages and drawbacks. For example, ante-hoc models usually suffer from significant performance drop, often requiring additional data to train. On the other hand, even though post-hoc models avoid the complexity of re-training, the results may lend themselves to subjective interpretations that depend on the method's assumptions. This work takes a novel route: it aims at improving the efficacy of post-hoc methods by addressing some fundamental building blocks of Deep Networks. Specifically, we depart from the commonly used forms of non-linearities in Deep Networks and propose the use of competition-based activations imposed upon otherwise linear projection units; these form the so-called Stochastic Local Winner- Takes-All (LWTA) layers [22]. Our inspiration stems from biological arguments: it has been shown that brain neurons with similar functions aggregate together in blocks and locally compete for their activation; the winner gets to pass its response to other neurons outside the block while the rest are inhibited to silence [30, 1, 14]. Stochastic LWTA activations have recently been employed on DNNs with striking success, exhibiting: (i) significant compression capabilities [22], (ii) unique representa- tion diversification ability [23], (iii) strong adversarial robustness against powerful adversarial attacks [24], (iv) the best ever reported performance in model-agnostic meta-learning (MAML), in terms of both accuracy and network footprint [11]. Other significant properties of LWTA-based networks include noise suppression, specialization, automatic gain control and robustness to catastrophic forgetting[29, 8, 3], while their prowess has also been shown in Transformer networks dealing with end-to-end translation of sign-language video into text [32]. In building interpretable networks, the proposed competition-based rationale comes with two impor- tant benefits: (i) a naturally arising activation sparsity: only the winner unit in each block passes its computed output to the next layer, while the rest pass zero values; and (ii) a data-driven pattern of neuron functionality, based on the probability of a unit being the active winner for a given input. This mode of operation naturally lends itself to the post-hoc paradigm of unraveling and inspecting individual neuron functionality, which this work addresses. In this setting, recent works on automated methods aim to provide high quality descriptions of neurons by leveraging multi-modal models to match neuron functionality to text-based unrestricted concepts. We leverage these ideas to address the interpretation limitations of conventional architectures, by intro- ducing the Dissection of Competitive Vision Networks (DISCOVER) approach, a novel framework towards interpretable Vision Networks. Our contributions can be summarized as follows: • We construct, implement and train a variety of Competitive Vision Networks (CVNs) utiliz- ing novel competition arguments, including both CNN and Transformer-based architectures. This is the first time in the literature that CVNs are trained on a large scale and their behavior is investigated with respect to both: (i) performance, and (ii) interpretation properties. • We perform post-hoc network dissection using multimodal models to identify the underlying functionality and contribution of each individual neuron; to this end, we leverage the unique characteristics of competition between neurons and novel Network Dissection approaches. • We examine the specialization properties of CVNs in the context of interpretability by investigating the generated per-example neuronal representations. 2 Background Image-Text Models. Contrastive Language-Image Pre-training (CLIP) [26] constitutes one of the best-known methods for multimodal deep learning, combining visual representations with natural language supervision. The main operating principle of CLIP relies on the usage of image-caption 2 pairs in order to obtain representations. Specifically, CLIP comprises an image encoder, denoted by ET (*) and a text encoder EI (*) that are trained simultaneously on the grounds of a contrastive learning objective[28, 4]. Specifically, assuming a batch of N (image, text) pairs, i.e. {(xi, ti)}N i=1, CLIP learns a multi-modal embedding space by maximizing the cosine similarity of the embeddings Ii = EI (xi) and Ti = ET (ti), between the N correct pairs, while minimizing the cosine similarity between the other N 2 − N combinations. During inference, we can use natural language supervision to perform zero-shot classification of any given image and labels. Thus, given a test image xtest and some labels {tj}M j=1, we can use the learned encoders and select the image-label pair that has the highest similarity of all the possible combinations. Network Dissection. Network Dissection constitutes one of the most popular approaches for understanding and describing the contribution of individual deep network units in the produced inferential outcomes. In [2], a method that yields descriptive outcomes in terms of concepts is presented. To this end, the authors introduce a newly developed densely-labeled dataset, named Broden; this contains pre-determined concepts, images and their associated pixel-level labels. The main principle is to use the Intersection over Union (IoU) score as a measure of relevance between each concept and neuron in the set. However, the proposed method requires the use of dense labels for training, while at the same time the concepts are restricted to the pre-defined label set. This limitation inspired the development of MILAN [9], an automated method that addresses the notion of pre-defined concepts through the generation of unrestricted description via generative image-to-text models. Nevertheless, the requirement for human annotation is still present, similar to Network Dissection [2]. CLIP-Dissect [20] bypasses this restriction by leveraging multimodal image-text models, and specifically CLIP; this allows for decoupling the dependence between the concept set and the probing dataset. Thus, any network can be dissected, using any text corpus to form the concept set, any image probing dataset, and any appropriate similarity measure for matching concepts to neurons. In this work, we exploit the flexibility of CLIP-Dissect and extend it in the context of Competitive Vision Networks. Differently than CLIP-Dissect, we mainly focus our analysis on the properties of Vision Transformer architectures with respect to neuron identification. Competitive Vision Networks. Recent works have explored a fundamentally different paradigm for the latent unit operation of DNNs, based on the concept of local competition among units (LWTA) [29]. In this setting, latent units compute their response and compete for their activation. The winner passes its (linear) response to the next layer, while the rest output zero values. In the following, we will be referring to these networks as Competitive Vision Networks (CVNs). Let us consider an input x ∈ RJ presented to a hidden layer of a DNN comprising K hidden units and a weight matrix W ∈ RJ×K. To compute a typical non-linear activation, each hidden unit in the layer performs an inner product computation with its respective weights wk ∈ RJ yielding the k x ∈ R; this usually passes through a non-linear activation σ(*), such intermediate response hk = wT that the final layer output reads: y = [y1, . . . , yK], where yk = σ(hk), ∀k. In a corresponding LWTA-based layer, U singular units are grouped together forming the so-called LWTA blocks. Hereinafter, we denote by B the number of LWTA blocks in the layer, and with U the number of linear competing units therein. The aggregation operation is manifested via the definition of the layer's weights as a three-dimensional matrix W ∈ RJ×B×U ; this structural modification implies that each input dimension of x is now presented to each block b and each unit u therein; in turn, all b,ux ∈ R, ∀b, u units compute their response via the standard inner-product computation hb,u = wT and competition takes place among them. The fundamental principle of competition is that out of the U competing units, only one can be the winner. This unit gets to convey its activation outside the block, i.e. the next layer, while the rest output zero values. This process is instantiated via an appropriate competition function that encodes the outcome of the competition in each block. Contrary to the conventional definition, where the layer's output arises as the concatenation of the individual response of each unit, in the LWTA-based framework, the final output yB*U is now constructed from B sub-vectors, one for each LWTA block that contains a single non-zero entry; this corresponds to the response of the winner unit in said block. Thus, an inherent property of the LWTA mechanism is the naturally emerging sparse representations. Indeed, considering a fixed number of units per layer, we can observe that the higher the number of competitors U , the sparser the layer 3 Figure 1: Detailed bisection of the bth Stochastic LWTA block. Presented with an input x ∈ RJ , each unit u computes its activation hb,u via different weights wb,u ∈ RJ , i.e., hb,u = wT b,ux. The linear responses are concatenated, s.t., hb = [hb,1, . . . , hb,U ], and transformed into probabilities via the softmax operation. Then, a Discrete sample ξb = [ξb,1, . . . , ξb,U ] is drawn, which is a one-hot vector with a single non-zero entry at position u′, denoting the winner unit in the block; unit u′, passes its linear response to the next layer, while the rest pass zero values. Image from [23]. output: when U = 2, only 50% of the units will be active per example, when U = 4 only 25% and so on. This gives rise to a sparse activation mode of operation that has been empirically shown to endow deep architectures with significant properties including strong adversarial robustness [24] and substantial representation diversification [23]. One design choice that we need to address concerns the nature of the competition: deterministic or stochastic. The former is the most typical approach in the LWTA literature; in this case, the unit with the highest activation is deemed the winner each time. The latter is founded upon novel stochastic arguments proposed in [22]. This formulation has been shown to consistently outperform its deterministic counterpart [21, 24, 32, 11]. Thus, we adopt stochastic competition in our approach. The stochastic variant of the competition function entails the introduction of an appropriate set of discrete latent variables for each LWTA block b, ξb ∈ one_hot(U ), that encode the (stochastic) out- come of the competition therein. The latent indicators constitute one-hot vectors with U components; that is, vectors containing a single non-zero entry at the index position corresponding to the winner unit in the block. The output y of a stochastic LWTA layer's (b, u)th component yb,u yields: yb,u = ξb,u J (cid:88) j=1 wj,b,u * xj ∈ R (1) We postulate that these latent indicators ξb, ∀b, are drawn from a Categorical distribution driven from the intermediate linear inner-product computations that each unit performs. Evidently, the higher the response of a particular unit in a block (relative to the others), the higher its probability of being the winner; however, the final decision remains stochastic. We can formulate this rationale as: q(ξb) = Categorical ξb (cid:32) (cid:33) (cid:12) (cid:12) (cid:12) Πb(x) (cid:12) (cid:12) , Πb(x) = Softmax   J (cid:88)  [wj,b,u]U u=1 * xj  , ∀b (2) j=1 u=1 denotes the vector concatenation of the set {wj,b,u}U where Πb(x) is a vector comprising the activation probability of each neuron in the block, and [wj,b,u]U u=1. Each unit in each block computes its intermediate linear inner-product; these are then passed to a softmax transformation and used to draw samples from a categorical distribution. The resulting discrete vector contains a single non-zero entry denoting the winner of the block. The intermediate computation of the winner unit passes out as its activation; the rest units pass zero-valued activations. A graphical illustration of the stochastic LWTA structure is provided in Fig. 1. In the context of attention-based architectures, the encoder of Vision Transformers (ViTs) [6] comprises alternating layers of Multi-head Self-Attention (MSA), MLP blocks, Layer Normalization 4 (LN) and residual connections. Each MLP block comprises two layers with a GELU non-linearity in between. Within the CVN framework, we replace GELU layers with stochastic LWTA layers. This modeling decision is motivated by recent works that have shown that transformer MLPs encode knowledge attributes [5, 7, 18]. We posit that this formulation facilitates neuron identification and interpretation via analysis of the arising competition patterns; we explore its potency in the following sections. Further, convolutional operations also constitute an integral part of various architectures. To account for this fact, and for completeness, we also consider the convolutional variant of the stochastic LWTA layer proposed in [22]. Due to space constraints, and since we mainly focus our analysis on attention-based architectures, we provide the formulation in the Supplemental Material. 3 DISCOVER 3.1 Training and Inference Algorithms for CVNs CVNs comprise additional auxiliary variables denoting the winner in each LWTA block; thus, we need to devise an appropriate training regime that takes into consideration the stochastic nature of said variables. To this end, we turn to Stochastic Gradient Variational Bayes (SGVB) [12], and construct an Evidence Lower Bound (ELBO) objective. Assuming a dataset D = {X i, yi}N i=1, and denoting as f (X i; ˆξ) the cross-entropy between the target labels yi and the target probabilities emerging from a CVN, the objective reads: LCVN = − (cid:88) (cid:16) (cid:17) yi, f (X i; ˆξ) CE − KL[q(ξ)||p(ξ)] (3) X i,yi∈D where ˆξ denotes samples from the (posterior) distributions of all latent variables, ξ, in all layers, and KL[q(ξ)||p(ξ)] denotes the Kullback-Leibler divergence between the posterior and the prior. We assume a symmetric Categorical prior for the latent variable indicators ξ; hence, p(ξb) = Categorical(1/U ), ∀b. For all the computations we draw just one sample, but we consider it as a differentiable expression; this allows for very low variance gradients during training, which ensures convergence (reparameterization trick). Since the Categorical distribution is not amenable to differentiation, we enable reparameterization by resorting to a continuous relaxation, namely Gumbel-Softmax (GS) [16, 10]. In contrast to previous works [22, 23], we use the Straight-Through variant of GS, which we have seen to offer better convergence properties. We present the exact sampling procedure in the Supplemental Material. During inference, we directly draw samples from the trained posteriors and determine the winning units in each layer along with their responses (Eq. 2). 3.2 Dissection For dissecting the considered CVNs, we draw inspiration from CLIP-Dissect [20]. We employ a CLIP model to identify the functionality of each neuron in a stochastic LWTA block in terms of a given concept set; this will be matched with a textual description. There are three key components that define the approach: (i) a concept set S, where |S| = M , (ii) a dataset that is used as a probe to identify the individual functionality of neurons denoted by Dprobe, where |Dprobe| = N , and (iii) the network to be investigated, denoted by f (x). The main principle is to match neuronal activations with concepts using: (i) the activation matrix P that measures the similarity between images and concepts, and (ii) a summary of the individual neuronal activations of the network being probed to the given probe dataset. Concept Activation Matrix. We use the image and text encoder of the CLIP model, denoted by EI and ET respectively, and compute the respective embeddings Ii and Ti for each image xi and concept ti. This results in a concept activation matrix P ∈ RN ×M , where each entry (i, j) denotes the cosine similarity between image xi and concept tj in the CLIP embedding space. Record Activations for each Competitive Neuron. Given a neuron k and for each image in the probe dataset {X n}N n=1, n=1, CLIP-Dissect computes the neuron's non-linear responses {Ak(X n)}N 5 Figure 2: The DISCOVER framework. Given a probe dataset Dprobe : {X n}N n=1, a concept set S, |S| = M , and a layer to be dissected: compute the concept activation matrix P ∈ RN ×M using CLIP; then, for each LWTA block b and each neuron u therein, compute the responses Ab,u(X n), ∀n, s.t. qb,u = [Ab,u(X 1), . . . , Ab,u(X N )]. Each neuron b, u is then matched to the concept tl whose activation vector P :,l has the highest similarity (sim) with the neuron's activation vector qb,u. and records them into a single vector qk ∈ RN , s.t., qk = [Ak(X 1), . . . , Ak(X N )]. Each acti- vation vector qk essentially encodes the activation of neuron k across the whole probing dataset. Subsequently, it can be exploited as a data-wide neuron representation to match neurons to textual descriptions as we describe next. When the response Ak(X n) is not a scalar, a summary function that maps it to a real number is employed. For inner-product neurons, the response is already a real-number. For convolutional kernels, we consider a mean over the spatial dimensions. Our approach. Building on these outcomes, CVNs adopt a novel regard toward interpretation, which leverages the sparse nature of the representations obtained from stochastic LWTA layers; here, we focus on attention-based architectures. In this setting, the MLP blocks contain patch-specific information relating to the tokens of each image; in principle, we could introduce a summary function to aggregate the patch-wise information and output a real-number. However, we have access to another representation: the feature embedding pertaining to the class token; this comprises a set of units dedicated to capturing both global and local contextual information in each layer. Within the framework of CVNs, this is treated in a local competition fashion: CVN units on each MLP are grouped together in blocks of competitors and compete for the output of the block. Contrary to the singular recording of activations in the base formulation for each neuron k, {Ak(X n)}N n=1, the activations are computed for each LWTA block b and unit u therein, yielding {Ab,u(X n)}N n=1. These activations can be negative, positive or exactly zero, depending not only on the linear computation of the unit in consideration, but also the responses of the remaining units in its LWTA block, following the form of Eq.1. We concatenate them to construct a summary for each competitive unit, such that qb,u = [Ab,u(X 1), . . . , Ab,u(X N )]. Due to the nature of the proposed stochastic local competition, the emerging summary vectors will be sparse; only the winner of each LWTA block will retain its linear computation and pass it as a non-zero activation for each example X n; the rest units in the block pass zero activations. This mode of operation not only encourages specialization, but can also diversify individual neuron identification; we explore its potency in the next section. Matching Neurons to Concepts. Having recorded the activations vectors for each LWTA block b and each neuron u therein, qb,u ∈ RN , we aim to discover the most similar concept {tm}M m=1 to describe each neuron. To achieve this matching, a similarity function sim(tm, qb,u; P ) is defined; 6 {Bird, Water, Bridge, ..., Fox, Cat}T1T2T3...TMI3I2I1IN...I3T1I3T2I3T3...I3TMI1T1I1T2I1T3...I1TMI2T2I2T3...I2TM...............INT1INT2INT3...INTMI2T1Text EncoderImage EncoderRecord ActivationsMatching1122Block 1Block BFoxWaterBirdCat this is used to quantify the relation (in terms of similarity) between the neuron's activation vector qb,u ∈ RN and the concept's m activation vector, P :,m ∈ RN . For example, considering the cosine similarity, we compute: sim(tm, qb,u; P ) ∝ P :,mqT b,u Thus, for assigning a concept to neuron b, u, we compute its similarity to each concept in the set and select the one that exhibits the highest value, s.t., tl = arg maxm sim(tm, qb,u; P ). Characteristic similarity functions include, Rank Reorder, WPMI and SoftWPMI [20]. (4) At this point, it is important to highlight a principal benefit of CVNs: After neuron identification, i.e., matching neurons to concepts, and since only a small subset of neurons is active for each example, it becomes practically tractable to perform a per-example analysis on that particular small subset of "winner" (active) neurons; this greatly facilitates practical concept interrogation. 4 Experimental Analysis For evaluating and dissecting the proposed CVNs, we train two sets of models: (i) Transfomer-based, and (ii) Convolutional architectures. We consider stochastic LWTA layers with different numbers of competitors, ranging from U = 2 to U = 24. In every architecture, we retain the total number of parameters of the conventional model by splitting a layer comprising K singular neurons to B blocks of U competing neurons, such that B * U = K. This choice facilitates a fair -sizewise- comparison between an original network and its CVN counterpart. The number of competitors has a direct effect on the per example neuron activation in the respective layers. For example, when U = 2, only 50% of neurons are activated for a given input, when U = 8 only 12.5% and so on. For the Transformer architecture, we select the DeiT model, specifically DeiT-Tiny (DeiT-T, 5M parameters) and DeiT-Small (DeiT-S, 22M parameters), which we train from scratch on ImageNet-1k. For the convolutional paradigm, we chose the same network as in CLIP-Dissect [20] for comparability; In all cases, we follow the original training schemes that is ResNet-18 trained on Places365. concerning the hyperparameters, and remove the excessive augmentations of DeiT, i.e., DropPath, Color Jittering, Random Erase, CutMix and MixUp; we have found that these do not improve accuracy of CVNs. For completeness, all hyperparameter settings for each model are provided in the Supplementary Material. All models were trained on a single NVIDIA A6000 GPU. Our code implementation is available at: https://github.com/konpanousis/DISCOVER. Accuracy. We begin our evaluation with classification results pertaining to CVNs and how block size (number of competitors in each block) affects performance. This is essential, since CVNs have not been explored in the literature, especially when dealing with larger datasets and architectures, and no baselines exist for the considered setup. However, it is highly important to note that this work is not focused on achieving state-of-the-art performance for vision tasks using CVNs. Instead, our focus is on providing a fundamental component towards a novel Network Dissection paradigm. Thus, we focus on Network Dissection efficacy, as opposed to optimally tuning hyperparameters and augmentation to increase accuracy by few points. The obtained comparative results are presented in Table 1. Therein, we observe that despite the fact that we did not aim for performance improvements, CVNs exhibit near or even superior performance compared to their conventional counterparts. This finding persists even when using a large number of competitors, which directly translates to high activation sparsity. Let us consider for example DeiT- T/16; this model comprises LWTA blocks with 16 competing units each, leading to 1/16 = 6.25% active (winning) neurons in each layer. We observe that this network exhibits only a 1% drop in prediction accuracy (again without any tuning). On the other hand, when using a smaller number of competitors, e.g., DeiT-T/2 or DeiT-T/8, we obtain better and on par performance to the conventional architecture, respectively. Also note that, even though there is a minor computational overhead during training (up to 10%), the computational costs of inference are comparable. Thus, accuracy-wise, CVNs provide a realistic alternative to conventional Vision Networks that can even yield accuracy improvements when trained with the same (potentially suboptimal) setup. Quantitative Analysis. We follow the novel proposal of [20] to compare our CVN-based approach to conventional non-competitive networks. In this context, we can compare the generated neuron labels, for a specific layer of a network, with the ground truth descriptions, i.e., the class labels. 7 Table 1: Classification results for ImageNet and Places365. architecture, e.g., using ReLU/GELU, while numbers denote the number of competitors U . {⋆/ ∗}Locally reproduced results due to unavailability of pretrained models/resource limitations. /None denotes a non-competitive ImageNet-1k Model/Competitors Accuracy + Std (%) Active Neurons Proportion DeiT-T/None DeiT-T/2 DeiT-T/8 DeiT-T/16 DeiT-T/24 DeiT-S/None DeiT-S/2 DeiT-S/12 DeiT-S/16 Data Specific 0.500 0.125 0.062 0.041 Data Specific 0.500 0.083 0.062 72.2 ± N/A 72.5 ± 0.10 71.7 ± 0.15 71.1 ± 0.25 70.5 ± 0.45 77.0 ± N/A∗ 77.3 ± 0.30 77.0 ± 0.25 76.7 ± 0.50 ResNet-18/None ResNet-18/2 ResNet-18/4 ResNet-18/8 Places365 52.25 ± N/A⋆ 53.9 ± 0.20 51.0 ± 0.50 49.5 ± 0.75 Data Specific 0.500 0.250 0.125 Specifically, we measure the cosine similarity in a text embedding space between the ground truth class name and the description of the neuron. We use two different text encoders: (i) CLIP ViT-B/16, denoted as CLIP cos and (ii) all-mpnet-base-v2, denoted as mpnet cos. Here, we focus on the last layer of the MLP block of the DeiT-T model. The obtained comparative results are depicted in Table 2. Therein, we observe that the CVN consistently outperforms its non-competitive counterpart when using both the best-performing softWPMI and the Cubed Cosine Similarity function proposed in [20]. Table 2: Cosine similarity between the last layer neuron descriptions and ground truth labels on DeiT-T/None and DeiT-T/16 trained on ImageNet. For the former we use softWPMI for identification, while for CVNs, softWPMI and the cubed cosine similairity measure [20]. We use two text encoders: (i) CLIP ViT-B/16 and (ii) all-mpnet-base-v2, denoted as mpnet cos. Dprobe Concept Set S ImageNet Val -"- -"- -"- -"- CIFAR100 Train Broden ImageNet Val & Broden Broden 3k 10k 20k ImageNet 20k 20k 20k Vision Network DeiT-T/None (SoftWMPI) DeiT-T/16 (SoftWPMI) DeiT-T/16 (CosSimCubed) CLIP cos mpnet cos CLIP cos 0.6460 0.6250 0.6650 0.6226 0.6553 0.6187 0.6455 0.6128 0.5854 0.5850 0.6533 0.6392 0.6470 0.6338 0.6333 0.6299 mpnet cos 0.1800 0.1688 0.1715 0.1758 0.1782 0.1765 0.1780 0.1821 mpnet cos 0.1918 0.1842 0.1831 0.1899 0.1835 0.1876 0.1546 0.1433 CLIP cos 0.6543 0.6699 0.6616 0.6519 0.5840 0.6530 0.6606 0.6729 0.1829 0.1895 0.1878 0.1929 0.1842 0.1969 0.1815 0.1876 To further assess the quality of the obtained neuronal descriptions, we turn to the neuron identification accuracy metric proposed in [20]. In this context, and in situations where the considered concept set contains exact class labels, we compute the percentage of neurons that have been assigned the exact correct label. Evidently, this metric pertains to the classification layer of a considered network. We consider four datasets: CIFAR-100 Train, Broden, ImageNet Val and ImageNet Val & Broden; we use the ImageNet classes as the concept set S. For matching neurons to concepts, we use SoftWPMI, since it outperformed all other similarity functions. Further results with the other similarity metrics are provided in the Supplemental Material. The comparative results for all conventional and competitive configurations are presented in Table 3. We observe that on average, CVNs consistently outperform their conventional ReLU/GELU based counterparts, with up to 2% improvement. It is striking, that DeiT-S/12 improves accuracy on CIFAR-100 Train by a staggering 10% compared to the conventional ResNet-50 that has the same number of parameters; at the same time, DeiT-T/8, also provided a significant improvement of ≈ 7%. 8 Table 3: Accuracy as the percentage of neurons assigned the correct label, i.e., class name. Concept Set S: ImageNet, Similarity: SoftWPMI. ResNet-50 results from [20]. Dprobe CIFAR-100 Train Broden ImageNet Val ImageNet Val & Broden Average Vision Network ResNet-50/None DeiT-T/None DeiT-T/8 DeiT-T/16 DeiT-S/2 DeiT-S/12 56.10% 53.10% 68.10% 67.40% 95.60% 96.00% 94.80% 95.70% 78.65% 78.05% 46.20% 70.50% 95.00% 95.40% 76.78% 55.20% 68.30% 95.60% 95.00% 78.70% 50.80% 67.40% 95.30% 95.50% 78.30% 53.00% 68.80% 95.00% 95.20% 78.00% Figure 3: Neuron Identification for the first and last DeiT-T/16 MLP blocks using: SoftWPMI, Dprobe: ImageNet & Broden, S: 20K most common English words [20]. Qualitative Analysis. We now turn to a qualitative analysis of the obtained neuronal representation. In this context, we visualize several neuron identification results in terms of generated descriptions in Fig. 3. To this end, we select random neurons of the first and last MLP blocks of DeiT-T/16 and use a combination of the ImageNet and Broden datasets as a probe; the concept set S comprises the 20, 000 most common English words similar to [20]. Since we do not use the same pretrained backbone, and the considered CVNs were trained from scratch, there isn't an exact matching between the neurons presented therein and the neurons of our networks, enumeration-wise. Thus, we can not make direct comparisons pertaining to the exact same neuron on an illustration basis. Nevertheless, we observe that in the context of CVNs we obtain highly accurate descriptions of the functionality of the networks' neurons. We observe that the randomly selected neurons are activated by semantically similar inputs that may contain only a part of the matching concept. A principal property of CVNs is the per-example sparsity that naturally arises due to the competition mechanism; this can facilitate specialization and accelerate the process of examining the active concepts for each test point, greatly enhancing the interpretability of the network. Indeed, we perform this analysis for the last MLP block of the GELU-based DeiT-T/None, and its DeiT-T/8 and DeiT-T/16 competitive counterparts. This block comprises 768 neurons; for each example, DeiT-T/8 will activate only 768/8 = 96 neurons and DeiT-T/16 only 48 neurons. The number of activated neurons for the conventional DeiT-T/None will vary according to the probing dataset. For ImageNet Val, we found that on average, 98% of neurons are activated for each example when using DeiT-T/None. Thus, in Table 4, and for each architecture, we present the 7 most relevant concepts tied to neurons with the highest magnitude of activation to the considered example, along with 6 concepts tied to neurons with the lowest magnitude. Therein, we observe that the most contributing concepts in the conventional setting contain descriptions that are highly irrelevant or even contradicting to the presented input as "red/orange beak & legs", "black coat/tan markings" and "reddish brown fur"; at the same time 757/768 neurons are active for this example, rendering the concept investigation a strenuous process. In stark contrast, the considered CVNs exhibit substantially more relevant concepts, while allowing for a straightforward examination of the emerging per-example concepts. Similar qualitative visualizations for different settings can be found in the Supplemental Material. 9 Neuron10:CLIP-Dissect(SoftWPMI):snorkelingNeuron20:CLIP-Dissect(SoftWPMI):greenNeuron70:CLIP-Dissect(SoftWPMI):redNeuron302:CLIP-Dissect(SoftWPMI):maroonNeuron41:CLIP-Dissect(SoftWPMI):dogNeuron218:CLIP-Dissect(SoftWPMI):wineNeuron357:CLIP-Dissect(SoftWPMI):snowNeuron512:CLIP-Dissect(SoftWPMI):coyote Table 4: Concepts tied to activated neurons for a random image from the ImageNet validation set for both DeiT-T/None and DeiT-T/16. For the former, 757/768 = 98.56% neurons are activated leading to an arduous interpretation process; for DeiT-T/16 only 48/768 = 6.25% of neurons are active. DeiT-T/None DeiT-T/8 DeiT-T/16 Concepts Act Concepts Act Act Concepts +3.06 white fur under tail a cucumber plant a fox pale/gray or cream fur white fur under tail red/orange beak & legs +2.53 +2.19 white plumage black coat/tan markings +2.14 large/fluffy white dog reddish/brown fur shaggy/gray coat a fox large/fluffy white dog chicken klin sharp talons/beak camel rider fluffy/white appearance large/fluffy white dog large/fluffy white dog egret +1.46 white plumage +1.03 white/gray plumage +0.71 cabbage-like leaves −0.17 small/black dog shaggy/black-brown coat +0.56 wolf-like appearance −0.17 −0.17 product displays −0.17 a large/elegant dog −0.17 a bus driver −0.17 an insect +11.6 +10.5 +9.89 +9.32 +7.71 +8.90 +8.36 +7.37 +7.33 white/cream coloured coat +7.07 +6.87 +7.27 blue/gray body +5.96 +7.04 white plumage +1.29 +1.57 a cub +0.96 +0.68 +0.37 +0.35 +0.08 bandage egg-laying mammal large/fluffy white dog black/tan coat +0.46 +0.34 +0.18 +0.08 5 Limitations & Conclusions Limitations. Considering the use of the CLIP-Dissect approach for identifying neuron functionality in CVNs, this comes with its respective limitations, such as disregarding the spatial information; this, could allow for identifying lower level concepts and patterns. However, the structure of CVNs could potentially accommodate such a functionality via block (high) level and unit (low) level descriptions; we leave these explorations for future work. Finally, even though incorporating the competition mechanism to Vision Networks is a quite straightforward task, they aren't still implemented in an optimized way in popular frameworks, due to their limited adoption. Conclusions. In this work, we introduced DISCOVER, a novel framework towards Interpretable vision architectures through Competitive Vision Networks and Network Dissection. For the first time in the literature, we trained LWTA networks using sufficiently large datasets and architectures. Despite the fact that we did not perform any hyperparameter tuning, the resulting networks yielded on par or even improved performance, even when using up to 4% of active neurons per example. Our qualitative and quantitative results vouch for the efficacy and interpretation capabilities of our approach. We yielded highly interpretable neuron functionality, while using a small and explorable subset of all the available neurons per datapoint. Acknowledgements This work has received funding from the European Union's Horizon 2020 research and innovation program under grant agreement No 872139, project aiD. References [1] P Andersen, Gary N Gross, T Lomo, and Ola Sveen. Participation of inhibitory and excitatory interneurones in the control of hippocampal cortical output. In UCLA forum in medical sciences, 1969. [2] David Bau, Bolei Zhou, Aditya Khosla, Aude Oliva, and Antonio Torralba. Network dissection: Quantifying interpretability of deep visual representations. In Proc. CVPR, 2017. [3] Gail A. Carpenter and Stephen Grossberg. The art of adaptive pattern recognition by a self- organizing neural network. Computer, 1988. [4] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey E. Hinton. A simple framework for contrastive learning of visual representations. In Proc. ICML, 2020. [5] Damai Dai, Li Dong, Yaru Hao, Zhifang Sui, Baobao Chang, and Furu Wei. Knowledge neurons in pretrained transformers. In Proc. ACL, 2022. 10 [6] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In Proc. ICLR, 2021. [7] Mor Geva, Roei Schuster, Jonathan Berant, and Omer Levy. Transformer feed-forward layers are key-value memories. In EMNLP, 2021. [8] Stephen Grossberg. Contour enhancement, short term memory, and constancies in reverberating neural networks. In Studies of mind and brain. Springer, 1982. [9] Evan Hernandez, Sarah Schwettmann, David Bau, Teona Bagashvili, Antonio Torralba, and Jacob Andreas. Natural language descriptions of deep visual features. In Proc. ICLR, 2022. [10] Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparametrization with gumbel-softmax. In Proc. ICLR, 2017. [11] Konstantinos Kalais and Sotirios Chatzis. Stochastic deep networks with linear competing units for model-agnostic meta-learning. In Proc. ICML, 2022. [12] Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. In Proc. ICLR, 2014. [13] Pang Wei Koh, Thao Nguyen, Yew Siang Tang, Stephen Mussmann, Emma Pierson, Been Kim, and Percy Liang. Concept bottleneck models. In Proc. ICML, 2020. [14] Anders Lansner. Associative memory models: from the cell-assembly theory to biophysically detailed cortex simulations. Trends in neurosciences, 2009. [15] Scott M Lundberg and Su-In Lee. A unified approach to interpreting model predictions. In Proc. NIPS, 2017. [16] Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. In Proc. ICLR, 2017. [17] Diego Marcos, Ruth Fong, Sylvain Lobry, Rémi Flamary, Nicolas Courty, and Devis Tuia. Contextual semantic interpretability. In Proc. ACCV, 2020. [18] Kevin Meng, Arnab Sen Sharma, Alex J Andonian, Yonatan Belinkov, and David Bau. Mass- editing memory in a transformer. In Proc. ICLR, 2023. [19] Tuomas Oikarinen, Subhro Das, Lam M. Nguyen, and Tsui-Wei Weng. Label-free concept bottleneck models. In Proc. ICLR, 2023. [20] Tuomas Oikarinen and Tsui-Wei Weng. CLIP-dissect: Automatic description of neuron repre- sentations in deep vision networks. In Proc. ICLR, 2023. [21] Konstantinos Panousis, Sotirios Chatzis, Antonios Alexos, and Sergios Theodoridis. Local competition and stochasticity for adversarial robustness in deep learning. In Proc. AISTATS, 2021. [22] Konstantinos Panousis, Sotirios Chatzis, and Sergios Theodoridis. Nonparametric Bayesian deep networks with local competition. In Proc. ICML, 2019. [23] Konstantinos P Panousis, Anastasios Antoniadis, and Sotirios Chatzis. Competing mutual information constraints with stochastic competition-based activations for learning diversified representations. In Proc. AAAI, 2022. [24] Konstantinos P Panousis and Sotirios Chatzis. Stochastic local winner-takes-all networks enable profound adversarial robustness. In NIPS Bayesian Deep Learning (BDL) Workshop, 2022. [25] Konstantinos Panagiotis Panousis, Dino Ienco, and Diego Marcos. Sparse linear concept discovery models. In Proc. ICCV Workshops, 2023. 11 [26] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agar- wal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In Proc. ICML, 2021. [27] Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. "why should I trust you?": Explaining the predictions of any classifier. In Proc. SIGKDD, 2016. [28] Kihyuk Sohn. Improved deep metric learning with multi-class n-pair loss objective. In Proc. NIPS, 2016. [29] Rupesh K Srivastava, Jonathan Masci, Sohrob Kazerounian, Faustino Gomez, and Jürgen Schmidhuber. Compete to compute. In Proc. NIPS, 2013. [30] Costas Stefanis. Interneuronal mechanisms in the cortex. In UCLA forum in medical sciences, 1969. [31] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Herve Jegou. Training data-efficient image transformers & distillation through attention. In Proc. ICML, 2021. [32] Andreas Voskou, Konstantinos P. Panousis, Dimitrios Kosmopoulos, Dimitris N. Metaxas, and Sotirios Chatzis. Stochastic transformer networks with linear competing units: Application to end-to-end sl translation. In Proc. ICCV, 2021. 12 A Supplemental Material A.1 Experimental Details Integrating the competition mechanism in modern architectures constitutes a pretty straightforward task. One just needs to replace the existing calls to the conventional non-linear activations with a call to a module/function implementing the LWTA rationale. This can be performed in-place without any other changes necessary. Thus, in the accompanied code, we can directly change the definitions of the Transformer or ResNet based models and train the model in the same manner as in the conventional Vision Networks. In this context, for the DeiT architectures, we alter the definitions in the timm library, while for ResNet-based architectures, we slightly alter the example implementation found in the official Pytorch repository1. For dissecting CVNs, we use the official repository of CLIP-Dissect [20]. We describe all changes in the respective README file. Our code and trained models will be public after publication. Transformers. For training the CVN counterparts of the DeiT-T and DeiT-S models, we use the official implementation.2 We train both architectures from scratch using ImageNet-1k for 300 epochs with the default parameters found therein. Specifically, we use a 5-epoch warm-up period, starting with an initial learning rate of 10−6, following a cosine annealing schedule up to 5 * 10−4. We use the same AdamW optimizer and changed the used weight decay from 0.05 to 0.02 since we found that it hurt performance. We re-run the conventional GELU-based architectures with this selection and observed no change in the obtained accuracy. In contrast, we turned off the excessive augmentation setup, since it hurt the performance of CVNs. In this context, and in line with the initial ablation study presented in [31], we found that performance deteriorates when augmentations are removed in GELU-based networks. For training, we use a single sample for the Monte Carlo sampling estimation for the Evidence Lower Bound loss, described in the main text. For this, we turn to the continuous relaxation of the categorical distribution that allows for reparameterized samples and low variance estimation, as we describe in the next section. During inference, we draw 4 samples, average the logits in the Bayesian Averaging sense; we then compute the predicted loss and accuracy. We did not observe any improvement when drawing more samples. ResNet. For training the ResNet-18 model, we used the ResNet ImageNet example PyTorch script and adapted the data loading for Places 365. We train the model for 90 epochs, using SGD with an initial learning rate of 0.1 that is reduced by a factor of 0.1 every 30 epochs, a weight decay of 10−4 and 0.9 momentum. The batch size was set to 256. For the Gumbel-Softmax trick, we set the temperature to 0.67 and used the Straight-Through estimator. During training, we only draw one sample for the reparameterization trick, while during inference we draw 4 samples from the trained posterior. We trained both conventional and CVN architectures since the official pretrained models were not available online. For both methods, we used the standard RandomResizedCrop and RandomHorizontal Flip augmentations. A.2 The Gumbel-Softmax Trick In our work, we perform Monte-Carlo sampling using a single reparameterized sample for each of the corresponding latent variables. These are obtained via the reparameterization trick of the continuous relaxation of the Categorical distribution [16, 10] as described next. We focus on the reparameterization trick for the dense case; the convolutional case is analogous. As a reminder, the latent indicators ξb, ∀b, are drawn from a Categorical distribution driven from the intermediate linear inner-product computations that each unit performs.of q(ξ) (Eq. (2) in the main text): q(ξb) = Categorical ξb (cid:32) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:33) Πb(x) , ∀b, Πb(x) = Softmax   J (cid:88)  [wj,b,u]U u=1 * xj  (5) j=1 where Πb(x) is a vector comprising the activation probability of each neuron in the block, and [wj,b,u]U u=1 denotes the vector concatenation of the set {wj,b,u}U 1https://github.com/pytorch/examples/tree/main/imagenet 2https://github.com/facebookresearch/deit. u=1. 13 Then, the samples ˆξ are expressed as: ˆξb,u = Softmax (log[Πb(x)]u + gb,u)/τ ) , ∀b = 1, . . . , B, u = 1, . . . , U (6) where gb,u = − log(− log Vb,u), Vb,u ∼ Uniform(0, 1), and τ ∈ (0, ∞) is a temperature factor, controlling how "closely" the continuous relaxation approximates the Categorical distribution. In this work, we use a temperature of τ = 0.67 as suggested in [16], and used in several other works [22, 21]. A.3 Convolutional Formulation In this setting, local competition is performed among feature maps on a position-wise basis. Each kernel is treated as an LWTA block with competing feature maps; each layer comprises B kernels. Specifically, each feature map u = 1, . . . , U in the bth LWTA block of a convolutional LWTA layer computes: H b,u = W b,u ⋆ X ∈ RH×L Competition remains stochastic, and is now implemented on a position-wise basis as follows: (cid:16) q(ξb,h′,l′) = Categorical ξb,h′,l′ (cid:12) (cid:17) (cid:12) (cid:12)Πb,h′,l′(X) , ∀h′, l′ (7) (8) where Πb,h′,l′(X) = Softmax ([H b,1,h′,l′, . . . , H b,U,h′,l′]) comprises the position-wise activation probabilities for all neurons in the block. For each position in a kernel, only the feature map that wins the said position contains a non-zero entry. This yields sparse feature maps with mutually exclusive activated positions. Now, the output Y ∈ RH×L×B*U is obtained via concatenation of the sub-tensors Y b,u that read: Y b,u = Ξb,u (cid:16) W b,u ⋆ X (cid:17) , ∀b, u (9) where Ξb,u = [ξb,u,h′,l′]H,L LWTA block can be found in the Appendix. h′,l′=1. The corresponding detailed bisection of a convolutional stochastic In the following, we use these definitions to construct Competitive Vision Networks by replacing the usually employed non-linearities with the competition mechanism in each hidden layer of the considered architecture. Figure 4: A detailed bisection of the bth convolutional stochastic LWTA block. Presented with input X ∈ RH×L×C, competition takes place among feature maps on a position-specific basis. Only the winner feature map contains a non-zero entry in a specific position. This leads to sparse feature maps, each comprising uniquely position-wise activated pixels. Image from [23]. B Further Qualitative Analysis In this section, we provide further qualitative neuron identification results for various architectures and similarity functions. 14 Figure 5: Neuron Identification for the first and last DeiT-T/8 MLP blocks using: SoftWPMI, Dprobe: ImageNet & Broden, S: 20K most common English words[20]. Figure 6: Neuron Identification for the first and last DeiT-S/12 MLP block using the Cosine Similarity Cubed similarity function [20]. For the former we use Dprobe: (i) ImageNet Val & Broden (Left), and for the latter: (ii) ImageNet Val. We use the S: 20K most common English words for both settings. Figure 7: Neuron Identification for the first and last DeiT-S/12 MLP block using the Rank Reorder similarity function [20]. We use Dprobe: ImageNet Val and S: 20K most common English words for both settings. 15 Neuron146:CLIP-Dissect(SoftWPMI):motifNeuron365:CLIP-Dissect(SoftWPMI):greenNeuron461:CLIP-Dissect(SoftWPMI):patternNeuron662:CLIP-Dissect(SoftWPMI):blueNeuron6:CLIP-Dissect(SoftWPMI):wildlifeNeuron32:CLIP-Dissect(SoftWPMI):labradorNeuron357:CLIP-Dissect(SoftWPMI):espressoNeuron450:CLIP-Dissect(SoftWPMI):compassNeuron21:CLIP-Dissect(CosSimilarity3):stripeNeuron672:CLIP-Dissect(CosSimilarity3):crimsonNeuron783:CLIP-Dissect(CosSimilarity3):yellowNeuron1084:CLIP-Dissect(CosSimilarity3):darkNeuron21:CLIP-Dissect(CosSimilarity3):lobsterNeuron672:CLIP-Dissect(CosSimilarity3):guineaNeuron783:CLIP-Dissect(CosSimilarity3):eagleNeuron1084:CLIP-Dissect(CosSimilarity3):frogNeuron227:CLIP-Dissect(RankReorder):yellowNeuron726:CLIP-Dissect(RankReorder):blueNeuron1104:CLIP-Dissect(RankReorder):mammalsNeuron1206:CLIP-Dissect(RankReorder):blueNeuron193:CLIP-Dissect(RankReorder):tortNeuron224:CLIP-Dissect(RankReorder):gentooNeuron726:CLIP-Dissect(RankReorder):birdingNeuron820:CLIP-Dissect(RankReorder):antarctic Table 5: Concepts tied to activated neurons for a random image from the ImageNet validation set for DeiT-T/8 using various similarity functions. Cos Similarity WPMI SoftWPMI Concepts Act Concepts Act Act Concepts ferret ferret ferret ferret +10.5 Belgian Malinois +9.55 green/yellow eyes +8.90 white fur under tail white fur underside +8.51 black stripes on legs herd Alpine ibex +8.02 long/sharp quills long/sharp quills +7.53 fox gray fur/white tips +7.52 white/gray head white/gray head +0.96 baby stork black fur/white markings +0.44 +0.35 large/fluffy white dog +0.18 gills +0.12 car towing RV +0.12 other crocodiles black ruff around neck +1.09 +0.44 black/tan coloration +0.37 organ +0.18 salamander +0.12 headsail +0.12 egg-laying mammal +10.5 +9.55 +8.90 white fur under tail +8.51 black/white stripes +8.01 long/sharp quills +7.53 fox +7.52 white/gray head +10.5 +9.55 +8.90 +8.51 +8.01 +7.53 +7.52 black ruff around neck +1.09 +0.44 black/tan coloration +0.37 organ +0.18 salamander +0.12 headsail +0.12 egg-laying mammal Table 6: Concepts tied to activated neurons for a random image from the ImageNet validation set for DeiT-T/None and DeiT-S/12 using various similarity functions. DeiT-T/None (SoftWPMI) DeiT-S/12 (SoftWPMI) DeiT-S/12 (Rank Reorder) Concepts Act Concepts Act Act Concepts +15.0 sea turtle +11.7 cygnet +10.9 large/elephant animal hard shell covered in spines +9.96 sea turtle python doberman dome-shaped cap iguana other crocodiles case players exoskeleton +15.2 sea turtle large/webbed hind feet +11.7 +10.9 dark-colored carapace +9.96 large/fleshy cap +9.52 +9.32 tough/scaly exterior +9.08 black/tan coloration +1.41 round/spouted body fluffy/white appearance +0.33 +0.22 operating system +0.10 opponent +0.10 hard/shiny exoskeleton +0.10 +9.52 marine ecosystem +9.32 +9.08 +1.14 +0.63 +0.67 +0.22 +0.10 wings attached +0.01 +1.18 a coast +1.06 hard/shiny exoskeleton +0.54 sea turtle +0.54 large/red crab +0.53 large/red crustacean large/plant eating dinosaur +0.51 +0.46 short/bristly fur +0.20 white bill +0.17 a race +0.06 large/fluffy white dog −0.16 two-metal plates/trays −0.16 white markings wings −0.17 small/crab like body 16
http://arxiv.org/abs/2310.04925v1
"2023-10-07T21:36:55"
"2023-10-07T21:36:55"
Crystal-GFN: sampling crystals with desirable properties and constraints
Accelerating material discovery holds the potential to greatly help mitigate the climate crisis. Discovering new solid-state crystals such as electrocatalysts, ionic conductors or photovoltaics can have a crucial impact, for instance, in improving the efficiency of renewable energy production and storage. In this paper, we introduce Crystal-GFlowNet, a generative model of crystal structures that sequentially samples a crystal's composition, space group and lattice parameters. This domain-inspired approach enables the flexible incorporation of physical and geometrical constraints, as well as the use of any available predictive model of a desired property as an objective function. We evaluate the capabilities of Crystal-GFlowNet by using as objective the formation energy of a crystal structure, as predicted by a new proxy model trained on MatBench. The results demonstrate that Crystal-GFlowNet is able to sample diverse crystals with low formation energy.
[ "Mila AI4Science", "Alex Hernandez-Garcia", "Alexandre Duval", "Alexandra Volokhova", "Yoshua Bengio", "Divya Sharma", "Pierre Luc Carrier", "Michał Koziarski", "Victor Schmidt" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04925v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04925v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 5 2 9 4 0 . 0 1 3 2 : v i X r a Crystal-GFN: sampling crystals with desirable properties and constraints Mila AI4Science0 Alex Hernandez-Garcia1,2 Alexandre Duval1,3 Alexandra Volokhova1,2 Yoshua Bengio1,2 Divya Sharma4 Pierre Luc Carrier1 Michał Koziarski1,2 Victor Schmidt1,2 1Mila, Quebec AI Institute 2Université de Montréal 3CentraleSupélec, Université Paris-Saclay 4Johns Hopkins University 0This team name is the way the authors have found to express that the customary ordered list of authors hardly reflects their contributions. All authors have actively and significantly contributed to this work. The list in this manuscript has been randomised. Correspondence email: alex.hernandez-garcia@mila.quebec Accelerating material discovery holds the potential to greatly help mitigate the climate crisis. Discovering new solid-state crystals such as electrocatalysts, ionic conductors or photovoltaics can have a crucial impact, for instance, in improving the efficiency of renewable energy production and storage. In this paper, we introduce Crystal- GFlowNet, a generative model of crystal structures that sequentially samples a crystal's composition, space group and lattice parameters. This domain-inspired approach enables the flexible incorporation of physical and geometrical constraints, as well as the use of any available predictive model of a desired property as an objective function. We evaluate the capabilities of Crystal-GFlowNet by using as objective the formation energy of a crystal structure, as predicted by a new proxy model trained on MatBench. The results demonstrate that Crystal-GFlowNet is able to sample diverse crystals with low formation energy. 1 Introduction Materials discovery plays a vital role in transforming numerous industries that are currently responsible for a significant fraction of the global greenhouse gas emissions. From developing cutting-edge photovoltaic panels to tackling carbon capture, catalysis or solid-state batteries, the quest for innovative materials with targeted properties has the power to reshape the technological landscape. However, the discovery of new materials is an extremely complicated task at various levels of innovation: crystal structure generation, property prediction and developing feasible synthesis techniques. In practice, before scientists can think of producing a material with a desirable property, they must search through the vast space of possible materials and use their domain-expertise to investigate promising structures. Since this traditional trial-and-error process is extremely costly both in terms of time and efforts, machine learning (ML) can greatly accelerate the generation and evaluation of promising candidates. October 10, 2023 © Released under CC BY-NC-SA 4.0 While ML has already made significant progress with respect to property prediction and generation of small molecules (Long et al., 2021; Ren et al., 2022; Pakornchote et al., 2023; Zheng et al., 2023), its impact for solid state materials lags behind. At the root of this discrepancy lies the particular structure of materials, whose periodicity in 3D space imposes periodic boundary conditions that make it difficult to use finite graphs for crystal representation. As a result, the sole task of generating a stable candidate is complex. It involves exploring the combinatorial space of chemical compositions, considering all possible periodic arrangements of atoms as well as respecting complex physics that make them viable and stable structures. Indeed, the generation of crystal 3D structures involves a multitude of factors, including specific bonding preferences between different atom types, geometric and chemical constraints, and a positioning that is correlated with the local energy minimum defined by quantum mechanics. Overall, current methods often struggle to capture the above complexities in the generation process, failing to consistently generate valid structures. Besides, most such approaches would not enable an efficient search through the crystal space or a search for crystals with a specific property. In this work, we introduce Crystal-GFlowNet, a generative model designed to sequentially sample crystal structures in a space inspired by theoretical crystallography. Instead of directly generating atom positions, Crystal-GFlowNet samples the composition, the space group and the lattice parameters of a crystal (Section 4). This domain-inspired approach facilitates the incorporation of chemical and geometrical constraints, as well as the possibility to extend the sampling space, for example to obtain atom positions. The GFlowNet framework offers the ability to sample proportionally to a reward function, which enables diverse sampling. Through an empirical evaluation (Section 5) of a Crystal-GFlowNet trained with a predictive model of the formation energy, we demonstrate that our proposed method is able to sample diverse candidates with low formation energy. 2 Related Work There exists a record of generative methods for molecular and crystal structure generation, generally falling into one of these catagories: Variational Auto Encoders (VAE) (Ren et al., 2022; Pakornchote et al., 2023), Generative Adversarial Networks (GANs) (Cao & Kipf, 2018; Nouira et al., 2018; Long et al., 2021), Normalizing flows (Satorras et al., 2021; Ahmad & Cai, 2022) and Diffusion models (Zheng et al., 2023; Xu et al., 2022). In general, these methods are trained to reconstruct the training data from a latent distribution by maximising its likelihood or minimising the discrepancy between generated sampled and the real distribution. Once trained, they can generate new instances by sampling from the learned latent space. Hoffmann et al. (2019); Long et al. (2021); Court et al. (2020) treat materials as 3D voxel images, but the process of decoding images back to atom types and coordinates often results in low validity. Several methods (Ren et al., 2020; Kim et al., 2020; Zhao et al., 2021) encode unit cell related information to generate crystals. GANCSP (Kim et al., 2020) and CubicGAN (Zhao et al., 2021) use as input fractional coordinates, element properties, and lattice parameters, to build models that generate crystals conditioned on composition or both composition and space group. Such models are generally not invariant to any Euclidean transformations. CDVAE (Xie et al., 2021), employs a diffusion model in conjunction with a VAE to sample new materials, leveraging lattice parameters. However, it does not enable imposing domain-based constraints into the generation process. Overall, directly sampling 3D positions 2 without considering energy minimization can lead to physically unrealistic and unstable structures. Cheng et al. (2022) leveraged physics and symmetry-based constraints to solve an optimization problem over crystal graphs to obtain atomic coordinates, but it requires a composition and lattice information as input. Different from the above, auto-regressive methods like G-SchNet Gebauer et al. (2019) or G-SphereNet generates 3D molecules sequentially, placing atom-by-atom. They are unaware of periodicity and cannot generate the lattice, making them ill-suited for crystals. This also applies to flow models Shi et al. (2020). As most methods in the literature directly sample 3D positions, they struggle to embed essential physical constraints like energy minimization, dihedral angles geometric constraints or bonding preferences between different atom types, often leading to physically unrealistic In our proposed model, by selecting the composition, lattice, and unstable structures. and space group and imposing validity constraints, our approach inherently incorporates domain knowledge about materials science and crystallography, ensuring that the generated crystals adhere to fundamental principles and constraints, resulting in more physically valid structures. 3 Background In this section, we briefly review the necessary background on GFlowNets and crystallography, before describing our proposed method Crystal-GFlowNets. 3.1 GFlowNets Generative Flow Networks (GFlowNets or GFN for short), were introduced by Bengio et al. (2021) as an amortised inference method to sample from high-dimensional distributions, where both traditional methods such as MCMC and reinforcement learning are inefficient in terms of mode mixing. In essence, GFlowNets are designed to sample objects x ∈ X proportionally to a non-negative reward function R(x), that is π(x) ∝ R(x). This facilitates the discovery of multiple modes of a given function, which is a desirable objective in scientific discovery (Jain et al., 2023). For instance, GFlowNets have been successfully applied for biological sequence design and molecular property prediction as part of active learning loops (Jain et al., 2022; Hernandez-Garcia et al., 2023). A key property of GFlowNets is that objects are generated sequentially. Starting from a special state s0, transitions st→st+1 ∈ A are applied between states s ∈ S, forming trajectories τ = (s0 → s1 . . . x). This sequential construction of objects, together with the fact that the transition policy is parameterised by a neural network, provides amortisation and the potential of systematic generalisation. This can be the case if the decomposition into partially constructed objects provides structure that can be learnt by a machine learning model. In order to obtain policy that samples proportionally to the reward distribution, several training objectives have been proposed in the literature. Here, we will make use of the Trajectory Balance objective (Malkin et al., 2022), which has proven effective in various tasks (Jain et al., 2022; Hernandez-Garcia et al., 2023; Malkin et al., 2022). While GFlowNets where initially introduced for discrete probabilistic modelling, Lahlou et al. (2023) recently proposed a generalisation of the framework for continuous or hybrid state spaces. This work empirically demonstrates this generalisation, as we propose a GFlowNet that operates in a hybrid-mixture of discrete and continuous-state space. 3 3.2 Crystals Crystals are highly structured solid materials defined by a unit cell made of atom types and coordinates that repeat in the three spatial directions, as specified by the crystal's periodic lattice. This ordered structure gives them their unique shapes and properties and their understanding is crucial in the development of new materials. While there exists an infinite number of crystal structures, the field of theoretical crystallography has developed ways to systematically parameterise and classify crystals. Lattice. An n-dimensional lattice Λ can be defined as the set of integral combinations of the linearly independent lattice basis vectors ai ∈ Rn: Λ i miai | mi ∈ Z} . In 3D, the 3 lattice basis vectors can be converted into 6 parameters: a, b, c determine the lengths of each dimension and α, β, γ the angles between dimensions. . = {(cid:80)n Composition. We call composition the set of all atom types present in the crystal's unit cell and their respective quantities. Together with the lattice Λ, the atomic positions provide a complete description of the crystal structure. Space group. A space group is the symmetry group of the crystal's repeating pattern in space, whose elements are the rigid transformations of the pattern that leave it unchanged. A space group element can be described as a tuple (W, t), where W is the orthogonal matrix and t the translation vector. An element maps a vector x ∈ Rn to Wx + t. In three dimensions, space groups are classified into 230 types. 4 Crystal-GFlowNets In this section, we describe the details of Crystal-GFlowNet, the main method we introduce in this paper to explore the space of crystal structures and generate crystals with desirable properties and domain constraints. Drawing inspiration from crystallography, we propose to represent crystals as the concate- nation of three distinct components or subspaces: composition (C), space group (SG) and lattice parameters (LP) of the unit cell of a material. The Cartesian product of the spaces of these three components would make the state space S = SC × SSG × SLP and sample space X = XC ×XSG ×XLP of a naive, unrestricted implementation with GFlowNets. An important advantage of the GFlowNet framework and of the domain-inspired data representation that we propose to use is that it allows us to flexibly introduce domain knowledge such as well- studied geometrical constraints from crystallography as well as chemical constraints. These constraints are mostly introduced by restricting the action space A of the Crystal-GFlowNet, both inter- and intra-subspace. In this work, we design the Crystal-GFlowNet such that trajectories first select the composition, then the space group and finally the lattice parameters. Below we describe the three subspaces and the constraints we have introduced. 4.1 Composition We represent a composition as the number of atoms of each element present in the unit cell. Specifically, for a vocabulary of D elements, where each element can have up to K atoms, we construct D-dimensional vectors where each entry indicates the number of atoms of element d. This yields the space SC = {(k1, . . . kD)|kd ∈ {0, 1, . . . K}, d = 1, . . . D}. The action space 4 of the composition subspace consists of the choice of element and number of atoms, that is AC = {1, . . . D} × {1, . . . K}, plus the special "stop" action to finish a trajectory. As per the law of electroneutrality, the sum of of positive and negative charge in a solid must be equal. Since we have control over the action space of the GFlowNet, we incorporate a hard constraint to ensure that all the generated compositions can have neutral charge. We argue that this is an advantage over methods that aim at learning such properties implicitly from the data (Xie et al., 2021). 4.2 Space group The sample space of the space group subspace of our Crystal-GFlowNet is XSG = {1, 2, . . . 230}, corresponding to the space of the 230 symmetry groups that exist in three dimensions. As discussed in Section 3.1, GFlowNets rely on the decomposition of objects into multiple steps to facilitate generalisation. Therefore, we draw inspiration from theoretical crystallography to incorporate additional structure into the space group subspace. Crystals are classified into seven crystal systems: triclinic, monoclinic, orthorhombic, tetragonal, trigonal, hexagonal and cubic. Each crystal system comprises a set of point groups. Another related but slightly different category is the lattice system, with also seven systems (see Fig. 1), each comprising a set of Bravais lattices. The lattice system category is convenient for our purposes because it imposes specific constraints on the lattice parameters. Here, we use the derived category resulting from the combination of crystal system and lattice system. We refer to it as "crystal-lattice system" and it has eight categories: triclinic, monoclinic, orthorhombic, tetragonal, trigonal-rhombohedral, trigonal-hexagonal, hexagonal-hexagonal and cubic. Besides the crystal-lattice system, we introduce another category in the Crystal-GFlowNet space group subspace: the point symmetry (also known as site symmetry), which defines the type of symmetry of a point group. We use the following five categories of point symmetries: centrosymmetric, non-centrosymmetric, enantiomorphic, polar and enantiomorphic-polar. We choose these categories because the combination of point symmetry and crystal system gives rise to one of the 32 crystal classes or crystallographic point groups. In sum, our space group subspace SSG is a three-dimensional set where the entries correspond to the crystal-lattice system, the point symmetry and the space group. We define the action space such that, starting from the source state s0, the transitions can set any of the three dimensions. However, the selection of an option along any dimension restricts the valid options of the remaining dimensions. For example, if point symmetry "non-centrosymmetric" is selected from the source state, only three crystal-lattice systems remain valid and the valid space groups are reduced to 25. The "stop" action is valid (and forced) if and only if the space group has been selected. Finally, we also have an opportunity to incorporate inter-subspace constraints between the composition and the space group. Because of the symmetry imposed by each space group, not all compositions are possible given a space group, and given a composition not all space groups are valid. By way of illustration, the most restrictive space group-international number 230–cannot accommodate compositions with fewer than 16 atoms per element. Since here the trajectories of a Crystal-GFlowNet first sample a composition, we restrict the set of valid space groups-and hence crystal-lattice systems and point groups-given the composition. Empirically, we have estimated that this constraint reduces the size of the space group state space by a factor of 6, for the specific case of our experimental setup presented in Section 5. 5 4.3 Lattice parameters The lattice parameters (a, b, c, α, β, γ), in combination with the lattice system (or crystal system) determine the shape of the unit cell in three dimensions. While both the composition and the space group subspaces are discrete, the lattice parameters are real-valued and thus . yield a continuous sample space XLP = {(lmin, lmax)3 × (θmin, θmax)3}, where lmin and lmax are the minimum and maximum lengths and θmin and θmax are the minimum and maximum angles, respectively. In order to sample sets of continuous lattice parameters, the GFlowNet policy model outputs the parameters of a six-dimensional mixture of Beta distributions. Here, we incorporate an inter-subspace constraint from the space group. Every space group is classified into a lattice system which, in turn, constrains the values of the lattice parameters. For instance, for the cubic lattice system, a = b = c and α = β = γ = 90◦. The remaining constraints are illustrated in Fig. 1. This drastically reduces the state space and removes the need of having to learn such relationships and constraints from the data. (a) (b) (c) (d) (e) (f) (g) Figure 1: The seven lattice systems and the constraints they impose on the lattice parameters. In order a–g: triclinic, monoclinic, orthorhombic, tetragonal, rhombohedral, hexagonal and cubic. Source of the figures: Wikimedia Commons, licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license. 4.4 Reward function As explained in Section 3, our Crystal-GFlowNet is trained to sample proportionally to a reward function. This offers the flexibility of using as reward any quantity of interest, such as a desired property of materials. As an initial proof of concept for the method, we choose the reward to be based on the formation energy (FE) of the sampled crystal structure, in order to generate materials with higher likelihood of being thermodynamically stable. Because the sampled crystal structure may be unknown or not characterised in existing data bases, its true FE may be unknown too. This is why we train a proxy machine learning model to predict the FE given a crystal x ∈ X , that is parameterised as the output of Crystal-GFlowNet. In particular, we train a physics-informed Multi-Layer Perceptron (MLP) on the Mat- Bench (Dunn et al., 2020) data set. For a given crystal structure, the input to the proxy MLP is the concatenation of: • A physical embedding of the crystal's elements using PhAST (Duval et al., 2022). • A learned embedding for its space group. • The standardized lattice parameters. We stratify the MatBench data set into train, validation and test sets, controlling for the distribution in target FE. The final reward function is a Boltzmann transformation of 6 210 (cid:1) where T is a temperature hyper-parameter. This the proxy output: R(x) = exp (cid:0) − MLP(x) ensures that lower FE yields higher positive reward, and we can control our preference for lower energies with the temperature T . T 5 Empirical evaluation In this section, we present the results of experiments designed to serve as proof of concept for Crystal-GFlowNet. The motivation of using GFlowNet to generate crystal structures is two-fold: One, we are interested in discovering structures with high scores of a property of interest, in this case low formation energy. At the same time, we want to discover not just one but multiple and diverse structures. The main reason to seek for diverse samples is that often the target function is underspecified and the true objective is multifaceted or unknown. A natural way of dealing with underspecification is to try multiple candidates to increase the likelihood of finding successful structures for the downstream applications Jain et al. (2023); Hernandez-Garcia et al. (2023). Thus, we here aim at analysing whether Crystal-GFlowNet is able to discover diverse crystal structures with low formation energy. 5.1 Experimental setup Exploring the infinitely large space of crystals to find the ones with certain properties is a daunting "needle-in-a-haystack" task. In order to make the haystack a little smaller-though still infinitely large-we restrict the search task to a subset of compositions and space groups, and to a limited range of the lattice parameters, as described in Appendix B. We train the Crystal-GFlowNet for 50,000 iterations, which amounts to 500,000 queries to the proxy model and about 12 hours on a CPU-only machine. Further details about the experimental setup are provided in Appendix B. 5.2 Results In this section, we present results related to our proxy model, to the distribution of the formation energy in Crystal-GFlowNet samples and to the diversity of these samples. Proxy model of the formation energy. As presented in Section 4.4, our reward function is based on a proxy MLP trained on MatBench. Since part of our analysis of the performance of the proposed Crystal-GFlowNet depends on prediction of the formation energy by this proxy model, it is important to first verify its accuracy. In contrast to other methods, it does not rely on atom positions to predict the FE of a crystal, but rather on a high-level description of the crystal, namely its composition, space group and lattice parameters, akin to the outputs of Crystal-GFlowNet. It achieves a mean absolute error (MAE) of 0.10 ± 0.005 eV on the validation set. We further describe its hyper-parameters and detailed performance in Appendix C.2 and Appendix C.3. Predicted formation energy of samples. Evaluating generative models is well-known to be a hard, task-dependent problem. Here, in order to gain insights about the sampling policy of the trained Crystal-GFlowNet, we sample 10,000 crystals and compare the distribution with 1) the validation set from MatBench and 2) 10,000 samples from a randomly initialised and untrained Crystal-GFlowNet. Figure 2 shows the kernel density estimation of the formation energies predicted by our proxy model in the aforementioned sets of samples. As main conclusion, we can observe that training the Crystal-GFlowNet shifts the formation energy of the sampled crystals towards a range that approaches that of the validation set. Given the 7 vast search space, it is remarkable that with a relatively short training, Crystal-GFlowNet learns to sample from a distribution where nearly 90 % of the structures have negative formation energy (as predicted by the proxy model). Figure 2: A comparisons of the distributions of the formation energy predicted by our proxy model in three relevant distributions of samples: in green, the validation set, representative of the MatBench data base; in orange, samples from an untrained Crystal-GFlowNet; in blue, samples from Crystal-GFlowNet after training. As a main conclusion, we observe that Crystal-GFlowNet, after training, manages to sample crystals with predicted formation energies in the range of the validation set. Diversity of samples. As discussed before, an important goal in certain materials discovery applications is to find diverse candidates. In other words, sampling crystals with low formation energy would be almost useless for most applications if all the crystals were the same or very similar. To gain insights about the diversity, we analyse the crystal structures sampled by the trained Crystal-GFlowNet. The main conclusion is that Crystal-GFlowNet samples candidates with very high diversity. In particular, regarding the composition, we find that not only are all 12 elements contained in the samples from the Crystal-GFlowNet, but also the distribution of co-occurrence of elements is similar to the distribution in the validation set. As a matter of fact, all 12 elements are present in just the top-10 samples with lowest formation energy. Regarding crystal categories and space groups, we find that 6 out of the 8 crystal-lattice systems and all 5 point symmetries are found in just the top-10 samples. While not all 113 space groups are found in the 10,000 samples, we find 55 % of them. Finally, in terms of lattice parameters, we also observe relatively similar distributions of lengths and angles, compared to the MatBench data set. Further details and visualisations of these results are provided in Appendix D. 6 Conclusions and future work In this paper, we have introduced a new generative model, Crystal-GFlowNet, to sample inorganic crystal structures proportionally to a property of interest. A key feature of Crystal- GFlowNet is its flexibility to be trained with any available reward function and to incorporate domain constraints. The latter is due to the fact that Crystal-GFlowNet constructs crystals sequentially in the space of compositions, space groups and lattice parameters of the unit cell. This parameterization, inspired by theoretical crystallography, has allowed to flexibly 8 420246Formation energy predicted by the proxy model0.00.10.20.30.40.50.6DensityCrystal-GFlowNetValidation setCrystal-GFlowNet random init. incorporate constraints regarding the neutral charge of the composition, the compatibility between composition and space group and between space group and lattice parameters. By training a Crystal-GFlowNet with a reward function based on the formation energy predicted by a proxy model trained on the MatBench database, we have shown it learns to sample candidates such that the distribution of the predicted formation energy approaches the distribution of the MatBench data set. Importantly, it does so by sampling highly diverse crystals, in terms of coverage of compositions, space groups and lattice parameters. Interesting directions for future work include extending Crystal-GFlowNet with more domain-inspired constraints as well as with additional subspaces to sample the atom positions in the unit cell. Alternatively, crystal structure prediction from the samples could be performed using pre-trained machine learning models that generate atomic coordinates. Furthermore, it would be interesting to explore other properties of interest beyond the formation energy of the sampled crystals. Ethics Statement Our work is motivated by the the climate crisis, the need to develop sustainable technology and we envision applications of our approach in materials discovery. However, as with other related work, there is a potential risk of dual use of the technology by nefarious actors (Urbina et al., 2022). The authors strongly oppose any uses or derivations of this work intended to cause harm to humans or the environment. Code availability The code of Crystal-GFlowNet algorithm presented in this paper is open source and is available on https://github.com/alexhernandezgarcia/gflownet. Acknowledgements We thank Yasmine Benabed for her contribution to the conception and first steps of this project. We also thank Bruno Rousseau, Simon Blackburn and Mickael Dollé for their valuable insights from the materials science perspective. Sékou-Oumar Kaba and Michael Kilgour have also participated in helpful discussions. We thank Mila's IDT team for their support. Finally, we thank Quebec's Ministry of Economy, Innovation and Energy for their financial support. This research was enabled in part by compute resources provided by Mila (mila.quebec). References Ahmad, R. and Cai, W. Free energy calculation of crystalline solids using normalizing flows. Modelling and Simulation in Materials Science and Engineering, 30(6):065007, 2022. Bengio, E., Jain, M., Korablyov, M., Precup, D., and Bengio, Y. Flow network based generative models for non-iterative diverse candidate generation. In Advances in Neural Information Processing Systems (NeurIPS), volume 34, 2021. Cao, N. D. and Kipf, T. Molgan: An implicit generative model for small molecular graphs. arXiv preprint arXiv: 1805.11973, 2018. 9 Cheng, G., Gong, X.-G., and Yin, W.-J. Crystal structure prediction by combining graph network and optimization algorithm. Nature Communications, 13(1), March 2022. doi: 10.1038/s41467-022-29241-4. URL https://doi.org/10.1038/s41467-022-29241-4. Court, C. J., Yildirim, B., Jain, A., and Cole, J. M. 3-d inorganic crystal structure generation and property prediction via representation learning. Journal of Chemical Information and Modeling, 60(10):4518–4535, 2020. Dunn, A., Wang, Q., Ganose, A., Dopp, D., Jain, and A. Benchmarking materials property prediction methods: The matbench test set and automatminer reference algorithm., 2020. URL https://matbench.materialsproject.org/#citing-matbench. Accessed 2023-09- 28. Duval, A., Schmidt, V., Miret, S., Bengio, Y., Hernández-García, A., and Rolnick, D. Phast: Physics-aware, scalable, and task-specific gnns for accelerated catalyst design. arXiv preprint arXiv: 2211.12020, 2022. URL https://arxiv.org/abs/2211.12020v3. Gebauer, N., Gastegger, M., and Schütt, K. Symmetry-adapted generation of 3d point sets for the targeted discovery of molecules. Advances in neural information processing systems, 32, 2019. Hernandez-Garcia, A., Saxena, N., Jain, M., Liu, C.-H., and Bengio, Y. Multi-fidelity active learning with gflownets. arXiv preprint arXiv: 2306.11715, 2023. URL https: //arxiv.org/abs/2306.11715v1. Hoffmann, J., Maestrati, L., Sawada, Y., Tang, J., Sellier, J. M., and Bengio, Y. Data-driven approach to encoding and decoding 3-d crystal structures. arXiv preprint arXiv:1909.00949, 2019. 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 (ICML), volume 162. PMLR, 2022. Jain, M., Deleu, T., Hartford, J., Liu, C.-H., Hernandez-Garcia, A., and Bengio, Y. GFlowNets for AI-driven scientific discovery. Digital Discovery, 2023. Kim, S., Noh, J., Gu, G. H., Aspuru-Guzik, A., and Jung, Y. Generative adversarial networks for crystal structure prediction. ACS central science, 6(8):1412–1420, 2020. Lahlou, S., Deleu, T., Lemos, P., Zhang, D., Volokhova, A., Hernández-García, A., Ezzine, L. N., Bengio, Y., and Malkin, N. A theory of continuous generative flow networks. In International Conference on Machine Learning (ICML), 2023. Long, T., Fortunato, N. M., Opahle, I., Zhang, Y., Samathrakis, I., Shen, C., Gutfleisch, O., and Zhang, H. Constrained crystals deep convolutional generative adversarial network for the inverse design of crystal structures. npj Computational Materials, 7(1):66, 2021. Malkin, N., Jain, M., Bengio, E., Sun, C., and Bengio, Y. Trajectory balance: Improved credit assignment in GFlowNets. In Advances in Neural Information Processing Systems (NeurIPS), volume 35, 2022. Nouira, A., Crivello, J., and Sokolovska, N. Crystalgan: Learning to discover crystallographic structures with generative adversarial networks. AAAI Spring Symposium Combining Machine Learning with Knowledge Engineering, 2018. 10 Pakornchote, T., Choomphon-anomakhun, N., Arrerut, S., Atthapak, C., Khamkaeo, S., Chotibut, T., and Bovornratanaraks, T. Diffusion probabilistic models enhance variational autoencoder for crystal structure generative modeling. arXiv preprint arXiv:2308.02165, 2023. Ren, Z., Noh, J., Tian, S., Oviedo, F., Xing, G., Liang, Q., Aberle, A., Liu, Y., Li, Q., Jayavelu, S., et al. Inverse design of crystals using generalized invertible crystallographic representation. arXiv preprint arXiv:2005.07609, 3(6):7, 2020. Ren, Z., Tian, S. I. P., Noh, J., Oviedo, F., Xing, G., Li, J., Liang, Q., Zhu, R., Aberle, A. G., Sun, S., et al. An invertible crystallographic representation for general inverse design of inorganic crystals with targeted properties. Matter, 5(1):314–335, 2022. Satorras, V. G., Hoogeboom, E., Fuchs, F., Posner, I., and Welling, M. E(n) equivariant normalizing flows. Neural Information Processing Systems, 2021. Shi, C., Xu, M., Zhu, Z., Zhang, W., Zhang, M., and Tang, J. Graphaf: a flow-based autoregressive model for molecular graph generation. arXiv preprint arXiv:2001.09382, 2020. Urbina, F., Lentzos, F., Invernizzi, C., and Ekins, S. Dual use of artificial-intelligence-powered drug discovery. Nature Machine Intelligence, 4(3):189–191, 2022. Xie, T., Fu, X., Ganea, O., Barzilay, R., and Jaakkola, T. Crystal diffusion variational International Conference On Learning autoencoder for periodic material generation. Representations, 2021. Xu, M., Yu, L., Song, Y., Shi, C., Ermon, S., and Tang, J. Geodiff: A geometric diffusion model for molecular conformation generation. arXiv preprint arXiv:2203.02923, 2022. Zhao, Y., Al-Fahdi, M., Hu, M., Siriwardane, E. M., Song, Y., Nasiri, A., and Hu, J. High-throughput discovery of novel cubic crystal materials using deep generative neural networks. Advanced Science, 8(20):2100566, 2021. Zheng, S., He, J., Liu, C., Shi, Y., Lu, Z., Feng, W., Ju, F., Wang, J., Zhu, J., Min, Y., et al. Towards predicting equilibrium distributions for molecular systems with deep learning. arXiv preprint arXiv:2306.05445, 2023. 11 A Crystals Materials. Materials encompass the substances that make up objects. Their distinctive characteristics arise from a combination of factors, including their composition, structure, and manufacturing processes. While materials come in various forms, our primary focus will be on solid-state materials, specifically crystals, owing to their significance in many machine learning applications we have encountered. Solid state materials. Solid state materials consist of a multitude of smaller building blocks, such as atoms or molecules, securely positioned in fixed locations. They exhibit high-density packing and strong mutual attraction, resulting in a stable structure with a well-defined volume. Materials that possess a well-ordered, infinitely repetitive structure are categorized as crystals, while those lacking such long-range positional order are termed amorphous. Crystals. Also known as crystalline materials, crystals represent a category of solid substances characterised by their periodic structure. This entails a consistent and predictable repetition of atom or molecule placement within the crystal across all spatial dimensions. It is this inherent periodicity that sets crystals apart from smaller molecules and confers unique properties upon crystals. They manifest in diverse forms and showcase exceptional attributes like transparency and elevated melting points. The study of crystals offers a pathway to precise characterization and controlled manipulation, opening up avenues for engineering materials with targeted properties to fulfill a wide range of needs. The subsequent section delves into how machine learning models address and harness this periodicity. A crystal structure includes the type and position of every atom as well as the translational axes which allow the structure to repeat. Since crystal structures extend infinitely, we need to define some small section that can be repeated. We call this small section a unit cell. Unit cells are made of a lattice and basis. Lattices tell you how the crystal is repeated, the basis tells you what is repeated. There are six parameters of a unit cell: 3 edges a, b, c and the angles between the edges α, β, γ. The edges of a unit cell may be or may not be perpendicular to each other. A crystal structure combines the lattice (how atoms are translated) with a basis (which atoms are translated) which theoretically describes every atom in the crystal. The lattice is just a mathematical idea, but the basis is the "real" component which is repeated according to the mathematical lattice. Lattice. The lattice is fully specified by its basis vectors ai and is associated with a group of translations TΛ. The lattice Λ is the underlying structure of the unit cells, which have the property of tilling the space Rn when translated by lattice vectors. Of particular prominence . = {(cid:80)n is the primitive cell U for the basis ai: U i xiai | 0 ≤ xi < 1} . In a material, the unit cell comprises a set of atomic positions S = {(Zi, xi) | xi ∈ U }, where xi is the atom position (called the basis vector) and Zi its atomic number. S can contain an arbitrary number of atoms and is not constrained to a particular structure. Periodic boundary conditions. Periodic boundary conditions (pbc) are commonly used to represent the infinite repeating nature of crystals and other periodic systems. Rather than confining the analysis to a single unit cell housing all atoms, pbc envision an infinite array of identical unit cells extending indefinitely in all directions. This means that if an atom or molecule exits the cell on one side, it effectively re-enters from the opposite side, as if traversing a continuous lattice. This approach enables scientists to simulate the behavior of an infinitely extending crystal using a finite computational domain. 12 B Experimental setup In this section, we provide additional details about the hyper-parameters and experimental setup used to train the Crystal-GFlowNet to obtain the results presented in Section 5. In order to reduce the search space in our experiments, we apply the following restrictions: • Compositions consist of up to 5 different elements from the subset of these 12 elements: H, Li, C, N, O, F, Mg, Si, P, S, Cl and Fe. These are the most common elements in the MatBench data set used to train the proxy model. Note that even this reduced set yields a combinatorially large search space. • Compositions can contain up to 50 atoms in total and up to 16 atoms per element. This number is obtained by finding the lowest Wyckoff position multiplicity for each space group, and then computing the maximum of these values across all space groups. This means that 16 is the lowest possible value that still makes it possible for the Crystal-GFlowNet to generate samples from all space groups while respecting their symmetry constraints. • Space groups are the intersection of train and validation space groups, from the proxy model's data set. There are 113 of them. • The minimum and maximum lengths of the unit cell are 0.9 and 100 angstroms, respectively; the minimum and maximum angles are 50◦ and 150◦, respectively. We train the Crystal-GFlowNet by sampling 10 trajectories per iteration from the current forward policy. In order to encourage further exploration, 10 % of the steps in the trajectories are sampled at random from a uniform distribution. In total, we train for 50,000 iterations, which amounts to 500,000 queries to the proxy model. This took about 12 hours on a CPU-only machine. The architecture of both the forward and the backward GFlowNet policy models is a 3-layer multi-layer perceptron with 256 units per layer. We trained with the Adam optimiser and a learning rate of 0.0001. As is common with the Trajectory Balance objective (Malkin et al., 2022), we set a higher learning rate (0.01) for the 16 learning weights used to parameterised partition function. In order to sample structures with lower (negative) formation energy, we set a temperature of 8 in the reward function defined in Section 4.4. The distribution to sample the increments of the lattice parameters subspace is a mixture of 5 Beta distributions. In order to ensure numerical stability during training, we restrict the values of the coefficients of the Beta distributions to the range [0.1, 100]. One of the conditions that must be satisfied by generalised GFlowNets is that trajectories must have finite length. To this end we set a minimum increment of 10 % the range of each dimension. C Proxy MLP C.1 Architecture For a given crystal structure, the input to the proxy MLP is the concatenation of: a physical embedding of the crystal's elements using PhAST (Duval et al., 2022), a learned embedding for its space group and the standardized lattice parameters. We stratify the MatBench data set into train, validation and test sets, controlling for the distribution in target FE. The final (cid:1) where T is a reward function is a Boltzmann version of the proxy: R(x) = exp (cid:0) − MLP(x) T 13 temperature hyper-parameter. This ensures that lower FE yields higher positive reward, and we can control our preference for lower energies with the temperature T . Overall, the architecture consists of concatenated representations for the composition (hC), the space group hSG and the lattice parameters (hLP ) that are used as input to a prediction MLP ˆy = MLPout([hC, hSG, hLP ]). In the following we describe how each h is obtained from the data: • hC: Each element Zi in the composition is embedded with PhAST (Duval et al., 2022): it is a concatenation of 1/ static physical properties PZ projected into some latent space with a small MLP 2/ a learned embedding for the atomic number Z, Period P and the Group G of the element, noted Ei: hC = MLPC (cid:16)(cid:2)MLPP (PZ), EZ, EP , EG (cid:3)(cid:17) (1) • hSG: Each space group is embedded as a lookup in a learnable embedding matrix. • hLP: Lattice parameters are first standardize element-wise using the training set statistics. This 6-dimensional vector is then passed through a small MLP: hLP = MLPLP (cid:0) LP(x) − μtrain(LP) σtrain(LP) (cid:1) (2) C.2 Performance Our proxy MLP model achieves an overall Mean Absolute Error of 0.10 ± 0.005 eV1. For reference, best performing methods in Matbench leaderboard2 can achieve up to 10× better performance. However, they all use 3D positions of the crystals, and remarkably, our approach outperforms some of them, indicating that leveraging composition, space-group and lattice parametrs serves as a viable representation in the formation energy estimation task. In Figures 3 and 4 we detail further the performance of our Proxy MLP on the MatBench validation set. In particular we observe that it maintains good performance for structures with FE up to ∼ 0.3ev. The MAE beyond that FE level becomes high and unstable, but this is expected as those are the regions of the target space with least data available. Additionally we can verify in Figure 3 that our stratification algorithm works as expected, with similar FE distributions in the validation and train splits. C.3 Hyper parameters We present the hyper parameters of our Proxy MLP in Table 1 along with a description of their role in the architecture. 195% confidence interval, computed modeling the MAE as a log-normal distribution. This is further justified by Fig. 4. 2https://matbench.materialsproject.org/Leaderboards%20Per-Task/matbench_v0.1_matbench_mp_ e_form/ 14 Hyper parameter Value Description properties_proj_size group_emb_size period_emb_size z_emb_size sg_emb_size lat_hidden_channels lat_num_layers num_layers 64 16 256 128 128 284 1 5 Projection size of atomic properties h = WpZ Embedding size of element's group Embedding size of element's period Embedding size of element's atomic number Crystal space group embedding size Hidden channels for layers processing the lattice parameters Number of hidden layers for the lattice parameters MLP Number of layers for final MLP processing composition, space group and lattice parameters hidden representations hidden_channels 576 Size of final MLP hidden layers. optimizer lr batch_size Adam 0.0017 448 Learning rate scheduler ReduceLROnPlateau Divide learning rate by 2 when validation MAE es_patience epochs 11 100 does not improve for 4 epochs Early stopping patience (in epochs) Total epochs (effective after early stopping: 97) Table 1: Proxy MLP hyper parameters 15 Figure 3: Proxy MLP performance on the validation set and data split FE distributions. The average MAE is 0.10eV. We can also see the effect of the stratification algorithm wich yields similar FE distributions between the train and validation data set splits. D Additional results In this section, we provide additional results demonstrating the diversity of the samples generated by the Crystal-GFlowNet. They are displayed in Figure 5, Figure 6, Figure 7 and Figure 8. 16 1012345MAE +/- 1 std for each FE binValidation MAE per FE binValidation MAE mean4321012Formation Energy0.0000.0010.0020.0030.0040.005ProportionTraining setValidation set Figure 4: Distribution of FE values in the validation set and associated Proxy MLP MAE, with 25%, 50% and 75% MAE quantiles. 17 106105104103102101100101MAE (eV)4321012Formation Energy (eV)25% quantile50% quantile75% quantile0100001000 Figure 5: Distribution of element prevalence per data set (10k Crystal-GFlowNet samples, MatBench val, MatBench train). 18 HLiCNOFMgSiPSClFeElement0.000.050.100.150.200.250.300.35FrequencyCrystal-GFlownetMatBench ValMatBench Train Figure 6: Distribution of binarized element co-occurrences per data set (10k Crystal-GFlowNet samples, MatBench val, MatBench train). A binarized co-occurrence is defined as element i and element j both being present in a crystal, regardless of their respective stoichiometry in that crystal. 19 0.000.010.020.030.040.050.06FrequencyH-HH-LiH-CH-NH-OH-FH-MgH-SiH-PH-SH-ClH-FeLi-HLi-LiLi-CLi-NLi-OLi-FLi-MgLi-SiLi-PLi-SLi-ClLi-FeC-HC-LiC-CC-NC-OC-FC-MgC-SiC-PC-SC-ClC-FeN-HN-LiN-CN-NN-ON-FN-MgN-SiN-PN-SN-ClN-FeO-HO-LiO-CO-NO-OO-FO-MgO-SiO-PO-SO-ClO-FeF-HF-LiF-CF-NF-OF-FF-MgF-SiF-PF-SF-ClF-FeMg-HMg-LiMg-CMg-NMg-OMg-FMg-MgMg-SiMg-PMg-SMg-ClMg-FeSi-HSi-LiSi-CSi-NSi-OSi-FSi-MgSi-SiSi-PSi-SSi-ClSi-FeP-HP-LiP-CP-NP-OP-FP-MgP-SiP-PP-SP-ClP-FeS-HS-LiS-CS-NS-OS-FS-MgS-SiS-PS-SS-ClS-FeCl-HCl-LiCl-CCl-NCl-OCl-FCl-MgCl-SiCl-PCl-SCl-ClCl-FeFe-HFe-LiFe-CFe-NFe-OFe-FFe-MgFe-SiFe-PFe-SFe-ClFe-FeElement pairCrystal-GFlownetMatBench ValMatBench Train Figure 7: Distribution of Space Groups per data set (10k Crystal-GFlowNet samples, MatBench val, MatBench train) 20 0.0000.0250.0500.0750.1000.1250.1500.1750.200Frequency230229227225224221220217216206205199198194192189187186185181176167166164163162161160156155150148147146141140139138137136131129126123122121114113107102999288878685848274727170696766656463626160595857565553525147464443414038363331302926252120191816151413121110987654321Space groupCrystal-GFlownetMatBench ValMatBench Train Figure 8: Distribution of lattice parameters 21 0.9020.7240.5460.3680.18100.00a (normalized)507090110130150alpha (normalized)0.9020.7240.5460.3680.18100.00b (normalized)507090110130150beta (normalized)Crystal-GFlownetMatBench ValMatBench Train0.9020.7240.5460.3680.18100.00c (normalized)Crystal-GFlownetMatBench ValMatBench Train507090110130150gamma (normalized)
http://arxiv.org/abs/2310.04921v2
"2023-10-18T14:52:03"
"2023-10-07T21:23:58"
Crystal: Introspective Reasoners Reinforced with Self-Feedback
Extensive work has shown that the performance and interpretability of commonsense reasoning can be improved via knowledge-augmented reasoning methods, where the knowledge that underpins the reasoning process is explicitly verbalized and utilized. However, existing implementations, including "chain-of-thought" and its variants, fall short in capturing the introspective nature of knowledge required in commonsense reasoning, and in accounting for the mutual adaptation between the generation and utilization of knowledge. We propose a novel method to develop an introspective commonsense reasoner, Crystal. To tackle commonsense problems, it first introspects for knowledge statements related to the given question, and subsequently makes an informed prediction that is grounded in the previously introspected knowledge. The knowledge introspection and knowledge-grounded reasoning modes of the model are tuned via reinforcement learning to mutually adapt, where the reward derives from the feedback given by the model itself. Experiments show that Crystal significantly outperforms both the standard supervised finetuning and chain-of-thought distilled methods, and enhances the transparency of the commonsense reasoning process. Our work ultimately validates the feasibility and potential of reinforcing a neural model with self-feedback.
[ "Jiacheng Liu", "Ramakanth Pasunuru", "Hannaneh Hajishirzi", "Yejin Choi", "Asli Celikyilmaz" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04921v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04921v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.AI", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.AI", "cs.CL", "cs.LG" ]
CRYSTAL: Introspective Reasoners Reinforced with Self-Feedback Jiacheng Liu♡♣∗ Ramakanth Pasunuru♣ Hannaneh Hajishirzi♡♠ Yejin Choi♡♠ Asli Celikyilmaz♣ ♡Paul G. Allen School of Computer Science & Engineering, University of Washington ♣FAIR, Meta ♠Allen Institute for Artificial Intelligence liujc@cs.washington.edu 3 2 0 2 t c O 8 1 ] I A . s c [ 2 v 1 2 9 4 0 . 0 1 3 2 : v i X r a Abstract Extensive work has shown that the performance and interpretability of commonsense reasoning can be improved via knowledge-augmented rea- soning methods, where the knowledge that un- derpins the reasoning process is explicitly ver- balized and utilized. However, existing imple- mentations, including "chain-of-thought" and its variants, fall short in capturing the intro- spective nature of knowledge required in com- monsense reasoning, and in accounting for the mutual adaptation between the generation and utilization of knowledge. We propose a novel method to develop an introspective common- sense reasoner, CRYSTAL. To tackle common- sense problems, it first introspects for knowl- edge statements related to the given question, and subsequently makes an informed prediction that is grounded in the previously introspected knowledge. The knowledge introspection and knowledge-grounded reasoning modes of the model are tuned via reinforcement learning to mutually adapt, where the reward derives from the feedback given by the model itself. Experi- ments show that CRYSTAL significantly outper- forms both the standard supervised finetuning and chain-of-thought distilled methods, and en- hances the transparency of the commonsense reasoning process. Our work ultimately vali- dates the feasibility and potential of reinforcing a neural model with self-feedback. 1 1 Introduction Commonsense reasoning poses unique challenges to neural reasoning models. The underlying knowl- edge that grounds the reasoning process is often obscure and inexplicable, even to humans as we mainly rely on intuitive inference for such prob- lems (Mercier and Sperber, 2017). This is in stark contrast with multi-step logical reasoning (e.g., ∗Work done as a visiting researcher at FAIR, Meta. 1Code: github.com/liujch1998/crystal Model: huggingface.co/liujch1998/crystal-11b Demo: huggingface.co/spaces/liujch1998/crystal Figure 1: Top: CRYSTAL performing introspective rea- soning on a commonsense question. The model first uses its knowledge introspection mode to generate rele- vant knowledge statements, then invokes a knowledge- grounded reasoning mode to predict an answer based on the introspected knowledge. Bottom: chain-of- thought prompting on the same question (generated by text-davinci-003 with original few-shot prompts in Wei et al. (2022)). The intermediate steps fail to provide meaningful insight into the reasoning process. math problems, logical deductions), where the reasoning process consists of explicit and closed- world deduction steps. Chain-of-thought (CoT) (Wei et al., 2022) and its variants have been suc- cessful in multi-step logical reasoning, yet their ef- fectiveness on commonsense reasoning is marginal, largely due to the lack of the above observation when designing their few-shot prompts. Never- theless, generating the reasoning process is still instrumental for commonsense reasoning, as it im- proves both performance and interpretability of neural models (Shwartz et al., 2020; Liu et al., 2022a, i.a.). For such knowledge-augmented rea- soning approach, two components are indispens- able: (1) introspecting for relevant, high-quality knowledge, and (2) effectively and faithfully utiliz- ing the knowledge to make informed final predic- tions. Our key insight is that these two components are deeply adaptive to each other: knowledge in- trospection should aim to produce knowledge that would be most beneficial to grounding the subse- quent reasoning, and knowledge-grounded reason- ing should learn to best leverage the previously introspected knowledge. Existing literature does not comprehensively optimize these two compo- nents and the bi-directional interaction between them, and comes with additional complications. Knowledge-augmented reasoning methods largely employ task-specific engineering for knowledge generation and are thus difficult to generalize to unseen domains. As for CoT and its variants, the reasoning chains hardly provide meaningful infor- mation due to deficiency in their prompt design (Figure 1). We aim to systematically address the above con- siderations and build a strong, interpretable and generalizable model for commonsense reasoning. The introspective reasoner we develop, named CRYSTAL, tackles commonsense problems by the following (illustrated in Figure 1): it first invokes a knowledge introspection mode to generate knowl- edge statements related to the given question, and subsequently invokes a knowledge-grounded rea- soning mode that ingests both the question and the previously introspected knowledge to predict an an- swer. CRYSTAL is trained with reinforcement learn- ing (RL) to improve the synergy between the rea- soning paths and the final predictions. The knowl- edge introspection mode of the model is trained with PPO (Schulman et al., 2017) to optimize a reward function that characterizes if the generated knowledge can fix prediction errors made by the knowledge-grounded reasoning mode of the model. In this sense, CRYSTAL is reinforced with self- generated feedback. Concurrently, the knowledge- grounded reasoning mode evolves to better utilize the introspected knowledge statements for more accurate predictions. These two learning objectives are harmonized through a novel interleaved opti- mization schedule, echoing the principles of the EM algorithm (Dempster et al., 1977). We employ a two-stage training process: the RL training stage is preceded by a supervised training stage, where CRYSTAL acquires preliminary skills to generate and utilize knowledge by imitating a larger LM (e.g., GPT-3). Experimental results on 25 commonsense QA benchmarks (10 seen, 15 unseen) show that CRYS- TAL not only enhances performance within fixed model sizes, but also amplifies the interpretabil- ity of the reasoning process. CRYSTAL outper- forms direct QA models finetuned with standard supervised learning and the same data, improving absolute accuracy by 1.5% to 2.5% on different model sizes, and showcases good generalization to unseen benchmarks. This highlights the bene- fits of introspective reasoning over direct inference. Additionally, CRYSTAL substantially outperforms models distilled from CoT produced by large LMs. Through CRYSTAL, we illustrate the potential and viability of reinforcing neural reasoning models with self-feedback. An additional benefit of our approach is the memory and time-efficient imple- mentation of PPO via model sharing, which allows this state-of-the-art RL algorithm to be applied to larger models with given amount of resources. 2 Method We will first introduce the concept of introspective reasoning (§2.1), followed by a description of our introspective reasoner, CRYSTAL, including its ba- sic functionality (§2.2), training objectives (§2.3), adaptation of the RL algorithm and efficiency im- provements (§2.4), and the design of model training process (§2.5, §2.6). 2.1 Introspective Reasoning Conventionally, commonsense QA models are de- signed to directly predict answers for questions (e.g. Lourie et al., 2021). These models operate like black boxes and their predictions are difficult to interpret. We consider introspective reasoning, where a system first introspects for commonsense knowledge statements that are relevant to reasoning about the given question, and subsequently makes an informed prediction that is grounded in the in- trospected knowledge. We refer to the former step as knowledge introspection, and the latter step as knowledge-grounded reasoning. Figure 1 exemplifies the introspective reasoning process. Given the question "What comes from cows?" with the correct answer "nutritious flu- ids" provided among other incorrect choices, the system first generates knowledge statements like "Cows produce milk." Taking this knowledge state- ment as additional input, the system then invokes knowledge-grounded reasoning and makes a cor- rect prediction. Introspective reasoning has promise in enhanc- ing model performance on commonsense reasoning while making the reasoning process more inter- pretable. The introspected knowledge reveals the Mode I/O Format Knowledge introspection Knowledge- grounded reasoning Input: What comes from cows? \n (A) pork (B) can be organic ... (G) nutritious fluid (H) corn \n Knowledge: Output: Cows produce milk. Input: What comes from cows? \n (A) pork (B) can be organic ... (G) nutritious fluid (H) corn \n Knowledge: Cows produce milk. \n Answer: Output: G Table 1: CRYSTAL's I/O format for its two modes. reasoning paths that lead to the final predictions, which human users can observe. The system can explore and ensemble multiple reasoning paths and thus make a more informed final prediction. Knowledge introspection. The term "knowledge introspection" was introduced by Liu et al. (2022a), which also developed a dedicated knowledge in- trospection model, Rainier. Our work extends this idea to a unified introspective reasoning model. 2.2 CRYSTAL CRYSTAL, the introspective reasoner that we de- velop, is a unified model that supports the end-to- end workflow of an introspective reasoning sys- tem. CRYSTAL has two modes of operation: knowl- edge introspection and knowledge-grounded rea- soning. In knowledge introspection, the model ac- cepts a question as input, and outputs a knowledge statement relevant to the question. In knowledge- grounded reasoning, the model ingests both the question and the previously generated knowledge statement as input, and outputs a prediction. The system produces an final prediction by consulting and aggregating predictions resulted from all the available reasoning paths, effectively harnessing the power of ensembled reasoning. I/O format. Since CRYSTAL has two modes of operation, it needs to discern when to conduct knowledge introspection and when to engage in knowledge-grounded reasoning. Drawing inspira- tion from Tafjord and Clark (2021), we structure the input/output format as demonstrated in Table 1. This format is adapted from UnifiedQA (Khashabi et al., 2020), and we detail our modifications in §A. Notation. CRYSTAL is a sequence-to-sequence generative model parameterized by θ. In knowl- edge introspection, the modeling of knowledge k given question q is denoted as pQK(k|q; θ); in knowledge-grounded reasoning, the modeling of answer prediction a is denoted as pQKA(a|q, k; θ). 2.3 Training Objectives To yield the desired outcome of an introspective rea- soning system, we need to make knowledge intro- spection and knowledge-grounded reasoning well- adapted to each other. The knowledge introspec- tion component should aim to produce knowledge that would be most beneficial to ground the sub- sequent reasoning, and the knowledge-grounded reasoning component should learn to best leverage the previously introspected knowledge. We design the training objectives to account for this mutual adaptation. Adapting reasoning to introspection. Suppose a knowledge statement is sampled online from CRYSTAL in the knowledge introspection mode: ˆk ∼ pQK(k|q; θ). We use standard supervision and minimize a knowledge-grounded reasoning loss: LQKA(θ) = − log pQKA(a∗|q, ˆk; θ), where a∗ is the correct answer for question q. Adapting introspection to reasoning. The de- sirability of introspected knowledge is determined by its effectiveness on the subsequent knowledge- grounded reasoning. A knowledge statement is good if grounding in it can remediate an other- wise incorrect prediction, and is bad if it misleads an otherwise correct prediction. Formally, a good knowledge statement should yield a∗ ̸= arg max a∈A a∗ = arg max a∈A pQKA(a|q, ε; θ), pQKA(a|q, ˆk; θ), where A is the candidate set for question q, and ε stands for no knowledge; and vice versa for a bad knowledge statement. However, a knowledge statement consists of a se- quence of discrete tokens, rendering standard gra- dient methods infeasible for optimizing the intro- spected knowledge. Following Liu et al. (2022a), we formulate the problem as reinforcement learn- ing (RL), and optimize a reward function that char- acterizes the desirability of knowledge: r = (cid:104) tanh (cid:0)s(a∗|q, ˆk) − max 1 2 − tanh (cid:0)s(a∗|q, ε) − max a′∈A\{a∗} s(a′|q, ˆk)(cid:1) s(a′|q, ε)(cid:1)(cid:105) , a′∈A\{a∗} where s(a|q, k) is the pre-softmax logit of pQKA(a|q, k; θ) on the single-token answer a. The reward approaches +1 for good knowledge state- ments and −1 for bad ones. We use the PPO algorithm to optimize this reward. A knowledge introspection loss LPPO(θ) can be defined as a function of the reward and the model parameter θ, following Liu et al. (2022a). Since this training loss is derived from the downstream knowledge-grounded reasoning results produced by the same model, the model is reinforced with feedback given by itself. During training, the two objectives, LPPO(θ) and LQKA(θ), are optimized under an interleaved sched- ule (rather than jointly), which is described in §2.6. Leaving out the direct QA objective. To pre- vent the model from taking reasoning shortcuts and encourage it to leverage the introspected knowl- edge, we deliberately left out a potential, direct QA objective: LQA = − log pQA(a∗|q). (1) As we will show in experiments, including this direct QA loss hurts performance, probably by allowing the model to take shortcuts around the knowledge. 2.4 PPO and Model Sharing PPO, or Proximal Policy Optimization (Schulman et al., 2017), is an RL algorithm that has been widely used in aligning LMs with human feedback (Stiennon et al., 2020; Ouyang et al., 2022; OpenAI, 2022; Wu et al., 2023). It is also adopted by Liu et al. (2022a) to train their knowledge introspection model, Rainier. Within the context of PPO terminology, CRYS- TAL's knowledge introspection mode assumes the role of the policy model, while its knowledge- grounded reasoning mode functions as the reward model. PPO further employs a value model to esti- mate the value function for states containing partial knowledge statements, and we propose to reuse the parameters of CRYSTAL for the value model as well. Consequently, while in conventional PPO the policy, value and reward models are parameterized separately, when training CRYSTAL they share the same underlying parameters. CRYSTAL is essen- tially a generative LM equipped with two heads: an LM head that comes into play during the policy and reward modeling, and a value regression head that is activated in value modeling. This model sharing Figure 2: Illustration of the interleaved optimization schedule for both training stages. In training stage I, during each cycle, LQK is optimized for SQK iterations, and then LQKA is optimized for SQKA iterations. Pro- gressing to training stage II, during each cycle, LPPO is optimized for SPPO iterations, and then LQKA is opti- mized for SQKA iterations. results in improved memory and time efficiency for PPO training, as discussed in §4.4. 2.5 Two-Staged Training PPO requires that the policy model is initialized from a reasonably good state. Typically, PPO train- ing follows a supervised finetuning stage for the policy model (Stiennon et al., 2020; Ouyang et al., 2022). For Rainier, an imitation learning stage, during which the model is supervised on silver knowledge statements obtained from a few-shot GPT-3, precedes the RL training stage. This im- itation learning stage imparts the model with the preliminary skill of generating question-specific knowledge, and sets a promising starting point for RL. Drawing from this concept, we employ a two- stage training process for CRYSTAL. In training stage I, the model is tuned to conduct both knowl- edge introspection (by imitating a few-shot GPT-3) and knowledge-grounded reasoning. We minimize two losses: a knowledge introspection loss LQK(θ) = − log pQK(k|q; θ), and a knowledge-grounded reasoning loss LQKA(θ) = − log pQKA(a∗|q, k; θ), where k is a silver knowledge statement generated by the few-shot GPT-3. In training stage II, we follow the procedure in §2.3 to adapt the knowledge introspection and knowledge-grounded reasoning modes to each other. 2.6 Interleaved Optimization Schedule Through empirical analysis, we have observed in- terleaving the two training losses in each stage yields beneficial outcomes as opposed to jointly optimizing them. In stage I, we optimize LQK for a specific number of iterations, followed by opti- mizing LQKA for another set number of iterations, repeating this cycle. Similarly, In stage II, we op- timize LPPO for a designated number of iterations, followed by optimizing LQKA for another set num- ber of iterations, repeating this cycle. This design bears resemblance to the EM algorithm (Dempster et al., 1977), wherein the hidden variable corre- sponds to the knowledge statement. Optimizing LPPO can be likened to estimating the hidden vari- ables, while optimizing LQKA is akin to updating the parameter estimation based on the current as- signment of hidden variables. The interleaved opti- mization schedule is illustrated in Figure 2. 3 Experimental Setup Datasets. To promote generalization, we train CRYSTAL on 10 datasets (following Liu et al. (2022a)): OpenBookQA (Mihaylov et al., 2018), ARC (easy and hard splits) (Clark et al., 2018), AI2Science (elementary and middle splits) (Clark et al., 2018), CommonsenseQA (Talmor et al., 2019), QASC (Khot et al., 2020), PhysicalIQA (Bisk et al., 2020), SocialIQA (Sap et al., 2019), and Winogrande (Sakaguchi et al., 2020). We use the development set of these datasets to eval- uate model performance (i.e., seen evaluation). For unseen evaluation, we use the development set of 15 additional datasets: Com2Sense (Singh et al., 2021), SciQ (Welbl et al., 2017), QuaRel (Tafjord et al., 2019a), QuaRTz (Tafjord et al., 2019b), CycIC, ComVE (Wang et al., 2020), Wino- grad Schema Challenge (Levesque et al., 2011), COPA (Gordon et al., 2012), NumerSense (Lin et al., 2020), PROST (Aroca-Ouellette et al., 2021), SWAG (Zellers et al., 2018), HellaSwag (Zellers et al., 2019), CODAH (Chen et al., 2019), Story Cloze Test (Mostafazadeh et al., 2016), and αNLI (Bhagavatula et al., 2020). See Table 9 (appendix) for details. On the training datasets, we get sil- ver knowledge from the davinci version of GPT-3 (Brown et al., 2020), with the few-shot prompts in Liu et al. (2022a). Models. Similar to Liu et al. (2022a), we initial- ize CRYSTAL with T5 (Raffel et al., 2020). The value regression head is initialized from scratch at the beginning of stage II training. We exper- iment with three model sizes: T5-large, T5-3b, and T5-11b. We train models on V100 GPUs (8 for T5-large, 16 for T5-3b, and 64 for T5-11b), with the Huggingface Transformers and Accelerate libraries (Wolf et al., 2019; Gugger et al., 2022). See Table 10 (appendix) for the complete hyperpa- rameter settings. Baselines. We primarily compare CRYSTAL with models trained on the same datasets using the stan- dard QA objective (i.e., Equation 1), referred as "Direct QA". These models are also based on the pretrained T5 of the three sizes above. Addition- ally, we compare our model to Rainier (Liu et al., 2022a) and several CoT-distilled models. Among these, fine-tune-CoT (Ho et al., 2022) use zero-shot reasoning chains elicited from text-davinci-002 to finetune smaller variants of GPT-3; SCoTD (Li et al., 2023a) employs a similar distillation strategy, whereas the teacher model is code-davinci-002 and the target model is OPT up to 1.3B param- eters; SCOTT (Wang et al., 2023) proposes addi- tional techniques to improve the reasoning integrity, including a contrastive decoding method to elicit more consistent reasoning chains from the teacher model and a counterfactual reasoning method to train the target model, and yet does not enable full bidirectional adaptation between the reasoning pro- cess and the final prediction, as our method does. It is worth noting that these CoT-distilled models are often trained on specific datasets, so we only present their reported performance on the datasets they were trained on. We also report the existing SOTA performance achieved by non-retrieval methods on each seen dataset.2 We exclude retrieval-based methods for fair comparison, because CRYSTAL does not rely on retrieval from extra sources. 4 Results 4.1 Performance The performance results are presented in Table 2 and Table 3. We organize the results based on the size of the models and compare them to baseline models that are no smaller than our models. On seen datasets, across all model sizes we ex- periment with, CRYSTAL consistently outperforms the direct QA baseline (by 1.5%∼2.5% depending on model size). This demonstrates that our training process is superior to the standard supervised train- ing and brings substantial performance gains to the 2Accessed from the AI2 leaderboards on 08/24/2023. Method Base model Size All OBQA ARC_e ARC_h AI2Sci_e AI2Sci_m CSQA QASC PIQA SIQA WG SOTA (w/o retrieval) – – – 87.80 – GPT-3-babbage 1.3B – – Fine-tune-CoT OPT-1.3b 1.3B SCoTD 67.00 – Rainier (+ UnifiedQA) T5-large 770M 62.58 69.60 T5-large 770M 65.07 63.00 Direct QA T5-large 770M 66.74 64.20 CRYSTAL (ours) Fine-tune-CoT SCOTT Direct QA CRYSTAL (ours) Direct QA CRYSTAL (ours) GPT-3-curie T5-3b T5-3b T5-3b T5-11b T5-11b 6.7B 3B 3B 3B – – – – 75.84 72.00 78.33 74.20 11B 82.49 80.00 11B 84.58 85.40 – – 67.72 64.74 65.61 – – 77.19 78.25 84.56 87.54 81.14 – – 55.18 48.49 52.84 – – 63.55 66.22 72.91 73.24 – – – 68.29 72.36 71.54 – – 83.74 84.55 87.80 89.43 – 82.20 72.28 90.13 83.15 91.28 – – 63.20 65.60 68.00 – – 75.20 79.20 84.00 84.80 – – – – – 43.08 67.00 – 67.24 54.97 65.67 57.01 56.91 67.40 54.75 75.19 69.19 69.93 70.52 56.80 75.68 69.81 72.38 – – – – 56.76 75.40 65.00 – 76.99 67.82 83.03 76.77 82.08 80.10 74.30 84.49 78.40 83.58 – – – – 81.98 78.29 88.36 78.45 88.56 82.31 81.97 88.08 82.24 90.77 Table 2: Results on seen datasets. Accuracy on the development set is reported. Method Size All C2S SciQ QuaRel QuaRTz CycIC ComVE WSC COPA NumerSense PROST SWAG HellaSwag CODAH SCT aNLI 770M 60.93 55.75 66.80 71.22 Direct QA CRYSTAL (ours) 770M 62.95 56.52 66.70 70.86 Direct QA 3B CRYSTAL (ours) 3B 67.73 58.57 75.90 81.29 72.06 65.98 79.50 80.58 11B 76.83 75.45 83.20 86.69 Direct QA CRYSTAL (ours) 11B 80.37 85.93 85.30 85.97 67.45 67.71 70.83 73.96 77.34 76.30 49.83 49.72 55.35 60.20 69.57 70.89 83.45 78.02 74.20 85.46 81.68 77.60 93.08 82.05 90.20 95.49 89.74 91.20 96.89 94.14 94.00 98.09 93.77 94.00 23.00 23.00 20.00 28.50 30.50 41.50 38.07 41.34 36.83 44.35 44.39 59.37 46.48 51.54 57.77 60.48 65.68 69.58 45.65 48.51 49.31 56.58 69.37 76.06 62.36 86.37 65.27 66.43 90.27 66.84 75.54 95.14 74.15 81.45 96.37 76.57 84.73 97.70 82.83 87.64 98.50 82.64 Table 3: Results on unseen datasets. Accuracy on the development set is reported. model. CRYSTAL also outperforms the combina- tion of Rainier and UnifiedQA, especially over the last five datasets (which UnifiedQA is not trained on). This shows the benefit of adapting knowledge- grounded reasoning to the introspected knowledge. CRYSTAL performs very closely to existing non- retrieval SOTA methods, setting new SOTA on two datasets (CommonsenseQA, QASC), and has less than 3% gap on other four (OpenBookQA, PIQA, SIQA, Winogrande). It is worth noting that these SOTA methods are good on different datasets, whereas CRYSTAL is a single model with strong performance on all these benchmarks. CRYSTAL is also competitive when compared with CoT-distilled models with similar sizes. The large and 3b ver- sions of CRYSTAL beat Fine-tune-CoT on Com- monsenseQA by 27% and 23%, respectively, de- spite having smaller model sizes. CRYSTAL-large is comparable to SCoTD on OpenBookQA and CommonsenseQA, and CRYSTAL-3b significantly outperforms SCOTT on CommonsenseQA (by 5%) and QASC (by 9%). Being trained on multiple commonsense datasets, CRYSTAL exhibits good generalization to unseen datasets. As shown in Table 3, CRYSTAL achieves a 2.0%∼4.3% average accuracy improve- ment over the direct QA baseline on the unseen evaluation benchmarks. The largest version of our Figure 3: Expert annotation on the relationship between the introspected knowledge and the final prediction. model, CRYSTAL-11b, achieves an average accu- racy of over 80% on these benchmarks. 4.2 Interpretability Beside QA accuracy, we measure whether the in- trospective reasoning conducted by CRYSTAL pro- vides good interpretability to its reasoning process. We asked three NLP experts to annotate the rela- tionship between the introspected knowledge and the final prediction. We randomly selected 100 ex- amples (four from each of the 25 datasets, includ- ing both seen and unseen ones), and each annotator made a full pass over them. For each example, the annotator chooses one of the following labels: Question CRYSTAL's introspected knowledge Direct QA's pred CRYSTAL's pred Task WG They discussed the company's budget at the business meeting but the _ was boring and the topic of the budget ran long. (A) budget (B) meeting The topic of the meeting was boring. PIQA Find spices easily in the kitchen. (A) Arrange spices from hot to mild in the kitchen in order to find them by taste. (B) Arrange your spices alphabetically to make finding them easy. A spice alphabet is used to find spices. QASC What comes from cows? (A) pork (B) can be organic (C) holding nutrients (D) drinking water (E) rice (F) antigens (G) nutritious fluid (H) corn Cows produce milk. CSQA Paul wants carrots and doesn't need to drive anywhere. He gets them from where? (A) refrigerator (B) store (C) farmer's market (D) supermarket (E) dryer Carrots are stored in the refrigerator. OBQA Frilled sharks and angler fish live far beneath the surface of the ocean, which is why they are known as (A) Deep sea animals (B) fish (C) Long Sea Fish (D) Far Sea Animals Deep sea animals are found in the ocean. ARC_e An anemometer is a tool that measures (A) wind direction. (B) wind speed. (C) air pressure. (D) air temperature. An anemometer measures wind speed and direction. A B A B A G D A D A B C Table 4: Examples of CRYSTAL's introspected knowledge and predictions grounded in the knowledge. The first row of each section is the original question and the prediction made by the direct QA model; the second row is the knowledge statement generated by CRYSTAL in the knowledge introspection mode, and the prediction made by CRYSTAL under knowledge-grounded reasoning with this knowledge statement. We show correct answers in green and incorrect answers in red. • Support: The knowledge can be part of a non-trivial reasoning chain that supports the predicted answer. • Trivial: The knowledge is a trivial paraphrase of the question and the predicted answer. • Repeat: The knowledge is a mere repetition of known information given in the question. • Related: The knowledge is topically related to the question and/or the choices, but can- not be part of a reasoning chain to support or refute any of the choices. • Unrelated: The knowledge is unrelated to the question. • Contradict: The knowledge can be part of a reasoning chain that refutes the predicted answer, or supports a different choice. See Table 11 (appendix) for a detailed description of these labels and some examples. The annotators reached a moderate level of agreement (Fleiss κ = 0.53 (Landis and Koch, 1977)). As shown in Figure 3, in 34% of the cases the introspected knowledge is found to support the final prediction in a non-trivial manner. In 19% of the cases the knowledge trivially entails the predic- tion, and in another 31% of the cases the knowledge is otherwise related to the question. The knowledge repeats known information in the question 5% of the time, and is unrelated to the question or contra- dicts with the prediction 11% of the time. Overall, the reasoning process has good interpretability in the majority of cases. 4.3 Qualitative Examples We present several examples in Table 4 to illustrate the reasoning process of CRYSTAL. In most cases, the introspective reasoning carried out by CRYS- TAL leads to more accurate predictions compared to the direct QA model. The knowledge introspected by CRYSTAL often proves to be beneficial in ar- riving at the correct prediction from human inter- pretation standpoint. For example, the knowledge "Cow produce milk" aids in concluding that "Nu- tritious fluid comes from cows" (with the implicit knowledge that "Milk is nutritious fluid"). This showcases how the knowledge-grounded reasoning of CRYSTAL leverages introspected knowledge to reach accurate predictions. However, there are ex- ceptional cases where the knowledge-grounded rea- soning fails to incorporate the introspected knowl- Method # trained models # frozen models # forwards # backwards # optimizer steps Rainier CRYSTAL 2 1 2 1 5 + 2s 4 + s 2s s 2s s Table 5: Theoretical memory and time consumption of PPO training in CRYSTAL. s is the number of minor steps in each PPO iteration. (In our experiments, we use s = 4.) Model Base model Trainable params # GPUs Total GPU mem PPO training speed Rainier CRYSTAL CRYSTAL CRYSTAL T5-large T5-large T5-3b T5-11b 1.54B 770M 3B 11B 8 8 16 64 153 GiB 129 GiB 488 GiB 2032 GiB 10.97 s/it 6.96 s/it 14.07 s/it 60.30 s/it Table 6: Empirical memory usage and speed of training CRYSTAL (stage II). Experiments are conducted on V100 GPUs. Fully sharded data parallel (FSDP) and bfloat16 mixed precision are enabled. edge. For example, the correct knowledge that "An anemometer measures wind speed and direction" is introspected, but CRYSTAL still predicts "air pressure" instead of "wind speed" as the thing measured by anemometers. 4.4 Memory and Time Efficiency As mentioned in §2.4, the PPO training in CRYS- TAL improves efficiency of the conventional PPO algorithm by model sharing. In this section, through theoretical and empirical analysis, we com- pare the memory and time consumption of PPO training in CRYSTAL and Rainier (Liu et al., 2022a), which employs the conventional PPO. PPO in Rainier requires three different mod- els: a policy model, a value model, and a reward model. The policy model is Rainier, while the re- ward model is a fixed QA model. The value model is a separate model that shares the same architec- ture as Rainier, with the exception that it has a value regression head instead of a language model- ing head. The policy and value models are trained simultaneously, while the reward model remains frozen. Additionally, an initial version of the pol- icy model must be retained (to calculate the KL penalty term). Therefore, a total of four models are stored, with two of them being actively updated. In each PPO iteration, Rainier requires 5 + 2s for- ward passes, 2s backward passes, and 2s optimizer (s is the number of mi- updates on the model. nor steps in each PPO iteration.) This involves executing a gradient-less rollout from the policy, one gradient-less forward pass on the value model, another gradient-less forward pass on the initial policy model, two gradient-less forward passes on the reward model, and for each minor step in the iteration, conducting one forward-backward pass and one optimizer update on the policy model and the value model, respectively. In contrast to Rainier, PPO on CRYSTAL needs to store only two models: a shared pol- icy/value/reward model which is being actively up- dated, and an initial version of the policy model (to compute the KL penalty term). In each PPO iteration, CRYSTAL needs 4 + s forward passes, s backward passes, and s optimizer updates on the model: a gradient-less rollout from the policy, one gradient-less forward pass on the initial pol- icy model, two gradient-less forward passes on the reward model, plus for each minor step in the itera- tion, one forward-backward pass and one optimizer update on the policy/value model. Table 5 summarizes the theoretical memory and time consumption of Rainier and CRYSTAL, and Table 6 reports the empirical memory usage and speed in the stage II training of these models. Com- pared with Rainier, CRYSTAL has less trainable parameters, consumes less GPU memory, and has faster training speed. The superior memory and time efficiency of CRYSTAL enables training larger models, and a 11b model can be reinforced with 64 V100 GPUs. 4.5 Ablations The effect of RL. We report the impact of remov- ing RL (i.e. training stage II) in Table 7. Across different model sizes, the performance of CRYSTAL on seen datasets consistently decreases by approx- imately 0.5% to 0.6% when training stage II is omitted. This highlights the significance of RL in enchancing the knowledge introspection and knowl- edge grounded reasoning capability of CRYSTAL. Method CRYSTAL (ours) - Stage II + Direct QA loss CRYSTAL (ours) - Stage II CRYSTAL (ours) - Stage II Size Seen 770M 66.74 770M 66.16 770M 65.36 3B 3B 11B 11B 78.33 77.79 84.58 84.08 Table 7: Ablations on the RL training stage (i.e., stage II). Average accuracy on the development set of seen datasets is reported. Stage I Stage II Seen interleaved joint joint interleaved interleaved joint 66.74 66.66 66.31 Table 8: Ablations on the interleaved training objec- tives. Average accuracy on the development set of seen datasets is reported. Impact of the direct QA loss. We experimented with training the stage I model with the addition of the direct QA loss (§2.3, Equation 1). As shown in Table 7, training with this additional loss hurts performance by 0.8%. We therefore did not include this loss in the training objective of CRYSTAL. Interleaved objectives. To demonstrate the ad- vantages of interleaving the training objectives, we explore an alternative approach using a joint ob- jective. In this approach, during training stage I, we optimize the joint loss, LQK + LQKA, in each iteration. Similarly, during training stage II, we optimize the joint loss, LPPO + LQKA. Table 8 presents the results of this approach, where the interleaved objectives are replaced with the joint version. As such, the performance on seen datasets decreases. This suggests that the interleaving of objectives in CRYSTAL provides a benefit over the joint optimization approach. 5 Related Work Knowledge-augmented reasoning. There has been numerous work that grounds reasoning in model-generated knowledge (Bosselut et al., 2021; Rajani et al., 2019; Latcinnik and Berant, 2020; Shwartz et al., 2020; Paranjape et al., 2021; Liu et al., 2022b; Gu et al., 2022; Liu et al., 2022a; Wang et al., 2022b,a; Yu et al., 2022; Li et al., 2023b; Wei et al., 2022). We summarize these methods in Table 12 (appendix). Our method is the first to account for the mutual adaptation of knowledge generation and knowledge-grounded reasoning in a unified model setting. Relation to chain-of-thought distillation. A se- ries of work endow smaller LMs with step-by-step reasoning capabilities by distilling from chain-of- thought (CoT) generated by large LMs (Li et al., 2022; Shridhar et al., 2022; Magister et al., 2022; Ho et al., 2022; Fu et al., 2023; Li et al., 2023a; Wang et al., 2023). We share similarity with this line of work in that our part of training process (i.e., training stage I) include distilling the emergent ca- pability of a larger LM to a smaller one. We differ in that we capture the introspective nature of knowl- edge required for commonsense reasoning, and we further use reinforcement learning to improve the synergy between reasoning paths and final answer predictions. Improving from self-feedback. Several papers have proposed to improve LMs using feedback from themselves. For example, Zelikman et al. (2022) proposes to train a model with its self- generated reasoning steps that result in itself mak- ing the correct final predictions. Huang et al. (2022) chooses which self-generated reasoning chains to train on by selecting the high-confidence, self- consistent ones. Both papers use supervised loss to improve the model. To our best knowledge, we are the first to improve models from self-feedback using RL. Concurrent to our work, Madaan et al. (2023) pro- poses an inference-time method to improve text generation by taking an LM's own feedback on the output, and yet it relies on the emergent behav- ior of LLMs, whereas CRYSTAL improves through RL and can be applied to smaller LMs to achieve higher performance than larger LLMs. 6 Conclusion We develop a method to build introspective reason- ers that achieves superior performance and good interpretability on commonsense reasoning tasks. Compared with prior literature, our method com- prehensively accounts for the introspective nature of knowledge required in commonsense reason- ing, and the mutual adaptation of knowledge intro- spection and knowledge-grounded reasoning. Our approach highlights the feasibility and benefit of training neural models with self-feedback. Limitations CRYSTAL is intended to solve commonsense QA problems, and its performance on non- commonsense applications is unknown and thus requires further investigation. There is also a limit on the length of knowledge it generates in our ex- perimental setting, and it has not been tested on gen- erating long and coherent text. Extra care should be taken when applying our model in production environments, especially when making critical de- cisions or exposing its generated contents directly to human end users. Acknowledgements We thank members of the H2lab for their con- structive feedback. This work was funded in part by the DARPA MCS program through NIWC Pa- cific (N66001-19-2-4031), NSF IIS-2044660, NSF DMS-2134012, and ONR N00014-18-1-2826. JL is supported in part by the Meta AI Mentorship program. References Stéphane Aroca-Ouellette, Cory Paik, Alessandro Ron- cone, and Katharina Kann. 2021. PROST: Physi- cal reasoning about objects through space and time. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 4597–4608, Online. Association for Computational Linguistics. Chandra Bhagavatula, Ronan Le Bras, Chaitanya Malaviya, Keisuke Sakaguchi, Ari Holtzman, Han- nah Rashkin, Doug Downey, Wen-tau Yih, and Yejin Choi. 2020. Abductive commonsense reasoning. In 8th International Conference on Learning Represen- tations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. Yonatan Bisk, Rowan Zellers, Ronan LeBras, Jianfeng Gao, and Yejin Choi. 2020. PIQA: reasoning about physical commonsense in natural language. In The Thirty-Fourth AAAI Conference on Artificial Intelli- gence, AAAI 2020, The Thirty-Second Innovative Ap- plications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pages 7432– 7439. AAAI Press. Antoine Bosselut, Ronan Le Bras, and Yejin Choi. 2021. Dynamic neuro-symbolic knowledge graph construc- tion for zero-shot commonsense question answering. In Thirty-Fifth AAAI Conference on Artificial Intel- ligence, AAAI 2021, Thirty-Third Conference on In- novative Applications of Artificial Intelligence, IAAI 2021, The Eleventh Symposium on Educational Ad- vances in Artificial Intelligence, EAAI 2021, Virtual Event, February 2-9, 2021, pages 4923–4931. AAAI Press. Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language models are few-shot learners. In Ad- vances in Neural Information Processing Systems 33: Annual Conference on Neural Information Process- ing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual. Michael Chen, Mike D'Arcy, Alisa Liu, Jared Fernan- dez, and Doug Downey. 2019. Codah: An adversar- ially authored question-answer dataset for common sense. ArXiv preprint, abs/1904.04365. Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. 2018. Think you have solved question an- swering? try arc, the ai2 reasoning challenge. ArXiv preprint, abs/1803.05457. Arthur P Dempster, Nan M Laird, and Donald B Rubin. 1977. Maximum likelihood from incomplete data via the em algorithm. Journal of the royal statistical society: series B (methodological), 39(1):1–22. Yao Fu, Hao-Chun Peng, Litu Ou, Ashish Sabharwal, and Tushar Khot. 2023. Specializing smaller lan- guage models towards multi-step reasoning. ArXiv preprint, abs/2301.12726. Andrew Gordon, Zornitsa Kozareva, and Melissa Roem- mele. 2012. SemEval-2012 task 7: Choice of plau- sible alternatives: An evaluation of commonsense causal reasoning. In *SEM 2012: The First Joint Conference on Lexical and Computational Seman- tics – Volume 1: Proceedings of the main conference and the shared task, and Volume 2: Proceedings of the Sixth International Workshop on Semantic Eval- uation (SemEval 2012), pages 394–398, Montréal, Canada. Association for Computational Linguistics. Yuling Gu, Bhavana Dalvi, and Peter Clark. 2022. DREAM: Improving situational QA by first elab- In Proceedings of the 2022 orating the situation. Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1115–1127, Seattle, United States. Association for Computational Lin- guistics. Sylvain Gugger, Lysandre Debut, Thomas Wolf, Philipp Schmid, Zachary Mueller, and Sourab Mangrulkar. 2022. Accelerate: Training and inference at scale made simple, efficient and adaptable. https:// github.com/huggingface/accelerate. Namgyu Ho, Laura Schmid, and Se-Young Yun. 2022. Large language models are reasoning teachers. ArXiv preprint, abs/2212.10071. Jiaxin Huang, Shixiang Shane Gu, Le Hou, Yuexin Wu, Xuezhi Wang, Hongkun Yu, and Jiawei Han. 2022. Large language models can self-improve. ArXiv preprint, abs/2210.11610. Daniel Khashabi, Sewon Min, Tushar Khot, Ashish Sabharwal, Oyvind Tafjord, Peter Clark, and Han- naneh Hajishirzi. 2020. UNIFIEDQA: Crossing for- mat boundaries with a single QA system. In Find- ings of the Association for Computational Linguistics: EMNLP 2020, pages 1896–1907, Online. Association for Computational Linguistics. Tushar Khot, Peter Clark, Michal Guerquin, Peter Jansen, and Ashish Sabharwal. 2020. QASC: A dataset for question answering via sentence compo- In The Thirty-Fourth AAAI Conference on sition. Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Con- ference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pages 8082–8090. AAAI Press. J Richard Landis and Gary G Koch. 1977. The mea- surement of observer agreement for categorical data. biometrics, pages 159–174. Veronica Latcinnik and Jonathan Berant. 2020. Explain- ing question answering models through text genera- tion. ArXiv preprint, abs/2004.05569. Hector J. Levesque, Ernest Davis, and L. Morgenstern. 2011. The winograd schema challenge. In Interna- tional Conference on Principles of Knowledge Rep- resentation and Reasoning. Liunian Harold Li, Jack Hessel, Youngjae Yu, Xiang Ren, Kai-Wei Chang, and Yejin Choi. 2023a. Sym- bolic chain-of-thought distillation: Small models can also "think" step-by-step. ArXiv. Shiyang Li, Jianshu Chen, Yelong Shen, Zhiyu Chen, Xinlu Zhang, Zekun Li, Hong Wang, Jingu Qian, Baolin Peng, Yi Mao, Wenhu Chen, and Xifeng Yan. 2022. Explanations from large language mod- els make small reasoners better. ArXiv preprint, abs/2210.06726. Zekun Li, Baolin Peng, Pengcheng He, Michel Galley, Jianfeng Gao, and Xi Yan. 2023b. Guiding large language models via directional stimulus prompting. ArXiv preprint, abs/2302.11520. Bill Yuchen Lin, Seyeon Lee, Rahul Khanna, and Xiang Ren. 2020. Birds have four legs?! NumerSense: Probing Numerical Commonsense Knowledge of Pre- Trained Language Models. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6862–6868, Online. Association for Computational Linguistics. Jiacheng Liu, Skyler Hallinan, Ximing Lu, Pengfei He, Sean Welleck, Hannaneh Hajishirzi, and Yejin Choi. 2022a. Rainier: Reinforced knowledge introspector for commonsense question answering. In Proceed- ings of the 2022 Conference on Empirical Methods in Natural Language Processing, pages 8938–8958, Abu Dhabi, United Arab Emirates. Association for Computational Linguistics. Jiacheng Liu, Alisa Liu, Ximing Lu, Sean Welleck, Pe- ter West, Ronan Le Bras, Yejin Choi, and Hannaneh Hajishirzi. 2022b. Generated knowledge prompting for commonsense reasoning. In Proceedings of the 60th Annual Meeting of the Association for Compu- tational Linguistics (Volume 1: Long Papers), pages 3154–3169, Dublin, Ireland. Association for Compu- tational Linguistics. Nicholas Lourie, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. 2021. UNICORN on RAINBOW: A universal commonsense reasoning model on a new multitask benchmark. In Thirty-Fifth AAAI Confer- ence on Artificial Intelligence, AAAI 2021, Thirty- Third Conference on Innovative Applications of Arti- ficial Intelligence, IAAI 2021, The Eleventh Sympo- sium on Educational Advances in Artificial Intelli- gence, EAAI 2021, Virtual Event, February 2-9, 2021, pages 13480–13488. AAAI Press. Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, Sean Welleck, Bodhisattwa Prasad Majumder, Shashank Gupta, Amir Yazdanbakhsh, and Peter Clark. 2023. Self-refine: Iterative refinement with self-feedback. ArXiv, abs/2303.17651. Lucie Charlotte Magister, Jonathan Mallinson, Jakub Adamek, Eric Malmi, and Aliaksei Severyn. 2022. Teaching small language models to reason. ArXiv preprint, abs/2212.08410. Hugo Mercier and Dan Sperber. 2017. The enigma of reason. Todor Mihaylov, Peter Clark, Tushar Khot, and Ashish Sabharwal. 2018. Can a suit of armor conduct elec- tricity? a new dataset for open book question an- swering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2381–2391, Brussels, Belgium. Association for Computational Linguistics. Nasrin Mostafazadeh, Nathanael Chambers, Xiaodong He, Devi Parikh, Dhruv Batra, Lucy Vanderwende, Pushmeet Kohli, and James Allen. 2016. A corpus and cloze evaluation for deeper understanding of commonsense stories. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 839–849, San Diego, California. Association for Computational Linguis- tics. OpenAI. 2022. Introducing chatgpt. Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Car- roll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke E. Miller, Maddie Simens, Amanda Askell, Peter Welin- der, Paul Francis Christiano, Jan Leike, and Ryan J. Lowe. 2022. Training language models to follow instructions with human feedback. ArXiv preprint, abs/2203.02155. Bhargavi Paranjape, Julian Michael, Marjan Ghazvininejad, Hannaneh Hajishirzi, and Luke Zettlemoyer. 2021. Prompting contrastive explana- tions for commonsense reasoning tasks. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 4179–4192, Online. Association for Computational Linguistics. Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text trans- former. J. Mach. Learn. Res., 21:140:1–140:67. Nazneen Fatema Rajani, Bryan McCann, Caiming Xiong, and Richard Socher. 2019. Explain your- self! leveraging language models for commonsense reasoning. In Proceedings of the 57th Annual Meet- ing of the Association for Computational Linguistics, pages 4932–4942, Florence, Italy. Association for Computational Linguistics. Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavat- ula, and Yejin Choi. 2020. Winogrande: An adver- sarial winograd schema challenge at scale. In The Thirty-Fourth AAAI Conference on Artificial Intelli- gence, AAAI 2020, The Thirty-Second Innovative Ap- plications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pages 8732– 8740. AAAI Press. Maarten Sap, Hannah Rashkin, Derek Chen, Ronan Le Bras, and Yejin Choi. 2019. Social IQa: Com- monsense reasoning about social interactions. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Lan- guage Processing (EMNLP-IJCNLP), pages 4463– 4473, Hong Kong, China. Association for Computa- tional Linguistics. John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. 2017. Proximal policy optimization algorithms. ArXiv preprint, abs/1707.06347. Kumar Shridhar, Alessandro Stolfo, and Mrinmaya Sachan. 2022. Distilling multi-step reasoning ca- pabilities of large language models into smaller mod- els via semantic decompositions. ArXiv preprint, abs/2212.00193. commonsense question answering with self-talk. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4615–4629, Online. Association for Computa- tional Linguistics. Shikhar Singh, Nuan Wen, Yu Hou, Pegah Alipoormo- labashi, Te-lin Wu, Xuezhe Ma, and Nanyun Peng. 2021. COM2SENSE: A commonsense reasoning benchmark with complementary sentences. In Find- ings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 883–898, Online. Associa- tion for Computational Linguistics. Nisan Stiennon, Long Ouyang, Jeff Wu, Daniel M. Ziegler, Ryan J. Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul Christiano. 2020. Learning to summarize from human feedback. ArXiv preprint, abs/2009.01325. Oyvind Tafjord and Peter Clark. 2021. General-purpose question-answering with macaw. ArXiv preprint, abs/2109.02593. Oyvind Tafjord, Peter Clark, Matt Gardner, Wen-tau Yih, and Ashish Sabharwal. 2019a. QUAREL: A dataset and models for answering questions about qualitative relationships. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, The Thirty-First Innovative Applications of Artificial In- telligence Conference, IAAI 2019, The Ninth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2019, Honolulu, Hawaii, USA, January 27 - February 1, 2019, pages 7063–7071. AAAI Press. Oyvind Tafjord, Matt Gardner, Kevin Lin, and Peter Clark. 2019b. QuaRTz: An open-domain dataset of qualitative relationship questions. In Proceedings of the 2019 Conference on Empirical Methods in Natu- ral Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 5941–5946, Hong Kong, China. Association for Computational Linguistics. Alon Talmor, Jonathan Herzig, Nicholas Lourie, and Jonathan Berant. 2019. CommonsenseQA: A ques- tion answering challenge targeting commonsense knowledge. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Tech- nologies, Volume 1 (Long and Short Papers), pages 4149–4158, Minneapolis, Minnesota. Association for Computational Linguistics. Cunxiang Wang, Shuailong Liang, Yili Jin, Yilong Wang, Xiaodan Zhu, and Yue Zhang. 2020. SemEval- 2020 task 4: Commonsense validation and explana- In Proceedings of the Fourteenth Workshop tion. on Semantic Evaluation, pages 307–321, Barcelona (online). International Committee for Computational Linguistics. Vered Shwartz, Peter West, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. 2020. Unsupervised Peifeng Wang, Aaron Chan, Filip Ilievski, Muhao Chen, and Xiang Ren. 2022a. Pinto: Faithful language reasoning using prompt-generated rationales. ArXiv preprint, abs/2211.01562. Peifeng Wang, Zhengyang Wang, Zheng Li, Yifan Gao, Bing Yin, and Xiang Ren. 2023. Scott: Self-consistent chain-of-thought distillation. ArXiv preprint, abs/2305.01879. Wenya Wang, Vivek Srikumar, Hannaneh Hajishirzi, and Noah A. Smith. 2022b. Elaboration-generating commonsense question answering at scale. ArXiv preprint, abs/2209.01232. Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Huai hsin Chi, F. Xia, Quoc Le, and Denny Zhou. 2022. Chain of thought prompting elicits reasoning in large language models. ArXiv preprint, abs/2201.11903. Johannes Welbl, Nelson F. Liu, and Matt Gardner. 2017. Crowdsourcing multiple choice science questions. In Proceedings of the 3rd Workshop on Noisy User- generated Text, pages 94–106, Copenhagen, Den- mark. Association for Computational Linguistics. Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pier- ric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, and Jamie Brew. 2019. Huggingface's transformers: State-of-the-art natural language processing. ArXiv preprint, abs/1910.03771. Zeqiu Wu, Yushi Hu, Weijia Shi, Nouha Dziri, Alane Suhr, Prithviraj Ammanabrolu, Noah A. Smith, Mari Ostendorf, and Hanna Hajishirzi. 2023. Fine-grained human feedback gives better rewards for language model training. ArXiv, abs/2306.01693. W. Yu, Dan Iter, Shuohang Wang, Yichong Xu, Mingx- uan Ju, Soumya Sanyal, Chenguang Zhu, Michael Zeng, and Meng Jiang. 2022. Generate rather than retrieve: Large language models are strong context generators. ArXiv preprint, abs/2209.10063. E. Zelikman, Yuhuai Wu, and Noah D. Goodman. 2022. Star: Bootstrapping reasoning with reasoning. ArXiv preprint, abs/2203.14465. Rowan Zellers, Yonatan Bisk, Roy Schwartz, and Yejin Choi. 2018. SWAG: A large-scale adversarial dataset for grounded commonsense inference. In Proceed- ings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 93–104, Brus- sels, Belgium. Association for Computational Lin- guistics. Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. 2019. HellaSwag: Can a ma- chine really finish your sentence? In Proceedings of the 57th Annual Meeting of the Association for Com- putational Linguistics, pages 4791–4800, Florence, Italy. Association for Computational Linguistics. A More on Method C More on Results Table 11 reports the detailed instructions for the human evaluation. D More on Related Work Table 12 compares CRYSTAL with existing meth- ods for knowledge-augmented commonsense rea- soning. I/O format of CRYSTAL. The input/output for- mat illustrated in Table 1 is adapted from Khashabi et al. (2020), based on which we made the follow- ing changes: • The input is appended with a marker that in- dicates which mode of operation is desired. In knowledge introspection this marker is "Knowledge:", and in knowledge-grounded reasoning it is "Answer:". • The output is the letter for the predicted an- swer choice, not the actual content of an an- swer choice. • The input and output text are not lowercased. B More on Experimental Setup Table 9 shows the datasets we use for training and evaluation, along with their citations. Table 10 reports the hyperparameters. Abbr. Name Citation Link TRAINING + EVALUATION (SEEN) OBQA ARC_e ARC_h AI2Sci_e AI2Sci_m CSQA QASC PIQA SIQA WG Mihaylov et al. (2018) OpenBookQA Clark et al. (2018) ARC (easy) Clark et al. (2018) ARC (hard) AI2 Science (elem) Clark et al. (2018) AI2 Science (middle) Clark et al. (2018) CommonsenseQA QASC Physical IQA Social IQA Winogrande Talmor et al. (2019) Khot et al. (2020) Bisk et al. (2020) Sap et al. (2019) Sakaguchi et al. (2020) https://github.com/allenai/unifiedqa https://github.com/allenai/unifiedqa https://github.com/allenai/unifiedqa https://github.com/allenai/unifiedqa https://github.com/allenai/unifiedqa https://github.com/allenai/unifiedqa https://github.com/allenai/unifiedqa https://github.com/allenai/unifiedqa https://github.com/allenai/unifiedqa https://github.com/allenai/unifiedqa EVALUATION (UNSEEN) C2S Com2Sense (paired) Singh et al. (2021) SciQ QuaRel QuaRTz CycIC SciQ QuaRel QuaRTz CycIC (mc) Welbl et al. (2017) Tafjord et al. (2019a) Tafjord et al. (2019b) – ComVE ComVE (task A) Wang et al. (2020) WSC COPA NumerSense NumerSense WSC COPA Levesque et al. (2011) Gordon et al. (2012) Lin et al. (2020) https://github.com/PlusLabNLP/Com2Sense/tree/ master/data https://allenai.org/data/sciq https://allenai.org/data/quarel https://allenai.org/data/quartz https://leaderboard.allenai.org/cycic/ submissions/get-started SemEval2020-Task4-Commonsense-Validation-and- Explanation https://huggingface.co/datasets/winograd_wsc https://huggingface.co/datasets/super_glue https://github.com/INK-USC/NumerSense/tree/main/ data PROST SWAG PROST SWAG HellaSwag HellaSwag CODAH CODAH SCT αNLI Story Cloze Test αNLI Zellers et al. (2019) Aroca-Ouellette et al. (2021) https://huggingface.co/datasets/corypaik/prost https://github.com/rowanz/swagaf/tree/master/ Zellers et al. (2018) data https://github.com/rowanz/hellaswag/tree/master/ data https://github.com/Websail-NU/CODAH/tree/master/ data https://cs.rochester.edu/nlp/rocstories/ https://leaderboard.allenai.org/anli/submissions/ get-started Mostafazadeh et al. (2016) Bhagavatula et al. (2020) Chen et al. (2019) Table 9: Dataset details. We show the link from which we retrieved each dataset. Symbol Value Description LQ LK LA M p B S SQK SQKA η α β γ λ ε τ E B S s SPPO SQKA η 256 32 2 20 0.5 SHARED HYPERPARAMETERS Max number of tokens in question (including choices). Max number of tokens in knowledge. Max number of tokens in answer. GETTING SILVER KNOWLEDGE FROM FEW-SHOT GPT-3 Number of knowledge statements to sample from GPT-3, per question. Parameter for nucleus sampling from GPT-3. STAGE I: IMITATION LEARNING 64 50,000 500 500 1 × 10−5 Batch size for training. Total number of training iterations. Number of iterations for knowledge introspection in each interleaving cycle. Number of iterations for knowledge-grounded reasoning in each interleaving cycle. Learning rate of Adam optimizer. STAGE II: REINFORCEMENT LEARNING 1.0 0.2 1.0 0.95 0.2 0.7 2M 64 31,250 4 500 500 1 × 10−5 1 × 10−6 Weight of value model loss in PPO. Weight of entropy bonus term in reward. Discount factor for rewards. Parameter for advantage estimation. Clipping range for the clipped surrogate objective. Temperature for knowledge sampling in PPO training. Total number of training episodes. Batch size for training. Total number of training iterations. Number of PPO update steps in each iteration for knowledge introspection. Number of iterations for knowledge introspection in each interleaving cycle. Number of iterations for knowledge-grounded reasoning in each interleaving cycle. Learning rate of Adam optimizer (for CRYSTAL-large). (for CRYSTAL-3b and -11b). M p 10 0.5 Number of knowledge statements to sample from CRYSTAL, per question. Parameter for nucleus sampling from CRYSTAL. INFERENCE Table 10: Hyperparameter settings. Label Description Example Support The knowledge can be part of a non-trivial reasoning chain that supports the pre- dicted answer. Question: Who watches a play in an auditorium? \n (A) building (B) crowd (C) city (D) group (E) high school Knowledge: Audiences watch plays in auditoriums. Prediction: (B) Trivial The knowledge is a trivial paraphrase of the question and the predicted answer. Repeat The knowledge is a mere repetition of known informa- tion given in the question. Related The knowledge is topi- cally related to the question and/or the choices, but can- not be part of a reasoning chain to support or refute any of the choices. Question: An alpha particle, which is emitted during alpha decay, consists of two protons and what else? \n (A) two neutrons (B) two nuclei (C) two positrons (D) two electrons Knowledge: Alpha particles are composed of two pro- tons and two neutrons. Prediction: (A) Question: The movement of crustal plates results from circulating currents in material beneath the crust of Earth. Which best describes the material which moves the crustal plates? \n (A) hot water (B) molten rock (C) liquid metal (D) solid iron Knowledge: The movement of crustal plates is caused by circulating currents in material beneath the crust of Earth. Prediction: (B) Question: How are the particles in a block of iron af- fected when the block is melted? \n (A) The particles gain mass. (B) The particles contain less energy. (C) The particles move more rapidly. (D) The particles increase in volume. Knowledge: Iron particles are affected by heat. Prediction: (C) Unrelated The knowledge is unrelated to the question. – Contradict The knowledge can be part of a reasoning chain that refutes the predicted an- swer, or supports a different choice. Question: I need what to calculate the length from my big toe to my little toe? \n (A) Calculator (B) Tape Measure (C) A Graph (D) A Microscope Knowledge: A calculator is used to calculate lengths. Prediction: (B) Table 11: Instruction for the human evaluation. Method Citation Unified model KG => KR KR => KG Bosselut et al. (2021) Rajani et al. (2019) Latcinnik and Berant (2020) Shwartz et al. (2020) DynaGen CAGE ST-GS Self-talk Contrastive Expl. Paranjape et al. (2021) GKP DREAM Rainier ALEAP PINTO GenRead DSP CoT Liu et al. (2022b) Gu et al. (2022) Liu et al. (2022a) Wang et al. (2022b) Wang et al. (2022a) Yu et al. (2022) Li et al. (2023b) Wei et al. (2022) CRYSTAL ours ✓ ✗ ✗ ✓/ ✗ ✗ ✓/ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ✓ ✓ ✗ ✓ ✓ ✗ ✓ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ✗ ✓ ✗ ✗ ✓ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ✓ ✗ ✓ Table 12: Comparison of existing knowledge-augmented reasoning methods. Unified model: if the method employs a unified model (rather than separate) for knowledge generation and knowledge-grounded reasoning. KG => KR: if the knowledge-grounded reasoning is trained to adapt to knowledge generation. KR => KG: if the knowledge generation is trained to adapt to knowledge-grounded reasoning.
http://arxiv.org/abs/2310.04919v1
"2023-10-07T21:16:09"
"2023-10-07T21:16:09"
The Conditional Prediction Function: A Novel Technique to Control False Discovery Rate for Complex Models
In modern scientific research, the objective is often to identify which variables are associated with an outcome among a large class of potential predictors. This goal can be achieved by selecting variables in a manner that controls the the false discovery rate (FDR), the proportion of irrelevant predictors among the selections. Knockoff filtering is a cutting-edge approach to variable selection that provides FDR control. Existing knockoff statistics frequently employ linear models to assess relationships between features and the response, but the linearity assumption is often violated in real world applications. This may result in poor power to detect truly prognostic variables. We introduce a knockoff statistic based on the conditional prediction function (CPF), which can pair with state-of-art machine learning predictive models, such as deep neural networks. The CPF statistics can capture the nonlinear relationships between predictors and outcomes while also accounting for correlation between features. We illustrate the capability of the CPF statistics to provide superior power over common knockoff statistics with continuous, categorical, and survival outcomes using repeated simulations. Knockoff filtering with the CPF statistics is demonstrated using (1) a residential building dataset to select predictors for the actual sales prices and (2) the TCGA dataset to select genes that are correlated with disease staging in lung cancer patients.
[ "Yushu Shi", "Michael Martens" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04919v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04919v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "stat.ME", "@scheme": "http://arxiv.org/schemas/atom" }
[ "stat.ME", "cs.LG", "stat.ML" ]
3 2 0 2 t c O 7 ] E M . t a t s [ 1 v 9 1 9 4 0 . 0 1 3 2 : v i X r a The Conditional Prediction Function: A Novel Technique to Control False Discovery Rate for Complex Models Yushu Shi, Michael Martens October 10, 2023 Abstract In modern scientific research, the objective is often to identify which variables are associated with an outcome among a large class of potential predictors. This goal can be achieved by selecting variables in a manner that controls the the false discovery rate (FDR), the proportion of irrelevant predictors among the selections. Knockoff filtering is a cutting-edge approach to variable selection that provides FDR control. Existing knockoff statistics frequently employ linear models to assess relationships between features and the response, but the linearity assumption is often violated in real world applications. This may result in poor power to detect truly prognostic variables. We introduce a knockoff statistic based on the conditional prediction function (CPF), which can pair with state-of-art machine learning predictive models, such as deep neural networks. The CPF statistics can capture the nonlinear relationships between predictors and outcomes while also accounting for correlation between features. We illustrate the capability of the CPF statistics to provide superior power over common knockoff statistics with continuous, categorical, and survival outcomes using repeated simulations. Knockoff filtering with the CPF statistics is demonstrated using (1) a residential building dataset to select predictors for the actual sales prices and (2) the TCGA dataset to select genes that are correlated with disease staging in lung cancer patients. 1 BACKGROUND The frequency and sizes of high dimensional datasets have increased greatly in recent years, accompanied both by new opportunities to find determinants of outcomes of interest and by formidable challenges to identify truly prognostic variables among this myriad of candidates. Usually, many of them are not expected to affect the outcome and so interest lies in choosing only the variables that are most likely to be associated with the response. An appropriate way to formalize this objective is to focus on controlling the FDR (Benjamini and Hochberg, 1995). Knockoff filtering (Barber and Cand`es, 2015) is a popular device for FDR controlled variable selection, particularly since this control is guaranteed for finite sample sizes rather than appealing to asymptotic properties for its validity, as other frequently used approaches do. The general problem involved is to determine, within a vector X of p features, which ones are associated with the outcome Y of interest. The commonly used Model-X knockoff approach (Cand`es et al., 2018) conducts this evaluation as follows: • First, construct knockoff copies (cid:101)X satisfying the following two conditions: 1. Pairwise exchangeability: for any subset S ⊂ {1, . . . , p}, (X, (cid:101)X)swap(S) d= (X, (cid:101)X), i.e. swapping any subset of variables with their knockoffs leaves the joint distribution invariant; 2. Conditional independence: (cid:101)X ⊥⊥ Y |X. • Second, a model is fitted using all original and knockoff features, and the influences of the original and knockoff features are evaluated using importance statistics, such as the lasso (Tibshirani, 1996) penalty parameter at which a feature enters the model. The knockoff statistic built on it is the lasso signed max (LSM) statistic. Because the knockoff features are independent of the outcome, their importance statistics represent noise variables that can be contrasted against the original features' to assess which original features correlate with the response. From the importance statistics of the original feature and its knockoff, Zj and (cid:101)Zj, j = 1, . . . , p, we can compute knockoff statistics Wj = fj(Zj, (cid:101)Zj), where fj is an anti-symmetric function. A large positive Wj provides evidence that the distribution of Y depends on Xj, whereas under the null Wj is equally likely to take on positive and negative values (the "coin-flip" property). • Third, features are selected based on the knockoff statistics in a manner that controls the FDR at the specified level, q. Specifically, if we find a threshold τ > 0 by setting (cid:26) τ = min t > 0 : #{j : Wj ≤ −t} #{j : Wj ≥ t} (cid:27) ≤ q . Then the procedure selecting the set ˆS = {j : Wj ≥ τ } controls the modified FDR as mF DR = E (cid:34) |{j ∈ ˆS ∩ H0}| (| ˆS| + 1/q) (cid:35) ≤ q. A more conservative procedure, knockoffs+, with threshold τ + = min (cid:26) t > 0 : 1 + #{j : Wj ≤ −t} {#j : Wj ≥ t} (cid:27) ≤ q controls the ordinary FDR at level q by selecting ˆS+ = {j : Wj ≥ τ +}. Previous work has explored various ways to improve knockoff feature generation with a guarantee of pair- wise exchangeability. Notably, Bates et al. (2021) introduced a Metropolized knockoff sampler, which handles situations where the covariates are continuous, heavy-tailed, and follow an Ising model. Furthermore, other methods took advantage of generative machine learning models, including Deep Knockoffs (Romano et al., 2019), KnockoffGAN (Jordon et al., 2019), and variational autoencoder related methods (Liu and Zheng, 2019; Duarte and Feng, 2020). Compared with the abundance of choices for generating knockoff counter- parts, few studies have attempted to improve knockoff statistics. Common choices of knockoff statistics are based on a linear regression based model, such as lasso (Barber and Cand`es, 2015; Cand`es et al., 2018); a common choice is the lasso coefficient difference (LCD) statistic, which is defined as W LCD j = |βj| − | ̃βj|, where βj and ̃βj are the regression coefficients for Xj and its knockoff ̃Xj. The lasso-based statistics can yield good power if the true relationship is linear (Weinstein et al., 2017). But, if the linearity assumption is violated, these approaches may have poor power to detect prognostic variables. This paper investigates methods for constructing knockoff statistics that can yield higher power to resolve features with linear or nonlinear relationships with the outcomes while maintaining the FDR control. We propose the conditional prediction function (CPF) as a basis for building the knockoff importance statistic. The proposed CPF knockoff statistic is able to capture nonlinear relationships, and will empower researchers to explore more flexible prediction models for knockoff filtering, such as deep neural networks (DNNs). In Section 2, we explain the rationale and summarize the algorithm for calculating CPF knockoff statistics. The CPF statistic's ability to capture non-linear relationship for different types of outcomes is demonstrated through repeated simulations in Section 3. Section 4 applies the proposed method to a residential building dataset to select predictors for the actual sales prices and to the TCGA LUAD cancer dataset to identify genes that are associated with or more advanced stage of lung cancer. Section 5 concludes the paper with a short discussion. 2 THE CPF STATISTIC In this section, we introduce the conditional prediction function (CPF), which can measure a feature's importance by changing its value by a small magnitude while conditioning on all other covariates and computing the prediction difference before and after the change. The concept of the CPF knockoff statistic originates from multivariable linear models, where the regression coefficient signifies how much the mean of the dependent variable changes given a one-unit shift in the independent variable while holding other variables in the model constant. The CPF can be paired with many complicated predictive models, however. In the following text, we assume that we have already generated high-quality knockoff features ̃X from p original predictors X. Calculation of the CPF knockoff statistics proceeds per the following: 1. Combine both the original and the knockoff predictors X∗ [N ×2p] = [X, ̃X] in one matrix. Center and scale continuous predictors. 2. Train the prediction model M for the outcome Y with both the original and knockoff features. 3. Set Ui = 0, i = 1, . . . , 2p. Choose the number of percentiles at which we want to evaluate the CPF, J , and the δ value for numerical calculation. Then, for each predictor X ∗ i , i ← 1 to 2p do Sample a subset with n observations. for k ← 1 to n do if X ∗ i is a continuous covariate then for j ← 1 to J do Denote the value of X ∗ values of all other predictors X∗ and X ∗ ij + δ/2. (⋆) Ui = Ui + ∥M(X ∗ ij + δ/2|X∗ i at the 100j/(J + 1) percentile as X ∗ ij. Conditioning on the k,−i, evaluate the predictive difference for X ∗ ij − δ/2 k,−i) − M(X ∗ ij − δ/2|X∗ k,−i))∥2 2/(δ2J) end end else (⋆) Ui = Ui + ||M(X ∗ ij = 1|X∗ k,−i) − M(X ∗ ij = 0|X∗ k,−i)||2 2 end end end for each pair of the original predictor Xm and the corresponding knockoff ̃Xm, m ← 1 to p do CP Fm = Um − Um+p end After computing knockoff statistics for each pair of the original and knockoff covariates, we implement the last step of knockoff filtering. Given the pre-specified FDR level q, we find the threshold value T such that (cid:26) T = min t > 0 : #{r : CP Fr ≤ −t} #{r : CP Fr ≥ t} (cid:27) ≤ q , and return the selected feature set ˆS = {r : CP Fr ≥ T }. To illustrate the benefit of CPF, consider the univariate case where the predictor and the outcome have a relationship y = x2. As shown in Figure 1, the predictor has a negative slope when less than 0, and a positive slope when greater than 0. If one uses a linear model or a linear model based method (such as lasso, elastic net), this variable will likely be declared null, as the positive effect when x > 0 and negative effect when x < 0 cancel out. But if one employs CPF as knockoff importance statistics, this nonlinear relationship will be well captured, since CPF measures the cumulative squared effect over the space of x. When features are independent and the relationship to the outcome is genuinely linear, the CPF reduces to n times the squared regression coefficient of a linear model. However, when the relationship is more complicated, by evaluating the conditional prediction differences at J percentiles and averaging over n possible combinations of other predictors, the CPF can overcome the rigidity of linear models. When the outcome of interest is continuous, the predicted outcome M(*) is a real number. When the outcome of interest is categorical, M(*) is a vector of probabilities belonging to each category, and the increment in each iteration is the squared Euclidean distance of two probability vectors. When the outcome Figure 1: CPF can quantify nonlinear covariate effect. Here the red curve is the true effect of the covariate. If we fit a linear model, the slope of the line will be 0, as indicated by the blue line. The black lines indicate the prediction difference that can be captured by CPF statistics. of interest is a survival time in the single failure cause setting, the CPF can be calculated over all the distinct time points in the dataset and M(*|t) is the predicted survival function indexed by time t. When multiple failure types, i.e. competing risks, are present, M(*|t) is the predicted cumulative incidence function (CIF) for the event type of interest. When the number of distinct event times Nt is large, we can select a subset of nt time points (say, quintiles of the observed survival times), {tl; l = 1, . . . , nt}. For survival outcomes, the ⋆ step in the algorithm becomes for l ← 1 to nt do Ui = Ui + ||M(X ∗ ij + δ/2|tl, X∗ k,−i) − M(X ∗ ij − δ/2|tl, X∗ k,−i)||2 2/δ2J end if X∗i is continuous, and for l ← 1 to nt do Ui = Ui + ||M(X ∗ ij = 1|tl, X∗ k,−i) − M(X ∗ ij = 0|tl, X∗ k,−i)||2 2 end otherwise. The CPF resembles the squared gradient of a multivariate function. To approximate the gradient well, δ needs to be small relative to the range of X. Large J, n and nt can yield a more accurate estimation of the predictive ability of the features; yet, the choice of these parameters may be constrained by the computing resources available. 3 SIMULATION STUDY To illustrate the ability of the CPF statistics to detect both linear and nonlinear effects of predictors, we evaluated their performance in conjunction with DNNs for various outcome types, including continuous, categorical, survival, and competing risks data. In all simulated datasets, the number of original features was set at 250, while the sample size was 20000. Among the 250 predictors, ten were genuinely predictive. During the training of DNNs, early stopping callback was implemented to mitigate overfitting, with the patience parameter set at 50 for continuous, categorical, and survival outcomes and at 200 for competing −2−10120123456PredictorOutcomeReal relationshipCPFLinear model Linear Relationship Nonlinear Relationship Log-linear Hazard Relationship Non Log-linear Hazard Relationship s u o u n i t n o C y r a n i B l a v i v r u S s k s i r g n i t e p m o C Figure 2: Comparison of the FDR and power for CPF and LCD statistics. LCD and CPF denote standard knockoff filtering using the LCD and CPF statistics; LCD+ and CPF+ denote knockoff+ filtering for these techniques. The left columns show the results when the relationship between covariates and the outcome is linear/log-linear, while the right two columns show the results when the relationship is not. risks data. For continuous and categorical outcomes, a batch size of 20 was employed, and the validation proportion in each epoch was designated at 10%. For survival and competing risks outcomes, a batch size of 50 was used, and the validation proportion in each epoch was set at 20%. The parameters J = 5, n = 100, and δ = 0.1 were specified for the calculation of the CPF statistics from fitted DNNs. 0.00.20.40.60.81.0FDR LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0Power LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)LCDLCD+CPFCPF+0.00.20.40.60.81.0FDR LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0Power LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0FDR LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0Power LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0FDR LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0Power LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0FDR LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0Power LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0FDR LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0Power LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0FDR LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0Power LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0FDR LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2)0.00.20.40.60.81.0Power LCDLCD+CPFCPF+LCD AR(0.2)LCD+ AR(0.2)CPF AR(0.2)CPF+ AR(0.2) The LCD statistics were selected as the benchmark for comparison, as it has demonstrated higher power than the LSM statistics in most instances (Cand`es et al., 2018). For both continuous and categorical outcomes, the LCD statistics were derived from lasso results; for survival outcomes, they were based on Cox lasso results, and for competing risks outcomes, they were obtained from the Fine-Gray regression model (Fine and Gray, 1999). The target false discovery rate was set to be 0.2. Original features were generated using either a standard normal distribution or an autoregressive model with a mean of 0 and a covariance matrix with 0.2|i−j| entries, where i and j denote column and row indicators, respectively. The covariance matrix of the autoregressive model contains 1 along the diagonal, with entry values diminishing to zero as they move further from this diagonal. The second-order approximate Gaussian knockoffs, provided by the R package "knockoff" (Patterson and Sesia, 2020), were employed as the knockoff generator. Each simulation configuration was repeated 200 times, and the results were summarized using box plots. Subsequent subsections will present the simulation setup for each type of outcome. 3.1 Continuous Outcome i + 100 + εi, i = 1, 2, . . . , n, where X∗ For continuous outcomes, the true distribution of the response variable was assumed to follow a linear model with predictors that are either linear or quadratic functions of X. In the linear setting, the predictors and the outcome are related as follows: yi = βT X∗ i represents the vector that includes only true predictors, and β is a vector with all entries equal to 3. In the nonlinear setting, the relationship between each predictor and the outcome is quadratic, given by: yi = (cid:80)10 ij , i = 1, 2, . . . , n. In the linear setting, a three-layer DNN was employed, where the internal layer consisted of 8 nodes. For the nonlinear setting, a five-layer DNN was used, with the numbers of nodes in internal layers specified as (64, 32, 16). The activation function for both models was chosen to be the Rectified Linear Unit (ReLU), and for each layer, an L1 regularization term was imposed with a parameter value of 0.001. The optimizer was configured to be Adam, with a learning rate set at 0.01, and the loss function was defined as the mean squared error in the validation data. j=1 X∗2 3.2 Categorical Outcome The data simulation for categorical outcome is similar to the simulation for continuous outcomes. In the linear relationship setting, the predictors and the expected value of the outcome follow a linear relationship on the logit-transformed scale according to yi ∼ binom(logistic(βT X∗ is the vector including only true predictors and β is a vector of 1′s. In the nonlinear setting, we first computed the sum of squares of the true predictors Zi = (cid:80)10 ij , then standardized Zi and generated the outcome yi ∼ binom(Zi). i )), i = 1, 2, . . . , n. X∗ i j=1 X∗2 To decrease the training time, we started with the model trained for continuous outcomes and sim- ply changed the last layer to a sigmoid activation function. The loss function was chosen to be binary- crossentropy in the validation data. The learning optimizer was chosen to be Adam, and the learning rate was 0.01. 3.3 Survival Outcome We also applied our method on data with survival outcomes. We used DeepSurv model (Katzman et al., 2018), which adopts the framework of the Cox proportional hazards model, for computing the predicted survival based CPF. In the DeepSurv model, the hazard ratio of an individual is parameterized by the weights of the network, and the optimization goal is to maximize the log partial likelihood with some regularization. Again, we use X ∗ j = 1, . . . , 10, to denote the jth true predictor and specify that the j , hazard for each individual follows hi(t|X) = exp((cid:80)10 i = 1, . . . , n. This satisfies the underlying assumption for the Cox model as the covariate imposes a time-invariant multiplicative effect on the hazard. We refer to the scenario in which the covariate affects the hazard through a log-linear relationship as the log-linear setting. The censoring times were generated independently from an exp(0.05) distribution and this resulted in a 5% censoring rate. In simulation scenarios where the covariate effects are not log-linear, the hazard for the ith individual was hi(t|X) = exp((cid:80)10 ij ), and the censoring times were generated independently from an exp(0.1) distribution. j=1 0.5X ∗2 j=1 0.5X ∗ ij), For the scenarios under the log-linear setting, the numbers of nodes were set to be (64, 32, 16, 8, 1), for the non log-linear scenarios, the numbers of nodes were (128, 64, 32, 16, 1). Batch normalization and a dropout rate 0.5 were employed. We used Adam optimizer with learning rate 0.0001 and the weight decay was set to be 0.01. 3.4 Competing Risks Outcome To further assess the capabilities of the CPF statistics, we explored the application with competing risks data. In competing risks data, there are several types of potential events and the occurrence of one type of outcome prevents us from observing other types of events. Suppose that type 1 events are the main interest. Fine and Gray (1999) mimicked the Cox proportional hazards model by transforming the CIF F1(t) for type 1 into a subdistribution hazard η1(t), η1(t) = − ∂ ∂t log(1 − F1(t)), (1) and assumed the covariates have multiplicative, time-constant effects on the subdistribution hazard through the form η1(t|x) = η01(t) exp (f (X)) . (2) Recently, Lee et al. (2018) leveraged DNN for modeling competing risks data and proposed the DeepHit model, which was employed in computing the predicted CIF used in CPF statistics in our simulation. Our simulations assumed that 2 event types exist and that type 1 is the primary interest. In both log-linear and non log-linear hazards scenarios, we assumed the baseline probability of experiencing event type 1 was q = 0.5. The influence of covariates on outcomes was encapsulated by the variable Z = f (X). Specifically, in the log-linear scenario, Zi = (cid:80)10 ij − 10. For both scenarios, Zi is connected to the subdistribution hazard function through equation 2. By virtue of (1)-(2), the relationship between the baseline and individual CIFs is i = 1, . . . , n. For the non log-linear scenario, Zi = (cid:80)10 j=1 X ∗ ij, j=1 X ∗2 F1(t|Xi) = 1 − (1 − F01(t))exp(Zi). (3) Generating event times involved a two-step process: first, we generated probabilities of experiencing a type 1 event for each subject by randomly sampling from a binomial distribution with a probability of F1(∞|Xi) = 1 − (1 − q)exp(Zi); subsequently, for those subjects experiencing type 1 events, we modeled the baseline CIF for event type 1 as F01(t) = q(1 − exp(−t)) and generated their event time from the cumulative distribution function F1(t|Xi)/F1(∞|Xi), where the numerator follows (3). For type 2 events, we generated event times from an exponential distribution with a rate parameter of 1. Censoring times were independently generated from an exp(1) distribution. Within the architecture of the DeepHit, for both the log-linear and non lig-linear scenarios, the number of internal nodes was configured as (128, 64, 32, 16). To enhance training performance, we applied batch normalization and utilized a dropout rate of 0.5. In fitting the DeepHit model, the number of cutpoints for evaluating the likelihood was set to be 20. To mitigate overfitting, an L2 penalty with a parameter of 0.1 was incorporated. 3.5 Summary of Simulation Results As shown in Figure 2, the simulation results are consistent across different outcome types. When the linear assumption or the log-linear assumption is satisfied, the performance of the CPF is similar to the performance of the linear model-based LCD. However, when this assumption does not hold, for example, the relationship between the predictors and outcome is quadratic, the LCD fails to capture the true relationship and exhibits significant power loss, while the CPF controls the FDR while offering high power to detect signals. Table 1: Genes identified by the CPF method. Genes that corroborate with the selection from LCD statistics results are shown in bold. RELEVANT LITERATURE Puzone et al. (2013); Liu et al. (2017) GENE GAPDH RPLP0P6 Xie et al. (2023); Wang et al. (2018) RNASE1 SFTPC IGKV4-1 IGHJ3 Travaglini et al. (2020); Li et al. (2019b); Mironova and Vlassov (2019) Li et al. (2007); Wang et al. (2009); Li et al. (2019a) Wang et al. (2020); Qin et al. (2020); Xia et al. (2022); Pedersen et al. (2022) Isaeva et al. (2019); Feng et al. (2009); Jiang et al. (2022) 4 REAL DATA APPLICATION 4.1 Identifying predictors of real estate sale price We analyzed a dataset (Rafiei and Adeli, 2018) consisting of 108 covariates, aiming to identify predictors of the sale prices of single-family residential apartments in Tehran, Iran. The dataset encompasses various factors, including temporal economic covariates as well as diverse project-related physical and financial attributes. Furthermore, the dataset includes economic indicators and indices across five periods prior to the start of construction, such as stock market index and city population. We divided the 372 observations into training (70%) and testing (30%) sets. We first fit the lasso model with cross-validation, yielding a mean squared error of 27767.39 on the testing dataset. Then, we employed the LCD knockoff statistics with a target false discovery rate of 0.2. The knockoff+ method led to no feature selection, while the standard knockoff procedure resulted in the selection of a single feature: the unit price at project initiation. To compute CPF knockoff statistics, we started by constructing a DNN with four layers. The internal layers contained 256 and 128 nodes respectively, utilizing the leakyReLU activation function with an alpha parameter of 0.3. The final layer adopted the ReLU activation function. Across all layers, batch normalization was implemented. We opted for the Adam optimizer with a learning rate of 0.01 and chose batch size to be 50. To prevent overfitting, early stopping with a patience parameter of 200 was employed. The DNN can achieve a mean squared error of 20787.06 on the test dataset, which outperforms lasso in model fitting. When adopting the more conservative knockoff+ approach, similar to the result from LCD statistics, no features were selected. Meanwhile, with the standard knockoff method, three features were chosen: equivalent preliminary estimated construction cost based on prices at the project's outset, unit price at project initiation, and actual construction expenses. 4.2 Determinants of lung adenocarcinoma stage from TCGA dataset We applied CPF statistics on lung adenocarcinoma gene expression data from The Cancer Genome Atlas (TCGA). Our primary focus was on determining genes that express differently for stage I and stages II/III/IV cancer. In this dataset, there were 330 patients with stage I cancer and 271 patients with stages II/III/IV cancer. From the original 31,294 features, considering the constrained sample size, we selected 100 features with the highest variance. The target FDR here is 0.2. Before fitting the model, the predictors were standardized. We allocated 70% of the data for training and utilized the remainder for testing the model. Given the limited sample size, we employed a three layer neural network, with an internal layer with 100 nodes. The activation functions were chosen to be ReLU and sigmoid. Training DNN involved using dropout (dropout rate = 0.2) and L1 regularization with penalty parameter of 0.1 for kernel and 0.01 for bias in the last layer. The batch size was chosen to be 100. The Adam optimizer with a learning rate of 0.001 was used, and early stopping call with patience parameter 200 was employed to prevent overfitting. Using cross-validation, the lasso model yielded a c-index of 0.60088 for the test data, while the DNN achieved a c-index of 0.6774, demonstrating a superior model fitting than the lasso model. The knockoff+ method did not select any features for either LCD or CPF knockoff statistics. However, with the regular knockoff method, 6 features were chosen using the CPF approach, and LCD selection corroborated two of these (LCD with lasso chose 3 features in total). Table 1 lists all the genes selected by CPF and recent biomedical publications that have identified the correlations between the same gene and lung cancer. In both examples, the CPF statistics selected more features than LCD statistics. This behavior can be explained by its capacity in capturing nonlinear relationship between covariates and outcomes. The real data application is consistent with simulation study outcomes, demonstrating that CPF statistics have better power than a widely used existing method. 5 DISCUSSION Applying the CPF statistics successfully relies on pairing them with a well-selected and trained machine learning model. This paper is not aimed at providing a one-size-fits-all solution for variable selection and the flexibility of the CPF does not eliminate the need for tuning complicated machine learning models, in particular DNNs. We encourage users to first check the model fitting metrics of the trained model, including mean squared error, prediction accuracy, and concordance index and comparing them to the performance of traditional methods, such as linear model, lasso, and the Cox model. After verifying that the machine learning model attains better model fitting, then CPF can be used with it to identify key features that are predictive of the outcomes. Complex machine learning models such as DNNs have long been perceived as "black boxes," such that the relationships between features and response variables are hard to discern from the fitted model and which variables are truly associated with the outcome is unclear. The CPF knockoff statistic offers improved model interpretability by capturing the nonlinear relationships between the covariates and outcomes and enabling these correlations to be identified through knockoff filtering. When applied in biomedical studies, CPF statistics offer an improved resolution of prognostic features for health outcomes. This improvement in feature identification will promote the understanding of the determinants of patient health and, subsequently, can lead to advances in the prevention, treatment, and management of disease, thereby improving public health. Also, The proposed technique will be helpful more broadly in other scientific contexts such as information technology (IT), engineering, sociology, economics, psychology, and environmental science, where a large set of candidate variables are being evaluated for association with an outcome of interest. ACKNOWLEDGMENT This project is partly supported by NSF DMS 2310955. We would like to thank Dr. Hao Feng of Case Western Reserve University for his help in TCGA data application. References Barber, R. F. and Cand`es, E. J. (2015). Controlling the false discovery rate via knockoffs. The Annals of Statistics, 43(5):2055–2085. Bates, S., Cand`es, E., Janson, L., and Wang, W. (2021). Metropolized knockoff sampling. Journal of the American Statistical Association, 116(535):1413–1427. Benjamini, Y. and Hochberg, Y. (1995). Controlling the false discovery rate: A practical and powerful approach to multiple testing. Journal of the Royal Statistical Society. Series B, 57(1):289–300. Cand`es, E. J., Fan, Y., Janson, L., and Lv, J. (2018). Panning for gold: 'Model-X' knockoffs for high dimensional controlled variable selection. Journal of the Royal Statistical Society: Series B, 80(3):551– 577. Duarte, M. F. and Feng, S. (2020). Knockoff-inspired feature selection via generative models. preprint. Feng, Y., Xiao, X., Zhu, Z., Streaker, E., Ho, M., Pastan, I., and Dimitrov, D. S. (2009). A novel hu- man monoclonal antibody that binds with high affinity to mesothelin-expressing cells and kills them by antibody-dependent cell-mediated cytotoxicity. Molecular Cancer Therapeutics, 8(5):1113–1118. Fine, J. P. and Gray, R. J. (1999). A proportional hazards model for the subdistribution of a competing risk. Journal of the American Statistical Association, 94(446):496–509. Isaeva, O. I., Sharonov, G. V., Serebrovskaya, E. O., Turchaninova, M. A., Zaretsky, A. R., Shugay, M., and Chudakov, D. M. (2019). Intratumoral immunoglobulin isotypes predict survival in lung adenocarcinoma subtypes. Journal for ImmunoTherapy of Cancer, 7(1). Jiang, W., Zhou, S., Li, J., Zhu, G., Gao, M., Zhao, K., Zhang, L., Xie, X., Zhao, N., Tian, C., Zhang, Z., Zhao, Y., Guo, Y., Cui, Y., and Liu, P. (2022). B cell receptor (BCR) diversity and differential cdr3s usage as potential immune indictors of diffuse large B cell lymphoma (DLBCL). preprint. Jordon, J., Yoon, J., and van der Schaar, M. (2019). KnockoffGAN: Generating knockoffs for feature selection using generative adversarial networks. In International Conference on Learning Representations. Katzman, J. L., Shaham, U., Cloninger, A., Bates, J., Jiang, T., and Kluger, Y. (2018). DeepSurv: per- sonalized treatment recommender system using a Cox proportional hazards deep neural network. BMC Medical Research Methodology, 18(1):24. Lee, C., Zame, W., Yoon, J., and van der Schaar, M. (2018). DeepHit: A deep learning approach to survival analysis with competing risks. Proceedings of the AAAI Conference on Artificial Intelligence, 32(1). Li, B., Meng, Y.-Q., Li, Z., Yin, C., Lin, J.-P., Zhu, D.-J., and Zhang, S.-B. (2019a). MiR-629-3p-induced downregulation of SFTPC promotes cell proliferation and predicts poor survival in lung adenocarcinoma. Artificial Cells, Nanomedicine, and Biotechnology, 47(1):3286–3296. PMID: 31379200. Li, R., Todd, N. W., Qiu, Q., Fan, T., Zhao, R. Y., Rodgers, W. H., Fang, H.-B., Katz, R. L., Stass, S. A., and Jiang, F. (2007). Genetic deletions in sputum as diagnostic markers for early detection of stage I non–small cell lung cancer. Clinical Cancer Research, 13(2):482–487. Li, Y., Yang, Y., Gan, T., Zhou, J., Hu, F., Hao, N., Yuan, B., Chen, Y., and Zhang, M. (2019b). Ex- tracellular rnas from lung cancer cells activate epithelial cells and induce neutrophil extracellular traps. International Journal of Oncology, 55(1):69–80. Liu, K., Tang, Z., Huang, A., Chen, P., Liu, P., Yang, J., Lu, W., Liao, J., Sun, Y., Wen, S., Hu, Y., and Huang, P. (2017). Glyceraldehyde-3-phosphate dehydrogenase promotes cancer growth and metastasis through upregulation of snail expression. International Journal of Oncology, 50(1):252–262. Liu, Y. and Zheng, C. (2019). Deep latent variable models for generating knockoffs. Stat, 8(1):e260. e260 sta4.260. Mironova, N. and Vlassov, V. (2019). Surveillance of tumour development: The relationship between tumour- associated RNAs and ribonucleases. Frontiers in Pharmacology, 10. Patterson, E. and Sesia, M. (2020). knockoff: The Knockoff Filter for Controlled Variable Selection. R package version 0.3.3. Pedersen, S., Jensen, K. P., Honor ́e, B., Kristensen, S. R., Pedersen, C. H., Szejniuk, W. M., Maltesen, R. G., and Falkmer, U. (2022). Circulating microvesicles and exosomes in small cell lung cancer by quantitative proteomics. Clinical Proteomics, 19(1):2. Puzone, R., Savarino, G., Salvi, S., Dal Bello, M. G., Barletta, G., Genova, C., Rijavec, E., Sini, C., Esposito, A. I., Ratto, G. B., Truini, M., Grossi, F., and Pfeffer, U. (2013). Glyceraldehyde-3-phosphate dehydrogenase gene over expression correlates with poor prognosis in non small cell lung cancer patients. Molecular Cancer, 12(1):97. Qin, F.-l., Xu, Z.-y., Yuan, L.-q., Chen, W.-j., Wei, J.-b., Sun, Y., and Li, S.-k. (2020). Novel immune subtypes of lung adenocarcinoma identified through bioinformatic analysis. FEBS Open Bio, 10(9):1921– 1933. Rafiei, M. H. and Adeli, H. (2018). Novel machine-learning model for estimating construction costs considering economic variables and indexes. Journal of Construction Engineering and Management, 144(12):04018106. Romano, Y., Sesia, M., and Cand`es, E. (2019). Deep knockoffs. Journal of the American Statistical Associ- ation, pages 1–12. Tibshirani, R. (1996). Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society: Series B, 58(1):267–288. Travaglini, K. J., Nabhan, A. N., Penland, L., Sinha, R., Gillich, A., Sit, R. V., Chang, S., Conley, S. D., Mori, Y., Seita, J., Berry, G. J., Shrager, J. B., Metzger, R. J., Kuo, C. S., Neff, N., Weissman, I. L., Quake, S. R., and Krasnow, M. A. (2020). A molecular cell atlas of the human lung from single-cell RNA sequencing. Nature, 587(7835):619–625. Wang, H., Wang, M.-S., Wang, Y., Huang, Y.-Q., Shi, J.-P., Ding, Z.-L., and Wang, W.-J. (2020). Prognostic value of immune related genes in lung adenocarcinoma. Oncology Letters, 20(5):259. Wang, Y., Kuan, P. J., Xing, C., Cronkhite, J. T., Torres, F., Rosenblatt, R. L., DiMaio, J. M., Kinch, L. N., Grishin, N. V., and Garcia, C. K. (2009). Genetic defects in surfactant protein a2 are associated with pulmonary fibrosis and lung cancer. The American Journal of Human Genetics, 84(1):52–59. Wang, Y., Qian, W., and Yuan, B. (2018). A graphical model of smoking-induced global instability in lung cancer. IEEE/ACM Transactions on Computational Biology and Bioinformatics, 15(1):1–14. Weinstein, A., Barber, R., and Cand`es, E. J. (2017). A power and prediction analysis for knockoffs with lasso statistics. preprint arXiv:1712.06465. Xia, M., Wu, L., Sun, X., Han, X., Yan, H., Huang, J., Zhang, Y., Hu, Z., Zu, Y., Yin, C. C., and Qiu, X. (2022). Next-generation sequencing revealed a distinct immunoglobulin repertoire with specific mutation hotspots in acute myeloid leukemia. Biology, 11(2). Xie, J., Lin, Y., Li, Y., Fang, A., Li, X., Wang, S., and Li, W. (2023). lncrna trhde-as1 correlated with genomic landscape and clinical outcome in glioma. Genes, 14(5).
http://arxiv.org/abs/2310.04916v1
"2023-10-07T21:07:45"
"2023-10-07T21:07:45"
Tight Certified Robustness via Min-Max Representations of ReLU Neural Networks
The reliable deployment of neural networks in control systems requires rigorous robustness guarantees. In this paper, we obtain tight robustness certificates over convex attack sets for min-max representations of ReLU neural networks by developing a convex reformulation of the nonconvex certification problem. This is done by "lifting" the problem to an infinite-dimensional optimization over probability measures, leveraging recent results in distributionally robust optimization to solve for an optimal discrete distribution, and proving that solutions of the original nonconvex problem are generated by the discrete distribution under mild boundedness, nonredundancy, and Slater conditions. As a consequence, optimal (worst-case) attacks against the model may be solved for exactly. This contrasts prior state-of-the-art that either requires expensive branch-and-bound schemes or loose relaxation techniques. Experiments on robust control and MNIST image classification examples highlight the benefits of our approach.
[ "Brendon G. Anderson", "Samuel Pfrommer", "Somayeh Sojoudi" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04916v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04916v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "math.OC", "@scheme": "http://arxiv.org/schemas/atom" }
[ "math.OC", "cs.LG" ]
Tight Certified Robustness via Min-Max Representations of ReLU Neural Networks Brendon G. Anderson Samuel Pfrommer Somayeh Sojoudi 3 2 0 2 t c O 7 ] C O . h t a m [ 1 v 6 1 9 4 0 . 0 1 3 2 : v i X r a Abstract- The reliable deployment of neural networks in control systems requires rigorous robustness guarantees. In this paper, we obtain tight robustness certificates over convex attack sets for min-max representations of ReLU neural net- works by developing a convex reformulation of the nonconvex certification problem. This is done by "lifting" the problem to an infinite-dimensional optimization over probability measures, leveraging recent results in distributionally robust optimization to solve for an optimal discrete distribution, and proving that solutions of the original nonconvex problem are generated by the discrete distribution under mild boundedness, nonredun- dancy, and Slater conditions. As a consequence, optimal (worst- case) attacks against the model may be solved for exactly. This contrasts prior state-of-the-art that either requires expensive branch-and-bound schemes or loose relaxation techniques. Experiments on robust control and MNIST image classification examples highlight the benefits of our approach. I. INTRODUCTION Neural networks are rapidly being deployed in control systems as a means to efficiently model nonlinear systems [1], controllers [2], and reinforcement learning policies [3]. However, the performance of neural networks can be ex- tremely sensitive to small fluctuations in their input data [4]. For example, [5], [6] show that image classification models can be fooled into misclassifying vehicle traffic signs when subject to digital or physical adversarial attacks, i.e., human-imperceptible data perturbations designed to cause failure. This unreliable behavior is directly at odds with the robustness guarantees required in safety-critical control settings such as autonomous driving [7]. In light of these sensitivities, much effort has been placed on developing methods to rigorously certify the robustness of neural networks, with a large emphasis on models using the popular ReLU activation function. However, certifying a neural network's robustness generally amounts to solving an intractable nonconvex optimization problem [8]. Three major lines of work have focused on overcoming this intractability: convex relaxations, Lipschitz bounding, and branch-and- bound methods (all discussed further in Section I-A). In this paper, we utilize an alternative representation of ReLU neural networks as a means to efficiently compute tight robustness certificates using convex optimization (and hence in polynomial time). As a consequence, we are able to exactly compute optimal (worst-case) attacks, which is generally not possible using the popular local search-based attack methods such as projected gradient descent [9] and the Carlini-Wagner attack [10]. The authors are with the University of California, Berkeley. Emails: {bganderson,sam.pfrommer,sojoudi}@berkeley.edu. This work was supported by grants from ONR and NSF. A. Related Works 1) Robustness Certification: Certifying the robustness of a model amounts to solving the nonconvex optimization inf x∈X g(x), where X is a set of possible inputs or attacks (i.e., the "threat model"), and g(x) is either the model output at an input x, or some linear transformation of the model output (e.g., a classifier's margin between two classes). Convex relaxations work by optimizing over a convex outer-approximation of the set g(X) of possible outputs. Popular relaxations involve linear bounding and program- ming [11], [12], and semidefinite programming [13], [14], which constitutes a line of increasingly accurate yet com- putationally complex relaxations. Convex relaxation-based certificates remain loose in general, and their looseness has been shown to increase with model size [15]. The Lipschitz constant of a model provides a certified bound on how much the model output may change given some change in its input. Thus, bounds on the Lipschitz constant can yield efficient robustness certificates [16]. A number of works are devoted to computing Lipschitz bounds, but it has proven difficult to obtain tight enough bounds to grant meaningful certificates [16], [17], [18], [19]. Mixed-integer programming and branch-and-bound have also been applied to robustness certification for ReLU neural networks [20], [21], [22]. In contrast to convex relaxations and Lipschitz bounding, these methods are capable of ob- taining tight certificates if they are run to convergence, but this incurs exponential computational complexity, preventing them from scaling to practically-sized models [22]. Some methods allow for early termination of their optimizations to yield more efficient, yet loose certificates [22]. 2) Representations of ReLU Neural Networks: ReLU neural networks are defined by compositions g = AL ◦ σ ◦ * * * ◦ σ ◦ A1 with affine functions Al and elementwise activation functions σ = ReLU : x (cid:55)→ max{0, x}. The most prevalent alternative representation of such a model is as a piecewise linear function, i.e., a finite polyhedral partition of Rd with associated affine functions that agree with g on each polyhedron [23], [24]. Another representation is as a rational function when working with tropical algebra, where addition ⊕ and multiplication ⊗ are defined by x ⊕ y = max{x, y} and x ⊕ y = x + y [25]. Finally, min-max representations- discussed in Section II-have recently been introduced, where g is expressed as the pointwise minimum of pointwise maxima of affine functions. These works restrict their focus to showcasing the impressive approximation capabilities of ReLU models and their alternative representations. B. Contributions 1) We show that ReLU neural networks admit min-max representations and hence such representations are universal function approximators. 2) By lifting the certification to an infinite-dimensional problem over probability measures, we prove that, under mild boundedness, nonredundancy, and Slater conditions, exact solutions to the original nonconvex problem are efficiently obtained for min-max represen- tations via reduction to a tractable finite-dimensional convex optimization problem. 3) Experiments on robust control and MNIST image classification examples demonstrate the effectiveness of our approach. To the best of our knowledge, our work is the first to grant tight robustness certificates in polynomial time amongst those considering general ReLU neural networks and their alternative representations.1 C. Organization In Section II, we introduce and analyze the min-max rep- resentation of ReLU neural networks. We develop our tight robustness certificates in Section III. Experiments illustrating the effectiveness of our approach are given in Section IV, and concluding remarks are made in Section V. D. Notations The sets of natural, real, nonnegative real, and extended real numbers are denoted by N, R, R+, and R = R ∪ {−∞, ∞} respectively. Throughout, we let I, J , K ⊆ N denote index sets {1, . . . , m}, {1, . . . , n}, and {1, . . . , p}, respectively. The cardinality, convex hull, conic hull, and relative interior of a subset X of Rd are denoted by |X|, conv(X), cone(X), and ri(X), respectively. Furthermore, we define B(X) to be the Borel σ-algebra on X. We denote the set of probability measures on the measurable space (X, B(X)) by P(X). For x ∈ Rd, the Dirac measure centered at x is denoted by δx, which we recall is the probability measure defined by δx(A) = 0 if x /∈ A and δx(A) = 1 if x ∈ A for all A ∈ B(X). The set of all Dirac measures with center in X is defined to be D(X) = {μ ∈ P(X) : μ = δx for some x ∈ X}. The set of continuous functions from Rd into R is denoted by C(Rd, R). The effective domain of a function f : Rd → R is defined to be the set dom(f ) = {x ∈ Rd : f (x) < ∞}. If f is Borel measurable and μ is a probability measure on (X, B(X)), then we denote the expected value of f with respect to μ by Ex∼μf (x) = (cid:82) X f (x)dμ(x). If f is convex, the subdifferential of f at x is denoted by ∂f (x). Throughout, we let ∥ * ∥ denote an arbitrary norm on Rd, and we denote its dual norm by ∥ * ∥∗. 1See [26] for a polynomial time solution to the special case of 2-layer ReLU models. II. MIN-MAX AFFINE FUNCTIONS In this section, we formally define min-max affine func- tions, discuss works related to these functions, and show that every ReLU neural network admits such a representation. Definition 1. A function g : Rd → R is a min-max affine function if there exist I, J1, . . . , J|I| ⊆ N and associated aij ∈ Rd, bij ∈ R such that g(x) = mini∈I maxj∈Ji(a⊤ ijx+ bij) for all x ∈ Rd. In this case, the function x (cid:55)→ mini∈I maxj∈Ji(a⊤ ijx + bij) is called the min-max repre- sentation of g. The class of all min-max affine functions on Rd is denoted by G. Notice that g ∈ G is the pointwise minimum of m = |I| convex functions gi : x (cid:55)→ maxj∈Ji(a⊤ ijx + bij), and is therefore nonconvex in general. Without loss of generality, we henceforth assume that, for every g ∈ G, there exists some J ⊆ N with n = |J | such that the min-max representation of g satisfies Ji = J for all i ∈ I.2 Related Works on Min-Max Affine Functions. In the mathematics literature, min-max affine functions are also termed lattice polynomials [28]. The work [29] shows that piecewise linear activation functions can be written in min- max affine form, and that neural networks learned with such representations perform highly in image classification tasks. The works [30], [31] study the theoretical and algorithmic aspects of training min-max affine functions to separate data, and show that separating {x1, . . . , xp} ⊆ Rd from {y1, . . . , yq} ⊆ Rd requires no more that pq affine com- ponents. The authors of [32] use min-max representations of neural networks to characterize the training optimization landscape. The conversion of ReLU neural networks into min-max affine form is characterized in [33, Theorem 4.15]. An algorithm for nonlinear system identification using min- max affine functions is developed in [34]. Finally, min- max affine functions have been used as consistent statistical estimators, termed "Riesz estimators," in the mathematical economics literature [35]. To the best of our knowledge, our work is the first to exploit min-max representations for purposes of robustness certification. We now proceed with analyzing the representation power min-max affine functions. Let F be the class of all ReLU neural networks on Rd. The following theorem shows that every ReLU neural network can be represented as a min-max affine function, and therefore min-max affine functions are universal function approximators. Theorem 1. For every f ∈ F, there exist I, J ⊆ N and (aij, bij) ∈ Rd × R for i ∈ I, j ∈ J such that f (x) = min i∈I max j∈J (a⊤ ijx + bij) for all x ∈ Rd. (1) 2This is without loss of generality, since the value g(x) does not change upon appending affine global underestimators of the convex function gi : x (cid:55)→ maxj∈Ji (a⊤ ij x + bij ) to the set of affine components x (cid:55)→ a⊤ ij x + bij of g. In other words, mini∈I maxj∈Ji (a⊤ ij x + bij ) = mini∈I maxj∈J (a⊤ ij x + bij ) if one defines J = {1, . . . , n} with n = maxi∈I |Ji| and aij = vi, bij = gi(0) for j ∈ J \ Ji, for all i ∈ I, where vi ∈ Rd is a subgradient of gi at 0 (which exists by [27, Theorem 23.4]). Hence, the class G of min-max affine functions is dense in C(Rd, R) with respect to the topology of uniform conver- gence on compact sets. Proof. Every f ∈ F is piecewise affine, i.e., there is a finite collection Q of closed subsets of Rd such that Rd = (cid:83) Q∈Q Q and f is affine on every Q ∈ Q. Hence, by [36, Theorem 4.1], there exist I, J ⊆ N and (aij, bij) ∈ Rd × R for i ∈ I, j ∈ J such that (1) holds. Thus, since F ⊆ G and F is dense in C(Rd, R) with respect to the topology of uniform convergence on compact sets [37, Theorem 3.1], it holds that G is dense in C(Rd, R) in the same sense. III. THEORETICAL ROBUSTNESS CERTIFICATES In this section, we develop our theoretical robustness certificates. Consider a model g : Rd → R, which may, for example, represent the output of a scalar-valued controller or the confidence of a binary classifier f : Rd → {1, 2} defined by f (x) = 1 if g(x) ≥ 0 and f (x) = 2 if g(x) < 0. We consider the asymmetric robustness setting introduced in [38], where nonnegative outputs g(x) ≥ 0 are "sensitive" and we seek to certify that no input within some convex uncertainty set X ⊆ Rd causes the output to leave the sensitive operating regime. This asymmetric setting accurately models realistic adversarial situations. For example, an adversary may seek some imperceptible attack x ∈ X = {x′ ∈ Rd : ∥x′ − x∥ ≤ ε} to cause a vehicle's image classifier to predict "no pedestrian" (g(x) < 0) when the nominal image x has a pedestrian in view (the sensitive regime; g(x) ≥ 0), but not the other way around. We leave as future work the extension to vector-valued models. Formally, the certification problem we seek to solve in this work is written p⋆ := inf x∈X The model g is robust if and only if p⋆ ≥ 0. On the other hand, if x⋆ solves p⋆, then x⋆ is an optimal (worst-case) attack in X, and it is successful if p⋆ < 0. g(x). The problem p⋆ is nonconvex due to the nonconvexity of g. When g is a min-max affine function, a naive reformulation of p⋆ yields that p⋆ = inf (x,i,t)∈X×I×R {t : a⊤ ijx + bij ≤ t for all j ∈ J }, which removes the nonconvexity in x but is inefficient to solve in general due to the integer variable i. Alternatively, one may attempt to directly reformulate the problem into a convex one by minimizing the convex envelope of g. Although the resulting problem coincides with our convex reformulation c (introduced in Section III-A) on the relative interior of the direct reformulation's feasible set, it is diffi- cult to obtain regularity conditions under which the direct reformulation holds with respect to its entire feasible set. We propose an alternative approach to solving p⋆ that consists of three steps: 1) lift the problem to an optimization over probability measures, 2) leverage results and regularity conditions in distributionally robust optimization to make a finite-dimensional reduction of the problem, and 3) reformu- late and solve the finite-dimensional reduction. A. Lifting the Problem We lift the problem to an optimization over probabil- X g(x′)dδx(x′) = ity measures by noting that g(x) = (cid:82) Ex′∼δx g(x′) whenever x ∈ X: p⋆ = inf δx∈D(X) Ex′∼δx g(x′). With this reformulation, the optimization objective is linear in the variable δx, but the feasible set D(X) is nonconvex, making the problem intractable as written. Therefore, we consider relaxing the problem to an optimization over all probability measures: p′ := inf μ∈P(X) Ex′∼μg(x′). The problem p′ is convex, but infinite-dimensional. We start by showing that the relaxation is exact: Proposition 1. It holds that p′ = p⋆. Proof. Since D(X) ⊆ P(X), it holds that p′ ≤ p⋆. Now, let μ ∈ P(X). Then, since p⋆ ≤ g(x′) for all x′ ∈ X, it holds that p⋆ = (cid:90) X p⋆dμ(x′) ≤ (cid:90) X g(x′)dμ(x′) = Ex′∼μg(x′). Since μ ∈ P(X) is arbitrary, we conclude that p⋆ ≤ inf μ∈P(X) Ex′∼μg(x′) = p′. Hence, p′ = p⋆. Next, we show that solutions of the nonconvex problem p⋆ are generated by discrete solutions of the relaxation p′. Proposition 2. If μ⋆ = (cid:80) i∈I λiδxi is a discrete probability measure that solves p′, then x⋆ := xi solves p⋆ for all i ∈ I such that λi > 0. Proof. Let i⋆ ∈ arg mini∈I g(xi). Since λi ≥ 0 for all i, (cid:80) i∈I λi = 1, and g(xi⋆ ) ≤ g(xi) for all i, it holds that p⋆ ≤ g(xi⋆ ) = (cid:88) i∈I λig(xi⋆ ) ≤ (cid:88) i∈I λig(xi) = Ex′∼μ⋆ g(x′) = p′, so xi⋆ solves p⋆ by Proposition 1. If xi′ does not solve p⋆ for some i′ ∈ I such that λi′ > 0, then p⋆ = g(xi⋆ ) < g(xi′), implying that (cid:80) i∈I λig(xi) and hence that p⋆ < p′, which contradicts Proposition 1. i∈I λig(xi⋆ ) < (cid:80) The above results show that we may solve the problem p⋆ of interest by solving p′ for a discrete optimal distribution. The remainder of this section is dedicated to this approach. B. Finite-Dimensional Reduction To make our finite-dimensional reduction, we recall the definitions of conjugate and perspective functions. Definition 2. The conjugate of a function f : Rd → R is the function f ∗ : Rd → R defined by f ∗(y) = sup (y⊤x − f (x)). x∈dom(f ) We write f ∗∗ to denote the biconjugate (f ∗)∗. Definition 3. The perspective of a proper, closed, and convex function f : Rd → R is the function Pf : Rd × R+ → R defined by (cid:40) Pf (x, t) = tf (x/t) if t > 0, supy∈dom(f ∗) y⊤x if t = 0. Recall that the perspective Pf of a convex function f is also convex, and that the conjugate f ∗ is convex even when f is nonconvex [39]. Throughout the remainder of the paper, we fix g and X to be min-max affine and convex, respectively, via the following structural assumptions: Assumption 1. It holds that g ∈ G, taking the form g(x) = mini∈I gi(x) with gi(x) = maxj∈J (a⊤ Assumption 2. The set X takes the form X = {x ∈ Rd : ck(x) ≤ 0, k ∈ K} with ck : Rd → R a proper, closed, and convex function for all k ∈ K. ijx + bij). may be verified by simply solving c with a small number ε > 0 added to all of the nonlinear inequality constraints; replace fi(x) ≤ 0 with fi(x) + ε ≤ 0 for all nonlinear constraint functions fi. Theorem 2. If Assumption 3 holds, then c = p′ = c, and the discrete probability distribution (cid:80) solves p′ for all solutions (η⋆, λ⋆, x⋆) to c. i ̸=0 λ⋆ i δx⋆ i∈I:λ⋆ i /λ⋆ i Proof. Since X is defined by a finite intersection of 0- sublevel sets of proper, closed, and convex functions (As- sumption 2), and since every gi : x (cid:55)→ maxj∈J (a⊤ ijx + bij) is a proper, closed, and convex function, the result follows from [40, Theorem 12(ii)]. Theorem 2 together with our Propositions 1 and 2 show that we are able to exactly compute an optimal attack solving the nonconvex problem p⋆ by solving the convex optimizations c, c. We now make the reduction by introducing two finite- C. Reformulating and Solving the Finite Reduction dimensional convex optimization problems: c := minimize λi,ηi∈R xi∈Rd (cid:88) i∈I ηi subject to Pck (xi, λi) ≤ 0, i ∈ I, k ∈ K, Pgi(xi, λi) ≤ ηi, i ∈ I, (cid:88) λi = 1, λ ≥ 0. i∈I − α c := maximize α,βik∈R yi,zik∈Rd subject to g∗ i (yi) + (cid:88) k∈K Pc∗ k (zik, βik) ≤ α, i ∈ I, yi + (cid:88) k∈K zik = 0, i ∈ I, βik ≥ 0, i ∈ I, k ∈ K. Intuitively, c is minimizing a sort of "average" of the components gi at a finite number of points xi with weights given by the probability vector λ, and c is its dual. We now leverage recent results in distributionally robust optimization to show that the finite reductions c, c allow us to solve the infinite-dimensional problem p′ under mild assumptions. Definition 4. Let f0, f1, . . . , fm and h1, . . . , hn be extended real-valued functions defined on Rd. The optimization prob- lem p = inf{f0(x) : f1(x) ≤ 0, . . . , fm(x) ≤ 0, h1(x) = 0, . . . , hn(x) = 0, x ∈ Rd} admits a Slater point if there exists x ∈ (cid:84)m j=1 ri(dom(hj)) such that fi(x) ≤ 0 and hj(x) = 0 for all i and all j, and such that fi(x) < 0 for all i ̸= 0 such that fi is nonlinear. i=0 ri(dom(fi)) ∩ (cid:84)n Assumption 3. The set X is bounded and the optimization problem c admits a Slater point. The above boundedness assumption on X is standard in the adversarial robustness literature. The Slater condition In order to solve c, c, we must derive the appropriate conjugates and perspectives. In this subsection, we do so for the common cases where X is defined in terms of norm balls or polyhedra. We will also see that computing the conjugate g∗ is highly nontrivial, and as a result we turn i to tractably reformulating the constraint involving g∗ i using duality theory. Proposition 3. The perspective of gi : x (cid:55)→ maxj∈J (a⊤ bij) is given by Pgi(x, t) = maxj∈J (a⊤ (x, t) ∈ Rd × R+. Proof. Let x ∈ Rd. If t > 0, then ijx + ijx + bijt) for all Pgi(x, t) = tgi(x/t) = t max j∈J (a⊤ ijx/t + bij) = max j∈J (a⊤ ijx + bijt). If t = 0, then Pgi(x, t) = lim inf (x′,t′)→(x,0) Pgi(x′, t′) max j∈J = lim inf (x′,t′)→(x,0) a⊤ ijx = max j∈J = max j∈J (a⊤ ijx′ + bijt′) (a⊤ ijx + bijt), where the first equality comes from Theorem 13.3 and Corollary 8.5.2 in [27] and the third equality comes from the continuity of (x, t) (cid:55)→ maxj∈J (a⊤ ijx + bijt). Proposition 4. The perspective of ck : x (cid:55)→ ∥x − x∥ − ε is given by Pck (x, t) = ∥x − tx∥ − εt for all (x, t) ∈ Rd × R+. Proof. Following the same reasoning as in the proof of Proposition 3, we find that Pck (x, t) = t(∥x/t − x∥ − ε) = ∥x − tx∥ − εt for t > 0 and Pck (x, t) = lim inf (x′,t′)→(x,0)(∥x′ − t′x∥ − εt′) = ∥x∥ = ∥x − tx∥ − εt for t = 0. Proposition 5. The conjugate of ck : x (cid:55)→ ∥x − x∥ − ε is given for all z ∈ Rd by (cid:40) c∗ k(z) = z⊤x + ε ∞ if ∥z∥∗ ≤ 1, if ∥z∥∗ > 1. Proof. Let z ∈ Rd be such that ∥z∥∗ ≤ 1. Then sup x∈Rd:x̸=x z⊤(x − x) ∥x − x∥ = sup x′∈Rd:∥x′∥≤1 z⊤x′ = ∥z∥∗ ≤ 1, so z⊤(x − x) − ∥x − x∥ ≤ 0 for all x ̸= x. Also, z⊤(x − x) − ∥x − x∥ = 0 for x = x, and therefore supx∈Rd (z⊤(x − x) − ∥x − x∥) = 0, indicating that c∗ k(z) = sup x∈Rd (z⊤(x − x) − ∥x − x∥) + z⊤x + ε = z⊤x + ε. On the other hand, let z ∈ Rd be such that ∥z∥∗ > 1. Then ∥x′∥ > 1, implying that there exists x′ ∈ Rd \ {0} such that z⊤x′ z⊤x′ − ∥x′∥ > 0, and hence k(z) ≥ z⊤(x + αx′) − ∥αx′∥ + ε c∗ = α(z⊤x′ − ∥x′∥) + z⊤x + ε → ∞ The conjugate g∗ i is all that remains to compute. However, although computing g∗ i in closed form for the univariate (d = 1) function gi : x (cid:55)→ maxj∈J (aijx + bij) can be straightfor- ward, generalizing the formula to higher-dimensional settings is nontrivial. In theory, it is possible to express g∗ i for d > 1 in closed form via [27, Theorem 19.2]. However, this requires solving a vertex enumeration problem, i.e., determining finite sets V, R ⊆ Rd × R such that the polyhedron epi(g∗ i ) := {(x, t) ∈ Rd × R : a⊤ ijx + bij ≤ t for all j ∈ J } equals conv(P ) + cone(R). The vertex enumeration problem is NP-hard in general [41]. See the Minkowski-Weyl theorem [27, Theorem 19.1] for the theory on such representations of polyhedra. In Theorem 3 that follows, we instead take a duality-based robust optimization approach to tractably deal with the conjugate g∗ i in a direct manner. i ) = conv{aij : j ∈ J }. Lemma 1. It holds that dom(g∗ Proof. Let y ∈ conv{aij : j ∈ J }. Then y = (cid:80) for some θ ∈ Rn such that θ ≥ 0 and (cid:80) for all x ∈ Rd, we find that (a⊤ y⊤x − max j∈J ijx − max j∈J ijx + bij) = θja⊤ (a⊤ (cid:88) j∈J θjaij j∈J θj = 1. Hence, ijx + bij) j∈J (cid:88) θj(a⊤ ijx + bij) as α → ∞. Thus, c∗ k(z) = ∞. = Proposition 6. The perspective of the conjugate of ck : x (cid:55)→ ∥x − x∥ − ε is given for all (z, t) ∈ Rd × R+ by (cid:40) Pc∗ k (z, t) = z⊤x + εt ∞ if ∥z∥∗ ≤ t, if ∥z∥∗ > t. Proof. Let t > 0. If z ∈ Rd is such that ∥z∥∗ ≤ t, then ∥z/t∥∗ ≤ 1, so Pc∗ k(z/t) = t((z/t)⊤x + ε) = (z, t) = tc∗ z⊤x + εt. If ∥z∥∗ > t, then ∥z/t∥∗ > 1, so Pc∗ (z, t) = tc∗ k(z/t) = ∞. On the other hand, let t = 0. Then k k Pc∗ k (z, t) = sup x∈dom(c∗∗ k ) z⊤x = sup x∈Rd z⊤x = (cid:40) if z = 0, 0 ∞ if z ̸= 0, k = ck which has domain Rd, as ck is proper, closed, since c∗∗ and convex [27, Theorem 12.2]. Since, when t = 0, the condition z = 0 is equivalent to ∥z∥∗ ≤ t and the condition z ̸= 0 is equivalent to ∥z∥∗ > t, the proof is complete. We also provide the conjugates and perspectives for poly- hedral X: Proposition 7. Let ck : x (cid:55)→ ψ⊤ and some ωk ∈ R. Then the following all hold: k x + ωk for some ψk ∈ Rd (cid:40) k x + ωkt, 1) Pck (x, t) = ψ⊤ if z = ψk, −ωk ∞ if z ̸= ψk, (cid:40) k(z) = 2) c∗ 3) and Pc∗ k (z, t) = −ωkt ∞ if z = tψk, if z ̸= tψk. The proof of Proposition 7 follows from a straightforward application of the definitions of conjugate and perspective, and is hence omitted for brevity. j∈J − max j∈J (a⊤ ijx + bij) − (cid:88) j∈J θjbij ≤ (cid:88) j∈J θj max l∈J (a⊤ il x + bil) − max j∈J (a⊤ ijx + bij) − (cid:88) j∈J θjbij = − (cid:88) j∈J θjbij, i (y) ≤ − (cid:80) and thus g∗ i (y) = supx∈Rd (y⊤x − maxj∈J (a⊤ j∈J θjbij < ∞, so y ∈ dom(g∗ i ), so that g∗ i ). On the other hand, let y ∈ dom(g∗ i (y) < ∞. An epigraphic reformulation of g∗ i (y) yields that ∞ > g∗ ijx + bij)) = sup(x,t)∈Rd×R{y⊤x−t : a⊤ ijx + bij ≤ t for all j ∈ J }. This reformulation is a linear program with a finite optimal value, and hence by [42, Proposition 3.1.3], the reformulation is attained by some (x, t) ∈ Rd × R, and since it must be the case that t = a⊤ ijx+bij for some j ∈ J at this point (x, t), we conclude that this x solves the supremum defining g∗ i (y) in its original form (i.e., pre-epigraphic reformulation). There- fore, by the first-order optimality condition for unconstrained convex optimization [27, Theorem 23.2], it holds that 0 ∈ ∂hi(x), where hi : Rd → R is the convex function defined by hi(x) = maxj∈J (a⊤ ijx + bij) − y⊤x. Using the rules for subdifferentials of pointwise maxima and sums of proper convex functions [42, Proposition B.22],[27, Theorem 23.8], (cid:16)(cid:83) +{−y}, where we have that ∂hi(x) = conv A(x) denotes the set of active indices at x: A(x) = {j ∈ J : ijx + bij = maxl∈J (a⊤ a⊤ il x + bil)}. Since 0 ∈ ∂hi(x), this (cid:17) yields that y ∈ conv ⊆ conv{aij : j ∈ J }. j∈A(x){aij} This completes the proof. (cid:17) j∈A(x){aij} (cid:16)(cid:83) 1) y = (cid:80) and (cid:80) 2) νij ≥ 0, 3) y − aij + (cid:80) 4) and −bij + (cid:80) Assumption 4. The functions gi are nonredundant in the sense that for all j ∈ J there exists x ∈ Rd such that gi(x) = a⊤ ijx + bij. It is easy to see that nonredundancy of gi is efficiently verified by solving the linear (feasibility) programs inf{0 : (ail − aij)⊤x + (bil − bij) ≤ 0 for all l ∈ J , x ∈ Rd} for all j ∈ J . Removing the affine components of gi with infeasible programs ensures that Assumption 4 holds and does not change the model's predictions. Theorem 3. Suppose that Assumption 4 holds, and let h : Γ → R be an arbitrary real-valued function defined on some nonempty set Γ. Then, for all y ∈ Rd and all γ ∈ Γ, it holds that g∗ i (y) ≤ h(γ) if and only if, for all j ∈ J , there exists νij ∈ Rn such that the following all hold: j∈J θjaij for some θ ∈ Rn such that θ ≥ 0 j∈J θj = 1, l∈J (νij)l(aij − ail) = 0, l∈J (νij)l(bij − bil) ≤ h(γ). Proof. Let y ∈ Rd and γ ∈ Γ. If y ̸= (cid:80) j∈J θjaij for all θ ∈ Rn such that θ ≥ 0 and (cid:80) j∈J θj = 1, then y /∈ conv{aij : j ∈ J } and hence y /∈ dom(g∗ i ) by Lemma 1. In this case, g∗ i (y) = ∞ > h(γ) since h is real-valued. Therefore, the first condition enumerated in the theorem is necessary for g∗ i (y) ≤ h(γ). Going forward, assume that y = (cid:80) j∈J θjaij for some θ ∈ Rn such that θ ≥ 0 and (cid:80) i (y) < ∞. Breaking up the conjugate's supremum into n suprema over the affine components of gi yields j∈J θj = 1. Hence, g∗ (a⊤ ijx + bij)) (y⊤x − max j∈J g∗ i (y) = sup x∈Rd = max j∈J (ail − aij)⊤x + (bil − bij) ≤ 0 for all l ∈ J }. {(y − aij)⊤x − bij : sup x∈Rd il x + bil) = gi(x) = a⊤ ijx + bij ≥ a⊤ Denote the inner suprema by pij := supx∈Rd {(y − aij)⊤x − bij : (ail − aij)⊤x + (bil − bij) ≤ 0 for all l ∈ J }. Since, by Assumption 4, for all j ∈ J there exists x ∈ Rd such that maxl∈J (a⊤ ijx + bij, it holds that {x ∈ Rd : a⊤ il x + bil for all l ∈ J } ̸= ∅ for all j ∈ J , implying that every pij is feasible, i.e., pij > −∞. Furthermore, since g∗ i (y) < ∞, it must be the case that pij < ∞ for all j ∈ J . Thus, every optimal value pij is finite. Therefore, by [42, Proposition 3.1.3], every pij is attained, and therefore by [42, Proposition 4.4.2] strong duality holds between pij and its dual problem, which we denote by dij, and it also holds that dij is attained. A routine derivation via Lagrangian duality therefore yields that pij = dij = inf νij ∈Rn (cid:26) (cid:88) (νij)l(bij − bil) − bij : y − aij + l∈J (cid:88) l∈J (νij)l(aij − ail) = 0, νij ≥ 0 . (cid:27) Hence, g∗ i (y) ≤ h(γ) if and only if maxj∈J pij ≤ h(γ) if and only if pij ≤ h(γ) for all j ∈ J . Thus, since dij is attained, it holds that g∗ i (y) ≤ h(γ) if and only if, for all j ∈ J , there exists νij ∈ Rn such that νij ≥ 0, y − aij + (cid:80) l∈J (νij)l(bij − bil) ≤ h(γ). This completes the proof. l∈J (νij)l(aij − ail) = 0, and −bij + (cid:80) With the above conjugate and perspective derivations, our reformulations of c, c are complete; they may now be directly solved using off-the-shelf convex optimization solvers. Remark 1. Our developments can be generalized, so long as one can compute the appropriate conjugates and perspec- tives. In particular, the mathematical machinery yielding a discrete distribution solution to p′ from a solution to an associated finite-dimensional convex optimization problem may be applied to general convex functions gi and other (non-norm-based and non-polyhedral) convex attack sets X [40]. In fact, moment constraints on μ ∈ P(X) may even be added to the semi-infinite program p′, which may allow for modeling alternative "distributional attacks" beyond the standard "Dirac attack" at a single point considered here. IV. EXPERIMENTS In this section, we illustrate the utility of our method in both robust control and image classification settings.3 A. Robust Control Certification We take an illustrative robust control example adapted from the well-known autonomous vehicle collision avoidance problem [43], [44]. Consider two planar vehicles approach- ing an intersection located at the origin (0, 0) ∈ R2. One vehicle travels east with state x(t) = (x(t), ̇x(t)) ∈ R2 at time t. The other vehicle, which we control and hence term the "ego vehicle," travels north with state y(t) = (y(t), ̇y(t)). The eastbound uncontrolled vehicle has a fixed velocity ( ̈x(t) = 0 for all t). The full state (x(t), ̇x(t), y(t), ̇y(t)) is randomly initialized at t = 0 within [−3, −2] × [1/2, 5/2] × [−3, −2] × [0, 2]. The vehicles are each 1 unit long and 1/2 unit wide, matching the width of the road. Thus, a vehicle is considered to be in the intersection if the absolute value of its position is less than 3/4. If the vehicles collide, the simulation is stopped. We simulate standard double integrator dynamics with a time step ∆t = 0.05 for 100 steps. We control the northbound vehicle using a learned pol- icy u(t) = −πθ (x(t), y(t)) that enters the dynamics as ̈y(t) = Π[−1,1] (u(t)), where πθ : R4 → R is a min-max affine function with m = n = 10 and Π[−1,1] is the natural projection mapping of R onto [−1, 1]. Our robustness certificates apply for all training schemes, e.g., reinforcement learning and imitation learning. We train πθ using imitation learning on 500 trajectories generated by a hand-programmed expert policy π⋆. We use the mean squared error loss function and train for 20 epochs using the Adam optimizer at a learning rate of 0.01. The expert policy π⋆ is designed to stop the ego vehicle δ = 0.1 units before the intersection with a 3All experiments are conducted on a Ubuntu 22.04 instance with an Intel i7-9700K CPU and NVIDIA RTX A6000 GPU. y t i c o l e v o g E 1.75 1.50 1.25 1.00 0.75 0.50 0.25 Worst-case acceleration 0 Min-max α, β-CROWN [97.8% clean] [98.0% clean] 1.0 0.8 0.6 0.4 0.2 y c a r u c c a d e fi i t r e C −2.5 −2.0 −1.5 −1.0 Ego position −1 0.0 0.00 0.05 0.10 0.15 0.20 l∞-radius Fig. 1. Largest possible acceleration over all uncontrolled vehicle states for particular values of the ego vehicle state. The output is always negative, ensuring some level of braking. constant acceleration, then apply no acceleration until the tail of the uncontrolled vehicle is δ units past the intersection, and then accelerate with the maximum input of 1. We now consider certifying the safety of our control system. Our goal is to guarantee that the ego vehicle always brakes when the uncontrolled vehicle is approaching or inside the intersection. This enforcement of braking corre- sponds to ensuring that the largest acceleration signal u(t) is less than zero, which amounts to minimizing the output of πθ over the set of states for which we desire braking. This is formalized by requiring braking for all states in the set X = [−3 + δ, 3 4 ] × [ 1 2 + δ, 5 2 − δ] × [−3 + δ, − 3 4 ] × [δ, 2 − δ], which consists of states where the uncontrolled vehicle is approaching or in the intersection and the ego vehicle is approaching the intersection. The small positive constant δ = 0.1 accounts for boundary states where expert trajectories may not have been sampled. Utilizing our robustness certificates from Section III, we verify that indeed u(t) = −πθ (x(t), y(t)) < 0 for all states (x(t), y(t)) ∈ X. For visual purposes, we also consider fixing a particular y(t) and computing the largest possible acceleration u(t) amongst all uncontrolled vehicle states x(t) captured by X. The solutions to this problem over a range of y(t) are plotted in Figure 1. As expected, for all y(t), the ego vehicle is braking. As the ego vehicle approaches the intersection (large y(t)) or becomes faster (large ̇y(t)), we certify that the controller brakes more heavily. B. Image Classification We demonstrate the tightness and efficiency of our method on an image classification example adapted from [38]. The task is to distinguish between two visually similar MNIST classes: the digits 3 and 8 [45]. As we consider the asymmet- ric setting, we aim to certify predictions for one particular Fig. 2. Certified accuracies of our min-max representation and of α, β- CROWN on the MNIST 3-versus-8 dataset. class, which we take to be the class of 3's, while maintaining high clean accuracy for both classes. We consider the attack set X = {x ∈ Rd : ∥x − x∥∞ ≤ ε} over a range of radii ε > 0 around test images x. In this setting, certificates ensure that pixelwise adversarial alterations of an image x of a 3 cannot fool the classifier into predicting an 8. We compare two approaches: 1) directly learning our min- max representation with n = m = 15 and certifying via our convex optimization-based certificates, and 2) learning a standard composition-based ReLU model and certifying via the state-of-the-art verifier α, β-CROWN [22]. Since α, β-CROWN's worst-case runtime scales exponentially with model size, we instantiate the standard ReLU model with one hidden layer and 100 hidden units, which is the smallest hidden layer size that yields comparable clean accuracy to our min-max representation. We use adversarial training (see [9]) with l∞-attacks starting at a radius of 0.001 and linearly interpolate to a radius of εtrain over the first 20 epochs, where εtrain = 0.05 for our model and εtrain = 0.3 for the standard ReLU model. Both models are trained using the Adam optimizer with a learning rate of 0.001 for 60 epochs. Figure 2 compares the certified accuracy (averaged over the test inputs) of our method against that of α, β-CROWN. As certifying at a particular ε using our method is fast, for each test input, the largest certifiable l∞-radius is found us- ing binary search in order to yield a smooth certified accuracy curve. On the other hand, due to the expensive runtime of α, β-CROWN, we only certify at the select radii shown. Our min-max representation exceeds the state-of-the-art baseline certified radii at far faster runtimes: certifying a single input- radius pair (x, ε) takes on average 3.67 seconds with α, β- CROWN versus only 0.48 seconds with our method. We note that our runtime comparisons are solely based off of models with equivalent clean accuracy. Due to space constraints, we leave more thorough analyses of relative expressivity and computational complexity for future work. V. CONCLUSIONS In this work, we exactly solve the nonconvex robustness certification problem over convex attack sets for min-max representations of ReLU neural networks by developing a tractable convex reformulation. An interesting line of future work may include developing more efficient min- max representations or estimations for arbitrary ReLU neural networks, so that the advantageous optimization properties derived in this paper may be easily applied. Other interest lies in comparing the number of affine regions of a general min-max affine function versus that of a general ReLU neural network. REFERENCES [1] S. Chen, S. A. Billings, and P. Grant, "Non-linear system identification using neural networks," International Journal of Control, 1990. [2] S. S. Ge, C. C. Hang, T. H. Lee, and T. Zhang, Stable Adaptive Neural Network Control, 2013. [3] S. Levine, C. Finn, T. Darrell, and P. Abbeel, "End-to-end training of deep visuomotor policies," Journal of Machine Learning Research, 2016. [4] C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Good- fellow, and R. Fergus, "Intriguing properties of neural networks," in International Conference on Learning Representations, 2014. [5] K. Eykholt, I. Evtimov, E. Fernandes, B. Li, A. Rahmati, C. Xiao, A. Prakash, T. Kohno, and D. Song, "Robust physical-world attacks on deep learning visual classification," in IEEE Conference on Computer Vision and Pattern Recognition, 2018. [6] A. Liu, X. Liu, J. Fan, Y. Ma, A. Zhang, H. Xie, and D. Tao, "Perceptual-sensitive GAN for generating adversarial patches," in AAAI Conference on Artificial Intelligence, 2019. [7] M. Bojarski, D. Del Testa, D. Dworakowski, B. Firner, B. Flepp, P. Goyal, L. D. Jackel, M. Monfort, U. Muller, J. Zhang et al., "End to end learning for self-driving cars," arXiv preprint arXiv:1604.07316, 2016. [8] G. Katz, C. Barrett, D. L. Dill, K. Julian, and M. J. Kochenderfer, "Re- luplex: An efficient SMT solver for verifying deep neural networks," in Computer Aided Verification: 29th International Conference, 2017. [9] A. Madry, A. Makelov, L. Schmidt, D. Tsipras, and A. Vladu, "Towards deep learning models resistant to adversarial attacks," in International Conference on Learning Representations, 2018. [10] N. Carlini and D. Wagner, "Towards evaluating the robustness of neural networks," in IEEE Symposium on Security and Privacy, 2017. [11] E. Wong and Z. Kolter, "Provable defenses against adversarial ex- amples via the convex outer adversarial polytope," in International Conference on Machine Learning, 2018. [12] H. Zhang, T.-W. Weng, P.-Y. Chen, C.-J. Hsieh, and L. Daniel, "Ef- ficient neural network robustness certification with general activation functions," in Advances in Neural Information Processing Systems, 2018. [13] A. Raghunathan, J. Steinhardt, and P. S. Liang, "Semidefinite relax- ations for certifying robustness to adversarial examples," in Advances in Neural Information Processing Systems, 2018. [14] M. Fazlyab, M. Morari, and G. J. Pappas, "Safety verification and robustness analysis of neural networks via quadratic constraints and semidefinite programming," IEEE Transactions on Automatic Control, 2020. [15] B. G. Anderson, Z. Ma, J. Li, and S. Sojoudi, "Towards optimal branching of linear and semidefinite relaxations for neural network robustness certification," arXiv preprint arXiv:2101.09306, 2023. [16] M. Fazlyab, A. Robey, H. Hassani, M. Morari, and G. Pappas, "Ef- ficient and accurate estimation of Lipschitz constants for deep neural networks," in Advances in Neural Information Processing Systems, 2019. [17] L. Weng, H. Zhang, H. Chen, Z. Song, C.-J. Hsieh, L. Daniel, D. Boning, and I. Dhillon, "Towards fast computation of certified ro- bustness for ReLU networks," in International Conference on Machine Learning, 2018. [18] A. Virmaux and K. Scaman, "Lipschitz regularity of deep neural networks: Analysis and efficient estimation," in Advances in Neural Information Processing Systems, 2018. [19] M. Jordan and A. G. Dimakis, "Exactly computing the local Lipschitz constant of ReLU networks," in Advances in Neural Information Processing Systems, 2020. [20] V. Tjeng, K. Xiao, and R. Tedrake, "Evaluating robustness of neural networks with mixed integer programming," in International Confer- ence on Learning Representations, 2019. [21] B. G. Anderson, Z. Ma, J. Li, and S. Sojoudi, "Tightened convex relaxations for neural network robustness certification," in IEEE Con- ference on Decision and Control, 2020. [22] S. Wang, H. Zhang, K. Xu, X. Lin, S. Jana, C.-J. Hsieh, and J. Z. Kolter, "Beta-CROWN: Efficient bound propagation with per- neuron split constraints for neural network robustness verification," in Advances in Neural Information Processing Systems, 2021. [23] G. F. Montufar, R. Pascanu, K. Cho, and Y. Bengio, "On the number of linear regions of deep neural networks," in Advances in Neural Information Processing Systems, 2014. [24] R. Arora, A. Basu, P. Mianjy, and A. Mukherjee, "Understanding deep neural networks with rectified linear units," in International Conference on Learning Representations, 2018. [25] L. Zhang, G. Naitzat, and L.-H. Lim, "Tropical geometry of deep neural networks," in International Conference on Machine Learning, 2018. [26] P. Awasthi, A. Dutta, and A. Vijayaraghavan, "On robustness to adversarial examples and polynomial optimization," in Advances in Neural Information Processing Systems, 2019. [27] R. T. Rockafellar, Convex Analysis. Princeton University Press, 1970. [28] J.-L. Marichal, "Weighted lattice polynomials," Discrete Mathematics, 2009. [29] S. Velasco-Forero and J. Angulo, "MorphoActivation: Generalizing ReLU activation function by mathematical morphology," in Discrete Geometry and Mathematical Morphology, 2022. [30] A. M. Bagirov, "Max-min separability," Optimization Methods and Software, 2005. [31] A. M. Bagirov and J. Ugon, "Supervised data classification via max-min separability," Continuous Optimization: Current Trends and Modern Applications, 2005. [32] B. Rister and D. L. Rubin, "Piecewise convexity of artificial neural networks," Neural Networks, 2017. [33] S. Chen, A. R. Klivans, and R. Meka, "Learning deep ReLU networks is fixed-parameter tractable," arXiv preprint arXiv:2009.13512, 2020. [34] S. Wang and K. S. Narendra, "Nonlinear system identification with lattice piecewise-linear functions," in American Control Conference, 2002. [35] C. D. Aliprantis, D. Harris, and R. Tourky, "Riesz estimators," Journal of Econometrics, 2007. [36] S. Ovchinnikov, "Max-min representation of piecewise linear func- tions," Contributions to Algebra and Geometry, 2002. [37] A. Pinkus, "Approximation theory of the MLP model in neural networks," Acta Numerica, 1999. [38] S. Pfrommer, B. G. Anderson, J. Piet, and S. Sojoudi, "Asymmet- ric certified robustness via feature-convex neural networks," arXiv preprint arXiv:2302.01961, 2023. [39] S. Boyd and L. Vandenberghe, Convex Optimization. Cambridge University Press, 2004. [40] J. Zhen, D. Kuhn, and W. Wiesemann, "Mathematical foundations of robust and distributionally robust optimization," arXiv preprint arXiv:2105.00760, 2021. [41] L. Khachiyan, E. Boros, K. Borys, V. Gurvich, and K. Elbassioni, "Generating all vertices of a polyhedron is hard," Discrete & Compu- tational Geometry, 2009. [42] D. P. Bertsekas, Nonlinear Programming, 3rd ed. Athena Scientific, 2016. [43] K. Ren, H. Ahn, and M. Kamgarpour, "Chance-constrained trajectory planning with multimodal environmental uncertainty," IEEE Control Systems Letters, 2022. [44] A. Wang, A. Jasour, and B. C. Williams, "Non-Gaussian chance- constrained trajectory planning for autonomous vehicles under agent uncertainty," IEEE Robotics and Automation Letters, 2020. [45] Y. LeCun, "The MNIST database of handwritten digits," http:// yann.lecun.com/exdb/mnist/, 1998.
http://arxiv.org/abs/2310.04915v1
"2023-10-07T21:00:14"
"2023-10-07T21:00:14"
On Accelerating Diffusion-based Molecular Conformation Generation in SE(3)-invariant Space
Diffusion-based generative models in SE(3)-invariant space have demonstrated promising performance in molecular conformation generation, but typically require solving stochastic differential equations (SDEs) with thousands of update steps. Till now, it remains unclear how to effectively accelerate this procedure explicitly in SE(3)-invariant space, which greatly hinders its wide application in the real world. In this paper, we systematically study the diffusion mechanism in SE(3)-invariant space via the lens of approximate errors induced by existing methods. Thereby, we develop more precise approximate in SE(3) in the context of projected differential equations. Theoretical analysis is further provided as well as empirical proof relating hyper-parameters with such errors. Altogether, we propose a novel acceleration scheme for generating molecular conformations in SE(3)-invariant space. Experimentally, our scheme can generate high-quality conformations with 50x--100x speedup compared to existing methods.
[ "Zihan Zhou", "Ruiying Liu", "Tianshu Yu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04915v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04915v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "physics.comp-ph", "@scheme": "http://arxiv.org/schemas/atom" }
[ "physics.comp-ph", "cs.AI", "cs.LG" ]
3 2 0 2 t c O 7 ] h p - p m o c . s c i s y h p [ 1 v 5 1 9 4 0 . 0 1 3 2 : v i X r a Preprint ON ACCELERATING DIFFUSION-BASED MOLECULAR CONFORMATION GENERATION IN SE(3)-INVARIANT SPACE Zihan Zhou∗, Ruiying Liu* & Tianshu Yu The Chinese University of Hong Kong, Shenzhen {zihanzhou1,ruiyingliu}@link.cuhk.edu.cn yutianshu@cuhk.edu.cn ABSTRACT Diffusion-based generative models in SE(3)-invariant space have demonstrated promising performance in molecular conformation generation, but typically require solving stochastic differential equations (SDEs) with thousands of update steps. Till now, it remains unclear how to effectively accelerate this procedure explicitly in SE(3)-invariant space, which greatly hinders its wide application in the real world. In this paper, we systematically study the diffusion mechanism in SE(3)- invariant space via the lens of approximate errors induced by existing methods. Thereby, we develop more precise approximate in SE(3) in the context of projected differential equations. Theoretical analysis is further provided as well as empirical proof relating hyper-parameters with such errors. Altogether, we propose a novel acceleration scheme for generating molecular conformations in SE(3)-invariant space. Experimentally, our scheme can generate high-quality conformations with 50x–100x speedup compared to existing methods. 1 INTRODUCTION Given an atom-bond molecular graph, conformation generation asks for sampling viable 3- dimensional coordinate configurations of atoms following the Boltzmann distribution of its com- positional free energy (Strodel, 2021). As the 3-dimensional conformation generally determines a molecule's macroscopic properties, conformation generation is a basic yet essential task in chemin- formatics, drug discovery, and material engineering. Traditional solutions rely on optimizing over potential energy surface (e.g., force field (Riniker & Landrum, 2015) and density functional theory (Castro et al., 2004)), which suffer from a variety of drawbacks separately, such as low coverage, high computational complexity, and heavy demand for prior knowledge. Recently, there has been an increasing interest in applying diffusion-based generative models to sample molecular conformations (Shi et al., 2021; Zhang et al., 2023; Luo et al., 2021; Xu et al., 2022; Jing et al., 2022; Zhou et al., 2023; Fan et al., 2023a;b), as this line of work demonstrates strong modeling ability to capture the wide conformation distribution, analogous to their counterparts in computer vision area (Ho et al., 2020b; Dhariwal & Nichol, 2021). A central factor of such success lies in incorporating the roto-translational property of SE(3)-invariant space (De Bortoli et al., 2022), which is intrinsically equipped in 3-dimensional geometry. Unfortunately, unlike counterparts in computer vision, diffusion-based conformation generators that explicitly incorporate SE(3) property typically cost up to several thousand sampling steps. Till now it is vague how to directly accelerate them with standard solvers (e.g., DPM solver and high-order solvers (Song et al., 2020b; Dormand & Prince, 1980; Lu et al., 2022a)), while enforcing such solvers may result in unmeaningful conformations, and the reason causing this failure remains unclear. Although some other methods may be easily accelerated via bypassing this SE(3) riddle with much prior knowledge (Ganea et al., 2021; Jing et al., 2022), we believe that getting to the bottom of SE(3) can provide insightful perspectives to the future research. ∗indicates equal contribution. 1 Preprint In this paper, we systematically investigate how to effectively accelerate diffusion-based generation in SE(3)-invariant space for molecule generation tasks. To this end, we analyze current modeling methods in SE(3) (Shi et al., 2021; Xu et al., 2022; Zhou et al., 2023) and theoretically pose crucial mistakes shared in these methods, which inevitably bring about the failure of acceleration. From the perspective of differential geometry and projected differential equations, we correct these mistakes and propose more accurate approximations of score functions with a provably tight bound. This approximation is designed to mimic a projection into SE(3)-invariant space. As such, we propose a plausible scheme to accelerate diffusion-based generation on top of the corrected modeling with a hyper-parameter. We further empirically demonstrate the relationship between hyper-parameter and the model's prediction error, which we believe can provide useful suggestions for future solver design. Extensive experiments are conducted on QM9 and Drugs datasets (Axelrod & Gomez- Bombarelli, 2022). Our acceleration scheme can sample high-quality molecular conformations by slightly modifying GeoDiff (Xu et al., 2022) and SDDiff (Zhou et al., 2023), but with 50–100x speedup. In summary, our contributions are: • We analyze the modeling mistakes occurring in the current SE(3)-based methods and present effective approximation to correct them therein. • We give a theoretically tight bound of our approximation, which also empirically performs well. • We for the first time propose a plausible scheme for accelerating diffusion-based molecular conformation generation in SE(3)-invariant space, achieving remarkable speedup without sacrificing sampling quality. 2 RELATED WORKS Molecular conformation generation. Various methods have been proposed to generate molecular conformers. Some notable approaches include GeoMol (Ganea et al., 2021), which utilizes Graph Neural Networks (GNNs) to predict local structures and connectivity information for subsequential manual assembly of conformers. In contrast, DMCG (Zhu et al., 2022) offers an end-to-end solution by directly predicting atom coordinates while maintaining roto-translational invariance through an SE(3)-invariant loss function. Recently, a growing interest has emerged in diffusion-based methodologies (see Appendix A). To simplify the analysis of SE(3)-invariance, some methods shift the modeling from atom coordinates to pairwise distances. A subset of them (Shi et al., 2021; Zhang et al., 2023; Luo et al., 2021) introduce perturbations to inter-atomic distances and subsequently estimate the corresponding coordinate scores. On the other hand, two most closely related works to the present study, GeoDiff (Xu et al., 2022) and SDDiff (Zhou et al., 2023) both choose to perturb atomic coordinates, but their distance distribution modelings are distinct. Other models focuse on molecular local structure designs. FrameDiff (Yim et al., 2023) parameterizes the diffusion of the frame translation and torsion angles by considering diffusion on SE(3)-manifold. Torsional diffusion (Jing et al., 2022) further eases the problem by applying RDkit to first generate local structures so that the lengths of atom bounds and then apply the diffusion process on torsion angles. Another different method, EC-Conf (Fan et al., 2023b), is a consistency model which can transform the conformation distribution into a noise distribution with a tractable trajectory satisfied SE(3)-equivariance. Sampling acceleration of diffusion-based models. The reverse diffusion process typically takes thousands of steps. To accelerate the diffusion process, some new diffusion models such as consistency models (Song et al., 2023) are proposed. Consistency models directly map noise to data, enabling the generation of images in only a few steps. EC-Conf (Fan et al., 2023b) represents an application of consistency models in substantial reduced number of steps for molecular conformation generation. A more naive approach is simply reducing the number of sampling iterations. DDIM (Song et al., 2020a) uses a hyper-parameter to control the sampling stochastical level and finds that the decrease of the reverse iteration number results improved sample quality due to less stochasticity. This phenomenon can be attributed to the existence of a probability ODE flow associated with the stochastic Markov chain of the reverse diffusion process (Song et al., 2020b). This implies that several numerical ODE solver methods can be applied to solve the reverse diffusion. DPM-solver (Lu et al., 2022a) leverages the semi-linear structure of probability flow ODE to develop customized ODE solvers, and also provides high-order solvers for the probability ODE flow which can generate high-quality samples in only 10 to 20 iterations. Then DPM is extended as DPM-solver++ (Lu et al., 2022b) for sampling 2 Preprint with classifier-free guidance. However, such a dedicated solver can only be applied in Euclidean space. To our best knowledge, there is no diffusion solver for SE(3)-invariant space or on the pairwise distance manifold. Hence, accelerating SE(3)-diffusion process remains a challenge. 3 PRELIMINARY 3.1 MOLECULAR CONFORMATION GENERATION Given a specific molecular graph G, the molecular conformation generation task aims to generate a series of independent and identically distributed sample conformations from the conditional probability distribution denoted as p( G). In this context, the distribution function p adheres to the underlying Boltzmann distribution (Noé et al., 2019). C| C Each molecule is represented as an undirected graph, denoted as G = (V, E), where the set V represents the ensemble of atoms within the molecule, while E signifies the collection of inter-atomic chemical bonds. Additionally, the graph incorporates node features hv ∈ V and E. These features encapsulate information for all edge connections (u, v) edge features euv ∈ about atom types, formal charges, and bond types, among other characteristics. Rf for all nodes v Rf ′ ∈ ∈ To streamline the notation, the set of atoms in three-dimensional Euclidean space is represented as . xv∥ Rn×3, and the distance between nodes u and v is expressed as duv = xu − ∥ G). C To model the generative process effectively, the generative model is denoted as pθ( = [x1, . . . , xn] ∈ C| 3.2 EQUIVARIANCE WITHIN MOLECULAR CONFORMATION ANALYSIS Equivariance with respect to translation and rotation operations, defined by the SE(3) groups, holds significant interdisciplinary relevance across various physical systems. Therefore, it assumes a pivotal role in the modeling and analysis of three-dimensional geometric structures, as highlighted in prior research (Thomas et al., 2018; Weiler et al., 2018; Chmiela et al., 2019; Fuchs et al., 2020; Miller et al., 2020; Simm et al., 2020; Batzner et al., 2022). In mathematical terms, a model sθ is considered equivariant concerning the SE(3) group if it satisfies the condition sθ(Tf (x)) = Tg(sθ(x)) for any arbitrary transformations f and g belonging to the SE(3) group. An effective strategy is to employ inter-atomic distances, which naturally exhibit equivariance with respect to the SE(3) groups (Shi et al., 2021; Xu et al., 2022; Gasteiger et al., 2020). 3.3 PAIRWISE-DISTANCE MANIFOLD ∈ ∀ Rn×n + + . Directly applying the diffusion process, i.e., ̃d = d + z for some z Pairwise-distance matrices (adjacent matrices) lie in a sub-manifold of Rn×n + . A pairwise-distance matrix d = [dij] is said to be valid if there is a set of coordinates = [x1, . . . , xn] s.t. i, j = 1, . . . , n. The manifold of valid distance matrices is a proper sub-manifold dij = , xj∥ xi − ∥ of Rn×n (0n×n, I) would result in an invalid pairwise-distance ̃d. Meanwhile, in the reverse process of diffusion, enforcing the model to generate a feasible distance matrix is non-trivial. Some previous works (Hoffmann & Noé, 2019) utilize the spectral theorem to generate valid pairwise distance but such a method involves matrices decomposition, which would cause huge computational cost. In some other works, authors implicitly assume that the manifold of pairwise distance is surjective to Rn×n + , resulting in inaccurate computation of the score function (Shi et al., 2021; Xu et al., 2022; Zhou et al., 2023). ∼ N C 4 METHOD In this work, we aim to explicitly accelerate the sampling of SE(3)-invariant diffusion models. Surprisingly, our scheme only requires two slight modifications on top of existing models, i.e., GeoDiff (Xu et al., 2022) and SDDiff (Zhou et al., 2023), to enable efficient sampling in much fewer steps: 1) replacing "summation" with "mean" term in estimating the score (Eq. 5) and 2) multiplying a factor "scale" to correlate the error shift (Eq. 14). We consider SE(3)-invariant diffusion models that model inter-atomic distances. Specifically, given 3 matrix, i.e., a molecular conformation Rn×3/ SE(3) and let 0 be embedded by a n C × 0 C ∈ 3 Preprint 0 = [x1, . . . , xn] C (we consider ∈ C Rn×3, they define a forward diffusion process of the conformation embedding 0 as a vector to simplify our notations) (Song et al., 2020b) q0t ( Ct | C 0) = (cid:0) N 0, σ2 t I(cid:1) Ct | C ⇔ ∂ Ct = (cid:114) dσ2 t dt ∂wt (1) where the corresponding ODE reverse flow is q0( ∼ C C 0 0) and q0 is the distribution of the dataset, σt = σ(t) is an increasing function, and ∂ Ct ∂t = 1 2 dσ2 t dt ∇ − Ct log q0t ( 0) , Ct | C CT ∼ q0T ( CT | C 0) qT ( CT ) , ≈ (2) To define an equivariant reverse process, we need to compute an equivariant score function 0). By assuming that the manifold dimension of the pairwise distance is n2, existing ∇ methods use the chain rule to compute (Shi et al., 2021; Xu et al., 2022; Zhou et al., 2023) Ct log q0t( Ct|C Ct log q0t( ∇ log q0t(dt| d0) (3) ≈ 0) i=1 (cid:88) n (cid:88) Ct|C ∂d(t) ij Ct ∇d(t) ∂ ]. They train the model sθ = sθ( Ct|C j∈N (i) ij G G G where d = [dij] = [ xj∥ xi − ∥ 0) and sθ(dt, t, Ct log q0t( σt∇ notation simplification, we omit the input ) = − G ) satisfying Ct, t, G represents the molecular graph. In the following, for ). and sθ(dt, t) = sθ(dt, t, ) = sθ(dt, t, G We find that applying the usual discretilization (Lu et al., 2022a) (see Appendix B) − cannot produce substantial conformations. To enable efficient sampling, we apply two core modifica- tions. The first modification is to replace Eq. 3 with Ct ≈ Cs + [σ(t) σ(s)] sθ(ds, s) (4) Ct log qσ( 0) = Ct|C ∇ n (cid:88) i=1 1 degreei (cid:88) j∈N (i) ∂d(t) ij Ct ∇d(t) ∂ ij log q0t(dt| d0) (5) where degreei is the degree of node i. The second modification is to add a multiplier "scale", ksθ to Eq. 4: Ct ≈ Cs + ksθ (ds, s, t) [σ(t) − σ(s)] sθ(ds, s) (6) The reason for the first and second modifications is detailed in Sec. 4.1 and Sec. 4.2. In our empirical investigation, we substantiate that our solver is capable of producing high-quality samples when contrasted with the approach of sampling through thousands of iterations of Langevin dynamics. 4.1 DIFFERENTIAL FORM OF CONFORMATION SCORE We examine the relationship existing between the manifold of pair- wise distances and conformation. We define the manifold of pairwise distance matrices or adjacent matrices to be M and the manifold of the SE(3)-invariant conformation coordinates to be N . Consider mappings defined in Fig 1. By definition, we have Ct log q0t( Ct|C 0) = dφdt( ∇dt log q0t(dt| d0)) ∇ (7) Computation of dφ. For fixed t, we rewrite ̃d := dt, d := d0 and pσ( ̃d N . d) := q0t(dt | → We can write f = πN ◦ 3 matrix × N . In such an embedding, we can choose πN to be to embed C ∈ πM, ̃d. The mapping an identical mapping and we have dφ ̃d = φ d0). Consider the mapping f : T ̃dM dφ = φ πM . Since we use a n ◦ | ◦ 4 Figure 1: Mappings between the manifolds of pairwise dis- tances M and SE(3)-invariant conformations N . A more detailed introduction can be found in Appendix C. Preprint ∂ ̃dij ∂ ̃ C ˆxi − (cid:16) ∥ → φ : M to be a generalized multidimensional scaling (GMD), i.e. given ˆd = ̃d + (cid:80) define πM, ̃d( ˆd)ij = N is a function that maps the adjacent matrix to a conformation and πM can be chosen T ̃dM , we . Then, (cid:80) i<j (cid:16) ˆxj∥ , where ˆx1, . . . , ˆxn = argmin ˆx1,...,ˆxn ˆxi − ∥ ˆxi − ∥ i,j αijeij ∈ (cid:17)2 ˆdij ˆxj∥ − (cid:17)2 ˆdij . dφ ̃d( ˆd) = φ πM, ̃d( ˆd) = argmin ˆx1,...,ˆxM ◦ (cid:88) (cid:16) i<j ˆxi − ∥ ˆxj∥ − We approximate the solution of the above optimization problem as dφ ̃d( ˆd) = dφ ̃d( ̃d + (cid:88) i,j αijeij) + ̃ C ≈ (cid:88) αij i,j 2(n 1) − (8) (9) Theorem 1. Consider the optimization problem f ( ˆd) := min ˆd = ̃d + δeuv. The optimal value f ( ˆd) approximated by ˆx = dφ ̃d( ˆd) from Eq. 9 is bounded by 2n2+n−1 2(n−1)2 δ2 (See Appendix D.2 for the formal proof). Hence, approximation error does not explode with the increase of node numbers. ˆxj∥ − , where ˆx1,...,ˆxM ˆdij i<j (cid:80) (cid:17)2 Then, by Eq. 9 and the linearity of dφ ̃d, we have ̃C log pσ( ̃ C|C ∇ ) = dφ ̃d( ̃d log pσ( ̃d d)) | ∇ ≈ (cid:88) ∇ i,j ̃dij log pσ( ̃d | 1) 2(n − d) ∂ ̃dij ∂ ̃ C (10) Detailed intermediate steps and the reason for such an approximation, as well as approximation error bound and tangent space assumptions, are detailed in Appendix D. Since we usually consider partially connected conformations, the pairwise distance matrix is sparse. We thus modify Eq. 10 to Ct log q0t( Ct|C 0) ≈ ∇ n (cid:88) i=1 1 degreei (cid:88) j∈N (i) ∂d(t) ij Ct ∇d(t) ∂ ij log q0t(dt| d0), (11) where degreei denotes the degree of node i. By completing the sparse conformation into a fully connected conformation, Eq. 11 is reduced to Eq. 10. Various methods have been proposed to compute d0) and details can be seen in Appendix E. Using these methods, we can ∇dt log q0t(dt| train the model sθ(dt, t) Ct log q0t( 0). σt∇ ≈ − Ct|C 4.2 MODELING OF REVERSED FLOW As stated in Eq. 2, the reverse flow of conformations is ∂ Ct ∂t = 1 2 dσ2 t dt ∇ − Ct log q0t ( 0) = Ct | C 1 2 dσ2 t dt − dφdt( ∇dt log q0t(dt| d0)) (12) where we assume TdtM . We can discretize the above ODE (Lu et al., 2022a) (see Appendix B) and suppose that we have a model sθ(dt, t) = 0) + ε(dt, t), where ε(dt, t) is the prediction error, then we have Ct + Ct log q0t( ∇dt log q0t (dt | TCtN, dt + Ct log q0t ( Ct | C d0) 0) ∇ ∈ ∈ σt∇ − Ct|C σsσ′(s)dφ ( Ct ≈ Cs − ≈ Cs + [σ(t) := Cs + [σ(t) − − ∇ds log q0s (ds)) [σ(t) σ(s)] sθ(ds, s) σ(s)] sθ(ds, s) + ̄ε(ds, s, t) − − σ(s)] ε(ds, s) (13a) (13b) (13c) 5 Preprint and intermediate time steps are uniformly distribution between T and 0. The term ̄ε(ds, s, t) can be seen as an addtional noise injected to Cs. Hence, after one iteration of the denoising process, the obtained ̃Ct should be ̃Ct+λ(s−t) for some λ (0, 1). This motivates us to choose a larger drift of the conformation score. Hence, we introduce a multiplier "scale" ksθ (ds, s, t) > 1 as an addition term to remedy the model's prediction errors, and the iteration rule becomes ∈ Ct ≈ Cs + ksθ (ds, s, t) [σ(t) − σ(s)] sθ(ds, s) (14) ksθ (pdata), i.e., for each dataset, we can find a To find scale ksθ , we further assume ksθ (ds, s, t) q0t(dt). From the experimental results, we hyper-parameter to approximate ksθ (ds, s, t) for all dt ∼ find that the magnitude of ksθ increases along with the increase of the model's prediction error, while other factors such as node number and node degree do not have a significant influence on the choice of ksθ . Details of the experiments and the results can be seen in Sec. 5.1. ≈ 5 EXPERIMENTS We first examine the influential factors associated with the newly introduced hyper-parameter "scale" ksθ in Sec. 5.1. Then we evaluate our proposed accelerated sampling method through a comparative analysis with the baseline sampling method in Sec. 5.3 and conduct the hyper-parameter analysis for these two sampling method in Sec. 5.4. Finally, we assess our method's efficacy when the number of iterations in the sampling process is further reduced in Sec. 5.5. Appendix G provides additional experiments, and visualization of sampling process of our method can be found in Appendix H. 5.1 MODEL ERROR ̄ε AND SCALE ksθ { Ct | C n i=1 to investigate the relation- We develop toy datasets Qi} ship between the prediction error ̄ε and scale ksθ and each (i) dataset only contains a single sample, . i.e., Qi = 0 } {C T For each dataset, we denote the sigma scheduler as σt} t=1 { and set the forward diffusion process to be q0t( 0) = Ct | C t I) and suppose we have a model sQi θ (dt, δ) = ( N dt + d0) + εd(δ, t)(cid:1)(cid:1), where dt is the pairwise Normstd distance of the conformation coordinates at time t and εd(δ, t) is the noise level term controlled by a hyper-parameter δ. We assume sQi 0) when δ is small. De- Ct log q0t( tailed reasons for such a definition and corresponding settings can be found in Appendix F.1. To generate samples, we sample random noise ̃ 0, σ2 (cid:0)dφ (cid:0)( θ (dt, δ) σt∇ Ct|C (0, σ2 T I) and apply ≈ − − CT ∼ N − (15) ̃ Ct ≈ 0. If σ(s)]sθ (ds, s, δ) ̃ Cs + ksθ [σ(t) ̃dt − to generate ̃ ∞ < h for some predefined threshold d0 ∥ ∥ C h > 0, we say that the reverse process converges at t and define the minimal 1 t/T to be the convergent time. We aim to find the convergent time under different noise levels δ and scale ksθ . We grid-search the above two parameters and visualize the convergence of the model. The results can be seen in Fig. 2 and the color of each grid represents the convergent time. Grids with no color imply that under such noise level δ and model error ksθ , the model diverges. We can see a positive correlation between the model's error and the scale, which matches the hypothesis in Eq. 13. Other ablation studies show that other factors including node number and node degree do not have a strong impact on the choice of ksθ . Detailed analysis is in Appendix F.2. Figure 2: Relations between the prediction error δ and scale ksθ . Grid color indicates the conver- gent time. − 5.2 EXPERIMENT SETUP We firstly retrain SDDiff and GeoDiff models after the modifying their conformation score as introduced in Equation 5. Comprehensive training specifications can be found in Appendix G.1. It's important to note that the results presented here are derived from the modified models. 6 0.5 0.6 0.7 0.8 0.9 1.0 1.0 1.1 1.2 1.3 4.4 4.1 3.9 3.7 3.4 3.2 2.9 2.7 2.4 2.2 2.0 1.7 1.5 1.2 1.0ks0.8250.8500.8750.9000.9250.9500.975 Preprint Table 1: Comparison results between LD sampling and our fast sampling method. Note that GeoDiff and SDDiff here refer to the revised ones with modified score estimation in Eq. 5. Higher values for COV indicate better results, while lower values for MAT are preferable. The reported time represents the average run time for sampling a single conformer. Dataset Model Sampling method Recall Precision COV-R(%) ↑ MAT-R(Å) ↓ COV-P(%) ↑ MAT-P(Å) ↓ Mean Median Mean Median Mean Median Mean Median Time (s) Drugs QM9 GeoDiff SDDiff GeoDiff SDDiff LD Ours LD Ours LD Ours LD Ours 78.83 89.37 1.0422 1.0346 51.13 50.00 1.3143 1.2638 4.4506 84.06 94.39 0.9693 0.9608 49.09 49.04 1.3746 1.3303 0.0868 56.88 55.85 1.3318 1.2448 60.25 65.86 1.2619 1.1446 4.2392 70.69 76.68 1.0946 1.0801 48.83 48.01 1.6397 1.4478 0.0802 88.79 93.00 0.3285 0.3249 50.84 48.30 0.6986 0.5027 2.4608 90.62 95.09 0.2427 0.2368 52.30 50.61 0.4714 0.4588 0.0471 90.56 95.58 0.2740 0.2693 52.74 50.26 0.6210 0.4660 2.2428 88.46 92.66 0.2920 0.2905 46.94 45.07 0.8293 0.6726 0.0459 Dataset. We employ two datasets, namely GEOM-Drugs and GEOM-QM9 (Axelrod & Gomez- Bombarelli, 2022) to validate the efficiency of our fast sampling method. The dataset split is from GeoDiff (Xu et al., 2020). In the GEOM-Drugs dataset's test set, we encounter a total of 14,324 conformers from 200 molecules, with an average of approximately 47 atoms per molecule. The GEOM-QM9 test set contains 24,143 conformers originating from 200 molecules, and each molecule has an average of around 20. In line with the previous work (Xu et al., 2020), we expand the generation of ground truth conformers to double their original quantity, resulting in more than 20k+ and 40k+ conformers being generated. Please refer to GeoDiff (Xu et al., 2022) for more information. Evaluation. We adopt established evaluation metrics, namely COV (Coverage) and MAT (Match- ing), incorporating Recall (R) and Precision (P) aspects to assess the performance of sampling methods (Xu et al., 2020; Ganea et al., 2021). COV quantifies the proportion of ground truth conform- ers effectively matched by generated conformers, gauging diversity in the generated set. On the other hand, MAT measures the disparity between ground truth and generated conformers, complementing quality assessment. Furthermore, refined metrics COV-R and MAT-R place added emphasis on the comprehensiveness of the ground truth coverage, while COV-P and MAT-P are employed to gauge the precision and accuracy of the generated conformers. Detailed calculations are in Appendix G.1. Baseline sampling method. To the best of our knowledge, no other fast conformation generation methods exist. Therefore, we compare our fast sampling approach with the conventional sampling method via Langevin dynamics (LD sampling) (Song & Ermon, 2019): Ct−1 = Ct + αt∇ (0, I) and αt = hσ2 Ct log pσ( Ct) + √2αtzt−1, t . h is the hyper-parameter referring to step size and σt is the where zt ∼ N noise schedule in the forward diffusion process. We employ T = 5000 in the diffusion process, necessitating 5000 iterations in LD sampling. t = T, T 1, . . . , 2, 1 (16) − 5.3 COMPARISON WITH BASELINE SAMPLING METHOD The LD sampling method needs thousands of steps to align with the diffusion process, whereas our fast sampling achieves the same goal with significantly fewer iterations. We compare our fast sampling method using 100 steps with LD sampling, and the results are shown in Tab. 1. Our evaluation criteria consist of eight metrics, and the results displayed in the table are obtained under hyper-parameter settings that ensure a well-balanced comparison among these evaluation criteria. Tab. 1 shows that our fast sampling method can generate conformers of comparable quality to LD sampling while achieving a roughly 50-fold speed improvement. Overall, metrics related to Recall are satisfying, indicating that good diversity in conformers generated by our methods. However, there 7 Preprint Figure 3: Impacts of scale ksθ and step size h in our fast sampling and LD sampling. Note that in the figures in the upper row, higher COV values signify superior performance, while in the figures below, the opposite holds for MAT. Metrics failing to meet the predefined thresholds (COV values lower than 0.2, MAT values higher than 2.5) have been intentionally omitted from the graphical representation for clarity and precision. are more low-quality conformers generated, resulting in lower performance in terms of metrics under Precision. 5.4 HYPER-PARAMETER ANALYSIS We introduce a hyper-parameter scale, denoted as ksθ in Eq 14, to enable acceleration. In LD sampling, the hyper-parameter is step size h in our setting. We illustrate the influence of these hyper-parameters on Drugs dataset in Fig. 3. Notably, certain data points revealed a significant underperformance are not depicted in the figure. A counterpart analysis on QM9 dataset is provided in Appendix G.2. Fig. 3 shows that our method can obtain satisfactory metrics for Recall across most hyper-parameter values. However, metrics related to Precision consistently exhibit poorer results. Particularly, when higher scales are employed, resulting in significantly higher values for MAT-P. This is due to the deteriorating output of the network. We observe that part of the output occasionally start exploding from a certain sampling iteration especially under higher scale values, leading to some generated conformers becoming unstructured. This significantly impacts the P-series metrics but not the R-series metrics, as P-series metrics include all generated samples but the latter only considers conformers closely matching the ground truth. A similar phenomenon is also observed for LD sampling. When 8 12345678scale0.650.700.750.800.85COV-R mean12345678scale0.70.80.9COV-R median12345678scale0.30.40.50.6COV-P mean12345678scale0.20.30.40.50.60.7COV-P median12345678scale1.01.21.41.61.8MAT-R mean12345678scale1.01.21.41.61.8MAT-R median12345678scale1.41.61.82.0MAT-P mean12345678scale1.21.41.61.8MAT-P median0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step sizeHyper-parameter analysis of sampling methods on Drugs datasetFast sampling for GeoDiffLD samping for GeoDiff12345678scale0.20.30.40.50.60.7COV-R mean12345678scale0.20.40.60.8COV-R median12345678scale0.20.30.40.50.6COV-P mean12345678scale0.30.40.50.6COV-P median12345678scale1.21.41.61.82.0MAT-R mean12345678scale1.21.41.61.82.0MAT-R median12345678scale1.41.61.82.02.2MAT-P mean12345678scale1.251.501.752.002.252.50MAT-P median0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step sizeHyper-parameter analysis of sampling methods on Drugs datasetFast sampling for SDDiffLD samping for SDDiff Preprint Figure 4: Results of our accelerated sampling technique applied to GeoDiff with a reduced number of steps. The dashed horizontal lines represent the results obtained through LD sampling. Data points with MAT metrics exceeding 2.5 have been omitted from the figure for clarity and precision. the step size h exceeds a certain range, P-series metrics quickly deteriorate. Addressing this issue may require improved network design in future research. In the comparison between GeoDiff and SDDiff, we observe that when applied to SDDiff, our method demands a higher and more stringent scale ksθ . In a previous demonstration in Sec. 5.1, we demonstrate that scale is linked to modeling error. Despite SDDiff's more accurate distance score distribution approximation (Zhou et al., 2023), it leads to a significantly more complex learning objective compared to GeoDiff's Gaussian assumption. The presence of the random variable ̃d, which can approach zero in the denominator (see Appendix E), poses a significant challenge to training. Consequently, the error in the trained models of SDDiff is more likely to be higher, thus requiring a higher value of scale within a narrower range. 5.5 SAMPLING IN FEWER STEPS We evaluate the efficacy of our accelerated sampling method at further reduced steps. The results for the GeoDiff model on Drugs dataset are shown in Fig. 4, and more complementary experiments are detailed in Appendix G.3. As depicted in Fig. 4, our method exhibits noteworthy robustness when subjected to fewer steps. While performance gradually diminishes with decreasing step counts, it consistently maintains a commendable level of accuracy even under the constraint of only 30 steps. This adaptability to reduced step conditions underscores that our approach offers a compelling solution that strikes a commendable balance between speed and performance, indicating its considerable potential for real-world applications. 6 CONCLUSION This study focuses on effective acceleration of diffusion-based generation in SE(3)-invariant space for molecular conformation generation. To this end, we first investigate the correlation between two manifolds regarding distances and coordinates utilizing an approximated differential operator, as well as rigorously validating this approximation through mathematical proofs and empirical experiments. Then, we alleviate the accumulation of approximation errors in the reverse diffusion process by introducing an additional hyper-parameter, scale. Empirical results support the validity of this remedial strategy, and detailed analysis provided insights into hyper-parameter selection. Building upon these findings, comparative investigations substantiate the effectiveness of our acceleration scheme. We posit that this study has the potential to expedite the sampling procedure in real-world applications, facilitating the practical deployment of diffusion models. 9 2345678scale0.760.780.800.820.84COV-R mean2345678scale0.880.900.920.940.96COV-R median2345678scale0.400.450.500.55COV-P mean2345678scale0.350.400.450.500.55COV-P median2345678scale0.960.981.001.021.041.06MAT-R mean2345678scale0.960.981.001.021.04MAT-R median2345678scale1.41.61.82.0MAT-P mean2345678scale1.41.61.82.02.22.4MAT-P medianFewer steps of fast sampling for GeoDiff on Drugs datasetOur method in 80 stepsOur method in 50 stepsOur method in 30 stepsLD sampling with 5000 stpes Preprint REFERENCES Simon Axelrod and Rafael Gomez-Bombarelli. Geom, energy-annotated molecular conformations for property prediction and molecular generation. Scientific Data, 9(1):185, 2022. Simon Batzner, Albert Musaelian, Lixin Sun, Mario Geiger, Jonathan P Mailoa, Mordechai Kornbluth, Nicola Molinari, Tess E Smidt, and Boris Kozinsky. E (3)-equivariant graph neural networks for data-efficient and accurate interatomic potentials. Nature communications, 13(1):2453, 2022. Alberto Castro, Miguel AL Marques, Julio A Alonso, George F Bertsch, and Angel Rubio. Excited states dynamics in time-dependent density functional theory: high-field molecular dissociation and harmonic generation. The European Physical Journal D-Atomic, Molecular, Optical and Plasma Physics, 28:211–218, 2004. Stefan Chmiela, Huziel E Sauceda, Igor Poltavsky, Klaus-Robert Müller, and Alexandre Tkatchenko. sgdml: Constructing accurate and data efficient molecular force fields using machine learning. Computer Physics Communications, 240:38–45, 2019. Valentin De Bortoli, Emile Mathieu, Michael Hutchinson, James Thornton, Yee Whye Teh, and Arnaud Doucet. Riemannian score-based generative modelling. Advances in Neural Information Processing Systems, 35:2406–2422, 2022. Jan De Leeuw. Applications of convex analysis to multidimensional scaling. 2005. Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 2021. John R Dormand and Peter J Prince. A family of embedded runge-kutta formulae. Journal of computational and applied mathematics, 6(1):19–26, 1980. Wenqi Fan, Chengyi Liu, Yunqing Liu, Jiatong Li, Hang Li, Hui Liu, Jiliang Tang, and Qing Li. Gen- erative diffusion models on graphs: Methods and applications. arXiv preprint arXiv:2302.02591, 2023a. Zhiguang Fan, Yuedong Yang, Mingyuan Xu, and Hongming Chen. Ec-conf: A ultra-fast diffu- sion model for molecular conformation generation with equivariant consistency. arXiv preprint arXiv:2308.00237, 2023b. Fabian Fuchs, Daniel Worrall, Volker Fischer, and Max Welling. Se (3)-transformers: 3d roto- translation equivariant attention networks. Advances in Neural Information Processing Systems, 2020. Octavian Ganea, Lagnajit Pattanaik, Connor Coley, Regina Barzilay, Klavs Jensen, William Green, and Tommi Jaakkola. Geomol: Torsional geometric generation of molecular 3d conformer ensembles. Advances in Neural Information Processing Systems, 2021. Johannes Gasteiger, Janek Gross, and Stephan Günnemann. Directional message passing for molecular graphs. arXiv preprint arXiv:2003.03123, 2020. Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems, 2020a. Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in neural information processing systems, 2020b. Moritz Hoffmann and Frank Noé. Generating valid euclidean distance matrices. arXiv preprint arXiv:1910.03131, 2019. Bowen Jing, Gabriele Corso, Jeffrey Chang, Regina Barzilay, and Tommi Jaakkola. Torsional diffusion for molecular conformer generation. Advances in Neural Information Processing Systems, 2022. Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. Dpm-solver: A fast ode solver for diffusion probabilistic model sampling in around 10 steps. Advances in Neural Information Processing Systems, 2022a. 10 Preprint Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. Dpm-solver++: Fast solver for guided sampling of diffusion probabilistic models. arXiv preprint arXiv:2211.01095, 2022b. Shitong Luo, Chence Shi, Minkai Xu, and Jian Tang. Predicting molecular conformation via dynamic graph score matching. Advances in Neural Information Processing Systems, 34:19784–19795, 2021. Benjamin Kurt Miller, Mario Geiger, Tess E Smidt, and Frank Noé. Relevance of rotationally equivariant convolutions for predicting molecular properties. arXiv preprint arXiv:2008.08461, 2020. Frank Noé, Simon Olsson, Jonas Köhler, and Hao Wu. Boltzmann generators: Sampling equilibrium states of many-body systems with deep learning. Science, 365(6457):eaaw1147, 2019. Sereina Riniker and Gregory A Landrum. Better informed distance geometry: using what we know to improve conformation generation. Journal of chemical information and modeling, 55(12): 2562–2574, 2015. Kristof Schütt, Pieter-Jan Kindermans, Huziel Enoc Sauceda Felix, Stefan Chmiela, Alexandre Tkatchenko, and Klaus-Robert Müller. Schnet: A continuous-filter convolutional neural network for modeling quantum interactions. Advances in neural information processing systems, 30, 2017. Chence Shi, Shitong Luo, Minkai Xu, and Jian Tang. Learning gradient fields for molecular conformation generation. In International Conference on Machine Learning, 2021. Gregor NC Simm, Robert Pinsler, Gábor Csányi, and José Miguel Hernández-Lobato. Symmetry- aware actor-critic for 3d molecular design. arXiv preprint arXiv:2011.12747, 2020. Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020a. Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in neural information processing systems, 2019. Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.13456, 2020b. Yang Song, Prafulla Dhariwal, Mark Chen, and Ilya Sutskever. Consistency models. arXiv preprint arXiv:2303.01469, 2023. Birgit Strodel. Energy landscapes of protein aggregation and conformation switching in intrinsically disordered proteins. Journal of molecular biology, 433(20):167182, 2021. Nathaniel Thomas, Tess Smidt, Steven Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor field networks: Rotation-and translation-equivariant neural networks for 3d point clouds. arXiv preprint arXiv:1802.08219, 2018. Maurice Weiler, Mario Geiger, Max Welling, Wouter Boomsma, and Taco S Cohen. 3d steerable cnns: Learning rotationally equivariant features in volumetric data. Advances in Neural Information Processing Systems, 2018. Florian Wickelmaier. An introduction to mds. Sound Quality Research Unit, Aalborg University, Denmark, 46(5):1–26, 2003. Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In International Conference on Learning Representations, 2018. Minkai Xu, Shitong Luo, Yoshua Bengio, Jian Peng, and Jian Tang. Learning neural generative In International Conference on Learning dynamics for molecular conformation generation. Representations, 2020. Minkai Xu, Lantao Yu, Yang Song, Chence Shi, Stefano Ermon, and Jian Tang. Geodiff: A geometric diffusion model for molecular conformation generation. arXiv preprint arXiv:2203.02923, 2022. 11 Preprint Jason Yim, Brian L Trippe, Valentin De Bortoli, Emile Mathieu, Arnaud Doucet, Regina Barzilay, and Tommi Jaakkola. Se (3) diffusion model with application to protein backbone generation. arXiv preprint arXiv:2302.02277, 2023. Haotian Zhang, Shengming Li, Jintu Zhang, Zhe Wang, Jike Wang, Dejun Jiang, Zhiwen Bian, Yixue Zhang, Yafeng Deng, Jianfei Song, et al. Sdegen: learning to evolve molecular conformations from thermodynamic noise for conformation generation. Chemical Science, 14(6):1557–1568, 2023. Zihan Zhou and Tianshu Yu. Learning to decouple complex systems. In ICML, 2023. Zihan Zhou, Ruiying Liu, Chaolong Ying, Ruimao Zhang, and Tianshu Yu. Molecular conformation generation via shifting scores. arXiv preprint arXiv:2309.09985, 2023. Jinhua Zhu, Yingce Xia, Chang Liu, Lijun Wu, Shufang Xie, Yusong Wang, Tong Wang, Tao Qin, Wengang Zhou, Houqiang Li, et al. Direct molecular conformation generation. arXiv preprint arXiv:2202.01356, 2022. 12 Preprint A DIFFUSION SDES AND SCORE MATCHING OBJECTIVE Rn following an unknown distribution q0, diffusion probabilistic Given a random variable x0 ∈ models (Song & Ermon, 2019; Ho et al., 2020a; Song et al., 2020b) define a forward process xt}t∈[0,T ] following a stochastic differential equation (SDE) { dxt = f (t)xtdt + g(t)dwt, x0 q0, ∼ (17) where wt ∈ process starting from time T to 0: Rn is the standard Brownian motion. Such a forward process has an equivalent reverse dxt = (cid:2)f (t)xt − g2(t) ∇ x log qt(xt)(cid:3) dt + g(t)d ̄wt, xT ∼ q0T (xT | x0), (18) and the marginal probability densities probability flow ODE (Song et al., 2020b): T t=0 of the above SDE is the same as the following q0t(xt) } { dxt dt g2(t) 1 2 = f (t)xt − q0T (xT | This implies that if we can sample from q0T (xT ) x0) and solve Eq. 19, then the obtained x0 follows the distribution of q0(x0). The only unknown terms in Eq. 19 are q0T (xT ) and x0) converges to x log qt(xt). By choosing some specific f (t) and g(t), the distribution q0T (xT | ∇ and qT is an easy distribution for sampling like Gaussian distribution. To model qT (xT) as T x log qt(xt), we can train a score-based model sθ∗ (xt, t) s.t. x log qt(xt), xT ∼ q0T (xT | → ∞ x0). ∇ ≈ (19) ∇ θ∗ = arg min θ (cid:110) λtEx0∼q0(x0)Ext|x0 Et (cid:104) sθ(xt, t) ∥ x log q0t(xt | x0) ∥ − ∇ (cid:105)(cid:111) 2 2 , (20) where λt = λ(t) : [0, T ] equals → xt log qt(xt) for almost all xt and t (Song et al., 2020b). ∼ R++ is a weighting function, t [0, T ], . The obtained model sθ∗ (xt, t) ∇ B DIFFUSION REVERSE ODE AND ACCELERATION DPM solver (Lu et al., 2022a) is a high-order solver for the reverse diffusion ODE. Given a reverse process dxt dt = f (t)xt + g2(t) 2σt sθ (xt, t) , xT ∼ N (cid:0)0, σ2 T I(cid:1) where f (t) = d log αt dt , g2(t) = dσ2 t dt − 2 d log αt dt σ2 t . The exact solution of diffusion ODEs is xt = αt αs xs − αt (cid:90) λt λs e−λˆsθ (ˆxλ, λ) dλ, (21) (22) (23) (cid:0)xtλ(λ), tλ(λ)(cid:1) and tλ( where λt = log (αt/σt) , ˆsθ (ˆxλ, λ) = sθ ) is the inverse function of λ(t) = * λt and satisfy t = tλ(λ(t)). If we apply a first-order Taylor expansion of ˆsθ (ˆxλ, λ) w.r.t. λ at λs, we have xt = αt αs xs − αtsθ (xs, s) (cid:90) λt λs 13 e−λdλ + (cid:0)(λt − O λs)2(cid:1) (24a) Preprint = αt αs xs − σt (cid:0)eλt−λs − 1(cid:1) sθ (xs, s) + (cid:0)(λt − O λs)2(cid:1) . In our case, we take α = 1 and Eq. 24 becomes xt ≈ xs − = xs − σt (σt − (cid:16) elog σs σt (cid:17) 1 − σs) sθ (xs, s) sθ (xs, s) C INTRODUCTION OF DIFFERENTIAL GEOMETRY (24b) (25a) (25b) → In differential geometry, we consider mappings between two man- ifolds. Suppose that φ : M N is a smooth map between smooth manifolds. In our case, M denotes the manifold of pairwise dis- tances and N denotes the manifold of SE(3)-invariant coordinates. Then, φ maps a pairwise distances ̃d to a set of coordinates ̃ , i.e. C φ( ̃d) = ̃ . C The differential of φ at a point ̃d, denoted as dφ ̃d is the best linear approximation of φ near ̃d. The differential is analogous to the total derivative in calculus. Mathematically speaking, the differential dφ is a linear mapping from the tangent space of M at ̃d to the tangent space of N at φ( ̃d), which is dφ ̃d : T ̃dM Tφ( ̃d)N . If tangent vectors are defined as equivalence classes of the curves γ for which γ(0) = ̃d and we consider γ(t) as the flow of the reversed diffusion process, then the differential is given by γ)′(0), which means that dφ ̃d maps the reversed flow of pairwise distance to dφ ̃d (γ′(0)) = (φ the flow of the SE(3)-invariant coordinates. Hence, we write dφ ̃d + Figure 5: Mappings between the manifolds of pairwise dis- tances M and SE(3)-invariant conformations N . → d) (cid:17) ◦ (cid:16) ̃d + ∇ T M and ̃ + d) ∇ C ∈ (cid:17) ̃C log pσ( ̃ = d) ∇ C | C ̃d log pσ( ̃d | ̃C log pσ( ̃ = ̃ C T N . ) C | C ) by linearity. Since ∈ ̃d log pσ( ̃d ∇ ̃d log pσ( ̃d ∇ | | Rn×3/ SE(3). We can choose πN as an identical mapping. ̃C log pσ( ̃ ), where we assume that ̃d+ (cid:16) C | C ∇ The above equation also implies that dφ ̃d we use an n 3 matrix to embed C ∈ D APPROXIMATION OF dφ( ˆd) × D.1 APPROXIMATION FORMULA ∇ ̃d log pσ( ̃d Mathematically speaking, the dimension of the tangent space at every point of a connected manifold is the same as the dimension of the manifold itself. However, since there is no constraint on model's d), we still consider the tangent space of pairwise distance manifold has the output | dimension of n2 and we assume ̃d + δeuv ∈ dφ( ˆd) = dφ( ˆd) = T ̃dM for all δ > 0. We consider πN ◦ ˆxi − argmin ∥ ˆx1,...,ˆxM ̃ = [ ̃x1, . . . , ̃xn]⊤ C πN ◦ ˆxj∥ − Rn×3, we first consider ̃d + δeuv ∈ dφ( ̃d + δeuv) = [ˆx1, . . . , ˆxn]⊤ to be T ̃dM and approximate the solution of . Given a pairwise distance ̃d M and associated coordinate ˆdij (cid:80) (cid:17)2 i<j ∈ ∈ (cid:16)    ˆxu = ̃xu + ˆxv = ̃xv − ˆxk = ̃xk, 2(n δ − δ λuv, 1) λuv, 2(n k 1) − = u, v. where λuv = ̃xu− ̃xv ∥ ̃xu− ̃xv∥ . 14 ̸ Preprint Figure 6: The illustration of approximating the solution of dφ( ̃d + δeuv) Note that we can also write the solution of above as πN ◦ dφ( ̃d + δeuv) = ̃ C + δ 2(n−1) ∂ ̃duv ∂ ̃C , since ( ( ( ∂ ̃duv ∂ ̃ C ∂ ̃duv ∂ ̃ C ∂ ̃duv ∂ ̃ C )u = ( )v = ( )k = ( ∂ ∥ ∂ ∥ ∂ ∥ ̃xu − ∂ ̃ C ̃xu − ∂ ̃ C ̃xu − ∂ ̃ C ̃xv∥ )u = ̃xv∥ )v = ̃xv∥ )k = ∂ ∂ ∂ ̃xu − ∥ ∂ ̃xu ̃xu − ∥ ∂ ̃xv ̃xu − ∂ ̃xk ∥ Since dφ( ˆd) is linear, ̃xv∥ = ̃xv∥ = ̃xu − ̃xu − ∥ ̃xu − ̃xu − ∥ ̃xv ̃xv∥ ̃xv ̃xv∥ − = λuv = λuv − (26a) (26b) = 0, k = u, v (26c) ̃xv∥ πN ◦ dφ( ˆd) = dφ( ̃d + (cid:88) αijeij) i,j n2)dφ( ̃d) + (cid:88) i,j = (1 − dφ( ̃d + αijeij) (cid:88) αij 2(n 1) − = (1 n2) ̃ C + n2 ̃ C − = ̃ C + (cid:88) αij i,j 2(n 1) − + i,j ∂ ̃dij ∂ ̃ C , ∂ ̃dij ∂ ̃ C and ̃C log pσ( ̃ C|C ∇ ) = dφ ̃d( ∇ = dφ ̃d( ̃d + (cid:88) = ̃ C + ̃d log pσ( ̃d d)) | ̃d log pσ( ̃d d)) | log pσ( ̃d d) ̃dij | 1) 2(n ∇ ∇ i,j ̃dij (cid:88) ∇ = i,j − log pσ( ̃d | 1) 2(n − d) ∂ ̃dij ∂ ̃ C dφ ̃d( ̃d) ̃ C − − ∂ ̃dij ∂ ̃ C 15 (27a) (27b) (27c) (27d) (28a) (28b) (28c) (28d) ̃xu ̃xvˆxuˆxvδ2λuv−δ2λuv ̃xu ̃xu−δ2degreeuλuvδ2degreevλuv̸ Preprint Finally, we have Ct log q0t( Ct) = ∇ (cid:88) ∇d(t) ij i,j log q0t(dt | 1) 2(n − d0) ∂d(t) ij ∂ Ct (29) D.2 ERROR BOUND ANALYSIS We compute the maximum objective function value of (cid:80) mation in the case of ˆd = ̃d+δeuv. Let ∼ denotes the neighbors of node i, S∅(i, j) = that are nonadjacent to i and j, and degreei denote the degree of node i. We use ˆ C denote our approximated optimal solution, i.e. ˆ C denote the adjacent relation and SN (i) = (i, j), q (p, q) { ˆxj∥ − δ 2(n−1) = ̃ C ˆxi − + (cid:80) ∂ ̃dij ∂ ̃C (i, j) ˆdij i<j ̸∈ ̸∈ i,j p } ∥ | (cid:16) (cid:17)2 under our approxi- xj} xi ∼ | denote the set of nodes = [ˆx1, . . . , ˆxn] to (i, j) { . Formally, we have ˆxi − ∥ ˆxj∥ − (cid:17)2 ˆdij min x1,...,xn (cid:16) ≤ ˆxu − ∥ ˆxv∥ − ˆduv + (cid:88) (i,j)∈SN (u)\{(u,v)} (cid:88) (cid:16) i<j (cid:17)2 + xi − ∥ xj∥ − (cid:16) (cid:88) (i,j)∈S∅(u,v) (cid:16) ∥ ˆxi − ˆxj∥ − ˆdij (cid:17)2 ˆdij ∥ ˆxi − (cid:17)2 + (cid:17)2 ˆdij ˆxj∥ − (cid:88) (cid:16) (cid:18)(cid:13) (cid:13) (cid:13) (cid:13) ( ̃xu + ≤ 2(n δ λuv) 1) − − (cid:16) (cid:88) (i,j)∈S∅(u,v) (cid:88) ̃xj∥ − ̃xi − ∥ (cid:18)(cid:13) (cid:13) (cid:13) (cid:13) ( ̃xu + (i,j)∈SN (u)\{(u,v)} (cid:88) (i,j)∈SN (v)\{(u,v)} (cid:18)(cid:13) (cid:13) ( ̃xv − (cid:13) (cid:13) + + + (cid:18) (i,j)∈SN (v)\{(u,v)} λuv) (cid:13) (cid:13) (cid:13) (cid:13) − ̃duv − δ (cid:19)2 δ 1) − 2(n ( ̃xv − (cid:17)2 ̃dij λuv) ̃xj − 1) (cid:19)2 ̃duj (cid:13) (cid:13) (cid:13) (cid:13) − λuv) ̃xj − 1) (cid:19)2 ̃dvj (cid:13) (cid:13) (cid:13) (cid:13) − δ 2(n − δ 2(n − (cid:19)2 δ + 0 ̃xu − ∥ ≤ ̃xv∥ − ̃duv − (cid:88) δ n 1 − − (cid:18) + max ±(i,j) + max ±(i,j) ̃xu − ∥ ̃xj∥ ± (cid:18) ̃xv − ∥ ̃xj∥ ± (cid:18) (i,j)∈SN (u)\{(u,v)} (cid:88) (i,j)∈SN (v)\{(u,v)} (cid:19)2 (cid:88) δ2 + = = ≤ = (cid:18) n n 1 − (cid:32)(cid:18) n n − (cid:32)(cid:18) n n − 2n2 + n 2(n − 1 (cid:19)2 (cid:19)2 1 + + 1 1)2 δ2 − (i,j)∈SN (u)\{(u,v)} 1) (cid:33) δ2 2(n − 1 degreev − 1)2 4(n − (cid:33) 1 1)2 − − n 4(n δ2 1 degreeu − 1)2 + 4(n − 1 1)2 + n 4(n − − 16 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) δ δ 2(n − δ 2(n − (cid:19)2 (cid:19)2 ̃duj (cid:13) (cid:13) (cid:13) (cid:13) − λuv 1) (cid:19)2 ̃dvj (cid:13) (cid:13) (cid:13) (cid:13) − λuv 1) + (cid:88) (cid:18) δ (cid:19)2 (i,j)∈SN (v)\{(u,v)} 2(n 1) − (30a) (30b) (30c) (30d) (30e) (30f) (30g) (30h) (30i) (30j) (30k) (30l) (30m) (30n) Preprint Hence, the approximated optimal value is bounded above by 2n2+n−1 2(n−1)2 δ2. D.3 EXPERIMENTS OF APPROXIMATED OPTIMAL VALUE Experiment settings. We randomly generate ∼ Uniform([10, 19]). We compute the adjacent matrix d of the obtained coordinates and randomly perturb the adjacent matrix to obtain ˆd = d + δeuv. We aim to compare the magnitude of the optimal values computed under different algorithms or approximations. The optimal value is defined as the solution of the optimization problem f ( ˆd) = min ˆx1,...,ˆxn (0n×3, I) with n nodes, where n Ci ∼ N ˆdij (cid:80) (cid:17)2 i<j (cid:16) ˆxj∥ − ˆxi − ∥ . Algorithms. To our best knowledge, there is no simple algorithm for solving the metric MDS ˆxj∥ − problem ˆx1, . . . , ˆxn = argmin ˆx1,...,ˆxn inapplicable in such case since is not differentiable at x = 0. Usual convergence theorems for gradient methods are invalid under such cases and local minimum points do not need to satisfy the stationary equations (De Leeuw, 2005). Hence, we slightly modify the gradient descent process to . The usual gradient descent algorithm is ˆxi − ∥ x ∥ ˆdij (cid:80) (cid:17)2 i<j (cid:16) ∥ ˆC (t+1) = ˆC (t) + ˆC(t) ∇ (cid:16)(cid:13) (cid:13)ˆx(t) (cid:13) i − (cid:88) i<j ˆx(t) j + ε (cid:17)2 , ˆdij (cid:13) (cid:13) (cid:13) − (31) for some sufficiently small ε > 0. Then, we set ˆC (0) = ̃C = [ ̃x1, . . . , ̃xn] as the initialized value and apply the gradient descent algorithm. We visualize the magnitude of the MDS objective function obtained at ˆ G, ˆ c-MDS, computed from the proposed approximation (Eq. 9), gradient descent C C (Eq. 31) and the algorithm for the classic MDS problem, respectively. We also visualize the error bound proved in Eq. 30. The results can be seen in Fig 7. The algorithm for the classic MDS problem (c-MDS) is stated below (Wickelmaier, 2003): approx, ˆ C • 1. Set up the squared proximity matrix D = (cid:2)d2 ij (cid:3) • 2. Apply double centering: B = n is the number of objects, I is the n ones. − 1 2 P DP using the centering matrix P = I n identity matrix, and Jn is an n × × 1 n Jn, where − n matrix of all • 3. Determine the 3 largest eigenvalues λ1, λ2, λ3 and corresponding eigenvectors e1, e2, e3 of B. • 4. Now, = E3Λ1/2 3 matrix of 3 eigenvalues of B. C , where E3 is the matrix of 3 eigenvectors and Λ3 is the diagonal Metric MDS and c-MDS seek to find solution of c-MDS generally differs from the metric MDS. = [x1, . . . , xn] such that C xi − ∥ xj∥ ≈ dij but the optimal Experimental results. We see that our approximation leads to a much smaller loss than the c- MDS's, and compared with the optimal value, the gap is acceptable. As there is still improvement for optimal values, this further suggests that applying a more refined projection operator can yield additional improvements in the model's performance (Zhou & Yu, 2023). 17 Preprint Figure 7: Optimization loss of MDS w.r.t. different optimization algorithm. f ( ˆd) is the objective function of the optimization problem. E COMPUTATION OF dt log q0t(dt d0). | ∇ ∇dt log q0t(dt| We consider the score of when i.i.d. Gaussian noise is d0) where dij = injected to conformation coordinates. GeoDiff (Xu et al., 2022) naively assumes that the perturbed distances follow a Gaussian distribution. In SDDiff (Zhou et al., 2023), authors proposed a shifting d0). In this work, we consider both of probability density to approximate the distribution of q0t(dt| the above two modeling methods and train two separate models with their own loss function: xi − xj∥ ∥ (cid:16) L θ; {σi}T t=1 (cid:17) ≜ 1 T T (cid:88) t=1 1 2 Epdata(d0)Eq0t(dt|d0) ∥sθ(dt, t) + σtdφdt (∇dt log q0t(dt|d0))∥2 2 (32) GeoDiff: ∇dt log q0t(dt|d0) := − dt − d0 σ2 t SDDiff: ∇dt log q0t(dt|d0) := 1 − e−σt/d0 (cid:17) 8 (cid:16) dt − 2 dt − d0 σ2 t (33) (34) If a model sθ(dt, t) minimizes the above loss, then sθ(dt, t) σt∇ ≈ − Ct log q0t( Ct|C 0). F FACTORS RELATED TO SCALE ksθ In this section, we study factors that may influence the choice of scale ksθ . We mainly study factors including prediction error, node number, and node degree. F.1 SUPPLEMENTARY FOR POSITIVE CORRELATION BETWEEN PREDICTION ERROR AND SCALE ksθ (i) Dataset settings. We develop datasets Qi = that only contain one conformation of 20 nodes. 0 } Each conformation is a 4-regular graph (so that SE(3)-invariant conformation and pairwise distance (i) i = 1, . . . , n. Thus, the ground truth of the denoising manifolds are surjective) and (0, I), 0 ∼ N T t=1 is chosen to be the same as that in the GeoDiff and we process is fixed. The sigma scheduler σt} { try to sample conformations in 100 steps. {C ∀ C Model settings. During the denoising process, our model has the access to the ground truth d0 and following GeoDiff's assumption of the distance distribution, we want to develop a model 18 0.00.20.40.60.81.00.000.250.500.751.001.251.501.752.00f(d)/2G losscMDS lossapprox lossapprox loss upper bound Preprint (cid:17) (cid:16) dt−d0 σt d0)) = dφ ∇dt log p0t(dt | Normstd (dφ (dt − . As discussed in Eq. 13, we cannot access sθ(dt, t) = σtdφ ( the accurate information about the denoising timestamp during the denoising process, hence, we d0)). Such assumption comes from the fact that the assume that sθ(dt, t) d0)) approximately standard deviation of the score matching ground truth σtdφ ( ∇dt log p0t(dt | equals 1. Thus, the obtained model trends to output a score whose std equals 1. So, we force the output std of our model to be 1. Also, we use a hyperparameter δ to add prediction errors by letting d0) + εd(δ, t)(cid:1). But note that when δ = 0, there are still prediction sθ(dt, t, δ) = Normstd errors due to the approximated projection operator and the inaccurate distance distribution hypothesis. Finally, we define εd(δ, t) = 2(sigmoid(σt (cid:0)dφ (dt − δ)-0. 5)δz, where z (0, I). ≈ * ∼ N Detailed settings of convergence. We find that even with access to the ground truth of d0, our model cannot always converge to the ground truth at the end of the reverse process. Hence, we only consider the convergence for most samples (90% samples). Given a noise level δ and ksθ , we repeatedly apply the denoising process. If at time t0, at least 90% samples have converged, then we say that under δ, ksθ , the model converges at time t0. F.2 REVERSE FLOW ANALYSIS d0 ∥ * ∥ In the context of our investigation, we employ ∞ as a reduced-dimensional representation dt − ∥ ∥ of the reversed flow phenomenon, where dt denotes the edge lengths of the graph at time t, d0 denotes the ground truth edge lengths and ∞ denotes the maximum difference. It is well-established that the selection of the scale ksθ exerts a notable influence on the characteristics of the flow. Our primary objective is to systematically investigate whether while maintaining a constant scale parameter ksθ , other variables such as the number of nodes and node degrees exhibit substantial alterations in the reverse flow patterns. Should our findings indicate minimal variation in the reverse flow with respect to these aforementioned factors, it would enable us to posit that the choice of scale ksθ is relatively independent of their influence. We use the same settings of the sigma scheduler and the model, as discussed in the Appendix. F.1 but develop different toy datasets that contain graphs of distinct node numbers and distinct node degrees. Dataset settings. We develop two datasets with one containing a fixed node number of [10, 20, 50, 100], and each graph is a 4-regular graph and the other contains conformations of 20 nodes, and each graph is a k-regular graph, where k = 4, 5, 6. Experimental results. We visualize the flow (represented by ∞) under different node ∥ numbers and node degrees and find that these two factors have a limited effect on the flow when the scale ksθ is fixed. Results can be seen in Fig. 8a and 8b. We also visualize the reverse flow of 4-regular graphs with 20 nodes under different prediction errors. Results are shown in Fig. 8c. Compared with Fig. 8a and 8b, we can see that the flow under different settings of the model's error shows great difference and we conclude that prediction error is the main factor that affects the choice of scale ksθ . dt − d0 ∥ G EXPERIMENT EXTENSION G.1 SETTINGS Evaluation. We use the COV and MAT metrics for Recall (R) and Precision (P) to evaluate the diversity and quality of generated conformers. These metrics are built on the root-mean-square- deviation (RMSD) of heavy atoms. COV can reflect the converge status of ground truth conformers, and MAT denotes the average minimum RMSD. The calculation for COV-R and MAT-R is: COV-R = 1 Sr| | {C ∈ Sr| RMSD( C , C ′) < τ, ′ ∃C ∈ Sg} , MAT-R = 1 Sr| | (cid:88) C′∈Sg RMSD( C ′) , C where Sg and Sr denote generated and ground truth conformations. Sweeping Sg and Sr, we obtain the COV-P and MAT-P. The MAT is calculated under RMSD threshold τ . Following previous work, we set τ = 0.5Å for GEOM-QM9 and τ = 1.25Å for GEOM-Drugs. 19 Preprint (a) node number v.s. scale (b) node degree v.s. scale (c) model error v.s. scale Figure 8: Ablation study of factors that may affect the scale ksθ . The y-axis denotes the flow represented by ∞ and the x-axis denotes the denoising steps t. We can clearly see that the d0 ∥ prediction error greatly affects the reverse flow. dt − ∥ Training details We adopt the same backbone network from GeoDiff. The backbone consists of local and global parts. The local part is GIN (Xu et al., 2018) and the global part is SchNet (Schütt et al., 2017). We trained the model on a single NVIDIA GeForce RTX 3090 GPU and Intel(R) Xeon(R) Silver 4210R CPU @ 2.40GHz CPU. We use the Adam optimizer for training, with a maximum of 1000 epochs. We set the learning rate to 0.001, and it decreases by a factor of 0.6 every 2 epochs. The batch size is 64. For SDDiff, the parameter only updates when loss satisfies two conditions: loss of the global part is lower than 0.75 on QM9 dataset or 2 on Drugs dataset, and total loss is lower than 10. We set the steps of the diffusion process to 5000, the noise scheduler to βi) and βt = sigmoid(t). t is uniformly selected in [1e-7, 2e-3], σt = and the magnitude of σt is in the range of 0 to around 12. where ̄αt = (cid:81)t (cid:113) ̄αt 1− ̄αt i(1 − G.2 MORE HYPER-PARAMETER ANALYSIS In Sec. 5.4 we have investigated the influence of the hyper-parameter in LD sampling and our fast sampling. We conduct the same hyper-parameter analysis on QM9 dataset here. As shown in Fig. 9, we can draw a similar conclusion, that when ksθ and h are over a certain value, the P-series metrics 20 1008060402000246810scale = 1.51008060402000246810scale = 21008060402000246810scale = 2.5Number of atoms1020501001008060402000246810scale = 1.51008060402000246810scale = 21008060402000246810scale = 2.5k-regular4561008060402000246810scale = 1.51008060402000246810scale = 21008060402000246810scale = 2.5Noise level1246 Preprint Figure 9: The influence of hyper-parameter, namely scale ksθ and step size h. Note that higher values of COV in the row above are preferable, whereas in the row below, higher MAT values are undesirable. Values falling below the defined thresholds (COV lower than 0.2 or MAT higher than 2.5) are disregarded and indicated as missing points in the figure. become very poor. We think the reason is due to the low robustness of the network we use, details have been introduced in Sec. 5.4. G.3 MORE EXPERIMENTS IN FEWER STEPS We have shown results on fewer steps for GeoDiff on Drugs dataset in Sec. 5.5 to illustrate that our methods have a certain level of robustness. Here we report the more experiments in fewer steps in Fig. 10. 21 12345scale0.8000.8250.8500.8750.900COV-R mean12345scale0.860.880.900.920.940.96COV-R median12345scale0.400.450.500.55COV-P mean12345scale0.350.400.450.50COV-P median12345scale0.30.40.50.6MAT-R mean12345scale0.30.40.50.6MAT-R median12345scale246MAT-P mean12345scale0.500.751.001.251.50MAT-P median0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step sizeHyper-parameter analysis of sampling methods on QM9 datasetFast sampling for GeoDiffLD samping for GeoDiff12345scale0.40.60.8COV-R mean12345scale0.850.900.95COV-R median12345scale0.300.350.400.450.500.55COV-P mean12345scale0.250.300.350.400.450.50COV-P median12345scale0.30.40.50.6MAT-R mean12345scale0.30.40.50.6MAT-R median12345scale0.751.001.251.501.75MAT-P mean12345scale0.500.751.001.251.501.75MAT-P median0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step size0.070.090.10.30.50.7step sizeHyper-parameter analysis of sampling methods on QM9 datasetFast sampling for SDDiffLD samping for SDDiff Preprint Figure 10: Results of our fast sampling method in fewer steps. The results of LD sampling in 5000 steps are shown as dashed horizontal lines. Points with poor MAT metric (higher than 2.5) are dropped in the figure. 22 2345scale0.840.860.880.90COV-R mean2345scale0.880.900.920.940.96COV-R median2345scale0.420.440.460.480.500.52COV-P mean2345scale0.3750.4000.4250.4500.4750.500COV-P median2345scale0.260.280.300.320.34MAT-R mean2345scale0.260.280.300.320.34MAT-R median2345scale0.500.751.001.251.501.752.00MAT-P mean2345scale0.60.81.01.2MAT-P medianFewer steps of fast sampling for GeoDiff on QM9 datasetOur method in 80 stepsOur method in 50 stepsOur method in 30 stepsLD sampling with 5000 stpes2345678scale0.00.20.40.6COV-R mean2345678scale0.00.20.40.60.8COV-R median2345678scale0.00.10.20.30.40.50.6COV-P mean2345678scale0.00.20.40.6COV-P median2345678scale1.21.41.61.82.0MAT-R mean2345678scale1.21.41.61.82.02.2MAT-R median2345678scale1.41.61.82.0MAT-P mean2345678scale1.21.41.61.82.02.2MAT-P medianFewer steps of fast sampling for SDDiff on Drugs datasetOur method in 80 stepsOur method in 50 stepsOur method in 30 stepsLD sampling with 5000 stpes2345scale0.20.40.60.8COV-R mean2345scale0.20.40.60.81.0COV-R median2345scale0.00.10.20.30.40.5COV-P mean2345scale0.00.10.20.30.40.5COV-P median2345scale0.30.40.50.60.7MAT-R mean2345scale0.30.40.50.60.7MAT-R median2345scale1.01.52.02.5MAT-P mean2345scale0.51.01.52.0MAT-P medianFewer steps of fast sampling for SDDiff on QM9 datasetOur method in 80 stepsOur method in 50 stepsOur method in 30 stepsLD sampling with 5000 stpes Preprint H VISUALIZATION OF SAMPLING PROCESS We visualize the generation process of an example conformer via our fast sampling process. As shown in Fig. 11, the conformer will determine the basic structure in very early steps, and the structure will undergo only minor adjustments in the subsequent majority of steps. This indicates that it is possible to obtain a faster sampling method. (a) Sampling process in 100 steps 23 Preprint (b) Sampling process in 80 steps (c) Sampling process in 50 steps (d) Sampling process in 30 steps Figure 11: Visualization of sampling process in different steps for GeoDiff on Drugs 24
http://arxiv.org/abs/2310.05988v1
"2023-10-07T19:35:07"
"2023-10-07T19:35:07"
A Dual Latent State Learning Approach: Exploiting Regional Network Similarities for QoS Prediction
Individual objects, whether users or services, within a specific region often exhibit similar network states due to their shared origin from the same city or autonomous system (AS). Despite this regional network similarity, many existing techniques overlook its potential, resulting in subpar performance arising from challenges such as data sparsity and label imbalance. In this paper, we introduce the regional-based dual latent state learning network(R2SL), a novel deep learning framework designed to overcome the pitfalls of traditional individual object-based prediction techniques in Quality of Service (QoS) prediction. Unlike its predecessors, R2SL captures the nuances of regional network behavior by deriving two distinct regional network latent states: the city-network latent state and the AS-network latent state. These states are constructed utilizing aggregated data from common regions rather than individual object data. Furthermore, R2SL adopts an enhanced Huber loss function that adjusts its linear loss component, providing a remedy for prevalent label imbalance issues. To cap off the prediction process, a multi-scale perception network is leveraged to interpret the integrated feature map, a fusion of regional network latent features and other pertinent information, ultimately accomplishing the QoS prediction. Through rigorous testing on real-world QoS datasets, R2SL demonstrates superior performance compared to prevailing state-of-the-art methods. Our R2SL approach ushers in an innovative avenue for precise QoS predictions by fully harnessing the regional network similarities inherent in objects.
[ "Ziliang Wang", "Xiaohong Zhang", "Meng Yan" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.05988v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.05988v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
A Dual Latent State Learning Approach: Exploiting Regional Network Similarities for QoS Prediction Xiaohong Zhang* Chongqing University China, Chongqing xhongz@cqu.edu.cn Meng Yan Chongqing University China, Chongqing mengy@cqu.edu.cn Ziliang Wang Chongqing University Peking University China, Chongqing wangziliang@pku.edu.com 3 2 0 2 t c O 7 ] G L . s c [ 1 v 8 8 9 5 0 . 0 1 3 2 : v i X r a ABSTRACT Individual objects, whether users or services, within a specific region often exhibit similar network states due to their shared origin from the same city or autonomous system (AS). Despite this regional network similarity, many existing techniques overlook its potential, resulting in subpar performance arising from challenges such as data sparsity and label imbalance. In this paper, we introduce the regional-based dual latent state learning network(R2SL), a novel deep learning framework designed to overcome the pitfalls of tradi- tional individual object-based prediction techniques in Quality of Service (QoS) prediction. Unlike its predecessors, R2SL captures the nuances of regional network behavior by deriving two distinct regional network latent states: the city-network latent state and the AS-network latent state. These states are constructed utilizing aggre- gated data from common regions rather than individual object data. Furthermore, R2SL adopts an enhanced Huber loss function that adjusts its linear loss component, providing a remedy for prevalent label imbalance issues. To cap off the prediction process, a multi- scale perception network is leveraged to interpret the integrated feature map, a fusion of regional network latent features and other pertinent information, ultimately accomplishing the QoS prediction. Through rigorous testing on real-world QoS datasets, R2SL demon- strates superior performance compared to prevailing state-of-the-art methods. Our R2SL approach ushers in an innovative avenue for precise QoS predictions by fully harnessing the regional network similarities inherent in objects. CCS CONCEPTS • Do Not Use This Code → Generate the Correct Terms for Your Paper; Generate the Correct Terms for Your Paper; Generate the Correct Terms for Your Paper; Generate the Correct Terms for Your Paper. KEYWORDS Service recommendation, QoS prediction, Probabilistic network, Deep supervision ACM Reference Format: Ziliang Wang, Xiaohong Zhang, and Meng Yan. 2018. A Dual Latent State Learning Approach: Exploiting Regional Network Similarities for QoS Pre- diction. In Proceedings of Make sure to enter the correct conference title from your rights confirmation emai (Conference acronym 'XX). ACM, New York, NY, USA, 9 pages. https://doi.org/XXXXXXX.XXXXXXX Conference acronym 'XX, June 03–05, 2018, Woodstock, NY 2018. ACM ISBN 978-1-4503-XXXX-X/18/06. . . $15.00 https://doi.org/XXXXXXX.XXXXXXX INTRODUCTION 1 In the modern era where "everything is a service," discerning how to recommend optimal Web services to distinct users becomes paramount[18, 33]. Concurrently, certain microservice optimiza- tion methods necessitate precise predictive QoS modules[9, 19]. The network states undeniably play a pivotal role in QoS prediction for service recommendations. Yet, predicting QoS remains intricate, primarily due to challenges in capturing most object network states caused by financial and privacy constraints. Further compounding the problem, QoS data is frequently characterized by sparsity and im- balance, thus complicating predictions. Addressing these challenges, our work introduces an innovative approach that models latent net- work states regionally, deviating from conventional strategies that emphasize known network state features or individual object-based latent states. Significant challenges like data sparsity and label imbalance sig- nificantly impair QoS prediction accuracy. Data sparsity emerges from the reality that despite the myriad of web services within the recommendation system, users typically access only a subset, re- sulting in sparse usage logs. Capturing network state details about users or service providers becomes arduous due to privacy stip- ulations and the associated high acquisition costs. Collaborative filtering (CF) serves as a prevalent solution to tackle this issue in QoS prediction[34]. While CF attempts to alleviate data sparsity effects by identifying similar objects using available data, it tends to disproportionately rely on location-based information, neglecting substantial network state data. To delve deeper into network state insights, several QoS prediction strategies emphasizing latent factors (LF) have been proposed[15, 25]. Wang et al., for instance, utilized a latent state learning model to discern the network latent states of individual users and services[25]. However, these LF-centric strate- gies grapple with challenges like the cold start issue, data sparsity, and the intricate task of discerning latent user states, undermining their efficacy. The label imbalance dilemma originates from the disproportion- ate QoS data representation: the majority stemming from standard access procedures and only a fractional portion from abnormal ac- cesses. For instance, the WS-Dream dataset's response time (RT)[32] spans from 0s to 20s. A predominant portion of this data – over 98% – is concentrated in the 0s to 5s range, with merely 2% ex- tending beyond 5s. Various remedies such as data augmentation, re-sampling, and enhanced robustness loss functions have been proposed to counter this issue[2, 13]. Techniques like leveraging anomaly detection algorithms to eliminate outliers have also been explored[2, 30]. Nonetheless, these methods often don't holistically Conference acronym 'XX, June 03–05, 2018, Woodstock, NY Trovato and Tobin, et al. c) Comprehensive experimentation evaluating the R2SL ap- proach's effectiveness on real-world QoS datasets. Experi- mental outcomes highlight R2SL's superior performance over existing state-of-the-art QoS prediction methodologies. 1. 2 RELATED WORK The existing body of work primarily hinges on two pivotal ap- proaches for QoS prediction: Collaborative Filtering (CF) and Deep Learning (DL) methods. 2.1 CF-Based Approaches Collaborative Filtering (CF) remains a predominant strategy for QoS prediction, where models draw insights from analogous objects to forecast the QoS [3–5, 12, 32]. Broadly, CF methodologies bifurcate into: memory-based and model-based methods. Memory-based methods lean on QoS metrics (e.g., response time, network throughput) or attributes (like distance) as differentiation indices among objects. The cornerstone of these techniques lies in computing similarities with the object in focus. Foundational CF strategies encompass user-based (e.g., UPCC)[23], service-based (e.g., IPCC)[22], and their hybrids, such as UIPCC [17]. Notably, ini- tiatives like GroupLens and Bellcore harnessed similar user reviews to prognosticate other users' service sentiments [10]. Conversely, model-based methods, especially matrix factorization (MF), have gained traction. These entail factorizing a request matrix into a product of two state matrices for QoS prediction. Illustratively, Luo et al. innovated a non-negative matrix decomposition for swift user-service matrix training [14]. Others, like He et al., advanced hierarchical matrix factorization for clustered QoS matrices [7]. Also noteworthy is the Factorization Machine (FM), a pervasive method that discerns object feature interactions [20]. Variations of FM, such as those proffered by Tang et al., married CF with FM to optimize mobile service QoS predictions [24]. However, a recurring challenge with these methods is their limited capacity to effectively harness available information. Recent advancements are gravitating towards exploiting con- textual object information (like IP or location) to amplify predic- tion accuracy. Yang et al.'s FM-based model, which utilized neigh- boring user information, is a case in point [29]. Similarly, latent factor-focused QoS prediction methods are gaining popularity for their precision and scalability [6, 11, 21]. Luo et al.'s non-negative constrained latent factor learning model (NLF) exemplifies this shift [15]. 2.2 Deep Learning-Based Approaches The allure of Deep Learning (DL) for QoS prediction has surged recently, given its capacity to directly infer the intricate relationships between latent object features and QoS via deep neural networks. Our R2SL method aligns with this paradigm, aspiring for utmost predictive accuracy. A plethora of research has been centered on harnessing extant information for optimizing prediction precision. For instance, Zhou et al.'s spatio-temporal model leveraged varying time segments to refine QoS prediction accuracy [35]. Wu et al. tapped into contextual 1Our replication package: The code base address will be updated after the paper is publicly available Figure 1: Objects typically exhibit network-state similarity within a region, especially if the regional network operates under the same autonomous system (AS). address the QoS imbalance, potentially hindering prediction perfor- mance. Summarizing, the two principal challenges are: (1) Data Sparsity: encompassing both feature sparsity of objects and their QoS record sparsity. (2) Label Imbalance: extreme QoS record imbalances that detri- mentally impact prediction model performance. To surmount these challenges, we introduce the regional net- work latent state learning (R2SL) approach, which adeptly harnesses regional network latent states to achieve precise QoS predictions. R2SL encompasses two regional network latent state varieties: city- network and AS-network. The city-network latent state derives in- sights from QoS data corresponding to objects from a specific city, while the AS-network latent state analyzes data from objects sharing an autonomous system. Initially, R2SL employs latent probability learning algorithms to frame regional network latent states, coun- teracting data sparsity effects in QoS prediction. Subsequently, an enhanced Huber loss function is deployed, modulating the linear loss component to tackle label imbalances. Lastly, a multi-scale convolution network extracts insights from the fused feature maps, which consolidate known features and regional network latent states, ensuring high-accuracy QoS predictions. Our R2SL model offers two groundbreaking advances in QoS prediction. Firstly, we introduce the innovative concept of modeling regional latent network states as opposed to individual ones. This strategy capitalizes on regional QoS data to counter data sparsity, as illustrated in Fig. 1. Secondly, we present an optimized Huber loss function to elevate QoS prediction accuracy. Through meticulous analysis of QoS data label distributions, we fine-tuned the loss func- tion to strike an optimal balance in the model's learning capability for unbalanced labels, bolstering prediction performance. In summary, this paper's primary contributions are: a) Introduction of the R2SL approach, designed to harness re- gional network latent states, addressing data sparsity and cold start challenges in QoS prediction. By gleaning latent states from diverse regional networks, R2SL promises enhanced recommendation precision. b) Analysis of QoS data distribution characteristics, pinpointing label imbalance as a significant impediment. We introduce an enhanced Huber loss function, aiming to combat label imbalance and optimize prediction accuracy. Regional A1UserServiceRegional A2Regional A3ASASASRegional-NetworkIndividual objects: A Dual Latent State Learning Approach: Exploiting Regional Network Similarities for QoS Prediction Conference acronym 'XX, June 03–05, 2018, Woodstock, NY information with their Deep Neural Model (DNM) for multi-metric QoS forecasting [27]. Typically, DL necessitates an abundance of valid information to decipher the nonlinear relationships between features and anticipated labels. Novel endeavors, such as Xiong et al.'s deep hybrid model, further excavate additional information through a multi-layer perceptron (MLP)[28]. Others, like Wang et al., elevate predictive accuracy by discerning users' and services' varied latent states using an LDA-based pre-training mechanism[25]. Predominantly, current DL-based QoS methodologies orbit around individual objects. Our R2SL proposition draws inspiration from object-centric la- tent state learning approaches [16, 25]. The distinguishing facet of R2SL, in contrast to its peers, is its proficiency in discerning distinct network states per region. This granularity allows R2SL to learn latent states more effectively by capitalizing on a broader data swath. 3 APPROACH The architecture of R2SL, depicted in Fig.2, comprises two primary modules: regional network latent state learning and QoS prediction. 3.1 Regional Network Latent State Learning 3.1.1 Latent Regional State Variable. Define L = (U , S,T , Las, Los, Cs, Ass, Lau, Lou, Cu, Asu ), where U and S represent the user and service IDs, respectively. C and As denote city code and AS code, respectively. T signifies the response time for user Ui requesting Si , constrained to 0s < T < 20s. Ge- ographical and network metadata for services are represented by Las, Los, Cs, Ass , and by Lau, Lou, Cu, Asu for users. The latent states set B = {bk } (where 1 < k < m) encompasses m latent state vari- ables needed by the services' regional network and provided by the users' regional network to conduct activities. To determine the latent distribution of regional states, we employ a latent state learning algorithm. This approach aids in discerning the latent network states across diverse cities and AS. We initiate by defining two distributions, Θs and Θu , symbolizing the AS-network state frequencies for users and services respectively. Analogously, for the city-network latent distribution, we have δs and δu . Their mathematical representation is: Θs, Θu, δu, δs ∼ Dirichlet (α) (1) To refine these frequency variables, we introduce the Dirichlet Distribution characterized by parameter α. α acts as the starting value of the potential state and, by default, is set to 5. In essence, the prior distribution for the latent service-AS network state is given by Q = (cid:206)m (Θsi )α −1÷B(α) and that for city-as states is Q (Θu ; α). The procedure mirrors for δu and δs . 3.1.2 Assignment Probability on Latent Regional State. The city network latent state for each user and service. Given L and B, the probability of assigning latent city network state bi to user network Cu j is defined by (cid:205)j=i | bi ) = 1. Similarly, the probability of assigning latent city network states bi to service city Cs j is defined by P (s j | bi ). n P (u j The AS network potential state for each user and service. The probability of assigning latent AS network states bi to user AS Asu j is Pa (u j | bi ) and the probability of assigning latent AS network states bi to the service' Ass j is Pa (s j | bi ). (2) (3) For presentation brevity, we denote P (u j | bi ) by βs {i,j } and P (u j | bi ) by βu {i,j } . As the figure shows, for AS latent states, there are also βas and βau . The matrix βs = βs {i,j } to denote the probability for assigning all m latent city network states to all Cui and βu = βu {i,j } to denote the probability for assigning all m latent service network states to all Csi .Similarly, we have βau for ASu and βas for ASs . 3.1.3 Latent Parameters for RT. To model the nuanced influence of various regional state fre- quencies and assignments on QoS, we identify primary contributing factors that are the statistical properties of RT; these are termed as the Latent Parameters for RT. Central to various QoS metrics is the step of sampling QoS value Ti given the i-th QoS record L. In our discussion, Ti represents the response time, although other metrics can be substituted. The obser- vation value T is susceptible to changes in the network states. Let Φ represent the probability density function based on the exponential distribution: Φ(Ti, λi,j,k ) = λi,j,ke (−Ti ∗λi,j,k ) where λ−1 i,j,k = (cid:40)W uiW s j W uiW s jw else if Ti < η Here, i stands for the user's city code (or AS code) and j for the service's city (or AS code) in the i-th record. Both Wu and Ws represent the complexity coefficients related to the QoS for users and services, respectively. They are initialized to a value of 10. The constant η defaults to 5, while w, a trainable penalty coefficient, starts with an initial value of 50. 3.1.4 State Sampling. City network state sampling: City network state sampling: Our analysis follows this sampling methodology: the latent state originates from a state set of magnitude m, drawn in accordance with the frequency Θu . Explicitly, the probability of latent states associated with ui is denoted as Zu : Zu |Θu ∼ Discrete (Θu ) (4) In a similar vein, the probability of the latent state associated with si is expressed as Zs : Zs |Θs ∼ Discrete (Θs ) AS network state sampling: Analogous computations yield: Ts |δs ∼ Dirichlet (δs ) For the user's AS-network Asui , we have: Tu |δu ∼ Dirichlet (δu ) (5) (6) (7) 3.1.5 City/AS latent state Assignment. Then we assign the probability of the network state Zu to user's city-network state and assigning service's city-network Zs for each QoS record. To model the relation between the states Zu and Zs , we use the assignment probability βs as the parameter. The service's city Cs j with network states Zs {i } is sampled from the following distribution: Cs |Zs, βs ∼ Discrete (βs {Zs } ) (8) It means that the conditional probability of Cs given the network state zsi is exactly βs {Zs } . Conference acronym 'XX, June 03–05, 2018, Woodstock, NY Trovato and Tobin, et al. Figure 2: The R2SL architecture: regional network latent state learning (highlighted in orange) and the multi-scale convolutional prediction network. c○ indicates concatenation operations. Similarly, we introduce the user's city-network latent state assign- where ment probability βu to get the conditional probability Cu |Zu, βu ∼ Discrete (βu {Zu } ) (9) βs and βu have size nu x m and ns x m respectively with m indepen- dent mixture ability components. nu and ns are the number of cities where the user is located and the number of cities where the service is located Similarly, for AS-Network, we have Aau , Aas . 3.1.6 Quality of Service Sampling. The most important step is sampling response time Ti given the i QoS record L. Ti as the object of observation is affected by differ- ent factors of users and services. For each record, the conditional probability is used to represent its distribution: Ti |Zu, Zs, Aau , Aas ,Wu,Ws, w ∼ Φ(Ti ; λi,j,k ) (10) where f is the exponential distribution whose expectation is Φ as defined in eq 2. 3.1.7 Parameter estimation. City-network Latent State. The Λ(βu, βs, Θu, Θs, w,Wu,Ws ) is the set of parameters for city-network latent state. To complete the parameter estimation process, R2SL uses the maximum a posteriori (MAP) algorithm. The distribution P (Λ|L) is learned by the true label L. The calculation process is as follows: τi,j,k = βu{ j,Cui }βs { j,Csi }Θu{ j }Θs {k } 1 B (M ) m (cid:214) i=1 (Θs {i }Θs {i } )M −1 (12) Where Cui and Csi represent the city code or AS code of the i-th QoS recorded In order to estimate the parameter set {Θu, Θs, Cu, Cs }, the expectation-maximization (EM) algorithm is used, At the same time, the set {Wu,Ws, w } are estimated with the gradient descent (GD) algorithm. AS-network Latent State. Γ(δu, δs, βau, βas, wa,Wua ,Wsa ) is a set of parameters for AS-network latent state. The specific calculation process is as follows: Pa (φ |L) = n (cid:214) m ∑︁ m ∑︁ i=1 j=1 k=1 Φ(Ti ; λi,j,k )τi,j,k (13) where τi,j,k = βau { j,Asui } βas { j,Assi }δu{ j }δs {k } 1 B (M ) m (cid:214) (δs {i }δs {i } )M −1 i=1 (14) In Algorithm 1, we update the probability distribution of latent network state: F t i,j,k = P (Cui, tk |Cui, Csi, ti, Γ) = τi,j,k Φ(Ti j ; λi,j,k ) (15) P (Λ|L) = n (cid:214) m ∑︁ m ∑︁ i=1 j=1 k=1 Φ(Ti ; λi,j,k )τi,j,k (11) We use maximizing the condition expectation to update parameters Γ. Θt +1 s , Θt +1 u , βt +1 s , βt +1 u = maxT (Γ|Γt ) (16) Linear layerKnow FeaturesFusion Feature MapAAAAuuAAAAssRRRRCCssRRRRββAAnnββAA2ββAA1...ββummnnmmββssCRegional Network Latent State Learningββnnββuu2ββuu1...ββaassnnββaass2ββaass1...ββauunnββauu2ββauu1...CCuuLinear layerθθuuθθAAδδssδδuuZZAAiiZZuuiiTAAiiTuuiiOutputAS-network latent stateCity-network latent stateIDLongitudeLatitudeIDLongitudeLatitudeCityASCityASService:Cov 5x1Cov 5x3Cov 5x5User:ββaassββauuCMulti-scale Convolutional Prediction NetworkFlattenFlattenFlatten A Dual Latent State Learning Approach: Exploiting Regional Network Similarities for QoS Prediction Conference acronym 'XX, June 03–05, 2018, Woodstock, NY Algorithm 1 Network Latent State Learning Algorithm Require: L Ensure: (βau, βas , βu, βs ) for H = 1 to 2 do while τt +1/τt > γ do for i = 1 to n do for j = 1 to m do for k = 1 to m do Gt i,j,k = τi,j,k Φ(Ti ; λi,j,k ) end for end for end for for i = 1 to m do Θt +1 u = Θt +1 = s if H==1 then (cid:205)m (m−1)n+(cid:205)n i′ k=1 =1 n (m (m−1)+1) (cid:205)m (m−1)n+(cid:205)n i′ j =1 =1 n (m (m−1)+1) Gt i′ ,i,k Gt i′ ,j,i (cid:205)m k=1 Gt i′ ,i,k I (Cui = q) (cid:205)m j=1 Gt i′ ,j,i I (Csi = p) (cid:205)m k=1 Gt i′ ,i,k I (Asui = q) (cid:205)m j=1 Gt i′ ,j,i I (Assi = p) for q = 1 to ncu do u {i,q } = (cid:205)n βt +1 i′ =1 end for for p = 1 to ncs do s {i,q } = (cid:205)n βt +1 i′ =1 end for end if if H==2 then for q = 1 to nau do au {i,q } = (cid:205)n βt +1 i′ =1 end for for p = 1 to nas do as {i,q } = (cid:205)n βt +1 i′ =1 end for end if end for if H==1 then for q = 1 to ncu do i + ρ ∗ = W ut W ut +1 i end for for q = 1 to ncs do W st +1 i = W st i + ρ ∗ ∂P (Γ |L)t ∂W ut i ∂P (Γ |L)t ∂W st i end for t = t + 1 wt +1 = wt + ρ ∗ τt +1 = P (Γ|L) ∂P (Γ |L)t ∂wt end if if H==2 then for q = 1 to ncu do i + ρ ∗ = W ut W ut +1 i end for for q = 1 to ncs do ai = W st W st +1 ai + ρ ∗ ∂P (Γ |L)t ∂W ut i ∂P (Γ |L)t ∂W st ai end for t = t + 1 wt +1 a = wt + ρ ∗ τt +1 = P (Γ|L) ∂P (Γ |L)t ∂wt a end if end while end for return (βau, βas ,βu, βs ) T (Γ |Γt ) = = n ∑︁ m ∑︁ m ∑︁ i=1 n ∑︁ j =1 m ∑︁ k=1 m ∑︁ i=1 j =1 k=1 log (P (Γ |Q ) )F t i,j,k log (τi,j,k Φ(Ti j ; λi,j,k ) )F t i,j,k Then we have: Θt +1 s = argΘumaxT (Γ|Γt ) (cid:205)m (cid:205)n i′ =1 = + (m − 1)n k=1 F t i′ ,i,k n(m(m − 1) + 1) (17) (18) Similarly, by the derivative calculation, we update Θt +1 consider βu , with the constraint (cid:205)nu solving: u . Next, we j βu{ j,q } = 1. We update βu by βt +1 u j,p =argβu n ∑︁ maxT (Γ|Γt ) m ∑︁ = F t i,j,k I (Cui = q) Similarly, for βs : i=1 k=1 maxT (Γ|Λt ) βt +1 sk,q =argβs n ∑︁ = m ∑︁ i=1 j=1 F t i,j,k I (Csi = p) (19) (20) where I (Cui = q) means that the final value of the function is 1 when user's city code is equal to q and 0 otherwise; I (Csi = q) means that the value of the function is 1 when service's city code is equal to p and 0 otherwise. Finally, we obtain the user city-network latent state distribution βu and the service city-network latent state distribution βs through Algorithm 1. For AS-network latent state learning, we replace the city information in Algorithm 1 with the AS information and obtain βau , βas by the same calculation process. 3.2 QoS Prediction Feature Embedding. For deep neural networks to effectively learn prominent features, we input identifiers such as the user ID, user's city code, AS code, service ID, service's city code, and AS code into the embedding layer provided by TensorFlow. Conceptually, the embedding layer can be regarded as a linear layer where the bias is 0 [12]. Using this approach, the distinguishable features (i.e., ID, city code, and AS code) are mapped into distinct vectors. Known Feature. We create the integrated known feature map by embedding the known features as discussed in L(Sec.3.1.1). The dimensions of this known feature map are defined as: KF = (cid:20)Ik u , Lak s , Lak Ik u, Lok s , Lok u, U k s , U k u , Ask u s , Ask s (cid:21) (21) Regional Network Latent States Feature. To construct the latent states map, we employ city-network latent features combined with AS-network latent states. By default in the R2SL framework, the model extracts m latent states for each region, with m defaulting to 5. The impacts of varying m and related parameters are elaborated upon in Sec.5.4. Thus, the dimensions of the latent states map are Conference acronym 'XX, June 03–05, 2018, Woodstock, NY Trovato and Tobin, et al. 4 × m: LF = βk , u,1 βk , s,1 βk , au,1 βk , as,1 βk , u,2 βk , s,2 βk , au,2 βk , as,2 Fuse Feature Map. By integrating latent state features with known features, we derive the fused feature map. The resulting dimensions of this map are 6 × m. βk u,m βk s,m βk au,m βk as,m * * * * * * * * * * * *                   (22) O = (cid:21) (cid:20)KF LF (23) Adjustable Multi-scale Convolutional Network. Our approach extracts features via a Adjustable multi-scale convolutional network, which enables extraction from varying perspectives of the fused features. The kernel size will change adaptively according to the number of latent network state you set. Xi = f (O; wi ), i = 1, 2, 3. (24) Here, wi denotes a 2-dimensional convolutional kernel. The kernels for the three convolutional networks are defined as mx1, mx3, and mx5, respectively. Subsequently, we integrate the fusion features with sampling features and channel them through a convolutional layer. The final QoS prediction is achieved via a fully connected network: x = F (X1) ⊕ F (X2) ⊕ F (X3). ˆy = f [2v,2v−1,2v−2,1] (x; Wx ). (26) where Φ is represents the mergence operation. F is represents the flatten operation by Flatten of Keras. f [2v,2v−1,2v−2,1] denotes the fully connected layer, V is the count of neurons in this layer, and ˆy the prediction value. (25) 3.3 E-Huber Loss Function For QoS prediction, the Mean Absolute Error (MAE) loss function is prevalently employed. The MAE loss function directs the model to concentrate on normal values, while being minimally affected by outliers. Some research has adopted the Huber loss to enhance the model's attention to outliers. Broadly speaking, the Huber loss demonstrates higher sensitivity to outliers compared to the MAE loss and exhibits greater robustness than the Root Mean Square Error (RMSE) loss. In our exploration of QoS data distribution detailed in Sec. 4, we discerned that the linear component of the Huber loss remains significantly large, causing the model to still not adequately focus on outliers. R2SL addresses this by re-weighting the linear component of the Huber loss function in accordance with the intrinsic character- istics of the QoS data distribution. The novel loss function, termed the E-Huber loss, is adept at capturing the extended tail of QoS data. The E-Huber loss function between y and ˆy is given by: E − Huberloss (y, ˆy) = 1 2 (y − ˆy)2 (cid:26) ψ (ς |y − ˆy|abs − 1 2 i f |y − ˆy|abs < ς, otherwise. ς 2) (27) Here, y represents the actual label, ˆy is the predicted value, and ς is the Huber loss hyperparameter, defaulting to 0.5. Motivation and Improvement. The Huber loss function boasts enhanced resilience to outliers as opposed to both MAE and MSE Table 1: Division of all designed dataset cases. No. D1.1 D1.2 D1.3 D1.4 D1.5 Density 0.02 0.04 0.06 0.08 0.10 Train:Test:Valid 2%:78%:20% 4%:76%:20% 6%:74% :20% 8%:72% :20% 10%:70% :20% Train 37,375 74,969 112,016 150,071 186,059 Test 1,310,535 1,572,292 1,206,517 1,172,461 1,140,269 Validation 369,638 369,638 369,638 369,638 369,638 (a) QoS data distribution (b) Data distribution of five user (c) A user accesses service 0-1000 (d) User 0-350 accesses the service A Figure 3: QoS distribution of datasets loss functions. As per its definition, Huber loss equates to RMSE when the error is smaller than ς. Conversely, for errors surpassing ς, the loss corresponds to MAE. Nonetheless, extreme values in QoS data render the Huber loss suboptimal for directing model training. For instance, a long-tail label (e.g., 20s) might yield a linear loss exceeding 15, while a standard label (e.g., 1.5s) might result in an MSE loss approaching 0.25. This pronounced disparity causes the model to be disproportionately swayed by long-tail labels. To mitigate this, we introduced a weighting factor to the linear loss segment. Manipulating this coefficient's value permits the model to more proficiently characterize the long-tail labels. Therefore, diverging from the traditional Huber loss function, ψ acts as the weight for the linear loss component, and is set at 0.05 in this paper. 4 STUDY SETUP 4.1 Datasets We conducted validation experiments on publicly available bench- mark datasets. The QoS dataset, termed WS-Dream, contains service data harvested from real-world web systems as detailed by [32]. As depicted in Tab. 2, this dataset, concerning response time, encom- passes over 1,900,000 web service request records. Of significance, the dataset utilized in this research is derived from the most recent investigation by [30], which refines the WS- Dream data by removing outliers. Adhering to their methodology, we employed the iForest (isolation forest) approach for outlier detec- tion, maintaining the detection parameters consistent with [30]. The threshold for outlier scoring is in alignment with [30], set at 0.1. For a comprehensive analysis, the dataset was segmented into five divisions, as presented in Tab. 3. These divisions were made 5HFRUG57 A Dual Latent State Learning Approach: Exploiting Regional Network Similarities for QoS Prediction Conference acronym 'XX, June 03–05, 2018, Woodstock, NY to emulate data sparsity scenarios in real-world production envi- ronments and to ensure robust comparative experimentation. The data distribution for the WS-Dream dataset is depicted in Fig.3. A conspicuous observation from this figure is the pronounced label imbalance within the QoS dataset. Fig.3(a) delineates the QoS records of 50 users, chosen randomly from the WS-Dream dataset, constituting 277,615 QoS record values. The data exhibits a mean of 0.770 and a variance of 3.454. Delving deeper, 95.10% of the labels register values below 5, while the remaining 4.90% exceed this value. Fig.3(b) catalogues the request records of 5825 services sourced from five users. It's evident that the response time for a preponderant number of requests is under 5s. Fig.3(c) showcases the response time for user A when accessing services ranging from 0 to 1000. Predominantly, user A achieves ac- cess within 4s, yet there are certain services where the response time overshoots 10s. Conversely, Fig.3(d) demonstrates that for Service S, while the majority of user response times hover below 2.5s, some instances report times exceeding 10s. This underscores the influence of both user and service network states on the resultant quality of web requests. 4.2 Evaluation Metrics The accuracy of the QoS prediction is an important criterion for evaluating the performance of the model. Two metrics (i.e. MAE and RMSE) are commonly used to measure accuracy in most QoS prediction studies [30]. The mean absolute error function (MAE) is defined as follows: MAE = (cid:16)(cid:205) i,j (cid:17) (cid:12) (cid:12)ri,j − ˆri,j (cid:12) N (cid:12)abs (28) where ri,j is the real QoS value (e.g., RT or TP) and ˆri,j is the predicted value from predictive models. The root mean squared error (RMSE) is defined as follows RMSE = √︂ (cid:16)(cid:205)i,j (ri,j − ˆri,j ) 2(cid:17) N (29) where N is the count of records. For either the MAE indicator or the RMSE indicator, a lower value means higher predictive accuracy. 4.3 Baseline Methods We compare our R2SL approach with the following these meth- ods:IPCC [1],UPCC [22], UIPCC [32], HMF [8], LDCF [31], CMF [30], HSA-Net [25],D2E-LF[26],NCRL [36]. In all experimental results, each method will be run five times and the results will be averaged for a fair comparison and other settings remain the same as CMF [30]. We benchmark R2SL against six baselines, encompassing both traditional CF-based algorithms and cutting-edge deep learning approaches. Specifically, LDCF repre- sents the latest in QoS prediction, leveraging collaborative filtering of location data. For our experiments, LDCF is configured as de- scribed in its source paper. CMF, another contemporary method focusing on outlier-based QoS prediction, provided the experimental dataset. It, too, is set with its default parameters as specified in its original publication. HSA-Net, a state-of-the-art latent state-based QoS prediction model, is trained using parameters initially proposed to discern user and service latent states. 4.4 Research Questions Through rigorous experiments, this section intends to unveil the relative merits of our model, while elucidating the underlying rea- sons for its exemplary performance. We are particularly focused on addressing the ensuing research queries: RQ1: How does R2SL approach compare to the current state of the art baselines in terms of QoS prediction? RQ2: What is the effect of different latent region states on the prediction performance? RQ3: What is the impact of this E-huber loss on the prediction performance? 5 EXPERIMENTS In this section, we conduct thorough experiments to evaluate the prediction performance of R2SL against state-of-the-art baselines. We also delve into the influence of various modules and parameters on R2SL's performance through ablation studies. 5.1 RQ1: Prediction Performance Comparison As shown in Table 4, in machine learning-based models, most of the collaborative prediction algorithm models exhibit similar pre- dictive capabilities. When considering CMF, it outperforms HMF in terms of RMSE and MAE metrics, owing to CMF's ability to concurrently utilize contextual data rather than relying solely on QoS-based collaborative filtering. D2E-LF is the latest collaborative filtering algorithm with impressive training and prediction speeds, but it is limited by the extreme sparsity of the data, resulting in lower predictive accuracy on this dataset. NCRL is the latest QoS prediction method based on deep learn- ing, which maximizes the use of known features to achieve high prediction accuracy. CMF, innovating with its outlier optimization approach, and HSA-Net, capitalizing on deep learning with latent states, both present impressive results. CMF not only excels in predictive performance among non-deep models but also boasts a streamlined computational process. When juxtaposed with HSA-Net, the top performer among our baselines, R2SL achieves reductions of 14.17%, 17.03%, 11.32%, 11.56%, and 14.86% in MAE, and 13.06%, 11.76%, 9.62%, 20.91%, and 18.86% in RMSE. On the QoS dataset, R2SL's proficiency in discerning high-dimensional la- tent distributions is evident, outpacing HSA-Net, which employs a latent state learning approach for accuracy enhancement. Result Table 4 underscores that R2SL consistently yields lower MAE and RMSE metrics compared to other methodologies across all evaluated scenarios. 5.2 RQ2: The Effect of Network Latent States To discern the influence of network latent states on prediction per- formance, we instituted four comparative experiments: a) R2SL: Employs the default state fusion map encompassing all known features and latent states. b) R2SL w/o C: Excludes city-network latent states from the R2SL's feature fusion map. c) R2SL w/o A: Omits AS-network latent states from the R2SL's feature fusion map. Conference acronym 'XX, June 03–05, 2018, Woodstock, NY Trovato and Tobin, et al. Table 2: Experimental Results Method UPCC IPCC UIPCC D2E-LF HMF LDCF CMF NCRL HSA-Net R2SL D1.1 RMSE 1.022 1.121 1.075 1.638 0.674 0.987 0.657 0.953 0.558 0.440 MAE 0.542 0.520 0.506 0.653 0.349 0.349 0.327 0.312 0.182 0.151 D1.2 RMSE 0.820 0.900 0.878 1.577 0.579 0.794 0.605 0.772 0.495 0.393 MAE 0.466 0.473 0.462 0.633 0.277 0.279 0.294 0.252 0.159 0.124 D1.3 RMSE 0.787 0.838 0.820 1.564 0.551 0.751 0.536 0.722 0.470 0.359 MAE 0.428 0.437 0.427 0.607 0.261 0.247 0.250 0.221 0.128 0.114 D1.4 RMSE 0.754 0.829 0.808 1.563 0.532 0.711 0.496 0.662 0.448 0.342 MAE 0.389 0.427 0.415 0.600 0.256 0.240 0.231 0.201 0.128 0.109 D1.5 RMSE 1.317 1.342 1.329 1.556 0.526 0.692 0.461 0.660 0.442 0.335 MAE 0.555 0.596 0.584 0.590 0.256 0.213 0.205 0.182 0.126 0.104 5.3 RQ3: Loss Function for Data Imbalance To ascertain the efficacy of our introduced E-Huber loss function, we employed diverse loss functions on the standard R2SL network with the D1.1 dataset. Throughout the evaluation, all parameters remained consistent, defaulting to their standard values. The hyperparameter δ for the Huber loss was calibrated identically to that of the E-Huber loss, set at δ = 0.5. We conducted experiments using MAE, MSE, Huber loss and E-Huber loss, respectively. The MAE and MSE loss functions were derived from the standard formulations provided in TensorFlow. Employing the D1.1 dataset, we gauged the merit of the proposed E-Huber loss function vis-à-vis the standard R2SL network. Our find- ings indicated that the MSE loss trailed in effectiveness. Both MAE and Huber loss exhibited akin trajectories. E-Huber loss excelled, a consequence of the dataset predominantly featuring brief response durations, interspersed with rare, extended exceptions. While the Huber loss manifested a diminished sensitivity to outliers compared to the MSE loss and showcased greater resilience than the MAE loss, the E-Huber loss adeptly amalgamated the strengths of both, leading in both MAE and RMSE performance metrics. (a) MAE (b) RMSE Figure 4: The results for different regional network states (a) MAE (b) RMSE Figure 5: The results of R2SL with different loss function Result d) R2SL w/o H: Removes all latent states from the R2SL's feature fusion map. As illustrated in Fig. 4, R2SL demonstrates a prediction perfor- mance that outstrips the rest. Specifically, experiments a), b), and c) exhibit analogous results. Experiment d), by virtue of including all the network latent states found in a), b), and c), can harness a richer set of network state data for refined prediction accuracy. Additionally, d) proves especially potent in scenarios characterized by sparser training data. Contrastingly, a) which relies solely on known data points, underperforms in both MAE and RMSE metrics when set against its latent state-utilizing counterparts. These findings underscore the pivotal role latent states play as bolstering features for QoS prediction. Result Network latent states, especially at the regional level, sig- nificantly enhance QoS prediction accuracy. R2SL, by in- tegrating both city-network and AS latent states, achieves unmatched predictive precision. In synthesis, the E-Huber loss function eclipses its counter- parts. Consequently, we adopt the E-Huber loss function throughout this paper. 6 CONCLUSION This paper has elucidated challenges inherent in QoS prediction, pinpointing two predominant issues: data sparsity and label imbal- ance. Specifically, the dearth of user data has curtailed the efficacy of prior latent factor-based prediction techniques. Concurrently, la- bel imbalance can compromise the precision of deep models when discerning the interplay between features and QoS. In response to these impediments, we postulate a region-centric network similarity hypothesis and put forth the Regional Network Latent State Learning Network (R2SL) model. And it deploys an enhanced loss function to redress label imbalance. Our empirical analyses attest to R2SL's superior performance over contemporary QoS prediction methods, registering an average decrement in MAE error of 13.78% when benchmarked against prevailing datasets. Looking ahead, we intend to devise even more potent prediction algorithms to bolster accuracy and accommodate expansive datasets. We are also poised to weave 'HQVLW\0$(R2SLW/O AR2SLW/O HR2SLR2SLW/O C'HQVLW\506(R2SLR2SL W/O CR2SL W/O AR2SL W/O H'HQVLW\0$(0$(06(+XE(+XE'HQVLW\506(0$(06(+XE(+XE A Dual Latent State Learning Approach: Exploiting Regional Network Similarities for QoS Prediction Conference acronym 'XX, June 03–05, 2018, Woodstock, NY IEEE Transactions on Services Computing (2018). [22] Badrul Sarwar, George Karypis, Joseph Konstan, and John Riedl. 2001. Item- based collaborative filtering recommendation algorithms. In Proceedings of the 10th international conference on World Wide Web. 285–295. [23] Zhenhua Tan and Liangliang He. 2017. An efficient similarity measure for user- based collaborative filtering recommender systems inspired by the physical reso- nance principle. IEEE Access 5 (2017), 27211–27228. [24] M. Tang, W. Liang, Y. Yang, and J. Xie. 2019. A Factorization Machine-based QoS Prediction Approach for Mobile Service Selection. IEEE Access (2019), 1–1. [25] Ziliang Wang, Xiaohong Zhang, Meng Yan, Ling Xu, and Dan Yang. 2021. HSA- Net: Hidden-State-Aware Networks for High-Precision QoS Prediction. IEEE Transactions on Parallel and Distributed Systems 33, 6 (2021), 1421–1435. [26] Di Wu, Peng Zhang, Yi He, and Xin Luo. 2022. A double-space and double-norm ensembled latent factor model for highly accurate web service QoS prediction. IEEE Transactions on Services Computing 16, 2 (2022), 802–814. [27] Hao Wu, Zhengxin Zhang, Jiacheng Luo, Kun Yue, and Ching-Hsien Hsu. 2021. Multiple Attributes QoS Prediction via Deep Neural Model with Contexts*. IEEE Transactions on Services Computing 14, 4 (2021), 1084–1096. https://doi.org/10. 1109/TSC.2018.2859986 [28] Ruibin Xiong, Jian Wang, Neng Zhang, and Yutao Ma. 2018. Deep hybrid collaborative filtering for web service recommendation. Expert systems with Applications 110 (2018), 191–205. [29] Yatao Yang, Zibin Zheng, Xiangdong Niu, Mingdong Tang, Yutong Lu, and Xiangke Liao. 2021. A Location-Based Factorization Machine Model for Web Service QoS Prediction. IEEE Transactions on Services Computing 14, 5 (2021), 1264–1277. https://doi.org/10.1109/TSC.2018.2876532 [30] Fanghua Ye, Zhiwei Lin, Chuan Chen, Zibin Zheng, and Hong Huang. 2021. Outlier-Resilient Web Service QoS Prediction. In Proceedings of the Web Confer- ence 2021. 3099–3110. [31] Yiwen Zhang, Chunhui Yin, Qilin Wu, Qiang He, and Haibin Zhu. 2019. Location- aware deep collaborative filtering for service recommendation. IEEE Transactions on Systems, Man, and Cybernetics: Systems (2019). [32] Zibin Zheng, Hao Ma, Michael R Lyu, and Irwin King. 2010. Qos-aware web service recommendation by collaborative filtering. IEEE Transactions on services computing 4, 2 (2010), 140–152. [33] Zibin Zheng, Li Xiaoli, Mingdong Tang, Fenfang Xie, and Michael R Lyu. 2020. Web service QoS prediction via collaborative filtering: A survey. IEEE Transac- tions on Services Computing (2020). [34] Zibin Zheng, Li Xiaoli, Mingdong Tang, Fenfang Xie, and Michael R Lyu. 2020. Web service QoS prediction via collaborative filtering: A survey. IEEE Transac- tions on Services Computing (2020). [35] Qimin Zhou, Hao Wu, Kun Yue, and Ching-Hsien Hsu. 2019. Spatio-temporal context-aware collaborative QoS prediction. Future Generation Computer Systems 100 (2019), 46–57. [36] Guobing Zou, Shaogang Wu, Shengxiang Hu, Chenhong Cao, Yanglan Gan, Bofeng Zhang, and Yixin Chen. 2022. NCRL: Neighborhood-Based Collaborative Residual Learning for Adaptive QoS Prediction. IEEE Transactions on Services Computing (2022). Received 20 February 2007; revised 12 March 2009; accepted 5 June 2009 in auxiliary contextual data to probe the influence of similarity on service caliber across geographical locales. ACKNOWLEDGMENTS To Robert, for the bagels and explaining CMYK and color spaces. REFERENCES [1] JohnS Breese DavidHeckerman CarlKadie. 1998. Empirical analysis of predictive algorithms for collaborative filtering. Microsoft Research Microsoft Corporation One Microsoft Way Redmond, WA 98052 (1998). [2] Soumi Chattopadhyay, Richik Chanda, Suraj Kumar, and Chandranath Adak. 2022. OffDQ: An Offline Deep Learning Framework for QoS Prediction. In Proceedings of the ACM Web Conference 2022. 1987–1996. [3] Xi Chen, Xudong Liu, Zicheng Huang, and Hailong Sun. 2010. Regionknn: A scalable hybrid collaborative filtering algorithm for personalized web service recommendation. In 2010 IEEE international conference on web services. IEEE, 9–16. [4] Zhen Chen, Limin Shen, Feng Li, and Dianlong You. 2017. Your neighbors alleviate cold-start: On geographical neighborhood influence to collaborative web service QoS prediction. Knowledge-Based Systems 138 (2017), 188–201. [5] Ranjana Roy Chowdhury, Soumi Chattopadhyay, and Chandranath Adak. 2020. Cahphf: context-aware hierarchical QoS prediction with hybrid filtering. IEEE Transactions on Services Computing (2020). [6] Yu Feng and Biqing Huang. 2018. Cloud manufacturing service QoS prediction based on neighbourhood enhanced matrix factorization. Journal of Intelligent Manufacturing (2018), 1–12. [7] Pinjia He, Jieming Zhu, Zibin Zheng, Jianlong Xu, and Michael R. Lyu. 2014. Location-Based Hierarchical Matrix Factorization for Web Service Recommen- dation. In 2014 IEEE International Conference on Web Services. 297–304. https://doi.org/10.1109/ICWS.2014.51 [8] Pinjia He, Jieming Zhu, Zibin Zheng, Jianlong Xu, and Michael R Lyu. 2014. Location-based hierarchical matrix factorization for web service recommendation. In 2014 IEEE international conference on web services. IEEE, 297–304. [9] Walayat Hussain, José M Merigó, Muhammad Raheel Raza, and Honghao Gao. 2022. A new QoS prediction model using hybrid IOWA-ANFIS with fuzzy C- means, subtractive clustering and grid partitioning. Information Sciences 584 (2022), 280–300. [10] Joseph A Konstan, Bradley N Miller, David Maltz, Jonathan L Herlocker, Lee R Gordon, and John Riedl. 1997. Grouplens: Applying collaborative filtering to usenet news. Commun. ACM 40, 3 (1997), 77–87. [11] Yehuda Koren, Robert Bell, and Chris Volinsky. 2009. Matrix factorization techniques for recommender systems. Computer 42, 8 (2009), 30–37. [12] Kwangkyu Lee, Jinhee Park, and Jongmoon Baik. 2015. Location-based web ser- vice QoS prediction via preference propagation for improving cold start problem. In 2015 IEEE International Conference on Web Services. IEEE, 177–184. [13] Jianxun Liu, Mingdong Tang, Zibin Zheng, Xiaoqing Liu, and Saixia Lyu. 2015. Location-aware and personalized collaborative filtering for web service recom- mendation. IEEE Transactions on Services Computing 9, 5 (2015), 686–699. [14] Xin Luo, MengChu Zhou, Zidong Wang, Yunni Xia, and Qingsheng Zhu. 2019. An Effective Scheme for QoS Estimation via Alternating Direction Method-Based Matrix Factorization. IEEE Transactions on Services Computing 12, 4 (2019), 503–518. https://doi.org/10.1109/TSC.2016.2597829 [15] Xin Luo, MengChu Zhou, Yunni Xia, Qingsheng Zhu, Ahmed Chiheb Ammari, and Ahmed Alabdulwahab. 2016. Generating highly accurate predictions for miss- ing QoS data via aggregating nonnegative latent factor models. IEEE transactions on neural networks and learning systems 27, 3 (2016), 524–537. [16] Zhiling Luo, Ling Liu, Jianwei Yin, Ying Li, and Zhaohui Wu. 2018. Latent Ability Model: A Generative Probabilistic Learning Framework for Workforce Analytics. IEEE Transactions on Knowledge and Data Engineering 31, 5 (2018), 923–937. [17] Hao Ma, Irwin King, and Michael R Lyu. 2007. Effective missing data prediction for collaborative filtering. In Proceedings of the 30th annual international ACM SIGIR conference on Research and development in information retrieval. 39–46. [18] Hafiz Syed Muhammad Muslim, Saddaf Rubab, Malik M Khan, Naima Iltaf, Ali Kashif Bashir, and Kashif Javed. 2022. S-RAP: relevance-aware QoS predic- tion in web-services and user contexts. Knowledge and Information Systems 64, 7 (2022), 1997–2022. [19] Jinwoo Park, Byungkwon Choi, Chunghan Lee, and Dongsu Han. 2021. GRAF: a graph neural network based proactive resource allocation framework for SLO- oriented microservices. In Proceedings of the 17th International Conference on emerging Networking EXperiments and Technologies. 154–167. [20] Steffen Rendle. 2012. Factorization Machines with LibFM. ACM Trans. Intell. Syst. Technol. 3, 3, Article 57 (may 2012), 22 pages. [21] Duksan Ryu, Kwangkyu Lee, and Jongmoon Baik. 2018. Location-based web service QoS prediction via preference propagation to address cold start problem.
http://arxiv.org/abs/2310.04895v2
"2023-10-11T05:59:53"
"2023-10-07T18:47:17"
Cell Tracking-by-detection using Elliptical Bounding Boxes
Cell detection and tracking are paramount for bio-analysis. Recent approaches rely on the tracking-by-model evolution paradigm, which usually consists of training end-to-end deep learning models to detect and track the cells on the frames with promising results. However, such methods require extensive amounts of annotated data, which is time-consuming to obtain and often requires specialized annotators. This work proposes a new approach based on the classical tracking-by-detection paradigm that alleviates the requirement of annotated data. More precisely, it approximates the cell shapes as oriented ellipses and then uses generic-purpose oriented object detectors to identify the cells in each frame. We then rely on a global data association algorithm that explores temporal cell similarity using probability distance metrics, considering that the ellipses relate to two-dimensional Gaussian distributions. Our results show that our method can achieve detection and tracking results competitively with state-of-the-art techniques that require considerably more extensive data annotation. Our code is available at: https://github.com/LucasKirsten/Deep-Cell-Tracking-EBB.
[ "Lucas N. Kirsten", "Cláudio R. Jung" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04895v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04895v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.AI", "cs.LG" ]
3 2 0 2 t c O 1 1 ] V C . s c [ 2 v 5 9 8 4 0 . 0 1 3 2 : v i X r a CELL TRACKING-BY-DETECTION USING ELLIPTICAL BOUNDING BOXES A PREPRINT Lucas N. Kirsten Institute of Informatics Universidade Federal do Rio Grande do Sul Porto Alegre, RS (Brazil) lnkirsten@inf.ufrgs.br Cláudio R. Jung Institute of Informatics Universidade Federal do Rio Grande do Sul Porto Alegre, RS (Brazil) crjung@inf.ufrgs.bru October 12, 2023 ABSTRACT Cell detection and tracking are paramount for bio-analysis. Recent approaches rely on the tracking- by-model evolution paradigm, which usually consists of training end-to-end deep learning models to detect and track the cells on the frames with promising results. However, such methods require extensive amounts of annotated data, which is time-consuming to obtain and often requires specialized annotators. This work proposes a new approach based on the classical tracking-by-detection paradigm that alleviates the requirement of annotated data. More precisely, it approximates the cell shapes as oriented ellipses and then uses generic-purpose oriented object detectors to identify the cells in each frame. We then rely on a global data association algorithm that explores temporal cell similarity using probability distance metrics, considering that the ellipses relate to two-dimensional Gaussian distri- butions. Our results show that our method can achieve detection and tracking results competitively with state-of-the-art techniques that require considerably more extensive data annotation. Our code is available at: https://github.com/LucasKirsten/Deep-Cell-Tracking-EBB. Keywords Cell tracking * Cell detection * Oriented object detection 1 Introduction Detection and tracking of living cells in microscopy images is a crucial task required in many biomedical applications, such as cell growth, migration, invasion, morphological changes, and changes in the localization of molecules within cells [1–4]. The sheer amount of data produced by high-throughput microscopy imaging imposes an analytical challenge for science researchers, which can only be overcome with the appropriate computational tools. As with several other computer vision tasks, the state-of-the-art (SOTA) for cell detection and tracking is based on deep learning approaches [5, 6]. These techniques typically require manual cell annotations for training and evaluating the models, and the annotation format has a significant impact on both the time devoted to image labeling and the complexity of the network itself. The most traditional object representation refers to using horizontal bounding boxes (HBBs, a.k.a. BBs) to detect objects in a scene. Despite being very simple to annotate, this representation is not adequate when dealing with oriented elongated objects, since the HBB may contain large portions of the background or other objects in clutter scenarios. On the other hand, segmenting each object provides a fine-grained representation of the shape, but it is a tedious and time-consuming task. Moreover, applications that use multiple cell lineages from different sources (e.g., microscope, cell type) may require several rounds of labeling data and retraining the models [7]. In these cases, a fast and efficient method for quickly labeling the data is crucial for the application continuity, since it is usually the most time-consuming step. In the context of cell detection and tracking, knowing the complete shape representation might not be needed, while it can impose a real challenge in cases where the cell contour is highly uncertain (e.g., when there is low contrast between the cells and the background). Furthermore, methods used for individually segmenting the cell masks usually require Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT Figure 1: Comparison of different types of annotations. In green are the full segmentation mask, in yellow the HBB representation, in red the OBB representation, and in blue the EBB representation. more complex and computationally expensive algorithms, since they are typically developed in a two-step manner (either detecting and then segmenting [8, 9], or segmenting and then splitting the masks [10–14]). Oriented bounding boxes (OBBs, a.k.a. rotated bounding boxes) are an intermediate representation between segmentation masks and HBBs with a good compromise between simplicity and completeness. However, the presence of roughly circular cells imposes angular ambiguity on its representation, since its OBB representation will be a square rotated at any angle (see the left cell on Figure 1). In this work, we advocate using elliptical bounding boxes (EBBs), which can be directly derived from OBBs and can capture oriented cells while mitigating the angular ambiguity for circular objects. Fig. 1 shows a comparison of HBBs, OBBs, segmentation masks, and EBBs for two different cells: the left one is roughly circular, and right one is oriented. The EBB representation, shown in blue, presents a good fit in both examples. As an additional advantage, the orientation/shape of detected cells represented as EBBs can be explored in tracking-by-detection approaches to provide a better spatio-temporal association when time-lapse sequences are used, while weakly-supervised segmentation methods such as [15] can be coupled to the detected OBBs/EBBs to obtain a more detailed representation of the cell shape. We propose a cell tracking-by-detection method that uses a deep learning model to detect the cells as OBBs, then convert them to EBBs to fit the cell shapes better. For the tracking part, we based our solution on the work of Bise et al. [10], which describes an unsupervised (i.e., no tracking label is necessary) long-term global data association algorithm. We adapted their algorithm to rely only on the detection information provided by the object detector model (e.g., position, confidence score). It is important to note that our method only requires OBB cell annotations for isolated frames, and no tracking annotation involving temporal sequences is needed. 2 Related work 2.1 Cell detection and segmentation There are several approaches for cell counting, detection, and segmentation, and the best results have been achieved by deep learning methods [16, 17]. These methods vary considerably regarding the underlying structure of the network and also on the degree of supervision required to label training data. For example, detecting just the cell nucleus requires one pixel-per-cell as supervision; detecting the cell boundaries as an HBB requires two points (top-left and bottom-right), while OBBs require an additional parameter related to the orientation; finally, segmentation requires the identification of all pixels belonging to a cell, which is very time-consuming. There are also some intermediate shape representations such as the star-convex polygons [18]. The U-Net presented in [11] has become a popular segmentation approach in biomedical applications when segmentation- level information is required. It is based on an encoder-decoder U-shaped architecture with skip connections, and focuses mostly on semantic segmentation tasks (i.e., segmenting all objects for each class altogether). Although the connected components produced by U-Net can also be used for instance segmentation, dense scenarios or situations with strongly overlapping cells are challenging. For instance segmentation, most approaches produce an embedding vector for each image pixel in such a way that similar vectors should relate to the same instance (object) [19], and have been explored in the context of cell segmentation by Payer and colleagues [20, 21] by using a cosine loss for estimating local embedding distances. To mitigate the cost of clustering pixels embedding (that is required to obtain the final instance segmentation), Zhao and colleagues [22] proposed a fast Mean-Shift algorithm that works on GPUs. The 2 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT panoptic segmentation task combines both category- and instance-level information into a single framework, and has been applied to biomedical imaging by Liu and colleagues [23]. Although solutions that can return the full segmentation mask of cells have the clear advantage of providing a complete shape representation, most segmentation approaches are fully supervised, requiring time-consuming per-cell annotations. In order to overcome this problem, weakly supervised approaches explore partial annotations such as bounding boxes [24], center-points [25] or user-defined scribbles [26] for the segmentation task. Nevertheless, many applications (e.g., tissue engineering [27]) do not require the full description of the cell shape, but rather a position, size, and orientation descriptor are enough. This alleviates the annotation process, making it faster, less tedious, and more scalable. As noted in [18], a popular approach for cell detection in microscopy images is to use generic-purpose object detectors based on HBBs, such as SSD [28] or YOLO [29]. Despite the constant evolution of object detectors [30–33], the representation of cells as HBBs presents limitations in denser scenarios, particularly when oriented and elongated cells are present as aforementioned. Intermediate representations between HBBs and full segmentation masks have also been explored for cell detection. For example, Schmidt et al. [18] presented a polygonal shape representation based on radial sweeps with equidistant angles. A similar approach using splines instead of polygonal representations was presented in [34], obtaining smoother cell boundaries. In this work, we advocate using EBB representations for cell detection, which is a natural extension of the OBB representation, but usually provides a better fit to the cell shape. In particular, roughly circular shapes induce a naturally ambiguous angular representation when OBBs are used since any rotated square fits equally to a circle. For these cases, the EBB would reduce to a circle, mitigating the angular problem. Finally, it is worth mentioning that the output of any OBB detector can be mapped to an EBB, and OBB detectors have demonstrated exciting results in the past years [35–38]. An OBB annotation is almost as simple as an HBB, with a considerable gain in shape representation, particularly regarding applications that involve elongated cells. 2.2 Cell tracking Firstly, it is important to emphasize that "cell tracking" presents a broad spectrum of challenges, since each cell type and application might require a tailored solution. As noted in [7], "there is no simple way to point out the right algorithm for a given dataset", hinting that finding an algorithm capable of working for a broad spectrum of cell lineages is a huge challenge. Nevertheless, the ISBI Challenge [39] has provided several different datasets for benchmarking cell tracking algorithms, which usually are elaborated to work on more than one cell type and lineage. Recent cell tracking algorithms can be broadly divided into two categories [14, 40, 41]: (i) tracking by model evolution and (ii) tracking-by-detection. In tracking by model evolution methods (a.k.a. end-to-end tracking systems), detection and tracking are solved simultaneously. In this context, Payer et al. [20, 21] introduced temporal information for spatio-temporal learning of the embeddings. They explored a cosine loss for estimating local embedding distances, and used a convolutional Gated Recursive Unit (ConvGRU) to learn temporal relationships. Nishimura et al. [42] presented a cell tracking approach that works with weak annotation (cell centers in successive frames) by exploring a co-detection CNN. More recently, Hayashida et al. [5] proposed a complete pipeline that uses spatial-temporal context in multiple frames and long-term motion estimation with an objective level warping loss that addresses the problem of detecting and tracking highly dense cell images. Although these methods are capable of achieving high performance, it is important to emphasize that they all require full annotations for both the detection/segmentation and tracking steps, which might be a strong limitation. The tracking-by-detection paradigm consists of two stages: cell detection and cell association. When segmentation masks are required, the detection stage can either aid a segmentation step to extract the masks of each detected cell [8], or it can directly infer the segmentation masks and then split those wrongly joined cells using some algorithm such as the watershed [11, 12, 40, 41, 43, 44]. The methods for connecting the cells in subsequent frames usually rely on graphs and linear integer programming [8, 40, 41, 43, 44] by defining the costs of the cell events (e.g., movement, mitoses, and apoptosis). Other strategies include the use of multi-Bernoulli random finite sets [45] or joint particle filters based on Markov random field to model the dependency of the target movements [46]. Akram et al. [8] uses a deep learning model that first detects the cells using the HBB representation and then feeds these detections to a segmentation model to further retrieve the segmentation masks of individual cells. For associating the detection, they use random forests to estimate the costs of the event graph. More recently, Wang et al. [14] proposed a method that first segments the images using a U-Net [11] deep learning model, and then uses deep reinforcement learning to associate the detected targets between frames. This work proposes a tracking-by-detection approach that solely uses spatial information and the detection scores from an object detector to determine the associations between cells. It alleviates the annotation requirements to use only 3 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT Figure 2: Overview of the proposed pipeline for cell-tracking-by-detection. First, we detect the cells as OBBs and then convert them to the EBB representation. Next, we join the cells with high overlap between two adjecent frames. Finally, a global data association algorithm is used to identify all the cell events (i.e., movement, mitoses and apoptosis), while filling gaps generated by false negative detections and removing false positives ones, in order to produce the final tracklets. annotated cells as OBBs, and also eliminates the necessity of using other features from the detections (e.g., image histograms) to compute the associations. 3 The proposed tracking-by-detection method Our approach follows the typical pipeline of a tracking-by-detection method. First, an object detector is used to identify the cells in each frame using OBB representations, which are then converted to elliptical representations (EBBs). For tracking, we initially generate short tracklets by joining cells in subsequent frames with an objective function that jointly explores the shape and distance of cells. More precisely, we map the EBB representation to a two-dimensional Gaussian distribution and explore the Helinger distance, which directly correlates to the IoU metric [47]. Finally, a global data association method based on the work of [10] associates the tracklets to obtain the final cell trajectories and lineage trees. Figure 2 shows an overview of our complete pipeline for cell tracking-by-detection, and the steps are detailed next. 3.1 Cell detection The first step of our method relies on identifying the cells for each frame individually. We propose to use off-the-shelf OBB object detectors trained with cell images and then convert the output to elliptical bounding boxes (EBBs). For an OBB with center (x, y), width W , height H, and orientation θ, we generate an ellipse with the same center and orientation, with semi-axes a = W/2 and b = H/2. If the OBB is clearly oriented (i.e., W >> H or W << H), the EBB will preserve the orientation of the OBB. On the other hand, if the OBB is roughly square (i.e., H ≈ W ), the produced EBB will be roughly circular. In the case of a perfect square, the EBB simplifies to a single circle regardless of the orientation of the OBB, which mitigates the orientation ambiguity (recall the example shown in Fig. 1). 3.2 Detection filtering and suppression In a typical deep object detector, only candidate detections with scores larger than a pre-defined threshold τs are retrieved. Still, we usually have several overlapping candidates related to the same object, and Non-Maximum Suppression (NMS) is then used to retrieve only the candidate with the highest score. In this step, it is crucial to define a geometrical similarity measure between the detections for quantifying their "overlap" degree. The Intersection-over-Union (IoU) is the de facto standard metric for computing the overlap in HBB or OBB detectors. However, computing the IoU for OBBs is not trivial due to the several possibilities for two intersecting OBBs [48]. Furthermore, the IoU is unreliable for OBB detections related to circular cells, since angular discrepancies might artificially degrade the IoU [49]. Using the IoU with EBBs mitigates the latter problem, because the ellipse reduces to a circle. However, computing the intersection using EBBs is even more complex than using OBBs since it involves the overlap of two ellipses. In this work, we propose an alternative similarity metric based on fuzzy object representations. In [38, 50] and [47], the core idea is to use 2D Gaussian distributions (denoted as GBBs – Gaussian Bounding Boxes) as intermediate representations for oriented objects, and train OBB detectors using loss functions based on similarity metrics between distributions. Here, we explore their developed fuzzy representation to compute the distance/similarity, as explained next. Following [47], an OBB with center μ = (xc, yc)T , width W , height H and angle θ is mapped to a 4 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT (a) Frame with detections before filtering and sup- pression. (b) Frame with detections after filtering and suppres- sion. Figure 3: Illustration of detection filtering and NMS using the Hellinger Distance on a frame. Observe that in (a) we have many duplicates and false positives detection, while in (b) they are suppressed and eliminated, resulting in only one detection per cell. GBB described by the mean vector μ (which is the OBB center) and a covariance matrix  W 2 12 cos2 θ + H2 12 sin2 θ (cid:17) (cid:16) W 2 12 − H2 sin 2θ 12 − H2 1 2 12 sin2 θ + H2 W 2 sin 2θ 12 cos2 θ (cid:20)a c (cid:16) W 2 Σ = c b =   (cid:17) 1 2 12 12 (cid:21)  . (1) Note that square OBBs, for which H = W , generate a diagonal covariance matrix that does not involve the angular parameter θ. Hence, squares that differ only by angle are mapped to the exact same GBB. In [38, 50] and [47], the Gaussian distributions are used to train OBB object detectors as their loss function. However, the metrics proposed by [38, 50] do not hold the mathematical properties of a similarity measure, which is the goal for comparing two detection. Therefore, we define a similarity metric based on the Hellinger Distance, as done by [47]. Let us consider that p ∼ N (μ1, Σ1) and q ∼ N (μ2, Σ2) are Gaussian distributions with (cid:20)a2 c2 (cid:18)x1 y1 (cid:18)x2 y2 (cid:20)a1 c1 , Σ1 = , Σ2 = , μ2 = μ1 = c2 b2 c1 b1 (2) (cid:19) (cid:19) (cid:21) (cid:21) . The Bhattacharyya Distance [51] between distributions p and q is given by BD(p, q) = 1 8 μT 12Σ−1μ12 + μ12 = μ1 − μ2, Σ12 = (cid:18) ln √ det Σ12 det Σ1 det Σ2 (cid:19) , (Σ1 + Σ2) , 1 2 1 2 and the Hellinger distance [52] between p and q is then HD(p, q) = (cid:112) 1 − e−BD(p,q). (3) (4) Although both BD and HD are named "distances", only HD satisfies the mathematical properties for a metric [53]. Moreover, we can see that 0 ≤ HD(p, q) ≤ 1 (with 0 being the maximum similarity), meaning that HD provides a normalized distance metric. In this work, we explore HD to find overlapping EBBs to suppress non-maximum detections. Finally, given a detection p with the highest confidence score, we suppress all detections q ̸= p for which HD(p, q) < τh. We illustrate this procedure in Figure 3. 3.3 Tracklet generation As stated by [10], long trajectories obtained via frame-by-frame association may include more failures (such as drift and occlusions) than short trajectories. Hence, it is better to first reliably associate cell detections in adjacent frames, and then use some global data association algorithm to obtain the final long-term tracklets. 5 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT Figure 4: Illustration of using the Hellinger Distance for associating detections in subsequent frames. The dashed ellipse (black) represents a detection in frame i, while the two solid ellipses (red and blue) represent two possible associations in frame i+1 (the stars mark the respective centers of the detections). The Hellinger distance eliminates the imprecision of joining the black and blue detections due to only relating their centroid distances, while the red and black share more shape similarity. In this work, "reliable tracklets" are obtained by computing the overlap between all detections of subsequent frames with the Hellinger distance (Eq. (4)), and the optimal association between detections is obtained by solving a linear sum assignment problem with the Hungarian Algorithm [54]. Note that HD jointly considers the centroid distance (typically used for tracklet generation) and shape information – encoded in the covariance matrix. Hence, nearby cells with distinct shape/orientations that generate strong ambiguity when using only the centroid distance can be disambiguated through the Hellinger distance (see Figure 4). In order to avoid bad associations caused by false positive detections, we only associate pairs of cells p and q for which HD(p, q) < τo, where τo is a similarity threshold. Note that we implicitly assume a low cell displacement and shape change in adjacent frames, which is typically the case for time-lapse microscopy imagery [10]. 3.4 Global data association In an ideal scenario, the combination of the associations in adjacent frames would lead to the long-term track of each cell. However, there may be errors either in cell detection or the association process itself. Furthermore, we also have to consider cell division and death. Hence, we explore a global data association step to fill the gaps between disjointed tracklets, remove false positives and identify the mitoses events. We based our method on the work by [10], who formulated a maximum-a-posteriori problem (MAP) solved by linear programming that addresses the tree structure association problem. We proceed to briefly describe their method and then introduce our modifications. The MAP problem is solved by defining a set of hypotheses associated with a likelihood score for combinations of the NT tracklets (i.e., each tracklet will respond to a set of possible hypotheses with their likelihood). More precisely, they assume the following five possible types of hypotheses that can be made for each tracklet: initiation, termination, translation, mitoses, and false positive. Mathematically, let CM ×2NT be a binary matrix containing the constraints for all possible hypotheses. Each row of C relates to a single hypothesis, and it presents 2NT columns that indicate the possible tracklet associations, where the first NT columns indicate the index of the source tracklet index and the following NT columns relate to the target tracklet index (or indices). For example, the translation hypothesis presents one source tracklet and one target tracklet. Meanwhile, the mitosis hypothesis relates one source tracklet to a pair of target tracklets (its children), and the false positive hypothesis relates one tracklet to itself (i.e., the source index is the same as the target). There is also a likelihood value for each hypothesis (i.e., for each row of C), stored in a vector ρ with M elements (the number of generated hypotheses). The solution of the global optimization problem is a subset of all non-conflicting hypotheses (a subset of rows of C) that maximizes the sum of the corresponding likelihoods. This can be formulated as the following ILP optimization problem: x∗ = argmax ρT x, s.t. , CT x ≤ 1, x (5) where xM ×1 is a binary vector, and an entry xk = 1 means the k-th hypothesis is selected in the global optimal solution. The constraint CT x ≤ 1 guarantees that each tracklet ID appears in only one associated tree or false positive tracklet. 6 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT The work developed by [10] allows a simple but efficient method for long-term data association. Yet, their approach still presents some limitations that we propose to address with the following modifications: 1. In [10], they propose to use a specific algorithm [55] to identify the mitotic cells (i.e., the cells that are more likely to suffer mitoses). This algorithm, however, is specifically designed to work with images captured under phase-contrast microscopy, which narrows its usage to other types of images (e.g., fluorescence). We decided not to differentiate between mitotic and non-mitotic cells, and consider all cells as potentially mitotic. Furthermore, to address this choice, we employ two free parameters to adjust the likelihood distribution of the translation and mitoses hypothesis; 2. We removed the initiation and termination hypotheses and replaced them with a completeness one. In theory, these two hypotheses are essential to define the tree structure of the MAP problem. However, we noted in our experiments that they tend to generate a more complex MAP problem and do not provide better tree structures (i.e., closer to the ground-truth one), as we demonstrate in Section 5. In the original formulation, these hypotheses are defined regarding the cell position towards the borders and their first (or last) appearance, assuming that cells appear or disappear when they enter or leave the area captured by the microscope. Although these assumptions work well for an ideal detector, real detectors can fail to capture some cells (e.g., due to the absence of contrast between cell and background). As a consequence, the tracklets can start to be recognized only after some frames and/or with the cells already located farther away from the image boundaries, and imposing these boundary-related conditions can increase the number of false negatives; 3. We re-defined all the likelihood computations to use only information regarding the detected cells (e.g., position, time-frame distance, and confidence score returned by the object detector). In particular, we explore the confidence score to discriminate between the true and false positive hypotheses. For the translation and mitoses hypotheses, we used only the center and time distance between detections, whereas generic feature matching (e.g., based on histogram matching) was proposed by [10]. Our motivation is that finding an adequate feature to individually discriminate cells in long-term matching is challenging (no specific feature was mentioned in [10]), and appearance-based features might change depending on the method used to capture the images. Moreover, using only positional information and confidence score allow using any cell detector. We also removed the true positive likelihood that was originally proposed by [10] since our pre-processing step can remove low-scored detections. The proposed alternate hypotheses and corresponding likelihoods are explained next. • Translation hypothesis: If the time and center distances between the last detection of tracklet Xk1 and the first detection of Xk2 are smaller than a pair of thresholds, Xk1 → Xk2 is a candidate of a tracklet translation. Considering that h denotes the index of a new hypothesis, we append a new row to C and a corresponding likelihood to ρ as: (cid:26)1, if i = k1 or i = NT + k2 C(h, i) = 0, otherwise ρ(h) = Plink(Xk2|Xk1). , • Mitosis hypothesis: If the time and center distances between the last detection of tracklets Xp and the first detection of Xc1 and Xc2 are smaller than a threshold for the detection center and time, Xp → {Xc1, Xc2} is a candidate of a tracklet mitosis. We define new entries for C and ρ as: C(h, i) = (cid:26)1, if i = p or i = NT + c1 or i = NT + c2 0, otherwise , • False positive and Completeness hypothesis: ρ(h) = Pmit(Xc1, Xc2|Xp). If the score of tracklet Xk (i.e., the mean score of all its detections) is smaller than threshold τF P , Xk is a candidate for both false positive and completeness. We define two new entries for C (h and h + 1) and ρ given by C(h, i) = C(h + 1, i) = (cid:26)1, if i = k or i = NT + k 0, otherwise , and for the ρ entries as: ρ(h) = PF P (Xk), ρ(h + 1) = Pcplt(Xk). 7 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT The completeness hypothesis aims to cover the cases in which a tracklet does not translate or suffer from mitoses, i.e., the tracklet is, in fact, a full long-term cell track. Hence, assuming only the false positive hypothesis would wrongly eliminate those tracklets. Now, we formalize the likelihoods for each hypothesis provided above. For the link and mitosis hypotheses, we would like to maximize the likelihood (i.e., values closer to 1) when the time and space distance between two cell tracklets are small, and minimize it (i.e., values closer to 0) when their distance increase. For this purpose, we based the formulation of the link and mitoses likelihoods on an exponential mapping that penalizes the time-space distance between tracklets. More precisely, we propose to use Plink(Xj|Xi) = exp − (cid:18) (ci,j + 1) tj,i ∆t λlink (cid:19) , (6) where ∆t is the dataset capture time step in frames hour , ci,j is the Euclidean center distance between the last and the first detection of tracklets Xi and Xj, respectively, ti,j is their time distance in frames, and λlink is a parameter that controls the decay of the exponential. The mitosis likelihood is defined in a similar way, but jointly considering the space-time distance between the parent cell p and the two candidate children c1, c2. Formally, it is given by Pmit(Xc1, Xc2|Xp) = exp − (cid:18) (cp,c1 + cp,c2 + 1)(tp,c1 + tp,c2) 4∆t λmit (cid:19) , (7) where λmit controls the decay of the exponential. We do not use the Helinger distance in these formulations because cell shapes can change considerably in longer-term translations or during mitosis. For the false positive likelihood, we also explore the precision α of the object detector computed for a given dataset (e.g., the training or validation set) and the tracklet score si, defined as the mean confidence score of all its detection. We want low-confidence tracklets (w.r.t. to the detector precision) to have an increased false positive likelihood, but longer tracklets must have a smaller value since they tend to be related to actual tracklets. Based on these assumptions, the false positive likelihood is computed as PF P (Xi) = (1 − α)(1 − si + τs)|Xi|, (8) where |Xi| is the number of total detection responses in the tracklet, and τs is the threshold detection score defined in Section 3.2. Note that detectors with low precision (α << 1) are prone to produce false positives, and PF P should be increased in this case. On the other hand, detectors with high precision (α ≈ 1) are less prone to produce false positives, and the likelihood PF P is decreased. A similar rationale is used to define the completeness tracklet likelihood, given by Pcplt(Xi) = α(si − τs). (9) Note that the likelihood of a tracklet being complete (i.e., it does not fit any other hypotheses) is not directly related to the tracklet size, since a cell can emerge and die very soon or appear in the visible field only in the last frames, which might lead to very small tracklets. Hence, we chose to define the likelihood based only on how precise the predictions of the object detector are, so that the tracklet generation step can do most of the correct associations between adjacent frames. Figure 5 shows an example of the proposed hypotheses generation. From left to right, it shows a set of tracklets; the possible hypotheses connecting the tracklets; the likelihood vector ρ; the matrix C indicating the possible tracklet connections; and the vector x returned by the MAP problem solution. The final tracks are then obtained by solving Eq. (5). 4 Experiments 4.1 Datasets We evaluated the proposed method on three publicly available cell microscopy datasets provided from the ISBI 2015 Cell Tracking Challenge [39]: Fluo-N2DH-GOWT1, PhC-C2DH-U373, and Fluo-N2DL-HeLa, illustrated in Fig. 6. Each dataset contains two sequences in the training set (with ground truth annotations) and two challenge sequences (without ground truth annotation), named with suffices -01 and -02. The results for the challenge sequences are obtained by submitting the results to the ISBI challenge server. We proceed to provide details regarding each of the chosen datasets. 8 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT Figure 5: Example of hypotheses generation for a given set of tracklets. Given a set of initial tracklets, we generate hypothesis for each of them, which are associated with a likelihood value stored in vector ρ, and the constraints stored in the binary matrix C. Solving the MAP problem returns the binary vector x which selects a subset of rows in C that defines the optimal solution of the MAP problem. For example, the first line defines a translation hypothesis of tracklet 1 to 2 with a likelihood of 0.5. The matrix C stores the ID values of the considered tracklets (in each of its halves), and the value 0 in the vector x indicates that this hypothesis was not chosen during the optimization solving. (a) Fluo-N2DH-GOWT1 (b) Fluo-N2DH-HeLa (c) PhC-C2DH-U373 Figure 6: Example of cell images for each of the datasets used for evaluation. Fluo-N2DH-GOWT1 contains GFP-transfected GOWT1 mouse embryonic stem cells captured on fluorescence microscopy. Challenges with this dataset include low contrast of some cells and few cells entering and exiting the imaged region from the axial direction. The capture time step is ∆t = 12 frames hour . PhC-C2DH-U373 contains glioblastoma-astrocytoma U373 cells captured under phase contrast microscopy. This dataset is challenging due to cells having highly deformable shapes and parts of cell bodies having a similar appearance to the background. The capture time step is ∆t = 4 frames hour . Fluo-N2DH-HeLa contains fluorescently labeled HeLa nuclei captured on fluorescence microscopy. Challenges with this dataset include high cell density, low contrast, a few irregularly shaped cells, various mitoses events, and cells entering and exiting the imaged region. The capture time step is ∆t = 2 frames hour . All these datasets only contain ground truth (GT) annotations for cells within a field of interest, which excludes a few pixels for cells close to the image boundaries. There are two types of GT annotations: cell masks for the segmentation evaluation, and cell markers for the detection and tracking evaluation. For the cell masks, the annotations are provided as silver and gold standards. The silver standard annotations refer to computer-origin reference annotations, while the gold standard refers to human-origin ones. Since only a few cells are annotated in the gold standard, we used only the silver ones for both training and evaluation. The cell marks are "similar" to the segmentation masks, but they have 9 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT (a) GOWT1-01 (b) HeLa-01 (c) U373-01 (d) GOWT1-02 (e) HeLa-02 (f) U373-02 Figure 7: Illustration showing the difference between the two CTC [39] annotations types: cell masks (green) and cell markers (red). reduced size and serve solely as a position descriptor of the cells. Moreover, they do not follow a standard regarding their size or placement on the cell image. We illustrate these annotation discrepancies in Fig. 7. 4.2 Data pre-processing We use the same data pre-processing procedure for all datasets, except for some specific adjustments in the HeLa, as described next. Since the HeLa dataset contains cells with very different sizes compared to the other CTC datasets [39], we followed a similar strategy to the one employed by [8] and magnified all images by a factor of 2. This procedure allows us to use the same network architecture without needing any adjustment in its head parameters regressor (e.g., the anchors) to better fit the cell sizes in this dataset. For training the object detector, we extracted patches of full images in the datasets using a 512×512px sliding window with 100px stride. The patches are extracted starting the window at the top-left corner of the image and sliding it across the image horizontally and vertically according to the specified stride. At each position, we extract a patch within the window boundaries. This process resulted in, for each sequence of the CTC dataset, 4,508 for the GOWT1 dataset, 690 for U373, and 16,314 for HeLa. During inference, we used the full-sized images, except for the HeLa dataset, for which we used the patches with a 256 stride (to provide some overlap in the borders) and then divided the parameters of the detection by a factor of 2 to retrieve them with the expected original image sizes. We used a similar strategy as in other works [8, 14, 40, 41, 43]: with dataset sequences that contain GT annotations (i.e., not the one related to the challenge), we trained the models with one sequence and used the other for evaluation. To generate the OBBs (and then the EBBs) from the CTC cell masks, which are required to train the object detectors, we employed the minimum-area rectangle fitting algorithm available in the OpenCV [56] framework. 4.3 Implementation details As the object detector, we chose to use the R2CNN [35] provided by the AlphaRotate benchmark 1, because it has shown to have the best compromise between precision and recall compared to other OBB detectors in our preliminary 1https://github.com/yangxue0827/RotationDetection 10 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT Table 1: Object detection precision α for each dataset. Dataset GOWT1-01 GOWT1-02 U373-01 U373-02 HeLa-01 HeLa-02 0.7899 0.8993 0.8644 0.7673 0.6867 0.7930 α investigations using a private cell dataset. Furthermore, as presented in [57], general-purpose two-stage detectors usually provide better results when compared with one-stage ones. R2CNN is a two-stage object detector (i.e. it has a region proposed module (RPN) before the detection module) that was first proposed in text detection problems. The model parameters used for all experiments are the same as in the AlphaRotate default architecture. The trained model uses a ResNet50 [58] backbone with pre-trained weights on the ImageNet dataset [59]. Both classification modules (RPN and head) use the categorical cross-entropy loss, and both box regression modules use the smooth-l1 loss. Weight decay and momentum are set to 10−4 and 0.9, respectively. We employ Momentum Optimizer over 1 GPU and eight images per mini-batch. All models are trained for 100 epochs with a 0.1 reduction factor of the learning rate at epochs 12, 16, and 20, using random rotation and flips as data augmentation primitives. The initial learning rate was 10−3 for all datasets except HeLa, for which the model showed overfitting. In this dataset, we used 10−4 as the initial learning rate and trained for 24 epochs only. The hyper-parameters for the tracking system are the same for all datasets (except the object detection precision α and capture time ∆t), and were chosen empirically to produce good results for all the evaluated datasets (i.e., we used the training datasets in order to define the hyper-parameters of the final tracking system that was evaluated on the CTC [39] server with hidden GT). Nevertheless, we provide a sensitivity analysis of the parameters in Section 5.3, and conclude that changing them has a small impact on the results. For the inference of the detector, we used a score threshold τs = 0.5, and an overlap threshold of τh = 0.5 for the filtering and aggregation step. For the tracklet generation, we employed an overlap threshold of τo = 0.5, which are classical thresholds for IoU-like metrics. For the parameters of the global data association algorithm, we used a time threshold tth = 3 frames, and a false positive (cid:113) threshold τF P = 0.9. The space threshold was set to 0.1 f , where Wf and Hf are the width and height of the dataset frames, respectively. The α value was computed using the precision value for each dataset considering an overlap threshold of τh = 0.5 between the predicted and ground-truth detections of the training images with no score threshold (i.e., considering any detection with a confidence score above zero), and are available in Table 1. The free parameters for likelihood adjustment are set to λlink = 25 and λmit = 50 for all datasets. The MAP problem was solved using the Cbc [60] mixed ILP solver provided in the CVXPY2 Python 3 [61] library. f + H 2 W 2 4.4 Evaluation Metrics We evaluated our method using the metrics proposed by the ISBI 2015 Cell Tracking Challenge [39] and standard literature metrics used for evaluating general-purpose detection and tracking systems. The ISBI Challenge provides the DET, SEG and TRA metrics 3. Both DET and TRA metrics are designed to mirror the manual effort required to correct the errors of a given detection and tracking algorithm, respectively, using Acyclic Oriented Graph Matching; SEG measures the Jaccard similarity index (a.k.a. IoU) between predicted and ground-truth segmentation masks. All ISBI metrics return values from 0 to 1 (1 being the highest score). Since our method provides only an approximation of the segmentation masks through EBBs, we would also like to estimate how close both the GT EBBs and the predicted EBBs are to the GT segmentation masks. The former can be answered by evaluating the EBBs generated from the ground truth cell masks with the SEG metric, obtaining the EBB SEG metric. The latter is obtained by simply evaluating our method with the SEG metric. For the detection and tracking evaluation, the algorithm provided by the ISBI challenge disregards detections that do not entirely overlap with the provided ground-truth cell marks. As mentioned before, they do not follow a standard for size and displacement, which might affect the quantitative metrics. For the U373-02 dataset, in particular, Ulah and colleagues [8] propose simply enlarging the predicted masks to avoid missing the cell marks. In our approach, however, the variability of cell mark annotations can significantly impact all the tested datasets, since the EBBs are only approximations of the segmentation mask and might not completely overlap with a ground-truth mark – they are not bounding representations as well. In order to overcome this issue, we also evaluated our method enlarging the predicted cell masks with a simple watershed algorithm, using the EBBs as guiding markers. An example of EBB-guided watershed is shown in Fig. 8. 2Available at: https://www.cvxpy.org/index.html 3A full the metrics can be of evaluation-methodology/ description found at http://celltrackingchallenge.net/ 11 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT Figure 8: Visual comparison of the cell masks using EBBs (left) and post-processed with watershed (right). Note that the watershed fills the voids between the different detections allowing some degree of error when evaluating with the DET and TRA metrics. For the standard literature metrics, we evaluated our object detector using the Average Precision (AP) metric, which relates the precision and recall for a given threshold score and detection overlap (e.g., using IoU or the Hellinger distance) between detections. For the tracking evaluation, we used the CLEAR-MOT [62, 63] and ID-MEASURE [64] metrics4. Both metrics attempt to find a minimum-cost assignment between ground truth objects and predictions. However, while CLEAR-MOT solves the assignment problem on a local per-frame basis, ID-MEASURE solves the bipartite graph matching by finding the minimum cost of objects and predictions over all frames. For evaluating the object detector, we used the Hellinger distance to compute the overlap between predicted and ground-truth detections, and set the score and overlap thresholds to 0.5. 5 Results and Discussions In this section, we present the results for evaluating our tracking-by-detection method in the CTC [39] datasets. We evaluated our results in two manners: one by using only the training datasets with GT and comparing with other works directly (see Section 4.2 for more details), and the other by submitting our codes to the CTC server5 in order to retrieve the metrics scores and rank compared to other submitted works. We begin this section by briefly describing the baseline methods used in the first evaluation methodology. Then, we present the results for both methodologies and discuss them. 5.1 Baseline methods We proceed to briefly describe the methods used as baseline for comparison with our proposal, highlighting the nature of required training data. KTH [43] segments cells using a bandpass filter followed by thresholding, and then uses the watershed algorithm to split joined cells. The tracking graph is created by connecting cell segmentations in adjacent frames, and then solved by iteratively finding the lowest cost path in the graph using Viterbi algorithm. It does not require any annotation. EPFL [40] detects cells by fitting ellipses to binary segmented regions. It joins the detection on subsequent frames using a tracking graph solved using integer linear programming (ILP). It requires annotation for segmentation, detection and tracking. HEID [40] detects cells by merging super-pixels clustering segmentation, which are obtained using watersheds. Then, the tracking is retrieved by finding the global optimum of a graph model that represents cellular events using ILP. It requires annotation for segmentation, detection, and tracking. BLOB [41] detect cells using multiple elliptical filter banks, and performs tracking by iteratively finding the shortest path in a model graph. It requires only tracking annotation, i.e., temporal cell associations. CPN [8] first generates cell region proposals using an HBB object detector, and then finds the segmentation masks of these regions using a deep learning segmentation network similar to the U-Net [11]. It performs tracking using ILP to 4We used a Python [61] implementation of these metrics available at: https://github.com/cheind/py-motmetrics 5Available at: http://celltrackingchallenge.net/ 12 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT solve a graph for which the weights are set by training a random forest classifier with several histogram features. It requires full annotation for detection, segmentation, and tracking. DRL [14] uses the U-Net [11] model to produce the cell segmentation masks. Then, it uses deep reinforcement learning to build the cost matrix that joins the cells of subsequent frames. It requires full annotation for detection, segmentation, and tracking. ST-TCV [44] detects cells using a joint spatio-temporal diffusion and region-based level-set optimization ap- proach [65]. Then, it uses motion prediction and minimization of a global probabilistic function to join the cells of subsequent frames. It does not require any annotation. We did not include results for the methods U-Net [11], GC-ME [12], and U-Net S [13] because they do not follow the same data split methodology (i.e., they employ images from both sequences in the training phase), and hence it would define an unfair baseline for comparison. 5.2 Results for the CTC datasets The results for comparing our method with SOTA approaches on the ISBI evaluation using separate sets are provided in Table 2. We include in this table results for both using or not using the watershed algorithm for enlarging the detection results. Regarding the approximation of the cell masks using EBBs, we can observe from the EBB SEG column that it provides a good fit for the GOWT1 and HeLa datasets. On the other hand, the EBB approximation is not very good for the U373 dataset since there is strong variability in the cell shapes, as mentioned before. Finally, our method did not achieve SOTA scores on the SEG metric, which is expected since we only approximate the cell masks through EBBs. Nevertheless, it could reach close values to those on both the GOWT1 and HeLa datasets, and even get the second best for the GOWT1-01. For the DET and TRA metrics, we note that our approach achieves a considerable boost using the watershed post- processing algorithm, particularly for the U373-02 dataset. We believe that this behavior is mostly due to the GT annotation of the cell markers in the dataset, which is sometimes located at the boundary of the cells and might not overlap completely with the EBB. Nevertheless, our method (without watershed) could reach SOTA results in both GOWT1 datasets, while having the second-best result in U373-01. When applying the watershed mask augmentation, our method reached SOTA scores on three datasets, and second best on other two. Regarding the degree of annotation required for each technique, our method was capable of outperforming fully supervised methods (HEID [40], EPFL [40], CPN [8] and DRL [14]) in most of the evaluated datasets. It also presented better results than the tracking-supervised approach BLOB [41] and the unsupervised trackers KTH [43] and ST-TCV [44] in all datasets, except for HeLa-02 compared to the KTH method. Table 3 report the results for evaluating our method on the CTC server 6 on the DET and TRA metrics with and without the watershed method7. In this evaluation, our method was capable of achieving the TOP 3 rank on the DET metric for the GOWT1 dataset using the watershed algorithm. Although it could not overcome the SOTA in any dataset, we can observe a small difference between the scores of our method with those ranked as the top one. Furthermore, most of the top-ranked algorithms are end-to-end trackers or use elaborated techniques to improve the predicted segmentation masks from deep learning models (e.g., using model assemble or multiple refinement stages). In contrast, our proposed method intends to provide a simple yet efficient method for tracking-by-detection that requires only per-frame OBB cell annotations. The results using standard detection and quality metrics are provided in Table 4. The detection results refer only to the detector performance itself, i.e., it does not use the global data association to further eliminate false positive detections and/or add false negative ones. This table evaluates different aspects of our method, enabling us to identify its strengths and weakness better. Regarding the recall metric, we can observe that it could achieve high values on all datasets for detection and tracking. However, it is noticeable that our method fails to eliminate false positive detections, which impact the precision in both detection and tracking, as noted for dataset U373-01. On the other hand, the detector precision in the GOWT1-02 dataset was also relatively low, but our global data association algorithm was capable of eliminating most of the false positive detections and hence obtaining a higher precision value on the tracking metrics. 6Submitted implementation available at: http://celltrackingchallenge.net/participants/UFRGS-BR/ 7Due to environment problems related to CUDA instructions on the CTC server computers, we could not reproduce the exact same code used on our side. This ended up slightly harming the predicted EBB shapes and hence under-estimating the SEG metric, and the DET and TRA metrics when the detections' shapes are not augmented with the watershed algorithm. 13 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT Table 2: Results for the CTC [39] training datasets using separate sequences. Our results with the watershed method are reported as Ours-W. Bold values mark the best results, while underline values mark the second best. We also report the annotation requirements (Ann. Req. column) of each technique related to the detection (Det) and tracking (Tra) . Ann. Req. Det. Tra. Dataset U373-01 GOWT1-02 GOWT1-01 Method ST-TCV ✗ ✗ KTH ✗ BLOB ✓ CPN ✓ DRL ✓ Ours Ours-W ✓ ST-TCV ✗ ✓ HEID ✓ EPFL ✗ KTH ✗ BLOB ✓ CPN ✓ DRL ✓ Ours Ours-W ✓ ✓ CPN ✓ DRL ✓ Ours Ours-W ✓ ✓ CPN ✓ DRL ✓ Ours Ours-W ✓ ST-TCV ✗ ✓ HEID ✓ EPFL ✗ KTH ✓ CPN ✗ BLOB ✓ Ours Ours-W ✓ ST-TCV ✗ ✓ HEID ✓ EPFL ✗ KTH ✓ CPN ✗ BLOB ✓ Ours Ours-W ✓ * denotes augmentation on the segmentation masks. U373-02 HeLa-02 HeLa-01 ✗ ✗ ✓ ✓ ✓ ✗ ✗ ✗ ✓ ✓ ✗ ✓ ✓ ✓ ✗ ✗ ✓ ✓ ✗ ✗ ✓ ✓ ✗ ✗ ✗ ✓ ✓ ✗ ✓ ✓ ✗ ✗ ✗ ✓ ✓ ✗ ✓ ✓ ✗ ✗ DET SEG EBB SEG TRA N/A N/A N/A N/A N/A 0.9916 0.9940 N/A N/A N/A N/A N/A N/A N/A 0.9812 0.9868 N/A N/A 0.9647 0.9748 N/A N/A 0.8822 0.9634 N/A N/A N/A N/A N/A N/A 0.9779 0.9863 N/A N/A N/A N/A N/A N/A 0.9707 0.9796 N/A 0.6849 0.7415 0.8506 0.8585 0.8568 - N/A N/A N/A 0.8942 0.9046 0.8725 0.9181 0.8509 - 0.7336 0.8527 0.6307 - 0.7376 0.7735 0.5626 - N/A N/A N/A 0.8018 0.8313 0.7951 0.7264 - N/A N/A N/A 0.8366 0.8445 0.8390 0.7618 - - - - - - 0.9268 - - - - - - - - 0.9167 - - - 0.7791 - - - 0.7029 - - - - - - - 0.8871 - - - - - - - 0.8897 - 0.913 0.9462 0.9733 0.9864 0.9875 0.9914 0.9930 0.914 0.95 0.95 0.9452 0.9628 0.9719 0.9575 0.9817 0.9853 0.9594 0.9919 0.9671 0.9774 0.9346* 0.9318 0.8737 0.9525 0.816 0.80 0.98 0.9775 0.9869 0.9803 0.9758 0.9820 0.845 0.85 0.97 0.9747 0.9826 0.9771 0.9664 0.9740 14 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT Table 3: Results from the CTC [39] challenge evaluation server. We report the results for our technique both using and not the watershed mask augmentation (W column), the rank position over all submissions, and the relative difference to the first rank method (To TOP1 column). Evaluation date: October 10, 2022. DET GOWT1 Dataset W Score Rank ✗ 26/49 0.925 ✓ 0.970 3/49 ✗ 33/38 0.914 ✓ 0.979 17/38 ✗ 15/48 0.986 ✓ 0.989 10/48 U373 HeLa To TOP1 5.61% 1.02% 7.68% 1.11% 0.80% 0.50% TRA Score Rank 19/40 0.922 4/40 0.959 26/31 0.909 12/31 0.976 11/39 0.984 8/39 0.988 To TOP1 5.82% 2.04% 7.72% 0.91% 0.91% 0.50% Table 4: Results using standard detection and tracking quality metrics (in %), as described in Section 4.4. Dataset GOWT1-01 GOWT1-02 U373-01 U373-02 HeLa-01 HeLa-02 Tracking Detection ID-F1 97.9 95.2 88.9 81.5 94.6 93.1 ID-P 96.7 91.3 79.9 79.6 92.4 89.0 ID-R 99.0 99.6 100.0 83.6 96.8 97.6 R 99.9 100.0 100.0 96.0 100.0 100.0 P 97.5 91.7 79.9 91.4 95.4 91.2 MOTA R50 99.4 97.0 99.9 90.7 99.9 74.8 93.6 86.3 90.8 94.0 95.0 89.1 P50 97.0 83.7 79.0 90.1 96.5 93.5 F150 AP50 90.9 98.2 90.5 91.1 90.8 88.2 89.5 91.8 90.4 93.6 90.1 94.2 For U373-02, we can observe an inconsistency between the detection and tracking precision, which might be explained by the inconsistency of the cell mark annotations mentioned in Section 4.4. Table 5 shows a comparison of our tracking pipeline using our data association algorithm and a modified version using the approach by [10] for computing the final tracks. We note that the proposed modifications only slightly improve the DET and TRA metrics for most datasets, but they provide a significant reduction in the number of generated hypotheses. As a consequence, it allows faster solution computation and fewer hardware requirements. Finally, we provide visual detection results on the CTC [39] datasets on Figure 9. We can observe that EBBs provide a good description of the cell shapes for the GOWT1 and HeLa datasets, but not so much for the U373 datasets. We can also note the high recall rate of the object detector, since almost all cells are retrieved. Figure 10 presents the generated tracking trees8. Analyzing the results for the GOWT1 and U373 datasets, which are less cluttered, we can observe that our method could produce clear paths for most of the initial cells. These datasets have almost no mitosis or apoptosis events, so the paths that seem to emerge in later frames can be false positives or cells emerging from the image borders. 8We also provide animated images in our GitHub repository at: https://github.com/LucasKirsten/ Deep-Cell-Tracking-EBB/ Table 5: Results comparing our complete method and a modified version of [10] (Baseline). Dataset GOWT1-01 GOWT1-02 U373-01 U373-02 HeLa-01 HeLa-02 Method Baseline Ours Baseline Ours Baseline Ours Baseline Ours Baseline Ours Baseline Ours DET 0.9914 0.9916 0.9803 0.9812 0.9655 0.9647 0.8818 0.8822 0.9772 0.9779 0.9699 0.9707 TRA 0.9913 0.9914 0.9805 0.9817 0.9677 0.9671 0.8733 0.8737 0.9741 0.9758 0.9652 0.9664 Hypothesis Time (s) 133 47 312 161 78 53 83 24 7989 7061 25525 22649 0.1234 0.0998 0.2280 0.2082 0.0891 0.0763 0.0918 0.0509 30.681 25.337 259.18 235.06 15 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT (a) GOWT1-01 (b) GOWT1-02 (c) HeLa-01 (d) HeLa-02 Figure 9: Visual results of our method in the CTC [39] training datasets. In green are the ground-truth segmentation masks, and in red are the predicted EBBs. (e) U373-01 (f) U373-02 16 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT (a) GOWT1-01 (b) GOWT1-02 (c) HeLa-01 (d) HeLa-02 (e) U373-01 (f) U373-02 Figure 10: Visualization of the generated tracking trees in the CTC [39] training datasets. 17 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT Figure 11: Impacts on the individual datasets evaluation from randomly sampling the hyper-parameters. The zero value refers to an output metric value equal to the one reported in Table 2. (a) DET metric (b) TRA metric Figure 12: Individual impacts of the hyper-parameters on the method performance using the SHAP values [66, 67] regarding the DET and TRA metrics. 5.3 Sensitivity analysis In this section, we analyze the sensitivity of our tracking-by-detection method regarding its hyper-parameters. We randomly sampled the parameter values within an interval and evaluated the results on the CTC [39] tested training datasets (i.e., with provided GT). The parameters were randomly sampled in the following scheme: λlink and λmit ∈ R+ linearly spaced between 5 and 1000 with step 25, tth ∈ N linearly ranging from 1 to 8 with step 1, τs ∈ R+ linearly ranging from 0.4 to 0.9 with 0.05 step, and τF P ∈ R+ linearly ranging from 0.5 to 0.9 with 0.05 step. For consistently evaluating the impact of the parameters on the different datasets, we subtracted the metrics values from the ones reported in Table 2 when using the watershed method to show the relative gain or loss when changing the hyper-parameters. Figure 11 shows a boxplot with the relative changes of the DET and TRA metrics for a set of ∼ 400 random combinations of the hyper-parameters in each individual dataset. We can observe that the impact of changing the parameters is small for most of the datasets. The worst-case scenario occurs on the U373-2 dataset, with a negative impact of ∼ 3.5% on the TRA metric. On the other hand, we note that some combination of hyper-parameters can actually improve the results obtained with the default parameters. In order to access the impact of the individual hyper-parameters on the method, we used the Shapley Additive Explanations (SHAP values) [66, 67] using the DET and TRA evaluation metrics as the targets and averaging the results among all the CTC tested datasets. SHAP values provide insights into feature contributions, distributing credit among features to explain machine learning predictions. They measure the impact of each feature compared to its absence or average value, allowing a nuanced understanding of feature importance. Positive values increase predictions, negative values decrease predictions, and zero values have no impact. Examining SHAP values helps identify influential features, aiding feature selection, model debugging, and understanding model decisions. In our case, we adapted the method to work with the hyper-parameters instead of the features. Figure 12 presents the violin plots, where the color indicates the parameter value and the horizontal axis denotes the corresponding SHAP value. The small range of the horizontal axis and concentration at small SHAP values indicate that the method is robust to the parameter choice. Furthermore, we note that most random combinations of individual parameters lead to a positive impact on the metric scores. 18 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT 6 Conclusions We proposed a tracking-by-detection method that explores an OBB detector to identify cells, represent them as ellipses, and then uses the detection information in an unsupervised tracking algorithm based on tracklet association. Our method alleviates the annotation efforts by representing the cells as a 5-parameter oriented ellipses (that can be either annotated as an OBB or EBB), and by defining an unsupervised tracking system oriented solely on the detection information retrieved by the trained object detector. Our results demonstrate that the cell elliptical representation presents a good approximation for the full segmentation mask, particularly for lineages with a regular shape. Furthermore, our tracking- by-detection method can achieve results competitive to other state-of-the-art methods that require considerably more annotated data. Moreover, our method reduces the hardware requirements for training and predicting when compared to the current trend of end-to-end trackers, since it requires training only one object detector and does not rely on training a complete detection and association deep learning architecture that needs both batches of frame images and their objects associations. We believe that our method can be broadly used in applications where there are limited resources or short deadlines for retrieving the full annotations. References [1] T. Q. Syed, V. Vigneron, S. Lelandais, G. Barlovatz-Meimon, M. Malo, C. Charrière-Bertrand, and C. Montagne, "Detection and counting of" in vivo" cells to predict cell migratory potential," in 2008 First Workshops on Image Processing Theory, Tools and Applications, pp. 1–8, IEEE, 2008. [2] M. R. C. Leite, I. A. Cestari, and I. N. Cestari, "Computational tool for morphological analysis of cultured neonatal rat cardiomyocytes," in 2015 37th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), pp. 3517–3520, IEEE, 2015. [3] D. Di Giuseppe, F. Corsi, A. Mencattini, M. C. Comes, P. Casti, C. Di Natale, L. Ghibelli, and E. Martinelli, "Learning cancer-related drug efficacy exploiting consensus in coordinated motility within cell clusters," IEEE Transactions on Biomedical Engineering, vol. 66, no. 10, pp. 2882–2888, 2019. [4] D. Gradeci, A. Bove, G. Charras, A. R. Lowe, and S. Banerjee, "Single-cell approaches to cell competition: high-throughput imaging, machine learning and simulations," in Seminars in cancer biology, vol. 63, pp. 60–68, Elsevier, 2020. [5] J. Hayashida, K. Nishimura, and R. Bise, "Consistent cell tracking in multi-frames with spatio-temporal context by object-level warping loss," in Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pp. 1727–1736, 2022. [6] N. Emami, Z. Sedaei, and R. Ferdousi, "Computerized cell tracking: Current methods, tools and challenges," Visual Informatics, vol. 5, no. 1, pp. 1–13, 2021. [7] V. Ulman, M. Maška, K. E. Magnusson, O. Ronneberger, C. Haubold, N. Harder, P. Matula, P. Matula, D. Svoboda, M. Radojevic, et al., "An objective comparison of cell-tracking algorithms," Nature methods, vol. 14, no. 12, pp. 1141–1152, 2017. [8] S. U. Akram, J. Kannala, L. Eklund, and J. Heikkilä, "Cell tracking via proposal generation and selection," arXiv preprint arXiv:1705.03386, 2017. [9] K. He, G. Gkioxari, P. Dollár, and R. Girshick, "Mask r-cnn," in Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017. [10] R. Bise, Z. Yin, and T. Kanade, "Reliable cell tracking by global data association," in 2011 IEEE International Symposium on Biomedical Imaging: From Nano to Macro, pp. 1004–1010, IEEE, 2011. [11] O. Ronneberger, P. Fischer, and T. Brox, "U-net: Convolutional networks for biomedical image segmentation," in International Conference on Medical image computing and computer-assisted intervention, pp. 234–241, Springer, 2015. [12] R. Bensch and O. Ronneberger, "Cell segmentation and tracking in phase contrast images using graph cut with asymmetric boundary costs," in 2015 IEEE 12th International Symposium on Biomedical Imaging (ISBI), pp. 1220–1223, IEEE, 2015. [13] D. K. Gupta, N. de Bruijn, A. Panteli, and E. Gavves, "Tracking-assisted segmentation of biological cells," arXiv preprint arXiv:1910.08735, 2019. [14] J. Wang, X. Su, L. Zhao, and J. Zhang, "Deep reinforcement learning for data association in cell tracking," Frontiers in Bioengineering and Biotechnology, vol. 8, p. 298, 2020. 19 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT [15] V. Kulharia, S. Chandra, A. Agrawal, P. Torr, and A. Tyagi, "Box2seg: Attention weighted loss and discriminative feature learning for weakly supervised segmentation," in European Conference on Computer Vision, pp. 290–308, Springer, 2020. [16] F. Xing, Y. Xie, H. Su, F. Liu, and L. Yang, "Deep learning in microscopy image analysis: A survey," IEEE Transactions on Neural Networks and Learning Systems, vol. 29, no. 10, pp. 4550–4568, 2017. [17] E. Moen, D. Bannon, T. Kudo, W. Graf, M. Covert, and D. Van Valen, "Deep learning for cellular image analysis," Nature methods, vol. 16, no. 12, pp. 1233–1246, 2019. [18] U. Schmidt, M. Weigert, C. Broaddus, and G. Myers, "Cell detection with star-convex polygons," in International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 265–273, Springer, 2018. [19] A. Newell, Z. Huang, and J. Deng, "Associative embedding: End-to-end learning for joint detection and grouping," in Advances in neural information processing systems, pp. 2277–2287, 2017. [20] C. Payer, D. Štern, T. Neff, H. Bischof, and M. Urschler, "Instance segmentation and tracking with cosine embeddings and recurrent hourglass networks," in International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 3–11, Springer, 2018. [21] C. Payer, D. Štern, M. Feiner, H. Bischof, and M. Urschler, "Segmenting and tracking cell instances with cosine embeddings and recurrent hourglass networks," Medical image analysis, vol. 57, pp. 106–119, 2019. [22] M. Zhao, A. Jha, Q. Liu, B. A. Millis, A. Mahadevan-Jansen, L. Lu, B. A. Landman, M. J. Tyska, and Y. Huo, "Faster mean-shift: Gpu-accelerated clustering for cosine embedding-based cell segmentation and tracking," Medical Image Analysis, vol. 71, p. 102048, 2021. [23] D. Liu, D. Zhang, Y. Song, H. Huang, and W. Cai, "Panoptic feature fusion net: a novel instance segmentation paradigm for biomedical and biological images," IEEE Transactions on Image Processing, vol. 30, pp. 2045–2059, 2021. [24] Z. Zhao, L. Yang, H. Zheng, I. H. Guldner, S. Zhang, and D. Z. Chen, "Deep learning based instance segmentation in 3d biomedical images using weak annotation," in International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 352–360, Springer, 2018. [25] T. Zhao and Z. Yin, "Weakly supervised cell segmentation by point annotation," IEEE Transactions on Medical Imaging, vol. 40, no. 10, pp. 2736–2747, 2020. [26] H.-J. Oh, K. Lee, and W.-K. Jeong, "Scribble-supervised cell segmentation using multiscale contrastive regulariza- tion," in 2022 IEEE 19th International Symposium on Biomedical Imaging (ISBI), pp. 1–5, IEEE, 2022. [27] K. Lu, Y. Qian, J. Gong, Z. Zhu, J. Yin, L. Ma, M. Yu, and H. Wang, "Biofabrication of aligned structures that guide cell orientation and applications in tissue engineering," Bio-Design and Manufacturing, vol. 4, no. 2, pp. 258–277, 2021. [28] W. Liu, D. Anguelov, D. Erhan, C. Szegedy, S. Reed, C.-Y. Fu, and A. C. Berg, "Ssd: Single shot multibox detector," in European conference on computer vision, pp. 21–37, Springer, 2016. [29] J. Redmon, S. Divvala, R. Girshick, and A. Farhadi, "You only look once: Unified, real-time object detection," in Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 779–788, 2016. [30] N. Carion, F. Massa, G. Synnaeve, N. Usunier, A. Kirillov, and S. Zagoruyko, "End-to-end object detection with transformers," in European conference on computer vision, pp. 213–229, Springer, 2020. [31] M. Tan, R. Pang, and Q. V. Le, "Efficientdet: Scalable and efficient object detection," in Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 10781–10790, 2020. [32] C.-Y. Wang, A. Bochkovskiy, and H.-Y. M. Liao, "Scaled-yolov4: Scaling cross stage partial network," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 13029– 13038, June 2021. [33] J. Yang, C. Li, and J. Gao, "Focal modulation networks," arXiv preprint arXiv:2203.11926, 2022. [34] S. Mandal and V. Uhlmann, "Splinedist: Automated cell segmentation with spline curves," in 2021 IEEE 18th International Symposium on Biomedical Imaging (ISBI), pp. 1082–1086, IEEE, 2021. [35] Y. Jiang, X. Zhu, X. Wang, S. Yang, W. Li, H. Wang, P. Fu, and Z. Luo, "R2cnn: Rotational region cnn for orientation robust scene text detection," arXiv preprint arXiv:1706.09579, 2017. [36] X. Yang, J. Yan, Z. Feng, and T. He, "R3det: Refined single-stage detector with feature refinement for rotating object," in AAAI, 2021. 20 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT [37] G.-S. Xia, X. Bai, J. Ding, Z. Zhu, S. Belongie, J. Luo, M. Datcu, M. Pelillo, and L. Zhang, "Dota: A large-scale dataset for object detection in aerial images," in The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018. [38] X. Yang, X. Yang, J. Yang, Q. Ming, W. Wang, Q. Tian, and J. Yan, "Learning high-precision bounding box for rotated object detection via kullback-leibler divergence," in Advances in Neural Information Processing Systems (M. Ranzato, A. Beygelzimer, Y. Dauphin, P. Liang, and J. W. Vaughan, eds.), vol. 34, pp. 18381–18394, Curran Associates, Inc., 2021. [39] M. Maška, V. Ulman, D. Svoboda, P. Matula, P. Matula, C. Ederra, A. Urbiola, T. España, S. Venkatesan, D. M. Balak, et al., "A benchmark for comparison of cell tracking algorithms," Bioinformatics, vol. 30, no. 11, pp. 1609–1617, 2014. [40] E. Türetken, X. Wang, C. Becker, C. Haubold, and P. Fua, "Globally optimal cell tracking using integer program- ming," arXiv preprint arXiv:1501.05499, 2015. [41] S. U. Akram, J. Kannala, L. Eklund, and J. Heikkilä, "Joint cell segmentation and tracking using cell proposals," in 2016 IEEE 13th International Symposium on Biomedical Imaging (ISBI), pp. 920–924, IEEE, 2016. [42] K. Nishimura, J. Hayashida, C. Wang, D. F. E. Ker, and R. Bise, "Weakly-supervised cell tracking via backward- and-forward propagation," in European Conference on Computer Vision, pp. 104–121, Springer, 2020. [43] K. E. Magnusson and J. Jaldén, "A batch algorithm using iterative application of the viterbi algorithm to track cells and construct cell lineages," in 2012 9th IEEE International Symposium on Biomedical Imaging (ISBI), pp. 382–385, IEEE, 2012. [44] F. Boukari and S. Makrogiannis, "Automated cell tracking using motion prediction-based matching and event handling," IEEE/ACM transactions on computational biology and bioinformatics, vol. 17, no. 3, pp. 959–971, 2018. [45] B. Xu, J. Shi, M. Lu, J. Cong, L. Wang, and B. Nener, "An automated cell tracking approach with multi-bernoulli filtering and ant colony labor division," IEEE/ACM transactions on computational biology and bioinformatics, vol. 18, no. 5, pp. 1850–1863, 2019. [46] O. Hirose, S. Kawaguchi, T. Tokunaga, Y. Toyoshima, T. Teramoto, S. Kuge, T. Ishihara, Y. Iino, and R. Yoshida, "Spf-celltracker: Tracking multiple cells with strongly-correlated moves using a spatial particle filter," IEEE/ACM transactions on computational biology and bioinformatics, vol. 15, no. 6, pp. 1822–1831, 2017. [47] J. M. Llerena, L. F. Zeni, L. N. Kristen, and C. Jung, "Gaussian bounding boxes and probabilistic intersection- over-union for object detection," arXiv preprint arXiv:2106.06072, 2021. [48] Z. Chen, K. Chen, W. Lin, J. See, H. Yu, Y. Ke, and C. Yang, "Piou loss: Towards accurate oriented object detection in complex environments," in European conference on computer vision, pp. 195–211, Springer, 2020. [49] J. Murrugarra-Llerena, L. N. Kirsten, and C. R. Jung, "Can we trust bounding box annotations for object detection?," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, pp. 4813–4822, June 2022. [50] X. Yang, J. Yan, M. Qi, W. Wang, Z. Xiaopeng, and T. Qi, "Rethinking rotated object detection with gaussian wasserstein distance loss," in International Conference on Machine Learning (ICML), 2021. [51] A. Bhattacharyya, "On a measure of divergence between two multinomial populations," Sankhy ̄a: the indian journal of statistics, pp. 401–406, 1946. [52] E. Hellinger, "Neue begründung der theorie quadratischer formen von unendlichvielen veränderlichen.," Journal für die reine und angewandte Mathematik, vol. 1909, no. 136, pp. 210–271, 1909. [53] T. Kailath, "The divergence and bhattacharyya distance measures in signal selection," IEEE transactions on communication technology, vol. 15, no. 1, pp. 52–60, 1967. [54] H. W. Kuhn, "The hungarian method for the assignment problem," Naval research logistics quarterly, vol. 2, no. 1-2, pp. 83–97, 1955. [55] S. Huh, R. Bise, M. Chen, T. Kanade, et al., "Automated mitosis detection of stem cell populations in phase-contrast microscopy images," IEEE transactions on medical imaging, vol. 30, no. 3, pp. 586–596, 2010. [56] G. Bradski, "The OpenCV Library," Dr. Dobb's Journal of Software Tools, 2000. [57] L. Liu, W. Ouyang, X. Wang, P. Fieguth, J. Chen, X. Liu, and M. Pietikäinen, "Deep learning for generic object detection: A survey," International journal of computer vision, vol. 128, no. 2, pp. 261–318, 2020. [58] K. He, X. Zhang, S. Ren, and J. Sun, "Deep residual learning for image recognition," in Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. 21 Cell Tracking-by-detection using Elliptical Bounding Boxes A PREPRINT [59] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei, "Imagenet: A large-scale hierarchical image database," in 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255, Ieee, 2009. [60] J. Forrest, T. Ralphs, H. G. Santos, S. Vigerske, J. Forrest, L. Hafer, B. Kristjansson, jpfasano, EdwinStraver, M. Lubin, rlougee, jpgoncal1, Jan-Willem, h-i gassmann, S. Brito, Cristina, M. Saltzman, tosttost, B. Pitrus, F. MATSUSHIMA, and to st, "coin-or/cbc: Release releases/2.10.8," May 2022. [61] G. Van Rossum and F. L. Drake Jr, Python reference manual. Centrum voor Wiskunde en Informatica Amsterdam, 1995. [62] K. Bernardin and R. Stiefelhagen, "Evaluating multiple object tracking performance: the clear mot metrics," EURASIP Journal on Image and Video Processing, vol. 2008, pp. 1–10, 2008. [63] A. Milan, L. Leal-Taixé, I. Reid, S. Roth, and K. Schindler, "Mot16: A benchmark for multi-object tracking," arXiv preprint arXiv:1603.00831, 2016. [64] E. Ristani, F. Solera, R. Zou, R. Cucchiara, and C. Tomasi, "Performance measures and a data set for multi-target, multi-camera tracking," in European conference on computer vision, pp. 17–35, Springer, 2016. [65] F. Boukari and S. Makrogiannis, "Joint level-set and spatio-temporal motion detection for cell segmentation," BMC Medical Genomics, vol. 9, no. 2, pp. 179–194, 2016. [66] S. M. Lundberg and S.-I. Lee, "A unified approach to interpreting model predictions," in Advances in Neural Information Processing Systems 30 (I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, eds.), pp. 4765–4774, Curran Associates, Inc., 2017. [67] S. M. Lundberg, B. Nair, M. S. Vavilala, M. Horibe, M. J. Eisses, T. Adams, D. E. Liston, D. K.-W. Low, S.-F. Newman, J. Kim, et al., "Explainable machine-learning predictions for the prevention of hypoxaemia during surgery," Nature Biomedical Engineering, vol. 2, no. 10, p. 749, 2018. 22
http://arxiv.org/abs/2310.04889v1
"2023-10-07T18:21:35"
"2023-10-07T18:21:35"
GradXKG: A Universal Explain-per-use Temporal Knowledge Graph Explainer
Temporal knowledge graphs (TKGs) have shown promise for reasoning tasks by incorporating a temporal dimension to represent how facts evolve over time. However, existing TKG reasoning (TKGR) models lack explainability due to their black-box nature. Recent work has attempted to address this through customized model architectures that generate reasoning paths, but these recent approaches have limited generalizability and provide sparse explanatory output. To enable interpretability for most TKGR models, we propose GradXKG, a novel two-stage gradient-based approach for explaining Relational Graph Convolution Network (RGCN)-based TKGR models. First, a Grad-CAM-inspired RGCN explainer tracks gradients to quantify each node's contribution across timesteps in an efficient "explain-per-use" fashion. Second, an integrated gradients explainer consolidates importance scores for RGCN outputs, extending compatibility across diverse TKGR architectures based on RGCN. Together, the two explainers highlight the most critical nodes at each timestep for a given prediction. Our extensive experiments demonstrated that, by leveraging gradient information, GradXKG provides insightful explanations grounded in the model's logic in a timely manner for most RGCN-based TKGR models. This helps address the lack of interpretability in existing TKGR models and provides a universal explanation approach applicable across various models.
[ "Chenhan Yuan", "Hoda Eldardiry" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04889v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04889v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CL" ]
GradXKG: A Universal Explain-per-use Temporal Knowledge Graph Explainer Chenhan Yuan The University of Manchester Manchester, UK chenhan.yuan@manchester.ac.uk Hoda Eldardiry Virginia Tech Blacksburg, U.S. hdardiry@vt.edu 3 2 0 2 t c O 7 ] G L . s c [ 1 v 9 8 8 4 0 . 0 1 3 2 : v i X r a ABSTRACT Temporal knowledge graphs (TKGs) have shown promise for reason- ing tasks by incorporating a temporal dimension to represent how facts evolve over time. However, existing TKG reasoning (TKGR) models lack explainability due to their black-box nature. Recent work has attempted to address this through customized model archi- tectures that generate reasoning paths, but these recent approaches have limited generalizability and provide sparse explanatory out- put. To enable interpretability for most TKGR models, we propose GradXKG, a novel two-stage gradient-based approach for explain- ing Relational Graph Convolution Network (RGCN)-based TKGR models. First, a Grad-CAM-inspired RGCN explainer tracks gra- dients to quantify each node's contribution across timesteps in an efficient "explain-per-use" fashion. Second, an integrated gradi- ents explainer consolidates importance scores for RGCN outputs, extending compatibility across diverse TKGR architectures based on RGCN. Together, the two explainers highlight the most critical nodes at each timestep for a given prediction. Our extensive ex- periments demonstrated that, by leveraging gradient information, GradXKG provides insightful explanations grounded in the model's logic in a timely manner for most RGCN-based TKGR models. This helps address the lack of interpretability in existing TKGR models and provides a universal explanation approach applicable across various models. CCS CONCEPTS • Computing methodologies → Temporal reasoning. KEYWORDS Temporal knowledge graph, explainable AI, temporal knowledge graph reasoning, event forecasting, gradients-based explanation ACM Reference Format: Chenhan Yuan and Hoda Eldardiry. 2018. GradXKG: A Universal Explain- per-use Temporal Knowledge Graph Explainer. In Proceedings of Make sure to enter the correct conference title from your rights confirmation emai (Conference acronym 'XX). ACM, New York, NY, USA, 10 pages. https: //doi.org/XXXXXXX.XXXXXXX Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org. Conference acronym 'XX, June 03–05, 2018, Woodstock, NY © 2018 Association for Computing Machinery. ACM ISBN 978-1-4503-XXXX-X/18/06. . . $15.00 https://doi.org/XXXXXXX.XXXXXXX 1 INTRODUCTION Since knowledge graphs are dynamic in nature, i.e., evolve over time, Temporal Knowledge Graphs (TKG) have a promising po- tential in the fields of question answering [10, 21], event fore- casting [2, 15], and information retrieval [6]. Unlike conventional static knowledge graphs, which represent each fact with a triplet (sub ject, relation, ob ject), temporal knowledge graphs incorporate a temporal dimension to represent how facts and relations evolve over time. In general, a temporal knowledge graph represents each fact using a quadruple (sub ject, relation, ob ject, timestamp). Con- ventionally, a temporal knowledge graph is represented by decom- posing it into a sequence of static knowledge graphs, each of which contains all facts at the corresponding timestamp. TKGs provide new perspectives and insights for many down- stream applications, e.g., disease diagnosis aid[4] and stock pre- diction [3]. The unique promise of TKGs has sparked a growing interest in reasoning over TKG. TKG reasoning (TKGR) is a task to validate whether a query relationship between two entities is true, given the context provided by the TKG. With the rise of graph neural networks (GNN), most existing TKGR methods first leverage Relational Graph Convolutional Networks (RGCNs) [22], a type of GNN well-suited for multi-relational graphs like TKGs, to encode the local graph structure into dense vector representations. Various neural architectures are then applied on top of the RGCN encodings to score the validity of the query relationship. For instance, cur- riculum learning and neural ordinary differential equations have been used to enhance TKGR performance [8, 13]. While RGCN- based TKGR models have achieved significant improvements over general neural network models, RGCN-based TKGR models still lack explainability due to their end-to-end black-box nature. The reasoning process behind their predictions is opaque. This lack of explainability is a critical limitation because explainability is crucial for trustworthy AI systems. Recent work has attempted to address this limitation by de- signing customized model architectures that can generate reason- ing paths along with the prediction results. For example, Time- Traveler [25] proposed a reinforcement learning-based explainable TKGR model that works as follows. Given a query: (Governor (Cote d'Ivoire), Make an appeal or request, ?, 2018/10/14), it generates the reasoning path: (Governor (Cote d'Ivoire), Praise or endorse, Party Member, 2018/10/12)→(Party Member, Make an appeal or request, Citizen, 2018/9/29). However, existing explainable TKGR models have two critical problems: 1) They are constrained by requiring custom-designed model architectures to enable reasoning path gen- eration. This leads to a lack of generalizability, which is a major drawback, as it prevents easy application to the myriad of most Conference acronym 'XX, June 03–05, 2018, Woodstock, NY Chenhan Yuan and Hoda Eldardiry Figure 1: Comparison between the proposed GradXKG and conventional explainable TKGR models (xTKGR). Node color shade represents node importance; darker yellow is more important than lighter yellow. Dashed arrows denote the same entities in different timestamps. e? is the query entity. non-explainable TKGR models, i.e., RGCN-based models. 2) As il- lustrated in Fig 1, current explainable TKGR models only provide reasoning paths with very few nodes per static knowledge graph. This sparse explanatory output fails to capture the complex in- terdependencies within the broader knowledge graph context. In particular, it is difficult to fully trust or evaluate the faithfulness of explanations without the ability to account for the potential impact of other entities. To address these challenges, it is necessary to design a universal explainer that can work for most RGCN-based TKGR models. A sim- ple and intuitive possible approach is to follow the GNNExplainer method, by masking a node/edge in the TKG, and observing its impact on the TKGR model prediction performance. [31]. However, to obtain the importance of all nodes across all timestamps, the GNNExplainer-based method requires repeating the test at least O (n ∗ m) times; where n is the number of nodes and m is the num- ber of timestamps for various inputs; as shown in Fig 2. This is an exhaustive process that scales poorly as the knowledge graph grows. We propose a more efficient approach to design a universal explainer. More specifically, we propose a universal TKGR model explainer that works by analyzing the model's gradients. In doing so, it provides real-time rationales for each individual prediction, elucidating the model's logic in an accessible "explain-per-use" fash- ion. In this paper, we propose GradXKG: a novel two-stage approach for generating explanations of RGCN-based temporal knowledge graph reasoning (TKGR) models. Our proposed GradXKG approach bridges a critical gap in universal explainable temporal knowledge graph reasoning. Our method leverages gradient information to highlight the most influential nodes across timesteps. First, a Grad- CAM-inspired RGCN explainer tracks gradients flowing into each node at each timestep, quantifying the contribution of that node to the RGCN output tensors in each run. Secondly, to extend the compatibility of our proposed approach to TKGR architectures that utilize RGCN, we propose an integrated gradients-based top-layer Figure 2: Comparison between the proposed GradXKG and perturbation-based methods. g(*) denotes TKGR models. Perturbation-based methods require at least n times running to determine node importance in TKG. explainer. This proposed explainer layer tracks the contribution of RGCN output tensors toward the final prediction in the top layer of these TKGR models. Moreover, the top-layer explainer associates RGCN output tensors with prediction scores regardless of the model specifics. This allows our approach to be applicable to any neural network-based RGCN TKGR model. Together, the two explainers produce a heat map spotlighting the most critical nodes at each timestep for a given prediction. Going beyond perturbation-based approaches, our proposed "explain-per-use" mechanism provides explanations that are tailored to each individual prediction in a time- efficient manner. Furthermore, GradXKG enables interpretability within most RGCN-based TKGR models. This is achieved by gener- ating explanations that are informed by gradient information. Our main contributions can be summarized as follows: • We proposed the first novel gradient-based two-stage RGCN- based TKGR explanation approach (GradXKG) that can ex- plain all RGCN-based TKGR models. To the best of our knowl- edge, this is the first effort in this research area. • We proposed a Grad-CAM-based RGCN-explainer in an "explain-per-use" fashion, which significantly reduces time complexity compared to perturbation methods. • We proved that our proposed explainer can be approximated to the Grad-CAM GCN model if both are unsigned. • Our extensive experiments demonstrate that the proposed GradXKG can outperform other explanation methods in terms of explanation sufficiency and accuracy. 2 RELATED WORK 2.1 Temporal Knowledge Graph Reasoning Models Temporal knowledge graph reasoning is an emerging field that aims to model the evolution of real-world events and their relationships over time. This task involves two key settings: interpolation, which focuses on completing knowledge graphs over a given time span, and extrapolation, which forecasts future facts based on histori- cal data [13, 15]. Early work on extrapolation like Know-Evolve utilized temporal point processes to capture continuous-time dy- namics [27]. However, graph neural networks (GNNs) have since become the dominant modeling approach due to their ability to GradXKGxTKGRGradXKGgradientstrackingremove node(s)selectionrepeat n timesPerturbation GradXKG: A Universal Explain-per-use Temporal Knowledge Graph Explainer Conference acronym 'XX, June 03–05, 2018, Woodstock, NY encode both structural and temporal dependencies. In particular, relational GCNs (RGCNs) have emerged as a powerful tool for temporal knowledge graph reasoning [22]. RE-NET pioneered the use of RGCNs with an autoregressive encoder to model long-term temporal patterns [11]. RE-GCN further improved modeling by emphasizing graph dependency learning [15]. Later, Zhang et al. proposed a hierarchical RGCN to learn both long global and short local representations of temporal knowledge graphs [34]. Han et al. adapted neural ordinary differential equations on RGCN so that they can be applied in continuous space as temporal knowledge graphs vary continuously over time [8]. To better forecast unseen entities and relations, MTKGE utilized meta-learning to sample from exist- ing temporal knowledge graphs to simulate future scenarios [29]. CENET learned both historical and non-historical dependency and distinguished the dependency type of predicted events using con- trastive learning [30]. Li et al.consider the length, diversity, and time-variability of evolutional patterns by introducing curriculum learning and online learning [13]. Overall, the ubiquity of RGCNs in TGKR models demonstrates their importance for encoding local graph structures, on top of which more complex temporal reasoning techniques can be developed. Several other approaches generate predictions along with vali- dated reasons. These explainable techniques can be categorized into three main types: logic rule-based, reinforcement learning-based, and attention-based. Logic rule mining is a popular technique for explainable forecasting on temporal knowledge graphs. TLogic extracts logic rules from the graph via temporal walk estimation and then applies the rules to make predictions [17]. Lin et al. train encoders to incorporate both graph structures and logic rules[16]. Reinforcement learning has also been leveraged for explainable reasoning. Sun et al. developed an RL agent that travels optimal paths on the knowledge graph to predict future events [25]. The agent's trajectory explains its decision-making. Similarly, Li et al. first find relevant event clusters and then use RL search to forecast those subgroups [14]. Attention mechanisms are another way to en- able explainability. Some methods learn to expand an initial query by attending to important neighboring nodes [7]. The attended subgraphs indicate the influential regions for prediction. Jung et al. also apply graph attention to iteratively propagate attention weights towards target nodes and use these weights to provide model interpretability [12]. 2.2 Graph Neural Networks Explanation GNN explainers can be broadly classified into two distinct cate- gories: perturbation-based methods and gradient-based methods [32]. Perturbation-based explainers identify important graph compo- nents (nodes, edges, or features) by removing or masking compo- nents and measuring the resulting impact on model predictions. A significant change in predictions when a component is masked indicates high relevance. For example, GNNExplainer identifies compact subgraph structures that are important for a prediction by using mutual information to quantify the difference between predic- tions on the original versus perturbed graph [31]. SubgraphX also masks substructures but uses Shapley values to measure subgraph importance based on contribution to the model output [33]. Another Figure 3: General architecture of an RGCN-based TKGR model. We propose to explain an RGCN-based TKGR model by decomposing it into two sub-modules: RGCN explainer and Top-layer explainer. perturbation-based method called PGM-Explainer illustrates depen- dencies between important features and provides interpretations of a model's reasoning using Bayesian network concepts [28]. In contrast, gradient-based explainers focus directly on analyzing gradient information flow through the neural network model itself. The key idea is that components with high gradient magnitude likely have high relevance or impact on predictions. For example, GNN-LRP utilizes layer-wise relevance propagation, a technique that redistributes relevance scores based on neural network acti- vations, to generate detailed explanations of predictions [1, 23]. GraphLIME adapts a popular local explanation method called LIME, which stands for Local Interpretable Model-Agnostic Explanations, to graph domains using nonlinear feature selection [9, 20]. Some methods extend gradient visualization techniques like Grad-CAM, originally designed for convolutional neural networks, to graph neural networks to improve explainability [18, 19, 24]. 3 PROPOSED GRADXKG METHOD Conventionally, as shown in Fig. 3, an RGCN-based temporal knowl- edge graph reasoning model utilizes the Relational Graph Convolu- tional Network (RGCN) as the base model to encode graph informa- tion in each individual timestamp. On top of RGCN outputs, various reasoning methods are deployed, such as curriculum learning [13], and autoregressive encoder [11], to yield a score ranging from 0- 1 that indicates if the query triplet will happen in the future or not. The process can be formally defined as follows: Suppose a set G = {G1, G2, * * * .GT } represents the individual static knowledge graph in each timestamp t, a regular temporal knowledge graph reasoning model can be defined as: s = f (H1, H2, * * * , Ht ) Hi = RGCN (Gi ) (1) where RGCN (*) is the RGCN model that takes each static knowl- edge graph as input. f (*) represents the complex temporal knowl- edge graph reasoning model that outputs a scalar score s. As shown RGCNRGCNRGCNRGCN explainerTop-layerexplainerGradXKG Conference acronym 'XX, June 03–05, 2018, Woodstock, NY Chenhan Yuan and Hoda Eldardiry in the Eq. 1, our explanation method can also be decomposed into two parts: Grad-CAM-based RGCN explanation, i.e., RGCN (*) ex- plainer, and a universal top-layer explanation, i.e., f (*) explainer. 3.1 Gradient-based RGCN Explainer We start deriving our method from a simple setting: Assume that only the RGCN model itself is used in the temporal knowledge graph reasoning model. Then we have s = RGCN (Gi ) following Eq. 1. That is, the output of RGCN is a scalar that indicates the prediction of the whole model. We propose to design a gradient- based RGCN explainer method to explain this simple architecture. Currently, the most popular gradient-based convolutional neural network (CNN) explanation method, Grad-CAM, has been success- fully extended to graph convolutional networks (GCN) as GCN shares the similar convolutional layer as CNN [19, 24]. The key idea of GCN Grad-CAM is to use the gradients of the target classifi- cation flowing into the final convolutional layer to produce a coarse localization map highlighting the important nodes for predicting the classification result. Formally, the first step of GCN-based Grad- CAM is to determine the k'th graph convolutional feature map at layer l: k (X, A) = σ ( ̃D − 1 Ml 2 ̃A ̃D − 1 2 Ml −1 (X, A)W l k ) (2) where X ∈ RN ×dx is the representation of the nodes, N is the number of nodes in the graph, and A ∈ Rdx ×dx is the adjacency matrix. ̃A = A + IN is the adjacency matrix of the undirected graph ̃Ai j , with added self-connections. IN is the identity matrix, ̃Dii = (cid:205)j and W l is the k-th column of matrix Wk . Then the importance score k In can be used to generate a heat map for a node n defined as follows: αl k = IGCN n = 1 N 1 L N ∑︁ n=1 L ∑︁ l=1 ∂y k,n (X, A) ∂Ml (3) ReLU ( k Ml αl k,n (X, A)) ∑︁ k where Ml k,n (X, A)) denotes the k'th feature at the l'th layer of node n. That is, the importance score of each node is a weighted sum over all feature columns associated with each node. However, despite the success of this simple yet effective gradient-based approach, it cannot be directly applied to the RGCN model. This is because the RGCN model binds different relational edges with different matrices so no W l can be defined for the RGCN model. This can be k formally observed in the following definition of the RGCN model: h (l+1) i ∑︁ = σ (cid:169) (cid:173) r ∈ R (cid:171) ∑︁ j ∈ Nr i 1 ci,r W (l ) r h (l ) j + W (l ) 0 h (l ) i (cid:170) (cid:174) (cid:172) , (4) where Nr i denotes the set of neighbor indices of node i under relation r ∈ R and h ( i l) is the hidden state of node i in layer l. ci,r is a normalization constant. As shown in the Eq. 4, the hidden representation of node i in layer l + 1 is contributed by a set of relation matrices W l r instead of one W l . Therefore, Eq. 3 cannot be directly applied to the RGCN model. To extend the compatibility of GCN Grad-CAM to RGCN, we first convert Eq. 4 into matrix graph representation form: H (l+1) = σ (cid:32) ∑︁ r ∈R Ar H (l )W (l ) r + IN H (l )W (l ) 0 (cid:33) (5) where Ar is a relation-specific adjacency matrix as shown in the following equation. Ar,i,j = (cid:26) 1 0 E (i, j) ∈ r else (6) where E (i, j) ∈ ∇ means the edge between nodes i and j represents relation type r . In this way, we can define the k-th RGCN feature map at layer l under each relation individually. Formally, combining Eq. 5 and Eq. 3, the k-th RGCN feature map under relation r can be derived as follows: H (l+1) k,r r,k + IN H (l )W (l ) (cid:16) Ar H (l )W (l ) = σ 0,k (7) (cid:17) Then the relation-dependent gradient-based weight αl for k-th feature in l-th layer under r -th relation can be derived as follows: k,r αl k,r = 1 N N ∑︁ n=1 N ∑︁ ∂Hl ∂s k,n,r (X, A) ∂y ∂σ (*) (8) = 1 N ∂σ (*) k,n,r (X, A) where s is the final score. In this way, the weights derived here are always associated with one specific relation. r,k + INW (l ) (cid:16) ArW (l ) ) ∂Hl −1 n=1 0,k (cid:17) Following a similar procedure as in Eq. 3, the importance score In,r,l for node n from layer l under relation r is defined as follows: ∑︁ I RGCN n,r,l = ReLU ( k,r Hl αl k,n,r (X, A)) (9) We use the average In,r,l as the final importance score: k I RGCN n,r = 1 L L ∑︁ l=1 I RGCN n,r,l (10) Note that the implementation complexity of Eq. 9 increases as the number of relations increases. Therefore, we propose the following approximation that averages over the relation r dimension: I RGCN n ≈ 1 R R ∑︁ r =1 1 L L ∑︁ l=1 I RGCN n,r,l (11) 3.2 Theoretical Analysis of RGCN Grad-CAM We provide a theoretical analysis of the proposed Grad-CAM-based RGCN explainer in this section. First, note that the derived RGCN explainer is equivalent to the original GCN Grad-CAM if the output is unsigned. Formally, we define the equivalence theorem as follows: Theorem 1. I RGCN n ≈ IGCN n iff. both I RGCN n and IGCN n are unsigned. Proof. To prove the equivalence theorem, we first convert Eq. 3 into unsigned format by removing the ReLU (*) function: L ∑︁ ∑︁ k Ml αl k,n (X, A) IGCN n = 1 L l=1 k (12) GradXKG: A Universal Explain-per-use Temporal Knowledge Graph Explainer Conference acronym 'XX, June 03–05, 2018, Woodstock, NY k,n (X, A) Then the I RGCN n can be derived as follows: I RGCN n = = 1 R 1 R R ∑︁ r =1 R ∑︁ r =1 L ∑︁ 1 L 1 L L ∑︁ l=1 L ∑︁ l=1 In,r,l ReLU ( ∑︁ k αl k,r Hl k,n,r (X, A)) 1 R R ∑︁ r =1 ∑︁ k αl k,r Hl k,n,r (X, A) (unsigned) ⇒ 1 L 1 L = l=1 L ∑︁ ∑︁ βl k,n (X, A) k n with IGCN n , the only difference is between βl l=1 Comparing I RGCN and αl k,n (X, A). However, we consider that βl Ml k,n (X, A) represents k the averaged k-th feature along r dimension, which is equivalent αl □ k k,n (X, A). Therefore, we have I RGCN Ml Directly applying Eq. 4 to relational graphs in practice can lead to over-fitting on rare relations as the number of relations can rapidly grow. Therefore, the original RGCN provides a linear combination of basis transformations to represent relation matrices Wr . It is defined as follows: ≈ IGCN n n . W (l ) r = B ∑︁ b=1 a (l ) rb V (l ) b (14) b ∈ Rdr ×do is the b-th basis in layer l. Note that this de- where V l composition method is consistent with Theorem 1. Theorem 2. THEOREM 1 holds when W (l ) Proof. To prove Theorem 2, we first convert the decomposition b=1 a (l ) V (l ) b = (cid:205)B rb r equation into a matrix form: = U l r B (l ) W (l ) (15) r r ∈ R1×B where Bl ∈ RB×dr ×do is the stack of the set of all basis. U l is a linear combination of all coefficients a (l ) . We can therefore rb derive the hidden layer of RGCN under basis decomposition as follows: H (l+1) = σ (cid:32) ∑︁ r ∈R Ar H (l ) [U l r B (l ) ] + IN H (l )W (l ) 0 (cid:33) (16) r B (l ) ] is equivalent to the original W l Note that [U l matrix shape. Therefore, the computation of αl (Eq. 8∼11)remains unchanged. As the final I RGCN same format, Theorem 1 still holds. r in terms of k,n,r (X, A) preserves the □ and Hl k,r n 3.3 Top-Layer Integration 3.3.1 Top-Layer Explanation Method. We proposed a top-layer ex- planation method that is model-agnostic so it can work with any model type in the layers above the RGCN. In particular, we utilize the integrated gradients method to quantify the contribution of each tensor to the model prediction for the layers above the RGCN. Integrated gradients is an explanation method by attributing a pre- diction to individual features [26]. The integrated gradients method then calculates the contribution of each feature by integrating the gradients of the model's output with respect to that feature. This calculation is carried out along a path from a baseline input to the ac- tual input. Formally, the integrated gradients for a one-dimensional tensor x can be defined as follows: IG (x) ::= (x − x ′) ∫ 1 α=0 ∂f (x ′ + α (x − x ′)) ∂x dα (17) (13) where f (*) denotes the general neural network function and x ′ is the base input. In practice, x ′ is set to random or zeros. Note that the integral part of Eq. 17 is not applicable in neural networks. Therefore, we approximate the Eq. 17 by summing over small intervals. Then we have: p ∑︁ ∂f (x ′ + IG (x) ≈ (x − x ′) (18) p α (x − x ′)) ∂x 1 p where p is the sampling times. α=1 3.3.2 Explanation Integration. Our proposed RGCN explainer pro- vides node-level explanations by quantifying each node's contribu- tion to the final predicted scalar score s, as shown in Eq. 8. However, this formulation assumes that the RGCN model outputs s directly, which is not always true, since many models integrate RGCN as an intermediate component. In this case, additional processing is applied to the RGCN outputs before producing the final predic- tion. Our proposed RGCN explainer further considers cases when models include intermediate RGCN components by propagating explanations through intermediate components to subsequent lay- ers. For example, given an intermediate tensor t generated by the RGCN, we compute explanations in two steps. First, we compute the importance of each node to generate t. Second, we compute the importance of t to generate the final prediction. Finally, each node's final explanation is the sum of the nodes contribution to t combined with t's contribution to the final prediction. More formally, for a model defined as in Eq. 1, the derivation of the final predicted score for any node n can be expressed as: In = = ∂s ∂n ∂s ∂f ∂f ∂RGCN (Gt ) ∂f ∂RGCN (Gt ) = f ′ (Ht ) (19) = IG (Ht ) * I RGCN n 4 EXPERIMENTS In this section, we conduct extensive experiments to evaluate our proposed GradXKG's performance on RGCN-based TKGR models. Specifically, we investigate four research questions: • Does GradXKG provide more sufficient explanations than model- specific approaches for all evaluated RGCN-based TKGR mod- els? • Compared to perturbation-based methods, does GradXKG offer comparable or superior explanation quality with lower time costs? • Does the proposed RGCN explainer in GradXKG contribute to explanation quality? • Can GradXKG provide relevant, validated explanations? Conference acronym 'XX, June 03–05, 2018, Woodstock, NY Chenhan Yuan and Hoda Eldardiry Models ICEWS14 N=5 ICEWS0515 ICEWS18 Fidelity Stability Time Cost Fidelity Stability Time Cost Fidelity Stability Time Cost TLogic TimeTraveler per-RE-NET per-CEM IG-RE-NET IG-CEM 0.50 0.59 0.77 0.81 0.48 0.57 0.67 0.69 0.85 0.95 0.55 0.53 1.0 1.6 76.6 97.8 2.5 1.3 0.58 0.57 0.76 0.88 0.47 0.44 0.55 0.54 0.87 0.94 0.57 0.46 1.1 1.5 70.9 92.2 3.2 1.5 0.55 0.55 0.86 0.83 0.41 0.50 0.58 0.68 0.82 0.89 0.45 0.45 1.3 1.7 78.0 98.5 2.4 1.9 0.61 0.70 xRE-NET xCEM Table 1: Automatic evaluation scores of each explainable TKGR model under three datasets. N denotes the number of nodes output by the models as an explanation. 0.77 0.78 0.73 0.76 0.79 0.82 0.73 0.71 0.65 0.74 1.3 1.0 1.2 1.0 1.1 1.0 4.1 Experimental Settings 4.1.1 Datasets. Currently, there are no TKGR datasets designed specifically for explainable TKGR model evaluation that contain ex- planations associated with each quadruple (fact). Therefore, we first utilize the standard ICEWS14 [5], ICEWS18 [11], and ICEWS0515 [5] datasets from the Integrated Crisis Early Warning System to evalu- ate our proposed GradXKG method implemented on TKGR models, following previous work. We then designed an automatic evalu- ation approach that is based on faithfulness and trustworthiness criteria and does not require a golden standard testing set with explanations. Additionally, we conducted a human evaluation to further assess the performance of the generated explanations. 4.1.2 Baselines. We implemented our approach on two state-of- the-art RGCN-based TKGR models: CEM [13] and RE-NET [11]. Since there are currently no universal or gradient-based expla- nation methods for TKGR models to compare against, we imple- mented two model-specific explainable TKGR methods as baselines: TimeTraveler [25] and TLogic [17]. We also implemented a simple perturbation-based explanation method on both CEM and RE-NET as additional baselines to benchmark GradXKG. To analyze the effectiveness of the proposed RGCN explainer, we conducted an ab- lation study by replacing RGCN explainer with integrated gradients. In total, we compared eight methods: xCEM: A curriculum learning- based RGCN TKGR model. xCEM denotes that GradXKG is imple- mented on CEM. xRE-NET: A autoregressive RGCN TKGR model. xRE-NET means GradXKG implemented version. per-CEM: CEM model with perturbation-based method-generated explanations. per-RE-NET: RE-NET model with perturbation-based method- generated explanations IG-CEM: The whole CEM model is ex- plained by integrated gradients. IG-RE-NET: The whole RE-NET model is explained by integrated gradients. TimeTraveler: A RL- based explainable TKGR model. This model does not contain RGCN architecture. TLogic: A temporal random walk-based explainable TKGR model that does not use RGCN. 4.1.3 Evaluation Metrics. Given the lack of explainable TKGR model evaluation datasets, we assessed the quality of generated explana- tions through both automatic and human evaluation. We utilized three automatic evaluation metrics, namely fidelity, stability, and time complexity. We also used three human evaluation criteria, namely validity, relevance, and sufficiency. Following previous work on GNN explanation [32], we con- sidered the following two automatic criteria. 1) Fidelity, which measures whether the explanations are faithfully important to the model's predictions. Formally, fidelity can be defined by measuring the prediction gap between the original graph input and graph input that lacks important nodes: Fidelity = 1 N N ∑︁ i=1 mi (f (Gi ) − f (G i )) (20) mi where f (*) denotes the TKGR model, Gi is the input graph, and G i is the graph with important node mi removed. 2) Stability, which measures the ability of the explainable TKGR model to produce a consistent explanation when the input graph is slightly altered or perturbed. We measure stability as follows: Stability = |Np ∩ No | |No | (21) where Np is the set of important nodes generated when the input graph is altered and No is the set of important nodes generated when the input graph is the original one. In addition to fidelity and stability, we also report the time complexity of each explanation method. In addition to the automatic evaluation, we also included three human evaluation metrics as follows. Two annotators evaluated explanations based on three metrics: validity, relevance, and suffi- ciency criteria using a 3-point scale (1=low, 3=high). Validity mea- sures whether the explanation is logically valid based on the an- notator's knowledge, indicating if the model learned the expected features. Relevance measures whether selected nodes are connected meaningfully to the target node. Sufficiency measures if the explana- tion contains enough nodes to sufficiently understand the reasoning behind the prediction, since explanations with too few nodes may lack context. Note that there may be a trade-off between relevance and sufficiency, since more nodes may increase sufficiency but de- crease relevance. The detailed evaluation guideline is provided in Appendix A. GradXKG: A Universal Explain-per-use Temporal Knowledge Graph Explainer Conference acronym 'XX, June 03–05, 2018, Woodstock, NY Models ICEWS14 N=9 ICEWS0515 ICEWS18 Fidelity Stability Time Cost Fidelity Stability Time Cost Fidelity Stability Time Cost TLogic TimeTraveler per-RE-NET per-CEM IG-RE-NET IG-CEM 0.44 0.50 0.78 0.83 0.41 0.47 0.53 0.49 0.87 0.93 0.53 0.52 1.3 3.0 76.5 97.6 2.4 1.5 0.47 0.51 0.88 0.75 0.43 0.46 0.51 0.52 0.83 0.95 0.55 0.40 1.7 2.7 70.9 92.3 3.1 1.3 0.40 0.40 0.71 0.80 0.44 0.36 0.54 0.56 0.90 0.94 0.54 0.42 2.1 3.2 78.1 98.5 2.5 1.9 0.63 0.74 xRE-NET xCEM Table 2: Fidelity and stability scores of each explainable TKGR model under three datasets. N denotes the number of nodes output by the models as an explanation. 0.78 0.74 0.75 0.78 0.77 0.85 0.71 0.70 0.70 0.72 1.8 1.0 1.4 1.0 1.3 1.0 4.2 Automatic Evaluation Results We conduct two experiments where the number of nodes output in the explanation is constrained to 5 and 9, representing reasoning paths of lengths 3 and 4, respectively. This allows us to evaluate the performance of GradXKG compared to TimeTravler and TLogic, which have constraints on the length of the reasoning path they can output. The results in Table 1 demonstrate that with 5 node explanations, GradXKG achieves higher fidelity and stability scores than TimeTravler and TLogic on all datasets. Specifically, on the ICEWS05015 dataset, the xCEM and xRE-NET variants of GradXKG obtain fidelity scores of 0.73 and 0.71, and stability scores of 0.77 and 0.78; compared to 0.58 and 0.57 fidelity, and 0.55 and 0.54 sta- bility for TimeTravler and TLogic, respectively. This shows that despite being a universal explainer without special architectural constraints, GradXKG can generate more trustworthy explanations than previous constrained models. We also compare GradXKG to perturbation-based methods, which intrinsically optimize explanation fidelity and stability. As expected, these methods slightly outperform GradXKG but at a drastically higher computational cost. For instance, per-CEM takes 97.8 times longer than xCEM on the ICEWS14 dataset, demonstrating the efficiency of GradXKG's "explain-per-use" approach. Note that TLogic is not theoretically runnable when the reason- ing path length is longer than 5. Therefore, we also set the generated number of nodes requirement to be 9 and show the results in Ta- ble. 2. Compared to the 5-node experiment, the 9-node experiment shows that most perturbation and gradient-based methods maintain a similar performance across all three automatic criteria. This is because they score all nodes and select the top ones. However, Time- Travler and TLogic slow down considerably and have lower fidelity and stability as they are constrained by needing to traverse explana- tion trajectories. Overall, the experiments demonstrate GradXKG's ability to generate trustworthy explanations efficiently despite its model-agnostic nature. 4.3 Human Evaluation and Qualitative Analysis Human Evaluation To further evaluate the quality of the gener- ated explanations, we randomly selected 50 generated explanations from each compared method and asked two experienced annotators to rate the quality of the explanations based on the aforementioned criteria. As shown in Fig. 5, the saliency map explanations gener- ated by GradXKG achieved higher sufficiency scores compared to the other methods. This demonstrates that compared to reasoning path explanations, like those from TLogic and TimeTraveler, the proposed GradXKG method can provide more contextual infor- mation by assigning importance scores to all nodes in the TKG. Furthermore, the relevance scores of xCEM are comparable to those of TLogic, indicating that the importance scores of each node are aligned with its contribution to the prediction. We also observed differences in the evaluation results between xRE-NET and xCEM even when using the same GradXKG method. This discrepancy can be attributed to the fact that the explainer's performance also heavily depends on the capabilities of the original model. Qualitative Analysis We include two saliency maps generated by xCEM, the best variant of GradXKG, when the following query is submitted to the model: (National Council for Peace and Order of Thailand, Make Statement, ?, 2014-07-24) and (John Kerry, Engage in negotiation, ?, 2014-07-24). The correct answers to these two queries are Thailand and Benjamin Netanyahu, respectively. As shown in Fig. 4, GradXKG revealed that the CEM model relied on nodes/entities that are highly related to the queries in order to make the correct predictions. For instance, for the query (John Kerry, Engage in negotiation, ?, 2014-07-24), CEM attended to other U.S. government officials like Barack Obama and international political organizations such as "UN Security Council" as well as politicians in the Middle East region. This demonstrates that with the proposed GradXKG method, RGCN-based TKGR models' predictions can be accurately interpreted and explained. 4.4 Ablation Study To evaluate the effectiveness of the proposed RGCN explainer, we also conducted an ablation study by replacing the RGCN explainer with integrated gradients (IG). The node importance score is calcu- lated by averaging the IG scores across the whole vector representa- tion of that node. As shown in Tables 1 and 2, the IG-based RE-NET and CEM methods perform much worse in terms of fidelity and stability. This demonstrates the effectiveness and trustworthiness Conference acronym 'XX, June 03–05, 2018, Woodstock, NY Chenhan Yuan and Hoda Eldardiry Figure 4: The saliency maps generated by xCEM, where big nodes are the selected important nodes by GradXKG. We omit the rest of the TKGs and timestamps for better illustration. Figure 5: The box plots of human evaluation for each criterion of each baseline method. The dashed line denotes the mean value and the bold line indicates the median value. of the proposed RGCN explainer. Furthermore, as illustrated in Fig. 5, the human evaluation also suggests that IG-only RE-NET or CEM methods cannot provide a saliency map with high validity, relevance, and sufficiency. Together, this shows the necessity and effectiveness of the proposed RGCN explainer. 5 CONCLUSION In this paper, we propose GradXKG, a universal explain-per-use temporal knowledge graph explainer. The proposed approach can be applied to most RGCN-based TKGR models to generate saliency maps that indicate node importance (contribution) towards the prediction as the explanation. Our proposed explainer model tracks the gradient flow in the whole model by introducing, and com- bining, two explainers: a Grad-CAM-based RGCN explainer and an integrated gradient-based top-layer explainer. Our extensive experiments demonstrate that with GradXKG, most state-of-the-art TKGR models can be explained with high fidelity and stability in a time-efficient manner. REFERENCES [1] Sebastian Bach, Alexander Binder, Grégoire Montavon, Frederick Klauschen, Klaus-Robert Müller, and Wojciech Samek. 2015. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PloS one 10, (John Kerry, Engage in negotiation, ?, 2014-07-24)(National Council for Peace and Order of Thailand, Make statement, ?, 2014-07-24) GradXKG: A Universal Explain-per-use Temporal Knowledge Graph Explainer Conference acronym 'XX, June 03–05, 2018, Woodstock, NY 7 (2015), e0130140. [2] Songgaojun Deng, Huzefa Rangwala, and Yue Ning. 2020. Dynamic knowledge graph based multi-event forecasting. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. 1585–1595. [3] Shumin Deng, Ningyu Zhang, Wen Zhang, Jiaoyan Chen, Jeff Z Pan, and Huajun Chen. 2019. Knowledge-driven stock trend prediction and explanation via tem- poral convolutional network. In Companion Proceedings of The 2019 World Wide Web Conference. 678–685. [4] Lijuan Diao, Wei Yang, Penghua Zhu, Gaofang Cao, Shoujun Song, and Yang Kong. 2021. The research of clinical temporal knowledge graph based on deep learning. Journal of Intelligent & Fuzzy Systems 41, 3 (2021), 4265–4274. [5] Alberto Garcia-Duran, Sebastijan Dumančić, and Mathias Niepert. 2018. Learning Sequence Encoders for Temporal Knowledge Graph Completion. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing. 4816–4821. [6] Simon Gottschalk and Elena Demidova. 2018. Eventkg: A multilingual event- centric temporal knowledge graph. In The Semantic Web: 15th International Confer- ence, ESWC 2018, Heraklion, Crete, Greece, June 3–7, 2018, Proceedings 15. Springer, 272–287. [7] Zhen Han, Peng Chen, Yunpu Ma, and Volker Tresp. 2021. Explainable Sub- graph Reasoning for Forecasting on Temporal Knowledge Graphs. In Interna- tional Conference on Learning Representations. https://openreview.net/forum?id= pGIHq1m7PU [8] Zhen Han, Zifeng Ding, Yunpu Ma, Yujia Gu, and Volker Tresp. 2021. Learning neural ordinary equations for forecasting future links on temporal knowledge graphs. In Proceedings of the 2021 conference on empirical methods in natural language processing. 8352–8364. [9] Qiang Huang, Makoto Yamada, Yuan Tian, Dinesh Singh, and Yi Chang. 2022. Graphlime: Local interpretable model explanations for graph neural networks. IEEE Transactions on Knowledge and Data Engineering (2022). [10] Zhen Jia, Soumajit Pramanik, Rishiraj Saha Roy, and Gerhard Weikum. 2021. Complex temporal question answering on knowledge graphs. In Proceedings of the 30th ACM international conference on information & knowledge management. 792–802. [11] Woojeong Jin, Meng Qu, Xisen Jin, and Xiang Ren. 2020. Recurrent Event Network: Autoregressive Structure Inferenceover Temporal Knowledge Graphs. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP). 6669–6683. [12] Jaehun Jung, Jinhong Jung, and U Kang. 2021. Learning to walk across time for interpretable temporal knowledge graph completion. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining. 786–795. [13] Zixuan Li, Saiping Guan, Xiaolong Jin, Weihua Peng, Yajuan Lyu, Yong Zhu, Long Bai, Wei Li, Jiafeng Guo, and Xueqi Cheng. 2022. Complex Evolutional Pattern Learning for Temporal Knowledge Graph Reasoning. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers). 290–296. [14] Zixuan Li, Xiaolong Jin, Saiping Guan, Wei Li, Jiafeng Guo, Yuanzhuo Wang, and Xueqi Cheng. 2021. Search from History and Reason for Future: Two-stage Reasoning on Temporal Knowledge Graphs. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers). 4732– 4743. [21] A Saxena, S Chakrabarti, and P Talukdar. 2021. Question answering over temporal knowledge graphs. In ACL-IJCNLP 2021-59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, Proceedings of the Conference. Association for Computational Linguistics (ACL), 6663–6676. [22] Michael Schlichtkrull, Thomas N Kipf, Peter Bloem, Rianne Van Den Berg, Ivan Titov, and Max Welling. 2018. Modeling relational data with graph convolu- tional networks. In The Semantic Web: 15th International Conference, ESWC 2018, Heraklion, Crete, Greece, June 3–7, 2018, Proceedings 15. Springer, 593–607. [23] Thomas Schnake, Oliver Eberle, Jonas Lederer, Shinichi Nakajima, Kristof T Schütt, Klaus-Robert Müller, and Grégoire Montavon. 2021. Higher-order expla- nations of graph neural networks via relevant walks. IEEE transactions on pattern analysis and machine intelligence 44, 11 (2021), 7581–7596. [24] Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedan- tam, Devi Parikh, and Dhruv Batra. 2017. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE interna- tional conference on computer vision. 618–626. [25] Haohai Sun, Jialun Zhong, Yunpu Ma, Zhen Han, and Kun He. 2021. TimeTrav- eler: Reinforcement Learning for Temporal Knowledge Graph Forecasting. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing. 8306–8319. [26] Mukund Sundararajan, Ankur Taly, and Qiqi Yan. 2017. Axiomatic attribution for deep networks. In International conference on machine learning. PMLR, 3319– 3328. [27] Rakshit Trivedi, Hanjun Dai, Yichen Wang, and Le Song. 2017. Know-evolve: Deep temporal reasoning for dynamic knowledge graphs. In international conference on machine learning. PMLR, 3462–3471. [28] Minh Vu and My T Thai. 2020. Pgm-explainer: Probabilistic graphical model explanations for graph neural networks. Advances in neural information processing systems 33 (2020), 12225–12235. [29] Yuwei Xia, Mengqi Zhang, Qiang Liu, Shu Wu, and Xiao-Yu Zhang. 2022. MetaTKG: Learning Evolutionary Meta-Knowledge for Temporal Knowledge Graph Reasoning. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing. 7230–7240. [30] Yi Xu, Junjie Ou, Hui Xu, and Luoyi Fu. 2023. Temporal knowledge graph reason- ing with historical contrastive learning. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 37. 4765–4773. [31] Zhitao Ying, Dylan Bourgeois, Jiaxuan You, Marinka Zitnik, and Jure Leskovec. 2019. Gnnexplainer: Generating explanations for graph neural networks. Ad- vances in neural information processing systems 32 (2019). [32] Hao Yuan, Haiyang Yu, Shurui Gui, and Shuiwang Ji. 2022. Explainability in graph neural networks: A taxonomic survey. IEEE transactions on pattern analysis and machine intelligence 45, 5 (2022), 5782–5799. [33] Hao Yuan, Haiyang Yu, Jie Wang, Kang Li, and Shuiwang Ji. 2021. On explain- ability of graph neural networks via subgraph explorations. In International conference on machine learning. PMLR, 12241–12252. [34] Zhao Zhang, Fuzhen Zhuang, Hengshu Zhu, Zhiping Shi, Hui Xiong, and Qing He. 2020. Relational graph neural network with hierarchical attention for knowledge graph completion. In Proceedings of the AAAI conference on artificial intelligence, Vol. 34. 9612–9619. [15] Zixuan Li, Xiaolong Jin, Wei Li, Saiping Guan, Jiafeng Guo, Huawei Shen, Yuanzhuo Wang, and Xueqi Cheng. 2021. Temporal knowledge graph reasoning based on evolutional representation learning. In Proceedings of the 44th interna- tional ACM SIGIR conference on research and development in information retrieval. 408–417. [16] Qika Lin, Jun Liu, Rui Mao, Fangzhi Xu, and Erik Cambria. 2023. TECHS: Temporal Logical Graph Networks for Explainable Extrapolation Reasoning. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). 1281–1293. [17] Yushan Liu, Yunpu Ma, Marcel Hildebrandt, Mitchell Joblin, and Volker Tresp. 2022. Tlogic: Temporal logical rules for explainable link forecasting on temporal knowledge graphs. In Proceedings of the AAAI conference on artificial intelligence, Vol. 36. 4120–4127. [18] Maxime Oquab, Léon Bottou, Ivan Laptev, and Josef Sivic. 2015. Is object localiza- tion for free?-weakly-supervised learning with convolutional neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition. 685–694. [19] Phillip E Pope, Soheil Kolouri, Mohammad Rostami, Charles E Martin, and Heiko Hoffmann. 2019. Explainability methods for graph convolutional neural net- works. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition. 10772–10781. [20] Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. 2016. " Why should i trust you?" Explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD international conference on knowledge discovery and data mining. 1135–1144. A ANNOTATION GUIDELINE We provide detailed evaluation guidelines for human evaluations in this section. Overview You will be shown explanations generated by a model for tem- poral knowledge graph reasoning tasks. Your task is to evaluate the quality of the explanation based on 3 criteria using a 1-3 rating scale: • Validity (1=low, 3=high) - Does the explanation seem logi- cally valid based on your own knowledge? Note that invalid explanations indicate the model may not have learned ex- pected features. • Relevance (1=low, 3=high) - Do the nodes selected seem relevant for explaining the model's prediction? Relevant nodes should meaningfully connect to the target node being explained. Conference acronym 'XX, June 03–05, 2018, Woodstock, NY Chenhan Yuan and Hoda Eldardiry • Sufficiency (1=low, 3=high) - Does the explanation contain enough nodes to sufficiently understand the reasoning be- hind the prediction? Too few nodes may lack the needed context. The detailed criteria for each score is described below: Note there is a tradeoff between sufficiency and relevance - more nodes increase sufficiency but may reduce relevance. Validity • Assign a score of 1 if the nodes seem unrelated to explaining the prediction. • Assign a score of 2 if some nodes are relevant while others are not. • Assign a score of 3 if all nodes clearly help explain the pre- diction through their connections. Sufficiency • Assign a score of 1 if the explanation does not provide enough • Assign a score of 1 if the explanation is illogical or contains context to understand the reasoning. factual errors based on your knowledge. • Assign a score of 2 if the explanation provides some context • Assign a score of 2 if you are uncertain of the validity or but is still lacking. logic of the explanation. • Assign a score of 3 if the explanation provides ample context • Assign a score of 3 if the explanation seems factually and to understand the reasoning. logically valid. Relevance Received 20 February 2007; revised 12 March 2009; accepted 5 June 2009
http://arxiv.org/abs/2310.04884v2
"2023-10-10T01:57:56"
"2023-10-07T17:54:36"
Regret Analysis of Repeated Delegated Choice
We present a study on a repeated delegated choice problem, which is the first to consider an online learning variant of Kleinberg and Kleinberg, EC'18. In this model, a principal interacts repeatedly with an agent who possesses an exogenous set of solutions to search for efficient ones. Each solution can yield varying utility for both the principal and the agent, and the agent may propose a solution to maximize its own utility in a selfish manner. To mitigate this behavior, the principal announces an eligible set which screens out a certain set of solutions. The principal, however, does not have any information on the distribution of solutions in advance. Therefore, the principal dynamically announces various eligible sets to efficiently learn the distribution. The principal's objective is to minimize cumulative regret compared to the optimal eligible set in hindsight. We explore two dimensions of the problem setup, whether the agent behaves myopically or strategizes across the rounds, and whether the solutions yield deterministic or stochastic utility. Our analysis mainly characterizes some regimes under which the principal can recover the sublinear regret, thereby shedding light on the rise and fall of the repeated delegation procedure in various regimes.
[ "MohammadTaghi Hajiaghayi", "Mohammad Mahdavi", "Keivan Rezaei", "Suho Shin" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04884v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04884v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.GT", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.GT", "cs.LG" ]
3 2 0 2 t c O 0 1 ] T G . s c [ 2 v 4 8 8 4 0 . 0 1 3 2 : v i X r a Regret Analysis of Repeated Delegated Choice MohammadTaghi Hajiaghayi ∗ Mohammad Mahdavi∗ Suho Shin∗ Keivan Rezaei∗ October 11, 2023 Abstract We present a study on a repeated delegated choice problem, which is the first to consider an online learning variant of Kleinberg and Kleinberg, EC'18. In this model, a principal interacts repeatedly with an agent who possesses an exogenous set of solutions to search for efficient ones. Each solution can yield varying utility for both the principal and the agent, and the agent may propose a solution to maximize its own utility in a selfish manner. To mitigate this behavior, the principal announces an eligible set which screens out a certain set of solutions. The principal, however, does not have any information on the distribution of solutions in advance. Therefore, the principal dynamically announces various eligible sets to efficiently learn the distribution. The principal's objective is to minimize cumulative regret compared to the optimal eligible set in hindsight. We explore two dimensions of the problem setup, whether the agent behaves myopically or strategizes across the rounds, and whether the solutions yield deterministic or stochastic utility. Our analysis mainly characterizes some regimes under which the principal can recover the sublinear regret, thereby shedding light on the rise and fall of the repeated delegation procedure in various regimes. 1 Introduction Delegation is perhaps one of the most frequent economic interactions one may see around in real life (Holmstrom, 1980; Bendor et al., 2001; Amador and Bagwell, 2013). Abstractly speaking, consider a principal with less information tries to find an optimal solution from an agent with expertise, but there's an information asymmetry such that she1 cannot directly access the solutions that the agent possesses (Alonso and Matouschek, 2008; Kleinberg and Kleinberg, 2018; Kleiner, 2022; Hajiaghayi et al., 2023). Instead, she requires the agent to propose a set of solutions and then commits to the final one among them. The principal and the agent, however, may have misaligned utility for the solution selected, and thus the agent may propose a solution in a selfish manner. To cope with it, the principal announces a set of eligible solutions before the agent proposes, and only accepts the eligible solution. To provide a concrete example, consider (online) labor market or crowdsourcing platform such as Upwork. We have a task requester (principal) who regularly visits the platform (agent) and tries to solve a series of tasks. The platform has a pool of workers (solutions). At each time the requester visits, the platform recommends some set of workers, and the requester selects a single worker to commit to the task. Obviously, the task requester wants to hire a qualified worker. The platform, on the other hand, aims to maximize its long-term revenue by recommending workers who solve tasks ∗ University of Maryland College Park, MD USA. Email: {hajiagha,mahdavi,krezaei,suhoshin}@umd.edu 1Feminine pronouns (masculine) hereafter denote the principal (agent). 1 Behavior Myopic Strategic Utility Deterministic Stochastic Theorem 4.3 Table 1: Summary of our results under different settings. Theorem 3.1 Theorem 3.4,3.8 Theorem 4.1 quickly, even if their quality is not high, allowing them to be assigned to other tasks promptly. This misalignment of utility may lead to the platform strategically recommending unqualified workers. To mitigate this, the requester sets restrictions, such as requiring certificates in specific areas like a foreign language or web development, when requesting worker recommendations. We refer to Appendix A for more examples on motivations. If the task requester is fully aware of the set of workers that the platform has, then she can directly impose a strong restriction to make the platform recommend the specific workers she wants. In practice, however, such information is not feasible priorly, instead, the requester needs to learn the distribution of existing workers in the repeated interaction. The fundamental question here is, how the requester should dynamically determine which sort of restriction to impart at each round, in order to maximize cumulative utility over the set of tasks. Furthermore, one may ask what happens if the platform also tries to strategize across the rounds to deceive the requester, and what if the quality of each worker is not fixed in advance, but rather is given from a latent distribution. This work introduces the repeated delegated choice problem, which focuses on how the principal can design an efficient delegation mechanism. To the best of our knowledge, this is the first study to explore an online learning extension of the delegated choice problem presented by Armstrong and Vickers (2010); Kleinberg and Kleinberg (2018); Hajiaghayi et al. (2023). In our model, the principal lacks initial information about the solutions' distribution. Instead, through repeated announcements of eligible sets that may screen out some solutions, the principal aims to learn the solutions' distributions in a sample-efficient manner. The principal aims to minimize cumulative regret compared to the optimal eligible set in hindsight. We distill the problem into two dimensions of whether the utility of each solution is deterministic or stochastic, and whether the agent strategizes across the rounds or not, and provide a comprehen- sive regret analysis for each setting. In the myopic agent setting, the agent plays a best-response to the eligible set at each round, i.e., a strategy which maximizes myopic utility without regard to the future utility and resulting behavior of the mechanism.2 Hence, the principal's objective boils down to efficiently learn the distribution of utilities by selecting proper eligible sets at each round, while only observing the partial feedback from the choice of eligible set, i.e., which solution the agent submits (or possibly declines to submit any). This challenge intensifies with a strategic agent, as the agent may intentionally hide solutions or deviate from their best response for greater utility in later rounds. Consequently, the feedback is not guaranteed to be stochastic across rounds, making the analysis more complex. Our contributions. We here provide a summary of our contributions and techniques. The results are summarized in Table 1. First, we observe a revelation-principle-style-of-result such that it suffices to focus on a class of so-called single-proposal mechanism, formally defined in Definition 2.1. Interestingly, we show that the myopic deterministic setting can be reduced to the repeated posted price mechanism (RPPM) with myopic buyer. 3 Denoting the principal's utility 2This model of myopic agent accommodates a perspective of "multiple agents" setting in which at each round an agent having the same type of solutions arrive and interacts with the principal. In this viewpoint, the agents are bound to be myopic due to the single round interaction per agent. 3Overall, we observe an intimate connection between the RPPM and our problem under certain settings. In 2 for each solution by Xi, one can effectively construct an instance of RPPM by converting Xi to the buyer's value v = maxi Xi in RPPM. In both problems, the optimal benchmark is to obtain maxi Xi, and the reduction follows. Combined further with an iterative algorithm, we obtain a regret upper bound of O(min(K, log log T )), where K denotes the number of solutions and T is the time horizon. With stochastic valuation, however, this does not work since the benchmark in RPPM is to put an ex-ante best fixed price, which does not coincide maxi Xi. Indeed, we observe that the optimal benchmarks cannot be reduced from one to another in general. Instead, we mainly reduce our problem to a stochastic multi-armed bandit problem via proper discretization over the space of eligible sets equipped with a variant of analysis by Kleinberg and Leighton (2003), and obtain a regret of O(√T log T ) under the same assumption imposed in Kleinberg and Leighton (2003) For the strategic agent with deterministic utility, we first observe that it is necessary to impose a certain assumption on the agent's utility sequence to obtain positive results. Precisely, the agent with non-discounting utility can strategize so that no algorithm can obtain sublinear regret, where the formal proof is presented in Appendix K. In this context, to capture both of the practicality and theoretical tractability, we consider γ-discounting strategic agent whose utility is discounted by a multiplicative factor of γ at each round. We also note that this is common in the literature Amin et al. (2013); Haghtalab et al. (2022). − ) where Tγ = 1/(1 Given that, for the γ-discounting agent with deterministic utility, we first consider a case in which the agent's utility is uniformly bounded below by ymin and the principal is aware of it. In this setting, by exploiting the delay technique of Haghtalab et al. (2022), we obtain a regret bound of O(KTγ log Tγ γ). The dependence on K can be replaced by log T by shrinking ymin the eligible set more in an aggressive manner, thereby obtaining a regret of O(Tγ log Tγ + log T ). ymin Note that these bounds yield sublinear regret only if ymin = e−o(T ). We complement these results by showing that any algorithm suffers regret of Ω(T ) if ymin ≤ On the other hand, if the agent's minimum utility is not known or unbounded, there's no guarantee that the agent behaves myopically for any delay that is imposed in the algorithm. Instead, under minor assumptions that the solutions are densely spread with respect to parameter d and Lipschitzness between the principal's and agent's utilities, we obtain an efficient algorithm that achieves a regret upper bound of O(Tγ log Tγ α + log 1 d + dT ), where α is a function of the Lipschitz parameters. The linear dependence of O(dT ) regret may look a lot at first glance, we observe this is inevitable for any algorithm, thereby justifying our assumption. e−T . In the stochastic setting with γ-discounting strategic agent, we reuse the machinery by Hagh- talab et al. (2022); Lancewicki et al. (2021), and obtain a regret of O(√T log T ). More specifically, we can view the proposed solution as a perturbed output of a stochastic bandit, where the per- turbation comes from the agent's strategic behavior. The technical subtlety lies on how we should upper/lower bound such perturbed output to properly apply Lancewicki et al. (2021), i.e., how we should construct a random perturbation interval. 1.1 Related works Delegation. Dating back to the seminal work of Holmstrom (1980), a number of literature from the economics community study the theory of delegation, mostly within the extent of char- acterizing the regimes under which some simple mechanisms reach the optimal solution Alonso and Matouschek (2008); Armstrong and Vickers (2010); Kleiner (2022). Recently, Kleinberg and general, however, our problem spawns additional challenges of having multiple latent random variables and the principal is even unaware of the number of potential solutions. We provide more detailed discussion in Appendix B. 3 Kleinberg (2018) study a problem of delegated choice 4 with a lens of computer science, and show that there exists a mechanism with 2-approximation compared to the case in which the principal can fully access all the solutions in advance, based on a novel connection to prophet inequality problem (Samuel-Cahn, 1984). Their result, however, depends on the assumption that the prin- cipal knows the distribution from which the utility of each solution is drawn, i.e., they study the efficiency of Bayesian mechanism. Interestingly, if the principal has no such information at all, i.e., prior-independent mechanism, the result becomes largely pessimistic, i.e., there exists a prob- lem instance in which the principal's approximation becomes arbitrarily bad. Hajiaghayi et al. (2023) reveal that prior-independent mechanisms can be made efficient with multiple agents, but this does not hold with a single agent. Repeated delegation. Lipnowski and Ramos (2020) study a problem of infinitely repeated delegation, however, their model of delegated choice is largely different from ours. Mainly, their model considers aligned utility but when the principal bears the cost of adopting a project. Their objective is to persuade the agent to adopt the project when it is truly good, whereas the agent tries to always adopt the project. Several lines of work Li et al. (2017); Guo and H ̈orner (2021) study a repeated game of project choice, but we do not discuss it in details due to significant differences from our model. A line of work Lewis (2012); Xiao et al. (2022) study a delegated search problem, especially a dynamic version by Rahmani and Ramachandran (2016), but the players bear the cost of search for solutions in their model, whereas the solutions are exogenous to the mechanism in our model. Stackelberg games. Our problem can be viewed as an online learning version of repeated Stackelberg game Von Stackelberg (2010); Marecki et al. (2012); Bai et al. (2021); Lauffer et al. (2022); Zhao et al. (2023). A common objective in this area of work is to minimize a Stackelberg regret, i.e., difference to the optimal policy that knows the leader's optimal action in hindsight, and the above works aim to minimize the cumulative Stackelberg regret of a leader, assuming that a follower best responds at each round. Especially, our model of strategic agent belongs to the growing area of learning in games with strategic agent Birmpas et al. (2020); Haghtalab et al. (2022); Zhao et al. (2023). More precisely, Birmpas et al. (2020) study how the follower can efficiently deceive the leader by misreporting his valuation. Haghtalab et al. (2022) proposes a generic delaying technique to deal with a strategic agent, and proposes several applications to strategic classification, repeated posted price mechanism (henceforth RPPM), and Stackelberg security game. Indeed, our model resembles RPPM of Kleinberg and Leighton (2003); Amin et al. (2013); Babaioff et al. (2017). However, RPPM restricts the buyer and the seller's utility to be linearly negatively correlated, but our model accommodates any kind of correlation. In addition, our agent has multiple solutions to choose from compared to only accept/reject of RPPM, and thus is technically more challenging to predict/analyze the agent's strategic behavior. 2 Problem setup In a repeated delegated choice problem, there is a principal and an agent. The agent is equipped where K denotes the cardinality of the set of possible a0, a1, . . . , aK } with a set of solutions A = { solutions5, and a0 denotes the null solution which means that the agent submits nothing. At [T ], solution a incurs a nonnegative random utility for the principal and the agents. each round t ⊥ ∈ 4They consider two types of problem settings, one of which is delegated search with sampling costs, and the other is delegated choice, referring back to Armstrong and Vickers (2010). Since we also assume that the solutions of the agent are exogenous to mechanisms, we frame our model as a delegated choice problem. 5We do not restrict the number of solutions to be finite, or constant with respect to T. 4 ∈ ∈ for t a , Y (t) a ) is independent and identically distributed (i.i.d.) Denote by X (t) the utility random variable (r.v.) of the principal selecting the solution a and a Y (t) the random utility of the agent given solution a, both of which has support in Ω := [0, 1]. a The random vector (X (t) [T ]. A at each round, but the Importantly, the agent can access the ex-post utility of the solutions a ∈ principal cannot. The agent is equipped with a discounting factor γ (0, 1), i.e., he discounts the utility at round t by a factor of γt−1. That is, the agent's true utility for solution a at round t is γt−1Y (t) a . This assumption on agent regret is common in studies concerning strategic agents Amin et al. (2013); Haghtalab et al. (2022). It is shown in Amin et al. (2013) that in the repeated posted- price mechanism problem, a sublinear regret can not be achieved for a non-discounting strategic agent. This is also the case in our problem, as a non-discounting agent might have the incentive to hide a solution that is worse than another solution in terms of agent utility but better for the γ). Given a mechanism M , principal. We further explore this in Appendix K. Define Tγ = 1/(1 at each round t A, and submits them to the principal. We write 2X to denote the power set of a set X, and ∆(X) for a simplex over X. Thus, the agent's action belongs to S(t) History, mechanism, and agent's policy. At each round t [T ], the mechanism determines which solutions to commit given the agent's action S(t). This choice is based on the history available t−1 l=1(S(l), a(l)), where a(l) denotes the solution selected at up to round t, formally defined by Ht := ∪t≥1(2A, A) to be the set of all possible histories of the game, i.e., each round l. We define H Ht is a subset of A specifies which solutions to select . Formally, the mechanism M : 7→ and the agent's submission. Importantly, the mechanism at each round t given the history Ht ∈ H is only able to choose an action among the actually submitted solutions by the agent. Also, the principal commits to a mechanism before the game starts. [T ], the agent chooses a (possibly random) subset of solutions S(t) ∆(2A). H × 2A := H − ⊂ ∈ ∈ ∈ ∪ M Let be the set of all possible mechanisms. Correspondingly, the agent's policy P : H × M 7→ ∆(2A) is a function that takes the mechanism announced by the principal and the history sequence be the set of all possible agent policies. We Ht and decides an (possibly randomized) action. Let write st to denote the solution eventually selected at round t by the mechanism. Note that st can , if the principal declines to accept any proposed solution. In this case, both the be null, i.e., st = M,P and Y (t) agent's and the principal's utilities are zero. We write X (t) M,P to denote the principal's M,P ] and ΨM,P = E[Y (t) and agent's utility at round t under M and P . Define ΦM,P = E[X (t) M,P ] to denote the expected utility of the principal and the agent, respectively. Mechanism description. Overall, the interaction between the principal and the agent proceeds as follows: ⊥ P i The principal commits to a mechanism. ii At each round, agent observes the realized solutions and their utility. iii Agent (possibly strategically) proposes solutions. iv Principal determines the final outcome with respect to the committed mechanism. v Steps ii-iv are repeated. Single-proposal mechanism. We mainly deal with the following specific type of mechanism, inspired by Kleinberg and Kleinberg (2018). Definition 2.1 (Single-proposal mechanism). In a single proposal mechanism M , at each round t, the principal announces an eligible set E(t) Ω2, and the agent submits only a single solution a. If (X (t) E(t), then the principal accepts the solution, otherwise, she selects nothing. a , Y (t) a ) ⊂ ∈ 5 We further say that a mechanism is threshold-based, if its eligible set only puts a (possibly strict) lower bound on the principal's utility. We define Eτ = } to represent threshold-based eligible sets for a threshold τ . Given a single proposal mechanism, we write x(t) to denote the eventual utility of the principal and the agent at round t when the agent proposes solution a, i.e., which reflects the principal's decision. a : Xa > τ { a : Xa ≥ { a and y(t) a τ = } τ and E> Notably, we provide a revelation principle style of result which states that any mechanism can be reduced to a single-proposal mechanism. Theorem 2.2. Given any mechanism M and any agent's policy P , there exists a single-proposal mechanism M ′ and corresponding deterministic agent's policy P ′ such that ΦM,P ≤ ΦM ′,P ′ and ΨM,P ≤ ΨM ′,P ′. Thanks to the reduction above, we can essentially focus on the single-proposal mechanism, and the agent only needs to determine which solution to submit at each round. Thus, unless specified explicitly, we now focus on the single-proposal mechanism. Note that the reduction from any deterministic mechanism with deterministic policy follows from a variant of the proof of the standard revelation principle (Nisan et al., 2007). For randomized policy, we can reduce it to a deterministic policy by sequentially derandomizing each round's random events in a backward manner. Approximately best response and Stackelberg regret. Our construction of a mechanism against a strategic agent requires a notion of approximate best response of the agent, defined as follows. Definition 2.3 (ε-best response). Given a mechanism M and history Ht, let AE be a union of the set of eligible solutions given eligible set E and the null outcome . Then, the ε-best response at round t for eligible set E is defined by ⊥ If ε = 0, we simply say best response and denote by Br(t). Br(t) ε (E) = a { ∈ AE : y(t) a ≥ y(t) a′ ε, a′ ∀ − . A } ∈ Whenever there are multiple solutions as best response, we assume that a myopic agent plays in favor of the principal, i.e., submits the solution that maximizes the principal's utility. Fundamentally, the dynamics of the single-proposal mechanism belongs to a repeated Stack- elberg game in which the principal moves first by announcing an eligible set, and then the agent follows by proposing solutions, at each round. In repeated Stackelberg games (possibly with strate- gic agent), typical objective is to minimize a cumulative regret compared to the case when the mechanism knows the optimal eligible set in hindsight, and the agent myopically responds to the principal's move. In our setting, this benchmark boils down to the case under which the mechanism knows the distribution of X (t) in hindsight, while the agent best responds to the principal's eligible set at each round. In this case, the optimal principal's utility can be written as, a and Y (t) a Opt = max E⊂Ω2 E x(t) Br(t)(E) i . h (2.1) Thus, Stackelberg is defined as follows. Definition 2.4 (Stackelberg regret). Given a mechanism M and agent's policy P , suppose that the agent submits solution at at each round t. Then, Stackelberg regret is defined by RegM,P (T ) = T T Opt * − Xt=1 x(t) at . 6 Furthermore, we define a worst-case Stackelberg by maximizing over the agent's policy, WRegM (T ) = maxP ∈P RegM,P (T ). Let sponse. Then, we define WRegM (T, ε) = maxP ∈Pε RegM (T ) = WRegM (T, 0) to denote its worst-case Stackelberg regret. Pε be a family of policy under which the agent always plays ε-best re- RegM,P (T ). If the agent is myopic, we abuse 3 Deterministic Setting We start with a simplistic setting in which the agent is myopic and the utility is deterministic. In this case, the principal needs to learn the optimal eligible set, without regard to the agent's strategy. In this case, for notational simplicity, we drop the superscript (t) since the utility remains the same across the rounds. Our main result with myopic agent is presented as follows. Theorem 3.1. There exists a mechanism with Reg(T ) = O(min(K, log log T )) against myopic agent. The proof is based on two algorithms, one of which relies on a novel connection between our problem and the repeated posted-price mechanism problem (henceforth RPPM) by Kleinberg and Leighton (2003), and the other is a simple algorithm that iteratively finds a (slightly) better solution. In the former, we mainly construct a reduction from our problem to RPPM, and thus recovers the regret bound log log T of Kleinberg and Leighton (2003).6 In the latter algorithm with regret bound O(K), the algorithm iteratively updates the eligible set so that it excludes at least one suboptimal solution at each round, until there's no eligible solution. Formal definition of RPPM, pseudocode of the algorithms, and the proof can be found in Appendix D. This result implies an intimate connection between our problem and RPPM, however, we observe that this does not hold beyond this simplistic setting. In fact, the utilities are always linearly negatively correlated in RPPM, on the other hand, in our setting they can be arbitrarily correlated. Moreover, agent has multiple actions to choose beyond accept and reject compared to only two actions of accept or reject in RPPM. 3.1 Strategic agent Next, we consider a more challenging scenario in which the agent tries to strategize over the rounds. Since we cannot assume that the agent will truthfully best respond to the mechanism at each iteration, instead, he possibly tries to deceive the mechanism by untruthfully submitting a solution. Thus, we need to design a mechanism that is more robust to the strategic behavior. This may indeed be plausible in practice, for instance in our online labor market example, the platform may try to deceive the task requester to not strain highly qualified workers. Intuitively, this will especially true when the platform does not have a large number of workers. Mainly, we characterize the regret upper bound with respect to two types of assumptions. The first version of the results relies on a relatively simple assumption such that the agent's utility is uniformly bounded below by some constant. The latter depends on the Lipschitz continuity of the utility across the solutions and the density of solutions in the utility space. For each setting, we provide regret upper bounds and matching lower bounds. This justifies the necessity of the assumptions we impose, thereby providing insightful implications on the regimes in which the principal can attain large utility. Before presenting the results, we introduce a notion of delayed mechanism, which will be useful in dealing with strategic agent. Formally, we say that mechanism M is D-delayed, if at each round 6Note that any state-of-the-art result can be carried over to our problem's regret bound, due to our reduction. 7 t, it uses Hmax(1,t−D) to decide its eligible set Et. Delayed mechanism effectively restricts the strategic agent's behavior, as follows. Lemma 3.2 (Haghtalab et al. (2022)). Given γ D-delayed mechanism M satisfies WRegM (T ) ∈ WRegM (T, ε). (0, 1), if we set D = ≤ , then Tγ log(Tγ/ε) ⌉ ⌈ Intuitively, if D gets larger enough, the agent with discounted utility is less incentivized to deviate from the best response at each round since the discounted utility after D rounds may not be enough to make up for the loss of ε utility in the current turn. Uniformly bounded agent utility. Formally, we first assume that Ya > ymin for any a A and the principal is also aware of this lower bound. Our regret bound will accordingly be parameterized with respect to ymin. This assumption is plausible since in our online labor market example, the task requester and the worker are typically contracted to pay an intermediary fee to the platform and thus constitute a reasonable amount of minimum payoff to the agent. The existence of such a minimum utility effectively allows us to compute the necessary delay to make the agent approximately myopic, thanks to Theorem 3.2. ∈ Leveraging the minimum utility of the agent, we consider a variant of the algorithm used in the myopic deterministic setting, by introducing a delay in reacting to the agent's feedback. Then, we can further obtain the following regret bound. Theorem 3.3. There exists an algorithm with WReg(T ) = O(KTγ log Tγ ymin strategic agent. ) against γ-discounting The proof can be found in Appendix E. Essentially, the delay introduced in the algorithm induces the agent to behave restrictively strategic, and we can effectively bound the regret to be constant, assuming the other parameters are constants. Note, however, that the regret bound linearly depends on the number of agent's solutions K. Obviously, if K tends to be large in some cases, our regret guarantee here is doomed to be pessimistic. This is indeed plausible in practice, since the agent may have growing number of solutions with respect to T , especially for online platforms. This limitation can be handled by shrinking the eligible sets more in an aggressive manner, instead of sequentially seeking the next-best solutions. Then, the linear dependency on K can further be wiped out as follows. Theorem 3.4. There exists an algorithm with WReg(T ) = O(Tγ log Tγ ymin discounting strategic agent. + log T ) against γ- The proof and its algorithm are deferred to Appendix F. Note that the regret no longer depends on the number of solutions K, but instead on log T . Our algorithm keeps shrinking the eligible set until it concludes that the truly optimal solution lies within at most 1/T to the currently best solution. Afterward, the regret is at most 1/T T , thus does not affect the overall regret upper * bound. Intuitively, to remove the dependence on the number of solutions, such a logarithmic burden on T is essential to guarantee that our eventual solution is correct up to O(1/T ) distance. We further note that both the regret bounds of Theorem 3.3 and 3.4 have a logarithmic de- pendency on 1/ymin. Assuming that Tγ = 1/(1 γ) = O(1), this regret bound yields a sublinear − regret upper bound if ymin = e−o(T ), but becomes detrimental the other way around. Interestingly, however, we show that this dependency is necessary to obtain sublinear regret for any algorithm, by e−T against the strategic formally proving that no algorithm can achieve sublinear regret if ymin ≤ agent. The proof is presented in Appendix G. 8 Theorem 3.5. if ymin ≤ strategic agent. e−T , then any algorithm has WReg(T ) = Ω(T ) against γ-discounting Thus, the principal would suffer a large amount of regret by delegating to the agent whose utility tends to be severely small. Lipschitz utility with dense solutions. Next, we consider the case where the principal is not aware of any lower bound on ymin, or such a lower bound does not exist. To cope with this lack of information on ymin, we assume that there is no significant disparity in the utility between two close solutions for both the principal and the agent, and the solutions are densely spread in the utility space. Under these two assumptions, we provide an algorithm to find a semi-optimal solution. These assumptions are formally presented as follows. Assumption 3.6 (d-dense). Let dX(a, b) = d > 0 if for any two solutions a, b dX (a, b) > d and there exists another solution c such that dX(a, c) Xa − | A, either of the following is satisfied: (i) dX (a, b) . A problem instance is d-dense for some d or (ii) ≤ dX (a, b). Xb| ∈ d and dX (b, c) ≤ ≤ Assumption 3.7 (L1, L2-Lipschitz continuity). There exists absolute constants L1, L2 > 0 such that for any a, b Xb| dY (a, b) and dY (a, b) = dX (a, b), where dX (a, b) = A, we have L1 * Xa − | dX (a, b) L2 * ≤ ≤ ∈ Ya − | . Yb| Our assumption of densely spread solutions is innocuous since the solutions will be packed more in a compact manner as the number of solutions grow. Otherwise, if the number of solutions is relatively small, then our results on the bounded agent's utility would kick-in, and thus one may recover the sublinear regret. The Lipschitz continuity assumption is often valid, as it is observed that when the agent's utility for two solutions is similar, the principal's utility follows suit, and vice versa. For instance, if all the solutions lie in y = 1 x, then the Lipschitz condition holds with (L1, L2) being (1, 1 + ε) or (1 − ε, 1) for any choice of ε 0. Further, we assume that Lipschitz parameters L1 and L2 tend to be close to each other, precisely, 4 L2. Indeed, if there exists a significant difference between L1 and L2, the Lipschitz L2 ≥ assumption fails to effectively impose any restrictions. L1 > 3 ≥ − Leveraging these assumptions, we propose a new algorithm. Since we lack precise information on the required delay to ensure the submission of a solution, we cannot compel the agent to be approximately myopic. We propose a modified version of the algorithm used above which effectively leverages the assumptions above to explore superior solutions. The proof can be found in Appendix H. ALGORITHM 1: DelayedProgeressiveSearch while any solution has not been received do Announce E0. { − ← ← ← ← L1 min Ya0 , r Xa0, y Let a0 be the proposed solution. 3 4 L2, l α Announce E0 for D rounds. l > 4d do while r − l+r 2 ; τ Announce E> τ . if solution a is proposed by the agent then l Announce El for D rounds. r, l + y r Announce El for remaining rounds. min { L1 } ← ← ; 1, l + y , ε ← 4αd, D ← Tγ log Tγ ε ; L1 } Xa, y ← ← Ya else r τ ; ← 9 Theorem 3.8. If α := L1 − against γ-discounting strategic agent. 3 4 L2 > 0, then Algorithm 1 has WReg(T ) = O(Tγ log Tγ α + log 1 d + dT ) In Algorithm 1, we maintain an interval, denoted as [l, r], which encompasses the optimal solution. It is guaranteed that at every round, a solution a exists such that Xa0 = l. According to the Lipschitz continuity assumption, we can place an upper bound on r, signifying that the optimal solution a∗ cannot be significantly distant from a. This is because when the difference between Xa∗ and Xa becomes large, it is expected that Ya∗ Ya will also be substantial. This is not possible − since Ya∗ is non-negative, and cannot be significantly greater than Ya, otherwise, it would have been proposed by the agent in earlier rounds. to d + l+r With the bounded value of r, our objective is to determine if there exists a solution within the right half of the interval. By considering the line x = l+r 2 , the d-dense assumption implies that if a solution exists in the right half, there must be a solution with the principal's utility ranging from l+r 2 . Utilizing the Lipschitz continuity along with the condition on its parameters, we 2 can find a lower bound on the agent's utility within that interval. Consequently, we can introduce an appropriate delay to compel the agent to propose a solution from the right half if it exists. As a result, the algorithm can determine the presence or absence of a solution in the right half and subsequently shrink the interval accordingly. By continuing this procedure, the interval gradually converges toward the optimal solution. Furthermore, our regret upper bound essentially decomposes Tγ from T , and thus the effect of discount factor is decoupled from the linear dependency of dT . The linear dependency on dT may look pessimistic at first glance, but we reveal that this dependency is indeed optimal, as formally presented as follows. The proof is in Appendix G. Theorem 3.9. There exists a d-dense problem instance such that any algorithm suffers WReg(T ) = Ω(dT ) against γ-discounting strategic agent. Its proof easily follows from the proof of Theorem 3.5. Thus, this demonstrates the fundamental inevitability of the term dT . It's worth noting that whenever d is subconstant, e.g., d = T −c for c > 0, then our regret upper bound in Theorem 3.8 implies a sublinear regret. In our online labor market example, since the number of workers in a platform usually grows with respect to the time horizon, their intrinsic qualities might lie more compactly in the utility space as time flows. For instance, if there are T ε workers having uniformly distributed utility in a (0, 1), their utility will be O(T −ε)-densely spread, which would compact utility space for some ε yield dT = T 1−ε = o(T ) regret bound. In words, the requester needs to delegate to a platform with a large number of solutions, i.e., delegating to big business matter. Conversely, the platform should maintain more workers to attract requesters, i.e., economy of scale works, however, a trade-off arises since the platform's gains from strategizing would be limited then. ∈ 4 Stochastic Setting For the stochastic setting, previous algorithms no longer work as the ex-post optimal solution varies across the rounds. Thus, the objective of the principal here will not be to find the largest threshold τ to exclude any ex-post suboptimal solutions, but to balance two quantities of probability that the agent possesses a solution that belongs to the eligible set, and incentivizes the agent to submit a good solution. Recall that this phenomenon is already well-captured in our benchmark (2.1) and the corresponding notion of Stackelberg regret. Given the differences, the principal faces an additional challenge of handling the random noise in the reward, where she needs to find the best solution to balance the trade-off presented above. 10 To cope with it, we reduce our problem to a stochastic bandit problem which is standard in the literature (Kleinberg and Leighton, 2003; Amin et al., 2013; Haghtalab et al., 2022). In the stochastic multi-armed bandit problem, a principal has a set of Q arms, indexed by i [Q], and needs to decide which arm to pull at each round given the time horizon T . Each arm i is equipped with a reward distribution Di with support [0, 1]. Given μi = Er∼Di [r], the principal's objective E [ rt ], where rt Er∼Di [r] is to minimize expected regret defined by Reg(T ) = T − denotes the random reward of the arm selected at round t by the principal. We first discretize the space of principal's utility into the set of i/Q for i P [Q] for some carefully chosen parameter Q. Each element i/Q corresponds to a single arm, which represents the threshold τ that the principal can commit to at each round. By pulling the arm i, the principal is essentially announcing an eligible set of Eτi = 1 a . Namely, the principal aims to find the best i/Q [Q]. If the discretization is dense enough with respect to the eligible set among the set of Eτi for i problem parameters, the regret bound here would imply a reasonable regret bound for our original problem. We define f (τ ) = E as the expected principal utility for using threshold τ . Note that if the agent best responds, the expected utility from pulling arm i becomes f (i/Q). x(t) Br(t)(Eτ ) i maxi∈[Q] Xa ≥ { ∈ T t=1 ∈ ∈ } h * | We assume that f (τ ) achieves its maximum for a unique τ ∗ (0, 1) with f ′′(τ ∗) < 0, which is common in the literature (Kleinberg and Leighton, 2003; Amin et al., 2013; Haghtalab et al., 2022). Now, we can simply use the well-known UCB upon the discretization, and obtain the following results against the myopic agent. ∈ Theorem 4.1. If the agent is myopic, running UCB1 with discretization by Q = ( T Reg(T ) = O(√T log T ). log T )1/4 has Its analysis is a simple variant of Kleinberg and Leighton (2003), but we provide the entire proof to make paper self-contained. The proof can be found in Appendix I. Next, to deal with the strategic behavior of the agent, we again exploit the concept of delay to restrict the agent to be approximately best responding with a suitable choice of parameters. In addition, however, we cannot simply expect that the outcome of pulling a single arm, i.e., a specific eligible set, follows some stochastic distributions since the agent may strategically deviate from the best response at hand. To cope with this additional challenge, we use the foundation of perturbed bandit instance by Haghtalab et al. (2022). Since the stochastic setting is a generalization of the deterministic setting, it is obvious that we need a reasonable set of assumptions to obtain positive results. Similar to the deterministic setting, we first assume that there exists a value ymin > 0 such that for any realization of the agent's solutions, his utility for each solution is strictly greater than ymin. Secondly, we assume that the problem instance satisfies the following assumption, which is a stochastic version of Lipschitz continuity in the deterministic setting. Definition 4.2 (Stochastic Lipschitz continuity). Under the stochastic setting, we say that the problem instance is stochastically Lipschitz-continuous with parameter L1 > 0 if the ex-post utilities dY (a, b). of the solutions are correlated in a sense that for any a, b dX (a, b) A a0} , we have L1* −{ ∈ ≤ Finally, our main result can be presented as follows. Theorem 4.3. Under the two assumptions presented above, there exists an algorithm that has WReg(T ) of T log T + Tγ log O (cid:18) p Tγ max (cid:18) T L1 , (cid:18) 1 ymin (cid:19)(cid:19) log T , (cid:19) with γ-discouting strategic agent. 11 The algorithm and the proof can be found in Appendix J. Our proof essentially relies on a construction of proper random perturbation interval, followed by the regret analysis of delayed version of successive elimination algorithm by Haghtalab et al. (2022) and Lancewicki et al. (2021). The technical subtlety lies on introducing a proper random perturbation interval to convert it to the perturbed bandit instance. The latter term including Tγ, L1 and ymin incurs due to the strategic behavior of the agent. Still, this only contributes log T amount of regret once all these parameters are constants, which is dominated by the former term of √T log T . 5 Conclusion We study a novel repeated delegated choice problem. This is the first to study the online learning variant of delegated choice problem by Armstrong and Vickers (2010); Kleinberg and Kleinberg (2018); Hajiaghayi et al. (2023). We thoroughly investigate two problem dimensions regarding whether the agent strategizes over the rounds or not, and whether the utility is stochastic or deter- ministic. We obtain several regret upper bounds for each problem setting, along with corresponding lower bounds that complement the hardness of the problems and some assumptions therein. Our analysis mainly characterizes the conditions of problem instances on which the principal can effi- ciently learn to delegate compared to the case when she knows the optimal delegation mechanism in hindsight, thereby providing fruitful insights in the principal's decision-making in delegation process. References Ricardo Alonso and Niko Matouschek. 2008. Optimal delegation. The Review of Economic Studies 75, 1 (2008), 259–293. Manuel Amador and Kyle Bagwell. 2013. The theory of optimal delegation with an application to tariff caps. Econometrica 81, 4 (2013), 1541–1599. Kareem Amin, Afshin Rostamizadeh, and Umar Syed. 2013. Learning prices for repeated auctions with strategic buyers. Advances in Neural Information Processing Systems 26 (2013). Mark Armstrong and John Vickers. 2010. A model of delegated project choice. Econometrica 78, 1 (2010), 213–244. Peter Auer, Nicol`o Cesa-Bianchi, and Paul Fischer. 2002. the Multiarmed Bandit Problem. https://doi.org/10.1023/A:1013689704352 Mach. Learn. 47, Finite-Time Analysis of 235–256. 2–3 (may 2002), Moshe Babaioff, Liad Blumrosen, Shaddin Dughmi, and Yaron Singer. 2017. Posting prices with unknown distributions. ACM Transactions on Economics and Computation (TEAC) 5, 2 (2017), 1–20. Yu Bai, Chi Jin, Huan Wang, and Caiming Xiong. 2021. Sample-efficient learning of stackelberg equilibria in general-sum games. Advances in Neural Information Processing Systems 34 (2021), 25799–25811. Jonathan Bendor, Amihai Glazer, and Thomas Hammond. 2001. Theories of delegation. Annual review of political science 4, 1 (2001), 235–269. 12 Georgios Birmpas, Jiarui Gan, Alexandros Hollender, Francisco Marmolejo, Ninad Rajgopal, and Alexandros Voudouris. 2020. Optimally deceiving a learning leader in stackelberg games. Ad- vances in Neural Information Processing Systems 33 (2020), 20624–20635. Yingni Guo and Johannes H ̈orner. 2021. Dynamic allocation without money. (2021). Nika Haghtalab, Thodoris Lykouris, Sloan Nietert, and Alexander Wei. 2022. Learning in Stackel- berg Games with Non-myopic Agents. In Proceedings of the 23rd ACM Conference on Economics and Computation. 917–918. MohammadTaghi Hajiaghayi, Keivan Rezaei, and Suho Shin. 2023. Multi-agent Delegated Search. arXiv preprint arXiv:2305.03203 (2023). Bengt Holmstrom. 1980. On the theory of delegation. Technical Report. Discussion Paper. Jon Kleinberg and Robert Kleinberg. 2018. Delegated search approximates efficient search. In Proceedings of the 2018 ACM Conference on Economics and Computation. 287–302. R. Kleinberg and T. Leighton. 2003. The value of knowing a demand curve: bounds on regret for online posted-price auctions. In 44th Annual IEEE Symposium on Foundations of Computer Science, 2003. Proceedings. 594–605. https://doi.org/10.1109/SFCS.2003.1238232 Andreas Kleiner. 2022. Optimal Delegation in a Multidimensional World. arXiv preprint arXiv:2208.11835 (2022). Tal Lancewicki, Shahar Segal, Tomer Koren, and Yishay Mansour. 2021. Stochastic multi-armed bandits with unrestricted delay distributions. In International Conference on Machine Learning. PMLR, 5969–5978. Niklas Lauffer, Mahsa Ghasemi, Abolfazl Hashemi, Yagiz Savas, and Ufuk Topcu. 2022. No-Regret Learning in Dynamic Stackelberg Games. arXiv preprint arXiv:2202.04786 (2022). Tracy R Lewis. 2012. A theory of delegated search for the best alternative. The RAND Journal of Economics 43, 3 (2012), 391–416. Jin Li, Niko Matouschek, and Michael Powell. 2017. Power dynamics in organizations. American Economic Journal: Microeconomics 9, 1 (2017), 217–241. Elliot Lipnowski and Joao Ramos. 2020. Repeated delegation. Journal of Economic Theory 188 (2020), 105040. Janusz Marecki, Gerry Tesauro, and Richard Segal. 2012. Playing repeated stackelberg games with unknown opponents. In Proceedings of the 11th International Conference on Autonomous Agents and Multiagent Systems-Volume 2. 821–828. Noam Nisan, Tim Roughgarden, Eva Tardos, and Vijay V Vazirani. 2007. Algorithmic game theory. Cambridge university press. Morvarid Rahmani and Karthik Ramachandran. 2016. Dynamics of delegated search. Technical Report. Working paper, Scheller College of Business, Georgia Institute of Technology . . . . Ester Samuel-Cahn. 1984. Comparison of threshold stop rules and maximum for independent nonnegative random variables. the Annals of Probability (1984), 1213–1216. 13 Heinrich Von Stackelberg. 2010. Market structure and equilibrium. Springer Science & Business Media. Yangge Xiao, Zhenyu Hu, and Shouqiang Wang. 2022. Information Design of a Delegated Search. Available at SSRN 4249165 (2022). Geng Zhao, Banghua Zhu, Jiantao Jiao, and Michael I Jordan. 2023. Online Learning in Stackelberg Games with an Omniscient Follower. arXiv preprint arXiv:2301.11518 (2023). 14 A More discussions on motivation As shown by the online labor market exampled presented in the introduction, repeated delegation between two parties with misaligned utility and information asymmetry happens in many real-world scenarios. For example, consider a university (principal) bears the cost of hiring faculty members while delegating the role of selection to the department (agent). The university and the department may have different goals in hiring faculty members, while the university may constrain feasible candidates of faculties in advance. In addition, a content platform like Youtube (principal) decides which contents to recommend to incoming users while requiring Youtubers (agent) to register contents. This can essentially be viewed as a process of delegation, since although Youtube may have registered the contents by itself, it delegates the role of registering contents to Youtubers due to a lack of time, money, or expertise. Finally, one may consider an e-commerce (principal) decides which items to recommend to incoming buyers. Typically, there exists a number of sellers (agent) who contract with the e-commerce, and register their items in the platform. Thus, e-commerce delegates the role of actually creating items and deciding which ones to sell. Note that in the examples above, different from the online labor market example we provided in the introduction, the platforms typically act as a principal and the individuals can be viewed as an agent. B Connection to repeated posted pricing problem We found an intimate connection between the repeated posted price mechanism (RPPM) and our problem. For example, offering a price in RPPM can be viewed as announcing a thresholded eligible set in our problem. The acceptance can be regarded as a submission of eligible solution, and rejection as the agent declined to submit any solution. However, the correspondence is not exact, since in RPPM there is only one value for the buyer w.r.t. to the item, but in our problem there are multiple values w.r.t. multiple solutions that the agent might possess. Therefore, while the only latent value that the principal needs to learn is the buyer's value for the item in RPPM, in our setup, the principal needs to learn the value of multiple solutions. Finally, the principal does not know how many solutions the agent possesses in advance. Besides, different from the fact that the principal's utility (revenue = price) is exactly negatively correlated to the agent's utility (valuation - price), in our setting, it can be arbitrarily correlated. To provide a simple example of our analysis, given two solutions that yields principal's (x) and agent's (y) utility of: (x, y) =(i) (0.5, 0.5) and (ii) (0.75, 0.75), there is no guarantee that the agent would pick (ii), although it strictly dominate (ii). This is because the agent may think suggesting (ii) would increase the principal's expectation on the further solutions, so that it prevents possibly inferior solutions to be eligible in the future. This becomes more complicated when there are multi- ple Pareto-optimal solutions w.r.t. the principal's and agent's utility. Despite these complications, our analysis, however, reveals that one can construct efficient algorithms by incorporating existing techniques and some new ideas on how to deal with agent (especially in strategic case). C Proof of Theorem 2.2 Proof. To begin with, suppose first that M is a deterministic mechanism. Then, there exists a )T representing the (possibly null) arms selected at each deterministic sequence (at)t∈[T ] ∈ round. Since the agent is fully capable of computing the exact payoff, Denote the corresponding agent's actions sequence by S(t) t∈[T ]. Without loss of generality, suppose that the realization of the X (t) for the problem instances with M and M ′ remains the same. Given Ht, let M ′ be a single- a ∪ {⊥} (A 15 proposal mechanism that announces an eligible set which consists of the selected solution (possibly null) by mechanism M at round t. Consider the agent's policy P ′ such that for each t [T ], given Ht and X (t) , and otherwise he submits nothing. Then, it follows = a ⊥ ∈ M,P = X (t) M ′,P ′ and Y (t) from the above construction that X (t) M ′,P ′, and thus we essentially have ΦM,P = ΦM ′,P ′ and ΨM,P = ΨM ′,P ′. A, he submits at if at 6 M,P = Y (t) for a ∈ Suppose that rewards of solutions realized to be ω(t) = (ω1(t), . . . , ωK(t)) for each t [T ]. Now consider a randomized policy of agent P and (possibly) randomized mechanism M , where P maximizes the agent's expected payoff. Let ΣP be the set of all possible random bits if P , and similarly define ΣM for M . For each σ = (σP , σM ) ΣM , we can essentially compute the agent's expected payoff yM,P (σ)(ω). Let σ∗(ω) = argmaxσ∈Σ yM (σM ),P (σP )(ω(t)). Let P ′ be the agent's deterministic policy which plays P (σ∗(ω(t))) against M for each realization ω(t). Then, due to our construction, P ′ yields a larger (or equal) agent's utility than P . If this yields a strictly larger utility, then the agent should have played P ′, which is a contradiction. Thus, the agent's policy can be made deterministic, and by the argument presented above, we finish the proof. Σ = ΣP × ∈ ∈ D Proof of Theorem 3.1 Proof. As we discussed in the main paper, the proof is essentially based on two observations (i) reduction to RPPM, and (ii) iterative algorithm. To this end, we first present the formal definition of RPPM. Definition D.1 (Repeated Posted Price Mechanism). In a repeated posted price mechanism prob- lem, given T rounds, a buyer with an i.i.d. valuation vt from an unknown distribution supported on [0, 1] arrives at each round, and decides whether to buy an item. The seller posts a price pt on pt, and leaves otherwise. The seller's regret is defined the item, and the buyer takes the item if vt ≥ E by Reg(T ) = T maxp∈[0,1] p , i.e., the difference compared − to the optimal revenue in hindsight with a fixed price. t=1 pt1 vt} i pt ≤ h P Pr [ v p ] ≥ { T * * Now we prove the following claim. Claim D.2. Suppose that the agent is myopic. Given a mechanism for the RPPM problem that achieves regret of at most R(T ) on any instance with T rounds, we can construct a mechanism M for the repeated delegated choice achieving the same regret bound R(T ) for all instances with T rounds. Proof of the claim. Let M be a mechanism for the RPPM problem. We construct a threshold- based mechanism M ′ for the repeated delegated choice problem that simulates M . At each round, the mechanism M chooses a price based on the history of the buyer's responses. In the RPPM problem, this history consists of the prices used at each round and whether the buyer bought the item or not. For M ′, we consider the history to be the threshold τ used in each round which defines the eligible set Eτ and whether the agent proposes an eligible solution or not. Now, at each round, we can consider the history for M ′ to be a history for M . If M would propose price p with the given history, M ′ announces a threshold τ = p. Now, consider an instance I ′ of the repeated delegated choice problem with T rounds. In the deterministic case, each random variable X (t) takes only a single value, and so we abuse this a notation to refer to the value rather than the random variable. Let X (t) = maxa∈A X (t) a denote the maximum value of the principal's utility among the agent's solutions. We define instance I of the RPPM problem, where the buyer's value is X (t) and there are T rounds. We show that the regret 16 of M ′ on I ′ is at most that of M on I. We prove inductively that at each round, the price M proposes given I is the same as the threshold announced by M ′ for I ′, the agent and the buyer's responses are the same which leads to the same history, and the principal utility achieved by M ′ is at least as high as the seller utility in M . In the first round, there is no history and in the other rounds, the history will be the same by induction. So by definition, M ′ uses the price τ used in M as the threshold. In I, the buyer buys if and only if X (t) is at least τ . Similarly, in I ′ the agent proposes an eligible solution with principal utility at least τ if and only if such a solution exists as this would result in a positive utility for the agent as opposed to the zero utility for submitting an ineligible solution or no solution. So, the agent and buyer responses are the same. In addition, if X (t) τ the seller's utility is the price τ , and the principal's utility is at least τ as an eligible solution is submitted. If X (t) τ , the buyer does not buy and the agent can not propose an eligible solution, so both the seller and the principal's utility will be 0. So, the principal's utility when using mechanism M ′ in each round is at least as high as the seller's using M . ≥ ≤ The regret in both cases is defined as the difference between the utility achieved and the optimal X (t) in both cases. Therefore, the regret of M ′ on I ′ is at most the regret of M utility, which is T on I. So, if M has regret at most R(T ) on instances with T rounds, M ′ will also achieve the same regret bound. * Now, the regret upper bound of log log(T ) can directly be obtained from the following theorem. Theorem D.3 (Kleinberg and Leighton (2003)). There exists an algorithm achieving regret O(log log T ) for the RPPM problem in the deterministic myopic setting. ALGORITHM 2: IterativeSearch τ = 0, f = 0 while f = 1 do Announce E> if arm a is proposed by the agent then τ τ for a single round. Announce Eτ for remaining rounds. Xa else break; ← | | a { a { Xa > τ τ Xa ≥ improves the solution. Note that E> than τ , i.e., E> τ := least τ , i.e., Eτ := In order to obtain the regret upper bound of K, we present Algorithm 2 which iteratively τ denotes the set of eligible arms with principal's utility greater , and Eτ denotes the set of eligible arms with principal's utility at } . } Due to the myopic and deterministic nature of the agent, it is obvious that Algorithm 2 first finds the best arm in terms of the agent. Then, the eligible set is set to preclude that arm, and thus the agent will submit another arm which yields larger principal's utility. This process terminates at most after K rounds since it excludes at least 1 arm at each round. Thus, its regret is at most O(K). Combining the above observations, we can essentially compare K and log log T , and determine which algorithms to exploit, and it completes the proof. E Proof of Theorem 3.3 Proof of Theorem 3.3. The proof relies on the following lemma. Lemma E.1. In a D-delayed mechanism where D = Tγ log Tγ ymin E> τ , the agent submits a solution if and only if solution a exists such that Xa > τ . , when the principal announces 17 6 ALGORITHM 3: DelayedIterativeSearch τ ← while f Tγ log Tγ ← = 1 do ymin , f 0, D ← 0; Announce E> τ for a single round. if solution a is proposed by the agent then τ ′ Announce E> if f τ for D rounds. τ ′; = 1 then τ Announce Eτ for remaining rounds. ← Xa else f 1; ← ← Proof. When the mechanism is D-delayed, then the agent plays his ε best response. Given E> τ , if the agent proposes an eligible solution, then he obtains the utility of more than ymin. On the other hand, if the agent does not propose any solutions, he gets the utility of 0. As ε = ymin, the ε-best responding agent proposes a solution if he has at least one eligible solution. The above lemma indicates that by announcing E> τ , the principal can check whether there exists solution a such that Xa > τ or not. We consider algorithm 3. In this algorithm, when the principal observes solution a, she announces E> Xa and due to Lemma E.1, checks whether there exists a better solution or not. By observing a better solution, the principal does the same thing and keeps observing better solutions. This process continues until the principal observes the best solutions. As a result, after at most K iteration of the algorithm, the principal observes the best solution. Each iteration of the above algorithm, takes D rounds, hence, total regret is bounded by KD where D = Tγ log Tγ ymin . F Proof of Theorem 3.4 1 ← ← T do ALGORITHM 4: DelayedBinarySearch Tγ log Tγ ymin , l 0, r D ← l > 1 while r − l+r 2 ; τ Announce E> τ for a single round. if solution a is proposed by the agent then l Announce El for D rounds. Announce El for remaining rounds. ← τ else r τ ; ← ← Proof of Theorem 3.4. The proof is based on Algorithm 4. We claim that the optimal Xa∗ always lies in the interval [l, r]. When l = 0 and r = 1, it is obvious that the optimal solution lies in this interval. Then on each iteration, principal puts τ = l+r τ . According to Lemma E.1, if the agent has solution a such that Xa > τ , the principal observes that solution and should find the optimal solution in the interval [τ, r]. On the other hand, there do not exist any solutions in the interval [τ, r] and the algorithm continues searching for the optimal solution in [l, τ ]. In this type of rounds, regret is at most 1. 2 and announces E> The algorithm stops shrinking the interval until its length gets smaller than 1 T . After that the principal announces El and as the optimal solution lies in the interval [l, r], regret is at most r l = 1 T . This algorithm needs O(log T ) iterations and on each iteration announces O(D) eligible sets. l is shrunk by a multiplicative factor of 2, total On those rounds, regret is at most r l. as r − − − 18 6 6 regret in these rounds will be at most D + D 2 + D 4 + D 8 + ... 2D ≤ After log T iterations, regret is at most 1 T . Hence, total regret is O(Tγ log Tγ ymin + log T ). G Proof of Theorems 3.5 and 3.9 After establishing the proof for Theorem 3.5, it becomes straightforward to infer Theorem 3.9. Thus, we start with Theorem 3.5. ∈ Proof of Theorem 3.5. We consider two problem instances and claim that in at least one of them, the principal obtains a linear regret. We use P1 and P2 to refer to those instances. We assume that in P1, there are two deterministic solutions a1 and a2 with utility of (Xa1 , Ya1) = (d, 1) and (Xa2 , Ya2) = (2d, y). In P2 the only solution is a1. We assume that in both instances, the principal has already observed a1. In problem P1, the principal has to find a2 as her regret is d for each round of not receiving a2. However, in problem P2, a1 is the optimal solution and the principal wastes her time by looking for better solutions. We show that under the setting where y c1, c2, ..., cK } { e−T , the principal's regret in at least one of P1 and ≤ P2 will be Ω(T d). Let C = be the rounds in instance P2 such that the principal looks for a better solution, i.e., a2. In those rounds, she announces an eligible set such that a1 is no longer eligible, thus, in P2 she receives no solutions and has the regret of d. Thus, her regret in P2 is Ω(Kd) because, in K rounds, she receives no solutions. This implies that in order to get sublinear regret, K o(T ). We note that in problem P1, the principal needs to find a2 in sublinear rounds. Indeed, if the principal observes a2 after l rounds, then her regret for previous rounds is at least d, hence, her total regret is Ω(ld), which implies that for sublinear regret l should be sublinear, i.e., l o(T ). Now we consider the agent's response in P1. We note that as long as the agent does not reveal a2, the principal cannot distinguish between P1 and P2. So, her strategy is the same in both problem instances. In the case that the agent decides not to hide a2, denote by j the first round that the agent's behavior is different in P1 and P2. In fact, in round j of instance P1, the agent proposes a2. We note that according to the argument we mentioned above, j O(l). This implies that j o(T ). After that round, as the principal has already observed a2, she never announces an eligible set such that a1 is accepted. Thus, agent's utility starting from round j will be at most γjy γj y ∈ ∈ T −1 t=j γt 1−γ . If the agent decides to hide a2, then he does not propose it in round j and the principal's P strategy will be the same as her strategy for P2. As the principal does not accept a1 only for K rounds, then in at least one of the rounds j, j + 1, ..., j + K, principal accepts a1 and the agent gets the utility of at least γj+K. We note that as both j, K o(T ), then all rounds j, j + 1, ..., j + K exist. ∈ ≤ ∈ Since the agent wants to maximize his utility, if he decides to propose a2 in round j, then his maximum possible utility should be at least his minimum utility in the scenario he hides that solution. Formally, γj 1 y − γj+K. γ ≥ 19 This implies that y 1−γ ≥ γK. By assuming the fact that y e−T , then we have ≤ e−T 1 − γ ≥ γK . By taking log of both sides, we get K log γ T − ≤ − log (1 γ). − Ω(T ). This implies that the principal needs to spend Finally, K Ω(T ) rounds to check whether a better solution exists or not, which is a contradiction with the previous argument that K . Hence, K o(T ). ≥ − ∈ T log γ − log (1−γ) γ ∈ Proof of Theorem 3.9. We note that the above instances P1 and P2 satisfy d-dense assumption. e−T , then there the This implies that we showed even under d-dense assumption when ymin ≤ principal suffers from Ω(T d) regret. H Proof of Theorem 3.8 Proof. We obtain an upper bound on the regret for a more generalized version of the algorithm 5. In this algorithm, we assume that there exists β 2 such that L1 ≥ β+2 2β L2 > 0. − ALGORITHM 5: DelayedProgeressiveSearch while any solution has not been received do Announce E0. ← Ya0 ; L1 } Xa0 , y Let a0 be the proposed solution. β+2 2β L2, l α L1 ← ← − 1, l + y min r ; { ← l > βd do while r − l+r τ α(r 2 , ε ← Announce E> τ . if solution a is proposed by the agent then l Announce El for D rounds. r, l + y r Announce El for remaining rounds. l), D = Tγ log Tγ ε ; min { L1 } ← ← − ; Xa, y ← ← Ya else r τ ; ← At first, the algorithm keeps accepting all solutions until the agent proposes any of them. it is obvious that there is no merit for the agent to not propose any solution at all. In fact, even after a single round of accepting all solutions, the agent proposes a0 and we can initialize corresponding variables in our algorithm. We claim that the optimal Xa∗ always lies in the interval [l, r]. At first, as l = 0 and r = 1, this interval contains all solutions. On each iteration, we assume that there exists solution a0 such that β l > βd, the algorithm shrinks the interval. let p to be r−l 2 d. l = Xa0 . As long as r it picks τ = l+r τ or not. if it 2 and aims to check whether there exists solution a such that Xa ≥ can guarantee there exists a solution in the interval [τ, r], the principal continues searching in that interval, otherwise, she continues searching in the interval [l, τ ]. 2 , thus, p − ≥ exists a solution a′ such that τ According to d-dense assumption, if there exists a solution a such that Xa ≥ ≥ τ + d. We note that τ + d r since β Xa′ ≤ ≤ ≤ τ , then there also τ + d, 2. As Xa′ ≤ 20 according to Lipschitz continuity dY (a′, a0) ≤ (Xa′ Xa0), i.e., − Ya0 − Ya′ L2 * L2 * L2 * L2 * L2 * (cid:18) ≤ ≤ ≤ ≤ (Xa′ − (τ + d Xa0 ) l) − (p + d) 2 + β β p (cid:19) This implies that Ya′ Ya0 − L2 * ( ≥ 2 + β β p). (H.1) Furthermore, we can always assume that r r, then according to Lipschitz continuity, dY (a′′, a0) l is bounded. This is due to the fact that if there Xa0), (Xa′′ − L1 * ≥ − is a solution a′′ with Xa′′ i.e., ≥ Ya0 − | Ya′′ | ≥ ≥ ≥ Xa0 ) − l) (Xa′′ (r L1. − L1 * L1 * 2p * 2pL1 or Ya′′ Ya0 − This implies that either Ya′′ ≤ Ya + 2pL1 is not possible. As we will later show, we always put We first show that Ya′′ ≥ β+2 β L2. Thus, the agent always plays αβd best response. In this case, ǫ = αβd where α = L1 − L1βd > αβd. This implies that αβd best-responding agent 2pL1 ≥ Ya0 ≥ Xa′′ > Xa0 and Ya′′ should not propose a0 as a′′ gives him at least αβd more utility and whenever solution a0 is eligible, so does a′′. Ya0 + 2pL1. ≥ − Therefore, we focus on case where Ya′′ 2pL1. if Ya0 − r, thus, we can shorten the interval, i.e., we can decrease r. In fact, 2pL1 < 0, then there cannot be Ya0 − ≤ any solution with Xa′′ ≥ indicating that r should not exceed l + than l + Ya0 L1 Ya0 L1 . If it surpasses this value, we simply update it to l + Ya0 L1 . Now, we use this lower bound on Ya0 to find a lower bound on Ya′. We define α > 0 to be 0, 2pL1 ≥ Ya0 − . Consequently, in each iteration, we verify if r is smaller (H.2) α := L1 − β+2 β L2. Ya′ Ya0 − ≥ β + 2 β p L2 * β + 2 β β + 2 2β p L2 * L2(cid:19) 2p L1 − * ≥ L1 − 2p (cid:18) αβd. ≥ ≥ (H.1) (H.2) (definition of α) The above lower bound shows that if there exists a solution in the interval [τ, r], then there exists solution a′ such that the agent's utility for that is at least αβd. We put ε to be αβd and D 21 − ≤ to be Tγ log Tγ by announcing E> ε , Then the D-delayed mechanism makes the agent play his ε best response. Hence, τ , the agent will propose a solution if there exists a solution in interval [τ, r]. After observing his proposal, the algorithm updates the interval correspondingly. If a is proposed τ ), then it keeps searching for better solutions in the interval [Xa, r]. We note by the agent (Xa ≥ that for the next iteration, we maintain the property l = Xa. On the other hand, if the agent does not propose any solutions, the principal has to search for better solutions in the interval [l, τ ]. Similarly, note that l = Xa0 in the next iteration. in this type of rounds, regret is at most 1. We keep shrinking this interval until its length gets smaller than βd (β 2). At this point, we keep announcing El and solution a0 is eligible, so the principal gets the utility of at least l and the regret is at most r βd. ≥ l As in each iteration, the length of the interval becomes at most half of the previous interval, number of iterations is O(log 1 βd ). On each iteration, we run O(D) rounds where D = Tγ log Tγ αβd . The regret of the algorithm on those rounds is at most r − multiplicative factor 2, then the total regret in these rounds as at most l. As r − l is shrunk by at least a D + D 2 + D 4 + ... 2D. ≤ Also, after stopping exploration, the regret is at most βd. So the total regret is O(Tγ log Tγ log 1 βd + βdT ). By plugging β = 4, we get the bound provided in the Theorem 3.8. αβd + I Proof of Theorem 4.1 Proof. Our proof is essentially based on the following series of lemmas. Lemma I.1. There exist constants C1, C2 such that C1(τ ∗ τ )2 < f (τ ∗) − f (τ ) < C2(τ ∗ τ )2. − − ε, τ ∗ +ε) such that for some constants A1, A2 we have A1(τ ∗ Nε(τ ∗). Now consider the complement of Nε(τ ) defined by X = Proof. Since f ′′(τ ∗) exists and has a strictly negative value, there exists a neighbor Nε(τ ∗) = (τ ∗ τ )2 − − for τ . ε τ } | ≥ Due to the compactness of X and since f (τ ∗) X, there are constants B1, B2 such that B1(τ ∗ X. Then, C1 = min(A1, B1) and C2 = max(A2, B2) finishes the proof. f (τ ) < A2(τ ∗ τ ∗ | f (τ ) is strictly positive for all x τ )2 for x f (τ ) < B2(τ ∗ τ )2 < f (τ ∗) τ )2 < f (τ ∗) − [0, 1] : τ { − − − − − − ∈ ∈ ∈ ∈ Lemma I.2. The discretization error f (τ ∗) maxi f (i/K) − C2/K 2. ≤ Proof. Note that there exists an element in the set of arms denote this arm by j. Then we have 1/K, . . . , K/K { } satisfy i/K x∗ − ≤ 1/K, f (τ ∗) max i − f (i/K) f (j/K) j/K) f (τ ∗) − C2(τ ∗ − C2/K 2, ≤ ≤ ≤ where the second inequality follows from Lemma I.1, and the last holds due to our construction of j. 22 Lemma I.3. Let ∆i = max1≤j≤K f (j/K) f (i/K). Then, The sum of inverse gaps satisfies − ∆i>0 1/∆i ≤ 7K 2/C1. P C1(τ ∗ Proof. Due to Lemma I.1, we have ∆i ≥ ̃∆K−1 be an ordered sequence of the set A = j/2K, we have ̃∆j ≥ satisfy i/K x∗ − ≤ [K]. Define 0 = ̃∆0 ≤ i/K)2 for i − ≤ ∆i}i∈[K]. Since at most j elements of the set A { ̃∆1 ≤ . . . ∈ C1(j/2K)2. Hence we obtain 1/∆i < Xi:∆i6=0 K Xi=1 C −1 1 (i/2K)−2 < 4K 2 C1 K i2 Xi=1 π2 6 4K 2 C1 * 7K 2 C1 , < ≤ and it completes the proof of the lemma. We can now use the following regret bounds for the UCB1 algorithm to complete the proof. Lemma I.4. Auer et al. (2002) In a multi-armed bandit instance with K > 1 arms, the UCB1 algorithm achieves an expected regret of at most O([ X∆i>0 log T ∆i K ] + ∆i) Xi=1 after T rounds, where ∆i = max1≤j≤K f (j/K) of arm i and the optimal arm. − f (i/K) is the difference between the expected utility Lemma I.5. Let DiscreteReg be the regret of the UCB1 algorithm compared to the utility of always using τ = [arg max1≤i≤K f (i/K)]/K as the threshold. Then DiscreteReg = O( K 2 C1 log T + K) Proof. Using Lemma I.4, we have DiscreteReg = O([ X∆i>0 log T ∆i K ] + ∆i) Xi=1 K log T + ∆i) Xi=1 log T + K). = O( = O( K 2 C1 K 2 C1 (LemmaI.4) (Lemma I.3) (∆i ≤ 1) The regret of UCB1 compared to the optimal benchmark, which achieves a utility of T max τ f (τ ), can be calculated by summing up DiscreteReg and the discretization error. Therefore, the total regret of the algorithm is REG = DiscreteReg + DiscretizationError = O( K 2 C1 log T + K + T K 2 ), (I.1) (I.2) 23 where we use Lemma I.2 and Lemma I.5. Plugging in K = ( T the regret log T ) 1 4 , we get the desired bound on log T + K + T K 2 ) REG = O( = O( = O( K 2 C1 √T log T C1 T log T ). + ( 1 4 ) T log T + T log T ) p p J Proof of Theorem 4.3 ALGORITHM 6: SuccessiveEliminationDelayed [Haghtalab et al. (2022)] K arms, delay D, perturbation δ, [K] while t < D do do A ← for i ∈ A Pull arm i and observe feedback (principal's utility) rt; t for i 1 then t−D 1 τ =1 1 t + 1; ← do ∈ A if t D − ≥ max( n ← t−D 1 P ˆμi τ =1 n ← P ˆμi LCBi − ← UCBi ˆμi + ← else continue; p p : UCBi , 1); iτ = 1 } { rτ ; iτ = i { } 2 log(T )/n δ; 2 log(T )/n + δ; − A ← { i ∈ A LCBj, j ∀ . ∈ A} ≥ Before we proceed, we present the formal definition of the perturbed bandit problem. Definition J.1 (Bandits with perturbed rewards). Let problem. We say that the ex-post sequence of rewards r1, r2, . . . , rT are δ-perturbed from the for any arm sequence a1, . . . , aT that happens with positive probability in }t∈[T ] such that rt ∈ random intervals μat + δ. be an instance of the multi-armed bandit if , there exist independent [lt, ut] almost surely and μat − I E [ ut ] [lt, rt] { E [ lt ] ≤ ≤ ≤ I I δ Proof. We mainly analyze the regret upper bound of Algorithm 6. We first present the following lemma, which characterizes the regret upper bound of Algorithm 6 for a bandit problem with delayed feedback and perturbed rewards. Lemma J.2 (Haghtalab et al. (2022)). For a multi-armed bandit problem with K arms, δ-perturbed rewards, and D-delayed feedback, Algorithm 6 has regret upper bound of O( + δT + D log K), where ∆i denotes the difference of the mean rewards between the optimal arm and arm i. log T ∆i ∆i>0 P To apply Lemma J.2, we essentially need to construct the proper random interval to guarantee some bounded perturbation of our reduced bandit problem. We write Eτ to denote the eligible set a : Xa ≥ { . Our construction of perturbation proceeds as follows. } τ 24 Lemma J.3. Fix an ex-post realization of all the arms. Let xτ = XBr(Eτ ) define l = (xτ − addition, we have E [ xτ ] L−1 1 ε) and u = (xτ + L−1 L−1 1 ε Brε(Eτ ), then l 1 ε. 1 ε). If a E [ u ] ∈ E [ xτ ] + L−1 E [ l ] ≤ 1 XBr(Eτ ) ≥ Xa1 (cid:8) τ Xa ≥ } ≤ { τ and (cid:9) u. In − ≤ ≤ ≤ Proof. The latter condition directly follows from the definition of l and u. To check the former inequality, we use our assumptions on ymin and Lipschitz continuity. Brε(Eτ ) be an ε-best response arm. If arm a is not in the eligible set, then the agent must not have any eligible arms. Otherwise, proposing that arm would achieve a utility of at least ymin > ε, which contradicts a being an ε-best response. Therefore in this case, Xa1 and xτ are both equal to 0 and so the first condition stands. Xa ≥ { Let a ∈ } τ Now, we can assume that a is an eligible arm. We have Xa − | XBr(Eτ )| ≤ ≤ L−1 Ya − 1 | εL−1 1 , YBr(Eτ )| where the first inequality follows from Lipschitz continuity, and the second holds by ε-best-responseness of the action a. Thus, we obtain If arm a is eligible, then it implies that the best response is also eligible. Therefore, we have XBr(Eτ ) − ε/L1 ≤ Xa ≤ XBr(Eτ ) + ε/L1. Xa1 Xa ≥ { τ } = Xa XBr(Eτ ) + ε/L1 ≤ = (XBr(Eτ ) = u, 1 Br(Eτ ) { τ } ≥ + ε/L1) where the first equation follows from a's eligibility and second equation follows since Br(Eτ ) is eligible. Further we similarly obtain Xa ≥ Br(Eτ ) { ε/L1) = l. (XBr(Eτ ) } − ≥ 1 τ Now observe that Similarly, and it completes the proof. E [ l ] = E E [ u ] = E (cid:2) (cid:2) (xτ − L−1 1 ε) = E [ xτ ] (cid:3) L−1 1 ε. − (xτ + L−1 1 ε) = E [ xτ ] + L−1 1 ε. (cid:3) Together with Lemma J.2, our bandit problem is L−1 1 ε-perturbed from the stochastic setting with a myopic agent, assuming that the agent is ε-best responding. Hence, similar to (I.2) in the proof of Theorem 4.1, running Algorithm 6 with δ = L−1 1 ε yields RegT = O(T log T 7K 2 C1 * + L−1 1 εT + D log K + T C2 K 2 ). Plugging in ε = min(L1/T, ymin), D = Tγ log(Tγ/ε), and K = (T / log T )1/4, we obtain RegT = O (C1 + C −1 (cid:16) 2 )(T log T )1/2 + Tγ log(Tγ max(T /L1, 1/ymin) log T , (cid:17) and it completes the proof. 25 K Necessity of Discount Factor We note that with modest assumptions about the difference in the agent's utility for different solutions, we can show that it is not possible for the principal to achieve a sublinear regret. To show the inevitability of linear regret, we can consider two simple cases with a strategic agent with deterministic utility. In the first case, the agent only has a single solution with utility 1/2 for the principal and utility 1 for the agent. To achieve sublinear regret compared to the optimal, the principal needs to accept this solution in all but a sublinear number of rounds. For a large enough T , we can assume that this solution needs to be accepted in at least 2T /3 rounds. In the other case, the agent again has the same solution with utilities 1 and 1/2, in addition to a solution with a utility of 1 for the principal and utility ǫ for the agent. For the principal to achieve a sublinear regret, she needs to get the solution with utility 1 in all but a sublinear number of rounds. So, we can assume that for large enough T , any mechanism achieving sublinear regret gets the agent to submit this solution in at least 2T /3 rounds. This results in a utility of at most 2T /3 ε + T /3 for the agent. However, if the agent pretends to only have the first solution and acts the same as the agent in the other case, he can achieve a utility of at least 2T /3, since the principal wants to have sublinear regret in the previous case. For ε < 1/2, this results in a better utility for the agent. Therefore, it is impossible for the principal to achieve a sublinear regret for both of these cases for large T . * 26
http://arxiv.org/abs/2310.04880v1
"2023-10-07T17:37:48"
"2023-10-07T17:37:48"
Question-focused Summarization by Decomposing Articles into Facts and Opinions and Retrieving Entities
This research focuses on utilizing natural language processing techniques to predict stock price fluctuations, with a specific interest in early detection of economic, political, social, and technological changes that can be leveraged for capturing market opportunities. The proposed approach includes the identification of salient facts and events from news articles, then use these facts to form tuples with entities which can be used to get summaries of market changes for particular entity and then finally combining all the summaries to form a final abstract summary of the whole article. The research aims to establish relationships between companies and entities through the analysis of Wikipedia data and articles from the Economist. Large Language Model GPT 3.5 is used for getting the summaries and also forming the final summary. The ultimate goal of this research is to develop a comprehensive system that can provide financial analysts and investors with more informed decision-making tools by enabling early detection of market trends and events.
[ "Krutika Sarode", "Shashidhar Reddy Javaji", "Vishal Kalakonnavar" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04880v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04880v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.AI", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.AI", "cs.LG" ]
Question-focused Summarization by Decomposing Articles into Facts and Opinions and Retrieving Entities Krutika Sarode, Shashidhar Reddy Javaji, and Vishal Kalakonnavar College of Information and Computer Sciences University of Massachusetts Amherst Abstract This research focuses on utilizing natural lan- guage processing techniques to predict stock price fluctuations, with a specific interest in early detection of economic, political, social, and technological changes that can be lever- aged for capturing market opportunities. The proposed approach includes the identification of salient facts and events from news articles, then use these facts to form tuples with enti- ties which can be used to get summaries of market changes for particular entity and then finally combining all the summaries to form a final abstract summary of the whole article. The research aims to establish relationships be- tween companies and entities through the anal- ysis of Wikipedia data and articles from the Economist. Large Language Model GPT 3.5 is used for getting the summaries and also form- ing the final summary. The ultimate goal of this research is to develop a comprehensive system that can provide financial analysts and investors with more informed decision-making tools by enabling early detection of market trends and events. 1 Introduction 1.1 Task Description We propose the development of a system that caters to financial analysts and investors by extracting relevant information from news articles and gen- erating summaries on the potential impact on a particular company. This system comprises four key tasks. Firstly, it involves the extraction of sen- tences from news articles, which will be labeled as either factual or opinionated (F v O), with the focus on utilizing factual sentences. Since the news data (coming from the Economist) is generally accurate in its reporting, we constructed our baseline of F v O on linguistic structures. We classify subjec- tive/opinionated sentences as containing subjective words/phrases ("I think", "believe", "hope", etc) and factual sentences as containing words/phrases like "according to", "studies show", and "research indicates". Secondly, the system will match each fact with the top-K most relevant entities. This is done using Pyserini to retrieve and match compa- nies/their descriptions to an extracted fact. Thirdly, for each (fact, company) pair, the system will gener- ate a summary outlining how the news will impact the particular company using a LLM/summarizer like GPT. We have currently found success using GPT 3/3.5 turbo. Finally, the system will aggregate the summaries across the entire article to extract the most significant information for each article, also using a LLM/summarize. GPT 3.5 turbo is currently being used for this task. By performing these tasks, the proposed system aims to provide financial analysts and investors with a comprehen- sive understanding of the potential effects of news articles on specific companies, allowing for more informed decision-making. 1.2 Motivation and Limitations of Existing Work There exist works that exhibit proximity to our own work, although their approaches are distinct. Our work, however, leverages the potency of Large Language Models in tandem with facts and events extracted from news articles to yield outputs that are more efficacious. Prior works have been con- strained by the utilization of knowledge graphs and other custom algorithms to establish relationships between given events or facts and the relevant news articles, thereby presenting certain limitations or inadequacies 1.3 Proposed Approach The proposed methodology integrates a rule-based model and Large Language Models (LLM) for the extraction of facts and events from news articles. Using the extracted facts, a retrieval model is em- Figure 1: WorkFlow ployed to identify the top-K companies related to each fact. A tuple of (fact, company) is then gen- erated for each relevant company. The impact of each fact on its respective company is determined by employing a language model. These individual summaries for each company are then aggregated to provide a concise overview of the potential im- pact of the news. This comprehensive summary can be utilized by financial analysts and investors to make informed decisions. By utilizing this ap- proach, we aim to improve the accuracy and effi- ciency of analyzing news articles to better inform financial decision-making. 1. Factual news generation: In order to utilize verified data that is based on evidence and avoid personal judgments and beliefs, it is necessary to separate factual sentences from news articles. This can be achieved by an- alyzing sentence structures and identifying subjectivity markers, such as words like "be- lieve," "think," "feel," and "hope," to filter out opinionated sentences. Additionally, sen- timent analysis and negation detection can be used to further refine the extraction of factual statements. This process involves using the NLTK and Spacy libraries in Python to cre- ate a rule-based model. By applying various vocabulary-based filters, we can identify and extract all factual statements, which can be used in subsequent steps. 2. Generation of fact, entity pair: After ex- tracting facts from the news articles, the next step is to identify the three most relevant en- tities for each fact. In this context, relevance refers to the entities that are most likely to be impacted by the fact. To perform this step, we gather relevant information about the enti- ties, such as their descriptions from Wikipedia pages, and use the Hugging Face sentence transformer to create embeddings for each en- tity. These embeddings are used to create an entity corpus. Next, we create an embedding for each fact and use Dense Passage Retrieval (DPR) techniques to map the fact embedding to the three most relevant entities in the cor- pus. DPR uses a bi-encoder to rank the entities based on their relevance to the fact. This pro- cess results in fact-entity pairs that provide a clear understanding of which entities are most likely to be impacted by each fact. Example: Fact: "The legendary auto executive has spent the last two months in jail since his arrest in Tokyo on November 19. He has been charged by Japanese prosecutors with financial mis- conduct while head of automaker Nissan (NSANF). Ghosn, 64, denies the charges, but prosecutors have argued successfully that he should be kept in jail awaiting trial". Entity Description: Halliburton Company: "Halliburton Com- pany is an American multinational corpora- tion responsible for most of the world's hy- draulic fracturing operations.[6] In 2009, it was the world's second largest oil field service company. It has operations in more than 70 countries.[7] It owns hundreds of subsidiaries, affiliates, branches, brands, and divisions worldwide and employs approximately 55,000 people.[8] The company has dual headquar- ters located in Houston and in Dubai and re- mains incorporated in the United States." 3. Generating impact of the fact on entity: To determine the impact of each fact on the rel- evant entities, we utilize Language Learning (LL) models such as the chat feature of the GPT-3.5 Turbo model. By inputting the fac- tual statements and relevant entities, we can generate a brief description of how each entity is impacted by the fact. We use chat-based prompts to provide context for the LL models, such as: "Imagine that you are an expert finan- cial analyst and you are analyzing the impact of a certain news article on different stocks and companies." To input the relevant entity, we use prompts like: "Consider the company " + entityname + ", which is described as " + entitydescription + "." Finally, we provide the factual statement to the LLM as part of the prompt and ask it to provide a brief sum- mary of the potential impact of the news on the entity. This step helps us to gain a better understanding of how each fact is likely to affect the entities that are relevant to it. Example: Fact-Entity Summary: "The charge of financial misconduct against the former head of Nissan, who is also a for- mer executive of Halliburton, may potentially affect the reputation of Halliburton negatively. As the company has been involved in contro- versies before, this news may lead investors and stakeholders to question the company's re- sponsible management and ethical practices. This could potentially lead to a decrease in the company's stock price and investment, dam- aging its financial performance. However, the extent of the impact would depend on how the company and its current management address the issue and respond to the situation.". Article summary: "The news regarding Carlos Ghosn being re- placed as chairman and CEO of Renault is not expected to have a direct impact on Al- phabet Inc, General Motors Company (GM), Tesla Inc., Howmet Aerospace Inc., A garter, or Garman as they are not directly related to the automotive industry or the companies in- volved. However, there may be indirect effects on these companies and the broader technol- ogy and automotive sectors. For Alphabet Inc, any changes in the global automotive industry resulting from Ghosn's replacement could indirectly affect their self-driving car project, Waymo, and the overall market senti- ment due to their global presence. Similarly, GM and Tesla Inc. may experience ripple effects within the automotive industry if the alliance between Renault and Nissan faces disruptions or changes, potentially impacting investor sentiment and the overall industry. Howmet Aerospace Inc. may be indirectly im- pacted if they have any partnerships or busi- ness agreements with Renault, Nissan, or Mit- subishi Motors, as mentioned in the news arti- cle. The extent of the impact would depend on the nature and scale of those collaborations. A garter and Garman are not directly associ- ated with the automotive industry, so the news about Carlos Ghosn's arrest and detention is unlikely to have a significant impact on these companies. It is important for these compa- nies to monitor the situation and potential ripple effects to determine any indirect impact on their operations and financial performance. However, without further information or de- velopments, it is difficult to predict the exact impact on these companies" 4. Summary aggregation: After generating in- dividual summaries for each fact and entity, the next step is to combine them to create a comprehensive summary of the news article. To achieve this, we also make use of LL mod- els and chat prompts to generate a final brief summary that covers all major points and ar- guments presented in the article. We provide a prompt that instructs the LL model to pro- vide a concise summary that captures the most important information from the article. The summary should include key details such as the main topic, the impact on every relevant company, relevant facts and figures, and any important conclusions or recommendations presented in the text. We also ask the model to list every company that has been impacted by the news. By combining the individual sum- maries and generating a final comprehensive summary, we can provide a clear and concise overview of the news article, including its im- pact on relevant entities. This can be useful for decision-making and analysis purposes in various industries. 1.4 Likely Challenges and Mitigations This task and methodology presented various chal- lenges, such as obtaining outputs as expected from the language models, utilizing appropriate prompts for the outputs, finetuning models when necessary, and identifying the top-K companies related to a given fact. Should any of these challenges have arisen, a systematic approach was adopted to re- vise the plans. This involved a comprehensive re- view of the relevant literature to identify alternative methods and approaches. In case of unmitigated challenges, the problem statement was considered for revision to achieve feasibility with the existing approaches. Such an adaptive approach ensured the continued progress of the research while main- taining high standards of scientific rigor. 2 Related Work [1] introduces example-based summarization tech- niques that circumvent the widely used query- based techniques that allow for more subjective and 'better'/desired results (in terms of the prompter's summarization goals). This improves drastically over query-based techniques by 1) providing more information to the system, 2) allowing the user to define their subjective prompt, 3) preventing the 'frustrating' process of iteratively improving a query to get the desired summary. The summa- rization step in our project aligns closely with this example based summarization technique in order to get a desirable summary of the aggregated facts from a news article by appending examples to input prompts. [2] aims to tackle the challenges that appear in long form summarization: processing very long documents, nontrivial causal and temporal depen- dencies, and rich discourse structures[2]. Many widely used summarization techniques are used ei- ther for short form writing or long form writing in the form of scientific journals or patents: the latter of which does not contain a large possibil- ity for openly interpretational summaries. Book- Sum tackles the long-form, creative-writing scene by creating an aggregate of summaries of creative works at a paragraph/chapters and full work level, it fine tunes baseline models to generate summaries at a paragraph level, ranks them using top-k, and combines the highly ranked summaries. This ap- proach will differ from our approach as our data is based on financial news articles (short form text) and SEC data (long form straightforward data), so it would be better to rely on other summarization methodologies from other sources. [3] aims to show how 'chain of thought' prompt- ing can help improve a large language model's abil- ity to perform complex tasks. By introducing an example QA pair, in which the answer contains an explanation the process/rationale (chain in thought) of solving the task, the LLM is able to imitate the process for a subsequent question to a higher de- gree of performance and accuracy than without the chain in thought addition. The idea of chain of thought prompting can be very helpful in our tasks in which we prompt a model to decide whether or not an event/entity has a positive or negative affect on another entity. By using this prompting technique, we can more easily see the effects that entities will have on each other, especially when looking at financial data. [5] builds an idea known as 'self consistency', which builds off the success of a chain of thought prompting in order to replace the legacy decoding methodology of 'greedy decoding'. Self consis- tency is a self supervised approach of using multi- ple reasoning paths to come to an aggregated con- clusive answer, like a group of humans would. This has shown to have a significant increase in com- monsense reasoning/arithmetic benchmarks, to a rate as high as 17.9 percent (GSM8K). This pro- cess would be very useful again for prompting in both the effect of an event/entity on another entity (ex. 'chain-in-thought' QA pair appended to Q: "Does chatGPT have a negative/positive affect on Google") and 'summarization' tasks (the aggrega- tion of facts from news sources) of our paper, as it would combine the success of chain in thought with the self-consistency route aggregation. Having mul- tiple routes of thinking will be very helpful when considering financial effects of events/entities. [6] aims to tackle the problem of fact verification in order to prevent misinformation by using a struc- tured based approach of organizing text in tables as opposed to that of commonly used unstructured text. Each row on the table is structured with a verified claim, annotated evidence from wikipedia, and a label indicating whether or not the informa- tion is enough to reach a verdict/what the verdict is (support or refute the claim). Feverous' data structure can be a good way to model the factual or opinionated sentences from news text input. Also, its dataset could be used to finetune a LLM for fact extraction. One change we may have to make is to rely on more than wikipedia as a source of infor- mation, as it would be limited in terms of financial data but would be good for general company/entity descriptions. [7] aims to label whether or not an article is a news story (unbiased reporting) or an opinion ar- ticle (persuasive reporting) in order to aid in fact checking. To create the dataset, the paper describes an approach of tagging sentences as either a 'claim' or a 'premise', with more 'premises' indicating a 'news story' and more 'claims' indicating an 'opin- ionated article'. After fine tuning various models with the data (BERT, SVM, RNN), they found that, during analysis, linguistic features that were high- lighted in the dataset (negation, negation-suffix, digits and interjection, etc) did not affect the re- sults, so it is a path to avoid taking when thinking of fact extraction. The paper also shows how we can fine tune the model to indicate whether text is opinionated or not, which can help in produc- ing accurate results; however, the big difference between our task and the paper's is that we will be extracting factual and opinionated structures from text at a sentence level, while this paper focuses on an article level. 3 Experiments 3.1 Datasets For our project, we have utilized a variety of news articles from the Economist dataset spanning from 2017 to 2019, along with additional data for later years through web scraping for news articles re- lated to finance, business, world and economy. To create event encodings for companies, individuals, stocks, and commodities, we have obtained con- textualized embeddings using data from Wikipedia. Furthermore, we are utilizing 10K sec filing data for creating company embeddings to incorporate business, risk and other key information of stake- holders. 3.2 Software In the first step of extracting facts from a news article, we employ a rule-based technique using NLTK and Spacy libraries. These libraries assist in tokenization, Part-of-Speech tagging, as well as detecting negation and subjective markers. This aids in the extraction of factual sentences from the article. Subsequently, we utilize the Pyserini li- brary for document retrieval and indexing. To incor- porate dense vector representations (embeddings) for each predefined entity, we employ Dense Pas- sage Retrieval techniques using Pyserini. For fact- summary creation, we utilize a chat-based model of LLM, such as gpt-3.5-turbo, along with vari- ous prompting techniques. The same approach is employed for abstract summary creation as well. 3.3 Challenges One potential challenge we faced was with LLMs and creating good enough prompts to perform question-focused summarization using facts, zero- shot, and few-shot prompting. Prompting perfor- mance was a crucial step for the success of the project. Additionally, we lacked a standard metric for evaluating the abstract summaries. We found a lack of evaluation techniques that could deter- mine the factual accuracy and usefulness of the generated summaries. An appropriate evaluation approach would involve comparing the generated summaries against factual truth, making the pres- ence of domain experts with relevant knowledge crucial. 3.4 Contingency Plan We aimed to attain zero-shot prompting for question-based summarization of the impact of news on different entities. If that did not work, we planned to use few-shot learning and feed more context to the prompt in order to generate better results. We experimented with different models to find the ones which gave the best possible response. While our prompt was able to generate results for the news impact on different companies, we aimed to generate better prompting techniques to generate better results and get more insights so that financial analysts can use this software in real-time in the future. In addition to that, we are devising plans to discover more effective evaluation techniques. This problem is highly open-ended and requires exten- sive experimentation to identify ways of assessing the quality of generated summaries. One approach is to create control and experiment sets and invite domain experts to evaluate the summaries based on their insightfulness. We can also investigate the impact of changing prompts on the evaluation scores. Additionally, we intend to employ ranking- based methods by treating human rankings as a baseline for relevance and calculating NDCG or Precision@n scores for the rankings generated by the language models. Currently, we are conducting this evaluation on a limited set of articles, but we aim to explore its effectiveness on a larger scale as well. 4 Results and Evaluation 4.2 Proposed Evaluation Method 4.1 Results News article: Some of the biggest names in tech are calling for artificial intelligence labs to stop the training of the most powerful AI systems for at least six months, citing "profound risks to society and humanity." Elon Musk was among the dozens of tech leaders, professors and researchers who signed the letter, which was published by the Future of Life Institute. The wave of attention around ChatGPT late last year helped renew an arms race among tech compa- nies to develop and deploy similar AI tools in their products. OpenAI, Microsoft and Google are at the forefront of this trend, but IBM, Amazon, Baidu and Tencent are working on similar technologies. Companies impacted: • Akamai Technologies, Inc. • American International Group, Inc. (AIG) • Bio-Rad Laboratories, Inc. • Intuitive Surgical, Inc. • Netflix, Inc. • Tesla, Inc. (TESS-l or TEZ-l) Factual Summary: The companies that may be impacted include OpenAI, Microsoft, Google, Leidos, AIG, Tesla, and Netflix. For example, if AI tools have biased responses or spread misinfor- mation, it could lead to increased insurance claims for AIG. The news of calls to stop the training of the most powerful AI systems for at least six months could have some impact on Tesla, Inc. as the company heavily relies on artificial intelligence in the development of their electric vehicles and related products. Netflix may need to reconsider its current business model and future strategies if AI tools are found to have biases or spread mis- information. Intuitive Surgical, which develops and markets robotic products designed to improve clinical outcomes of patients through minimally invasive surgery, might face questions about the safety and reliability of the da Vinci Surgical Sys- tem due to potential risks and concerns associated with AI technologies. Bio-Rad Laboratories, which uses advanced technology in its products, may not be directly impacted as it is not involved in the development and deployment of AI tools. Since we only had unlabelled data at our disposal, we lacked ground truth summaries for comparison purposes. The generated summaries needed to be evaluated on their factual accuracy regarding the impact of the news on relevant entities. Unfortu- nately, there was no predefined evaluation metric available for this specific criterion. We attempted to examine the stock movements over a certain pe- riod after the news was released, but this approach proved unreliable due to the multitude of factors influencing stock prices. Therefore, we opted for a contextual approach to assess the quality of the summaries, focusing on their conciseness, factual- ness, and usefulness for financial analysts in mak- ing decisions and conducting analysis. The proposed evaluation method entails the use of ChatGPT, a language model, to evaluate the performance of summary generation. The method involves feeding the final summary along with a prompt, which outlines the metrics used to assess model performance, to ChatGPT. As there are no labeled data to evaluate summary coherence, the method is inspired by ChatEval, a tool that uses a human-level intervention to evaluate summary coherence. ChatGPT simulates this intervention, generating scores for coherence based on the align- ment of the summary with the given information. To determine the final scores for model perfor- mance, the process involves using multiple inputs and outputs, computing an average score for each metric of interest. Currently, the metrics being used for this evaluation are accuracy, conciseness, fluency, and engagement, with the possibility of more metrics being experimented on based on the outcomes of these. To provide ChatGPT with the input required for generating summary coherence scores, two ap- proaches are used: few-shot learning and the in- structive method using prompts. The model is be- ing evaluated using both approaches. For the evaluation process, a single summary will be provided for a news article, and the task will be to rate the summary on the coherence metric, with a score range of 1 to 5. Coherence refers to the quality of all sentences collectively and is aligned with the DUC quality question of structure and coherence. A high-quality summary should be well-structured, well-organized, and build logically from sentence to sentence to provide a coherent body of information about a topic. The evaluation process involves three steps. Firstly, the news article is carefully read to identify the main topic and key points. Secondly, the sum- mary is compared to the news article to determine if it covers the main topic and key points and if it presents them in a clear and logical order. Lastly, a score for coherence is assigned based on the Eval- uation Criteria, using a scale of 1 to 5, where 1 represents the lowest score, and 5 represents the highest. Table 1: G-Eval Evaluation Example Prompt: You will be given one summary written for a news article. Your task is to rate the summary on one metric. Please make sure you read and understand these instructions carefully. Please keep this document open while reviewing, and refer to it as needed. Evaluation Criteria: • Coherence (1-5) - the collective quality of all sentences. We align this dimension with the DUC quality question of structure and coherence whereby "the summary should be well-structured and well-organized. The summary should not just be a heap of related information, but should build from sentence to sentence to a coherent body of information about a topic." Evaluation Steps: • Read the news article carefully and identify the main topic and key points. • Read the summary and compare it to the news article. Check if the summary covers the main topic and key points of the news article and if it presents them in a clear and logical order. • Assign a score for coherence on a scale of 1 to 5, where 1 is the lowest and 5 is the highest based on the Evaluation Criteria. Few Shot Prompt Input: The quick brown fox jumps over the lazy dog. Output: The fox jumps over the dog. Evaluation: Accuracy: 100% Conciseness: 100% Fluency: 100% Engagement: 100% Input: The quick brown fox jumps over the lazy dog. The dog barks at the fox. The fox runs away. Output: The fox jumps over the dog, which barks at it. The fox runs away. Evaluation: Accuracy: 100% Conciseness: 80% Fluency: 100% Engagement: 100% Input: The quick brown fox jumps over the lazy dog. The dog barks at the fox. The fox runs away. The dog chases the fox. The fox hides in a hole. The dog looks for the fox, but cannot find it. The dog gives up and goes home. Output: The fox jumps over the dog, which barks at it. The fox runs away, but the dog chases it. The fox hides in a hole, and the dog looks for it, but cannot find it. The dog gives up and goes home. Evaluation: Accuracy: 100% Conciseness: 70% Fluency: 100% Engagement: 100% Input: The news about the battle between the world's biggest economies over semiconductor resources could potentially impact Microchip Technology Inc. (......................................................) restric- tions imposed by these economies could impact their accessibility and affordability, ultimately af- fecting A semiconductor's revenue and profits. Output: To manage the impact of the conflict, such as di- versifying its supply chain or investing in research and development to produce more innovative prod- ucts (.......................................................) hospital- ity brands such as Marriott and Hilton, retailers like Macy's and J.C. Penney, and manufacturers such as Ford and General Motors. Evaluation: Generated response: Accuracy: 90% Conciseness: 60% Fluency: 90% Engagement: 80% While the output captures the main points from the input text and provides some valuable insights and recommendations, it also includes some irrel- evant information about the COVID-19 pandemic and companies unrelated to the semiconductor in- dustry. The text is also less concise and engaging, with longer and more complex sentences. However, it maintains good fluency, with a clear and coherent writing style. Human Evaluations We evaluated 20 articles using human evaluation and were asked to give a rating of 0-5 for the useful- ness of the article aspect from the financial analyst perspective. The results we have received are de- cent and all of the article's summaries came out to be relevant with all of the articles being scored above 3. In addition to evaluating the summaries using ChatGPT, we also employed a ranking-based evaluation approach to assess Chat-eval's reliabil- ity. Since we needed to verify the accuracy of the results generated by ChatGPT, we devised a method involving rankings provided by a Com- puter Science PhD student for a small set of 5-10 articles. These rankings were based on the per- ceived usefulness of the summaries. This served as our baseline for comparison. We then obtained rankings from ChatGPT for the same articles and calculated NDCG and Precision@n scores to com- pare the two rankings. However, due to the limited number of articles used in this evaluation and the need for further scalability, we acknowledge that more extensive testing is necessary to validate the approach. This is an aspect we plan to explore in future research. Table 2: Human evaluation vs G-Eval 5 Future Steps results. To address this, we will explore sequen- tial prompting techniques using Langchain to avoid repetition. Our plan involves expanding the en- tities included in our document store. Currently, we only have S&P 500 companies, but we intend to incorporate commodities such as gold and oil. Additionally, we aim to enhance the process of creating embeddings for these entities by utilizing their SEC filing data instead of relying solely on Wikipedia data. This shift is expected to provide more relevant information about the company and cover a broader range of aspects, ultimately improv- ing the fact-entity mapping process and influencing subsequent steps in a positive manner. Our next step entails running the pipeline on a larger dataset to generate more robust evaluations. Furthermore, we will dedicate more effort to researching and identifying better evaluation techniques, with a par- ticular focus on incorporating human evaluation methods. This approach will help in producing more insightful results. References [1] Yadav, Nishant, Matteo Brucato, Anna Far- iha, Oscar Youngquist, Julian Killingback, Alexan- dra Meliou, and Peter Haas. "SUBSUME: A Dataset for Subjective Summary Extraction from Wikipedia Documents." In New Frontiers in Sum- marization workshop (at EMNLP 2021). 2021. [2] Kry ́sci ́nski, Wojciech, Nazneen Rajani, Di- vyansh Agarwal, Caiming Xiong, and Dragomir Radev. "Booksum: A collection of datasets for long-form narrative summarization." arXiv preprint arXiv:2105.08209 (2021). [3] Wei, Jason, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. "Chain of thought prompting elicits rea- soning in large language models." arXiv preprint arXiv:2201.11903 (2022). [4] Diao, Shizhe, Pengcheng Wang, Yong Lin, and Tong Zhang. "Active Prompting with Chain- of-Thought for Large Language Models." arXiv preprint arXiv:2302.12246 (2023). [5] Wang, Xuezhi, Jason Wei, Dale Schu- urmans, Quoc Le, Ed Chi, and Denny Zhou. "Self-consistency improves chain of thought rea- soning in language models." arXiv preprint arXiv:2203.11171 (2022). We aim to experiment with improved prompting techniques to produce more concise and precise [6] Aly, Rami, Zhijiang Guo, Michael Schlichtkrull, James Thorne, Andreas Vlachos, Christos Christodoulopoulos, Oana Cocarascu, and Arpit Mittal. "Feverous: Fact extraction and veri- fication over unstructured and structured informa- tion." arXiv preprint arXiv:2106.05707 (2021). [7] Alhindi, Tariq, Smaranda Muresan, and Daniel Preot ̧iuc-Pietro. "fact vs. opinion: The role of argumentation features in news classification." In Proceedings of the 28th international conference on computational linguistics, pp. 6139-6149. 2020. Appendix Experiments and Outputs News article: WASHINGTON, DC AND MOSCOW P ATRIOT PARK in Kubinka, 60km south-west of Moscow, is a military Disneyland. Families can picnic among rows of Soviet-era aircraft. Children can frolic over tanks. Those doing so on January 23rd might have noticed a long green tube, studded with ridges and dials, roped off and watched by stern guards. This was not an exhibit. It was, supposedly, the canister for the 9M729 missile. Its launcher, an imposing truck, stood nearby, as Lieutenant- General Mikhail Matveyevsky, Russia's missile chief, pointed to a diagram of the missile's innards. "All tests of surface-to-surface missiles," he declared, "were conducted to a range that is less than the INF [Intermediate- Range Nuclear Forces] treaty limit." The show-and-tell did not impress America, whose diplomats had turned down an invitation to the theme park. On February 1st America declared itwould pull out of the INF treaty. It is exasperated not only with ten years of Russian cheating but also with the rapid growth in China's unshackled arsenal of over 2,000 missiles, 95% of which are of the range forbidden to America. "If Russia's doing it and if China's doing it, and we're adhering to the agreement," complained Donald Trump in October, "that's unacceptable". The pact will die once America's six months' notice expires in the summer. "The likelihood of compromise is zero," says Adam Thomson, Britain's envoy to NATO until 2016. That brings over 30 years of arms control to a close. The INF treaty was forged in 1987 to defuse a missile race between America and the Soviet Union. Intermediate-range nukes were appealing because they could hit key targets while remaining a safe distance away from the front line, without resorting to intercontinental ballistic missiles ( ICBM s). Appealing, but dangerous: ICBM s took 30 minutes to reach their targets; mid-range missiles got there in under ten. "It was like holding a gun to our head," remarked Mikhail Gorbachev. He and Ronald Reagan agreed to scrap all such land- based missiles, conventional and nuclear. By the 2000s the treaty began to chafe Russia. Its decrepit armed forces could not afford modern warships, submarines and warplanes to carry plentiful missiles, whose utility America had demonstrated with bombing campaigns in the Middle East and the Balkans. To Russia's south and east, countries like Israel, Iran, China and Pakistan were accumulating land-based missiles. In 2005 Russia's defence minister proposed that the treaty should be junked. Not long after came Russia's first test of the 9M729 . Since 2016 four battalions, roughly 100 missiles, have been deployed to two bases east of the Ural mountains and near the Caspian sea. "The 9M729 is core to Russian military thinking in terms of what they need to fight a regional war," says Pranay Vaddi, who worked on the issue for the State Department until October. American officials may decry the cheating. But they surely sympathise with In recent years Pentagon officials the impulse. have fretted over a widening missile gap in the Pacific. "China has a massive advantage over us," says a former American army official. "It cannot be overstated how important it is that we can field precision-guided missiles, unlimited by range."The INF treaty does not prohibit putting intermediate-range missiles on ships, submarines and aircraft. But these are expensive (a modern destroyer costs $1.8bn), demand manpower and have other things to do. Hence the appeal of "A mobile TEL requires land-based missiles. a couple of drivers and operators," says the former official, referring to the transporter-erector- is launcher trucks used to fire missiles. virtually impossible for the enemy to find." In a review of American nuclear posture last year, the Trump administration said it would respond to Russia's violation of the INF treaty by building a nuclear-tipped sea-launched cruise missile (which would be INF -compliant) and reviewing "concepts and options" for a conventional land-based one (which would not be). But a deployable weapon is some way off. The US Army is already working on a Precision Strike Missile ( P r SM ) due in 2023. Its range could easily be extended beyond the current INF ceiling of 499km. But even twice that would not get from Warsaw to Moscow. A longer-legged option would be to tweak the sea-based Tomahawk to fire from land; that is what America did during the INF crisis in the 1980s to produce the 2,500km-range Gryphon. Let's do launch But Pacific geography is forbidding. Guam, the likeliest host for American missiles in Asia if Japan demurs, is over 3,000km away from Shanghai. An entirely new missile would be required. Hypersonic boost-glide missiles, which "It skip off the atmosphere at great speed, might fit the bill. But ground- launched ones are years away. Democrats, who took control of the House in January, have taken a dim view of the swelling defence budget. They may query why the Pentagon cannot make do with air- and sea-launched systems already in the pipeline. Nor is it obvious where new missiles would be put in Europe. Though NATO strongly backed America on February 1st, declaring that "Russia will bear sole responsibility for the end of the treaty," its members will be less keen on welcoming missiles, even non-nuclear ones. A few allies, like Poland, which is trying to seduce Mr Trump into setting upa new tank base, would probably embrace American arms on their soil. But a deal with Poland struck over NATO 's head would compound anxiety over America's commitment to the alliance. It might also be seen as destabilising. "Missiles deployed on the territory of newer NATO members could reach Russia's main command points in less than five minutes," notes Pavel Zolotarev of the Russian Academy of Sciences. That, he warns, would allow the "destruction of its critical infrastructure without the use of nuclear warheads." In a crisis, a jittery Russia would not necessarily make wise choices. Another option for NATO would be to rejig the American-led missile-defence shield in Poland and Romania so that it could cope with Russian cruise missiles like the 9M729 , rather than just Iranian and North Korean ballistic ones. Yet that might provoke an even bigger fight in NATO . The death of the INF treaty marks "the end of the post-cold war era," says Bruno Tertrais of the Foundation for Strategic Research, a French think-tank. What is clear is that the Trump administration has pulled the plug without a clear sense of how to navigate the era to come. This article was downloaded by calibre from https://www.economist.com/united- states/2019/02/09/america-calls-time-on-the- inf-treaty-ushering-in-a-new-age-of- missiles -************************************** . Facts: Patriot Park in Kubinka, Russia is a military-themed park with Soviet-era aircraft and tanks. Lieutenant-General Mikhail Matveyevsky, Russia's missile chief, displayed a diagram of the 9M729 missile's innards at Patriot Park. America declared on February 1st that it would pull out of the INF treaty. The INF treaty was created in 1987 to defuse a missile race between America and the Soviet Union. The treaty prohibited intermediate- range nukes, which could hit key targets while re- maining a safe distance away from the front line. Russia began to chafe under the treaty in the 2000s, as it could not afford modern warships, submarines, and warplanes to carry plentiful missiles. Since 2016, Russia has deployed roughly 100 9M729 missiles to two bases east of the Ural mountains and near the Caspian sea. America is exasperated with ten years of Russian cheating and the rapid growth in China's unshackled arsenal of over 2,000 missiles, 95The Trump administration plans to re- spond to Russia's violation of the INF treaty by building a nuclear-tipped sea-launched cruise mis- sile and reviewing "concepts and options" for a conventional land-based one.. Democrats, who took control of the House in January, may query why the Pentagon cannot make do with air- and sea- launched systems already in the pipeline. . NATO strongly backed America on February 1st, declar- ing that "Russia will bear sole responsibility for the end of the treaty.". Pavel Zolotarev of the Russian Academy of Sciences warns that missiles deployed on the territory of newer NATO members could reach Russia's main command points in less than five minutes, allowing the "destruction of its critical infrastructure without the use of nuclear warheads." . The death of the INF treaty marks "the end of the post-cold war era," according to Bruno Tertrais of the Foundation for Strategic Research. Companies impacted: ['Intercontinental Ex- change, Inc. (ICE) ', 'F5, Inc. ', 'American In- ternational Group, Inc. (AIG) ', 'Leidos, formerly known as Science Applications International Cor- poration (SAIC), ', 'Trimble Inc. ', 'Vulcan Mate- rials Company (NYSE: VMC) ', 'The Interpublic (IPG) ', 'The Lock- Group of Companies, Inc. heed Martin Corporation ', 'IQVIA, formerly Quin- tiles and IMS Health, Inc., ', 'Howmet Aerospace Inc. (formerly Arconic Inc.) ', 'American Airlines Group Inc. ', 'The Union Pacific Corporation ', 'L3Harr', 'Align Technology ', 'Gen Digital Inc. (formerly Symantec Corporation and NortonLife- Lock) ', 'Raytheon Technologies Corporation ', 'Halliburton Company ', 'Broadcom Inc. ', 'In- vesco Ltd. ', 'Northrop Grumman Corporation ']. - Overall summary: The news of America with- drawing from the INF treaty and the subsequent increase in arms race may have a positive impact on Northrop Grumman Corporation. As a major defense technology provider, the increased demand for advanced missile systems and defense equip- ment could lead to an increase in revenue and growth opportunities for the company. However, the potential negative impact of political tensions and instability in the global arms race should also be considered. The news about the end of the INF treaty, which prohibited land-based intermediate- range missiles, could potentially impact Howmet Aerospace Inc. due to its manufacturing of com- ponents for jet engines and titanium structures for aerospace applications. The increase in missile pro- duction and development could lead to a potential increase in defense spending and a rise in demand for Howmet's products. The US decision to pull out of the INF treaty could potentially have a positive impact on The Lockheed Martin Corporation. As one of the largest defense contractors in the world, it may receive further contracts and revenue from the US government to build and develop land-based missiles to compete with Russia and China's grow- ing missile arsenal. The article discusses the end of the INF treaty and the potential for a new arms race, particularly in the development and deployment of intermediate-range missiles. As Leidos provides technical services to the United States Department of Defense and other government agencies, partic- ularly in the fields of defense and aviation, it may benefit from increased demand for its expertise and services as the US seeks to modernize and expand its missile capabilities. However, there may also be increased competition and pressure on Leidos to provide cutting-edge solutions in this area. The news about America's withdrawal from the INF treaty and the possibility of an arms race may im- pact the construction industry as a whole, but it is unlikely to have a significant direct impact on Vulcan Materials Company (NYSE: VMC) as they primarily produce and distribute construction mate- rials. However, the potential escalation of tensions may impact the construction industry's demand for their products, depending on how the situation de- velops. The news about the US pulling out of the INF treaty and the potential for a new arms race be- tween America, Russia, and China is not expected to have a significant impact on American Interna- tional Group, Inc. (AIG), as the company operates primarily in the insurance and financial sectors. However, any geopolitical instability or conflict re- sulting from this situation could affect the global markets and potentially impact AIG's investments and operations. The news about the INF treaty and Russia's missile program is unlikely to have a di- rect impact on Align Technology. The company does not manufacture any military equipment or have any significant operations in Russia. However, the broader geopolitical implications of this news could impact the global economy and potentially affect the demand for Align's products in certain regions. The news article does not have a direct impact on The Union Pacific Corporation since it is a railroad holding company. However, it may indi- rectly impact the transportation industry as tensions rise between the United States and Russia, and po- tentially China. Any increase in military spend- ing or conflict may divert resources away from infrastructure and transportation projects, affecting Union Pacific's business. The news about America pulling out of the INF treaty, which led to discus- sions about the missile race and the development of new weapons, is unlikely to have a significant impact on Invesco Ltd, an investment management company based in the US. The US government's decision to pull out of the INF treaty, which could lead to a new arms race, may result in increased demand for Raytheon's missile defense systems, as well as opportunities for the company's missile divi- sion to develop and supply new land-based missiles. However, there may also be increasing competition from other defense manufacturers in the industry. The news about America pulling out of the INF treaty and the potential increase in missile race could lead to increased demand for semiconduc- tor and infrastructure software products produced by Broadcom Inc. as countries like America and China may escalate their military capabilities in this area. The news article about America pulling out of the INF treaty and the potential growth in missile technology could indirectly impact Trim- ble Inc, as they are involved in the development of satellite navigation systems and other hardware technologies that could be used in defense and mili- tary applications. The potential increase in demand for precision-guided missiles could lead to an in- crease in demand for Trimble's technology. The news article does not directly relate to Gen Digital Inc. or the cybersecurity industry, so it is unlikely to have a significant impact on the company's stock or operations. However, any potential global in- stability resulting from the end of the INF treaty and the escalation of military tension between the US and Russia could potentially affect the overall market and investor sentiment, including towards Gen Digital Inc. The news about America pulling out of the INF treaty and the potential for a mis- sile race could have a positive impact on L3Harr, as the company specializes in defense and surveil- lance solutions. The company may see increased demand for their products and services due to the growing concern over missile capabilities of the US and its rivals. The news article about Amer- ica's withdrawal from the INF treaty and the po- tential development of new missiles could have an indirect impact on Halliburton Company, as it is a major player in the energy services sector, which includes the production and transportation of oil and gas. Any increased tensions or conflicts re- sulting from the development and deployment of new missiles could potentially disrupt the industry, leading to changes in demand for Halliburton's ser- vices and products. The news about the potential global arms race and increasing military tension between the US, Russia, and China is unlikely to have a direct impact on F5, Inc. as a technology company. However, if the situation escalates into a full-blown conflict, it could have a negative impact on the overall global economy, which in turn may lead to a decrease in demand for F5's products and services. The news about the US pulling out of the INF treaty and the potential for a new missile race could potentially impact American Airlines Group Inc. due to the increased geopolitical ten- sions and potential for military action, leading to a decrease in air travel demand and revenue for the company. The news about the US pulling out of the INF treaty and the potential rise of missile development could potentially lead to an increase in military spending and a shift in focus for the US government. However, it is unlikely to have a direct impact on The Interpublic Group of Compa- nies, Inc. (IPG), which operates in the advertising industry. The news article about America pulling out of the INF treaty and the potential missile race to come would not have a direct impact on Inter- continental Exchange, Inc. (ICE), which mainly operates global financial exchanges and clearing houses. However, it may indirectly impact the financial markets and commodities that ICE ex- changes deal with due to the geopolitical tensions that may arise from such developments. Based on the news article, it is unlikely that the INF treaty withdrawal will directly impact IQVIA. IQVIA pri- marily operates within the biopharmaceutical in- dustry and is not directly involved in military or defense matters. However, any potential escalation of tensions between the US and Russia or China could lead to broader economic and geopolitical im- pacts that may indirectly affect IQVIA's business.. -************************************ Final abstract instruction based 1: The US withdrawal from the INF treaty and the potential for an arms race may have a positive impact on defense technology providers such as Northrop Grumman and Lockheed Martin, as well as Howmet Aerospace due to increased demand for missile systems and defense equipment. Leidos, which provides technical services to the US Depart- ment of Defense, may also benefit from increased demand for its expertise. The news is unlikely to have a significant direct impact on Vulcan Materials Company and American International Group, but any geopolitical instability resulting from the sit- uation could affect global markets and potentially impact AIG's investments and operations. Align Technology is not expected to be directly impacted by the news. The news of America pulling out of the INF treaty could impact the global economy and po- tentially affect the demand for Align's products in certain regions. The transportation industry, includ- ing Union Pacific Corporation, may be indirectly impacted as tensions rise between the US and Rus- sia. Raytheon's missile defense systems may see increased demand due to the potential increase in the missile race, while Broadcom Inc. and Trimble Inc. may also see increased demand for their prod- ucts. Gen Digital Inc. may not be directly impacted, but any potential global instability resulting from the end of the INF treaty could affect the overall market and investor sentiment. L3Harr, specializ- ing in defense and surveillance solutions, may see increased demand for their products and services. Halliburton Company, a major player in the energy services sector, may also be indirectly impacted by any increased tensions or conflicts resulting from the development. The potential global arms race and increasing military tension between the US, Russia, and China could impact Halliburton's services and products. F5, Inc. may be indirectly impacted if the situation escalates into a full-blown conflict, leading to a decrease in demand for its products and services. American Airlines Group Inc. may be impacted due to the increased geopolitical tensions and po- tential for military action, leading to a decrease in air travel demand and revenue. The Interpublic Group of Companies, Inc. (IPG) and Interconti- (ICE) are unlikely to be nental Exchange, Inc. directly impacted, but may be indirectly impacted by the geopolitical tensions that may arise from such developments. IQVIA is not directly involved in military or defense matters, but any potential es- calation of tensions between the US and Russia or China could lead to broader economic and geopolit- ical impacts that may indirectly affect its business.. -************************************* Final abstract instruction and one shot 2: The news of America withdrawing from the INF treaty and the potential increase in the arms race may have a positive impact on defense con- tractors such as Northrop Grumman Corporation, The Lockheed Martin Corporation, and Leidos. Howmet Aerospace Inc. may also benefit from increased demand for its products due to the poten- tial increase in missile production and development. The news is unlikely to have a significant impact on Vulcan Materials Company and American In- ternational Group, Inc. However, any geopolitical instability resulting from this situation could affect the global markets and potentially impact AIG's in- vestments and operations. The news is not expected to have a direct impact on Align Technology. The news of America pulling out of the INF treaty and the potential for a missile race could have a positive impact on defense contractors, such as Raytheon and L3Harris, as well as companies involved in semiconductor and infrastructure soft- ware products, such as Broadcom. Trimble, which develops satellite navigation systems, may also see increased demand for their technology. The news may indirectly impact transportation companies, such as Union Pacific, and energy services compa- nies, such as Halliburton, due to potential resource diversion and global instability. The news is un- likely to have a significant impact on Invesco or Gen Digital. The potential global arms race and increasing military tension between the US, Russia, and China could impact defense contractors such as Hallibur- ton, but is unlikely to have a direct impact on technology companies like F5, Inc. However, if the situation escalates into a full-blown conflict, it could negatively impact the overall global econ- omy, leading to a decrease in demand for F5's products and services. The news about the US pulling out of the INF treaty and the potential for a new missile race could potentially impact American Airlines Group Inc. due to the increased geopolitical tensions and potential for military ac- tion, leading to a decrease in air travel demand and revenue for the company. The news may indi- rectly impact the financial markets and commodi- (ICE) ties that Intercontinental Exchange, Inc. exchanges deal with due to the geopolitical ten- sions that may arise from such developments. The INF treaty withdrawal is unlikely to directly im- pact IQVIA, but any potential escalation of ten- sions between the US and Russia or China could lead to broader economic and geopolitical impacts that may indirectly affect IQVIA's business.. - *************************************** Instruction based abstract eval scores 1: Factfulness: 5 Conciseness: 3 Usefulness: 4 The summary provides relevant and accurate in- formation on the impact of America's withdrawal It specifically highlights from the INF treaty. companies that could benefit from increased de- mand for defense-related products and services, such as Northrop Grumman, Lockheed Martin, and Leidos. However, the summary also notes that the situation may indirectly impact other companies in the global market due to potential geopolitical instability. The summary could be more concise in its discussion of how the news may impact other companies, but overall it pro- vides helpful information to a financial analyst.. -************************************* Instruction based abstract eval scores 2: News 1: Factfulness: 5 The summary provides accurate and relevant information about the impact of the news article on the listed companies. The writer discusses specific ways in which the INF treaty withdrawal may impact various companies. Conciseness: 4 The summary provides essential information in a concise manner, but some state- ments could be more straightforward and less repet- itive. Usefulness: 4 The summary provides useful data to a financial analyst to analyze the market and identify potential impacts on specific companies. However, the potential impact on other industries or markets is not discussed, which limits the overall usefulness of the summary. Overall, the summary accurately and concisely be improved for clarity and to better connect to the main topic. Accuracy: 3 The summary mentions some po- tential impacts on defense contractors, such as Northrop Grumman Corporation and The Lock- heed Martin Corporation, but does not provide a clear explanation of why they would be affected. The potential impact on transportation companies and energy services companies, as well as the in- direct impact on financial markets and commodi- ties, is mentioned, but not fully explained. The summary does not address the specific companies listed in the prompt or provide a clear explanation of how the news article may impact them. Over- all, the summary includes some important points about potential economic impacts of the INF treaty withdrawal, but could benefit from more specific examples and explanations.. summarizes the impact of the news article on the listed companies, but could provide more compre- hensive analysis of potential impacts on other in- dustries or markets. News 2: Factfulness: 5 The summary provides accurate and relevant information about the potential im- pact of the news article on the listed companies. The writer discusses specific ways in which the in- creased global arms race may impact various com- panies. Conciseness: 4 The summary provides essential information in a concise manner, but some state- ments could be more straightforward and less repet- itive. Usefulness: 4 The summary provides useful data to a financial analyst to analyze the market and identify potential impacts on specific companies. However, the potential impact on other industries or markets is not discussed, which limits the overall usefulness of the summary. Overall, the summary accurately and con- cisely summarizes the potential impact of the news article on the listed companies, but could provide more comprehensive analysis of poten- tial impacts on other industries or markets.. - ************************************** Instruction and one shot based abstract eval desc 1: Coherence: 5 - The summary is well-structured and each sentence logically follows the previous one, providing a clear flow of information. Accuracy: 4 - The summary accurately ex- plains how the US withdrawal from the INF treaty could impact defense technology providers such as Northrop Grumman and Lockheed Martin, al- though the impact on other companies listed is more uncertain and indirect. The summary also correctly identifies the potential for geopolitical instability and its impact on global markets, and the potential demand for Raytheon's missile de- fence systems. However, the summary's assess- ment of the impact on other companies, such as F5, Inc. and American Airlines Group Inc., is more speculative and may not necessarily come true.. -************************************ Instruction and one shot based abstract eval desc 2: Coherence: 4 The summary is mostly well- structured and organized, with clear transitions be- tween sentences. However, some sentences could
http://arxiv.org/abs/2310.04878v1
"2023-10-07T17:24:41"
"2023-10-07T17:24:41"
Hybrid Recommendation System using Graph Neural Network and BERT Embeddings
Recommender systems have emerged as a crucial component of the modern web ecosystem. The effectiveness and accuracy of such systems are critical for providing users with personalized recommendations that meet their specific interests and needs. In this paper, we introduce a novel model that utilizes a Graph Neural Network (GNN) in conjunction with sentence transformer embeddings to predict anime recommendations for different users. Our model employs the task of link prediction to create a recommendation system that considers both the features of anime and user interactions with different anime. The hybridization of the GNN and transformer embeddings enables us to capture both inter-level and intra-level features of anime data.Our model not only recommends anime to users but also predicts the rating a specific user would give to an anime. We utilize the GraphSAGE network for model building and weighted root mean square error (RMSE) to evaluate the performance of the model. Our approach has the potential to significantly enhance the accuracy and effectiveness of anime recommendation systems and can be extended to other domains that require personalized recommendations.
[ "Shashidhar Reddy Javaji", "Krutika Sarode" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04878v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04878v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.IR", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.IR", "cs.AI", "cs.LG" ]
Hybrid Recommendation System using Graph Neural Network and BERT Embeddings Shashidhar Reddy Javaji Krutika Sarode University of Massachusetts Amherst University of Massachusetts Amherst Amherst, MA sjavaji@umass.edu Amherst, MA ksarode@umass.edu Abstract Recommender systems have emerged as a crucial component of the modern web ecosystem. The effectiveness and accuracy of such systems are critical for pro- viding users with personalized recommendations that meet their specific interests and needs. In this paper, we introduce a novel model that utilizes a Graph Neural Network (GNN) in conjunction with sentence transformer embeddings to predict anime recommendations for different users. Our model employs the task of link prediction to create a recommendation system that considers both the features of anime and user interactions with different anime. The hybridization of the GNN and transformer embeddings enables us to capture both inter-level and intra-level features of anime data.Our model not only recommends anime to users but also predicts the rating a specific user would give to an anime. We utilize the Graph- SAGE network for model building and weighted root mean square error (RMSE) to evaluate the performance of the model. Our approach has the potential to signifi- cantly enhance the accuracy and effectiveness of anime recommendation systems and can be extended to other domains that require personalized recommendations. 1 Introduction Recommendation systems are algorithms that suggest items to users based on their past behavior. They are used in a variety of applications, such as online shopping, music streaming, and social media. There are two main types of recommendation systems: collaborative filtering and content-based filtering. Collaborative filtering systems recommend items to users based on the ratings or preferences of other users. For example, if you have rated a number of movies on Netflix, the collaborative filtering system will recommend other movies that other users with similar ratings have also enjoyed. Content-based filtering systems recommend items to users based on the content of the items them- selves. For example, if you have listened to a number of songs by a particular artist, the content-based filtering system will recommend other songs by the same artist. In recent years, there has been a trend towards using hybrid recommendation systems that combine the strengths of collaborative filtering and content-based filtering. These systems can provide more accurate recommendations than either type of system on its own. There are a number of different ways to build recommendation systems. One common approach is to use machine learning algorithms. Machine learning algorithms can be trained on large datasets of user ratings or preferences to learn how to predict which items a user will like. Another approach to building recommendation systems is to use artificial intelligence (AI) techniques. AI techniques, such as deep learning, can be used to create more complex and powerful recommendation systems. Recommendation systems have become an integral part of our daily lives, aiding us in making informed decisions about the products and services we use. The success of these systems can be attributed to their ability to filter and personalize vast amounts of information, making it easier for Submitted to 37th Conference on Neural Information Processing Systems (NeurIPS 2023). Do not distribute. users to find relevant and useful items. However, the increasing complexity and heterogeneity of data have made it challenging to develop accurate and efficient recommendation systems. In recent years, graph neural networks (GNNs) have emerged as a promising solution to this problem, allowing us to incorporate relational data into our recommendation models. GNNs can effectively capture the inherent structure and dependencies in the data, enabling us to make more accurate and personalized recommendations. Graph Neural Networks (GNNs) have emerged as a powerful approach to solving problems in the domain of recommendation systems. Recommendation systems aim to recommend items to users that are relevant and useful to them, based on their past behavior and preferences. GNNs can help in creating better recommendations by modeling the complex relationships between users and items in a graph-based representation. One of the key challenges in recommendation systems is the sparsity of the data. In many cases, users may have only interacted with a small subset of items, and the available data may not be sufficient to learn accurate models. GNNs can help address this challenge by leveraging the graph structure of the data to propagate information from observed to unobserved nodes. GNNs can be used in both content-based and collaborative filtering approaches to the recommendation. In a content-based approach, GNNs can be used to model the features of the items and users and create recommendations based on the similarity between their embeddings. In a collaborative filtering approach, GNNs can be used to model the interactions between users and items in a graph, and create recommendations based on the relationships between the nodes. One of the popular approaches for GNN-based recommendation is GraphSAGE. GraphSAGE is a variant of GNN that aggregates information from neighboring nodes to generate node embeddings. In GraphSAGE, each node is assigned an initial feature vector, and these features are updated iteratively by aggregating information from the node's neighbors. The aggregated features are then passed through a neural network layer to generate a new embedding for the node. In the context of recommendation, GraphSAGE can be used to generate embeddings for both users and items. The model can be trained to predict the likelihood of a user interacting with an item, based on the embeddings of the user and item. The learned embeddings can then be used to generate recommendations for users. To improve the performance of the recommendation system, additional features can be incorporated into the model. For example, in the case of movie recommendations, features such as the genre and the synopsis of the movie can be used to augment the embeddings of the movies. Similarly, features such as the age and gender of the user can be used to augment the embeddings of the users. Overall, GNNs have shown great promise in the domain of recommendation systems and can help in creating more accurate and personalized recommendations for users. With the availability of large amounts of data and the increasing interest in personalized recommendations The rest of the paper is organized as follows: Section 2 provides a brief overview of related work. Section 3 describes the dataset and the pre-processing steps used to prepare the data. Section 4 presents the proposed model in detail. Section 5 presents the experimental setup and results. Finally, Section 6 concludes the paper with a summary of the contributions and directions for future work 2 Related Work Recommender systems have been widely used to provide personalized recommendations to users. Collaborative filtering (CF) is a popular technique that utilizes users' past behavior to make recom- mendations. Matrix factorization, a type of CF algorithm, decomposes the user-item interaction matrix into two lower-dimensional matrices to represent users and items. The regularization weights of the latent factors can be assigned based on items' popularity and users' activeness, which can improve the prediction results of the matrix factorization technique. [4] The paper on graph neural networks in recommender systems provides a survey of various graph- based techniques for recommender systems, including GCNs, GATs, and GAEs. The paper discusses how these techniques can be used to handle cold-start problems, incorporate side information, and enhance recommendation accuracy. [5] Graph-based models have become increasingly popular in recent years for their ability to handle complex interactions between users and items. The linear residual graph convolutional network approach for CF-based recommender systems revisits GCNs in CF models and shows that removing non-linearities can enhance recommendation performance. The 2 proposed model uses a residual network structure that is specifically designed for CF with user-item interaction modeling, which alleviates the over-smoothing problem in graph convolution aggregation operation with sparse data. [3] The graph-based hybrid recommendation system (GHRS) combines content-based and collaborative filtering approaches to extract new features based on users' ratings, demographic, and location information. These features are then used for clustering users, which improves recommendation accuracy and dominates other methods' performance in the cold-start problem. The experimental results on the MovieLens dataset show that the proposed algorithm outperforms many existing recommendation algorithms on recommendation accuracy. [1] Inductive matrix completion is another popular approach to building recommender systems that can handle the cold-start problem. The paper on learning to transfer graph embeddings for inductive graph-based recommendation proposes a transfer learning framework for personalized video highlight recommendation. The proposed framework is composed of two parts: a graph neural network that exploits the higher-order proximity between users and segments to alleviate the user cold-start problem and an item embedding transfer network that approximates the learned item embeddings from graph neural networks. [2] Matrix factorization, specifically, is a widely used technique in recommender systems that utilizes users' past behavior, such as ratings or purchases, to make recommendations. One of the most popular CF algorithms is matrix factorization, which decomposes the user-item interaction matrix into the product of two lower dimensionality rectangular matrices, user and item embeddings, that represent users and items in a lower-dimensional space. The regularization weights of the latent factors can be assigned based on items' popularity and users' activeness, which can improve the prediction results of the matrix factorization technique. The paper on matrix factorization techniques for recommender systems provides a foundational understanding of collaborative filtering and matrix factorization for building recommender systems. [4] In summary, the related papers cover various techniques for building recommender systems, including matrix factorization, graph-based models, inductive matrix completion, and transfer learning. These papers provide further insights into the use of these techniques in recommender systems and how they can be used to handle cold-start problems, incorporate side information, and enhance recommendation accuracy. 3 Dataset The Anime Recommendation Database 2020 is a dataset available on Kaggle, containing information about anime and user interactions from the website MyAnimeList. The dataset was created by scraping the website and contains recommendation data from 320,000 users and 16,000 animes. The dataset is comprised of two main tables: the anime table and the rating table. The anime table contains information about each anime, including its ID, name, genre, type, episodes, and synopsis. The genre field is a list of genres associated with anime, such as "Action", "Comedy", "Drama", and "Fantasy". The type field indicates whether the anime is a TV series, movie, OVA, or other formats. The episodes field indicates the number of episodes in the series. The synopsis field provides a brief description of the anime's plot. The rating table contains information about user interactions with the animes, including the user ID, the anime ID, and the user's rating for the anime on a scale of 1 to 10. The dataset also includes a timestamp field indicating the time when the user rated the anime. The dataset contains a total of 78,460,895 user-anime interactions, with an average of 4.9 ratings per user. The most popular anime in the dataset is "Death Note", with over 150,000 ratings. The dataset is useful for building recommendation systems for anime, as it contains information about both the animes and user preferences. 3.1 Preprocessing The dataset used in this research consists of two primary data sources: the "anime with synopsis" and "rating complete" files, which were merged to obtain relevant columns for the model. Specifically, the dataset includes anime id, user id, synopsis, genres, and rating. Prior to analysis, the dataset 3 Figure 1: Bar graph of ratings given by each users underwent a preprocessing step which involved data cleaning to remove rows with null values in any column. One hot encoding was also applied to the genres column in order to transform the categorical variable into a numerical format suitable for analysis. Furthermore, two dictionaries were created to map the user id's and anime id's in the dataset. These dictionaries were used to facilitate the analysis and interpretation of the data. Overall, the resulting dataset is suitable for use in conducting research on anime recommendation systems, and provides a robust foundation for the development and evaluation of machine learning algorithms for this purpose. We created three classes: SequenceEncoder, IdentityEncoder, and GenresEncoder, which encode different types of data into PyTorch tensors. These classes are used to load and process node and edge data for a graph-based recommendation system. The SequenceEncoder class encodes text data using the SentenceTransformer model. The input data is a Pandas dataframe, and the output is a PyTorch tensor that represents the sentence embeddings. The IdentityEncoder class converts raw column values to PyTorch tensors, and the GenresEncoder class encodes genre information from the raw data. The load node csv function uses these encoders to process the node data, concatenating the resulting tensors into a single tensor. The load edge csv function loads edge data and generates labels for each edge. It takes two arguments, ratings user id and ratings movie id, which are the user and movie IDs for each rating. It then generates edge labels by looking up the corresponding ratings from a dictionary user anime rating and returns a PyTorch tensor containing the edge labels. Overall, the code shows how the dataset is preprocessed before being fed into the graph-based recommendation system. The SequenceEncoder, IdentityEncoder, and GenresEncoder classes are used to encode different types of data into PyTorch tensors, which are then concatenated into a single tensor using the load node csv function. The load edge csv function loads edge data and generates labels for each edge, completing the dataset preprocessing pipeline. 4 Proposed Methodology In an anime recommendation system, the features used for node creation can have a significant impact on the performance of the system. One common approach is to use genres as the features for each anime. Genres are categorical variables that can be one-hot encoded and used to represent the anime's content. This approach is straightforward and easy to implement, but it has some limitations. 4 Figure 2: Architecture of the model One limitation is that genres alone may not capture the complexity and nuances of the anime. For example, two anime could have the same genres, but one could be a comedy with a light-hearted tone while the other could be a dark psychological thriller. In this case, relying solely on genres may not differentiate between the two anime and could lead to poor recommendations. To overcome this limitation, we can combine the genres with the sentence embeddings of the synopsis. The synopsis is a brief summary of the anime's plot, and it can provide additional information about the anime's content and style. By using sentence embeddings, we can capture the meaning and context of the synopsis, which can help to differentiate between anime with similar genres. To do this, we first preprocess the synopsis by removing stop words, punctuation, and other irrelevant information. We then use a pre-trained sentence embedding model such as BERT or GloVe to generate embeddings for each sentence in the synopsis. We can then average these embeddings to obtain a single embedding for the entire synopsis. We can then concatenate the one-hot encoded genres with the synopsis embedding to create a feature vector for each anime. This feature vector captures both the categorical information about the anime's genres and the semantic information about the anime's content and style. Once we have the feature vectors for each anime, we can use them to create nodes in the graph. We can then use graph neural networks (GNNs) to learn the representations of these nodes and generate recommendations based on the learned representations. Compared to using genres alone, combining genres with the synopsis embeddings can lead to more accurate and personalized recommendations. This approach can capture the complex and nuanced content of the anime and provide better differentiation between anime with similar genres. Additionally, this approach can be extended to incorporate other textual features such as reviews or user feedback, which can further improve the recommendations. The Model class inherits from the PyTorch Module class, which provides a convenient way to define a neural network model. The __init__ method defines the components of the model and initializes their parameters. The forward method defines the computation that will be performed by the model when it is run on input data. The GNNEncoder class is a custom implementation of a GNN encoder that takes as input a set of node features and edge connections and outputs a set of node embeddings. The hidden_channels argument specifies the dimensionality of the node embeddings. The GNNEncoder class is defined in a separate file and is not shown in the code snippet provided. HeteroData( user={ x=[100, 100] }, anime={ x=[3534, 427] }, (user, rates, anime)={ edge_index=[2, 16143], edge_label=[16143] }, (anime, rev_rates, user)={ edge_index=[2, 16143] } ) : HeteroData Structure 5 The encoder attribute of the Model class is an instance of the GNNEncoder class. It takes the hidden_channels argument as input and is initialized with the same dimensionality for both the input and output features. The to_hetero function is a utility function that converts the GNNEncoder object to a heterogeneous GNN. The data.metadata() argument specifies the schema of the heterogeneous graph, which includes information about the node types, edge types, and features of the graph. The aggr argument specifies the type of aggregation to be used when combining information from different node types. The EdgeDecoder class is a custom implementation of an edge decoder that takes as input a set of node embeddings and a set of edge connections and outputs a set of edge predictions. The hidden_channels argument specifies the dimensionality of the node embeddings. In the GNNEncoder class, the Graph- SAGE implementation is achieved by using the SAGEConv module from PyTorch Geometric library. The SAGEConv module implements the GraphSAGE convolutional operator, which aggregates the feature vectors of a node and its neighbors using a graph convolutional operation. The decoder attribute of the Model class is an instance of the EdgeDecoder class. It takes the hidden_channels argument as input and is initialized with the same dimensionality for both the input and output features. The forward method takes as input a dictionary of node features, a dictionary of edge connections, and a set of edge labels. The x_dict argument is a dictionary of PyTorch tensors representing the node features for each node type. The edge_index_dict argument is a dictionary of PyTorch tensors representing the edge connections for each edge type. The edge_label_index argument is a PyTorch tensor representing the edge labels.The forward method of the GNNEncoder class first applies a GraphSAGE layer to the input node features using the SAGEConv module. This layer aggregates the feature vectors of each node and its neighbors using a graph convolutional operation. The resulting feature vectors are then normalized and passed through a ReLU activation function. The forward method first passes the input data through the encoder to obtain a set of node embeddings, represented as a dictionary of PyTorch tensors. It then passes these node embeddings and the edge labels through the decoder to obtain a set of predicted edge labels. In summary, the model architecture consists of a GNN encoder that takes as input node features and edge connections, a heterophily operator that converts the GNN encoder to a heterogeneous GNN, and an edge decoder that takes as input node embeddings and edge connections and outputs a set of predicted edge labels. The model is designed for semi-supervised learning on heterogeneous graphs and can handle multiple node and edge types with different feature representations. In the context of graph neural networks (GNNs), the heterophily operator is a mechanism used to combine information from nodes of different types in a heterogeneous graph. In a heterogeneous graph, nodes can have different types, which correspond to different features or attributes. For example, in a citation network, nodes can represent papers, authors, or conferences, and each node type can have different attributes such as publication year, paper topic, or author affiliation. To capture such heterogeneity, GNNs use different weight matrices for each node type, allowing the model to learn different representations for nodes of different types. In the GNNEncoder class, the GraphSAGE implementation is achieved by using the SAGEConv module from the PyTorch Geometric library. The SAGEConv module implements the GraphSAGE convolutional operator, which aggregates the feature vectors of a node and its neighbors using a graph convolutional operation. The GNNEncoder class takes two arguments: the number of input feature dimensions and the number of output feature dimensions. The forward method of this class applies two GraphSAGE layers to the input node features to generate the output node features. The forward method of the GNNEncoder class first applies a GraphSAGE layer to the input node features using the SAGEConv module. This layer aggregates the feature vectors of each node and its neighbors using a graph convolutional operation. The resulting feature vectors are then normalized and passed through a ReLU activation function. The output of the first GraphSAGE layer is then passed through a second GraphSAGE layer in a similar fashion. Finally, the resulting output features are returned as the output of the forward method of the GNNEncoder class. Overall, the GNNEncoder class implements a GraphSAGE-based neural network architecture for learning node representations in a graph by aggregating neighborhood information of each node in the graph 6 5 Evaluation and Results The process of evaluation is as follows; this model is evaluated using Root Mean square Error(RMSE), the model is used to get the ratings between a given user and certain anime which the user haven't watched before, all such links are predicted with certain weight, so given a user we get the ratings for different anime in the list which they haven't watched yet, after this the predicted ratings along with the anime are taken for particular user and then the list is sorted according to the rating predicted, we get the list of anime with highest to lowest rated for the anime that would be given by the user if watched as predicted by the model, top 10 anime of this list are taken and are recommended to that user as the anime recommendation that the user can watch. The evaluation is done by using the test set where we have the ratings that are given by the user for different anime, these are not shown at the training time, trained model is used to predict the rating and then evaluate it with the ground truth labels, using RMSE we check how close the model is able to predict the values for the given graph. (a) Loss vs Epochs (b) Accuracy vs Epochs Figure 3: Results Recomendation for user: 415 ['Pokemon Movie 14 White: Victini to Kuroki Eiyuu Zekrom', 'Tsuki no Sango', 'Charlotte', 'Tanaka-kun wa Kyou mo Kedaruge', 'Iblard Jikan', 'Teekyuu', 'Tenshi Nanka ja Nai', 'No Game No Life: Zero', 'Puchitto Gargantia', 'Pokemon: Senritsu no Mirage Pokemon'] Recomendation for user: 30 ['Jormungand', 'Hanayamata', 'BlackRock Shooter (OVA)', 'Mahou Shoujo Ore', 'Selector Infected WIXOSS', 'Kara no Kyoukai 6: Boukyaku Rokuon', 'Claymore', 'Kamigami no Asobi', 'Zettai Bouei Leviathan', 'Kakegurui'] Recomendation for user: 189 ['Zero no Tsukaima F', 'Mahouka Koukou no Rettousei Movie: Hoshi wo Yobu Shoujo', 'Kami-tachi ni Hirowareta Otoko', 'Sunohara-sou no Kanrinin-san', 'Dragon Ball GT', 'Seishun Buta Yarou wa Bunny Girl Senpai no Yume wo Minai', 'Tamako Market', 'School Days', 'Kono Bijutsubu ni wa Mondai ga Aru!', 'Re:Zero kara Hajimeru Isekai Seikatsu 2nd Season'] Recomendation for user: 298 ['Mobile Suit Gundam 00', 'Bannou Bunka Neko-Musume DASH!', 'Fullmetal Alchemist: Premium Collection', 'Naruto Movie 2: Dai Gekitotsu! Maboroshi no Chiteiiseki Dattebayo!', 'Issho ni Training: Training with Hinako', 'Doraemon', 'School Rumble', 'Golden Boy', 'Rurouni Kenshin: Meiji Kenkaku Romantan - Tsuioku-hen', 'Death Note: Rewrite'] The results of our experiment are presented in this section. The model was trained and tested on a dataset consisting of 800 users. The following are the results of our experiment: Train loss: 0.659 Test Loss: 0.667 Train Accuracy: 0.52 Test Accuracy: 0.37 7 6 Conclusion and Future Work The results show that the model achieved a higher accuracy on the training data (52%) compared to the testing data (37%). The loss values for both the training and testing data are relatively high, indicating that the model may not be performing optimally. Though the accuracy is not that high, but the model is working and giving good results with very less amount of data, the compute resource required to run for large amount of data is very high The future plans of the model would be to try with more nodes which can be made into features and then make edges between the user and their features as well as the anime and the features of the animes. Also the other side of future work would to try on more data which would be possible with more compute resources. There is also possibility of trying more types of GNN's other than Graph SAGE network for the training process of the GNN. References [1] Zahra Zamanzadeh Darban and Mohammad Hadi Valipour, GHRS: Graph-based hybrid recommendation system with application to movie recommendation, Expert Systems with Applications. https://doi. org/10.48550/arXiv.2111.11293 [2] Wu, Le & Yang, Yonghui & Chen, Lei & Lian, Defu & Hong, Richang & Wang, Meng. (2020). Learning to Transfer Graph Embeddings for Inductive Graph based Recommendation. [3] Chen, Lei et al. "Revisiting Graph based Collaborative Filtering: A Linear Residual Graph Convolutional Network Approach." ArXiv abs/2001.10167 (2020): n. pag. [4] Y. Koren, R. Bell and C. Volinsky, "Matrix Factorization Techniques for Recommender Systems," in Computer, vol. 42, no. 8, pp. 30-37, Aug. 2009, doi: 10.1109/MC.2009.263. [5] Wu, Shiwen, et al. "Graph neural networks in recommender systems: a survey." ACM Computing Surveys 55.5 (2022): 1-37. 8
http://arxiv.org/abs/2310.04875v1
"2023-10-07T17:16:34"
"2023-10-07T17:16:34"
Prompt-to-OS (P2OS): Revolutionizing Operating Systems and Human-Computer Interaction with Integrated AI Generative Models
In this paper, we present a groundbreaking paradigm for human-computer interaction that revolutionizes the traditional notion of an operating system. Within this innovative framework, user requests issued to the machine are handled by an interconnected ecosystem of generative AI models that seamlessly integrate with or even replace traditional software applications. At the core of this paradigm shift are large generative models, such as language and diffusion models, which serve as the central interface between users and computers. This pioneering approach leverages the abilities of advanced language models, empowering users to engage in natural language conversations with their computing devices. Users can articulate their intentions, tasks, and inquiries directly to the system, eliminating the need for explicit commands or complex navigation. The language model comprehends and interprets the user's prompts, generating and displaying contextual and meaningful responses that facilitate seamless and intuitive interactions. This paradigm shift not only streamlines user interactions but also opens up new possibilities for personalized experiences. Generative models can adapt to individual preferences, learning from user input and continuously improving their understanding and response generation. Furthermore, it enables enhanced accessibility, as users can interact with the system using speech or text, accommodating diverse communication preferences. However, this visionary concept raises significant challenges, including privacy, security, trustability, and the ethical use of generative models. Robust safeguards must be in place to protect user data and prevent potential misuse or manipulation of the language model. While the full realization of this paradigm is still far from being achieved, this paper serves as a starting point for envisioning this transformative potential.
[ "Gabriele Tolomei", "Cesare Campagnano", "Fabrizio Silvestri", "Giovanni Trappolini" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04875v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04875v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CL", "cs.CY", "cs.HC", "cs.OS" ]
Prompt-to-OS (P2OS): Revolutionizing Operating Systems and Human-Computer Interaction with Integrated AI Generative Models Gabriele Tolomei,§ Cesare Campagnano,§ Department of Computer Science Sapienza University of Rome, Italy {tolomei, campagnano}@di.uniroma1.it Fabrizio Silvestri, Giovanni Trappolini Department of Computer Engineering Sapienza University of Rome, Italy {fsilvestri, trappolini}@diag.uniroma1.it 3 2 0 2 t c O 7 ] G L . s c [ 1 v 5 7 8 4 0 . 0 1 3 2 : v i X r a Abstract-In this ambitious paper, we present a groundbreak- ing paradigm for human-computer interaction that revolutionizes the traditional notion of an operating system. Within this innova- tive framework, user requests issued to the machine are handled by an interconnected ecosystem of generative AI models that seamlessly integrate with or even replace traditional software ap- plications. At the core of this paradigm shift are large generative models, such as language and diffusion models, which serve as the central interface between users and computers. This pioneering approach leverages the abilities of advanced language models, empowering users to engage in natural language conversations with their computing devices. By capitalizing on the power of language models, users can articulate their intentions, tasks, and inquiries directly to the system, eliminating the need for explicit commands or complex navigation. The language model comprehends and interprets the user's prompts, generating and displaying contextual and mean- ingful responses that facilitate seamless and intuitive interactions. This paradigm shift not only streamlines user interactions but also opens up new possibilities for personalized experiences. Generative models can adapt to individual preferences, learning from user input and continuously improving their understanding and response generation. Furthermore, it enables enhanced accessibility, as users can interact with the system using speech or text, accommodating diverse communication preferences. However, this visionary concept also raises significant chal- lenges, including privacy, security, trustability, and the ethical use of generative models. Robust safeguards must be in place to protect user data and prevent potential misuse or manipulation of the language model. While the full realization of this paradigm is still far from being achieved, this paper serves as a starting point for envisioning the transformative potential of a human-computer interaction intelligence. We discuss paradigm centered around artificial the envisioned benefits, challenges, and implications, paving the way for future research and development in this exciting and promising direction. Index Terms-AI generative models for operating systems, AI generative models for human-computer interaction, AI generative models as universal applications I. INTRODUCTION The evolution of human-computer interaction (HCI) has undergone several transformations over the decades, with tech- §Equal contribution. nology continuously striving to make computers more user- friendly and accessible. From the command-line interfaces of the 1960s to the graphical user interfaces (GUI) of the 1980s and, more recently, the touch interfaces on mobile devices, each shift has represented a significant leap towards more intuitive, efficient, and seamless user experiences. Today, as we find ourselves at the precipice of another paradigm shift, the question is not whether, but how, we continue to shape this ongoing evolution to ensure a future where technology serves us in increasingly human-centric ways. In the current technological landscape, artificial intelligence (AI) stands as a powerhouse of potential, particularly for augmenting and redefining current operating systems and user interfaces. The abilities of large generative models (LGMs), such as large language models (LLMs) and diffusion models (DMs), have given us a glimpse into a future where our inter- actions with technology transcend the traditional boundaries. LLMs, built upon vast data sets and sophisticated architec- tures, are capable of completing complex tasks, demonstrating chain-of-thought reasoning akin to human capabilities, and displaying impressive generalization skills. Their proficiency in comprehending and generating language makes them ideal base-reasoners, capable of orchestrating diverse system com- ponents to create a seamless, intuitive, and responsive user interface. Moreover, with advances in generative computer vision models, especially DMs, our toolbox for enhancing human- computer interaction has expanded. These models can generate incredibly realistic outputs, setting the stage for them to serve as the foundation for user interface generation: the ability to generate personalized interfaces on-the-fly, that cater and adapt to individual user preferences, their character, and mood marks a shift toward highly customized and user-centric design, a shift that promises to enrich user experiences significantly. This new paradigm of human-computer interaction presents exciting opportunities, such as enabling communication be- tween systems that otherwise do not integrate the same API. By utilizing natural language, a universal medium, we can bridge the gap between disparate systems, fostering a more unified, coherent, and efficient interaction landscape. However, this shift in paradigm also brings its share of chal- lenges. A prime example is the need to ensure data persistence within these models. One key question when implementing this new approach is how we can keep a consistent and ongo- ing dialogue over time, especially when the system is working on complicated or multi-stage tasks. This steady interaction is crucial for a smooth user experience and for building trust in the system's ability to assist the user effectively. To make this possible, we may need to step away from the methods we're used to and start thinking about new ways to improve the performance of these generative models. For instance, current methods of data management, such as storing files explicitly in computers or data centers, may provide some benefits, but they may not fully meet the unique needs of generative models, which store their knowledge implicitly, compressed within their parameters. While the capabilities of LLMs in understanding and gen- erating language are remarkable, they are not without their limitations. These issues primarily originate from the data employed for their pre-training, which is frequently obtained from web crawls. This data can often contain biased, toxic, or harmful content, consequently impairing models' reliabil- ity. Another limitation is the tendency to hallucinate, i.e., despite not having any explicit misinformation, LLMs may generate outputs that are not entirely accurate or faithful. This propensity to deviate from the input can occasionally lead to responses that, while contextually plausible, might misrepresent the user's intent or the factual information at hand. Moreover, the promise of seamless interaction and com- munication must balance with considerations of trustability, privacy, security, and ethics. For this reason, developing new protocols for information exchange becomes a necessity in this envisioned future. These protocols must meet and surpass current standards, protecting user data while simultaneously ensuring private and secure interactions. The design of such protocols also must anticipate and be resilient against potential misuse of AI systems, providing robust safeguards to exploita- tion and unethical practices. These represent just a few of the challenges in harnessing the full potential of LLMs in revolutionizing human-computer interaction. As we venture into this exciting new territory, it is essential to confront these challenges head-on, ensuring that the solutions we develop are not just technologically advanced, but also reliable, ethical, and user-centric. The road ahead in this new paradigm is both promising and challenging. This paper serves as an exploration into the future of human-computer interaction – a future where our interactions with technology become akin to a natural con- versation. We delve deeper into the benefits, challenges, and implications of this envisioned future in the following sections, charting a course for continued research and development in this transformative and exciting direction. In particular, Section II reviews current work in this area, and provides an idea of the current technological landscape; Sections III and IV describe our vision and propose a possible architecture, respectively. Section V questions the main challenges that may arise; finally, Section VI concludes our discussion. II. RELATED WORK Recent years have seen the rise of Transformers as the leading architecture for (deep) learning systems. Initially in- troduced as a technique for machine translation [1], they have soon been recognized as valuable for text-related downstream tasks. Works such as [2, 3, 4, 5] pre-train a transformer on a self-supervised task and finetune it on a specific downstream task, usually using a small amount of data and achieving super- human performance [6]. Others [7, 8, 9] have focused on using transformers as generative LLMs. These models effectively train to predict the next token sequence given a particular context/input. This latter strategy has reached wide popularity, even among the general public, thanks to recent successes like [10]. These LLMs have fully exploited the transformer's capacity to scale to a huge number of parameters, allowing them to have exceptional capabilities on many downstream tasks, even in a zero-shot setting, i.e., without requiring further supervision on the specific task. Even more surprisingly, the models can improve these tasks using prompting [11]. Prompting consists in providing specific input to the LLM, inducing a more accurate response by the model. We find other techniques inside this paradigm, like that of in-context learning [12], that is, to provide the LLM with a few examples of the task in its input, sometimes greatly enhancing its performance. We would like the reader to notice that these techniques do not require any additional training and can be performed at inference time. While these LLMs have shown impressive capabilities, they also have several shortcomings. Above all, the inability to deal with a large context/input [13] and the tendency to hallucinate [14] has led researchers to look for ways of augmenting them [15, 16, 17]. Among these, we find most interesting for this work the line of researchers that aims at augmenting LLMs with the use of tools [18, 19]. Under this paradigm, the LLM can call for help in the form of APIs. For instance, the model could call a calculator to perform a mathematical operation. In this paper, we want to move beyond this paradigm. While the LLM can call for tools, they are imagined as strictly rigid and static APIs. What we envision, instead, is to have generative models that can communicate both with the user and among each other in a natural manner; in other words, we foresee the the end of programming [20] as we know it for the average computer user. This new proposed paradigm opens up a realm of possibility. For example, thanks to recent advances in text-to-image gener- ation [21], authors from [22] have proposed a GUI generated at runtime and explicitly personalized for a particular user- task-experience triplet. Even further, deep learning models are now reaching multimodal capabilities beyond just images, with methods proficient on audio [23, 24, 25], video [26, 27], and 3D [28, 29, 30]. In the following sections, we develop more thoroughly this vision that promises to revolutionize system design and human-computer interactions. III. VISION Let us consider a hypothetical scenario as an exemplification to introduce this section. In the following, we will use the term "agent" to indicate any generative AI model within our ecosystem. We denote by Ac a client agent, which is a user's personal assistant, while As designates a set of server agents, which provide specific services or resources. We illustrate this through the following dialogue sequence, where files and actions are represented by square brackets: 1) User to Ac: "Please find me a flight to Paris on the 16th or 17th of July in the evening for less than 120 USD. Don't show me all the options; propose the cheapest one directly" 2) Ac to [As1, As2, As3]: "My user would like a flight to Paris, between the 16th and 17th of July, preferably in the evening, at a cost not exceeding 120 USD. Who can provide options?" 3) As1 to Ac: "No options available." As2 to Ac: "There are two flights, the first is on July 16th at 4 PM for 118 USD, the other on July 17th at 6 PM for 95 USD." As3 to Ac: "There is a flight on July 17th at 4 PM for 110 USD." 4) Ac to As2: "Please send a quote for the second option (the one on July 17th at 6 PM for 95 USD)." 5) As2 to Ac: [PDF][Secure payment link] 6) Ac to User: "Here is the quote for a 95 USD flight [Display PDF]. Do you want to book?" 7) User to Ac: "Yes, and then print the ticket." 8) Ac to As2: [Payment] 9) As2 to Ac: [Ticket PDF] 10) Ac to User: "Here is PDF][Print ticket PDF]" the ticket. [Display ticket This hypothetical scenario above is just one example of a broader vision that is mappable to this framework. This system could have enormous flexibility, for example, "find me a flight to go to Thailand, Indonesia, Vietnam, or Cambodia around mid-August for 14-16 days. When you find something less than 700 USD, book it without asking for my confirmation, and print me the ticket". In this scenario, Ac serves as the orchestrator, coordinating with the server agents As to achieve the user's goal. Ac, empowered by LLMs and DMs, is capable of understanding the user's instructions, delegating tasks, and managing the dialogue's flow. Meanwhile, the server agents As, powered by various specialized components/models, handle specific tasks such as finding flights, handling payments, and generating PDFs. To further delineate our vision, let us delve deeper into the integration of state-of-the-art computer vision systems and their potential role in on-the-fly GUI rendering. Diffusion models, which have demonstrated remarkable capabilities in generating high-quality, realistic outputs, could serve as a cornerstone for this task. One of the exciting prospects that the adoption of such models brings is the ability to customize and personalize the interface in response to the user's preferences, character, and even mood. Given that these models can be trained to generate a wide range of visual outputs, they could be directed to design interfaces that echo a user's aesthetic preferences or adapt to their current mood. For instance, the system could switch from a minimalist design with soft colors to a vibrant, dynamic design as it detects a change in the user's emotional state. Such a degree of customization would revolutionize the con- cept of user-centric design, moving away from static designs to more fluid and responsive ones. This ability to generate personalized interfaces on-the-fly represents a significant shift towards a future where technology can deeply integrate into our lives, responding to our needs and moods in real time. Additionally, the integration of speech-to-text and text- to-speech models can further enhance this future vision of human-computer interaction. The coupling of these models with a powerful language understanding system allows for interactions that are more in line with natural, human conver- sation. Users could convey their needs verbally, and the system could respond in kind, further blurring the lines between human-computer interaction and human-human conversation. For instance, in the previously discussed scenario, the user could verbalize their request for a flight booking, and the client agent (Ac) could acknowledge, confirm, and execute these instructions using spoken language. This seamless integration of speech-to-text and text-to-speech models would provide an interaction experience that is not just intuitive but also highly efficient, especially for users with visual impairments or those who are occupied with other tasks and prefer to interact verbally with their devices. Furthermore, these systems could extend beyond serving individual users and facilitate interactions between groups of users. For instance, they could be deployed in conference calls or group meetings, transcribing the conversation, sum- marizing the key points, and even responding to queries in real time. This transition to more natural and fluid forms of communication holds immense promise for both personal and professional contexts, signaling a future where our interaction with technology is as natural and intuitive as speaking with a friend or colleague. This concept of personalized, responsive, and accessible interfaces could even extend to other sensory modalities, such as haptics, further broadening the scope of HCI. With advance- ments in AI and ML, the future of HCI could encompass an array of sensory interactions, each tailored to individual user needs and preferences, creating an immersive and inclusive technological environment. Despite these potential advancements, it is important to keep in mind that such a high level of customization and personalization carries with it a host of challenges related to privacy, security, and ethics. Addressing these challenges is essential to ensure the successful implementation of this vision. These challenges and potential solutions are discussed in greater detail in Sections V and IV. IV. PROPOSED ARCHITECTURE C. Integrated Components As the trajectory of human-computer interaction continues to evolve, we propose a novel architecture that shifts the paradigm of traditional system design. This architecture is visualized in Figure 1, highlighting the integration of an LLM directly above the system call layer of the operating system, fundamentally altering how users (and current standalone applications) interface with low-level computing resources. Fig. 1. A representation of the proposed architecture highlighting the operating system, system calls, LLM, and its integration with a multi-modal neural database and other integrated components. A. High-Level to Direct LLM Interface Referring to Figure 1, traditionally, user requests, translated by standalone applications, would interface with the operating system through system calls. Our proposed architecture envi- sions an LLM layer sitting atop the system call layer. This LLM would harness the power of system calls to communi- cate with the operating system directly. By introducing this intermediary LLM layer, we can achieve several advantages: • Reduction in Redundancy: Redundancies inherent in maintaining multiple application layers, especially those with overlapping backend processes, can be significantly reduced. • Simplified Communication: LLMs, acting as universal mediators, can execute user commands across various platforms, obviating the need for shared APIs. • Natural Interaction: Users can employ natural language, moving away from domain-specific commands, promot- ing a more human-centric design. B. Transitioning Away from Standalone Applications While the LLM becomes the primary interface, standalone applications will not vanish but transform. They could serve as specialized plug-ins or tools for the LLM. For complex tasks, such as advanced graphic design, specialized applica- tions might still be employed. However, initiation and basic interactions can be handled in natural language, seamlessly integrating these applications with the LLM. In addition to the LLM, our architecture encompasses: • Graphical Processor based on Diffusion Models: This caters to visual tasks, allowing for the generation and in- terpretation of personalized user interfaces and graphical content, ensuring a multi-modal interaction platform. • Multi-modal Neural Database: Integral to our proposed architecture, as visualized in Figure 1, is the connection of the LLM to a multi-modal neural database. This database serves as persistent memory storage for the LLM, ensur- ing consistent user experiences across sessions. Unlike traditional databases that store explicit data, this neural database retains information in a format amenable to di- rect neural processing, facilitating immediate and efficient data retrieval and modification by the LLM. • Text-to-Speech and Speech-to-Text Systems: These components allow for auditory interactions, where users can speak to and receive vocal feedback from the system. The outlined architecture supports adaptability and user- centricity, with components continuously refining their oper- ations based on feedback. Data security, consistency, and the reliability of LLM-mediated interactions remain pivotal, and will be discussed in more detail in the next section. V. CHALLENGES Developing an operating system that integrates generative AI models like the one sketched in Figure 1 promises to reshape system design dramatically. Therefore, realizing this vision is not without its challenges, which span technological, security, privacy, and ethical domains. In this section, we delve deeper into these obstacles, highlighting the complex and multifaceted work required to bring this vision to fruition. A. Trustability and Safety LLMs have shown remarkable capabilities in understanding and generating human-like text. This remarkable prowess stems from their training on enormous, diverse web data, which allows them to assimilate an impressive understanding of language structure, context, and information. However, this training approach can also present substantial risks [31, 32, 33]. Uncontrolled web data, which is often part of large pre-training corpora, can introduce the possibility of biased, harmful, or toxic behavior. For instance, if the training data includes prejudiced viewpoints or false information, the LLM might inadvertently absorb these biases and misinfor- mation, potentially affecting the quality and trustworthiness of the content it generates. Moreover, LLMs can sometimes generate plausible yet inaccurate content, a phenomenon often referred to as hallu- cination. Users may overlook minor inaccuracies in the short term, but persistent or significant misrepresentations can erode trust in the system. This challenge becomes even more acute when the system handles sensitive or critical tasks, where accuracy and reliability are paramount. Developing methods to reduce these hallucinations, in- crease the trustworthiness of generated content, and provide Operating SystemServicesProgramexecutionI/OoperationsErrordetectionResourceallocation. . .System callsLLMMulti-modalNeural DatabaseText-to-speechSpeech-to-textGraphical processor(Diffusion-based model)LegacyDatabaseHardware transparency into the system's decision-making process is a significant, non-trivial challenge in realizing this vision. be challenging to anticipate or prevent, given the diverse and unpredictable nature of human interaction. B. Technological Challenges 1) Data Persistence: Current LLMs are stateless, meaning they do not maintain a memory of past interactions. While this is not an issue for single, isolated tasks, it poses a substantial challenge for complex, multi-stage tasks that require an on- going dialogue with the user. In these scenarios, maintaining a consistent "conversation thread" is crucial for the system to function effectively and provide a smooth, seamless user experience. More generally, LGMs encode their knowledge implicitly within their model parameters, effectively compressing vast amounts of information into a highly condensed form. While this approach allows the model to generate rich, contextually- aware content, it also presents a significant challenge in retrieving and using this information effectively. Innovative solutions for data persistence and memory man- agement are essential for achieving smooth, natural human- computer interactions. These solutions could involve novel data storage and retrieval mechanisms, new ways of repre- senting and tracking dialogue states, or creative uses of meta- learning to adapt and personalize the system over time. 2) Hardware Considerations: The integration of LGMs into operating systems entails careful consideration of both low-level and high-level hardware aspects. At the low level, the system's design must efficiently manage the available hardware resources. Running LGMs in real-time could demand substantial computational resources, potentially stretching the limits of current systems. Innovative technologies to build small and specialized models for this new kind of operating system should be devised, as we cannot make any use of an LGM that will exhaust the system resources available. At a high level, the envisioned system would necessitate a radical shift in software-hardware interaction. The generated user interfaces must work seamlessly across diverse hardware configurations, demanding extensive adaptability and compat- ibility. Ensuring the system's efficacy and efficiency across a wide range of hardware poses a significant technical challenge. C. Security and Privacy 1) Communication Security: As we move towards a new paradigm of human-computer interaction, secure communi- cation becomes even more critical. Current communication protocols, like certificate-based authentication, provide robust mechanisms for ensuring that an agent is legitimate before starting communication. However, as we transition to a sys- tem centered around LLMs, these protocols will need to be augmented or replaced with new techniques tailored to the unique challenges and opportunities of this paradigm. 2) AI-Social Engineering: The sophistication of LGMs can potentially be exploited in AI-social engineering attacks. In such scenarios, a malicious user might attempt to deceive the AI system into revealing sensitive information or execute harmful actions. These attacks can take many forms and can Preventing these attacks will require careful system design, including setting strict parameters on the system's behavior, determining which data can be shared and under what condi- tions, and designing mechanisms for user consent and control over the system's actions. D. Ethics The integration of LGMs into operating systems also raises numerous ethical concerns. One significant concern is their po- tential to displace human workers in specific professions. Such displacement could lead to widespread job losses, contributing to economic inequalities and causing societal disruption on a potentially large scale. Moreover, the power of these technologies to synthesize and manipulate data poses unique risks. For example, LGMs can be harnessed to create deepfakes and fake news, which can then be used for nefarious purposes, including disinformation campaigns or identity theft. These models can generate ma- licious content, such as automated phishing emails or hate speech, exacerbating existing social and ethical dilemmas. These ethical issues highlight the importance of establish- ing robust safeguards, regulations, and guidelines to prevent misuse and manage the societal impact of these technologies. VI. CONCLUSION The evolution of human-computer interaction, enhanced by the capabilities of LGMs such as LLMs and DMs, has the potential to reshape system design and the dynamics of communication, interaction, and collaboration between users and machines. Through the integration of AI into operating systems, we envision a future where interfaces are not only intuitive but also deeply personalized, adapting to individual needs and preferences, allowing for seamless and coherent in- teractions. This paper offers a glimpse of such a transformative future, emphasizing both its unprecedented benefits and its multifaceted challenges. Yet, the roadmap to such a future is not without its intri- cacies. Harnessing the full potential of AI-enhanced human- computer interaction requires navigating a landscape replete with challenges, ranging from data persistence, model reliabil- ity, bias, to the paramount concerns of trust, privacy, and eth- ical considerations. Addressing these challenges is not merely a technical exercise but a broader call for interdisciplinary collaboration. The complexity of these issues suggests that our current understanding and strategies may only be scratching the surface, necessitating a paradigm shift in our approach. Despite these hurdles, this journey is of primary importance. The convergence of AI and HCI within system design can lead to a profound enhancement in the quality of our digital experiences, shifting from transactional commands to natural, conversation-like engagements. We envision a world where technology is a responsive collaborator, attuned to human needs and preferences. While this paper has just scratched the surface of this promising frontier, we hope that it serves as a catalyst, inspiring and guiding future research endeavors. ACKNOWLEDGMENT This work was partially supported by: • DRONES AS A SERVICE for FIRST EMERGENCY RESPONSE Project (Ateneo 2021); • projects FAIR (PE0000013), SERICS (PE00000014), and IR0000013-SoBigData.it under the MUR National Re- covery and Resilience Plan funded by the European Union NextGenerationEU. REFERENCES [1] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, "Attention is all you need," Advances in neural informa- tion processing systems, vol. 30, 2017. [2] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova, transformers preprint "Bert: Pre-training of deep bidirectional for language arXiv:1810.04805, 2018. understanding," arXiv [3] K. Clark, M.-T. Luong, Q. V. Le, and C. D. Manning, "Electra: Pre-training text encoders as discriminators rather than generators," arXiv preprint arXiv:2003.10555, 2020. [4] Y. Liu, M. Ott, N. Goyal, J. Du, M. Joshi, D. Chen, O. Levy, M. Lewis, L. Zettlemoyer, and V. Stoyanov, "Roberta: A robustly optimized bert pretraining ap- proach," arXiv preprint arXiv:1907.11692, 2019. [5] C. Campagnano, S. Conia, and R. Navigli, "SRL4E – Se- mantic Role Labeling for Emotions: A unified evaluation framework," in Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 4586–4601, 2022. [6] A. Wang, A. Singh, J. Michael, F. Hill, O. Levy, and S. R. Bowman, "Glue: A multi-task benchmark and analysis platform for natural language understanding," arXiv preprint arXiv:1804.07461, 2018. [7] T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Ka- plan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. M. Ziegler, J. Wu, C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray, B. Chess, J. Clark, C. Berner, S. McCandlish, A. Radford, I. Sutskever, and D. Amodei, "Language models are few-shot learners," 2020. [8] A. Radford, K. Narasimhan, T. Salimans, "Improving and understanding language I. Sutskever, by generative pretraining," 2018. [9] A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, and I. Sutskever, "Language models are unsupervised multitask learners," OpenAI Blog, 2019. [10] OpenAI, "Chatgpt by openai," 2021. [11] Y. Lu, M. Bartolo, A. Moore, S. Riedel, and P. Stenetorp, "Fantastically ordered prompts and where to find them: Overcoming few-shot prompt order sensitivity," arXiv preprint arXiv:2104.08786, 2021. [12] Q. Dong, L. Li, D. Dai, C. Zheng, Z. Wu, B. Chang, X. Sun, J. Xu, L. Li, and Z. Sui, "A survey on in-context learning," 2023. [13] N. F. Liu, K. Lin, J. Hewitt, A. Paranjape, M. Bevilac- qua, F. Petroni, and P. Liang, "Lost in the middle: How language models use long contexts," arXiv preprint arXiv:2307.03172, 2023. [14] M. Zhang, O. Press, W. Merrill, A. Liu, and N. A. Smith, "How language model hallucinations can snow- ball," 2023. [15] G. Mialon, R. Dess`ı, M. Lomeli, C. Nalmpantis, R. Pa- sunuru, R. Raileanu, B. Rozi`ere, T. Schick, J. Dwivedi- Yu, A. Celikyilmaz, et al., "Augmented language models: a survey," arXiv preprint arXiv:2302.07842, 2023. [16] G. Trappolini, A. Santilli, E. Rodol`a, A. Halevy, and F. Silvestri, "Multimodal neural databases," in Proceed- ings of the 46th International ACM SIGIR Conference on Research and Development in Information Retrieval, SIGIR '23, (New York, NY, USA), p. 2619–2628, Asso- ciation for Computing Machinery, 2023. [17] J. Thorne, M. Yazdani, M. Saeidi, F. Silvestri, S. Riedel, and A. Halevy, "Database reasoning over text," in Pro- ceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Vol- ume 1: Long Papers), (Online), pp. 3091–3104, Associ- ation for Computational Linguistics, Aug. 2021. [18] T. Schick, J. Dwivedi-Yu, R. Dess`ı, R. Raileanu, M. Lomeli, L. Zettlemoyer, N. Cancedda, and T. Scialom, "Toolformer: Language models can teach themselves to use tools," arXiv preprint arXiv:2302.04761, 2023. [19] S. G. Patil, T. Zhang, X. Wang, and J. E. Gonzalez, "Gorilla: Large language model connected with massive apis," 2023. [20] M. Welsh, "The end of programming," Commun. ACM, vol. 66, p. 34–35, dec 2022. [21] R. Rombach, A. Blattmann, D. Lorenz, P. Esser, and B. Ommer, "High-resolution image synthesis with latent diffusion models," 2022. [22] J. Wei, A.-L. Courbis, T. Lambolais, B. Xu, P. L. Bernard, and G. Dray, "Boosting gui prototyping with diffusion models," 2023. [23] P. Dhariwal, H. Jun, C. Payne, J. W. Kim, A. Radford, and I. Sutskever, "Jukebox: A generative model for music," arXiv preprint arXiv:2005.00341, 2020. [24] Z. Borsos, R. Marinier, D. Vincent, E. Kharitonov, O. Pietquin, M. Sharifi, D. Roblek, O. Teboul, D. Grang- ier, M. Tagliasacchi, et al., "Audiolm: a language model- ing approach to audio generation," IEEE/ACM Transac- tions on Audio, Speech, and Language Processing, 2023. [25] G. Barnab`o, G. Trappolini, L. Lastilla, C. Campagnano, A. Fan, F. Petroni, and F. Silvestri, "Cycledrums: auto- matic drum arrangement for bass lines using cyclegan," Discover Artificial Intelligence, vol. 3, no. 1, p. 4, 2023. [26] Z. Luo, D. Chen, Y. Zhang, Y. Huang, L. Wang, Y. Shen, D. Zhao, J. Zhou, and T. Tan, "Videofusion: Decomposed diffusion models for high-quality video generation," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2023. [27] Y. Li, C.-Y. Wu, H. Fan, K. Mangalam, B. Xiong, J. Malik, and C. Feichtenhofer, "Mvitv2: Improved multi- scale vision transformers for classification and detection," 2022. [28] Z. Chen, G. Wang, and Z. Liu, "Scenedreamer: Un- bounded 3d scene generation from 2d image collections," 2023. [29] G. Trappolini, L. Cosmo, L. Moschella, R. Marin, S. Melzi, and E. Rodol`a, "Shape registration in the time of transformers," Advances in Neural Information Processing Systems, vol. 34, pp. 5731–5744, 2021. [30] O. Halimi, I. Imanuel, O. Litany, G. Trappolini, E. Rodol`a, L. Guibas, and R. Kimmel, "Towards pre- cise completion of deformable shapes," in Computer Vision–ECCV 2020: 16th European Conference, Glas- gow, UK, August 23–28, 2020, Proceedings, Part XXIV 16, pp. 359–377, Springer, 2020. [31] D. Z ̈ugner, O. Borchert, A. Akbarnejad, and S. G ̈unnemann, "Adversarial attacks on graph neural and their patterns," ACM networks: Perturbations from Data Transactions on Knowledge Discovery (TKDD), vol. 14, no. 5, pp. 1–31, 2020. [32] A. Chakraborty, M. Alam, V. Dey, A. Chattopadhyay, and D. Mukhopadhyay, "Adversarial attacks and defences: A survey," arXiv preprint arXiv:1810.00069, 2018. [33] G. Trappolini, V. Maiorca, S. Severino, E. Rodol`a, F. Sil- vestri, and G. Tolomei, "Sparse vicious attacks on graph neural networks," arXiv preprint arXiv:2209.09688, 2022.
http://arxiv.org/abs/2310.04871v1
"2023-10-07T16:48:24"
"2023-10-07T16:48:24"
Machine Learning for Automated Mitral Regurgitation Detection from Cardiac Imaging
Mitral regurgitation (MR) is a heart valve disease with potentially fatal consequences that can only be forestalled through timely diagnosis and treatment. Traditional diagnosis methods are expensive, labor-intensive and require clinical expertise, posing a barrier to screening for MR. To overcome this impediment, we propose a new semi-supervised model for MR classification called CUSSP. CUSSP operates on cardiac imaging slices of the 4-chamber view of the heart. It uses standard computer vision techniques and contrastive models to learn from large amounts of unlabeled data, in conjunction with specialized classifiers to establish the first ever automated MR classification system. Evaluated on a test set of 179 labeled -- 154 non-MR and 25 MR -- sequences, CUSSP attains an F1 score of 0.69 and a ROC-AUC score of 0.88, setting the first benchmark result for this new task.
[ "Ke Xiao", "Erik Learned-Miller", "Evangelos Kalogerakis", "James Priest", "Madalina Fiterau" ]
10.1007/978-3-031-43990-2_23
[ { "@title": "doi", "@href": "http://dx.doi.org/10.1007/978-3-031-43990-2_23", "@rel": "related", "@type": null }, { "@title": null, "@href": "http://arxiv.org/abs/2310.04871v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04871v1", "@rel": "related", "@type": "application/pdf" } ]
[ "In: Medical Image Computing and Computer Assisted Intervention -\n MICCAI 2023. pp. 236-246 (2023)" ]
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "eess.IV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "eess.IV", "cs.CV", "cs.LG", "I.4.0; I.2.10" ]
3 2 0 2 t c O 7 ] V I . s s e e [ 1 v 1 7 8 4 0 . 0 1 3 2 : v i X r a Machine Learning for Automated Mitral Regurgitation Detection from Cardiac Imaging Ke Xiao1, Erik Learned-Miller1, Evangelos Kalogerakis1, James Priest2, and Madalina Fiterau1 1 University of Massachusetts Amherst, Amherst MA 01003, USA {kexiao,elm,kalo,mfiterau}@cs.umass.edu 2 Stanford University, Stanford CA 94305, USA jpriest@stanford.edu Abstract. Mitral regurgitation (MR) is a heart valve disease with po- tentially fatal consequences that can only be forestalled through timely diagnosis and treatment. Traditional diagnosis methods are expensive, labor-intensive and require clinical expertise, posing a barrier to screen- ing for MR. To overcome this impediment, we propose a new semi- supervised model for MR classification called CUSSP. CUSSP operates on cardiac imaging slices of the 4-chamber view of the heart. It uses standard computer vision techniques and contrastive models to learn from large amounts of unlabeled data, in conjunction with specialized classifiers to establish the first ever automated MR classification system. Evaluated on a test set of 179 labeled – 154 non-MR and 25 MR – se- quences, CUSSP attains an F1 score of 0.69 and a ROC-AUC score of 0.88, setting the first benchmark result for this new task. 1 Introduction Mitral regurgitation. Mitral regurgitation (MR) [7] is a valvular heart disease in which the mitral valve does not close completely during systole when the left ventricle contracts, causing regurgitation – leaking of blood backwards – from the left ventricle (LV), through the mitral valve, into the left atrium (LA) – Figure 1. MR can be caused by either organic or functional mechanisms [6], with organic MR leading to atrial and annular enlargement and functional MR increasing atrial pressure. As MR progresses, it may cause arrhythmia, shortness of breath, heart palpitations and pulmonary hypertension [14]. Left undiagnosed and un- treated, MR may cause significant hemodynamic instability and congestive heart failure which can lead to death [17], while acute MR usually necessitates imme- diate medical intervention [22]. Thus, early detection and assessment of MR are crucial for optimal treatment outcomes, with the best short-term and long-term results obtained in asymptomatic patients operated on in advanced repair centers with low operative mortality (< 1%) and high repair rates (≥ 80 − 90%) [7]. MR diagnosis. MR is often only detected following symptom onset. Among pa- tients with asymptomatic MR, quantitative grading of mitral regurgitation is a 2 K. Xiao et al. Fig. 1. Three cardiovascular magnetic resonance (CMR) images showing the long-axis four-chamber view of the heart. Left: a heart with normal mitral valve. Middle: a heart with normal mitral valve when the valve leaflets are open. Right: a heart with mitral regurgitation. The red dotted line denotes the mitral valve. powerful indicator for clinical treatment such as immediate cardiac surgery [8]. Clinically, MR is usually diagnosed with doppler echocardiography, with car- diovascular magnetic resonance (CMR) subsequently used to assess the MR severity and to accurately quantify the regurgitant volume, one of the indicators of severity [20]. Most studies that have evaluated CMR for assessing the mi- tral regurgitant volume use the difference between left ventricular stroke volume (LVSV) and forward stroke volume (FSV). LVSV is usually estimated with the short-axis (SA) view CMR – a 4-D tensor – while FSV is most commonly de- termined by aortic phase-contrast velocity-encoding images [20]. This diagnosis and assessment process requires continuous involvement from expert clinicians along with specific order and post-processing for the phase-contrast images of the proximal aorta or main pulmonary artery during the acquisition of the CMR data. The associated expense with this standard diagnostic procedure thus poses an obstacle to the large-scale screening for MR in the general population. Toward machine learning for MR diagnosis. Although quantitatively assessing mitral regurgitant volume requires specific CMR imaging sequences and expert analysis, four-chamber (4CH) CMR images provide a comprehensive view of all four heart chambers, including the mitral valve as it opens and closes, as shown in Figure 1. Thus, we propose to train a model that uses 4CH CMR to automati- cally diagnose MR, making wide screening possible. As training data, we use the long axis 4CH CMR imaging data from the UK Biobank [1], from over 30,000 subjects, out of which N=704 were labeled by an expert cardiologist. While the 4CH view has the potential to identify MR when the regurgitant jet is visible, the imaging is not accompanied by comprehensive annotations or diagnoses of diseases/conditions for individual patients. To overcome this difficulty, we rely on weakly supervised and unsupervised methods. Weakly supervised deep learning has proved successful in detecting other heart pathologies. Specifically, Fries et al. [9] proposed a weakly supervised deep learning method (CNN-LSTM) to clas- sify aortic valve malformation from the aortic valve cross section CMR present in the UK Biobank, wherein the critical feature of the aortic valve opening shape was easily extracted from the aortic valve cross section CMR imaging data. Automated MR Detection from Cardiac Imaging 3 Meanwhile, Vimalesvaran et al. [21] proposed a deep learning based pipeline for detecting aortic valve pathology using 3CH CMR imaging from three hospitals. The data set was fully annotated with landmarks, stenotic jets and regurgitant jets. Unlike these prior two studies, we faced the challenge of extracting complex mitral valve regurgitant features from 4CH CMR images with no annotations for landmarks, regurgitant jets or easily extractable features, and only a small amount of binary MR labels. To the best of our knowledge, this is the first study on identifying MR using the 4CH CMR imaging data in an automated pipeline. Our approach. We propose an automated five stage pipeline named Cardio- vascular magnetic resonance U-Net localized Self-Supervised Predictor (CUSSP). Our approach incorporates several different preexisting neural network architec- tures in the pipeline, discussed in Section 2.2.3, to address the challenges inherent to the MR classification task. Specifically, we use a U-Net [18] to perform seg- mentation of the heart chambers, which we then use to localize the area around the mitral valve. We apply histogram equalization to enhance the appearance of the valve. We then use a Barlow Twins [26] network to learn, without su- pervision, representations of the blood flow around the valve, and a Siamese network [25] to learn differences between instances of MR and non-MR. During training, CUSSP leverages a large amount of unlabeled CMR images, and mini- mal supervision, in the form of a comparatively small set of MR labels manually annotated by cardiologist. However, at test time CUSSP is fully automated. Contribution. Our work is the first study on automated detection of mitral re- gurgitation (MR), providing a benchmark for the classification of MR in an automated pipeline from long axis 4CH CMR images. Used as a screening tool, it has the potential to support hospital diagnostics and improve patient care. 2 Methods 2.1 Segmentation of the cardiac magnetic resonance images The CMR imaging data from the UK Biobank that is relevant to MR detection includes long-axis 2-chamber (2CH) view and long-axis 4-chamber (4CH) view, which are all shown in Figure 2. In addition, the short-axis view CMR provides accurate description of the left ventricle. Both long-axis views and short-axis view are used to estimate heart measurements relevant to the MR detection task, while only the long-axis 4CH view is used for the deep learning models. As a pre-processing step, we performed semantic segmentation on the CMR imaging data, using masks (Figure 2) generated by a U-Net [18] segmentation model to highlight regions of interest to MR classification. U-Net is currently the leading model architecture for medical imaging segmentation, with various U-Net variants developed for different applications. TernausNet [12] is a U-Net variant that reshapes the U-Net encoder to match the VGG11 architecture, al- lowing it to use pre-trained VGG11 [19] model weights for faster convergence and improved segmentation results. While most medical imaging segmentation 4 K. Xiao et al. models are trained using supervised learning, weakly supervised segmentation methods such as VoxelMorph augmented segmentation [27], ACNN [16], CCNN [13], graph-based unsupervised segmentation [15], and GAN-based unsupervised segmentation [23,24] also produce comparable segmentation results. For the seg- mentation of the 4CH, 2CH, SA, and aorta view CMR imaging dataset from the UK Biobank, Bai et al. [2] offer a supervised segmentation model. Fig. 2. Example of the segmentation outputs of the long axis 4CH (left), 2CH (middle) CMR view imaging data and the short axis (right) CMR imaging data. We manually labeled 100 CMR images for each view and trained a supervised segmentation model with the TernausNet [12] architecture. Then, segmentation outputs, shown in Figure 2, are used to compute measurements of cardiac struc- ture and function for the four chambers of the heart, as summarized in Table 1. The short-axis view CMR segmentation output is used to estimate the left ven- tricle and right ventricle measurements, while the long-axis 4CH view and 2CH view outputs are used to estimate the left atrium and right atrium measure- ments. Specifically, the left atrial volume is estimated using the biplane method with segmentation of both the 2CH and 4CH view, while the right atrial volume is estimated using single plane method with segmentation of the 4CH view. 2.2 Three MR classification models We consider two baseline models, random forests (Section 2.2.1) and a CNN- LSTM (Section 2.2.2). We then present our CUSSP model in Section 2.2.3. 2.2.1 Random forest baseline We first considered a random forest (RF) classifier [3] trained for MR classification on the tabular heart measurements derived from the semantic segmentation masks, as described in Section 2.1. We divided the 18 features by body surface area (BSA) prior to training the RF. Left Atrium Vol Max (mL) Volume Min (mL) Stroke Vol (mL) Ejection Fraction (%) Ejection Fraction (%) Ejection Fraction (%) Right Atrium Vol Max (mL) Vol Min (mL) Stroke Vol (mL) Left Ventricle End-Systolic Vol (mL) End-Systolic Vol (mL) End-Diastolic Vol (mL) End-Diastolic Vol (mL) Stroke Vol (mL) Stroke Vol (mL) Ejection Fraction (%) Right Ventricle Table 1. Cardiac measurements derived from the semantic segmentation of the CMR. Cardiac Output (L/min) Mass (g) Automated MR Detection from Cardiac Imaging 5 2.2.2 Weakly supervised CNN-LSTM baseline Conceptualization. The first deep learning model for MR classification we devel- oped is a weakly supervised CNN-LSTM following the principles in Fries et al. [9] and operating on the 4CH CM imaging data. Fries et al. [9] used CMR imag- ing sequences from the UK Biobank, however, the objective of their work was the identification of aortic valve malformations. Their proposed deep learning architecture – CNN-LSTM – used DenseNet [11] as the CNN of choice to encode CMR imaging frames and the LSTM to encode embeddings of all frames within each sequence for a final classification of aortic valves into tricuspid (normal) and bicuspid (pathological). We point out that our MR classification problem is considerably more challenging. We hypothesize this difficulty is due to the lack of direct view of the mitral valve in the CMR imaging data. Moreover, the flow information provided from the 4CH view CMR imaging data is difficult to learn and encode in the model, an issue which we alleviated in the CUSSP framework. Fig. 3. Overview of the CNN-LSTM method pipeline for MR classification. Test-time pipeline. The CNN-LSTM pipeline, shown in Figure 3 includes an image segmentation model, and an image classification model. It uses the 4CH CMR from the UK Biobank. The CMR data is center-cropped using the center of mass of the CMR imaging frames. The resulting sequence provided to the CNN-LSTM, which generates probabilistic labels of MR for the sample. Training process. In the CNN-LSTM model architecture, the CNN serves as the frame encoder, which encodes each frame of each sequence into a representation vector. The model uses DenseNet-121 pre-trained on ImageNet as the CNN. To better learn the attention span of the frame encoder, we added an attention layer to the DenseNet-121 after the first convolutional layer. After the bi-directional LSTM, a multi-layer perceptron (MLP) performs the final classification. Center CropProbabilistic labelsAttention-added DenseNet-LSTM model4CH ImagesMaskingSegmentationConvolutionConvolutionPoolingAttention Layerx4Encoded Frame feature vectorsLSTM 6 K. Xiao et al. 2.2.3 The CUSSP framework Conceptualization. To better encode the blood flow information relevant to MR classification from the 4CH CMR view, we investigated self-supervised represen- tation learning methods which can leverage all the unlabeled CMR sequences present in the UK Biobank. Typically, self-supervised representation learning for visual data involves maximizing the similarity between representations of various distorted versions of a sample. Among the many self-supervised architectures, SimCLR [5], SwAV [4], and BYOL [10], we chose Barlow Twins [26], since it does not require large batches. With the labeled data, our siamese network compares the representation differences between classes by sampling two inputs from dif- ferent classes as performed in [25]. Thus, our CUSSP MR classification pipeline takes advantage of both self-supervised and supervised representation learning. Test-time pipeline. Our CUSSP method consists of five main steps, shown in Figure 4, with the first two steps representing data preprocessing, and the later three steps using network components trained for MR classification, as described in the next section. The pre-processing of the CMR imaging sequence is shown in Figure 8 in the Appendix. We used the segmentation model in 2.1 to locate the mitral valve and the orientation of the left ventricle. We then cropped a square patch with the mitral valve at its center positioned horizontally. After cropping, we applied histogram equalization to the patch with the pixel intensity range of the left atrium. The resulting patches are used by the downstream networks. Fig. 4. Overview of the CUSSP pipeline for MR classification, with its 5 steps: (1) segmentation, (2) localization, (3) cropping, (4) equalization, and (5) prediction. Training process. The first step involves training a representation encoder in a Barlow Twins network using over 30,000 unlabeled pre-processed sequences. ResNet-18 with an output dimension of 512 is used as the encoder, with hidden Segmentation ModelLocalization algorithmCroppingHistogram EqualizationembeddingEmpirical cross-corrprojectorprojectorembeddingBarlow Twins NetworkContrastive lossrepresentationrepresentationSiamese NetworkMLPResNet18predictionMLP ClassifierResNet18ResNet18ResNet18ResNet184CH CMR Images Automated MR Detection from Cardiac Imaging 7 dimension and the projector output dimensions being 2048. After training the encoder with the unlabeled dataset, it is fine-tuned in a siamese network using a comparatively smaller labeled set, as indicated in 3.1. During training, two sequences are sampled from the labeled dataset, with the first being non-MR and the second being either MR or non-MR. The two sequences are passed through the representation encoder to obtain embeddings, which are then used to calculate the contrastive loss. The model is trained to maximize contrastive loss when the two samples are non-MR and MR and to minimize it when both are non-MR. Once the representation encoder is fine-tuned in the siamese network, it is combined with a 3-layer multi-layer perceptron (MLP) network to form a classifier, which is trained on the same labeled dataset. To improve computation efficiency and training accuracy, we also tested the framework using a smaller window of 25 frames, since MR occurs between diastole and systole. 3 Experiments 3.1 Experimental setup Data splitting. 4CH CMR images were used to conduct experiments with both the CNN-LSTM method and the CUSSP method. We used a total of 704 labeled sequences, with 525 sequences selected for the training set, including 452 labeled as non-MR and 73 labeled as MR. The remaining 179 sequences were used for testing, with 154 labeled as non-MR and 25 labeled as MR. Evaluation metrics. Considering the substantial class imbalance, we opted to use F1 score as our primary evaluation metric, along with precision and recall. 3.2 Random Forest Classification Results The random forest model is trained with 10-fold cross validation, with a ran- dom search over a parameter grid of n_estimators(10 − 100), max_depth(2 − 16), max_f eatures(sqrt, log2), min_samples_leaf (2 − 8). The optimal hyper- parameter setting found is: n_estimators = 20, max_f eatures = log2, max_depth = 8, min_samples_leaf = 2. The best results obtained are presented in Table 2. Pos. Acc Neg. Acc Precision Recall F1 AUC Model 0.14 0.58 0.09 RF 0.09 0.44 0.72 0.53 CNN-LSTM 0.53 0.32 0.65 0.38 CUSSP-1 0.38 0.27 0.63 0.29 CUSSP-2 0.29 0.36 0.66 0.38 CUSSP-3 0.38 0.55 CUSSP-SIAM 0.60 0.80 0.55 0.62 0.69 0.88 CUSSP-SIAM-25 0.62 0.99 0.86 0.87 0.87 0.90 0.96 0.96 0.43 0.45 0.29 0.25 0.35 0.66 0.8 Table 2. Experimental results for Random Forest (RF) baseline, CNN-LSTM and CUSSP. CUSSP-1, CUSSP-2 and CUSSP-3 are trained with the BarlowTwins-MLP model without fine-tuning with the Siamese network. CUSSP-SIAM and CUSSP- SIAM-25 are trained with the BarlowTwins-Siamese-MLP model. 8 K. Xiao et al. 3.3 CNN-LSTM Classification Results We conducted experiments on the DenseNet-LSTM classification model using various input image sizes, attention layer configurations, and masks. The best CNN-LSTM model attains a F1-score of 0.44, shown in Table 2, with further in- formation on the performance under other settings summarized in the Appendix. 3.4 CUSSP Classification Results We evaluated various configurations of the CUSSP model, to determine the relative benefits of different components. In the first configuration, the ResNet18 model was combined with a 3-layer MLP to train a classifier using the labeled training set after being trained in the Barlow-Twins network with the unlabeled dataset. During the classifier training, the cross-correlation loss from the Barlow- Twins network and the cross-entropy loss from the binary classification were weighted using three different configurations. For CUSSP-1 the cross-correlation loss has a weight of 0.9, while the cross-entropy loss has a weight of 0.1. For CUSSP-2, the weights are 0.5 and 0.5, while for CUSSP-3 they are 0.1 and 0.9, respectively. Both CUSSP-1 and CUSSP-3 outperform CUSSP-2, though the performance is low, indicating the importance of fine-tuning, described below. In the second scenario, we fine-tuned the encoder with a siamese network to enhance the quality of the encoded representations after training the Barlow Twins network. To prevent overfitting of the model and to limit its capacity, we froze the parameters of all layers except the last block of the ResNet18 en- coder when training the siamese network and the classifier. The resulting model, CUSSP-SIAM, showed a significant improvement in performance. In the final configuration CUSSP-SIAM-25, the number of frames in the training sequences was truncated from 50 frames to the 25 frames that correspond to the interval when mitral regurgitation occurs. The results are summarized in Table 2, while the ROC-AUC curve for CUSSP-SIAM-25 are shown in Figure 5. Fig. 5. The ROC AUC curve and the precision-recall curve of CUSSP. The annotated coordinates on the precision-recall curve plot are (recall, precision, f1-score, threshold). Automated MR Detection from Cardiac Imaging 9 4 Conclusion We present the world's first automated mitral regurgitation classification system. The CUSSP model we developed, trained with limited supervision, operates on 4CH CMR imaging sequences and attains an F1 score of 0.69 and an ROC AUC of 0.88, opening up the opportunity for large-scale screening for MR. References 1. Allen, N.E., Sudlow, C., Peakman, T., Collins, R., null null: Uk biobank data: Come and get it. Science Translational Medicine 6(224), 224ed4–224ed4 (2014). https://doi.org/10.1126/scitranslmed.3008601, https://www.science.org/ doi/abs/10.1126/scitranslmed.3008601 2. Bai, W., Sinclair, M., Tarroni, G., Oktay, O., Rajchl, M., Vaillant, G., Lee, A.M., Aung, N., Lukaschuk, E., Sanghvi, M.M., et al.: Automated cardiovascular mag- netic resonance image analysis with fully convolutional networks. Journal of Car- diovascular Magnetic Resonance 20(1), 1–12 (2018) 3. Breiman, L.: Random forests. Machine learning 45, 5–32 (2001) 4. Caron, M., Misra, I., Mairal, J., Goyal, P., Bojanowski, P., Joulin, A.: Unsupervised learning of visual features by contrasting cluster assignments. Advances in neural information processing systems 33, 9912–9924 (2020) 5. Chen, T., Kornblith, S., Norouzi, M., Hinton, G.: A simple framework for con- trastive learning of visual representations. In: International conference on machine learning. pp. 1597–1607. PMLR (2020) 6. Dziadzko, V., Dziadzko, M., Medina-Inojosa, J.R., Benfari, G., Michelena, H.I., Crestanello, J.A., Maalouf, J., Thapa, P., Enriquez-Sarano, M.: Causes and mech- anisms of isolated mitral regurgitation in the community: clinical context and out- come. European heart journal 40(27), 2194–2202 (2019) 7. Enriquez-Sarano, M., Akins, C.W., Vahanian, A.: Mitral regurgitation. The Lancet 373(9672), 1382–1394 (2009) 8. Enriquez-Sarano, M., Avierinos, J.F., Messika-Zeitoun, D., Detaint, D., Capps, M., Nkomo, V., Scott, C., Schaff, H.V., Tajik, A.J.: Quantitative determinants of the outcome of asymptomatic mitral regurgitation. New England Journal of Medicine 352(9), 875–883 (2005) 9. Fries, J.A., Varma, P., Chen, V.S., Xiao, K., Tejeda, H., Saha, P., Dunnmon, J., Chubb, H., Maskatia, S., Fiterau, M., et al.: Weakly supervised classification of aortic valve malformations using unlabeled cardiac mri sequences. Nature commu- nications 10(1), 1–10 (2019) 10. Grill, J.B., Strub, F., Altché, F., Tallec, C., Richemond, P., Buchatskaya, E., Do- ersch, C., Avila Pires, B., Guo, Z., Gheshlaghi Azar, M., et al.: Bootstrap your own latent-a new approach to self-supervised learning. Advances in neural information processing systems 33, 21271–21284 (2020) 11. Huang, G., Liu, Z., Van Der Maaten, L., Weinberger, K.Q.: Densely connected convolutional networks. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 4700–4708 (2017) 12. Iglovikov, V., Shvets, A.: Ternausnet: U-net with vgg11 encoder pre-trained on imagenet for image segmentation. arXiv preprint arXiv:1801.05746 (2018) 13. Kervadec, H., Dolz, J., Tang, M., Granger, E., Boykov, Y., Ayed, I.B.: Constrained- cnn losses for weakly supervised segmentation. Medical image analysis 54, 88–99 (2019) 10 K. Xiao et al. 14. Mirabel, M., Iung, B., Baron, G., Messika-Zeitoun, D., Détaint, D., Vanoverschelde, J.L., Butchart, E.G., Ravaud, P., Vahanian, A.: What are the characteristics of patients with severe, symptomatic, mitral regurgitation who are denied surgery? European heart journal 28(11), 1358–1365 (2007) 15. Nian, Y., Li, M., Cui, H., Hu, X., Xie, B., Li, K., Xiong, X., Xiao, J., Chen, W.: Graph-based unsupervised segmentation for lung tumor ct images. In: 2017 3rd IEEE International Conference on Computer and Communications (ICCC). pp. 1884–1888. IEEE (2017) 16. Oktay, O., Ferrante, E., Kamnitsas, K., Heinrich, M., Bai, W., Caballero, J., Cook, S.A., De Marvao, A., Dawes, T., O'Regan, D.P., et al.: Anatomically constrained neural networks (acnns): application to cardiac image enhancement and segmen- tation. IEEE transactions on medical imaging 37(2), 384–395 (2017) 17. Parcha, V., Patel, N., Kalra, R., Suri, S.S., Arora, G., Arora, P.: Mortality due to mitral regurgitation among adults in the united states: 1999-2018. In: Mayo Clinic Proceedings. vol. 95, pp. 2633–2643. Elsevier (2020) 18. Ronneberger, O., Fischer, P., Brox, T.: U-net: Convolutional networks for biomedi- cal image segmentation. In: International Conference on Medical image computing and computer-assisted intervention. pp. 234–241. Springer (2015) 19. Simonyan, K., Zisserman, A.: Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556 (2014) 20. Uretsky, S., Argulian, E., Narula, J., Wolff, S.D.: Use of cardiac magnetic reso- nance imaging in assessing mitral regurgitation: current evidence. Journal of the American College of Cardiology 71(5), 547–563 (2018) 21. Vimalesvaran, K., Uslu, F., Zaman, S., Galazis, C., Howard, J., Cole, G., Bharath, A.A.: Detecting aortic valve pathology from the 3-chamber cine cardiac mri view. In: Medical Image Computing and Computer Assisted Intervention–MICCAI 2022: 25th International Conference, Singapore, September 18–22, 2022, Proceedings, Part I. pp. 571–580. Springer (2022) 22. Watanabe, N.: Acute mitral regurgitation. Heart 105(9), 671–677 (2019) 23. Wu, X., Bi, L., Fulham, M., Feng, D.D., Zhou, L., Kim, J.: Unsupervised brain tu- mor segmentation using a symmetric-driven adversarial network. Neurocomputing 455, 242–254 (2021) 24. Wu, X., Bi, L., Fulham, M., Kim, J.: Unsupervised positron emission tomography tumor segmentation via gan based adversarial auto-encoder. In: 2020 16th Inter- national Conference on Control, Automation, Robotics and Vision (ICARCV). pp. 448–453. IEEE (2020) 25. Xing, Z.J., Yin, F., Wu, Y.C., Liu, C.L.: Offline signature verification using convo- lution siamese network. In: Ninth International Conference on Graphic and Image Processing (ICGIP 2017). vol. 10615, pp. 415–423. SPIE (2018) 26. Zbontar, J., Jing, L., Misra, I., LeCun, Y., Deny, S.: Barlow twins: Self-supervised learning via redundancy reduction. In: International Conference on Machine Learn- ing. pp. 12310–12320. PMLR (2021) 27. Zhao, A., Balakrishnan, G., Durand, F., Guttag, J.V., Dalca, A.V.: Data augmen- tation using learned transformations for one-shot medical image segmentation. In: Proceedings of the ieee/cvf conference on computer vision and pattern recognition. pp. 8543–8553 (2019) Automated MR Detection from Cardiac Imaging 11 Appendix Fig. 6. Overview of the dataset. Top: Example of the long axis 4CH (left), 2CH (mid- dle) CMR view imaging data and the short axis (right) CMR imaging data. Bottom: Example of the segmentation outputs of the long axis 4CH (left), 2CH (middle) CMR view imaging data and the short axis (right) CMR imaging data. Fig. 7. Detailed overview of the CNN-LSTM method pipeline for MR classification. Center of MassInput: 4CH50x50x50xCenter CropConvolutionConvolutionPoolingAttention Layerx4Encoded Frame feature vectorsLSTM50xProbabilistic labelsAttention-added DenseNet-LSTM modelP = 0.2038329P = 0.3453742P = 0.7440756650xMasked CMRCropped Masked CMRSegmentation ModelSegmented MasksOutput 12 K. Xiao et al. Fig. 8. Detailed overview of the pre-processing steps for CUSSP. Top: Example of the 4CH CMR images in the original contrast (left), the left atrium histogram equalized contrast (middle), and the cropped patch histogram equalized contrast (right), with blue contours outline the left atrium, and the red square boxes outline the patch to crop. Bottom: Example of the cropped mitral valve patch as outlined in the red square boxes in the top row. Fig. 9. The model training stage of the CUSSP method contains three steps: (i) the feature encoder is trained in the Barlow-Twins network with unlabeled imaging data set, (ii) the feature encoder is fine-tuned in a siamese network with labeled imaging data set, and (iii) the feature encoder is assembled with a MLP, then trained with labeled imaging data set for the classification task of MR. ResNet18embeddingEmpirical cross-corrProjectorContrastive lossStep 1Step 2embeddingrepresentationpredictionStep 3Barlow Twins networkSiamese networkClassifierProjectorMLPResNet18ResNet18ResNet18ResNet18representation
http://arxiv.org/abs/2310.04870v2
"2023-10-10T03:54:36"
"2023-10-07T16:44:53"
Lemur: Integrating Large Language Models in Automated Program Verification
The demonstrated code-understanding capability of LLMs raises the question of whether they can be used for automated program verification, a task that often demands high-level abstract reasoning about program properties, which is challenging for verification tools. We propose a general methodology to combine the power of LLMs and automated reasoners for automated program verification. We formally describe this methodology as a set of derivation rules and prove its soundness. We instantiate the calculus as a sound automated verification procedure, which led to practical improvements on a set of synthetic and competition benchmarks.
[ "Haoze Wu", "Clark Barrett", "Nina Narodytska" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04870v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04870v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.FL", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.FL", "cs.AI", "cs.LG", "cs.LO" ]
3 2 0 2 t c O 0 1 ] L F . s c [ 2 v 0 7 8 4 0 . 0 1 3 2 : v i X r a Under submission LEMUR: IN AUTOMATED PROGRAM VERIFICATION INTEGRATING LARGE LANGUAGE MODELS Haoze Wu Department of Computer Science Stanford University haozewu@stanford.edu Nina Narodytska VMware Research n.narodytska@gmail.com Clark Barrett Department of Computer Science Stanford University barrett@cs.stanford.edu ABSTRACT The demonstrated code-understanding capability of LLMs raises the question of whether they can be used for automated program verification, a task that often de- mands high-level abstract reasoning about program properties that is challenging for verification tools. We propose a general methodology to combine the power of LLMs and automated reasoners for automated program verification. We formally describe this methodology as a set of derivation rules and prove its soundness. We instantiate the calculus as a sound automated verification procedure, which led to practical improvements on a set of synthetic and competition benchmarks. 1 INTRODUCTION AI-powered language models are being routinely used to help developers with their tasks. Examples include program synthesis from natural language descriptions by GPT-4 (OpenAI, 2023) or Github Copilot (Chen et al., 2021; GitHub, 2021), solving competitive programming problems with Alpha- Code (Li et al., 2022), and repairing code by DeepRepair (White et al., 2019), among others. These models have shown impressive results in generating correct code in many programming languages. An important research question is whether modern AI models are capable of understanding the logic behind the programs they analyze. Recently, several approaches have been proposed to com- bine the strengths of formal verification and Large Language Models (LLMs) that demonstrate such capabilities. For example, Pei et al. (2023) made an important step in this direction by investigat- ing whether LLMs can generate program properties, namely, program invariants, which remains a crucial and challenging task for automated program verification (Clarke et al., 2018). The authors demonstrated that LLMs are effective in generating program invariants on a set of synthetic Java programs. Another example is the recent work by Charalambous et al. (2023), who demonstrated that LLM models can be used to repair vulnerabilities in code, given examples of incorrect behavior. They provided compelling evidence of the complementary strengths of LLMs, which serve as a gen- erator for code repair snippets, and formal techniques, which are used to check the correctness of the generated code. While previous work shows promise in program analysis tasks, they do not provide a formalization of the interaction between LLMs and formal verifiers; require manual efforts, or are limited to the invariant generation process as a stand-alone procedure. In this work, we propose a novel LLM-powered framework, LEMUR, for automated program verifi- cation tasks. Our key insight is to combine LLMs' ability to perform abstract high-level reasoning and automated reasoners' ability to perform precise low-level reasoning. Specifically, LLMs are em- ployed to propose program invariants in the form of sub-goals, which are then checked by automated reasoners. This transforms the program verification tasks into a series of deductive steps suggested by LLMs and subsequently validated by automated reasoners. Our main contributions are: • a novel framework to combine LLMs and automated reasoners for program verification; 1 Under submission • a presentation of LEMUR as a proof system and a proof of its soundness, which to the best of our knowledge, is the first formalization of such a hybrid approach; • an instantiation of the LEMUR calculus that gives a sound and terminating algorithm; • an implementation of the proposed framework (using OpenAI's GPT models) and several opti- mizations to enhance its practical efficiency; • an experimental evaluation of LEMUR on two sets of benchmarks that demonstrates its efficiency compared with both existing AI-powered and conventional verification tools. 2 DEFINITIONS Given a program P : Prog, a reachability property, or simply property, is a tuple p = ⟨φ, l⟩, where φ : Pred is a Boolean predicate of the program state and l : N is a program line. The negation of p, denoted ¬p, is defined as ⟨¬φ, l⟩. Next we introduce several useful definitions and their properties. Definition 2.1. A property p = ⟨φ, l⟩ is an invariant on P, denoted Inv(P, p), iff p holds (i.e., φ always evaluates to true at line l) for all possible executions of the program P. Example 2.1. Consider a simple program P on Figure 2 (the first frame, top row). P instantiates an unsigned 32-bit integer variable x to 0 and increases its value by 4 on each loop iteration. A property p = ⟨φ, l⟩ is specified on the 4th line, so φ = (x != 30) and l = 4 for this property. It is easy to see that p is an invariant as x is not divisible by 3, for example. ■ Next, we introduce a notion of assumption on a program P. An assumption q = ⟨φ, l⟩ is a property that is assumed in a program by altering a program behavior. Definition 2.2. An assumption q = ⟨φ, l⟩ is a property that modifies the program as follows 1. if φ holds at line l then the program P continues execution without changes; 2. if φ does not hold at line l then P terminates at l. We use P ′ = Asm(P, q) to denote a modification of P with the assumption q. An assumption can itself be an invariant. We now introduce a special notion of an implication. Definition 2.3. Let P be a program, and p, q be properties on P. We say that q implies p with respect to P, denoted q −→ P p, iff p is an invariant in Asm(P, q). Example 2.2. Consider the program P on Figure 2 and an assumption q = ⟨φ = (x%4==1), l = 3⟩ that modifies the original program P, giving P ′ = Asm(P, q). The first frame in the bottom row of Figure 2 depicts P ′. To see a difference between P and P ′, we observe that the loop is executed only once in P ′: x=0 when it enters the loop so (x%4)!=1, the φ is violated, and P ′ terminates. If we consider an alternative assumption q′ = ⟨φ = (x%2==0), l = 3⟩ The second frame at the top depicts P ′ for q′. We can see that its predicate φ holds for all executions. Hence, q′ is an invariant for the original program P. Finally, we can see q′ −→ P p, where p is from Example 2.1. ■ The following propositions follow from the definitions above. Proposition 2.1. Let P be a program, and p, q be properties on P: • The property p is an invariant on P if q is an invariant on P and q implies p with respect to P. More formally, (Inv(P, q) ∧ q −→ P p) ⇒ Inv(P, p). • The property p is not an invariant on P if the property p is not an invariant on P ′ = Asm(P, q). More formally, ¬Inv(P, q) ⇒ ¬Inv(P ′, p). Proposition 2.2. For any property p on a program P, p −→ P p. Proposition 2.3. For any properties p, q, r on a program P, p −→ P q and q −→ P r, then p −→ P r. Note that it is possible that neither a property p nor its negation ¬p holds on a program. Example 2.3. Consider again our example from Example 2.1 and two properties at line 3: p = ⟨φ = (x%8==4), l = 3⟩ and p′ = ⟨φ′ = (x%8!=4), l = 3⟩. Neither p nor p′ is an invariant in P. On the first loop iteration, we have that x=0 before line 3 so φ′ holds and φ does not at line 3. On the second loop iteration, we have that x=4 before line 3 so φ holds and φ′ does not. ■ 2 Under submission Definition 2.4. A property p = ⟨φ, l⟩ is stable for P, denoted S(P, p), if, for each execution of the program, either φ always evaluates to true at line l or φ always evaluates to false at line l. An invariant must be stable, but a property that is not an invariant might still be stable. For example, any property on a program without loops is stable. If a p is stable, then ¬p is also stable. Lemma 2.1. Consider a program P, two properties p, q on P, and a program P ′ = Asm(P, q). The property p is an invariant on P, if 1) q is stable for P; 2) q implies p with respect to P; and 3) ¬q implies p with respect to P. More formally: S(P, q) ∧ (q −→ P p) ∧ (¬q −→ P p) ⇒ Inv(P, p). Proof. In App. B. Assume we have a verifier V : Prog ×P(Prop) × Prop (cid:55)→ {TRUE, FALSE, UNKNOWN}, which takes as inputs a program P, a set of assumptions A and a property p, and checks whether A implies p. More precisely, given set of assumption A = {q1, . . . , qn} we construct a new program P ′ = Asm(Asm((. . . , Asm(P, q1)), qn−1), qn) and the verifier checks if p is an invariant in this program. Hence, a statement that A implies p on P means that p is an invariant in P ′. V is sound, meaning if V returns TRUE, then A implies p, and if V returns FALSE, then A does not imply p. Note that A can be empty, in which case the verifier essentially checks whether p is an invariant in general. When the verifier V returns TRUE, we say p is proven; and when V returns FALSE, we say the property is falsified. V is incomplete, meaning that V can return UNKNOWN. In practice, V is instantiated as automated program verifiers such as CBMC (Kroening & Tautschnig, 2014), ESBMC (Gadelha et al., 2018), and UAUTOMIZER (Heizmann et al., 2013). We provide an overview of the main techniques that these tools employ in Section A and note here that a crucial challenge shared across existing verifiers is the automatic decomposition of a verification task into smaller, more manageable sub-tasks. This decomposition requires high-level reasoning that is difficult to automate using conventional formal methods, but plausible to be performed by LLMs, with their documented code-understanding capability. However, we must ensure soundness when LLMs are used to automatically perform this high-level reasoning in program verification tasks. 3 LEMUR: INTEGRATING LLMS IN PROGRAM VERIFICATION We present a proof system LEMUR that combines LLMs and automated reasoners for proving a property on a program. The calculus operates over a configuration, which is either one of the dis- tinguished symbols {SUCCESS, FAIL} or a tuple ⟨P, A, M⟩, where P is a program, A is either ∅ or a singleton representing the assumption, and M is a list of properties referred to as proof goals. M itself is referred to as a trail. The last element of M represents the current property to prove. The rules describe the conditions under which a certain configuration can transform into another configuration. In this calculus, verifying whether Inv(P, p) holds, boils down to finding a sequence of valid rule applications from the starting configuration ⟨P, ∅, [p]⟩ to either SUCCESS or FAIL. Our calculus performs oracle calls to LLMs to propose new properties and revise them. The oracle Opropose proposes new properties for a given program and the current proof goal as inputs. Namely, Opropose : Prog × Prop (cid:55)→ P(Prop). An important insight here is that LLMs are capable of gener- ating new properties that are likely to 1) be invariants, and 2) imply the proof goal given a prompt. We will discuss strategies to generate prompts in Section 4. Importantly, properties generated by an LLM are treated as assumptions until we can prove that they are invariants of the original program. The oracle Orepair revises previously proposed properties. e.g. if we determine that a property q previously produced by Opropose does not hold or does not imply the current proof goal. In this case, we request an LLM to repair q. We have Orepair : Prog × Prop × Prop ×{FALSE, UNKNOWN} (cid:55)→ P(Prop), whose inputs comprise a program, two properties, and a solver return value. The first property is our current proof goal, and the second property q is usually an assumption previously proposed by oracles. The output of Orepair is a new set of properties. In practice, we implement it with a prompt to an LLM to either correct or strengthen q (see Section 4). Finally, the calculus performs an external call to a verifier V to check whether a property holds. The proof rules of LEMUR are shown in Fig. 1. Each rule defines a set of preconditions that specify the configurations where it can be applied. Note again that our preconditions permit invocations of LLMs and/or verifiers. The rules within the calculus can be partitioned into four groups. 3 Under submission M = M′ : : p V(P, A, p) = UNKNOWN q ∈ Opropose(P, p) P, A, M =⇒ P, {q}, M (Propose) A = {q} M = M′ : : p V(P, A, p) = TRUE P, A, M =⇒ P, ∅, M : : q (Decide) M = M′ : : p : : q V(P, A, q) ̸= TRUE q′ ∈ Opropose(P, p) P, A, M =⇒ P, {q′}, M′ : : p (Backtrack) A = {q} M = M′ : : p V(P, A, p) = UNKNOWN q′ ∈ Orepair(P, p, q, UNKNOWN) P, A, M =⇒ P, {q′}, M′ : : p (Repair 1) A = ∅ M = M′ : : p : : q V(P, A, q) = FALSE q′ ∈ Orepair(P, p, q, FALSE) P, A, M =⇒ P, {q′}, M′ : : p (Repair 2) A = ∅ M = M′ : : p V(P, A, p) = TRUE P, A, M =⇒ SUCCESS (Success 1) A = ∅ M = M′ : : p : : q S(P, q) V(P, {¬q}, p) = TRUE P, A, M =⇒ SUCCESS (Success 2) M = [p] V(P, A, p) = FALSE P, A, M =⇒ FAIL (Fail) Figure 1: Deductive rules of the LEMUR calculus. The first group contains rules that are responsible for generating new proof goals given specific configurations. These rules are Propose, Repair 1, and Repair 2. The Propose rule states that if the verifier is unable to prove or disprove the current proof goal p, we could invoke the oracle Opropose to obtain a property q, and update A to be {q}. It is also possible to modify the proposed property produced by Opropose. The Repair 1 rule can be applied when the current assumption q is not sufficient for the verifier to prove the current proof goal p. In this case, we could use the oracle Orepair to propose ways to strengthen q and choose one of them, q', as the new assumption. On the other hand, the Repair 2 rule can be applied when q is already in the trail but is falsified by the verifier V. In this case, we could use Orepair to repair q and update A accordingly. The second group specifies how LEMUR makes progress in the proof. The Decide rule specifies that the condition under which the assumption q can be made the new proof goal (i.e., being appended to M)-when the verifier V is able to prove that q implies the current proof goal. The third group defines how LEMUR can recover from faulty assumptions. In particular, the Back- track rule allows us to revert to the previous proof goal (the second to the last property in the trail M) and pick a different assumption suggested by Opropose, if there are at least two elements in the trail and the verifier cannot prove the current proof goal. Note that Backtrack might not be the only applicable rule in this case. For example, Repair 1 is also applicable. In practice, we need a strategy to decide between multiple applicable rules. This discussion is deferred to Sec. 4. The final group specifies three termination conditions that can be either SUCCESS or FAIL. The Success 1 rule states that whenever the assumption is empty and the verifier is able to prove the current proof goal (i.e., the last property p in the trail M), we can transition into the SUCCESS state. If the verifier can directly prove the original property, then the rule can be directly applied to the starting configuration to reach SUCCESS. Otherwise, p would come from the oracles and is different from the original property. Success 2 states that if the last two elements of the trail M are p, and q, the current proof goal q := ⟨φ, l⟩ is stable (as defined in Sec. 2), and the verifier is also able to also prove p under the assumption of ⟨¬φ, l⟩, then p is an invariant and we can transition to SUCCESS. The Success 2 rule constitutes a way to utilize an incorrect sub-goal q proposed by the LLM-based oracles to decompose the verification task: we separately reason about the cases when q holds and when it does not hold. Finally, if the verifier V proves that the original property is not an invariant, whether under an assumption or not, then we transition to the FAIL state using Fail. Note that the program P remains unchanged throughout the transitions. We keep it as part of the state for two reasons. First, P is an input to the verifiers and the oracles. Second, in the future, it 4 Under submission V: UNKNOWN uint32_t x=0; while (rand()){ x+=4; assert(x!=30); } Opropose Propose O p r o p P s e o p o o e r s ... x+=4; assert(x!=30); ... List invariants that prove the assertion. Your answer should look like assert(...) //Line number ------------------------ assert(x % 2 == 0); //Line 2 assert(x % 4 == 1); //Line 2 V: UNKNOWN V: TRUE uint32_t x=0; while (rand()){ assume(x%2==0); x+=4; assert(x!=30); } Orepair Rep. 1 uint32_t x=0; while (rand()){ assume(x%4==0); x+=4; assert(x!=30); } Decide V: TRUE uint32_t x=0; while (rand()){ assert(x%4==0); x+=4; } Succ. 1 V: TRUE uint32_t x=0; while (rand()){ assume(x%4==1); x+=4; assert(x!=30); } Decide V: FALSE uint32_t x=0; while (rand()){ assert(x%4==1); x+=4; } Opropose Backtrack V: TRUE uint32_t x=0; while (rand()){ assume(x%4==0); x+=4; assert(x!=30); } ... Figure 2: A running example of executing the LEMUR calculus. might be possible to augment the proof system to update P, by, for example, rewriting the program using LLMs in an invariant-preserving manner. We state the following soundness properties about LEMUR. The proof is presented in App. C.1. Theorem 3.1 (Soundness). Given a property p and a program P, if SUCCESS is reached by a sequence of valid rule applications starting from ⟨P, ∅, [p0]⟩, then p0 is an invariant on P. Theorem 3.2 (Soundness 2). Given a property p and a program P, if FAIL is reached by a sequence of valid rule applications starting from ⟨P, ∅, [p0]⟩, then p0 is not an invariant on P. Example 3.1. To provide more intuition about the proof system and to motivate the design choices when instantiating LEMUR, we consider again our running example. Figure 2 illustrates how LEMUR can be used to verify properties in practice. In Figure 2 each frame represents a state of the program. Transitions between states are depicted by arrows, with each arrow marked with the rule applied to execute this transition. In this example, our goal is to prove the property x!=30 in a while loop that keeps adding 4 to an unsigned 32-bit integer variable x. We note that this partic- ular verification task is adapted from a similar one in the SV-COMP competition.1 While seemingly trivial, during the competition, 19 out of the 24 participating tools (including the overall winner of the competition UAUTOMIZER) were not able to solve this benchmark. Given such a verification problem, we create an initial configuration ⟨P, ∅, [p])⟩ where P is the given problem and p = ⟨x!=30, 3⟩.2 Suppose the verifier V is unable to solve this problem and returns UNKNOWN. In this case, we need to generate a new proof goal, so the only rule we could apply is Propose. To do so, we invoke the LLM-based oracle Opropose to obtain a set of new properties that are potentially themselves invariants and might help prove the property. An example prompt is given on the left bottom part. This is not the exact prompt that we found the most effective in practice and we defer the discussion of prompting strategies to Sec. 4. Suppose the oracle returns two potential predicates at the beginning of the while loop: x%2==0 and x%4==1 at line 3. The Propose allows us to make one of them the current assumption. Case (x%2==0): The top row illustrates what happens when we transition into ⟨P, {q = ⟨x%2==0, 2⟩}, [p]⟩. While q is indeed an invariant, it does not help to prove the assertion and V would return UNKNOWN. This satisfies the condition to apply the Repair 1 rule, which would invoke the oracle Orepair to strengthen q. Suppose in this case, the oracle suggests the predicate q′ = x%4==0, which clearly implies the original property x!=30. Suppose then V(P, {q′}, p) returns TRUE. We could apply the Decide rule and transition to ⟨P, ∅, [p, q′]⟩, making q' the cur- rent proof goal. Proving q' is arguably easier because x%4==0 is inductive (i.e., if it holds in one iteration and then it will hold in the next iteration), making conventional automated reasoning tech- niques such as k-induction applicable. Suppose V(P, ∅, q′) = TRUE, we could apply Success 1 and transition into the SUCCESS state, thus completing the proof. 1https://sv-comp.sosy-lab.org/2023/results/results-verified/META_ ReachSafety.table.html#/table?filter=id_any(value(jain_5-2)) 23 is the line number (in the snippet) where the predicate is asserted. 5 Under submission Case (x%4==1): The bottom row illustrates a different chain of rule applications when we picked the property r = ⟨x%4==1, 2⟩ from the first proposal. While r does not hold, it does imply x!=30. Sup- pose this implication is proven by the verifier. We could apply Decide and transition to ⟨P, ∅, [p, r]⟩. Since r is not an invariant, V(P, ∅, r) would be either UNKNOWN or FALSE. Either way, we could apply Backtrack and try a new assumption proposed by Opropose. In practice, we could either invoke the stochastic Opropose again or pick an un-attempted property (e.g., ⟨x%2==0, 2⟩ proposed previ- ously). In the illustration, we invoke Opropose again and obtain the "correct" predicate x%4==0, which would allow us to prove the property in two more steps. ■ 4 INSTANTIATING THE LEMUR CALCULUS In this section, we present strategies to instantiate LEMUR as an automated decision procedure. While we showed that LEMUR calculus is a sound procedure, there are no guarantees that it termi- nates. Here, we will discuss two sources of non-termination in this calculus. The first one corresponds to unbounded suggestions of new sub-goals to prove the current proof goal. Concretely, when trying to prove a particular proof goal p, we could get stuck if V(P, {q}, p) = UNKNOWN or V(P, ∅, q) = FALSE for each proposed assumption q. This could be due to limita- tions in either the LLM or the verifier. One way to avoid this type of non-termination is by putting an upper bound on the number of proposed assumptions to prove each proof goal. That is, for any proof goal p, we require that V(P, {q}, p) is invoked for at most k different q's. The second source of non-termination corresponds to an unbounded depth of the trail M. Con- cretely, it is possible to construct an infinite sequence of Propose and Decide where 1) the verifier returns UNKNOWN on the current proof goal; 2) the oracle proposes an assumption that is not in- variant but implies the current proof goal; 3) the verifier proves the implication; 4) the assumption becomes the new proof goal; and 5) repeat. This case can be avoided by adding a side condition to the rules that the property proposed by the oracles (q = ⟨ψ, l′⟩) must be at a smaller program line than the current proof goal (p = ⟨φ, l⟩), that is, ⟨ψ, l′⟩ ∈ O∗(P, ⟨φ, l⟩, . . .) ⇒ l′ < l (Condition 1) Based on the strategy described above, a terminating (by Thm. 4.1 at the end of this section) and sound (by Thm. 3.1) algorithm for checking whether a property p is an invariant on a program P is presented in Alg. 1. Alg. 1 is a recursive procedure lemur check. It takes a program P and a property p as inputs. If lemur check returns SUCCESS, then the property is an invariant. If lemur check returns FAIL, then the property is not an invariant. The function can also return UNKNOWN, if the analysis is inconclusive. At the high level, Alg. 1 searches for a potential subgoal q that implies the current goal p (lines 9–21). If such q is identified in line 13, we recurse to prove q (line 16). The while loop starting at line 10 ensures that at most k attempts can be utilized to generate a new subgoal for p. See a full description of Alg 1 in Appendix D. The comments in Alg. 1 show which rule is applied at the lines. The algorithm is sound as it only applies the rules of the calculus. We prove that the algorithm terminates in Appendix D. Theorem 4.1 (Termination). Given a program P, and a property p on the program, Alg. 1 terminates with either SUCCESS, FAIL, or UNKNOWN. 5 EXPERIMENTS We have presented the LEMUR calculus and described a sound and terminating algorithm based on LEMUR. In this section, we investigate the following question: • Can we develop a practical automated verification procedure based on Alg 1? [Yes] • Is LEMUR competitive with existing end-to-end learning-based verification approaches? [Yes] • Can LEMUR already prove hard benchmarks that are beyond the reach of state-of-the-art conven- tional program verifiers? [In several cases] 6 Under submission i, Q (cid:55)→ 0, Opropose(P, p) while i < k ∧ |Q| > 0 do Algorithm 1 The LEMUR procedure 1: Input: A program P, a property p. 2: Output: SUCCESS only if Inv(P, p); FAIL only if ¬Inv(P, p); and UNKNOWN if inconclusive. 3: Parameters: Verifier V, oracles Opropose and Orepair (which satisfy Condition 1), number of proposals k 4: function lemur check(P, p) d (cid:55)→ V(P, ∅, p) 5: if d = FALSE then return FAIL 6: else if d = TRUE then return SUCCESS 7: else 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: f (cid:55)→ lemur check(P, q) if f = SUCCESS then return SUCCESS else if S(P, q) ∧ (V(P, {¬q}, p) = TRUE) then return SUCCESS else if f = FAIL then Q (cid:55)→ join(Q, Orepair(P, p, q, FALSE)) else continue i (cid:55)→ i + 1 q (cid:55)→ pop(Q) e (cid:55)→ V(P, {q}, p) if e = FALSE then return FAIL else if e = TRUE then else Q (cid:55)→ join(Q, Orepair(P, p, q, UNKNOWN)) return UNKNOWN ▷ Decide ▷ Success 1 ▷ Success 2 ▷ Repair 2 ▷ Propose/Backtrack ▷ Fail ▷ Fail ▷ Success 1 ▷ Repair 1 5.1 BUILDING AN LLM-BASED PROGRAM VERIFIER We report the practical considerations when building a prototype of Alg. 1. There are two types of external calls that Alg. 1 depends on. The first type is calls to V. We use off-the-shelf verifiers in our framework that are extensively tested by the community (described in later paragraphs), so we have some expectations about their performance. However, the main source of uncertainty in building LEMUR comes from interaction with the second type of calls, calls to LLM oracles, as we treat them as black boxes. In our framework, the oracles Opropose and Orepair automatically prompt a GPT-family model through the OpenAI API and parse its outputs. We use GPT-4 by default. We found that while GPT has great potential in generating sensible loop invariants, it still has practical limitations. We report several tactics that we found useful in practice. • Formatting the output: We initially investigated whether the popular chain-of-thought (CoT) reasoning (Wei et al., 2022) can be useful to discover new properties given P and p. We found that GPT's outputs were verbose and often contained irrelevant/incorrect statements, even in cases where useful invariants were contained in the outputs. This behavior increases the cost and makes it difficult to extract invariants from the output. To address these issues, we used in- context learning to format the output of GPT. For example, adding Your output should be "assert(...);// Line number" to the prompt is sufficient for GPT to consistently generate outputs of exactly this format, without providing verbose explanations. • Inserting markers to the program: We found that the current versions of GPT are not good at counting program lines. In many cases, the predicate generated by GPT is "correct" but the line number is off by a small margin. This is highly undesirable as an invariant at a wrong position is of no use to the verifier. To mitigate this challenge, we inserted placeholder lines of the form "// Line A", "// Line B" to the program and prompted GPT to generate invariants of the form assert(...);// Line name (for those specific locations). As a simple practical heuristics, we insert placeholders to right before the loop and the beginning of the loop. • Ordering the proposal: The output of an oracle call is non-deterministic for a given prompt, depending on the hyper-parameters of the call. Moreover, the oracles produce a set of properties and we need good heuristics to choose the order of trying those properties. A heuristic we found practically useful is to prompt GPT multiple times and order the properties by the frequency they are proposed (breaking ties by preferring shorter expressions). Moreover, instead of relying on string matching, we treat two proposals the same if their abstract syntax trees are equivalent. 7 Under submission Configurations Solved Time # proposal Configurations Solved Time # proposals Code2Inv ESBMC LEMUR 92 68 107 – 0.34 24.9 > 20 0 4.7 UAUTOMIZER ESBMC LEMUR 0 0 26 – – 140.7 0 0 9.1 (a) The Code2Inv benchmarks. (b) The 50 SV-COMP benchmarks. Table 1: Solved instances by ESBMC, LEMUR, and Code2Inv (1a) or UAUTOMIZER (1b) on two benchmark sets. We also report the average time and number of proposals on solved instances. The exact prompts are described in Appendix F. We consider two state-of-the-art C program formal analyzers for V, ESBMC (Gadelha et al., 2018) and UAUTOMIZER (Heizmann et al., 2013). The former is based on K-induction and the latter is based on predicate-abstraction. In particular, ESBMC and UAUTOMIZER are the top two performing non-portfolio solvers in the reachability track of the SV-COMP (Beyer, 2023). And UAUTOMIZER is the overall winner of the competition. By default, we impose a 30-second time limit for each invocation of the verifier. That is, if the verifier does not terminate within 30 seconds, then the verifier returns UNKNOWN. The total cost incurred by using the OpenAI API services for the experiments (including testing phases) is $1000. We will release the source code and the benchmarks for the community to make further improvements. 5.2 LOOP INVARIANT GENERATION BENCHMARKS A prominent approach in learning-based end-to-end program verification is Code2Inv, which uses reinforcement learning to train an invariant synthesizer to propose loop invariants. In this section, we study how LEMUR compares with this approach. The Code2Inv (Si et al., 2020) benchmark set contains 133 benchmarks, each containing a C program and a property expressed as an assert statement in the program. Each program contains a single loop and each loop can have nested if- then-else blocks (without nested loops). Programs in the benchmark may also have uninterpreted functions (emulating external function calls) in branches or loop termination conditions. The asser- tion to check is always after the loop. As reported in the original Code2Inv paper, these problems can be efficiently solved using state-of-the-art invariant synthesis solvers and the goal was to eval- uate the ability of Code2Inv to generate a real invariant that implies the property at the beginning of the loop. To have a fair comparison, we prompt the oracles to generate invariants in the same location as Code2Inv in Alg. 1. We use the k-induction-based verifier, ESBMC, to check the implication (line 13 in Alg. 1) which aligns with the verification procedure used in Code2Inv. We report the number of solved instances as well as the number of failed suggestions (either itself cannot be verified or ESBMC times out on the implication check). As a point of comparison, we report those statistics from the original Code2Inv approach, which combines graph and recurrent neural networks to model the program graph and learn from counterexamples. Code2Inv was given a one-hour timeout. In addition, we also report ESBMC's performance on this set of benchmarks. The result is shown in Table 1a. With a 10-minute timeout, ESBMC alone can solve 68 problems. On the other hand, LEMUR can solve 107 problems within the same time limit. Surprisingly, this approach solves more instances than Code2Inv, which is specifically designed for invariant synthesis tasks. Moreover, LEMUR is able to find the correct loop invariant with on average 4.7 attempts, while it takes Code2Inv on average > 20 attempts to do so. For problems unsolved by ESBMC but solved by LEMUR, a histogram of the values of Log2 of the num- ber of proposals is shown in Fig. 3. While in most cases, Alg. 1 can propose the correct proposals within 4 attempts, there are still benchmarks that take LEMUR many rounds of proposal and repair to find the desired loop invariant, e.g. one of the benchmarks took 177 proposals. 8 Figure 3: Number of pro- posals for LEMUR to solve a benchmark. Under submission 5.3 SOLVING HARD SV-COMP BENCHMARKS Next, we study LEMUR's ability to solve hard benchmarks from the Software-Verification Compe- tition 2023 (Beyer, 2023). Due to budget limitations, we focus on benchmarks with less than 150 tokens (after removing comments, unnecessary headers, and clang-formatting). We select 50 bench- marks that ESBMC and UAUTOMIZER are unable to solve within 20 minutes and evaluate LEMUR on them with the same timeout. The property is expected to hold in all benchmarks. These benchmarks are considerably more challenging than the Code2Inv programs. While the latter has one loop and follows a strict format, the SV-COMP benchmark presents a more diverse set of benchmarks, with multiple loops present in many programs. The results are shown in Table 1b. Impressively, with the guidance of the proof goals suggested by the LLM, LEMUR is able to solve 26 of the 50 SV-COMP benchmarks. While neither ESBMC nor UAUTOMIZER can solve a single benchmark alone. Upon closer examination, 6 of the solved instances contain 2 loops, 3 contain 3 loops, and 3 contain 4 or more loops. To our knowledge, this is the first time a learning-based verification approach 1) can handle programs with more than one loop; and 2) boosts the performance of state-of-the-art conventional C program verifiers. The average number of proposals before solving a problem is higher compared to the Code2Inv benchmarks (9.1 vs. 4.7). Fig. 4 sheds more light on the behavior of LEMUR. In particular, 16 of the 26 solved instances require more than 6 proposals in total. We found that the LLM-based oracles can produce surprisingly in- sightful loop invariants that are difficult for conventional formal methods to synthesize. While predicate-abstraction-based tech- niques typically generate predicates that involve only the operators and values in the program and follow a particular template, LLM is not constrained by these limitations. For example, for the program in Fig. 2, GPT-4 can consistently generate x%4==0 as the loop in- variant although the modulo operator is not present in the program. Appendix. F.1 shows an example where LLM understands the range of unsigned char as the key to proving the given property and suggests variable bounds as the assumption. There are also several cases where the LLM generates disjunctive invariants that precisely characterize the behavior of the loops. Figure 4: Number of pro- posals for LEMUR to solve a benchmark. 6 DISCUSSION OF LIMITATIONS AND EXTENSIONS In this work, we proposed a novel framework, LEMUR, that combines automated reasoning and LLMs. To the best of our knowledge, LEMUR is the first framework that provides a theoretical foundation for such integration, i.e., a formal calculus, and practical algorithmic instantiation of the calculus. We also implemented LEMUR as a fully automated framework and demonstrated its efficiency on standard benchmark sets. We conclude by discussing the current limitations of LEMUR, which point to future research directions to extend the framework. As we mentioned above, the practical performance of LEMUR depends on two types of external calls: the verifiers and the LLMs. Any improvements in these tools should translate into LEMUR improvements. Currently, modern verifiers are capable of handling relatively small programs (see SV-COMP'23 (Beyer, 2023)). Interestingly, even when provided with a strong invariant, they some- times cannot solve the verification problem. One research direction that we envision is to customize LEMUR to a particular backend verifier to obtain better performance and solve larger programs. While our experience with LLMs was largely positive (see Section 5.1 for a discussion on the limi- tations we have successfully overcome), there are more interesting challenges to tackle. First, LLMs can take a limited number of tokens as inputs, and many practical programs exceed that limit. Sec- ond, it is sometimes challenging for LLMs to generate more complex logical formula such as nested if-then-else properties. We believe that to overcome this limitation we need to 1) develop a prompt- ing language for invariant generation with LLMs, and 2) fine-tune LLMs for invariant generation tasks using this language. 9 Under submission Finally, due to the limitations of LLMs and automated reasoners, our hybrid framework is not yet able to offer a significant leap in automatically verifying complex properties on real-world C li- braries. However, a modular approach, where large parts of the program are abstracted and summa- rized in the form of pre- and post-conditions, can benefit from frameworks like LEMUR. 10 Under submission REFERENCES Dirk Beyer. Competition on software verification and witness validation: Sv-comp 2023. In Sriram Sankaranarayanan and Natasha Sharygina (eds.), Tools and Algorithms for the Construction and Analysis of Systems, pp. 495–522, Cham, 2023. Springer Nature Switzerland. ISBN 978-3-031- 30820-8. Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhari- wal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agar- wal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neu- ral Information Processing Systems, volume 33, pp. 1877–1901. Curran Associates, Inc., URL https://proceedings.neurips.cc/paper_files/paper/2020/ 2020. file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf. Yiannis Charalambous, Norbert Tihanyi, Ridhi Jain, Youcheng Sun, Mohamed Amine Ferrag, and Lucas C. Cordeiro. A new era in software security: Towards self-healing software via large language models and formal verification, 2023. Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Pond ́e de Oliveira Pinto, Jared Kaplan, Harrison Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavar- ian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plap- pert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Joshua Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Pe- ter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code. CoRR, abs/2107.03374, 2021. URL https://arxiv.org/abs/2107.03374. Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Lev- skaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Bren- nan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. Palm: Scaling language modeling with pathways, 2022. Edmund M Clarke, Thomas A Henzinger, Helmut Veith, Roderick Bloem, et al. Handbook of model checking, volume 10. Springer, 2018. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. In Jill Burstein, Christy Doran, and Thamar Solorio (eds.), Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pp. 4171– 4186. Association for Computational Linguistics, 2019. doi: 10.18653/v1/n19-1423. URL https://doi.org/10.18653/v1/n19-1423. 11 Under submission Emily First, Markus N. Rabe, Talia Ringer, and Yuriy Brun. Baldur: Whole-proof generation and repair with large language models. CoRR, abs/2303.04910, 2023. doi: 10.48550/arXiv.2303. 04910. URL https://doi.org/10.48550/arXiv.2303.04910. Mikhail R Gadelha, Felipe R Monteiro, Jeremy Morse, Lucas C Cordeiro, Bernd Fischer, and De- nis A Nicole. Esbmc 5.0: an industrial-strength c model checker. In Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering, pp. 888–891, 2018. Inc. GitHub. GitHub Copilot. https://copilot.github.com/, 2021. Accessed: September 2023. Matthias Heizmann, J ̈urgen Christ, Daniel Dietsch, Evren Ermis, Jochen Hoenicke, Markus Lin- denmann, Alexander Nutz, Christian Schilling, and Andreas Podelski. Ultimate automizer with smtinterpol: (competition contribution). In International Conference on Tools and Algorithms for the Construction and Analysis of Systems, pp. 641–643. Springer, 2013. Daniel Kroening and Michael Tautschnig. Cbmc–c bounded model checker: (competition contribu- tion). In Tools and Algorithms for the Construction and Analysis of Systems: 20th International Conference, TACAS 2014, Held as Part of the European Joint Conferences on Theory and Prac- tice of Software, ETAPS 2014, Grenoble, France, April 5-13, 2014. Proceedings 20, pp. 389–391. Springer, 2014. Aitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Imanol Schlag, Theo Gutman- Solv- In NeurIPS, 2022. http://papers.nips.cc/paper_files/paper/2022/hash/ Vinay V. Ramasesh, Ambrose Slone, Cem Anil, Solo, Yuhuai Wu, Behnam Neyshabur, Guy Gur-Ari, ing quantitative URL 18abbeef8cfe9203fdf9053c9c4fe191-Abstract-Conference.html. reasoning problems with language models. and Vedant Misra. Yujia Li, David Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, R ́e mi Leblond, Tom Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, Thomas Hubert, Peter Choy, Cyprien de Masson d'Autume, Igor Babuschkin, Xinyun Chen, Po-Sen Huang, Johannes Welbl, Sven Gowal, Alexey Cherepanov, James Molloy, Daniel J. Mankowitz, Esme Sutherland Robson, Push- meet Kohli, Nando de Freitas, Koray Kavukcuoglu, and Oriol Vinyals. Competition-level code generation with AlphaCode. Science, 378(6624):1092–1097, dec 2022. doi: 10.1126/science. abq1158. URL https://doi.org/10.1126%2Fscience.abq1158. OpenAI. Gpt-4 technical report, 2023. Kexin Pei, David Bieber, Kensen Shi, Charles Sutton, and Pengcheng Yin. Can large language models reason about program invariants? In Andreas Krause, Emma Brunskill, Kyunghyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett (eds.), Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pp. 27496–27520. PMLR, 23–29 Jul 2023. URL https://proceedings.mlr. press/v202/pei23a.html. Xujie Si, Aaditya Naik, Hanjun Dai, Mayur Naik, and Le Song. Code2inv: A deep learning frame- work for program verification. In Shuvendu K. Lahiri and Chao Wang (eds.), Computer Aided Verification - 32nd International Conference, CAV 2020, Los Angeles, CA, USA, July 21-24, 2020, Proceedings, Part II, volume 12225 of Lecture Notes in Computer Science, pp. 151–164. Springer, 2020. doi: 10.1007/978-3-030-53291-8\ 9. URL https://doi.org/10.1007/ 978-3-030-53291-8_9. Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Fei Xia, Ed Chi, Quoc V Le, Denny Zhou, et al. Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35:24824–24837, 2022. Martin White, Michele Tufano, Matias Martinez, Martin Monperrus, and Denys Poshyvanyk. Sort- ing and transforming program repair ingredients via deep learning code similarities. In 2019 IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER). IEEE, feb 2019. doi: 10.1109/saner.2019.8668043. URL https://doi.org/10.1109% 2Fsaner.2019.8668043. 12 Under submission A BACKGROUND Automated reasoning tools. We overview several popular techniques that are used by modern program verification solvers, like CBMC (Kroening & Tautschnig, 2014), ESBMC (Gadelha et al., 2018), and UAUTOMIZER (Heizmann et al., 2013). The Bounded Model Checking (BMC) approach is an iterative technique that verifies the program for each unwind bound up to a maximum value, m, e.g. It either finds a counterexample within m steps or returns UNKNOWN. This approach usually employs SMT solvers to find counterexamples very efficiently at each step. However, for non-trivial systems unrolling can be expensive and memory-consuming. Moreover, vanilla BMC can only check finite reachability, e.g. it cannot prove loop invariants, for example. it can perform m loop unwinding. Another popular technique is the k-induction method, which allows BMC-style methods to prove properties like loop invariants. This approach is also iterative. First, we check whether a property holds for k steps from a valid state. If it does not, we find a counterexample. Otherwise, we check an inductive hypothesis that if the property holds for k steps from a state then the property holds for the k + 1th step. If it does, the property holds for any number of steps. If not, k-induction either increases k or returns UNKNOWN. As in the case of BMC, unrolling can be computationally expensive. Moreover, k-induction is not complete; there are properties that are not k-inductive for any k. The last approach we consider is abstract interpretation verification methods. Such methods create abstract representations of program states and variables. These abstract representations are simpli- fied versions of the actual program states, focusing on relevant aspects while ignoring irrelevant details. The choice of abstraction depends on the specific properties to verify. Moreover, if a prop- erty holds for an abstract program, then it holds for the original program. The reverse is not true. Hence, if a property does not hold for an abstract program, we need to refine the abstract repre- sentation to exclude the counterexample. The main challenge here is how to come up with a good abstraction and how to design a refinement procedure. Large Language Models. Large Language Models belong to a class of artificial intelligence mod- els used in natural language processing tasks. These models are designed to process and gener- ate both human language and structured inputs, such as code in various programming languages. Examples of large language models include Generative Pre-trained Transformer models like GPT- 3 (Brown et al., 2020) or GPT-4 (OpenAI, 2023), Bidirectional Encoder Representations from Trans- formers, BERT (Devlin et al., 2019), and others. LLMs are getting increasingly popular as an AI- assistance for code generation tasks, like PaLM (Chowdhery et al., 2022), GitHub Copilot (Chen et al., 2021; GitHub, 2021), etc. LLMs are usually trained in two steps. The main phase is training, where these models are exposed to very large corpora of data, usually collected over the internet. The architecture of LLMs is based on transformers and has a very large number of parameters. Therefore, it can capture relations between different parts of the input text to produce coherent outputs. For some applications, we need to perform fine-tuning to expose the model to application-specific inputs. During inference, when a user provides inputs and a prompt that contains instructions to an LLM, it generates the output with respect to these instructions. B DEFINITIONS Lemma 2.1. Consider a program P, two properties p, q on P, and a program P ′ = Asm(P, q). The property p is an invariant on P, if 1) q is stable for P; 2) q implies p with respect to P; and 3) ¬q implies p with respect to P. More formally: S(P, q) ∧ (q −→ P p) ∧ (¬q −→ P p) ⇒ Inv(P, p). Proof. Let q = ⟨φ, l⟩. By the definition of stability, for any execution of P, either φ always evaluates to true at line l or ¬φ always evaluates to true at line l. In either case, the property p holds by the definition of implication. Therefore, p holds for all executions of P, i.e., Inv(P, p). 13 Under submission C LEMUR: INTEGRATING LLMS IN PROGRAM VERIFICATION C.1 SOUNDNESS OF LEMUR Lemma C.1. For any configuration ⟨P, A, M⟩ created by a sequence of valid rule applications starting from an initial configuration ⟨P, ∅, [p0]⟩, M is not empty. Proof. This can be proven by induction on the length of the sequence. In the base case, M is [p0]. In the inductive case, the length of M does not reduce except in the Backtrack rule which requires M to have at least 2 elements in the pre-condition. Thus, M is not empty. Lemma C.2. Let ⟨P, A, M⟩ be a configuration created by a sequence of valid rule applications starting from an initial configuration ⟨P, ∅, [p0]⟩, and let p be the last element of M. We have p −→ P p0. Proof. We prove a stronger property, that for each element p in M, p −→ p0. We induct on the P p0 by proposition 2.2. In the inductive case, we length of the sequence. In the base case, p0 −→ P proceed by cases. Success 1, Success 2, Fail cannot be applied. In the post conditions of Propose, Backtrack, Repair 1, and Repair 2, M either shrinks or remains the same. Therefore, the inductive hypothesis can be directly applied. If Decide rule is to be applied. In the pre-condition, the trail is p. In the post condition, M becomes M : : p : : q. M : : p, the current assumption is {q} and q −→ P By the inductive hypothesis, p −→ P p0. Furthermore, by Proposition 2.3, q −→ P p0. Lemma C.3. Let ⟨P, A, M : : p : : p′⟩ be a configuration created by a sequence of valid rule applications starting from an initial configuration ⟨P, ∅, [p0]⟩, we have p′ −→ P p. Proof. This can be proven by induction on the length of the sequence. Theorem 3.1. Given a property p and a program P, if SUCCESS is reached by a sequence of valid rule applications starting from ⟨P, ∅, [p0]⟩, then p0 is an invariant on P. Proof. We can transition into SUCCESS by either the Success 1 rule or the Success 2 rule. In the pre-condition of Success 1, the trail is of the form M : : p, and the verifier V proves that Inv (P, p0. Further by Proposition 2.1, we have Inv(P, p0). On the other hand, p). By Lemma C.2, p −→ P in the pre-condition of Success 2, the trail is of the form M : : p : : p′. By Lemma C.3, p′ −→ p. P In addition, p′ is stable and ¬p′ −→ P also know from Lemma C.2 that p −→ P P. p. Therefore, by Lemma 2.1, p is an invariant of P. Since we p0, it follows from Proposition 2.1 that p0 is an invariant of Theorem 3.2. Given a property p and a program P, if FAIL is reached by a sequence of valid rule applications starting from ⟨P, ∅, [p0]⟩, then p0 is not an invariant on P. Proof. We transition into the FAIL state only when the verifier V(P, A, p0) = FALSE. Even if A is not empty, p0 is still not an invariant by Prop. 2.1. D INSTANTIATING THE LEMUR CALCULUS Here, we describe Alg. 1. First, the algorithm checks whether the current p can be verified by V or if a counterexample exists (line 5). If so, it returns either SUCCESS or FAIL to the upper level of recursion or terminates if lemur check is at the top level. If V cannot prove p, i.e. it returns UNKNOWN, lemur check enters a new phase of subgoal generation, where LLM oracles are used to propose new or repair existing properties (lines 9–21). In this phase, we start by calling Opropose to generate a new subgoal (line 9). The while loop at line 10 ensures that at most k attempts can be unitized to generate a new subgoal for p. In line 13, we call V to check whether q implies 14 Under submission p. If V returns FALSE, we know that p is not an invariant and return FAIL (line 14). If V returns UNKNOWN, then we need to repair q; for example, we might strengthen q and try again to prove implication. Otherwise, if q does imply p, we recurse to prove q (line 16). The last logical block of lemur check in lines 17–20 addresses the output of the recursive call. If we have successfully proved that q is an invariant, we return SUCCESS. Otherwise, if q is stable (see Definition 2.4), we can check whether ¬q implies p (line 18). If so, by Lemma 2.1, we can conclude that p is an invariant and also return SUCCESS. If we prove that q is FALSE, we can repair q by informing an LLM oracle that the property does not hold (line 19). Finally, if f is UNKNOWN then we continue to the next iteration of the while loop and consider the next proposed sub-goal. Second, we present a proof of Theorem 4.1. Theorem 4.1. Given a program P, and a property p on the program, Alg. 1 terminates with either SUCCESS, FAIL, or UNKNOWN. Proof. Suppose p = ⟨φ, l⟩. We prove with a decreasing argument on l. When l = 0, the al- gorithm terminates without entering the while loop, because Opropose satisfies Condition 1 and Opropose(P, p) = ∅. In the recursive case, the while loop is executed for at most k iterations. In each iteration, we show that for the second input to lemur check (Line 16), q = ⟨ψ, l′⟩, we have l′ < l. This is true because q is generated either by Opropose(P, p) or Orepair(P, p, . . .), both satisfying Condition 1. E RELATED WORK There has been a lot of interest in using LLMs to augment formal reasoning. Charalambous et al. (2023) proposed a novel framework, ESBMC-AI, that integrated LLMs reasoning and formal verifi- cation. They also applied their framework to the analysis of C programs focusing on memory safety properties. The main idea is to use LLMs as a code repair generator that can fix faulty code using a carefully designed prompt, a program, and a counterexample provided by a bounded model checker. However, ESBMC-AI assumes that program rewriting done by an LLM is valid, i.e. syntactically and semantically correct. The latter is challenging to prove in an automatic manner as it requires pro- gram equivalence checking. Our framework does not use LLMs to modify code and treat the outputs of the LLM as suggestions until we prove that they are correct. Another example of an automated framework is Baldur (First et al., 2023), which uses an LLM, Minerva (Lewkowycz et al., 2022), to generate theorem proofs that are checked by Isabelle theorem prover. They also proposed a proof repair procedure. In contrast, our interactive decision procedure relies on an automated reasoner to generate proofs and only uses LLMs generated program properties. The most related work to our framework is Code2Inv (Si et al., 2020), which proposed learning program invariants using machine learning techniques and employed automatic reasoning to verify the programs. The main principle of partitioning responsibilities between automated reasoners and LLMs is similar to our framework. However, we provide a formalization for such interactive proce- dures with formal calculus and a strategy to use it in practice. Our procedure is more general as it allows the generation of sequences of logically related properties, and we demonstrate that it is more efficient in practice. Finally, recent work by Pei et al. (2023) investigates the potential of invariant generation for Java programming language. While this framework does not incorporate automated reasoning components, it shows the potential of LLMs to uncover program properties. F PROMPTING THE GPT In this section, we describe how we automatically constructed the prompts in Opropose and Orepair, and show examples of the prompts and the GPT outputs. We provided in the supplementary materials the execution traces of LEMUR on solved benchmarks used in our experiments. F.1 PROPOSING NEW PROPERTIES Given a program P and a property represented as a C assert statement in P, we inserted the place- holder lines "// Line A", "// Line B"... to dedicated program lines as described in 5.1. Our prompt has the following structure: 15 Under submission --------- [P1] Print [P2] as valid C assertions at line[P3] [P4] that help prove the assertion. Use '&&' or '||' if necessary. Don't explain. Your answer should be 'assert(...); // line [P5]' --------- P1 is the program with the placeholder lines and the C assertion; P2 is either facts or loop invariants depending on whether all the placeholder lines are in loops; P3 is either empty or s depending on the number of placeholder lines; P4 are the placeholder line names (e.g., A, B); and P5 is either A, if there is only one placeholder line, or name, if there are multiple. Below is an example extracted from the execution of our prototype on an SV-COMP benchmark: int main() { unsigned char n = (unsigned char) rand(); if (n == 0) { return 0; } unsigned char v = 0; unsigned int s = 0; unsigned int i = 0; while (i < n) { // Line A v = (unsigned char) rand(); s += v; ++i; } assert(s >= v); return 1; } Print loop invariants as valid C assertions at line A that help prove the assertion. Use '&&' or '||' if necessary. Don't explain. Your answer should be 'assert(...); // line A' Below are GPT-4's responses on multiple attempts as well as the final set of extracted properties our prototype proceeds to prove. GPT output 1 with penalty 1.5: assert(i <= n); // line A assert(s >= i); // line A GPT output 2 with penalty 1.5: assert(i <= n); // line A assert(s >= 0 && v >= 0); // line A GPT output 3 with penalty 1.5: assert(i <= n); // line A assert(s >= 0 && s <= i*UCHAR_MAX); // line A GPT output 4 with penalty 1.5: assert(i <= n); // line A assert(s >= 0 && s <= i*UCHAR_MAX); // line A GPT output 1 with penalty 2: assert(i <= n); // line A assert(s >= 0 && s <= UCHAR_MAX * i); // line A GPT output 2 with penalty 2: assert(i <= n); // line A assert(s >= i*v && s <= (i*255)); // line A GPT output 3 with penalty 2: assert(i <= n); // line A assert(s >= 0 && s <= i*UCHAR_MAX); // line A GPT output 4 with penalty 2: 16 Under submission assert(i <= n); // line A assert(s >= 0 && s <= UCHAR_MAX * i); // line A Found 6 potential sub-goals Goal 1: i <= n after line 8 Goal 2: s >= 0 && s <= i*0xff after line 8 Goal 3: s >= 0 && s <= 0xff * i after line 8 Goal 4: s >= i after line 8 Goal 5: s >= 0 && v >= 0 after line 8 Goal 6: s >= i*v && s <= (i*255) after line 8 F.2 REPAIRING A PREVIOUS PROPOSAL The oracle Orepair uses a similar prompting template: --------- [P1] Print [P2] as valid C assertions at line A that help prove the assertion. Your previous answer [P3] is [P4]. Use '&&' or '||' if necessary. Don't explain. Your answer should be 'assert(...);' --------- P1 is the program with the placeholder line (corresponding to the assumption p = ⟨φ, l⟩ to repair) and the C assertion; P2 is either facts or loop invariants depending on whether p is in a loop; P3 is p; P4 is either incorrect or too weak. Below is an example extracted from the execution of our prototype on another SV-COMP bench- mark: int main() { unsigned int n = (unsigned int) rand(); unsigned int x = n, y = 0, z; while (x > 0) { x--; y++; } z = y; // Line A while (z > 0) { x++; z--; } assert(y + z == n); return 1; } Print facts as valid C assertions at line A that help prove the assertion. Your previous answer 'x + z == n' is too weak. Use '&&' or '||' if necessary. Don't explain. Your answer should simply be 'assert(...);' The GPT outputs on different prompting attempts with different penalties and the extracted proper- ties: GPT output 1 with penalty 1.5: assert(x + y == n); // Line A assert(x + z == y); // Line B GPT output 2 with penalty 1.5: assert(x + y == n); // Line A assert(x + z == n); // Line B 17 Under submission GPT output 1 with penalty 2: assert(x + y == n); // Line A assert(x + z == n); // Line B GPT output 2 with penalty 2: assert(x + y == n); // Line A assert(z + x == n); // Line B Found 4 potential adapted sub-goals Goal 1: x + y == n after line 7 Goal 2: x + z == n after line 7 Goal 3: x + z == y after line 7 Goal 4: z + x == n after line 7 18
http://arxiv.org/abs/2310.04867v1
"2023-10-07T16:27:00"
"2023-10-07T16:27:00"
Randomized Sparse Neural Galerkin Schemes for Solving Evolution Equations with Deep Networks
Training neural networks sequentially in time to approximate solution fields of time-dependent partial differential equations can be beneficial for preserving causality and other physics properties; however, the sequential-in-time training is numerically challenging because training errors quickly accumulate and amplify over time. This work introduces Neural Galerkin schemes that update randomized sparse subsets of network parameters at each time step. The randomization avoids overfitting locally in time and so helps prevent the error from accumulating quickly over the sequential-in-time training, which is motivated by dropout that addresses a similar issue of overfitting due to neuron co-adaptation. The sparsity of the update reduces the computational costs of training without losing expressiveness because many of the network parameters are redundant locally at each time step. In numerical experiments with a wide range of evolution equations, the proposed scheme with randomized sparse updates is up to two orders of magnitude more accurate at a fixed computational budget and up to two orders of magnitude faster at a fixed accuracy than schemes with dense updates.
[ "Jules Berman", "Benjamin Peherstorfer" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04867v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04867v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.NA", "math.NA", "stat.ML" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 7 6 8 4 0 . 0 1 3 2 : v i X r a Randomized Sparse Neural Galerkin Schemes for Solving Evolution Equations with Deep Networks Jules Berman Courant Institute for Mathematical Sciences New York University New York, NY 10012 jmb1174@nyu.edu Benjamin Peherstorfer Courant Institute for Mathematical Sciences New York University New York, NY 10012 pehersto@cims.nyu.edu Abstract Training neural networks sequentially in time to approximate solution fields of time- dependent partial differential equations can be beneficial for preserving causality and other physics properties; however, the sequential-in-time training is numerically challenging because training errors quickly accumulate and amplify over time. This work introduces Neural Galerkin schemes that update randomized sparse subsets of network parameters at each time step. The randomization avoids overfitting locally in time and so helps prevent the error from accumulating quickly over the sequential-in-time training, which is motivated by dropout that addresses a similar issue of overfitting due to neuron co-adaptation. The sparsity of the update reduces the computational costs of training without losing expressiveness because many of the network parameters are redundant locally at each time step. In numerical experiments with a wide range of evolution equations, the proposed scheme with randomized sparse updates is up to two orders of magnitude more accurate at a fixed computational budget and up to two orders of magnitude faster at a fixed accuracy than schemes with dense updates. 1 Introduction In science and engineering, partial differential equations (PDEs) are frequently employed to model the behavior of systems of interest. For many PDEs that model complicated processes, an analytic solution remains elusive and so computational techniques are required to compute numerical solutions. Global-in-time training There have been many developments in using nonlinear parameterizations based on neural networks for numerically approximating PDE solutions. These include techniques such as the Deep Galerkin Method [46], physics-informed neural networks (PINNs) [41], and others [4, 21, 53, 15]; as well as early works such as [11, 42]. In most of these methods, a neural network is used to represent the solution of a (time-dependent) PDE over the whole space-time domain. For this reason they are termed global-in-time methods in the following. To approximate the solution, the neural network is trained to minimize the PDE residual on collocation points sampled from the space- time domain, which requires solving a large-scale optimization problem that can be computationally expensive. Additionally, the solutions learned by global-in-time methods can violate causality, which can become an issue for complex problems that rely on preserving physics [27]. We note that neural networks have been used for approximating PDE solutions in various other ways, such as learning specific component functions [23, 31, 43], finding closure models [2, 25, 50], de-noising [44], and for surrogate modeling [33, 32, 18]. However, we are interested in this work in using neural networks for directly approximating PDE solutions. Preprint. Under review. Sequential-in-time training with the Dirac-Frenkel variational principle In this work, we follow the Dirac-Frenkel variational principle, which has been used for numerical methods in the field of quantum dynamics for a long time [10, 17, 26, 34, 28] and for dynamic-low rank and related solvers [24, 45, 35, 39, 38, 22]. Instead of globally approximating a PDE solution in time, the Dirac-Frenkel variational principle allows a sequential-in-time training that adapts a nonlinear parameterization, such as a neural network, over time. In contrast to classical numerical methods in vector spaces, the approximate solution in Dirac-Frenkel schemes is allowed to depend nonlinearly on its parameters and so to lie on a smooth manifold. The update to the nonlinear parameterization is calculated at each time step according to the orthogonal projection of the dynamics onto the tangent space of the manifold induced by the nonlinear parameterization. The Dirac-Frenkel variational principle has been adapted for the nonlinear approximation of PDEs with neural networks. In particular [14, 1, 7] formulate a sequential-in-time method based on the Dirac-Frenkel variational principle. The neural network represents the PDE solution at a point in time. The time-dependence then arises by allowing the parameters-the weights and biases of the network-to vary in time. The network parameters are then evolved forward according to the time dynamics which govern the PDE. This is in contrast to global-in-time methods, in which time enters the network as an additional input variable. By construction, an approximate solution obtained with a sequential-in-time method is causal, in that the solution at future times depends only on the solution at the current time. Although these methods have demonstrated success in solving various PDEs [34, 14, 7, 54, 16, 8, 30], there are open challenges: First, the sequential-in-time training is prone to overfitting which can lead to a quick accumulation of the residual over time. Second, the local training step has to be repeated at each time step, which can be computationally costly, especially with direct solvers that have costs increase quadratically with the number of network parameters. The work [16] proposes to address the two issues by using iterative solvers, instead of direct ones, and by re-training the network occasionally over the sequential-in-time training. We show with numerical experiments below that the re-training of the network can be computationally expensive. Additionally, the performance of iterative solvers depends on the condition of the problem, which can be poor in the context of sequential-in-time training. Our approach and contributions: Randomized sparse updates for schemes based on the Dirac- Frenkel variational principle We build on the previous work in sequential-in-time methods following a similar set up as [7] based on the Dirac-Frenkel variational principle. Where all previous methods solve local training problems that update every parameter of the network at each time step, we propose a modification such that only randomized sparse subsets of network parameters are updated at each time step: (a) The randomization avoids overfitting locally in time and so helps preventing the error from accumulating quickly over the sequential-in-time training, which is motivated by dropout that addresses a similar issue of overfitting due to neuron co-adaptation. (b) The sparsity of the updates reduces the computational costs of training without losing expressiveness because many of the network parameters are redundant locally at each time step. Our numerical experiments indicate that the proposed scheme is up to two orders of magnitude more accurate at a fixed computational cost and up to two orders of magnitude faster at a fixed accuracy. We release our code implementation here: https://github.com/julesberman/RSNG 2 Sequential-in-time training for solving PDEs 2.1 Evolution equations, Dirac-Frenkel variational principle, Neural Galerkin schemes Given a spatial domain u : T × X → Rd, and a time domain X ⊆ R so that u(t, ) : * ∂tu(t, x) =f (x, u) u(0, x) =u0(x) X → U for (t, x) ∈ T × X for x ∈ X R is in a function space T = [0, T ) R, we consider a solution field ⊆ at each time t, with dynamics (1) is the initial condition and f can include partial derivatives of u to represent PDEs. where u0 ∈ U We focus in this work on Dirichlet and periodic boundary conditions but the following approach 2 Figure 1: We propose Neural Galerkin schemes that update ran- domized sparse subsets of network parameters with the Dirac-Frenkel variational principle. Randomization avoids overfitting locally in time, which leads to more accurate approxi- mations than dense updates. Sparsity reduces the computational costs of training without losing expressive- ness because many parameters are redundant locally in time. can be applied with, e.g., Neumann boundary conditions as well [7]. One approach for imposing Dirichlet boundary conditions is by choosing parameterizations that satisfy the boundary conditions by definition [48]. Sequential-in-time training methods approximate u with a nonlinear parameterization such as a Rp depends on time t; the neural network ˆu : parameter θ(t) has p components and enters nonlinear in the second argument of ˆu. The residual of (1) at time t is R, where the parameter vector θ(t) X × → Θ ⊆ Θ ∈ r(x; θ(t), ̇θ(t)) = (2) f (x, ˆu( * ∇ ; θ(t)) to formally obtain ̇θ(t). Methods based on the where we applied the chain rule to ∂t ˆu( * Dirac-Frenkel variational principle [10, 17, 34] seek ̇θ(t) such that the residual norm is minimized, which leads to the least-squares problem θ ˆu(x; θ(t)) ; θ(t))) , − * ̇θ(t) ̇θ(t) ∥∇θ(t) ˆu( min * ; θ(t)) ̇θ(t) ; ˆu( f ( * ; θ(t))) ∥ * − 2 L2(X ) , (3) X ) norm . The least-squares problem (3) gives a ̇θ(t) such that the in the L2( residual is orthogonal to the tangent space at ˆu( Θ ∈ } * induced by the parameterization ˆu; see Figure 1. Schemes that solve (3) over time have also been termed Neural Galerkin schemes [7] because (3) can be derived via Galerkin projection as well. ∥ * ∥L2(X ) over ; θ(t)) of the manifold MΘ = ˆu( * ; θ) X θ { | ; θ(t)) is spanned by the spanning set ; θ(t)) ∂θi ˆu( } * { ; θ(t)); it is important to stress that ∇θ(t) ˆu( * p i=1, which are the The tangent space at ˆu( * p component functions of the gradient i=1 } { is not necessarily a basis of the tangent space because it can contain linearly dependent func- tions and be non-minimal. The least-squares problem (3) can be realized by assembling a ma- p points x1, . . . , xn trix whose columns are the gradient sampled at n resulting in ≫ Rn×p, which is a batch Jacobian ma- ∇θ(t) ˆu(xn; θ(t))]T J(θ(t)) = [ trix to which we refer to as Jacobian for convenience in the following. Additionally, we form the Rn and thus the least-squares right-hand side vector f (θ(t)) = [f (x1; θ(t)), . . . , f (xn; θ(t))]T problem ∇θ(t) ˆu(x1; θ(t)), . . . , ∂θi ˆu( * ; θ(t)) ∈ X ∈ ∈ J(θ(t)) ̇θ(t) min ̇θ(t) ∥ f (θ(t)) ∥ − 2 2 . (4) The choice of the points x1, . . . , xn is critical so that solutions of (4) are good approximations of solutions of (3); however, the topic of selecting the points x1, . . . , xn goes beyond this work here and so we just note that methods for selecting the points exist [1, 7] and that we assume in the following that we select sufficient points with n p to ensure that solutions of (4) are good approximations of solutions of (3) ≫ 2.2 Problem Formulation Challenge 1: Parameters are redundant locally in time. Typically, parameterizations ˆu based on deep neural networks lead to Jacobian matrices J(θ(t)) that are low rank in the least-squares problem (4); see, e.g., [37] and Figure 2(a). In our case, a low-rank matrix J(θ(t)) means that components in ̇θ(t) are redundant, because we assume that the samples x1, . . . , xn are sufficiently rich. Even if J(θ(t)) is low rank and thus the components in ̇θ(t) are redundant, the problem (4) can still be 3 tangentspaceMΘf(θ(t))ˆu(*;θ(t))spanningsetsparsesubset (a) low-rankness of Jacobian (b) residual growth (c) co-adaptation of neurons Figure 2: (a) Jacobians that have low rank locally in time imply that there are redundant parameters in the neural network, which motivates the proposed sparse updates that lead to speedups without losing expressiveness. (b) The residual grows quickly with sequential-in-time training (and dense updates). This is not due to a limitation with the expressiveness of the network because directly fitting the network to solutions indicates that there exist other parameters that can lead to lower residuals. (c) Sequential-in-time training (with dense updates) results in co-adapted neurons as indicated by the highly correlated columns of the J matrix. Plots for experiment with Allen-Cahn equation (Sec. 4). solved with standard linear algebra methods such as the singular value decomposition (SVD) because they compress the matrix J(θ(t)) and regularize for, e.g., the minimal-norm solution; however, the (np2), and thus is quadratic in the number of costs of performing the SVD to solve (4) scales as parameters p. This means that a redundancy in ̇θ(t) of a factor two leads to a 4 increase in the computational costs. Note that the problem typically is poorly conditioned because J(θ(t)) is low rank, which makes the direct application of iterative solvers challenging. O × Challenge 2: Overfitting leads to high residual over time. The residual from solving (4) can rapidly increase over time which in turn increases the overall error. This indicates that the tangent space along the trajectory θ(t) becomes ill suited for approximating the right-hand side vector f (θ(t)) in (4). We compare the residual of the least-squares problem (4) that is obtained along a trajectory of θ(t) from sequential-in-time training with the schemes above to the residual of (4) from a network that is fit to the true solution at each point in time; details in Appendix A.1. As shown in Figure 2(b), a lower residual is achieved by the network that is fit to the true solution. We aim to understand this phenomenon through the lens of overfitting: the sequential-in-time training can be thought of as successive fine-tuning, in the sense that at each time step we must make a small update to our parameters to match the solution at the next time step. However, fine-tuning is well known to be prone to over-fitting and model degeneration [3]. In the setting considered in this work, ; θ(t)) does not generalize well to the next time step. Not overfitting means that the representation ˆu( * generalizing well means that a local change to θ(t) is insufficient to move ˆu( ; θ(t)) according to the * desired update given by ̇θ(t) to match the right-hand side f (θ(t)), which implies that a large residual is incurred when solving (4). A common approach to prevent overfitting is dropout [47], especially when applied to fine-tuning tasks with dropout variants proposed in [3, 29], while other approaches are formulated specifically around sparse updates [49, 52]. Dropout is motivated by the observation that dense updates to parameters in neural networks can cause overfitting by leading neurons to co-adapt. Typically, co-adaptation is characterized by layer-wise outputs with high covariance [9]. In the case of sequential-in-time training with the schemes discussed above, co-adaptation implies the columns of the Jacobian matrix J(θ(t)) are correlated and thus close to linearly dependent. So as neurons co-adapt, component functions of the gradient become redundant and may be less suited for approximating f (θ(t)) causing the high residual for the least-squares problem; see Figure 2(b). This could also be characterized by the ill conditioning issue pointed out in [16]. We see empirical evidence of co-adaptation in Figure 2(c), where we plot component functions of the gradient and see that they are strongly correlated at the end time T . 4 3 Randomized Sparse Neural Galerkin (RSNG) schemes We introduce randomized sparse Neural Galerkin (RSNG) schemes that build on the Dirac-Frenkel variational principle to evolve network parameters θ(t) sequentially over time t but update only sparse subsets of the components of θ(t) and randomize which components of θ(t) are updated. The sparse updates reduce the computational costs of solving the least-squares problem (4) while taking advantage of the low rank structure of J(θ) which indicates components of the time derivative ̇θ(t) are redundant and can be ignored for updating θ(t) without losing expressiveness. The randomization of which components of θ(t) are updated prevents the overfitting described above. 3.1 Randomized sketch of residual To define the sketch matrix St, let e1, . . . , ep be the p-dimensional canonical unit vectors so that ei has entry one at component i and zeros at all other components. We then define s independent and identically distributed random variables ξ1(t), . . . , ξs(t) that depend on time t. The distribution of ξi(t) is π, which is supported over the set of indices s is then defined as St = [eξ1(t), . . . , eξs(t)]. The corresponding sketched residual analogous to (2) is . The random matrix St of size p } 1, . . . , p × { where now ̇θs(t) ∈ rs(x; θ(t), ̇θs(t)) = ∇ Rs is of dimension s p. ≪ θ ˆu(x; θ(t))St ̇θs(t) f (x, ˆu( ; θ(t)) , * − (5) 3.2 Projections onto randomized approximations of tangent spaces ∇ θ ˆu( * ; θ(t)) a subset ∂θξi(t) ˆu( { * p Using the sketch matrix St, we obtain from the spanning set i=1 of component func- } s tions of ; θ(t) i=1 } * ; θ(t)) of spans at least approximately the tangent space at ˆu( p elements. The * p i=1 contains many functions that are close to motivation is that the full spanning set ; θ(t)) } * linearly dependent (Jacobian is low rank) and thus sub-sampling the component functions still gives reasonable tangent space approximations that preserves much of the expressiveness; see Figure 1. While the low rankness depends on the complexity of the problem and parametrization, we observe low rankness in all our examples; see Appendix A.1 for further discussion. ; θ(t)) ∂θi ˆu( { * s i=1 with s functions. The set { MΘ but has only s ∂θi ˆu( { ; θ(t) } ∂θξi(t) ˆu( ≪ s We now introduce a least-squares problem based on the sparse spanning set i=1 that is analogous to the least-squares problem problem based on the full spanning set given in (4). We seek ̇θs(t) Rs with s components that solves ∂θξi(t) ˆu( * { ; θ(t) } ∈ min ̇θs(t)∈Rs ∥∇ θ ˆu( ; θ(t))St ̇θs(t) * f ( * ; ˆu( * 2 L2(X ) . ; θ(t))) ∥ − (6) To obtain ̇θ(t) to update θ(t), we set ̇θ(t) = St ̇θs(t). Thus, the components of ̇θ(t) that are selected by St are set to the corresponding value of the component of ̇θs(t) and all other components are set to zero, which means that the corresponding components of θ(t) are not updated. We can realize (6) the same way as the full least-squares problem in (4) by using the full Jacobian matrix and St to define the sparse Jacobian matrix as Js(θ(t)) = J(θ(t))St and the right-hand side vector f (θ(t)) analogous to Section 2 to obtain the discrete least-squares problem Js(θ(t)) ̇θs(t) min ̇θs(t) ∥ f (θ(t)) 2 2 . ∥ − (7) The choice of the distribution π is critical and depends on properties of the Jacobian matrix J(θ(t)). Distributions based on leverage scores provide tight bounds with regard to the number of columns one needs to sample in order for the submatrix to be close to an optimal low rank approximation of the full matrix with high probability [13]. But these distributions can be expensive to sample from. Instead, uniform sampling provides a fast alternative. The number of columns will not grow too quickly if the full matrix is sufficiently incoherent [19]. This means some columns do not carry a disproportionate amount of information relative to other columns. We numerically see that in our case the Jacobian matrix J(θ(t)) is sufficiently incoherent. Thus we can choose a uniform distribution over the set of indices to get the benefits of low rank approximation in a computationally efficient way. 1, . . . , p { } 5 Algorithm 1 Randomized Neural Galerkin scheme with sparse updates Fit parameterization ˆu( for k = 1, . . . , K do ; θ(0)) to initial condition u0 to obtain θ(0) * Draw realization of sketching matrix Sk as described in Section 3.1 Solve for sparse update ∆θ(k−1) Lift sparse update ∆θ(k−1) = Sk∆θ(k−1) Update θ(k) = θ(k−1) + δt∆θ(k−1) with least-squares problem (9) s s end for 3.3 Discretizing in time We discretize the time interval tK = T with δt = tk condition u0. We then update − T with K N regularly spaced time steps 0 = t0 < t1 < tk−1 for k = 1, . . . , K. At time t0, we obtain θ(0) ∈ < Rp by fitting the initial * * * ∈ for k = 1, . . . , K so that θ(k) is the time-discrete approximation of θ(tk) and thus ˆu( * imates the solution u at time tk. The sparse update ∆θ(k−1) the time-discrete counterpart of (7), which is given by s (8) ; θ(k)) approx- approximates ̇θs(tk−1) and is obtain by θ(k) = θ(k−1) + δt∆θ(k−1) min ∆θ(k−1) s Js(θ(k−1))Sk∆θ(k−1) ∥ s f (θ(k−1)) ∥ 2 2 , − (9) if time is discretized with the forward Euler method. Other discretization schemes can be used as well, which then lead to technically more involved problems (9) that remain conceptually similar though. The sparse update is lifted to ∆θ(k−1) = Sk∆θ(k−1) so that the update (8) can be computed. s 3.4 Computational procedure of RSNG We describe the proposed RSNG procedure in algorithmic form in Algorithm 1. We iterate over the time steps k = 1, . . . , K. At each time step, we first sketch the Jacobian matrix by creating a submatrix from randomly sampled columns. Notice that Sk need not actually be assembled as its action on the Jacobian matrix can be accomplished by indexing. We then solve the least-squares problem given in (9) using our sketched Jacobian to obtain ∆θ(k−1) . A direct solve of this system dominates the computational cost of making a time step and scales in O(ns2) time. The components of ∆θ(k−1) corresponding to the indices that have not been selected are filled with zeros. We then update the parameter θ(k−1) to θ(k) via ∆θ(k−1). The whole integration process scales as O( T s δt ns2) in time. 4 Numerical experiments We demonstrate RSNG on a wide range of evolution equations, where speedups of up to two orders of magnitude are achieved compared to comparable schemes with dense updates. We also compare to global-in-time methods, where we achieve up to two orders of magnitude higher accuracy. 4.1 Setup and equations Examples We now describe the details of the PDEs that we use to evaluate our method. We choose these particular setups to test our method on a diverse set of challenges including problems with global and local dynamics and solutions with sharp gradients and fine grained details. For visualization of the solutions of these equations see the Appendix A.4. Reaction-diffusion problem modeled by Allen-Cahn (AC) equation: The Allen-Cahn equation models prototypical reaction diffusion phenomena and is given as, We choose ε = 5 × ∂tu(t, x) = ε∂xxu(t, x) + u(t, x) 10−3, with periodic boundary condition − X u(t, x)3. = [0, 2π) and initial condition, 6 1 3 u0(x) = π 2 This initial condition results in challenging dynamics that are global over the spatial domain. 4.2)2) + exp( tanh(2 sin(x)) )2) + exp( 23.5(x 27(x 38(x exp( − − − − − − − 5.4)2)). Flows with sharp gradients described by Burgers' equation: The Burgers' equation is given by, We choose ε = 1 × ∂tu(t, x) = ε∂xxu(t, x) 10−3, with periodic boundary condition − u(t, x)∂xu(t, x). = [ 1, 1) and initial condition, u0(x) = (1 x2) exp( − − − X 30(x + 0.5)2). The corresponding solution field has sharp gradients that move in the spatial domain over time, which can be challenging to approximate. Charged particles in electric field: The Vlasov equation describes the time evolution of collisionless charged particles under the influence of an electric field. The equation models the distribution of such particles in terms of their position and velocity. We consider the case of one position dimension and one velocity dimension, making our domain R2. The equation is given by, X ⊆ ∂tu(t, x, v) = v∂xu(t, x, v) + ∂xφ(x)∂vu(t, x, v) − where x is the position, v is the velocity and φ is the electric field. We consider the case with periodic boundary condition 6, 6) and initial condition, = [0, 2π) [ X × − u0(x, v) = 1 √2π v2 exp( − 2 ) with a fixed electric field φ(x) = cos(x). This particular setup evolves into a distribution with fine grained details along a separatrix surrounding the potential well. ∈ Setup We parameterize with a feed-forward multi-layer perceptron. All our networks use linear layers of width 25 followed by non-linear activation functions, except the last layer which has no R. To vary the number of total parameters p, we activation and is of width 1 so that ˆu(x, θ(t)) vary the depth of networks ranging from 3–7 layers. We use rational activation functions which in our experiments allowed for fitting initial conditions faster and more accurately than a standard choice such as tanh or ReLU [5]. To enforce periodic boundary conditions, we modify the first layer so that it outputs periodic embeddings as in [7]; for details see Appendix A.5. The periodic embedding ensures that the boundary conditions are enforced exactly. For additional details on enforcing other types of boundary conditions (e.g. Dirichlet and Neumann) exactly in neural networks see [12, 7, 48]. We sample points from the domain on an equidistant grid. For time integration we use a RK4 scheme with a fixed time step size. The time step sizes are 5e 3 and we integrate up to end time 4, 4, and 3 for the Allen-Cahn, Burgers', and Vlasov equations, respectively. All error bars show two standard errors over three random realizations which results in different sketching matrices +/ at each time step. Relative errors are computed over the full space-time domain, unless the plot is explicitly over time. 3, 5e 3, 1e − − − − All gradients and spatial derivatives are computed with automatic differentiation implemented in JAX [6]. All computations are done in single precision arithmetic which is the default in JAX. All runtime statistics were computed on the same hardware, a Nvidia Tesla V100 w/ 32 GB memory. All additional hyperparameters are described in Appendix A.5. 4.2 Results RSNG achieves higher accuracy than schemes with dense updates at same computational costs In Figure 3 we plot the relative error over time. The curves corresponding to "dense updates" use a 3 layer network and integration is performed using dense updates. For RSNG, we use a 7 layer network and integrate with sparse updates, setting the number of parameters we update, s, equal to the total number of parameters in the 3 layer network and thus equal to the number of parameters that are updated by "dense updates." Thus, the comparison is at a fixed computational cost. The error achieved with RSNG is one to two orders of magnitude below the error obtained with dense updates, across all examples that we consider. In Figure 4(a), we see that as we increase the network size, 7 (a) Allen-Cahn (b) Burgers' (c) Vlasov Figure 3: We plot the relative error over time for RSNG versus dense updates at s = 757. We see RSNG leads to orders of magnitude lower errors than dense updates for the same costs. (a) fix sparsity s, vary #network parameters p (b) fix #network parameters p, vary sparsity s Figure 4: (a) RSNG benefits from the additional expressiveness of larger networks (larger p) while only using a fixed number of parameters (fixed s) at each time step. (b) As we decrease the number of parameters s in the sparse update, but keep the total number of parameters p of the network the same, we achieve lower errors than dense updates. Thus, RSNG outperforms dense updates while incurring lower computational costs. Error bars generated over random sketch matrices, St. the relative error decreases as the sparse updates allow us to exploit the greater expressiveness of larger networks while incurring no additional computational cost in computing (9). But we note that increasing the size of the full network will make computations of J(θ) and f (θ) more expensive because of higher costs of computing gradients. However, for the network sizes that we consider in this work, this effect is negligible compared to the cost of solving (9). RSNG achieves speedups of up to two orders of magnitude In Figure 5(a), we compare the runtime of RSNG to the runtime of a scheme with dense updates that uses a direct solver and to the runtime of a scheme with dense updates that uses an iterative solver as proposed in [16]. The time is computed for Burgers' equation and the sparsity s of RSNG is chosen such that all methods reach a comparable level of error. We find that RSNG is faster than direct solves with dense updates by two orders of magnitude and faster than the iterative solver by one order of magnitude. The results show that while using an iterative solver as in [16] does speed up the method relative to direct solves with dense updates, it can still be quite slow for networks with many parameters p. Additionally, convergence of the iterative method given in [16] requires a number of hyperparameters to be chosen correctly, which may require an expensive search or a priori knowledge about the solution. Note that our RSNG method does not preclude the use of an iterative method to speed up the least-squares solves further. 8 (a) runtime at 2e − 4 relative error with s = 125 (b) error versus runtime Figure 5: RSNG has lower computational costs than dense updates with direct and iterative least- squares solvers. Plots for numerical experiment with Burgers' equation To address the overfitting problem, the work [16] refits the network to the current approximate solution from a random initialization periodically during time integration. In Figure 5(b), we show the relative error versus the runtime for the iterative solver with various numbers of refits and for RSNG at different sparsity s. While refitting the network can reduce the relative error, it incurs a high computational cost. By contrast, for appropriate sparsity s, RSNG outperforms the method given in [16] in both speed and accuracy. Varying sparsity s at fixed number of total parameters p in network We now study the effect of varying the sparsity s (i.e., number of parameters updated by sparse updates) for a fixed network of total size p, in this case a 7 layer network. In Figure 4(b), we see that for a network of fixed size, sparse updates can reduce the relative error by about 2–3 when compared to dense updates. This is notable as the computational costs decrease quadratically with s. Thus, the combination of sparsity and randomized updates in RSNG can deliver both improved performance and lower computational cost. We see that at the beginning, when the number s is too small, the expressiveness suffers and the error becomes large. This is because if s is less than the rank of the dense Jacobian then the sparsified Jacobian will necessarily have less representational power. However, we stress that RSNG is robust with respect to s in the sense that for a wide range of s values the error is lower than for dense updates. × The high error when performing dense updates s = p in Figure 4(b) for Allen-Cahn and Burgers' equation is due to the overfitting problem described in Section 2.2. As updates become denser, the method is more likely to overfit to regions of the parameter space in which the Jacobian, J(θ), is ill suited for approximating the right-hand side f at future time steps (see Section 2). We can see this explicitly in Figure 6 where we plot the residual over time for sparse and dense updates on the Allen-Cahn equation. Initially, the dense updates lead to a lower residual. This makes sense as they begin at the same region of parameters space. But as the two methods navigate to different regions of parameters space, we see RSNG begins to incur a lower residual relative to dense updates. This indicates that RSNG ameliorates the problem of overfitting and so leads to a lower residual as shown in Figure 6(b). Comparison with global-in-time methods We compare our method to global-in-time methods which aim to globally minimize the PDE residual over the entire space-time domain. We compare to the original PINN formulation given in [41]. Additionally we compare to a variant termed Causal PINNs, which impose a weak form of time dependence through the loss function [51]. We select this variant as it claims to have state of the art performance among PINNs on problems such as the Allen-Cahn equation. In Table 1, we see that our sequential-in-time RSNG method achieves a higher accuracy by at least one order of magnitude compared to PINNs. Additionally, in terms of computational costs, RSNG outperforms both PINN variants, as their global-in-time training is expensive and requires many residual evaluations. We note that the training time of PINNs is directly 9 Figure 6: Plot (a) shows the residual of dense and sparse up- dates at early time steps. Ini- tially, dense updates must have a lower residual as JSt spans a subspace of the tangent space given by J. But in plot (b), we see that after a few time steps, dense updates overfit and the residual grows quicker than with sparse updates. (a) residual at early times (b) residual over full time PDE Method L2 Relative Error Time(s) s Allen-Cahn PINN 6.85e Allen-Cahn Causal PINN 3.84e Allen-Cahn RSNG Allen-Cahn RSNG 1.66e−5 5.34e 5 − − 2 4 Burgers' Burgers' Burgers' Burgers' PINN 2.34e Causal PINN 5.19e RSNG RSNG 6.07e−5 2.05e − − 3 4 4 − − 841 3060 776 63 3451 23027 2378 188 N/A N/A 800 150 N/A N/A 800 125 Table 1: The sequential-in-time training with RSNG achieves about one order of magnitude higher accuracy than global-in-time methods in our examples. Details on training in Appendix A.6. dependent on the number of optimization iterations and thus they can be trained faster if one is willing to tolerate even higher relative errors. 5 Conclusions, limitations, and future work In this work, we introduced RSNG that updates randomized sparse subsets of network parameters in sequential-in-time training with the Dirac-Frenkel variational principle to reduce computational costs while maintaining expressiveness. The randomized sparse updates are motivated by a redundancy of the parameters and by the problem of overfitting. The randomized sparse updates have a low barrier of implementation in existing sequential-in-time solvers. The proposed RSNG achieves speedups of up to two orders of magnitude compared to dense updates for computing an approximate PDE solution with the same accuracy. Current limitations leave several avenues for future research: first, as discussed in 3.2, uniform sampling is only appropriate when the Jacobian matrix is of low coherence. Future work may investigate more sophisticated sampling methods such as leverage score and pivoting elements of rank revealing QR. Second, there are problems for which overfitting with dense updates is less of an issue; e.g., the charged particles example in our work. Note that due to the sparsity of the updates, RSNG still achieves a speedup compared to dense updates for the same accuracy for this example though. However, more work is needed to better understand and mathematically characterize which properties of the problems influence the overfitting issue. We make a general comment about using neural networks for numerically solving PDEs: The equations discussed in this paper are standard benchmark examples used in the machine-learning literature; however, for these equations, carefully designed classical methods can succeed and often have lower runtimes than methods based on nonlinear parameterizations [20, 36]. While these equations provide an important testing ground to demonstrate methodological improvements, future work will extend these results to domains where classical linear methods struggle, e.g., high-dimensional problems and problems with slowly decaying Kolmogorov n-widths [15, 7, 40]. We do not expect that this work has negative societal impacts. 10 Acknowledgements The authors were partially supported by the National Science Foundation under Grant No. 2046521 and the Office of Naval Research under award N00014-22-1-2728. This work was also supported in part through the NYU IT High Performance Computing resources, services, and staff expertise. References [1] William Anderson and Mohammad Farazmand. Evolution of nonlinear reduced-order solutions for PDEs with conserved quantities. SIAM Journal on Scientific Computing, 44(1):A176–A197, 2022. [2] Yohai Bar-Sinai, Stephan Hoyer, Jason Hickey, and Michael P. Brenner. Learning data-driven discretizations for partial differential equations. Proceedings of the National Academy of Sciences, 116(31):15344–15349, 2019. [3] Antonio Valerio Miceli Barone, Barry Haddow, Ulrich Germann, and Rico Sennrich. Regu- larization techniques for fine-tuning in neural machine translation. CoRR, abs/1707.09920, 2017. [4] Jens Berg and Kaj Nyström. A unified deep artificial neural network approach to partial differential equations in complex geometries. Neurocomputing, 317:28–41, nov 2018. [5] Nicolas Boulle, Yuji Nakatsukasa, and Alex Townsend. Rational neural networks. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 14243–14253. Curran Associates, Inc., 2020. [6] James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: composable transformations of Python+NumPy programs. 2018. [7] J. Bruna, B. Peherstorfer, and E. Vanden-Eijnden. Neural Galerkin scheme with active learning for high-dimensional evolution equations. arXiv:2203.01360, 2022. [8] Peter Yichen Chen, Maurizio M. Chiaramonte, Eitan Grinspun, and Kevin Carlberg. Model reduction for the material point method via an implicit neural representation of the deformation map. Journal of Computational Physics, 478:111908, 2023. [9] Michael Cogswell, Faruk Ahmed, Ross B. Girshick, Larry Zitnick, and Dhruv Batra. Reducing overfitting in deep networks by decorrelating representations. In Yoshua Bengio and Yann LeCun, editors, 4th International Conference on Learning Representations, ICLR 2016, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, 2016. [10] P. A. M. Dirac. Note on exchange phenomena in the thomas atom. Mathematical Proceedings of the Cambridge Philosophical Society, 26(3):376–385, 1930. [11] M. W. M. G. Dissanayake and N. Phan-Thien. Neural-network-based approximations for solving partial differential equations. Communications in Numerical Methods in Engineering, 10(3):195–201, 1994. [12] Suchuan Dong and Naxian Ni. A method for representing periodic functions and enforcing exactly periodic boundary conditions with deep neural networks. Journal of Computational Physics, 435:110242, jun 2021. [13] Petros Drineas, Michael W. Mahoney, and S. Muthukrishnan. Relative-error CUR matrix decompositions. CoRR, abs/0708.3696, 2007. [14] Yifan Du and Tamer A. Zaki. Evolutional deep neural network. Physical Review E, 104(4), oct 2021. [15] Weinan E, Jiequn Han, and Arnulf Jentzen. Algorithms for solving high dimensional PDEs: from nonlinear Monte Carlo to machine learning. Nonlinearity, 35(1):278, dec 2021. [16] Marc Anton Finzi, Andres Potapczynski, Matthew Choptuik, and Andrew Gordon Wilson. A stable and scalable method for solving initial value PDEs with neural networks. In The Eleventh International Conference on Learning Representations, 2023. [17] J. Frenkel. Wave Mechanics, Advanced General Theory. Clarendon Press, Oxford, 1934. 11 [18] Stefania Fresca and Andrea Manzoni. POD-DL-ROM: Enhancing deep learning-based reduced order models for nonlinear parametrized PDEs by proper orthogonal decomposition. Computer Methods in Applied Mechanics and Engineering, 388:114181, 2022. [19] Alex Gittens. The spectral norm error of the naive Nystrom extension. arXiv, 1110.5305, 2011. [20] Tamara G. Grossmann, Urszula Julia Komorowska, Jonas Latz, and Carola-Bibiane Schönlieb. Can physics-informed neural networks beat the finite element method? arXiv, 2302.04107, 2023. [21] Jiequn Han, Arnulf Jentzen, and Weinan E. Solving high-dimensional partial differential equations using deep learning. Proceedings of the National Academy of Sciences, 115(34):8505– 8510, 2018. [22] Jan S. Hesthaven, Cecilia Pagliantini, and Gianluigi Rozza. Reduced basis methods for time- dependent problems. Acta Numerica, 31:265–345, 2022. [23] Yuehaw Khoo, Jianfeng Lu, and Lexing Ying. Solving for high-dimensional committor functions using artificial neural networks. Research in the Mathematical Sciences, 6(1):1, Oct 2018. [24] Othmar Koch and Christian Lubich. Dynamical low-rank approximation. SIAM Journal on Matrix Analysis and Applications, 29(2):434–454, 2007. [25] Dmitrii Kochkov, Jamie A. Smith, Ayya Alieva, Qing Wang, Michael P. Brenner, and Stephan Hoyer. Machine learning–accelerated computational fluid dynamics. Proceedings of the National Academy of Sciences, 118(21), 2021. [26] Peter Kramer and Marcos Saraceno. Geometry of the time-dependent variational principle in quantum mechanics. In Lecture Notes in Physics, volume 140. Springer, 1981. [27] Aditi S. Krishnapriyan, Amir Gholami, Shandian Zhe, Robert M. Kirby, and Michael W. Mahoney. Characterizing possible failure modes in physics-informed neural networks. CoRR, abs/2109.01050, 2021. [28] Caroline Lasser and Christian Lubich. Computing quantum dynamics in the semiclassical regime. Acta Numerica, 29:229–401, 2020. [29] Cheolhyoung Lee, Kyunghyun Cho, and Wanmo Kang. Mixout: Effective regularization to finetune large-scale pretrained language models. CoRR, abs/1909.11299, 2019. [30] Kookjin Lee and Kevin T. Carlberg. Model reduction of dynamical systems on nonlinear mani- folds using deep convolutional autoencoders. Journal of Computational Physics, 404:108973, 2020. [31] Qianxiao Li, Bo Lin, and Weiqing Ren. Computing committor functions for the study of rare events using deep learning. The Journal of Chemical Physics, 151(5):054112, 2019. [32] Zongyi Li, Nikola Borislavov Kovachki, Kamyar Azizzadenesheli, Burigede Liu, Kaushik Bhat- tacharya, Andrew M. Stuart, and Anima Anandkumar. Fourier neural operator for parametric partial differential equations. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. [33] Lu Lu, Pengzhan Jin, Guofei Pang, Zhongqiang Zhang, and George Em Karniadakis. Learning nonlinear operators via DeepONet based on the universal approximation theorem of operators. Nature Machine Intelligence, 3(3):218–229, Mar 2021. [34] Christian Lubich. From Quantum to Classical Molecular Dynamics: Reduced Models and Numerical Analysis. EMS Press, 2008. [35] E. Musharbash, F. Nobile, and T. Zhou. Error analysis of the dynamically orthogonal approxima- tion of time dependent random PDEs. SIAM Journal on Scientific Computing, 37(2):A776–A810, 2015. [36] K. Otness, A. Gjoka, J. Bruna, D. Panozzo, B. Peherstorfer, T. Schneider, and D. Zorin. An extensible benchmark suite for learning to simulate physical systems. In NeurIPS 2021 Track Datasets and Benchmarks, 2021. [37] Samet Oymak, Zalan Fabian, Mingchen Li, and Mahdi Soltanolkotabi. Generalization, adap- tation and low-rank representation in neural networks. In 2019 53rd Asilomar Conference on Signals, Systems, and Computers, pages 581–585, 2019. [38] B. Peherstorfer. Model reduction for transport-dominated problems via online adaptive bases and adaptive sampling. SIAM Journal on Scientific Computing, 42:A2803–A2836, 2020. 12 [39] B. Peherstorfer and K. Willcox. Online adaptive model reduction for nonlinear systems via low-rank updates. SIAM Journal on Scientific Computing, 37(4):A2123–A2150, 2015. [40] Benjamin Peherstorfer. Breaking the Kolmogorov barrier with nonlinear model reduction. Notices of the American Mathematical Society, 69(5):725–733, May 2022. [41] M. Raissi, P. Perdikaris, and G.E. Karniadakis. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 378:686–707, 2019. [42] R. Rico-Martinez, K. Krischer, I. G. Kevrekidis, M. C. Kube, and J. L. Hudson. Discrete- vs. continuous-time nonlinear signal processing of cu electrodissolution data. Chemical Engineering Communications, 118(1):25–48, 1992. [43] Grant M. Rotskoff, Andrew R. Mitchell, and Eric Vanden-Eijnden. Active importance sam- pling for variational objectives dominated by rare events: Consequences for optimization and generalization. arXiv, 2008.06334, 2021. [44] Samuel H. Rudy, J. Nathan Kutz, and Steven L. Brunton. Deep learning of dynamics and signal-noise decomposition with time-stepping constraints. Journal of Computational Physics, 396:483–506, 2019. [45] Themistoklis P. Sapsis and Pierre F.J. Lermusiaux. Dynamically orthogonal field equations for continuous stochastic dynamical systems. Physica D: Nonlinear Phenomena, 238(23):2347– 2360, 2009. [46] Justin Sirignano and Konstantinos Spiliopoulos. DGM: A deep learning algorithm for solving partial differential equations. Journal of Computational Physics, 375:1339–1364, dec 2018. [47] Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(56):1929–1958, 2014. [48] N. Sukumar and Ankit Srivastava. Exact imposition of boundary conditions with distance functions in physics-informed deep neural networks. Computer Methods in Applied Mechanics and Engineering, 389:114333, 2022. [49] Yi-Lin Sung, Varun Nair, and Colin Raffel. Training neural networks with fixed sparse masks. arXiv, 2111.09839, 2021. [50] Qian Wang, Nicolò Ripamonti, and Jan S. Hesthaven. Recurrent neural network closure of parametric POD-Galerkin reduced-order models based on the Mori-Zwanzig formalism. J. Comput. Phys., 410:109402, 2020. [51] Sifan Wang, Shyam Sankaran, and Paris Perdikaris. Respecting causality is all you need for training physics-informed neural networks. arXiv, 2203.07404, 2022. [52] Elad Ben Zaken, Shauli Ravfogel, and Yoav Goldberg. BitFit: Simple parameter-efficient fine-tuning for transformer-based masked language-models. arXiv, 2106.10199, 2022. [53] Linfeng Zhang, Jiequn Han, Han Wang, Roberto Car, and Weinan E. Deep potential molecular dynamics: A scalable model with the accuracy of quantum mechanics. Phys. Rev. Lett., 120:143001, Apr 2018. [54] Tianchen Zhao, Chuhao Sun, Asaf Cohen, James Stokes, and Shravan Veerapaneni. Quantum- inspired variational algorithms for partial differential equations: Application to financial deriva- tive pricing. arXiv, 2207.10838, 2022. 13 A Appendix A.1 Details on Figure 2 For Figure 2a–b we look at quantities generated by fitting a network to the true solution at a point in time t. This is done in the same way we fit initial conditions described in A.5, but in this context the target function is taken to be the true solution at time t. For Figure 2(a), we compute the Jacobian of the network fitted to the true solution at each point in time and then plot its spectrum. For Figure 2(b), we take the network fitted to the true solution and compute the residual from the least-squares problem 4 to give the data points in the "Direct fit" line. In Figure 7 we provide versions of Figure 2(a) from the main text but for all the equations considered. Vlasov is a more complex problem that exhibits a less sharp decay but is still distinctly rank deficient. A.2 Details on Speed-Up Here we provide additional results on the speed-up provided by RSNG for different equations. In Figure 8 we provide versions of Figure 5(a) from the main text but for all the equations considered. In Figure 9 we show how the runtime of Neural Galerkin schemes scales with s, thus showing the quadratic speed-up provided by RSNG as we reduce s. A.3 Applications to High Dimensional Problems Neural Galerkin schemes have been shown to be a useful approach to high dimensional PDEs [7]. In Figure 10 we demonstrate that RSNG may be applicable in these settings we well. We fit a neural network to a numerical solution of the Fokker-Planck equation in 5 dimensions; see [7, Section 5.4.1] for a description of the setup. The results show that for a sufficiently large network, the Jacobian has a low-rank structure as in the examples in the paper and a steep decay in the singular values so that random sketching strategies will likely be successful. A.4 Ground Truth The ground truth for the Allen-Cahn and Burgers' equations were generated using a spectral method with a fourth order integrator implemented in the spin solver as part of the Chebfun package in Matlab. We used a spatial grid of 10 000 points and time step size of 1e 3. The ground truth for the Vlasov equation was generated with a 4th order finite difference scheme in space and an RK4 time integration scheme. We sample 106 points over the full 2D space domain and a time step size of 1e 3 was used for time integration. − In Figure 11,12,13 we show plots of the ground truth solutions at the beginning, middle, and end of integration time for the equations we examine. We can see that they display the characteristics described in Section 4.1. − (a) Allen-Cahn (b) Burgers' (c) Vlasov Figure 7: Decay of singular values of J(θ(t)) 14 (a) Allen-Cahn, error 5e 5, s = 150 − (b) Burgers', error 2e 4, s = 125 − (c) Vlasov, error 2e 4, s = 800 − Figure 8: Speedups of RSNG over dense updates with direct and iterative solver. (a) Allen-Cahn (b) Burgers' (c) Vlasov Figure 9: Speedups of RSNG scale quadratic with sparsity s. Figure 10: Singular values of the Jacobian of the network fit to a Fokker-Planck solution in five di- mension decays quickly too; pro- viding indication that our RSNG approach is applicable in these set- tings as well. (a) t = 0 (b) t = 2 (c) t = 4 Figure 11: True solution u(t, x) for Allen-Cahn 15 (a) t = 0 (b) t = 2 (c) t = 4 Figure 12: True solution u(t, x) for Burgers' (a) t = 0 (b) t = 1.5 (c) t = 3 Figure 13: True solution (top) vs RSNG solution (bottom) for Vlasov A.5 Architecture and Hyperparameters For an input x ∈ parameters a, φ, b Rd as, ∈ Rd a periodic embedding layer with period P is defined with the optimization PeriodicEmbed(x) = d (cid:88) (cid:20) a cos(x (cid:21) + φ) + b . 2π P i i=1 This operation is the repeated w times for different parameters a, φ, b where w denotes the width of the layer resulting in a output vector y To fit the initial condition, we minimize the L2 distance between the network and the initial condition as well as the L2 distance between the first derivative of the network and the first derivative of the initial condition with respect to the spatial domain . We evaluate the loss function over 10 000 equispaced points for Allen-Cahn and Burgers' equation and 200 000 points for Vlasov. We fit our initial conditions with two nonlinear solvers. First we run L-BFGS with 1000 iterations, then we use an Adam optimizer with the following hyperparameters, Rw X ∈ • iterations : 100 000 • learning rate : 1e 3 • scheduler : cosine decay − 16 • decay steps : 500 The number of iterations and the number of points we sample are chosen to fit the initial condition to high accuracy to avoid polluting the results in our analysis with errors of fitting the initial condition. To assemble the Jacobian matrix J(θ(t)), the gradient of ˆu is evaluated on samples generated from the spatial domain. If not noted otherwise, we use 10 000 equidistant points for Allen-Cahn and Burgers' and 200 000 equidistant points for Vlasov. For the time-optimized RSNG results in Table 1 (rows 4 and 8) we use 1000 equidistant points for Allen-Cahn and Burgers'. In the dense and sparse least-squares system we regularize the direct solver so as to avoid numerical instability. For this 4, we set the rcond parameters in numpy implementation of lstsq. The values used are 1e 1e 5 for Allen-Cahn, Burgers', and Vlasov respectively. 4, 1e − − − A.6 Global Methods Benchmark Here we detail the training setups for our benchmarks of the global methods given in Table 1. For all PINN experiments we sampled data on a grid with 100 points in the time domain and 256 points in the spatial domain. All PINNs were trained with the following hyperparameters: • optimizer : Adam then L-BFGS • spatial samples : 256 • time samples : 100 • activation : tanh For the plain PINN experiments our architecture is a MLP with layers sizes as follows: [2, 128, 128, 128, 128, 1]. Boundary and initial conditions were enforced through a penalty in the loss function. For the Causal PINNs we use the architecture described in the original paper, with periodic embedding and "modified MLP layers." The layer sizes were as follows: [periodic embedding, 128, 128, 128, 128, 1]. Our implementation uses much of the original code provided in [51]. We used only one time-window for training as this is what was chosen in [51] for the Allen-Cahn equation. The tolerance hyperparameter, which controls the degree to which the loss function enforces causal training, was set to 100 and 50 for the Allen-Cahn and Burgers' equations respectively. Additionally the λic parameter, which controls the loss functions' weighting on the initial condition, was set to 100 and 1 for the Allen-Cahn and Burgers' equations respectively. These were both chosen via a hyperparameter search. For details on the context and meaning of these hyperparameters see the original paper [51]. The PINNs trained for Allen-Cahn used 1000 steps of Adam followed by 30000 steps of L-BFGS. For Burgers' equations we used 1000 steps of Adam followed by 60000 steps of L-BFGS. More steps are needed for Burgers' equation in order to sufficiently resolve the sharp gradient in the solution due to the low viscosity number. We similarly choose a smaller timestep for Burgers' in the Neural Galerkin schemes. We note that fewer optimization iterations can be used for training PINNs but this resulted in much larger errors in our experiments. In any case, widely varying the number optimization iterations and other PINNs hyperparameters did not achieve errors in the range of what RSNG achieves in these examples. 17
http://arxiv.org/abs/2310.04865v1
"2023-10-07T16:21:04"
"2023-10-07T16:21:04"
ForeSeer: Product Aspect Forecasting Using Temporal Graph Embedding
Developing text mining approaches to mine aspects from customer reviews has been well-studied due to its importance in understanding customer needs and product attributes. In contrast, it remains unclear how to predict the future emerging aspects of a new product that currently has little review information. This task, which we named product aspect forecasting, is critical for recommending new products, but also challenging because of the missing reviews. Here, we propose ForeSeer, a novel textual mining and product embedding approach progressively trained on temporal product graphs for this novel product aspect forecasting task. ForeSeer transfers reviews from similar products on a large product graph and exploits these reviews to predict aspects that might emerge in future reviews. A key novelty of our method is to jointly provide review, product, and aspect embeddings that are both time-sensitive and less affected by extremely imbalanced aspect frequencies. We evaluated ForeSeer on a real-world product review system containing 11,536,382 reviews and 11,000 products over 3 years. We observe that ForeSeer substantially outperformed existing approaches with at least 49.1\% AUPRC improvement under the real setting where aspect associations are not given. ForeSeer further improves future link prediction on the product graph and the review aspect association prediction. Collectively, Foreseer offers a novel framework for review forecasting by effectively integrating review text, product network, and temporal information, opening up new avenues for online shopping recommendation and e-commerce applications.
[ "Zixuan Liu", "Gaurush Hiranandani", "Kun Qian", "Eddie W. Huang", "Yi Xu", "Belinda Zeng", "Karthik Subbian", "Sheng Wang" ]
10.1145/3583780.3614887
[ { "@title": "doi", "@href": "http://dx.doi.org/10.1145/3583780.3614887", "@rel": "related", "@type": null }, { "@title": null, "@href": "http://arxiv.org/abs/2310.04865v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04865v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.IR", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.IR", "cs.AI", "cs.CL", "cs.LG" ]
3 2 0 2 t c O 7 ] R I . s c [ 1 v 5 6 8 4 0 . 0 1 3 2 : v i X r a ForeSeer: Product Aspect Forecasting Using Temporal Graph Embedding Zixuan Liu∗ zucksliu@cs.washington.edu University of Washington Seattle, WA, USA Edward W. Huang ewhuang@amazon.com Amazon Palo Alto, CA, USA Gaurush Hiranadani hgaurush@amazon.com Amazon Palo Alto, CA, USA Yi Xu yxaamzn@amazon.com Amazon Seattle, WA, USA Kun Qian qianku@amazon.com Amazon Palo Alto, CA, USA Belinda Zeng zengb@amazon.com Amazon Seattle, WA, USA Karthik Subbian ksubbian@amazon.com Amazon Palo Alto, CA, USA Sheng Wang swang@cs.washington.edu University of Washington Seattle, WA, USA ABSTRACT Developing text mining approaches to mine aspects from customer reviews has been well-studied due to its importance in understand- ing customer needs and product attributes. In contrast, it remains unclear how to predict the future emerging aspects of a new prod- uct that currently has little review information. This task, which we named product aspect forecasting, is critical for recommending new products, but also challenging because of the missing reviews. Here, we propose ForeSeer, a novel textual mining and product embed- ding approach progressively trained on temporal product graphs for this novel product aspect forecasting task. ForeSeer transfers reviews from similar products on a large product graph and ex- ploits these reviews to predict aspects that might emerge in future reviews. A key novelty of our method is to jointly provide review, product, and aspect embeddings that are both time-sensitive and less affected by extremely imbalanced aspect frequencies. We eval- uated ForeSeer on a real-world product review system containing 11,536,382 reviews and 11,000 products over 3 years. We observe that ForeSeer substantially outperformed existing approaches with at least 49.1% AUPRC improvement under the real setting where aspect associations are not given. ForeSeer further improves future link prediction on the product graph and the review aspect associa- tion prediction. Collectively, Foreseer offers a novel framework for review forecasting by effectively integrating review text, product network, and temporal information, opening up new avenues for online shopping recommendation and e-commerce applications. ∗This research was conducted during the author's internship at Amazon. This work is licensed under a Creative Commons Attribution International 4.0 License. CIKM '23, October 21–25, 2023, Birmingham, United Kingdom. © 2023 Copyright held by the owner/author(s). ACM ISBN 979-8-4007-0124-5/23/10. https://doi.org/10.1145/3583780.3614887 CCS CONCEPTS • Information systems → Data mining; Information retrieval; Language models; • Computing methodologies → Machine learning; Information extraction; Semantic networks; Tem- poral reasoning; Transfer learning. KEYWORDS Aspect forecasting, textual mining, temporal graph embedding, multi-time forecasting, information extraction, contrastive learning ACM Reference Format: Zixuan Liu, Gaurush Hiranadani, Kun Qian, Edward W. Huang, Yi Xu, Be- linda Zeng, Karthik Subbian, and Sheng Wang. 2023. ForeSeer: Product Aspect Forecasting Using Temporal Graph Embedding. In Proceedings of the 32nd ACM International Conference on Information and Knowledge Manage- ment (CIKM '23), October 21–25, 2023, Birmingham, United Kingdom. ACM, New York, NY, USA, 11 pages. https://doi.org/10.1145/3583780.3614887 1 INTRODUCTION Customer reviews reflect the properties of the product and the needs of the customer on online shopping systems [24, 88]. As a result, one widely studied task is to extract descriptive keywords from customer reviews, such as "not greasy" and "soft inside". These descriptive keywords, which are referred to as aspects in the liter- ature, are later used as key features for various applications that are beneficial to buyers making decisions and sellers improving the market, such as customer behavior prediction [48], sentiment analysis [42], opinion mining [26, 71], product rating [34], and mar- keting refinement [62]. To tackle this problem, many text mining methods have been proposed to mine such aspects from customer reviews [4, 7, 18, 25, 53, 73, 79, 83, 84]. Despite its usefulness, however, customer reviews are also subjec- tive and sometimes biased, therefore mining effective aspects from reviews for a product requires adequate numbers of reviews. For a new product with limited customer reviews, aspect mining meth- ods will suffer from starting cold and mining inaccurate and noisy aspects. In this paper, we aim at a novel product aspect forecasting task, by forecasting the top aspects in the future for products with CIKM '23, October 21–25, 2023, Birmingham, United Kingdom. Zixuan Liu et al. inadequate reviews (Fig. 1), i.e., what aspects will the customer use to describe a new product after six months or three years? To the best of our knowledge, product aspect forecasting has not been stud- ied in the literature and is one step further than traditional aspect extraction tasks. The most related task is zero-shot aspect-based sentiment analysis [9, 17, 54], but their frameworks are restricted to sentiment analysis or still require multilingual supervision. The recent progress in large language models such as ChatGPT [44] or GPT-4 [2] may also open a door for improved zero-shot aspect extraction performance, but besides the heavy computational costs using them, the limited availability of reviews of new products still restricts the model from forecasting their top aspects in the future. Figure 1: Problem setting of aspect forecasting. The product graph is evolving because new product nodes and edges are added to the graph. The edge weights also change over time. In this paper, we formulate the product aspect forecasting task as a multi-future top-K aspect retrieving problem. An intuitive solu- tion to the problem is to find similar products with longer histories and infer based on their received feedback, just like a customer would search for the reviews of similar older products that have the same functionality, brand, or same style before making the de- cision. Motivated by this, in this paper, we propose a three-stage framework ForeSeer to address it. ForeSeer is a flexible textual mining and product embedding framework progressively trained on temporal product graphs. The key idea is to find similar older products from the temporal product graph and propagate potential aspects mined from their reviews to the new item. This enables forecasting currently under-estimated aspects which might be fre- quently mentioned in the future (Fig. 2). ForeSeer has three core steps, contrastive review-aspect association learning, progressive temporal graph-based product embedding, and aspect-guided prod- uct embedding refinement with temporal information. The first step efficiently captures the static semantic relationship between review texts and aspects, and the second step together captures the evolving graphical product similarity information and how prod- ucts aggregate reviews over time. In the third step, we design a novel product-aspect temporal attention (PATA) module to help adjust the product embeddings guided by aspect embeddings for multi-length future times forecasting. We evaluated ForeSeer on a real-world customer review dataset, which contains 11,000 products, 11,536,382 reviews, and a product similarity graph constructed using user queries and clicks. Our dataset contains the timestamp for each review and product over three years. We observed substantial improvement against com- parison approaches on product aspect forecasting in both settings with accessible estimated or ground truth association. We found the product embeddings derived from ForeSeer show more visible patterns when the timestamp is increasing, suggesting an accurate incorporation of temporal information. In addition to aspect fore- casting, ForeSeer achieved prominent performance on multi-time future link prediction and review-aspect association prediction, demonstrating its wide applicability in modeling temporal review information. ForeSeer is developed as, to our knowledge, the first approach to product aspect forecasting and can be broadly applied to other temporal graph mining tasks. Figure 2: The key idea of ForeSeer is to find and embed similar products dynamically and propagate their top aspects mined from reviews to the new item to forecast future aspects. 2 PRODUCT ASPECT FORECASTING 2.1 Problem Definition: A new task In principle, products receive and aggregate reviews and aspects are mined from the review text pieces, enabling the products to extract and aggregate aspects associations. We then understand relationships among the three core components, products, aspects, and reviews in detail, and formally define the product aspect mining and forecasting problem as a top-Kl aspect retrieval problem. 2.1.1 Product aspect mining from review texts. A descriptive aspect Al , is a descriptive textual span extracted from a review text se- quence r j that summarizes a particular attribute or feature of Pi , the product r j belongs to (examples and illustration in Table 1). Given an aspect list L = {A1, A2, . . . , A|L | } and r j , we define the review-aspect association vector vj ∈ {0, 1} |L | , where vl j = 1 if r j and Al are associated. The aspect list can be obtained by supervised or unsupervised mining from reviews [77, 84]. The longer the list, the more descriptive and diverse aspects can be included in the list. A product network G = {P, E} is given with a set of product nodes P and an edge set E representing the similarities between products. Aw is the weighted adjacency matrix of E. Each product receives reviews and maintains a review list Ri = {ri,1, . . . , ri,|Ri | }. Let vi,k be the review-aspect association vector of ri,k and V l i = i,k } |Ri | {vl k=1 be the collected Al 's association list of Pi . The product- aspect association vector ui ∈ R|L | can then be obtained by aggre- gating all the review-aspect association vectors in the review list through Agg(.), a permutation-invariant aggregation function: )]. ui = [Agg(V 1 i ); . . . ; Agg(V |L | i Kl The binarized top-Kl aspect label vector y = yi can then be i constructed by ranking ui and picking up the top-Kl product-aspect associations of Pi to be positive. Let xi ∈ RdP be the node feature of Pi , the product aspect mining task is using xi and graphical information in G such as Aw to predict yi . Note that the number of positive labels can be less than Kl , resulting in the multi-label nature of yi . (1) Now (0 month)6 months12 months-12 months -6 months0.4What will be the top aspects for this new prod-uct after 12 months?0.50.50.40.70.60.80.70.80.80.50.40.40.80.71.Soft inside2.Comfortable3. WarmTop aspects1. Comfortable2. Soft inside3. Looks goodNum of review:s 100Top aspectsTop aspectsRankingSoft insideComfortableWarmLooks good1.Looks good 2.Comfortable3.Soft insideNum of reviews: 1000Num of reviews: 50001.Soft inside2.Comfortable3. WarmTop aspectsNum of reviews: 7000 ForeSeer: Product Aspect Forecasting Using Temporal Graph Embedding CIKM '23, October 21–25, 2023, Birmingham, United Kingdom. Table 1: Three review-aspect association examples are presented to show the different difficulty levels mining these aspects. The mining difficulty for an aspect depends on its relationship to the related corpus (More challenging from top to bottom). Relation with corpus Exact match Synonym Summary Product type Table Candle Carpet cleaning Great carpet machine Aspect Very sturdy Looks great Related corpus very sturdy looks perfect did a great job cleaner cleaning my carpet This Compact Carpet Cleaner did a great job cleaning my carpet ! Raw review texts This table is very sturdy. I bought this product for my wife and it looks perfect for me. Table 2: Head and tail aspect examples with frequency infor- mation over a three-year period. Head aspect Looks great Works great Very sturdy 3-year frequency 1,955,762 1,796,908 1,199,984 Tail aspect Buttons are good quality Great fit and finish Simple plug and play 3-year frequency 145 145 145 i i i,k , tstart i ≤ tprop i,k 2.1.2 Predicting future aspect trends for products. In practice, prod- ucts are released at different times and start receiving reviews over time. Consider in a discrete time period T = {0, . . . ,T }, the product network is evolving and Gt = {Pt , Et } is the product network snap- shot at time t ∈ T . Pi ∈ Pt >tstart only occurs after its proposed time tstart in the monotonically increasing product node list Pt i over time. The product similarities edge set Et and its weighted adjacency matrix Aw t are also changing as t changes. Products begin receiving reviews once become available to customers, therefore the corresponding review lists Ri (t; tstart ) = Ri,t are also expand- ing over time. Any review ri,k in Ri,t = {ri,1, . . . , ri,|Ri,t | } also has a proposed time tprop ≤ t, For simplicity, assume Ri,t is ordered by ascending review proposed time. Now V l i will be V l i,t with reviews up to Ri,t , and the product-aspect association vector i to V l becomes ui,t by replacing the V l Let the above t be the present time, and xi,t be the node feature of Pi in Gt . Suppose at a future time t ′ = t + Δt, the product aspect vector and the top-Kl aspect label vector is ui,t ′ and yi,t ′ . The Δt- future product aspect forecasting problem at time t is to predict yi,t ′ using xi,t and Gt . Moreover, we are interested in forecasting top product aspects yi,t +Δtn at multiple future with NΔT different time NΔT lengths ΔT ≜ {Δtn } n=1 simultaneously using information till t. In practice, the accessible information is till the present t (referred to as 'now'). Yet setting 't at now' to an earlier stage will therefore meet with the old product that is earlier 'new', together with a smaller product network that has fewer products with shorter review lists. i,t in Eqn (1). 2.2 Motivations and challenges of the problem 2.2.1 Motivation. We illustrate the motivation of the product as- pect forecasting problem. In a large e-commerce system, existing products keep receiving reviews from buyers, and sellers continue to release more and more new products (Fig. 1). The high-level tar- get of this problem is predicting the customer feedback for products in the long future: e.g., what will be the top aspects of a new product six months or three years later? This problem might be easier to answer for products with long histories - they have many customer reviews, thus simply extracting all aspects till now and counting the most frequent ones can already obtain statistically significantly sat- isfying results. However, for the larger and more important group of newly released products with limited reviews, such a strategy will give a much less reliable aspect forecasting, as aspects that currently have low frequency might be frequently mentioned in future reviews. On one hand, customers cannot trust products with less accurate aspects prediction; on the other hand, sellers worry about long-history products monopolizing the market. Therefore, a robust and reliable solution clearly relieves the dilemma that new products have limited reviews to help forecast on both the seller and customer side despite the non-trivial problem nature. 2.2.2 Challenges. Forecasting aspects for 'new' products can not be effectively achieved by trivially aggregating mined results from aspect mining methods, as the number of reviews is limited besides their subjectiveness. Also, the scale of reviews can be very large and aspect list length L can also be large in practice, leading to high sparsity of positive associations and extremely imbalanced aspect frequencies (Table 2). Therefore the top-K aspect retrieving formulation also introduces association sparsity and extremely imbalanced aspect frequencies, making it more challenging. Another challenge is that the 'new' products are distributed at different time points, resulting in unaligned review list series evolving processes. It is because reviews will keep occurring for products once they are released, and all the products will receive different reviews at different times. Since forecasting aspect trends for the 'new' products with limited reviews is more important and challenging, trivially training a graph neural network from a single product graph is also not effective. The evolving product-review associations and product similarities need to be efficiently extracted, aggregated, and embedded across the whole time range to avoid over-fitting effects. The third challenge is that the aspect evolving trends will be quite different in shorter and longer time periods, as yi,t ′ will reflect the genuine converged customer feedback when Δt → ∞ and the recent popular thoughts from customers when Δt is small. Therefore predicting top aspect trends for products at different Δt future indicates capturing different stages of product evolving from the entire 'new' (with limited reviews) to 'old' (with adequate reviews) evolving process from time to time. Trivially using one single product embedding at current time t without further future- length aware adjustment will result in unsatisfactory performance. 3 METHODS We propose ForeSeer, a textual mining and product embedding framework progressively trained on temporal product graph to predict the dynamic product embeddings at a future time point t + Δt using all information till the current time point t. ForeSeer then exploits the product embeddings to predict the top aspects of that future time. ForeSeer is a three-stage framework (Fig. 3). In the first stage, we exploit contrastive learning to co-embed reviews and aspects, leveraging the aspect semantic information to acquire better review embeddings. We resample review-aspect associations to increase the presence of rare aspects so that the review em- beddings can be less biased to frequently-appeared aspects. In the second stage, we progressively train the product graph embedding network on the temporal product graph. This helps ForeSeer see more new products and the new reviews they received, as well as evolving product similarity information, resulting in an efficient product embedding alignment. In the third stage, we develop a CIKM '23, October 21–25, 2023, Birmingham, United Kingdom. Zixuan Liu et al. Figure 3: ForeSeer first resamples review-aspect associations and co-embed aspects and reviews. It then progressively embeds products leveraging temporal product graphs. Finally, it exploits temporal information to adjust product and aspect embeddings to provide multi-time future forecasting. novel Product-Aspect Temporal Attention (PATA) module to fur- ther adjust product embeddings with the help of learned aspect embeddings. PATA module helps to forecast future product-aspect associations with explicit consideration of temporal information, thus providing time-sensitive forecasting. 3.1 A base model We first introduce a base model that extends aspect mining methods for aspect forecasting and later contrast this base model with Fore- seer to clarify the key technical ideas of ForSeer. Let R = {r j } |R| j=1 be the list of reviews collected from all products. The base model builds a BERT-based textual encoder that is pretrained on all reviews with the mask language modeling (MLM) objective [10]. The model can then be used to embed r j as hj = BERT(r j ). At present time t ('now'), the learned review embedding hj can then be aggregated to the product Pi they belong to as fi via an aggregator function. Let Ri be the review list of Pi at time t and ri,k ∈ Ri be one of the review of Pi , the aggregation process is: fi = Agg({hi,k |ri,k ∈ Ri }). (2) The base model then leverages xi = [fi ; SEi ] as a node feature of Pi and trains a graph neural network on the last observed product graph Glast to further get a product embedding Zlast . Here, SEi is the static product-specific embedding that encodes other product- related information, such as seller descriptions, which will not change over time. Let Aw last be the weighted adjacency matrix of Glast , and X be the product node feature matrix of all products that make up xi , where Pi ∈ Glast . Let σ be an activation function and H (0) = X , for H (lp ) , the output of the lp -th GNN layer we have: last H (lp −1)W lp ]). w H (lp ) = σ ([A (3) Let Zlast = H (Lp ) be the resulting embedding matrix of all products after the final layer, its i-th row zi is the embedding of Pi and is used to get the prediction of top aspects in the future. Suppose NΔT we are interested in multiple futures ΔT ≜ {Δtn } n=1 , we use NΔT NΔT n=1 to map Zlast and different Δtn to classifier heads {CLSP→A,n } the prediction ˆyi,t +Δtn for different future t + Δtn. They are finally optimized with a multi-time multi-label cross-entropy objective: ˆyi,t +Δtn = CLSP→A,n (zi, Δtn), L (i ) P→A = 1 NΔT * |L| NΔT ∑︁ |L | ∑︁ n=1 l=1 −yl i,t +Δtn log ˆyl i,t +Δtn (4) . 3.2 Mining aspect to enhance review embedding The major limitation of the base model is it only pre-trains the language model using review texts instead of clearly capturing the review-aspect association. Because reviews are usually long and subjective (Table 1), it is very inefficient to capture signals of potential aspects from the embedding of the entire review text. Also, to have more descriptive and diverse aspects, the aspect list can be very long. Under this situation, the positive aspect association in review texts will be very sparse, and the aspect distribution can be really imbalanced and long-tailed. We thus propose to refine the review embedding by fine-tuning the review encoder to mine aspect associations. The key intuition is to embed the review focusing on representing sparse aspect associations. Specifically, given a review text r j , we fine-tune its embedding hj to capture the review-aspect association vector ˆvj with a classifier head CLSr →a (.) and a multi-label cross-entropy loss objective: ˆvj = CLSr →a (hj ); L ( j ) cls,r →a = 1 |L| |L| ∑︁ −vl j log ˆvl j . (5) l=1 Note that here the association between the review texts and the resulted aspects will not change with time; it is therefore compati- ble to combine this objective with the MLM objectives [10] in the BERT pre-training stage. The resulting prediction of the association of the review aspect ˆv can be viewed as part of the refined review embeddings. For instance, the updated representation h′ j = [hj ; ˆvj ] can be the concatenation of BERT embedding and predicted as- sociation vectors. Having it can thus better capture sparse aspect association information during review aggregation using Eqn. (2). 3.3 Aspect-guided review embedding matching However, the limitation of the above refinement is that it has no idea that some aspects might describe similar meanings. It thus lacks the ability to efficiently capture the tail aspects that might have a similar meaning to the top frequent aspects but are rare and more diverse. Incorporating class names is useful when classes have their own description [40]. Therefore, our next key improve- ment is to jointly embed reviews and aspects through cross-domain contrastive learning. The key intuition is that by also embedding as- pects, tail aspects can be closer to head popular aspects if they have similar semantic meanings. The resulting aspect embeddings can therefore guide two review embeddings to be closer if they point to aspects with similar meanings. Moreover, if we treat the base FrequencyAspectFrequencyAspect1.Wearing this soft shirt is relaxing... 2. Quality is good. The inside of it is really soft...3. It's soft, comfy but not warm.... Soft inside:124Comfortable:871Good quality: 10,031Warm:2,793Aspect listAspect guided temporal adjustmentNowLooks good:5,192List of reviewsproduct6 months-12 months -6 months12 months36 months1.Soft inside2.Comfortable3. WarmTop aspects1. Comfortable2. Soft inside3. Looks goodTop aspectsTop aspects1.Looks good 2.Comfortable3.Soft insideaspectreview ForeSeer: Product Aspect Forecasting Using Temporal Graph Embedding CIKM '23, October 21–25, 2023, Birmingham, United Kingdom. j and ˆv(αm ) j model as a review feature extractor, training a cascaded contrastive learner will enable an effective way to train multiple review feature extractors and incorporate resampling and ensemble techniques. Specifically, we train multiple feature extractors by instantiating M base aspect extraction replicas with different reweighting factors α1, ..., αM in addition to the standard aspect extraction instance (α0 = 0). We use h(αm ) to denote the trained features output by the m-th replica follows Eqn (5). We then downsample frequent aspects to encourage the model to focus on review-aspect associations from infrequent aspects. For replica m, we first con- struct a bin for each aspect by assigning reviews that have positive associations with that aspect. Here, a review might be allocated to multiple aspect bins. We thus apply the resampling strategy hier- archically, which chooses the l-th aspect bin with probability pl by reweighting and then normalizing the importance of the aspect based on the reciprocal of the αm-reweighted aspect frequency: pl = w (m) l (cid:205)l w (m) l , w (m) l = ( 1 f req(Al ) )αm , αm ≥ 0. (6) The reweight factor αm leads the model to focus more on the aspects of tail (large αm) or head (small αm). αm = 0 corresponds to the standard aspect extractor that conduct uniform sampling. Then, a review r j is sampled from the chosen aspect bin with an assigned importance weight based on the number of review-aspect associations and the reweighted aspect importance. This resampling strategy enables the possibility to ensemble the features from all M feature extractors and perform mixture- of-experts (MoE) learning in the contrastive learner. We can now exploit contrastive learning to co-embed reviews and aspects so that the embedding of reviews can pay more attention to rare aspects. Specifically, we first build review and aspect embedding networks ER and EA with the same output dimension d. ER encodes the embeddings of the review r j and the predicted associations from all replicas of the extraction of aspects simultaneously and matches them into a calibrated embedding of the review zre : j ; ...; h(αM ) j j = ER (CONCAT([hj ; ˆvj ; h(α1 ) re (7) z For aspect Al , we use SpanBERT [22] to get the pre-trained ; ˆv(αM ) j ; ˆv(α1 ) j asp features and feed it into EA to get the aspect embedding z l ]). j asp z l = EA (SpanBERT(Al )). asp We then utilize the aspect embeddings z l optimization of the calibrated review embedding zre using the inner product of zre asp sl j = (z z l asp j and z l ; Z asp = [z : asp 1 j )T re j )T Z asp = [s1 re j ; . . . ; s |L | j asp ; . . . ; z ]; |L | ] ∈ R|L | . sj = (z of Al to guide the j of review r j : (8) (9) We finally employ a multi-label cross-domain contrastive loss similar to NT-Xent loss [56] to maximize positive association and minimize negative association denoted by vj : LCL (sj , vj ; τ) = − log vl j exp (sl (cid:205)k exp (sk j /τ) j /τ) . ∑︁ l (10) By jointly learning an informative, low-dimensional embedding space for reviews and aspects, the resulting sj has two advantages. First, it will efficiently ensemble learnings from multiple aspect extraction replicas, thus more effectively capturing tail aspects. Second, by minimizing Eqn (10), sj will encode the ranking infor- mation of the aspects for r j . This indicates a more flexible way to retrieve Ka positive associations. By simply tuning Ka, more (recall-inclined) or less (precision-inclined) positive associations can be given, resulting in a more flexible aspect extraction module. 3.4 Progressive temporal graph-based product embedding The major limitation of the graph-based product embedding module of the base model is that it is only trained on the last observed product graph snapshot with the product features at that time. In fact, only a small ratio of products are 'new' in the last observed graph snapshot. This leads the model to have severe overfitting effects. We thus propose to progressively train the model on the temporal product graph snapshot series rather than only on the last observed graph. The key intuition is that the model can not only see more 'new' products during training but also be aware of the other temporal evolving information, including product similarities and how a product becomes from 'new' to 'old' by receiving more and more reviews. Without loss of generality, we now let t ∈ T be a time point we want to train our model at and let the graph be the snapshot Gt at that time. To enable progressive training, multiple fixations are needed. First, the feature vectors of product nodes need to be aware of the evolving temporal information, such as the related information of the progressive product-aspect associations until time t. Given a review ri,k ∈ Ri,t , the review list of Pi at time t, we aggregate the learnt embedding zi,k and the predicted review- aspect association si,k for all reviews in Ri,t to acquire the product feature fi,t of Pi at time t: fi,t = Agg({CONCAT([zi,k, si,k ])|ri,k ∈ Ri,t }). (11) We then incorporate the related temporal information of Pi at time t. Similar to the positional embedding [61], the 2d-dimensional temporal embedding of a discrete-time index t0 is: Embt0 = [sin(ω1t0), cos(ω1t0), . . . , sin(ωdt0), cos(ωdt0)]. (12) For Pi at time t, there are three pieces of temporal information , the training . The that need to be incorporated: its proposed time tstart i time t and the gap between these two times tgap = t − tstart i resulting temporal embedding therefore has three sub-parts: i T emb i,t = CONCAT([Embtstart , Embt , Embtgap ]). i We then compose the overall node feature vector xi,t for Pi at i (13) training time t with three parts of features mentioned before: xi,t = CONCAT([fi,t ;T emb ; SEi ]). i,t (14) Let Aw t be the normalized weighted adjacency matrix of Gt , to enable progressive training, we sequentially train the graph neural , . . . , GtQ |tq ∈ T }. We network at a subset of graph snapshots {Gt1 further refine the GNN layer that contains an extra multi-layer perceptron (MLP) module that focuses on learning product-specific information. Specifically, let W l be the weight tq−1 matrix of l-th GNN layer and the extra MLP module after training and W l MLP,tq−1 CIKM '23, October 21–25, 2023, Birmingham, United Kingdom. Zixuan Liu et al. Figure 4: UMAP plots visualizing product embeddings at day 0 (a), day 30 (b), day 300 (c), and aggregation of product embeddings at all of the three time points (d). the network on Gtq−1 and let H (0) process in Eqn (3) will be updated at tq as: tq = xi,tq , the product embedding 4 EXPERIMENT H (lp ) tq = σ (CONCAT([A w tq H (lp −1 ) tq W lp tq−1 ;W lp MLP,tq−1 H (lp −1 ) tq ])). At present time t, we take Z P (15) t = H (Lp ) got on Gt as the resulting product embedding matrix. By progressively updating the network, ForeSeer can see more new products and how they 'grow' from 'new' to 'old', which is helpful in efficiently aligning the product embedding. t 3.5 PATA: Aspect-guided product embedding adjustment for multi-future forecasting One limitation of the base model is it uses only one product embed- ding for all Δtn future predictions without any refinement when capturing future product-aspect associations. We thus develop a novel multi-head product-aspect temporal attention (PATA) module to adjust product embedding based on learned aspect embedding Z asp . Our intuition is to adjust product embedding with a desig- nated attention module guided by aspect embedding. This novel design empowers ForeSeer with the ability to predict both short and long-future time ranges with lower computational costs. query network EPQ query matrix from Z P Specifically, given NΔT target futures, for each Δtn, we set up a Δtn to get the product Δtn and a key network EAK t and aspect key matrix from Z asp : t +Δtn = EPQ (Z P QP t ). Δtn Kasp = EAK (Z asp ) Δtn t +Δtn We then calculate cross-attention score Attnt +Δtn between prod- (16) uct query and aspect key for Δtn future: (Kasp t +Δtn √ d Attnt +Δtn = So f tmax ( t +Δtn QP )T ) ∈ R| Pt | × |L | . (17) We then set up a shared value network EV val that takes Z P and outputs value matrix V alP row of V alP for Pi , we obtain the final product embedding for Δtn future as: t as input t . Let vali,t and attni,t +Δtn , the i-th t and Attnt +Δtn , be the value and attention score vector f inal z i,t +Δtn = attni,t +Δtn ◦ vali,t . (18) We next exploit the final product embedding to get the final predic- tion using Eqn (4). With the above design, we can acquire different product embedding for different Δtn future prediction tasks. Using a shared value network is especially efficient when NΔT is large and d ≪ |L|. This also regularizes the model by sharing weights for learning multiple imbalanced top-Kl aspect retrieving tasks. In this section, we evaluated ForeSeer on a large scale e-commerce dataset with a variety of tasks, aiming to answer the following research questions (RQs): • RQ1: How does ForeSeer perform on product aspect forecast- ing without or with genuine annotated aspects for reviews? • RQ2: Is ForeSeer sensitive to aspects with long trends? • RQ3: How does different components contributes to the success of ForeSeer on capturing review-aspect associations? • RQ4: Is the PATA module in ForeSeer able to capture tem- poral information for different lengths of future? • RQ5: How does the product embedding captured by ForeSeer evolve over time? 4.1 Experimental setup 4.1.1 Dataset. We evaluated our ForeSeer framework on a large- scale e-commerce dataset that contains a dynamic product network with 11,536,382 time-stamped review events in a three-year period. The product network is a series of homogeneous dynamic product similarity graphs with 1,096 daily time-stamped snapshots. The final graph has 11,000 product nodes from 418 different product types based on their name, high-level property, and usage, such as "Lamp", "TABLE", and "Caddy". The unpublished product nodes will not be added to the graph until their proposed times are reached. The average start date of products is 77. The first snapshot has 999,614 edges and the final snapshot has 2,400,404 edges. Each edge represents a similarity ranging from 0 and 1 between the two prod- ucts. We calculate the similarities based on multiple factors such as user click information. We obtained an aspect list with 10,000 pop- ular aspects extracted via sequential extraction tools [76, 77] and 30,217,638 review-aspect associations from these reviews. We con- structed the top-Kl (Kl = 10) aspects label for every product node at all timesteps by aggregating all the review-aspect associations it has and picking up the top-ranked aspects after normalization. Exam- ple head and tail aspects with their frequency over three years are shown in Table 2. While the top 3 aspects have more than 1,000,000 counts, the tail aspects only have 150 counts from more than 11 million review texts, demonstrating extreme aspect imbalances. 4.1.2 Tasks. We studied ForeSeer with three challenging tasks: single review-aspect association prediction, multi-time aspect fore- casting, and multi-time link prediction. Single review-aspect association prediction: We model the single review-aspect association prediction as a multi-label classifi- cation problem. We split 80% of the reviews as the training set and leave the remaining 20% as the test set. Multi-time aspect forecasting: To further assess the effectiveness of the learned review associations, we tested the multi-time aspect ForeSeer: Product Aspect Forecasting Using Temporal Graph Embedding CIKM '23, October 21–25, 2023, Birmingham, United Kingdom. Table 3: Performance of ForeSeer and comparison approaches on aspect forecasting at three different time gaps (3 months, 6 months, 3 years) under settings of with annotated aspects and without annotated aspects. Δt Method 3 months 6 months 3 years Frequency baseline MLP LSTM GRU GNN ForeSeer (Ours) Frequency baseline MLP LSTM GRU GNN ForeSeer (Ours) Frequency baseline MLP LSTM GRU OA-Mine GNN ForeSeer (Ours) Without annotated aspects With annotated aspects AUPRC 21.0 ±5.7 13.1± 7.2 17.0 ±6.0 17.3± 6.2 19.2 ± 6.6 84.1 ±7.2 20.2± 5.6 11.1± 7.1 14.9± 5.7 15.4± 5.9 18.1 ± 6.5 81.8± 7.7 18.6 ±5.4 10.2± 4.9 11.4± 5.0 12.1 ±5.2 5.9 ± 3.9 16.1 ± 6.3 68.5 ± 8.9 AUROC 84.8±4.1 89.8± 3.2 93.7± 2.5 93.6± 2.6 95.1 ± 3.8 99.9± 0.2 84.3± 4.2 88.4± 3.5 93± 2.8 92.9 ±2.8 93.8 ± 3.5 99.8± 0.2 83.8 ±4.2 86.3 ±3.0 90.3 ±3.3 90.3 ±3.3 78.6 ± 5.9 92.1 ± 3.1 98.9± 1.1 Kappa 28.6 ±6.2 4.5 ±4.3 6.5 ±5.1 7.0 ±5.5 25.1± 8.1 75.8± 7.9 27.5± 6.2 4.3 ±4.1 6.6 ±5.2 6.7 ±5.3 23.0± 7.7 74.2± 8.1 25.4± 6.1 3.1± 3.0 5.8± 4.9 6.0 ±5.1 3.4 ± 2.7 20.9± 7.1 65.6 ± 8.5 Max F1 37.4 ±5.6 25.1± 6.5 29.6 ±6.1 30.1± 5.5 32.3± 6.8 83.9 ±5.9 36.1± 5.6 23.5± 6.7 27.5± 6.0 28.1± 6.2 29.4± 6.7 82.2 ±6.3 34.0± 5.6 21.2± 5.3 23.4± 5.7 24.4 ±5.9 6.1 ± 2.6 28.6± 6.6 73.2 ± 6.9 AUPRC 91.2 ±4.2 14.6± 7.7 17.4 ±6.1 18.2± 6.2 20.9 ± 6.5 80.2 ± 8.4 87.4 ±5.1 13.9± 7.5 15.3 ±5.8 16.2± 6.0 19.3 ± 6.4 82.3±8.6 81.0± 6.1 11.7± 5.3 12.0± 5.2 13.1± 5.4 5.9 ± 3.9 17.3 ± 6.4 83.6 ±7.9 AUROC 96.9± 2.0 91.3 ±2.9 93.8 ±2.6 94.0 ±2.6 97.2± 3.9 99.9 ±0.1 96.4 ±2.2 90.9 ±2.7 93.0 ±2.9 93.3± 5.6 95.9± 3.3 99.7 ±0.3 96.2± 2.3 89.7 ±4.2 90.3 ±3.5 90.7±6.7 78.6 ± 5.9 93.0± 2.7 99.9± 0.1 Kappa 86 ±5.4 4.9 ±4.1 7.3 ±5.5 5.9 ±5.3 24.9± 7.0 72.3 ±8.2 81.8 ±6.0 5.1 ±4.0 7.2 ±5.5 28.9 ±6.3 22.9± 6.9 73.6 ±8.5 75.8 ±6.5 5.5± 5.2 6.6± 5.3 5.9±5.1 3.4 ± 2.7 20.6± 6.9 74.7 ± 7.7 Max F1 90.0± 4.2 28.5 ±7.1 30.1 ±6.2 31.0 ±6.3 34.2 ±6.6 80.0± 7.2 86.3 ±4.9 27.6 ±6.8 27.8± 6.1 26.3 ±5.3 31.9 ±6.6 82.6±6.9 81.2± 5.3 23.3± 6.1 24.1± 6.0 25.1±6.0 6.1 ± 2.6 29.7 ±6.5 82.8± 6.4 forecasting task with two settings: (i) ground truth association accessible, (ii) only learned approximate association accessible. For this task, we chose to predict Δt = 3, 6 months and 3 years (always predicting the last observed label) at every test timestep t. We use the label at the final time if the target future time is out of range. We aimed to test the inductive performance by randomly splitting 10% nodes out as the test set. Multi-time link prediction: For multi-time link prediction, we chose to predict the link at the current time, 180 days later, and at the final time at every test time t. The positive edge ratio is 50%. 4.1.3 Comparison approaches. There is no existing framework that directly handles the multi-time aspect forecasting problem. We therefore designed and compared our method with four types of baselines. Frequency baseline directly aggregates the association learnt in section 3.2 at time t and uses it as the prediction. It can not incorporate other information and the performance will highly de- pend on the quality of learned aspect associations from reviews. We aim to assess the effectiveness of the multi-time forecasting PATA module. MLP baseline directly predicts the multi-time future with product features without graphical information. Recurrent-based baselines (GRU, LSTM) predict multi-time future step-by-step by using an autoregressive network structure and also ignore graphi- cal similarity information. We thus aim to assess the importance of using graphical information. Graph-based baseline (GNN) leverages only the final graphical information Glast . We aim to assess the effectiveness of our progressive training process in mul- tiple Δt-future. Weakly supervised baseline (OA-Mine) directly mines candidate aspects from reviews and aggregates the candi- dates as the final predictions. We aim to assess the effectiveness of learned review-aspect associations and the importance of using learning-based models as this baseline does not leverage review- aspect association information. For multi-time link prediction tasks for different Δt-future, we only compare our method with graph-based baselines, since other baselines can not handle this task. We built an extra lightweight GNN for multi-task link prediction for our methods and a GNN baseline with the same network structure. For our method, we used features learned from our multi-head product aspect temporal attention module for different futures as the input for different future time predictions. For the graph-based baseline, we used the same features for different future time predictions. Implementation details. For the aggregation function Agg(.) 4.1.4 used to construct future aspect labels, we used sum(.) with per- aspect z-score normalization operation. Specifically, for each aspect, we got the sum of its occurred association for every product at the end of the time period and calculated the mean and standard deviation of them. We then performed z-score normalization on the sum of the associations of this aspect for every product at time t. We used mean(.) as the aggregator to get the aggregated feature fi,t of product Pi at time t. We maintained both the predicted logits and the binarized association prediction from si,k . We incorporated a pre-trained product embedding obtained from a multi-modality neural model that encodes information from the product title and descriptions to construct the auxiliary product embedding SEi . For simplicity, we only trained one resampling replica with α = 0.5 and match its embedding with embedding learned by standard aspect extraction replica (α = 0). We used AdamW as the optimizer and 10−4 as the learning rate to train the aspect-guided embedding match model for 10 epochs on four 16GB Nvidia-V100 GPUs and set the number of retrieved positive associations Ka = 5 for better precision performance. We used a two-layer MLP with ReLU for all the embedding networks and a linear projection layer for all query and key blocks. All the embedding, query, and key vector output dimensions are 100. To avoid the over-smoothing problem, we used a GNN with one designed graph neural layer and two cascaded MLP layers. We used the same network structure for the GNN baseline. For the MLP baseline, we used a two-layer MLP with a hidden size of 128, for GRU and LSTM baseline we set the number of the layer as 2 with a hidden size of 128. For the lightweight GNN for multi-task link prediction task, we used a standard GraphSAGE layer and one cascaded MLP layer. We used Adam as the optimizer and 10−3 as the learning rate and trained all aspect forecasting and link prediction tasks for 200 epochs on a 16GB Nvidia-V100 GPU. CIKM '23, October 21–25, 2023, Birmingham, United Kingdom. Zixuan Liu et al. Table 4: Case study showing the aspected we predicted for skin moisturizer. Our method identified time-sensitive phrases (red) while the frequency baseline failed to identify them. Product type Count baseline prediction with one month reviews ForeSeer prediction with one month reviews Final Label (Ground truth) Skin moisturizer Smooth, Feels great, Product is great, Clean, Light weight, Soothing, Love this product, Dries quickly, Works great, Great price Smooth, Clean, Great price, Product is great, Soothing, A little goes a long way, Sensitive skin, Light weight, Not greasy, Good quality Smooth, Love the texture, Light weight, Product is great, Soothing, Great price, A little goes a long way, Sensitive skin , Fragrance free, Not greasy 4.2 Experimental results 4.2.1 Improvement on aspect forecasting without annotated aspects (RQ1). We first investigated the performance of ForeSeer on aspect forecasting when aspects are not annotated in the review (Table 3). We found that our method achieved the best performance on all three pieces of time gaps (3 months, 6 months, and 3 years), indicat- ing that our temporal graph embedding framework can effectively model the dynamics of aspects and products. For instance, ForeSeer obtains 63.1% and 49.1% improvements on 90-day gap forecasting and 3-year gap forecasting, respectively. We found that the fre- quency baseline didn't perform well on this task, especially when the time gap is larger, further confirming the importance of aligning products temporally. We found that the GNN baseline has undesir- able performance, demonstrating the effectiveness of progressive training on avoiding over-fitting. We found that the MLP, GRU, and LSTM baselines performed badly on all future forecasting, neces- sitating the importance of graphical information. We also found that two temporal baselines outperform the MLP baseline, suggest- ing the importance to adjust product embedding for multi-time forecasting. We found that OA-Mine, one of the state-of-the-art ap- proaches in aspect mining, obtained a less prominent performance, indicating that aspect mining methods cannot be applied to this novel aspect forecasting task. Finally, we noticed that graph-based approaches GNN, in general, performed better than methods that do not consider graphs, necessitating the consideration of graph dynamics in this task. 4.2.2 Improvement on aspect forecasting with annotated aspects (RQ1, RQ2). We next evaluated an easier setting where aspects are annotated in each review. In this setting, the frequency baseline achieved very good performances since it simply counts the as- pects in current reviews and uses it to predict future aspects. For aspects that are not time-sensitive, the frequency baseline can be regarded as an upper bound. Nevertheless, we found that ForeSeer still achieved good performance in this setting, where ForeSeer showed comparable performance with the frequency baseline on a 6-month gap and even outperformed the frequency baseline on a 3-year gap. All other comparison approaches obtained a much less promising performance. This indicates that ForeSeer can obtain a comparable performance with the frequency baseline on aspects that are not time-sensitive and substantially better performance on aspects that are time-sensitive. To further examine this (RQ2), we illustrated one case study showing how ForeSeer can effectively rec- ognize long-term aspects (Table 4). ForeSeer corrected forecasted time-sensitive aspects such as "a little goes a long way" and "sensi- tive skin", while the frequency baseline failed to identify, reassuring ForeSeer's ability to forecast long-term future aspects. 4.2.3 Improvement on predicting review-aspect association with em- bedding matching (RQ3). Next, we examined the importance of the aspect-guided embedding matching strategy by performing an ab- lation study on the review-aspect association prediction (Fig. 5). We observed the limited precision performance of using either with or without resampling multi-label classification instances, leading to poor ability or focusing too much on capturing tail aspect asso- ciations. Instead, we observed substantial improvements from our aspect-guided embedding framework by successfully exploiting the advantage of two multi-label classification instances. For exam- ple, the precision of our precision-inclined embedding matching model (Ka = 5) is 22% and 34% higher than the with or without resampling multi-label classification instances. The superior preci- sion performance suggests the learned review embeddings guided by aspects concentrate less-biased features for both head and tail aspects, which is critical to their success. Figure 5: Bar plot showing the performance of our embed- ding match approach and comparison approaches on review- aspect association prediction evaluated using precision, F1 score, accuracy, and recall. Improvement on predicting future links (RQ4). After confirm- 4.2.4 ing the superior performance of ForeSeer on aspect forecasting, we next investigated whether ForeSeer's PATA module is able to capture temporal information for multiple futures by letting it predict product-product edges that might emerge in the multiple fu- ture times (Table 5). We observed a consistent improvement of our methods over different time gaps compared to GNN. We adopted a multi-task prediction setting for efficient inference and training where predictions for different time gaps are treated as different tasks. Specifically, we found that the GNN baseline cannot gen- eralize well on the intermediate-long future range (6 months) as it didn't consider the dynamics when simultaneously predicting multiple time gaps. In contrast, our model addressed this by explic- itly modeling the temporal dynamics of products, confirming that ForeSeer can effectively capture both product and aspect dynamics. 4.2.5 Contrasting static and temporal embeddings (RQ5). We fur- ther visualized the dynamic product embedding space colored by their product types at different time steps to assess how ForeSeer captures the temporal pattern (Fig. 4). As the time step becomes PrecisionF1scoreAccuracyRecall0.20.30.40.50.60.70.8Scorew/oresamplingw/resamplingEmbeddingmatch(Ka=3)Embeddingmatch(Ka=5) ForeSeer: Product Aspect Forecasting Using Temporal Graph Embedding CIKM '23, October 21–25, 2023, Birmingham, United Kingdom. Table 5: Comparison of ForeSeer and GNN on predicting future links at three different time points (current, 6 months, 3 years). Δt−future Approaches Current (0 day) Baseline GNN ForeSeer (Ours) Baseline GNN ForeSeer (Ours) Baseline GNN ForeSeer (Ours) 6 months 3 years Accuracy 88.32± 0.54 92.64 ± 0.53 18.36 ± 0.32 85.12 ± 0.51 80.28 ± 0.48 84.25 ± 0.51 Precision 85.29 ± 0.37 92.68 ± 0.35 10.93 ± 0.24 92.96 ± 0.38 77.95 ± 0.35 92.95 ± 0.44 Recall 91.28 ± 0.72 92.66 ± 0.69 89.02 ± 0.72 91.87 ± 0.78 87 ± 0.63 87.31 ± 0.88 F1 score 88.13 ± 0.61 92.65 ± 0.58 19.49 ± 0.23 92.37 ± 0.55 82.03 ± 0.77 86.39 ± 0.64 AUPRC 94.64 ± 0.88 97.54 ± 0.83 89.13 ± 0.84 92.21 ± 0.87 92.24 ± 0.88 94.08 ± 0.96 AUROC 94.73 ± 0.76 97.66 ± 0.75 44.79 ± 0.24 74.91 ± 0.49 89.34 ± 0.81 91.75 ± 1.02 larger, we observed more visible clustering patterns among prod- ucts. This suggests that the quality of the product embeddings becomes better as the data is accumulated by modeling the tempo- ral dynamics. We also noticed the product embedding similarity reflects edges in the product-product graphs ("shelf" and "caddy", "lamp", "light fixture" and "string light"), indicating these product embeddings successfully encode graphical information. 5 RELATED WORKS Product aspect mining. Few work that tries to forecast aspects for products and most previous works only aim at product aspect min- ing tasks. Mining product aspects from large-scale commercial data has been a well-studied problem [7, 15, 25, 53, 77]. Previous works target the problem using rule-based [7, 25, 53], supervised learning based extractor [4, 18] or propagation-based methods [35, 46]. These works are less generalizable to product aspect forecasting, as they require either domain-specific features or supervision signals from downstream tasks such as sentiment or opinion labels. Recently, other works similarly extract descriptive product attributes from seller-provided product profiles by using sequential supervised textual span labeling information [29, 64, 70, 76, 93] or distant su- pervision [65, 83]. OA-Mine [84] leverage weakly-supervised seed set to mine aspects from product titles. These methods need either more costly massive sequential labeled datasets or predesigned hi- erarchical attribute taxonomy, which is hard to obtain for customer- centered aspects. Zero-shot aspect extraction is another recently emerged related topic that aims to extract aspects in new domains without annotated data by leveraging transfer learning [17], natural language inference [54], document sentiment classification [9] and the recent emerged super-scale ChatGPT [44] and GPT-4 [2]. How- ever, the zero-shot indicates that no prior knowledge of the new domain is needed instead of the number of reviews being limited for products. They are thus not directly applicable to forecasting tasks. In summary, all the methods above focus on text sequence level extraction and do not efficiently aggregate learned attributes at the product level. They are thus useful to help construct the aspect list for product aspect forecasting tasks, but are not able to forecast fu- ture aspect trends. Unlike these methods, our methods are the first framework that can forecast aspects that might be mentioned in future reviews for a new product with a limited number of reviews. Label-guided classification. Label-guided text classification has been studied in fields such as social recommendation and document classification [6, 32]. It has been proven to be beneficial for classifi- cation performance [37, 68]. While these methods focus on classifi- cation, our method provides an efficient cross-domain contrastive learning framework that can easily ensemble these models as ex- pert multi-label classification instances. Compared to [63], which also proposes to mix multiple encoder instances, our representa- tion learning scheme allows the model to also produce informative reviews and aspect representations to help downstream tasks. Temporal graph learning. Temporal graph-based representation learning has been intensively studied [14, 49, 74]. Previous works either incline on graph structure [28, 43, 52, 87, 91] or temporal dynamics [21, 38, 41, 59, 60, 72]. The dynamic graph structure is extracted by graph adjacency dynamics [12, 30], skip-gram-based modeling [11, 39, 95], leveraging clique information [16, 81, 90], step-by-step embedding updating [3, 13, 31, 33, 47, 55, 92]. These methods only focus on capturing implicit or short graphical dy- namics changing and can not efficiently model large-scale review- aspect associations and evolving product-review associations. Some methods are designed specifically for heterogeneous networks [19, 66, 82, 85, 86]. Temporal-dynamic focused methods leverage recurrent-based models [1, 8, 23, 67, 94], continuous point process modeling [5, 50] and self-supervised graph representation learn- ing [57, 58]. These methods focus on modeling interactive events between nodes, but are not suitable for modeling dynamic prod- uct similarities and massive product-review associations. Some methods leverage self-attention, hierarchical, or temporal atten- tion [20, 36, 51, 69, 75, 78, 89], but only for temporal information aggregation, while our PATA module leverages attention to pre- dict multiple time range future simultaneously. Other recent works such as EvolveGCN [45] and Roland [80] incorporate recurrent modules and efficient graph learning. These frameworks can be easily adapted to our progressive training framework, while we aim to clearly show that progressive training is the key success to in aspect forecasting with a simple yet clear formulation. JODIE [27] is the closest work that can also predict multiple time-range futures with a time projection module. However, it is based on interac- tion events and is designed for heterogeneous user-item networks, making it impractical for our use case. In summary, most of the existing works can not be directly applied to the product aspect forecasting task because of the training efficiency and inability to handle large-scale reviews. 6 CONCLUSION In this paper, we have studied a novel task of product aspect fore- casting, which aims to predict aspects that users might mention in future reviews. We have proposed a novel framework ForeSeer to solve this task by dynamically embedding products, reviews, and aspects. We have evaluated our method on a large-scale real-world dataset and observed ForeSeer's superior performance on aspect forecasting and link prediction. In the future, we are interested in boosting ForeSeer with more advanced progressive training strate- gies. We are interested in applying ForeSeer to other temporal graph embedding frameworks, such as modeling biological signal- ing pathways. We are further interested in exploring how ForeSeer can assist the classic task of aspect mining, allowing us to apply ForeSeer to advance a larger number of e-commerce applications, such as integrating it with recommendation systems to enhance the product suggestions based on anticipated aspect preferences. CIKM '23, October 21–25, 2023, Birmingham, United Kingdom. Zixuan Liu et al. REFERENCES [1] Alex Beutel, Paul Covington, Sagar Jain, Can Xu, Jia Li, Vince Gatto, and Ed H Chi. 2018. Latent cross: Making use of context in recurrent recommender systems. In Proceedings of the Eleventh ACM International Conference on Web Search and Data Mining. 46–54. [2] Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. 2023. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712 (2023). [3] Lei Cai, Zhengzhang Chen, Chen Luo, Jiaping Gui, Jingchao Ni, Ding Li, and Haifeng Chen. 2021. Structural temporal graph neural networks for anomaly de- tection in dynamic graphs. In Proceedings of the 30th ACM international conference on Information & Knowledge Management. 3747–3756. [4] Abir Chakraborty. 2022. Aspect Based Sentiment Analysis Using Spectral Tem- poral Graph Neural Network. arXiv preprint arXiv:2202.06776 (2022). [5] Xiaofu Chang, Xuqin Liu, Jianfeng Wen, Shuang Li, Yanming Fang, Le Song, and Yuan Qi. 2020. Continuous-time dynamic graph learning via neural interaction processes. In Proceedings of the 29th ACM International Conference on Information & Knowledge Management. 145–154. [6] Eli Chien, Wei-Cheng Chang, Cho-Jui Hsieh, Hsiang-Fu Yu, Jiong Zhang, Ol- gica Milenkovic, and Inderjit S Dhillon. 2021. Node Feature Extraction by Self- Supervised Multi-scale Neighborhood Prediction. arXiv preprint arXiv:2111.00064 (2021). [7] Anjali Dadhich, Blessy Thankachan, and Blessy Thankachan. 2021. Social & Juristic challenges of AI for Opinion Mining Approaches on Amazon & Flipkart Product Reviews Using Machine Learning Algorithms. SN Computer Science 2, 3 (2021), 1–21. [8] Hanjun Dai, Yichen Wang, Rakshit Trivedi, and Le Song. 2016. Deep coevolu- tionary network: Embedding user and item features for recommendation. arXiv preprint arXiv:1609.03675 (2016). [9] Pengfei Deng, Jianhua Yuan, Yanyan Zhao, and Bing Qin. 2022. Zero-shot Aspect- level Sentiment Classification via Explicit Utilization of Aspect-to-Document Sentiment Composition. arXiv preprint arXiv:2209.02276 (2022). [10] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805 (2018). [11] Lun Du, Yun Wang, Guojie Song, Zhicong Lu, and Junshan Wang. 2018. Dynamic Network Embedding: An Extended Approach for Skip-gram based Network Embedding.. In IJCAI, Vol. 2018. 2086–2092. [12] Palash Goyal, Sujit Rokka Chhetri, and Arquimedes Canedo. 2020. dyngraph2vec: Capturing network dynamics using dynamic graph representation learning. Knowledge-Based Systems 187 (2020), 104816. [13] Palash Goyal, Nitin Kamra, Xinran He, and Yan Liu. 2018. Dyngem: Deep em- bedding method for dynamic graphs. arXiv preprint arXiv:1805.11273 (2018). [14] Jin Guo, Zhen Han, Zhou Su, Jiliang Li, Volker Tresp, and Yuyi Wang. 2022. Continuous Temporal Graph Networks for Event-Based Graph Data. arXiv preprint arXiv:2205.15924 (2022). [15] Minqing Hu and Bing Liu. 2004. Mining and summarizing customer reviews. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining. 168–177. [16] Hong Huang, Zixuan Fang, Xiao Wang, Youshan Miao, and Hai Jin. 2020. Motif- Preserving Temporal Network Embedding.. In IJCAI. 1237–1243. [17] Soufian Jebbara and Philipp Cimiano. 2019. Zero-shot cross-lingual opinion target extraction. arXiv preprint arXiv:1904.09122 (2019). [18] A Jeyapriya and CS Kanimozhi Selvi. 2015. Extracting aspects and mining opinions in product reviews using supervised learning algorithm. In 2015 2nd international conference on electronics and communication systems (ICECS). IEEE, 548–552. [19] Yugang Ji, MingYang Yin, Yuan Fang, Hongxia Yang, Xiangwei Wang, Tianrui Jia, and Chuan Shi. 2021. Temporal heterogeneous interaction graph embedding for next-item recommendation. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases. Springer, 314–329. [20] Pengfei Jiao, Xuan Guo, Xin Jing, Dongxiao He, Huaming Wu, Shirui Pan, Maoguo Gong, and Wenjun Wang. 2021. Temporal network embedding for link prediction via vae joint attention mechanism. IEEE Transactions on Neural Networks and Learning Systems (2021). [21] Guangyin Jin, Min Wang, Jinlei Zhang, Hengyu Sha, and Jincai Huang. 2022. STGNN-TTE: Travel time estimation via spatial–temporal graph neural network. Future Generation Computer Systems 126 (2022), 70–81. [22] Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S Weld, Luke Zettlemoyer, and Omer Levy. 2020. Spanbert: Improving pre-training by representing and predict- ing spans. Transactions of the Association for Computational Linguistics 8 (2020), 64–77. [23] Seyed Mehran Kazemi, Rishab Goel, Sepehr Eghbali, Janahan Ramanan, Jaspreet Sahota, Sanjay Thakur, Stella Wu, Cathal Smyth, Pascal Poupart, and Marcus Brubaker. 2019. Time2vec: Learning a vector representation of time. arXiv preprint arXiv:1907.05321 (2019). [24] Sung Guen Kim and Juyoung Kang. 2018. Analyzing the discriminative attributes of products using text mining focused on cosmetic reviews. Information Processing & Management 54, 6 (2018), 938–957. [25] Michael Y Kpiebaareh, Wei-Ping Wu, Brighter Agyemang, Charles R Haruna, and Tandoh Lawrence. 2022. A Generic Graph-Based Method for Flexible Aspect- Opinion Analysis of Complex Product Customer Feedback. Information 13, 3 (2022), 118. [26] KL Santhosh Kumar, Jayanti Desai, and Jharna Majumdar. 2016. Opinion mining and sentiment analysis on online customer review. In 2016 IEEE International Conference on Computational Intelligence and Computing Research (ICCIC). IEEE, 1–4. [27] Srijan Kumar, Xikun Zhang, and Jure Leskovec. 2019. Predicting dynamic em- bedding trajectory in temporal interaction networks. In Proceedings of the 25th ACM SIGKDD international conference on knowledge discovery & data mining. 1269–1278. [28] Jundong Li, Harsh Dani, Xia Hu, Jiliang Tang, Yi Chang, and Huan Liu. 2017. Attributed network embedding for learning in a dynamic environment. In Proceed- ings of the 2017 ACM on Conference on Information and Knowledge Management. 387–396. [29] Ning Li, Chi-Yin Chow, and Jia-Dong Zhang. 2020. EMOVA: A semi-supervised end-to-end moving-window attentive framework for aspect mining. In Pacific- Asia Conference on Knowledge Discovery and Data Mining. Springer, 811–823. [30] Taisong Li, Jiawei Zhang, S Yu Philip, Yan Zhang, and Yonghong Yan. 2018. IEEE Access 6 (2018), Deep dynamic network embedding for link prediction. 29219–29230. [31] Hao Liu, Shuwang Zhou, Changfang Chen, Tianlei Gao, Jiyong Xu, and Minglei Shu. 2022. Dynamic knowledge graph reasoning based on deep reinforcement learning. Knowledge-Based Systems 241 (2022), 108235. [32] Jingzhou Liu, Wei-Cheng Chang, Yuexin Wu, and Yiming Yang. 2017. Deep learning for extreme multi-label text classification. In Proceedings of the 40th international ACM SIGIR conference on research and development in information retrieval. 115–124. [33] Xi Liu, Ping-Chun Hsieh, Nick Duffield, Rui Chen, Muhe Xie, and Xidao Wen. 2019. Real-time streaming graph embedding through local actions. In Companion Proceedings of The 2019 World Wide Web Conference. 285–293. [34] Yao Liu, Cuiqing Jiang, and Huimin Zhao. 2019. Assessing product competitive advantages from the perspective of customers by mining user-generated content on social media. Decision Support Systems 123 (2019), 113079. [35] Guangquan Lu, Jiecheng Li, and Jian Wei. 2022. Aspect sentiment analysis with heterogeneous graph neural networks. Information Processing & Management 59, 4 (2022), 102953. [36] Yuanfu Lu, Xiao Wang, Chuan Shi, Philip S Yu, and Yanfang Ye. 2019. Temporal network embedding with micro-and macro-dynamics. In Proceedings of the 28th ACM international conference on information and knowledge management. 469– 478. [37] Qianwen Ma, Chunyuan Yuan, Wei Zhou, and Songlin Hu. 2021. Label-specific dual graph neural network for multi-label text classification. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers). 3855–3864. [38] Yao Ma, Ziyi Guo, Zhaocun Ren, Jiliang Tang, and Dawei Yin. 2020. Stream- ing graph neural networks. In Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval. 719–728. [39] Sedigheh Mahdavi, Shima Khoshraftar, and Aijun An. 2018. dynnode2vec: Scal- able dynamic network embedding. In 2018 IEEE international conference on big data (Big Data). IEEE, 3762–3765. [40] Yu Meng, Yunyi Zhang, Jiaxin Huang, Chenyan Xiong, Heng Ji, Chao Zhang, and Jiawei Han. 2020. Text classification using label names only: A language model self-training approach. arXiv preprint arXiv:2010.07245 (2020). [41] Shengjie Min, Zhan Gao, Jing Peng, Liang Wang, Ke Qin, and Bo Fang. 2021. STGSN-A Spatial–Temporal Graph Neural Network framework for time- evolving social networks. Knowledge-Based Systems 214 (2021), 106746. [42] Divya Mittal and Shiv Ratan Agrawal. 2022. Determining banking service at- tributes from online reviews: text mining and sentiment analysis. International Journal of Bank Marketing (2022). [43] Giang Hoang Nguyen, John Boaz Lee, Ryan A Rossi, Nesreen K Ahmed, Eunyee Koh, and Sungchul Kim. 2018. Continuous-time dynamic network embeddings. In Companion proceedings of the the web conference 2018. 969–976. [44] Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. 2022. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems 35 (2022), 27730–27744. [45] Aldo Pareja, Giacomo Domeniconi, Jie Chen, Tengfei Ma, Toyotaro Suzumura, Hiroki Kanezashi, Tim Kaler, Tao Schardl, and Charles Leiserson. 2020. Evolvegcn: Evolving graph convolutional networks for dynamic graphs. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 34. 5363–5370. [46] Guang Qiu, Bing Liu, Jiajun Bu, and Chun Chen. 2011. Opinion word expansion and target extraction through double propagation. Computational linguistics 37, ForeSeer: Product Aspect Forecasting Using Temporal Graph Embedding CIKM '23, October 21–25, 2023, Birmingham, United Kingdom. 1 (2011), 9–27. [47] Mahmudur Rahman, Tanay Kumar Saha, Mohammad Al Hasan, Kevin S Xu, and Chandan K Reddy. 2018. Dylink2vec: Effective feature representation for link prediction in dynamic networks. arXiv preprint arXiv:1804.05755 (2018). [48] Jyoti Rana, Loveleen Gaur, and KC Santosh. 2022. Classifying Customers' Jour- ney from Online Reviews of Amazon Fresh via Sentiment Analysis and Topic Modelling. In 2022 3rd International Conference on Computation, Automation and Knowledge Management (ICCAKM). IEEE, 1–6. [49] Emanuele Rossi, Ben Chamberlain, Fabrizio Frasca, Davide Eynard, Federico Monti, and Michael Bronstein. 2020. Temporal graph networks for deep learning on dynamic graphs. arXiv preprint arXiv:2006.10637 (2020). [50] Sina Sajadmanesh, Sogol Bazargani, Jiawei Zhang, and Hamid R Rabiee. 2019. Continuous-time relationship prediction in dynamic heterogeneous information networks. ACM Transactions on Knowledge Discovery from Data (TKDD) 13, 4 (2019), 1–31. [51] Aravind Sankar, Yanhong Wu, Liang Gou, Wei Zhang, and Hao Yang. 2018. Dy- namic graph representation learning via self-attention networks. arXiv preprint arXiv:1812.09430 (2018). [52] Simon Schaefer, Daniel Gehrig, and Davide Scaramuzza. 2022. AEGNN: Asyn- chronous Event-based Graph Neural Networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 12371–12381. [53] Richa Sharma, Shweta Nigam, and Rekha Jain. 2014. Mining of product reviews at aspect level. arXiv preprint arXiv:1406.3714 (2014). [54] Lei Shu, Hu Xu, Bing Liu, and Jiahua Chen. 2022. Zero-Shot Aspect-Based Sentiment Analysis. arXiv preprint arXiv:2202.01924 (2022). [55] Uriel Singer, Ido Guy, and Kira Radinsky. 2019. Node embedding over temporal graphs. arXiv preprint arXiv:1903.08889 (2019). [56] Kihyuk Sohn. 2016. Improved deep metric learning with multi-class n-pair loss objective. Advances in neural information processing systems 29 (2016). [57] Li Sun, Junda Ye, Hao Peng, and Philip S Yu. 2022. A Self-supervised Riemannian GNN with Time Varying Curvature for Temporal Graph Learning. In Proceedings of the 31st ACM International Conference on Information & Knowledge Management. 1827–1836. [58] Sheng Tian, Ruofan Wu, Leilei Shi, Liang Zhu, and Tao Xiong. 2021. Self- supervised representation learning on dynamic graphs. In Proceedings of the 30th ACM International Conference on Information & Knowledge Management. 1814–1823. [59] Rakshit Trivedi, Hanjun Dai, Yichen Wang, and Le Song. 2017. Know-evolve: Deep temporal reasoning for dynamic knowledge graphs. In international conference on machine learning. PMLR, 3462–3471. [60] Rakshit Trivedi, Mehrdad Farajtabar, Prasenjeet Biswal, and Hongyuan Zha. 2019. Dyrep: Learning representations over dynamic graphs. In International conference on learning representations. [61] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. Advances in neural information processing systems 30 (2017). [62] Sanjeev Verma, Rohit Sharma, Subhamay Deb, and Debojit Maitra. 2021. Artifi- cial intelligence in marketing: Systematic review and future research direction. International Journal of Information Management Data Insights 1, 1 (2021), 100002. [63] Jiyao Wang, Zijie Chen, Yang Qin, Dengbo He, and Fangzhen Lin. 2023. Multi- Aspect co-Attentional Collaborative Filtering for extreme multi-label text classi- fication. Knowledge-Based Systems 260 (2023), 110110. [64] Qifan Wang, Li Yang, Bhargav Kanagal, Sumit Sanghai, D Sivakumar, Bin Shu, Zac Yu, and Jon Elsas. 2020. Learning to extract attribute value from product via question answering: A multi-task approach. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. 47–55. [65] Xin Wang, Jiaxiu He, David J Curry, and Jun Hyun Ryoo. 2022. Attribute embed- ding: Learning hierarchical representations of product attributes from consumer reviews. Journal of Marketing 86, 6 (2022), 155–175. [66] Xiao Wang, Yuanfu Lu, Chuan Shi, Ruijia Wang, Peng Cui, and Shuai Mou. 2020. Dynamic heterogeneous information network embedding with meta-path based proximity. IEEE Transactions on Knowledge and Data Engineering (2020). [67] Chao-Yuan Wu, Amr Ahmed, Alex Beutel, Alexander J Smola, and How Jing. 2017. Recurrent recommender networks. In Proceedings of the tenth ACM international conference on web search and data mining. 495–503. [68] Lin Xiao, Xin Huang, Boli Chen, and Liping Jing. 2019. Label-specific document representation for multi-label text classification. In Proceedings of the 2019 confer- ence on empirical methods in natural language processing and the 9th international joint conference on natural language processing (EMNLP-IJCNLP). 466–475. [69] Da Xu, Chuanwei Ruan, Evren Korpeoglu, Sushant Kumar, and Kannan Achan. Inductive representation learning on temporal graphs. arXiv preprint 2020. arXiv:2002.07962 (2020). [70] Huimin Xu, Wenting Wang, Xinnian Mao, Xinyu Jiang, and Man Lan. 2019. Scaling up open tagging from tens to thousands: Comprehension empowered attribute value extraction from product title. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics. 5214–5223. [71] Kaiquan Xu, Stephen Shaoyi Liao, Jiexun Li, and Yuxia Song. 2011. Mining com- parative opinions from customer reviews for competitive intelligence. Decision support systems 50, 4 (2011), 743–754. [72] Mengjia Xu, Apoorva Vikram Singh, and George Em Karniadakis. 2022. DynG2G: An Efficient Stochastic Graph Embedding Method for Temporal Graphs. IEEE Transactions on Neural Networks and Learning Systems (2022). [73] Xueke Xu, Xueqi Cheng, Songbo Tan, Yue Liu, and Huawei Shen. 2013. Aspect- level opinion mining of online customer reviews. China Communications 10, 3 (2013), 25–41. [74] Guotong Xue, Ming Zhong, Jianxin Li, Jia Chen, Chengshuai Zhai, and Ruochen Kong. 2022. Dynamic network embedding survey. Neurocomputing 472 (2022), 212–223. [75] Hansheng Xue, Luwei Yang, Wen Jiang, Yi Wei, Yi Hu, and Yu Lin. 2021. Modeling dynamic heterogeneous network for link prediction using hierarchical atten- tion with temporal rnn. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases. Springer, 282–298. [76] Jun Yan, Nasser Zalmout, Yan Liang, Christan Grant, Xiang Ren, and Xin Luna Dong. 2021. Adatag: Multi-attribute value extraction from product profiles with adaptive decoding. arXiv preprint arXiv:2106.02318 (2021). [77] Li Yang, Qifan Wang, Zac Yu, Anand Kulkarni, Sumit Sanghai, Bin Shu, Jon Elsas, and Bhargav Kanagal. 2022. Mave: A product dataset for multi-source attribute value extraction. In Proceedings of the Fifteenth ACM International Conference on Web Search and Data Mining. 1256–1265. [78] Luwei Yang, Zhibo Xiao, Wen Jiang, Yi Wei, Yi Hu, and Hao Wang. 2020. Dy- namic heterogeneous graph embedding using hierarchical attentions. In European Conference on Information Retrieval. Springer, 425–432. [79] Jisu Yi and Yun Kyung Oh. 2022. The informational value of multi-attribute online consumer reviews: a text mining approach. Journal of Retailing and Consumer Services 65 (2022), 102519. [80] Jiaxuan You, Tianyu Du, and Jure Leskovec. 2022. ROLAND: graph learning framework for dynamic graphs. In Proceedings of the 28th ACM SIGKDD Confer- ence on Knowledge Discovery and Data Mining. 2358–2366. [81] Wenchao Yu, Wei Cheng, Charu C Aggarwal, Kai Zhang, Haifeng Chen, and Wei Wang. 2018. Netwalk: A flexible deep embedding approach for anomaly detection in dynamic networks. In Proceedings of the 24th ACM SIGKDD international conference on knowledge discovery & data mining. 2672–2681. [82] Ling Zhan and Tao Jia. 2022. Coarsas2hvec: Heterogeneous information network embedding with balanced network sampling. Entropy 24, 2 (2022), 276. [83] Hanlei Zhang, Hua Xu, Ting-En Lin, and Rui Lyu. 2021. Discovering new intents with deep aligned clustering. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 35. 14365–14373. [84] Xinyang Zhang, Chenwei Zhang, Xian Li, Xin Luna Dong, Jingbo Shang, Christos Faloutsos, and Jiawei Han. 2022. OA-Mine: Open-World Attribute Mining for E-Commerce Products with Weak Supervision. In Proceedings of the ACM Web Conference 2022. 3153–3161. [85] Yao Zhang, Yun Xiong, Xiangnan Kong, and Yangyong Zhu. 2017. Learning node embeddings in interaction graphs. In Proceedings of the 2017 ACM on Conference on Information and Knowledge Management. 397–406. [86] Zhen Zhang, Jiajun Bu, Zhao Li, Chengwei Yao, Can Wang, and Jia Wu. 2021. TigeCMN: On exploration of temporal interaction graph embedding via Coupled Memory Neural Networks. Neural Networks 140 (2021), 13–26. [87] Yifeng Zhao, Xiangwei Wang, Hongxia Yang, Le Song, and Jie Tang. 2019. Large Scale Evolving Graphs with Burst Detection.. In IJCAI. 4412–4418. [88] Yabing Zhao, Xun Xu, and Mingshu Wang. 2019. Predicting overall customer satisfaction: Big data evidence from hotel online textual reviews. International Journal of Hospitality Management 76 (2019), 111–121. [89] Li Zheng, Zhenpeng Li, Jian Li, Zhao Li, and Jun Gao. 2019. AddGraph: Anomaly Detection in Dynamic Graph Using Attention-based Temporal GCN.. In IJCAI. 4419–4425. [90] Lekui Zhou, Yang Yang, Xiang Ren, Fei Wu, and Yueting Zhuang. 2018. Dynamic network embedding by modeling triadic closure process. In Proceedings of the AAAI conference on artificial intelligence, Vol. 32. [91] Dingyuan Zhu, Peng Cui, Ziwei Zhang, Jian Pei, and Wenwu Zhu. 2018. High- order proximity preserved embedding for dynamic networks. IEEE Transactions on Knowledge and Data Engineering 30, 11 (2018), 2134–2144. [92] Linhong Zhu, Dong Guo, Junming Yin, Greg Ver Steeg, and Aram Galstyan. 2016. Scalable temporal latent space inference for link prediction in dynamic social networks. IEEE Transactions on Knowledge and Data Engineering 28, 10 (2016), 2765–2777. [93] Tiangang Zhu, Yue Wang, Haoran Li, Youzheng Wu, Xiaodong He, and Bowen Zhou. 2020. Multimodal joint attribute prediction and value extraction for e- commerce product. arXiv preprint arXiv:2009.07162 (2020). [94] Yu Zhu, Hao Li, Yikang Liao, Beidou Wang, Ziyu Guan, Haifeng Liu, and Deng Cai. 2017. What to Do Next: Modeling User Behaviors by Time-LSTM.. In IJCAI, Vol. 17. 3602–3608. [95] Yuan Zuo, Guannan Liu, Hao Lin, Jia Guo, Xiaoqian Hu, and Junjie Wu. 2018. Embedding temporal network via neighborhood formation. In Proceedings of the 24th ACM SIGKDD international conference on knowledge discovery & data mining. 2857–2866.
http://arxiv.org/abs/2310.04861v1
"2023-10-07T15:50:26"
"2023-10-07T15:50:26"
Uncovering hidden geometry in Transformers via disentangling position and context
Transformers are widely used to extract complex semantic meanings from input tokens, yet they usually operate as black-box models. In this paper, we present a simple yet informative decomposition of hidden states (or embeddings) of trained transformers into interpretable components. For any layer, embedding vectors of input sequence samples are represented by a tensor $\boldsymbol{h} \in \mathbb{R}^{C \times T \times d}$. Given embedding vector $\boldsymbol{h}_{c,t} \in \mathbb{R}^d$ at sequence position $t \le T$ in a sequence (or context) $c \le C$, extracting the mean effects yields the decomposition \[ \boldsymbol{h}_{c,t} = \boldsymbol{\mu} + \mathbf{pos}_t + \mathbf{ctx}_c + \mathbf{resid}_{c,t} \] where $\boldsymbol{\mu}$ is the global mean vector, $\mathbf{pos}_t$ and $\mathbf{ctx}_c$ are the mean vectors across contexts and across positions respectively, and $\mathbf{resid}_{c,t}$ is the residual vector. For popular transformer architectures and diverse text datasets, empirically we find pervasive mathematical structure: (1) $(\mathbf{pos}_t)_{t}$ forms a low-dimensional, continuous, and often spiral shape across layers, (2) $(\mathbf{ctx}_c)_c$ shows clear cluster structure that falls into context topics, and (3) $(\mathbf{pos}_t)_{t}$ and $(\mathbf{ctx}_c)_c$ are mutually incoherent -- namely $\mathbf{pos}_t$ is almost orthogonal to $\mathbf{ctx}_c$ -- which is canonical in compressed sensing and dictionary learning. This decomposition offers structural insights about input formats in in-context learning (especially for induction heads) and in arithmetic tasks.
[ "Jiajun Song", "Yiqiao Zhong" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04861v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04861v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "stat.ML" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 1 6 8 4 0 . 0 1 3 2 : v i X r a Uncovering hidden geometry in Transformers via disentangling position and context Jiajun Song*, Yiqiao Zhong† October 10, 2023 Abstract Transformers are widely used to extract complex semantic meanings from input tokens, yet they usually operate as black-box models. In this paper, we present a simple yet informative decomposition of hidden states (or embeddings) of trained transformers into interpretable components. For any layer, embedding vectors of input sequence samples are represented by a tensor h ∈ RC×T ×d. Given embed- ding vector hc,t ∈ Rd at sequence position t ≤ T in a sequence (or context) c ≤ C, extracting the mean effects yields the decomposition hc,t = μ + post + ctxc + residc,t where μ is the global mean vector, post and ctxc are the mean vectors across contexts and across positions respectively, and residc,t is the residual vector. For popular transformer architectures and diverse text datasets, empirically we find pervasive mathematical structure: (1) (post)t forms a low- dimensional, continuous, and often spiral shape across layers, (2) (ctxc)c shows clear cluster structure that falls into context topics, and (3) (post)t and (ctxc)c are mutually incoherent-namely post is almost orthogonal to ctxc-which is canonical in compressed sensing and dictionary learning. This de- composition offers structural insights about input formats in in-context learning (especially for induction heads) and in arithmetic tasks. 1 Introduction Transformers (Vaswani et al., 2017) are practical neural network models that underlie recent successes of large language models (Brown et al., 2020; Bubeck et al., 2023). Unfortunately, transformers are often used as black-box models due to lack of in-depth analyses of internal mechanism, which raises concerns such as lack of interpretability, model biases, security issues, etc., (Bommasani et al., 2021). In particular, it is poorly understood what information embeddings from each layer capture. We identify two desiderata: (1) internal quantitative measurements, particularly for the intermediate layers; (2) visual- ization tools and diagnostics tailored to transformers beyond attention matrix plots. Let us introduce basic notations. An input sequence consists of T consecutive tokens (e.g., words or subwords), and a corpus is a collection of all input sequences. Let C be the total number of input sequences and c ≤ C denote a generic sequence, which may be represented by xc,1, . . . , xc,T where each *National Key Laboratory of General Artificial Intelligence, Beijing Institute for General Artificial Intelligence (BIGAI), Beijing 100080, China, songjiajun@bigai.ai †Department of Statistics, University of Wisconsin–Madison, WI, 53706, USA, yiqiao.zhong@wisc.edu 1 Figure 1: PCA visualization of positional basis (blue) and cvecs (red) from GPT-2 on OpenWebText. For every layer l, each pos(l) c,t are projected using top-2 principal directions of t (pos(l) t )t≤T . Darker blue/red colors correspond to larger t. Principal components have different scales across layers, but for aesthetic purposes we rescaled all plots. and randomly selected cvec(l) xc,t corresponds to a token. We start from the initial static (and positional) embeddings (h(0) calculate the intermediate-layer embeddings (h(l) c,t )t≤T : c,t )t≤T and then h(0) c,1, . . . , h(0) c,1, . . . , h(l) h(l) c,T = Embed(xc,1, . . . , xc,T ) c,T = TFLayerl(h(l−1) c,1 , . . . , h(l−1) c,T ) for l = 1, . . . , L. where Embed and TFLayerl are general mappings. This general definition encompasses many transformer models, which depend on attention heads defined as follows. Given dhead ≤ d and input matrix X ∈ RT ×d, for trainable weights W q, W k, W v ∈ Rd×dhead, define AttnHead(X) = softmax (cid:18) XW q(W k)⊤X ⊤ √ dhead (cid:19) XW v ∈ RT ×dhead . (1) Multi-head attention heads, denoted by MHA, are essentially the concatenation of many attention heads. Denote a generic fully-connected layer by FFN(x) = W2 max{0, W1x + b1} + b2 given any x ∈ Rd for trainable weights W1 ∈ Rd′×d, W2 ∈ Rd×d′, b1 ∈ Rd′, b2 ∈ Rd (often d′ = 4d), and let LN be a generic layer normalization layer. The standard transformer is expressed as h(l+0.5) c = h(l) c + MHA(l)(LN(l,1)(h(l) c )), h(l+1) c,t = h(l+0.5) c,t + FFN(l)(LN(l,2)((h(l+0.5) c,t ))) where h(l+0.5) c = (h(l+0.5) c,1 , . . . , h(l+0.5) c,T 1.1 A mean-based decomposition ) and h(l) c = (h(l) c,1, . . . , h(l) c,T ). For each embedding vector h(l) c,t ∈ Rd from any trained transformer, consider the decomposition μ(l) := 1 CT (cid:88) c,t h(l) c + resid(l) c,t = μ(l) + pos(l) t + ctx(l) c,t , 1 (cid:88) h(l) c,t , pos(l) h(l) c,t − μ(l), C := t ctx(l) c c where 1 T := (cid:88) t h(l) c,t − μ(l) . (2) (3) Each of the four components has the following interpretations. For any given layer l, 2 Table 1: Averaged (and std of) measurements across layers. Measurements based on 6.4K samples. All values are in [0, 1] except 'rank estimate': 'relative norm' means magnitude of positional basis relative to centered embeddings; 'similarity' and 'incoh' are averaged cosine similarity (inner products of normalized vectors) between ctx, and between ctx and pos, respectively. Positional basis rank estimate 7.86(1.96) relative norm 0.66(0.28) Context basis inter-cluster similarity --– intra-cluster similarity --– Incoh --– NanoGPT Shakespeare GPT-2 BERT BLOOM OpenWebText 11.38(1.86) 0.31(0.19) WikiText 11.69(1.64) 0.31(0.19) OpenWebText 12.54(2.73) 0.24(0.07) WikiText 12.62(2.70) 0.24(0.06) OpenWebText 10.23(1.31) 0.16(0.09) WikiText 10.00(1.47) 0.16(0.08) OpenWebText 9.38(1.15) 0.14(0.03) Llama 2 WikiText 8.69(0.91) 0.14(0.03) GitHub 8.69(1.67) 0.20(0.05) 0.10(0.01) 0.11(0.01) 0.13(0.04) 0.17(0.03) 0.21(0.12) 0.15(0.14) 0.12(0.13) 0.33(0.20) 0.22(0.08) 0.44(0.04) 0.051(0.05) 0.41(0.03) 0.039(0.04) 0.26(0.04) 0.046(0.05) 0.31(0.04) 0.043(0.04) 0.48(0.06) 0.158(0.23) 0.32(0.09) 0.148(0.23) 1.00(0.01) 0.190(0.24) 1.00(0.01) 0.316(0.27) 1.00(0.01) 0.189(0.20) • we call μ(l) the global mean vector, which differentiates neither contexts nor positions; • we call (pos(l) t )t≤T the positional basis, as they quantify average positional effects; • we call (ctx(l) c )c≤C the context basis, as they quantify average sequence/context effects; • we call (resid(l) c,t )t≤T,c≤C the residual vectors, which capture higher-order effects; • In addition, we define cvec(l) c,t = ctx(l) c + resid(l) c,t . A priori, we do not know how much position information is retained in each layer, since many trans- formers only have explicit positional encodings in the 0-th layer. Are positional basis and context basis play the role as the names suggest? We will provide affirmative answers. Sampling input sequences. A corpus can be extremely large, containing billions of tokens. For practical use, in this paper C is much smaller: we subsample input sequences from the corpus; for example, C = 6.4K in Figure 1. Thus, our empirical-mean-based decomposition can be regarded as an estimate of the population means, using much less computation. (i) We use context to refer to a sequence since its tokens collectively encode context On terminology. information. (ii) We call positional/context basis for convenience. A more accurate term is frame or over- complete basis, since (pos(l) t )c≤C are often linearly dependent. t )t≤T and (ctx(l) Connections to Analysis-of-Variance (ANOVA). Our embedding decomposition is similar to two-way ANOVA in form. Borrowing standard terminology from ANOVA, positions and contexts can be regarded as two treatments, so viewing the embedding hc,t as the response variable, then positional/context bases represent mean effects. 3 Figure 2: Normalized Gram matrix [ ̄P , ̄C]⊤[ ̄P , ̄C] where ̄P = [ pos1 ∥posT ∥ ] and ̄C = ∥ctx1∥ , . . . , ctxC [ ctx1 ∥ctxC ∥ ] based on GPT-2. Here, T = 128, and ctxc is sampled from 4 documents with sam- ple size 32 in OpenWebText. We find (i) Smoothness, pos-pos part (top left) of Gram matrix is smooth; (ii) Incoherence, pos-ctx part (top right/bottom left) has values close to 0; (iii) Clustering, ctx-ctx part (bottom right) shows strong cluster patterns. ∥pos1∥ , . . . , posT 1.2 Pervasive geometrical structure We consider a variety of transformers and datasets; see Section A for details. Our main results are summa- rized below. Further, Section 5 explores randomization experiments and arithmetic tasks. 1. Positional basis is a significant and approximately low-rank component, forming a continuous and curving shape, which is linked to smoothness. 2. Context basis has strong cluster patterns corresponding to documents/topics. 3. Positional basis and context basis are nearly orthogonal (or incoherent), which allows self-attention heads to capture the interaction of the two bases easily. What does residc,t represent? As with regression models, residual components may be non-negligible and contain idiosyncratic information. For example, they can be used to track previously seen tokens (Sec- tion 4.1) or special symbols in arithmetic tasks (Section 5.2). 1.3 Accessible reproducibility We provide a fast implementation via Google Colab that reproduces most of the figures and analysis for GPT-2 (under several minutes with the GPU option): https://colab.research.google.com/drive/1ubsJQvLkOSQtiU8LoBA_79t1bd5-5ihi?usp=sharing . The complete implementation, as well as additional plots and measurements, can be found on the following GitHub page. https://github.com/JiajunSong629/uncover-hidden-geometry 4 2 Geometry of positional basis 2.1 Low-dimensional structure as a significant component We find that the positional basis concentrates around a low-dimensional subspace. In Table 1, we report the rank estimate of positional basis averaged across all layers using the method of Donoho et al. (2023). In Section B.2, we report detailed rank estimates and an additional measurement: stable rank (Rudelson & Vershynin, 2007). Table 2 shows that the low-rank structure is robustness to out-of-distribution data, suggesting positional basis is indeed agnostic to contexts. We also find that usually, the positional basis ac- counts for a significant proportion of embeddings. In Table 1, we report the relative norm (averaged across layers) ∥P ∥op/∥M ∥op, where M contains centered embedding vectors hc,t − μ and columns of P are corresponding post. We also consider ̄P = [ pos1 ∥posT ∥ ], normalized vectors: etc. In Figure 3 (left), we plot the top singu- lar values (adjusted for dimensional difference) in descending order of P = [pos1, . . . , posT ], Cvec = [cvec1,1, . . . , cvecc,T ], and R = [resid1,1, . . . , residc,T ]. Visibly, positional basis is a considerable component in magnitude and con- tributes to the spikedness of embeddings. Figure 3: Spectral and Fourier analysis based on GPT-2 model and OpenWebText. Left: Top-60 (ad- justed) singular values of P , Cvec, R. Right: Ap- plying 2D discrete cosine transform to ̄P ⊤ ̄P , we show first 10 frequency coefficients. We notice that there are two exceptions: (i) 0-th layer of Llama 2 and BLOOM (due to no positional encoding), (ii) last one/few layers of a transformer. Likely, last layers do not need position information as contextualization is completed; an investigation is left as future work. ∥pos1∥ , . . . , posT 2.2 Spiral shape via a Fourier perspective A priori, a common geometric structure of positional basis is unexpected: after all, different models/datasets may use position information differently. Nevertheless, on text-based datasets, we observe a common continuous shape that is often spiral, parabolic, or U-shaped. In Figure 3 (right), we apply the 2D discrete cosine trans- form to the normalized Gram matrix ̄P ⊤ ̄P and discover that energies are concentrated mostly in the low-frequency compo- nents, which reinforces the smooth and curving structure we identified. Other models show similar low-frequency patterns except for BERT (possibly due to the different loss function). 2.3 Theoretical insight: connection to smoothness Table 2: Robustness of positional ba- sis. Similar geometric structures found on out-of-distribution samples: NanoGPT on WikiText, others on GitHub. rank estimate 7.86(1.96) 0.66(0.28) relative norm NanoGPT GPT-2 BERT 11.54(1.55) 0.31(0.16) 12.46(2.47) 0.23(0.04) BLOOM 9.54(0.84) 0.14(0.05) It is well known that the smoothness of a function is connected to fast decay or sparsity in the frequency domain (Pinsky, 2008, Sect. 1.2.3). In Figure 2, the Gram matrix of positional basis exhibits smooth patterns, allowing attention to neighboring tokens more easily. Does smoothness of the Gram matrix shed light on the geometrical structure of the positional basis? We provide an affirmative answer. 5 Smoothness of pos-pos Gram matrix induces the low-dimensional and spiral shape. Let G = P ⊤P ∈ RT ×T be the Gram matrix of the positional basis (no normalization for simplicity). By definition in Equation 3, positional basis has zero means, so pos1 + . . . + posT = 0. To characterize smoothness, below we introduce the definition of finite difference. As with the discrete cosine transform in 1D, we need to extend and reflect the Gram matrix to avoid boundary effects. Let G(1) = G and G(2), G(3), G(4) ∈ RT ×T be defined by G(2) t,t′ = GT +1−t,T +1−t′ for any t, t′ = 1, 2, . . . T . We extend and reflect G by t,t′ = Gt,T +1−t′, G(3) t,t′ = GT +1−t,t′, G(4) ̃G := (cid:18) G(1) G(2) G(3) G(4) (cid:19) . (4) We define the first-order finite difference by (using periodic extension ̃Gt±2T,t′±2T = ̃Gt,t′) [∆(1,1) ̃G]t,t′ = T 2(cid:0) ̃Gt,t′ − ̃Gt−1,t′ − ̃Gt,t′−1 + ̃Gt−1,t′−1 (cid:1), for all integers t, t′ (5) Higher-order finite differences are defined recursively by ∆(m,m) ̃G = ∆(1,1)(cid:0)∆(m−1,m−1) ̃G(cid:1). Note that ∆(m,m) ̃G measures higher-order smoothness of ̃G. Indeed, if Gt,t′ = f (t/T, t′/T ) for certain smooth function f (x, y) defined on [0, 1]2, then [∆(m,m) ̃G]t,t′ ≈ ∂m x ∂m y f (t/T, t′/T ). Theorem 1. Fix positive integers k ≤ T and m. Define the low-frequency vector fs = (1, cos((s − 0.5)π/T ), . . . , cos((s − 0.5)(T − 1)π/T ))⊤ ∈ RT where s = 1, . . . , k, and denote F≤k = [f1, . . . , fk] ∈ RT ×k. Then there exists B ∈ Rk×k such that (denoting ∥A∥max = maxij |Aij|) 1 T (cid:13) (cid:13)G − (F≤kB)⊤F≤kB (cid:13) (cid:13) (cid:13) (cid:13)op ≤ 6 (8k)m ∥∆(m,m) ̃G∥max . (6) This theorem implies that if the extended Gram matrix has higher-order smoothness, namely ∥∆(m,m) ̃G∥max is bounded by a constant, then even for moderate k and m, we have approximation G ≈ (F≤kB)⊤F≤kB. Note that F≤kB consists of linear combinations of low-frequency vectors. This explains why G has a dominant low-rank and low-frequency component. Why smoothness? One possible explanation is that smoothness allows attention to neighboring tokens easily (crucial for natural languages/codes), because often short-ranged token pairs tend to receive higher QK values and thus higher attention weights. 3 Context basis: salient cluster structure Figure 2 shows that the context basis computed from 4 different documents can be visually clustered into 4 groups. Measuring cluster compactness, we find that using context basis or even cvecs has at least a slight advantage over raw embeddings (without removing positional effects) as in Thompson & Mimno (2020). See Section C for detailed analysis. On contextualization. We observe from Table 1 and Section C: (i) except for Llama 2 and BLOOM, the increase in cluster compactness seems to be moderate and only occurs in early layers, likely because our measurements are global rather than based on fine-grained conditional probabilities; (ii) Llama 2 and BLOOM show progressive changes in cluster compactness across layers, as shown by the numbers in the paratheses. This is likely due to heterogeneous data during pretraining. 6 Figure 4: Dissecting QK/attention: GPT-2 on a repeated sequence of random tokens. (a)(b)(c): we visu- alize pos-pos, pos-cvec, cvec-pos, cvec-cvec QK components (first four columns of heatmaps), QK matrix (5-th column), and attention matrix (6-th column). (d): We visualize the same three attention heads simultaneously, highlighting 'anger' token and its associated attention. 4 An investigation of incoherent bases Table 1 (last column) shows the mutual incoherence maxt,c |⟨ post ∥ctxc∥ ⟩|, as a measure of alignment between the positional basis and the context basis. The low incoherence in Table 1 (zero is impossible due to noise) means that the two bases are nearly orthogonal to each other. This weak alignment is a key structural requirement for sparse learning and is often associated with restricted isometry (Candes & Tao, 2005), irrepresentable conditions (Zhao & Yu, 2006), etc. ∥post∥ , ctxc 4.1 QK matrix decomposition: a study on induction heads Induction heads (Elhage et al., 2021) are components in transformers that complete a sequence pattern based on observed past tokens, namely, predicting the next token [B] based on observed sequence [A], [B], . . . , [A]. They are recently identified to explain in-context learning abilities of large language models. Surprisingly, induction heads even generalize on out-of-distribution data. To dissect the self-attention mechanism, we decompose the QK matrices into components: assuming μ = 0, then for embedding vectors h, h′ ∈ Rd we have h⊤W q(W k)⊤h = pos⊤W q(W k)⊤pos + pos⊤W q(W k)⊤cvec + cvec⊤W q(W k)⊤pos + cvec⊤W q(W k)⊤cvec . (7) Each of the four components shows how much an attention head captures information from cross-pairs pos/cvec-pos/cvec of an embedding. Although the global mean μ ̸= 0 in reality, we find that it has little effect on interpretations. Attention attribution for induction heads. Motivated by Equation 7, we decompose QK matrices into interpretable components that illuminate the mechanism of induction heads. We generate a sequence of 8 random tokens, repeat it twice, and then concatenate them into an input sequence for the pretrained GPT-2 model. For each layer/head, we calculate four QK matrix components; for example, for pos-pos matrix, each entry is given by pos⊤ i W q(W k)⊤posj where i, j ≤ T . 7 Figure 5: Structure of attention weight matrices. For any of the 12 attention heads (for layer L = 6 shown dhead ∈ Rd×d. Red: we show the diagonal entries here) in GPT-2, we study the matrix W = W q(W k)⊤/ diagg(W ). Blue: we take off-diagonal matrix W − diagg(W ) and rotate it by the right singular vectors of positional basis, then show the large absolute values. √ Generally, we find that pos-pos is smoothly dependent on positions, while cvec-cvec exposes non- global effects of individual tokens. Depending on the magnitude of the four components, the "winning" component will determine the pattern of the attention matrix. As shown in Figure 4, we identify three types of attention heads that are vital for induction heads. • Attention to self-tokens (Layer 0, Head 1). The dominant component is cvec-cvec (4-th heatmap in (a)), where visible diagonal lines indicate strong association between identical tokens, which translates to attention to previous identical tokens (blue lines in (d)). • Attention to neighboring tokens (Layer 2, Head 2). The dominant component is pos-pos (1-th heatmap in (b)), where upper right entries have higher values, resulting in attention to the previous few tokens (red lines in (d)), thanks to softmax and causal masking. • Attention to token being copied (Layer 5, Head 1). The combination of the first two types gives rise to a new QK/attention pattern, where visible diagonal lines are shifted (yellow arrow) by one token; compare 6-th heatmaps in (a) & (c). Given token 'anger', as shown in grey in (d), attention heads look back for the next adjacent token, as shown in green. Each type contains many representative heads including our handpicked ones; see Section D.1. 4.2 Dissecting attention weight matrices So far, we have observed that positional information is passed from earlier layers to later layers, yielding clear geometric structures. How does transformer layer TFLayerl enable this information flow? A natural hypothesis is that the weight matrix W := W q(W k)⊤/ dhead has a component that is aligned with the low-dimensional subspace where the positional basis lies. We empirically examine whether the following low-rank plus noise structure holds for certain heads. √ W = V LV ⊤ + D + Noise (8) where columns of V ∈ Rd×K are the top-K right singular vectors of positional basis matrix P , L ∈ RK×K, and D ∈ Rd×d is a diagonal matrix. In Figure 5, we take D = diagg(W ) (shown in red), rotate the off-diagonal part of W by the right singular vectors of P and apply denoising, namely zeroing entries whose absolute values are smaller than a 8 threshold. For many heads, the surviving large absolute values are concentrated in the top left (K ≈ 20)- which suggests that indeed a significant component of W is aligned with the positional basis, supporting Equation 8. 4.3 Theoretical insight: kernel factorization What are the desirable properties that incoherence structure induces in many trained transformers? It is well known in sparse coding and compressed sensing that incoherent basis facilitates recovery of sparse signals (Donoho & Stark, 1989; Donoho & Elad, 2003; Donoho, 2006; Cand`es et al., 2006). Here we focus on the self-attention mechanism of transformers. By adopting the kernel perspective, we provide preliminary analysis for our following heuristics: Incoherence enables a kernel to factorize into smaller components, each operating independently. Given query/key matrices W q, W k ∈ Rd×dhead, we define the (asymmetric) kernel by KW (z, z′) := exp (cid:16) z⊤W z′(cid:17) = exp (cid:18) ⟨W qz, W kz′⟩ √ dhead (cid:19) , recall W = W q(W k)⊤/ (cid:112) dhead. Using KW , the attention can be expressed as kernel smoothing: for embeddings (xt)t≤T ⊂ Rd, AttnHead(xt; KW ) = (cid:88) k≤t KW (xk, xt) k′≤t KW (xk′, xt) (cid:80) v(xk) (9) where v : Rd → R is a generic value function. This kernel perspective is explored in Tsai et al. (2019), where it is argued that the efficacy of self-attention largely depends on the form of the kernel. Suppose that there are two overcomplete bases B0 1 or B0 2. The mutual incoherence is incoh := max (cid:8)|⟨c, t⟩ : c ∈ B0 if u ∈ B0 (extended) overcomplete basis Bα := {λu : u ∈ B0 vectors xq, xk ∈ Rd, suppose that we can decompose them according to the two bases. where cq, ck ∈ B1; tq, tk ∈ B2. xq = cq + tq, xk = ck + tk, 1, B0 2 ⊂ Rd. For simplicity, assume that ∥u∥2 ≤ 1 (cid:9). Consider the α, λ ∈ [−1, 1]} where α ∈ {1, 2}. Given query/key 1, t ∈ B0 2 (10) We can generically decompose the kernel into a product of four components KW (xq, xk) = KW (cq, ck)KW (cq, tk)KW (tq, ck)KW (tq, tk) . Each kernel component measures cross similarity of pairs between cq, tq and ck, tk, which then translates into a weight for the attention. Unfortunately, this general decomposition requires the individual kernels to share the same weight W , which hinders capturing cross interactions flexibly. It turns out that if the weight matrix is sparsely represented by the bases, then kernel flexibility can be achieved. To be precise, we will say that W ∈ Rd×d is s-sparsely represented by bases B, B′ if there exist (ak)k≤s ⊂ [−1, 1], (uk)k≤s ⊂ B, (vk)k≤s ⊂ B′ such that (cid:88) W = akukv⊤ k . (11) k≤s Theorem 2. Let W11, W12, W21, W22 ∈ Rd×d be any matrices with the following properties: for α, β ∈ {1, 2}, Wαβ ∈ Rd×d is O(1)-sparsely represented by bases Bα, Bβ. Then for all xq, xk ∈ Rd satisfying Equation 10, W = W11 + W12 + W21 + W22 satisfies KW (xq, xk) = (cid:0)1 + O(incoh)(cid:1) * KW11(cq, ck)KW12(cq, tk)KW21(tq, ck)KW22(tq, tk) (12) 2|) exp(−incoh2 * d) if each Wαβ is Moreover, Equation 12 holds with probability at least 1 − O((|B0 replaced by Wαβ + Zαβ√ d where (Zαβ)kk′ is an independent subgaussian1 random variable. 1| * |B0 1We say that a random variable ξ is subgaussian if E[ξ] = 0 and E[exp(λξ)] ≤ exp(λ2/2) for all λ ∈ R. 9 Figure 6: (a)(b)(c): Token randomization experiments (first row). Positional basis of transformers trained on unmodified text sequences, sequences with the latter half replaced by random tokens, purely random tokens, respectively. (d)(e): Addition experiment (second/third row). Fractured/discontinuous patterns likely cause length generalization to fail. The factorization 12 says that each kernel component has a separate weight matrix, and all components contribute multiplicatively to KW . The "moreover" part generalizes the sparse representation notion by allowing additive noise, which matches the empirical structure in Equation 8. The additive construction of W is connected to task arithmetic recently studied in the literature (Ilharco et al., 2022; Ortiz-Jimenez et al., 2023). Remark 1. If we suppose incoh ≍ d−γ with 1/2 > γ > 0, then the high probability statement is nontrivial if |B0 2| = o(exp(d1−2γ)). This dictionary size limit is generally reasonable. 1| * |B0 5 Why training format matters: smoothness perspective 5.1 Training with token randomization We train transformers on three different training data: (i) baseline-sequences of length T = 512 sam- pled from the first 10K samples of OpenWebText, (ii) partial randomization-sequences of the same data source but the latter half is replaced by random tokens uniformly sampled in the vocabulary, (iii) full randomization-input sequences are fully random tokens. Figure 6 (a)–(c) show the positional bases of two selected layers (L1 & L5) from the three settings. As darker colors represent later positions, we find that randomization destroys geometric structures of positional basis at exact positions where randomization takes place. 5.2 Simple experiments on addition tasks We explore a simple arithmetic task-Addition, where inputs are formatted as a string "a + b = c" with a, b, c represented by digits of a certain length. We sample the length of each addition component uniformly from {L/2, . . . , L} where L = 10 and then (i) in the "carry" setting, sample digits independently, and (ii) in 10 the "no-carry" setting, examples involving carry are removed. For both settings, the output order is reversed (Lee et al., 2023). Training transformers on datasets under the two settings, we discover similar phenomena, so we only present results for (i). In Figure 6 (d)–(e), we visualize two exemplary attention heads in a way similar to Figure 4. We find many fractured or discontinuous QK matrices and their pos-pos components. Likely associated with this discontinuity pattern, we find the transformer has difficulty generalizing to longer or shorter sequences (failure of length generalization). See Section E for details. 6 Related work Analyses of transformers have attracted research interest since Vaswani et al. (2017). Many studies on GPT-2 (Radford et al., 2019) and BERT (Devlin et al., 2018) show that last-layer contextualized embed- dings capture linguistic structure and exhibit excellent downstream performance (Hewitt & Manning, 2019; Chi et al., 2020; Thompson & Mimno, 2020). Fewer papers focus on the geometry or intermediate-layer embeddings: in Ethayarajh (2019), it is found that later-layer embeddings are increasingly anisotropic and context-specific; Cai et al. (2020); Reif et al. (2019); Hernandez & Andreas (2021); Gao et al. (2019) ob- served interesting geometric structures and artifacts without thorough analysis; Yeh et al. (2023) provide visualization tools for embeddings. Some very recent papers provide empirical/theoretical evidence about either low-rank or diagonal structure in attention weight matrices (Boix-Adsera et al., 2023; Trockman & Kolter, 2023). Our decomposition unifies scattered empirical phenomena, reveals consistent geometry and explains observed artifacts (anisotropic, spiral shape, etc.). Many variants of positional embedding are proposed (Shaw et al., 2018; Dai et al., 2019; Su et al., 2021; Scao et al., 2022; Press et al., 2021) since Vaswani et al. (2017). Since GPT-4, many papers focus on length generalization for arithmetic tasks (Kazemnejad et al., 2023; Lee et al., 2023). Prior analyses on positional embeddings focus only on static (0-th layer) embeddings for selected transformers (Wang et al., 2020; Ke et al., 2020; Wang & Chen, 2020; Tsai et al., 2019), whereas we provide a complete picture. Prior work on LSTMs finds decomposition-based methods can enhance interpretability (Murdoch et al., 2018). Understanding the inner workings of transformers is usually done through visualizing the attention heads (Clark et al., 2019; Wang et al., 2022). The emergence of induction heads (Elhage et al., 2021; Olsson et al., 2022) is supported by attention visualization, which is further reinforced by our analysis. 7 Limitations In this paper, we mostly focus on pretrained transformers due to limited computational resources. It would be interesting to investigate the impact of input/prompt formats on the geometry of embeddings over the course of training, especially for different linguistic tasks and arithmetic tasks. Also, we mostly focus on the mean vectors post and ctxc but not study residc,t thoroughly. It would be interesting to study the higher-order interaction in residc,t and propose a nonlinear decomposition of embeddings, which is left to future work. 8 Acknowledgement We thank Junjie Hu, Tim Ossowski, Harmon Bhasin, Wei Wang for helpful discussions. Support for this research was provided by the Office of the Vice Chancellor for Research and Graduate Education at the University of Wisconsin–Madison with funding from the Wisconsin Alumni Research Foundation. 11 References Enric Boix-Adsera, Etai Littwin, Emmanuel Abbe, Samy Bengio, and Joshua Susskind. Transformers learn through gradual rank increase. arXiv preprint arXiv:2306.07042, 2023. Rishi Bommasani, Drew A Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021. S Allen Broughton and Kurt Bryan. Discrete Fourier analysis and wavelets: applications to signal and image processing. John Wiley & Sons, 2018. Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. S ́ebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023. Xingyu Cai, Jiaji Huang, Yuchen Bian, and Kenneth Church. Isotropy in the contextual embedding space: Clusters and manifolds. In International Conference on Learning Representations, 2020. Emmanuel J Candes and Terence Tao. Decoding by linear programming. IEEE transactions on information theory, 51(12):4203–4215, 2005. Emmanuel J Cand`es, Justin Romberg, and Terence Tao. Robust uncertainty principles: Exact signal recon- struction from highly incomplete frequency information. IEEE Transactions on information theory, 52 (2):489–509, 2006. Ethan A Chi, John Hewitt, and Christopher D Manning. Finding universal grammatical relations in multi- lingual bert. arXiv preprint arXiv:2005.04511, 2020. Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D Manning. What does bert look at? an analysis of bert's attention. arXiv preprint arXiv:1906.04341, 2019. Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdi- arXiv preprint nov. Transformer-xl: Attentive language models beyond a fixed-length context. arXiv:1901.02860, 2019. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirec- tional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. David Donoho, Matan Gavish, and Elad Romanov. Screenot: Exact mse-optimal singular value thresholding in correlated noise. The Annals of Statistics, 51(1):122–148, 2023. David L Donoho. Compressed sensing. IEEE Transactions on information theory, 52(4):1289–1306, 2006. David L Donoho and Michael Elad. Optimally sparse representation in general (nonorthogonal) dictionaries via l1 minimization. Proceedings of the National Academy of Sciences, 100(5):2197–2202, 2003. David L Donoho and Philip B Stark. Uncertainty principles and signal recovery. SIAM Journal on Applied Mathematics, 49(3):906–931, 1989. 12 Nelson Elhage, Neel Nanda, Catherine Olsson, Tom Henighan, Nicholas Joseph, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, Tom Conerly, Nova DasSarma, Dawn Drain, Deep Ganguli, Zac Hatfield-Dodds, Danny Hernandez, Andy Jones, Jackson Kernion, Liane Lovitt, Kamal Ndousse, Dario Amodei, Tom Brown, Jack Clark, Jared Kaplan, Sam McCandlish, and Chris Olah. A mathemat- https://transformer- ical framework for transformer circuits. circuits.pub/2021/framework/index.html. Transformer Circuits Thread, 2021. Kawin Ethayarajh. How contextual are contextualized word representations? comparing the geometry of bert, elmo, and gpt-2 embeddings. arXiv preprint arXiv:1909.00512, 2019. Jun Gao, Di He, Xu Tan, Tao Qin, Liwei Wang, and Tie-Yan Liu. Representation degeneration problem in training natural language generation models. arXiv preprint arXiv:1907.12009, 2019. Evan Hernandez and Jacob Andreas. The low-dimensional linear geometry of contextualized word repre- sentations. arXiv preprint arXiv:2105.07109, 2021. John Hewitt and Christopher D Manning. A structural probe for finding syntax in word representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4129–4138, 2019. Gabriel Ilharco, Marco Tulio Ribeiro, Mitchell Wortsman, Suchin Gururangan, Ludwig Schmidt, Hannaneh Hajishirzi, and Ali Farhadi. Editing models with task arithmetic. arXiv preprint arXiv:2212.04089, 2022. Amirhossein Kazemnejad, Inkit Padhi, Karthikeyan Natesan Ramamurthy, Payel Das, and Siva Reddy. The impact of positional encoding on length generalization in transformers. arXiv preprint arXiv:2305.19466, 2023. Guolin Ke, Di He, and Tie-Yan Liu. Rethinking positional encoding in language pre-training. arXiv preprint arXiv:2006.15595, 2020. Nayoung Lee, Kartik Sreenivasan, Jason D Lee, Kangwook Lee, and Dimitris Papailiopoulos. Teaching arithmetic to small transformers. arXiv preprint arXiv:2307.03381, 2023. W James Murdoch, Peter J Liu, and Bin Yu. Beyond word importance: Contextual decomposition to extract interactions from lstms. arXiv preprint arXiv:1801.05453, 2018. Catherine Olsson, Nelson Elhage, Neel Nanda, Nicholas Joseph, Nova DasSarma, Tom Henighan, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, Tom Conerly, Dawn Drain, Deep Ganguli, Zac Hatfield-Dodds, Danny Hernandez, Scott Johnston, Andy Jones, Jackson Kernion, Liane Lovitt, Ka- mal Ndousse, Dario Amodei, Tom Brown, Jack Clark, Jared Kaplan, Sam McCandlish, and Chris Olah. In-context learning and induction heads. Transformer Circuits Thread, 2022. https://transformer- circuits.pub/2022/in-context-learning-and-induction-heads/index.html. Guillermo Ortiz-Jimenez, Alessandro Favero, and Pascal Frossard. Task arithmetic in the tangent space: Improved editing of pre-trained models. arXiv preprint arXiv:2305.12827, 2023. Mark A Pinsky. Introduction to Fourier analysis and wavelets, volume 102. American Mathematical Soc., 2008. Ofir Press, Noah A Smith, and Mike Lewis. Train short, test long: Attention with linear biases enables input length extrapolation. arXiv preprint arXiv:2108.12409, 2021. 13 Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019. Emily Reif, Ann Yuan, Martin Wattenberg, Fernanda B Viegas, Andy Coenen, Adam Pearce, and Been Kim. Visualizing and measuring the geometry of bert. Advances in Neural Information Processing Systems, 32, 2019. Mark Rudelson and Roman Vershynin. Sampling from large matrices: An approach through geometric functional analysis. Journal of the ACM (JACM), 54(4):21–es, 2007. Teven Le Scao, Angela Fan, Christopher Akiki, Ellie Pavlick, Suzana Ili ́c, Daniel Hesslow, Roman Castagn ́e, Alexandra Sasha Luccioni, Franc ̧ois Yvon, Matthias Gall ́e, et al. Bloom: A 176b-parameter open-access multilingual language model. arXiv preprint arXiv:2211.05100, 2022. Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations. arXiv preprint arXiv:1803.02155, 2018. Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2021. Laure Thompson and David Mimno. Topic modeling with contextualized word representation clusters. arXiv preprint arXiv:2010.12626, 2020. Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bash- lykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023. Asher Trockman and J Zico Kolter. Mimetic initialization of self-attention layers. arXiv preprint arXiv:2305.09828, 2023. Yao-Hung Hubert Tsai, Shaojie Bai, Makoto Yamada, Louis-Philippe Morency, and Ruslan Salakhutdinov. Transformer dissection: a unified understanding of transformer's attention via the lens of kernel. arXiv preprint arXiv:1908.11775, 2019. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. Roman Vershynin. High-dimensional probability: An introduction with applications in data science, vol- ume 47. Cambridge university press, 2018. Jesse Vig and Yonatan Belinkov. Analyzing the structure of attention in a transformer language model. arXiv preprint arXiv:1906.04284, 2019. Benyou Wang, Lifeng Shang, Christina Lioma, Xin Jiang, Hao Yang, Qun Liu, and Jakob Grue Simonsen. On position embeddings in bert. In International Conference on Learning Representations, 2020. Kevin Wang, Alexandre Variengien, Arthur Conmy, Buck Shlegeris, and Jacob Steinhardt. Interpretability in the wild: a circuit for indirect object identification in gpt-2 small. arXiv preprint arXiv:2211.00593, 2022. Yu-An Wang and Yun-Nung Chen. What do position embeddings learn? an empirical study of pre-trained language model positional encoding. arXiv preprint arXiv:2010.04903, 2020. 14 Catherine Yeh, Yida Chen, Aoyu Wu, Cynthia Chen, Fernanda Vi ́egas, and Martin Wattenberg. Attentionviz: A global view of transformer attention. arXiv preprint arXiv:2305.03210, 2023. Peng Zhao and Bin Yu. On model selection consistency of lasso. The Journal of Machine Learning Research, 7:2541–2563, 2006. 15 Appendix Table of Contents A Models, datasets, and implementations 16 A.1 Pretrained models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 A.2 Training small transformers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 A.3 Removing artifacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 A.4 Positional basis calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 B Additional empirical results for Section 2 18 B.1 PCA visualization . . . . B.2 Low rank measurements B.3 Fourier analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 C Additional empirical results for Section 3 D Additional empirical results for Section 4 21 21 D.1 On QK matrix decomposition and induction heads . . . . . . . . . . . . . . . . . . . . . . 21 D.2 On attention weight matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 E Additional empirical results for Section 5 F Proofs for theoretical results 30 30 F.1 Proof of Theorem 1 . F.2 Proof of Theorem 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 A Models, datasets, and implementations We present the details of our experiments and measurements. A.1 Pretrained models Except for NanoGPT and models in Section 5, we download and use pretrained models from Huggingface. • GPT-2 (Radford et al., 2019): 12-layer, 12-head, 768-dim, 124M parameters, autoregressive, absolute positional encoding at 0th-layer, pretrained on OpenWebText; • BERT (Devlin et al., 2018): 12-layer, 12-head, 768-dim, 124M parameters, masked prediction, abso- lute positional encoding at 0th-layer, pretrained on BooksCorpus and English Wikipedia; • BLOOM (Scao et al., 2022): 24-layer, 16-head, 1024-dim, 560M parameters, ALiBI positional en- codings (Press et al., 2021) at each layer, pretrained on 45 natural languages and 12 programming languages; 16 • Llama2-7B (Touvron et al., 2023): 32-layer, 32-head, 4096-dim, 7B parameters, autoregressive, Ro- tary positional embedding (Su et al., 2021) at every layer, pretrained on a variety of data. Note that (i) the training objective for pretraining BERT is different from the other models, and (ii) Llama 2 uses rotary positional encoding for each layer and BLOOM uses ALiBI positional encoding- which is different from absolute positional encoding that is added at the 0-th layer (Vaswani et al., 2017). A.2 Training small transformers We train a few smaller transformers in this paper. Models are based on the GPT-2 architecture with adjusted parameters, and we adopt the implementation of the GitHub Project by Andrej Karpathy. The hardware we use is mainly RTX3090ti. The following experiments take 2 hours, 3 hours, and 3 hours to train respectively. • NanoGPT in Table 1 and 2: The model is a Transformer with 6 layers, 6 heads, 384 dimensional embeddings, residual/embedding/attention dropout set to 0.1, weight decay set to 0.1, and a context window of 128. The dataset is Shakespeare with character-level tokenization. We train 100K iterations using the AdamW optimizer, with a batch size of 64 and a cosine scheduler (1000 step warmup) up to a learning rate of 5e-5; • Randomization: Similarly, we use a Transformer with 8 layers, 8 heads, 512 dimensional embed- dings, residual/embedding/attention dropout set to 0.1, weight decay set to 0.1, and a context window of 256. We train the model on the first 10K samples of OpenWebText dataset, which is tokenized using the same tokenizer as in GPT2. We train 100K iterations using the AdamW optimizer, with a batch size 64 and a cosine scheduler (1000 step warmup) up to a learning rate of 5e-5; • Addition: Similarly, we use a Transformer with 8 layers, 8 heads, 512 dimensional embeddings, residual/embedding/attention dropout set to 0.1m and weight decay set to 0.1. The context window is set as the length of the longest sequence, i.e., 32 for the 10-digit addition task here. We train 100K iterations using the AdamW optimizer, with a batch size 64 and a cosine scheduler (1000 step warmup) up to a learning rate of 5e-5. A.3 Removing artifacts There are two likely artifacts in the measurements and visualization that we removed in the paper. 1. First token in a sequence. We find that a large proportion of attention is focused on the first token, which usually distorts visualization significantly. It has been known that the first token functions as a "null token", which is removed in analysis (Vig & Belinkov, 2019). We also adopt removing the first token in our measurements and visualization. 2. Final-layer embeddings. We find that the embeddings of the final layer typically do not have a sig- nificant positional basis component. It is likely that positional information is no longer needed since last-layer embeddings are directly connected to the loss function. A.4 Positional basis calculation We calculate positional bases based on sampled sequences of length T from a subset of the corpus, which includes OpenWebText, WikiText, and GitHub. The implementation and weights of the pretrained models are obtained from HuggingFace. For the curated corpus subset, we utilize the streaming version of the HuggingFace datasets and extract the first 10K samples from the train split. Then we tokenize the dataset using the same tokenizer employed 17 Table 3: ScreeNOT Rank Estimate for models, datasets and at each layer. Layer 0 Layer 1 Layer 2 Layer 3 Layer 4 Layer 5 Layer 6 Layer 7 Layer 8 Layer 9 Layer 10 Layer 11 Layer 12 BERT BLOOM GPT2 Llama2 GitHub OpenWebText WikiText GitHub OpenWebText WikiText GitHub OpenWebText WikiText GitHub OpenWebText WikiText 15 15 15 8 6 6 15 15 15 6 7 8 16 16 16 9 10 8 14 13 14 10 10 10 16 18 18 9 10 9 13 14 14 9 10 10 16 16 16 8 11 10 12 12 12 8 11 10 14 11 12 9 11 10 12 13 11 10 11 9 11 11 11 10 10 11 11 11 11 8 10 8 11 9 9 10 11 11 11 10 11 8 9 8 9 9 9 11 11 11 10 10 11 9 10 8 10 11 11 10 11 11 10 10 11 9 9 8 10 11 11 10 11 11 10 10 11 9 8 8 11 11 11 10 10 11 11 9 9 9 9 8 11 11 12 10 10 10 11 9 10 8 8 8 12 13 12 10 11 11 10 12 12 10 10 10 Table 4: Stable rank for models, datasets and at each layer. Layer 0 Layer 1 Layer 2 Layer 3 Layer 4 Layer 5 Layer 6 Layer 7 Layer 8 Layer 9 Layer 10 Layer 11 Layer 12 BERT BLOOM GPT2 Llama2 GitHub OpenWebText WikiText GitHub OpenWebText WikiText GitHub OpenWebText WikiText GitHub OpenWebText WikiText 9.19 9.19 9.19 8.39 8.33 8.42 2.05 2.05 2.05 24.87 52.23 24.70 7.79 7.63 7.78 1.25 1.27 1.27 1.92 1.92 1.92 1.00 1.00 1.00 5.26 5.25 5.03 1.20 1.30 1.28 1.91 1.91 1.91 1.00 1.00 1.00 4.73 4.73 4.58 1.21 1.24 1.30 1.89 1.89 1.89 1.00 1.00 1.01 4.34 4.10 3.99 1.21 1.24 1.31 1.90 1.88 1.88 1.00 1.00 1.01 3.84 3.53 3.48 1.23 1.27 1.34 1.90 1.88 1.88 1.00 1.00 1.02 3.48 3.16 3.14 1.29 1.32 1.41 1.92 1.88 1.88 1.00 1.01 1.03 3.20 2.84 2.82 1.29 1.34 1.43 1.94 1.90 1.90 1.01 1.01 1.05 2.70 2.46 2.42 1.28 1.33 1.41 1.98 1.91 1.91 1.01 1.02 1.09 2.45 2.30 2.27 1.25 1.26 1.32 2.03 1.96 1.97 1.01 1.02 1.16 2.04 2.18 2.13 1.21 1.16 1.22 2.05 2.02 2.03 1.02 1.03 1.20 1.84 2.22 2.16 1.02 1.01 1.01 1.70 2.24 2.19 1.03 1.05 1.26 1.91 2.15 2.12 1.00 1.00 1.00 1.11 1.49 1.56 1.17 1.44 1.30 by the pretrained model. The size of the final datasets vary across tasks and datasets, and we ensure that there are at least 1M tokens in each case to prevent the occurrence of overlapping sequences. We set the context window T = 512 for BERT, BLOOM, and GPT-2, as this maintains the maximum context window utilized during pretraining. For Llama2, we set T = 512 instead of the maximum context sequence due to computational resource limitations. B Additional empirical results for Section 2 B.1 PCA visualization See Figure 7-Figure 11. Note: BERT displays a more complex circular shape, likely because its training objective is different from the others. B.2 Low rank measurements Rank estimate. We report the rank estimate for all pretrained models and datasets in Table 3. Additionally, we include the Stable rank estimate in Table 4. Relative norm. We report the relative norm for all pretrained models and datasets in Table 5. Spectral analysis. Recall that in Figure 3 (left), we showed the singular values plot for P = [pos1, . . . , posT ], Cvec = [cvec1,1, . . . , cvecc,T ], R = [resid1,1, . . . , residc,T ]. Note that P has T columns while Cvec and R has CT columns. In Figure 3 (left), we downsampled Cvec and R to match the number of columns of P . Alternatively, we also tried multiplied P by C and got similar results. √ 18 Figure 7: Top-2 principal components of positional basis; GitHub, GPT2 Figure 8: Top-2 principal components of positional basis; WikiText, GPT2 Figure 9: Top-2 principal components of positional basis; OpenWebText, BLOOM 19 Layer: 0Layer: 1Layer: 2Layer: 3Layer: 4Layer: 5Layer: 6Layer: 7Layer: 8Layer: 9Layer: 10Layer: 11Layer: 0Layer: 1Layer: 2Layer: 3Layer: 4Layer: 5Layer: 6Layer: 7Layer: 8Layer: 9Layer: 10Layer: 11Layer: 0Layer: 2Layer: 4Layer: 6Layer: 8Layer: 10Layer: 12Layer: 14Layer: 16Layer: 18Layer: 20Layer: 23 Figure 10: Top-2 principal components of positional basis; OpenWebText, BERT Figure 11: Top-2 principal components of positional basis; OpenWebText, Llama2 Figure 12: Top-2 principal components of positional basis; GitHub, Llama2 20 Layer: 0Layer: 1Layer: 2Layer: 3Layer: 4Layer: 5Layer: 6Layer: 7Layer: 8Layer: 9Layer: 10Layer: 11Layer: 0Layer: 2Layer: 5Layer: 8Layer: 11Layer: 14Layer: 16Layer: 19Layer: 22Layer: 25Layer: 28Layer: 31Layer: 0Layer: 2Layer: 5Layer: 8Layer: 11Layer: 14Layer: 16Layer: 19Layer: 22Layer: 25Layer: 28Layer: 31 Table 5: Relative norm for models, datasets and at each layer. Layer 0 Layer 1 Layer 2 Layer 3 Layer 4 Layer 5 Layer 6 Layer 7 Layer 8 Layer 9 Layer 10 Layer 11 Layer 12 BERT BLOOM GPT2 Llama2 GitHub OpenWebText WikiText GitHub OpenWebText WikiText GitHub OpenWebText WikiText GitHub OpenWebText WikiText 0.325 0.361 0.356 0.009 0.008 0.009 0.758 0.807 0.815 0.025 0.031 0.035 0.267 0.302 0.293 0.079 0.092 0.098 0.447 0.463 0.470 0.221 0.146 0.067 0.246 0.265 0.267 0.123 0.108 0.123 0.396 0.411 0.416 0.221 0.146 0.067 0.242 0.265 0.265 0.147 0.143 0.152 0.359 0.371 0.375 0.221 0.146 0.067 0.234 0.263 0.263 0.170 0.164 0.166 0.338 0.344 0.345 0.222 0.146 0.067 0.229 0.249 0.250 0.181 0.173 0.174 0.316 0.324 0.325 0.222 0.147 0.068 0.232 0.245 0.246 0.173 0.158 0.159 0.287 0.301 0.299 0.222 0.147 0.068 0.248 0.266 0.269 0.158 0.143 0.143 0.266 0.271 0.270 0.223 0.148 0.069 0.248 0.273 0.278 0.145 0.131 0.133 0.237 0.232 0.229 0.224 0.150 0.071 0.215 0.215 0.217 0.138 0.135 0.134 0.207 0.196 0.197 0.225 0.152 0.073 0.211 0.170 0.172 0.137 0.153 0.147 0.172 0.150 0.152 0.226 0.153 0.077 0.173 0.117 0.118 0.182 0.278 0.250 0.140 0.095 0.098 0.226 0.154 0.080 0.162 0.122 0.122 0.140 0.385 0.358 0.100 0.030 0.030 0.158 0.118 0.146 B.3 Fourier analysis See Figure 13-Figure 18. Compared with Figure 3 (right), for completeness we also include in the plots 0-th coefficients (often not informative). We find that BERT contains considerable higher-frequency components, likely due to its non-autoregressive training; see also Wang & Chen (2020). C Additional empirical results for Section 3 See Figure 19-Figure 23. Note that there are progressive cluster compactness changes across layers in It is likely that pretraining on heterogeneous datasets creates multiscale cluster BLOOM and Llama 2. structure. An investigation of this phenomenon is left as future work. Measuring cluster compactness. We define ΣW and ΣB as the within-cluster and between-cluster co- variance matrix respectively, and we use Tr(ΣBΣ−1 W ) to measure how well the samples are separated into clusters (bigger value is better). To compare the performance of cvec and raw embeddings in the down- stream clustering tasks, we calculate them based on four documents of OpenWebText. In Figure 24, Figure 25, and Figure 26, we show the first two principal components for the cvec (left) and raw embeddings (right), with samples from documents shown in different colors. Based on the metric of Tr(ΣBΣ−1 W ) in the title and the PCA plot, we can see that cvec-s are better separated than the raw embeddings, indicating that the removal of positional basis is good for clustering tasks. D Additional empirical results for Section 4 D.1 On QK matrix decomposition and induction heads On global mean vector. We show the QK matrix decomposition with global mean (Figure 28), and with- out global mean (Figure 27). Note that adding a constant to all entries of the QK matrix will not change the attention matrix, because softmax computes the ratio. We conclude that the global mean vector μ has little effects on interpretations. See Figure 29-Figure 35 for more QK plots at various layers and heads on GPT-2 and BLOOM model. D.2 On attention weight matrix See Figure 36-Figure 41 for more plots on rotated W = W q(W k)⊤/ for BERT and GPT-2 model. √ dhead at various layers and heads 21 Figure 13: Fourier transformed positional basis; Openwebtext, GPT2 Figure 14: Fourier transformed positional basis; Openwebtext, BERT Figure 15: Fourier transformed positional basis; Openwebtext, BLOOM 22 123456789123456789Layer: 0123456789123456789Layer: 1123456789123456789Layer: 2123456789123456789Layer: 3123456789123456789Layer: 4123456789123456789Layer: 5123456789123456789Layer: 6123456789123456789Layer: 7123456789123456789Layer: 8123456789123456789Layer: 9123456789123456789Layer: 10123456789123456789Layer: 11150100500501001502001501005005010015020020015010050050100150200200150100500501001502002001501005005010015020020015010050050100150200200150100500501001502002001501005005010015020020015010050050100150200200150100500501001502002001501005005010015020020015010050050100150200123456789123456789Layer: 0123456789123456789Layer: 1123456789123456789Layer: 2123456789123456789Layer: 3123456789123456789Layer: 4123456789123456789Layer: 5123456789123456789Layer: 6123456789123456789Layer: 7123456789123456789Layer: 8123456789123456789Layer: 9123456789123456789Layer: 10123456789123456789Layer: 1115105051015302010010203060402002040607550250255075100755025025507510010050050100100500501001005005010010050050100150100500501001501501005005010015015010050050100150123456789123456789Layer: 0123456789123456789Layer: 2123456789123456789Layer: 4123456789123456789Layer: 6123456789123456789Layer: 8123456789123456789Layer: 10123456789123456789Layer: 12123456789123456789Layer: 14123456789123456789Layer: 16123456789123456789Layer: 18123456789123456789Layer: 20123456789123456789Layer: 231.00.50.00.51.01501005005010015030020010001002003003002001000100200300300200100010020030030020010001002003003002001000100200300300200100010020030020010001002002001000100200300200100010020030015010050050100150 Figure 16: Fourier transformed positional basis; Openwebtext, Llama2 Figure 17: Fourier transformed positional basis; GitHub, GPT2 Figure 18: Fourier transformed positional basis; WikiText, GPT2 23 123456789123456789Layer: 0123456789123456789Layer: 2123456789123456789Layer: 5123456789123456789Layer: 8123456789123456789Layer: 11123456789123456789Layer: 14123456789123456789Layer: 16123456789123456789Layer: 19123456789123456789Layer: 22123456789123456789Layer: 25123456789123456789Layer: 28123456789123456789Layer: 311.51.00.50.00.51.01.520010001002002001000100200200100010020020010001002002001000100200200100010020020010001002002001000100200200150100500501001502001501005005010015010050050100123456789123456789Layer: 0123456789123456789Layer: 1123456789123456789Layer: 2123456789123456789Layer: 3123456789123456789Layer: 4123456789123456789Layer: 5123456789123456789Layer: 6123456789123456789Layer: 7123456789123456789Layer: 8123456789123456789Layer: 9123456789123456789Layer: 10123456789123456789Layer: 111501005005010015020015010050050100150200200150100500501001502002001501005005010015020020015010050050100150200200150100500501001502002001501005005010015020020015010050050100150200200150100500501001502002001501005005010015020020010001002002001000100200123456789123456789Layer: 0123456789123456789Layer: 1123456789123456789Layer: 2123456789123456789Layer: 3123456789123456789Layer: 4123456789123456789Layer: 5123456789123456789Layer: 6123456789123456789Layer: 7123456789123456789Layer: 8123456789123456789Layer: 9123456789123456789Layer: 10123456789123456789Layer: 11150100500501001502001501005005010015020020015010050050100150200200150100500501001502002001501005005010015020020015010050050100150200200150100500501001502002001501005005010015020020015010050050100150200200150100500501001502002001501005005010015020020015010050050100150200 Figure 19: Gram matrix of positional basis and context basis; Openwebtext, GPT2 Figure 20: Gram matrix of positional basis and context basis; Openwebtext, BLOOM Figure 21: Gram matrix of positional basis and context basis; Openwebtext, Llama2 24 Figure 22: Gram matrix of positional basis and context basis; GitHub, Llama Figure 23: Gram matrix of positional basis and context basis; Wikitext, GPT2 Figure 24: Top-2 principal components; GPT2, OpenWebText, L7. Left shows cvecs and right shows raw embeddings. 25 20020406080100604020020406080Layer 7; Tr(Sb/Sw):5.492202102001901801708060402002040Layer 7; Tr(Sb/Sw):3.30 Figure 25: Top-2 principal components; GPT2, OpenWebText, L9. Left shows cvecs and right shows raw embeddings. Figure 26: Top-2 principal components; GPT2, OpenWebText, L11. Left shows cvecs and right shows raw embeddings. Figure 27: GPT2 L10H7 QK Decomposition; Global mean removed 26 12510075502502550050100150Layer 9; Tr(Sb/Sw):5.5932030028026024022050250255075100Layer 9; Tr(Sb/Sw):3.80100010020015010050050100150200250Layer 11; Tr(Sb/Sw):8.1165060055050020015010050050100150Layer 11; Tr(Sb/Sw):3.39 Figure 28: GPT2 L10H7 QK Decomposition; Global mean not removed Figure 29: QK Decomposition; BLOOM L10H1 Figure 30: QK Decomposition; BLOOM L6H12 Figure 31: QK Decomposition; BLOOM L7H10 Figure 32: QK Decomposition; BLOOM L0H5 Figure 33: QK Decomposition; GPT2 L0H1 Figure 34: QK Decomposition; GPT2 L10H1 27 Figure 35: QK Decomposition; GPT2 L4H11 Figure 36: Dissecting attention weights, GPT2 L0 Figure 37: Dissecting attention weights, GPT2 L6 Figure 38: Dissecting attention weights, GPT2 L10 28 Figure 39: Dissecting attention weights, BERT L0 Figure 40: Dissecting attention weights, BERT L6 Figure 41: Dissecting attention weights, BERT L10 29 E Additional empirical results for Section 5 Full results on the Randomization experiment. We apply three noise levels (regular, partially random, fully random) in both of the training and inference process. We give the 3 × 3 = 9 results in Figure 42-Figure 50. Addition experiment. We have manually generated the addition dataset for the carry and no-carry tasks, with training set and validation set containing 100K and 10K additions of length ranging from 5 to 10 respectively. The models achieve 100% and 72% accuracy on the validation set in the no-carry and carry experiments, respectively. However, the model does not generalize: they get 5.02% and 0.00% accuracy on 1K samples of additions with length from 1 to 4. See Figure 51-Figure 56 for the QK plots at various layers and heads under carry and no-carry addition tasks. Notice the unsmoothness in the positional basis gram matrix that is pervasive across different layers, heads, and tasks. F Proofs for theoretical results We introduce some additional notations. Denote the indicator function by 1. We denote by 1N the vector (1, 1, . . . , 1)⊤ ∈ RN . For a complex matrix A, we denote the conjugate transpose by A∗. For convenience, for a matrix A, we will write ∆A instead of ∆(1,1)A. For a vector x ∈ CN , we also write ∆x to denote the finite difference vector N * (x1 − x0, x2 − x1, . . . , xN − xN −1)⊤ (where xN = x0). We will say that a Hermitian matrix A ∈ CN ×N is positive semidefinite (PSD) if and only if x∗Ax ≥ 0 for every x ∈ CN . Denote by R(x) the real part of a complex number x ∈ C. F.1 Proof of Theorem 1 In this subsection, we denote a generic dimension by N and ω = exp(−2πi/N ). We need some standard definitions and properties; see Broughton & Bryan (2018) for example. The discrete Fourier transform (DFT) matrix F ∈ CN ×N is given by Ftt′ = ω(t−1)(t′−1) for 1 ≤ t, t′ ≤ N . The inverse discrete Fourier transform (IDFT) matrix is N −1F ∗. Both the DFT matrix and the IDFT matrix are symmetric (not Hermitian). Sometimes we prefer to write F ⊤ instead of F simply for formality. For a generic matrix A ∈ RN ×N , we denote by ˆA ∈ CN ×N the matrix after its 2-d DFT. It satisfies ˆA = F AF ⊤, A = N −2F ∗ ˆA(F ∗)⊤. (13) The following simple lemma is a consequence of integration-by-parts for the discrete version. For completeness we include a proof. Lemma 1. Let x ∈ RN be a vector, and ˆx = F x be its DFT. Then for t = 1, . . . , N , ˆxt = γt(F ∆x)t + 1{t = 1} * N (cid:88) t′=1 xt′, where γt := N −1 (cid:18) 1 − exp (cid:16) −2πi(t − 1) N (cid:17)(cid:19)−1 for t > 1 and γ1 := 1. (14) (15) 30 Figure 42: Training: regular; Inference: regular Figure 43: Training: regular; Inference: partially random 31 Figure 44: Training: regular; Inference: fully random Figure 45: Training: partially random; Inference: regular 32 Figure 46: Training: partially random; Inference: partially random Figure 47: Training: partially random; Inference: fully random 33 Figure 48: Training: fully random; Inference: regular Figure 49: Training: fully random; Inference: partially random 34 Figure 50: Training: fully random; Inference: fully random Figure 51: Addition without carry, L2H3 Figure 52: Addition without carry, L3H0 Figure 53: Addition without carry, L3H1 Figure 54: Addition with carry, L1H0 35 Proof. If t = 1, then (F x)t = (cid:80)N t′=1 xt′, and (F ∆x)t = N (cid:80)N t′=1(xt′ − xt′−1) = 0. For t ̸= 1, (F ∆x)t = N N (cid:88) t′=1 ω(t−1)(t′−1)(xt′ − xt′−1) = N N (cid:88) t′=1 (cid:0)ω(t−1)(t′−1) − ω(t−1)t′(cid:1)xt′ = N (cid:0)1 − ω(t−1)(cid:1) N (cid:88) t′=1 ω(t−1)(t′−1)xt′ = γ−1 t (F x)t. This shows ˆxt = γt(F ∆x)t for t ̸= 1 and completes the proof. A simple bound on the modulus |γt| is given by the following lemma. Lemma 2. Let γt be defined by Equation 15. For positive integer 1 < t ≤ N/2, we have |γN −t+2| = |γt| ≤ 1 8(t − 1) . Proof. The equality part is obvious. For any θ ∈ (−π, π), we have |1 − exp(iθ)|2 = (1 − cos θ)2 + sin2 θ = 4 sin2(θ/2) = 4 sin2(|θ|/2) Since sin θ/θ is monotone decreasing in (0, π/2), we have sin(|θ|/2) ≥ sin(π/2)|θ|/(π/2), Thus, |1 − exp(iθ)| ≥ 4|θ|/π . Setting θ = −2π(t − 1)/N , we obtain the desired upper bound on |γt|. Denote Γ = diag{γ1, . . . , γN }. By Lemma 1, for any vector x ∈ RN , F x = ΓF ∆x +      x⊤1N 0 ... 0      . Below we will assume that the generic matrix A ∈ RN ×N is symmetric and satisfies A1N = 0. Observe that F A = [F A:,1, . . . , F A:,N ] = ΓF [∆A:,1, . . . , ∆A:,N ], F AF ⊤ = ΓF (∆A)F ⊤Γ where we used A1N = 0 and (∆A)1N = 0. Repeating the second equality m times, we obtain ˆA = F AF ⊤ = ΓmF (∆(m,m)A)F ⊤Γm. Now fix a generic nonempty index sets I ⊂ {1, 2, . . . , N } and denote J = {1, . . . , N } \ I. Consider the block matrix form of ˆA: Using the block matrix notation, we derive ˆA = (cid:18) ˆAI,I ˆAJ ,I ˆAI,J ˆAJ ,J (cid:19) . ∥ ˆAI,J ∥op = ∥Γm I,I (cid:0)F (∆(m,m)A)F ⊤(cid:1) I,J Γm J ,J ∥op ≤ max t∈I,t′∈J |γtγt′|m∥F (∆(m,m)A)F ⊤∥op . 36 Similar inequalities hold for other three blocks. By Lemma 2 we have |γt| ≤ 1 for all t. Adding the three inequalities that involve at least one index set J , we get (cid:13) (cid:13) ˆA − (cid:13) (cid:13) (cid:18) ˆAI,I 0 0 0 (cid:19)(cid:13) (cid:13) (cid:13) (cid:13)op ≤ 3 max t∈J |γt|m∥F (∆(m,m)A)F ⊤∥op . Since F F ∗ = N , we have ∥F ∥op = ∥F F ∗∥1/2 op = N 1/2. Denoting A(res) := N −2F ∗(cid:104) ˆA − (cid:18) ˆAI,I 0 0 0 (cid:19) (cid:105) (F ∗)⊤ , we find ∥A(res)∥op ≤ 3 max t∈J |γt|mN −2∥F ∥4 op∥∆(m,m)A∥op ≤ 3 max t∈J |γt|mN ∥∆(m,m)A∥max (16) where the first inequality is due to Lemma 2 and the second inequality is due to the inequality between matrix operator norm and max norm. To finish the proof, let us make some specification: we identify N with ̃T (namely 2T ), identify A with ̃G, and identify I = {1, . . . , k} ∪ { ̃T − k + 1, . . . , ̃T }. These choices satisfy the requirement for A because ̃G is symmetric and it satisfies ̃G1 ̃T = 2G1T = 0 due to the assumption pos1 + . . . + posT = 0. By Lemma 2, maxt∈J |γt| ≤ 1/(8k), so Equation 16 gives ∥A(res)∥op ≤ 6(8k)−mT ∥∆(m,m) ̃G∥max By the definition of A(res) and the identities in 13, ̃G = A(res) + N −2F ∗ (cid:18) ˆAI,I 0 0 0 (cid:19) (F ∗)⊤ . We make the following claim. Lemma 3. There exists B ∈ Rk×k such that (cid:18) ˆAI,I 0 0 0 (cid:20) F ∗ N −2 (cid:19) (cid:21) (F ∗)⊤ 1:T,1:T = F≤kB(F≤kB)⊤ (17) While the DFT matrix is complex, the above lemma claims that the left-hand side is a Gram matrix of real low-frequency vectors. Once this lemma is proved, we can combine this lemma with Equation 16 and G = ̃G1:T,1:T to obtain the desired inequality 6 in Theorem 1. Proof of Lemma 3. Recall ω = exp(−2πi/2T ). We further introduce some notations. Denote I1 = {1, . . . , k} and I2 = {T − k + 1, . . . , T } so that I = I1 ∪ I2. Let qt = ωt−1 for positive integer t, matrix Q ∈ RT ×k and matrix D ∈ Rk×k be given by Qt,s = R(qs−0.5 t ), where t ≤ T, s ≤ k, D = diag(q1/2 1 , . . . , q1/2 k ) 37 For t, t′ ∈ I, ˆAt,t′ = (F AF T )t,t′ T (cid:88) = Ft,sGs,s′Ft′,s′ + T (cid:88) s,s′=1 Ft,2T +1−sGs,s′Ft′,s′ s,s′=1 T (cid:88) s,s′=1 + Ft,sGs,s′Ft′,2T +1−s′ + T (cid:88) s,s′=1 Ft,2T +1−sGs,s′Ft′,2T +1−s′ = q1/2 t q1/2 t′ T (cid:88) (cid:16) Gs,s′ s,s′=1 qs−0.5 t qs′−0.5 t′ + q−s+0.5 t qs′−0.5 t′ + qs−0.5 t q−s′+0.5 t′ + q−s+0.5 t q−s′+0.5 t′ (cid:17) = 4q1/2 t q1/2 t′ T (cid:88) s,s′=1 Gs,s′R(qs−1/2 t )R(qs′−1/2 t′ ) . If t, t′ ∈ I1, the above equality leads to ˆAI1,I1 = 4DQ⊤GQD; and more generally ˆAI,I is given by symmetrically extending ˆAI1,I1 as in the definition of ̃G. Since 4Q⊤GQ is a PSD, we can find B0 ∈ Rk×k such that We want to simplify F ∗ :,I ˆAI,IF ∗ I,:, namely 4Q⊤GQ = B0B⊤ 0 . F ∗ :,I1 ˆAI1,I1F ∗ I1,: + F ∗ :,I1 ˆAI1,I2F ∗ I2,: + F ∗ :,I2 ˆAI2,I1F ∗ I1,: + F ∗ :,I2 ˆAI2,I2F ∗ I2,: (18) For any t, t′ ∈ I1, (F ∗)t,I1 ˆAI1,I1(F ∗)I1,t′ = (F ∗)t,I1DB0B⊤ 0 D(F ∗)I1,t′ and similar equations hold for other three cases. Observe that (F ∗)t,I1D = ( ̄q1−0.5 t , . . . , ̄qk−0.5 t ), (F ∗)t,I2D = ( ̄q2T −0.5 t , . . . , ̄q2T −k+0.5 t ) . When we add the four terms in 18, the imaginary part cancels out. Thus, F ∗ t,I ˆAI,IF ∗ I,t′ = 4 (cid:16) R( ̄q1−0.5 t ), . . . , R( ̄qk−0.5 t (cid:17) ) B0B⊤ 0 (cid:16) R( ̄q1−0.5 t ), . . . , R( ̄qk−0.5 t (cid:17)⊤ ) . Note that R( ̄qs−0.5 and denote B = B0/N , we find that Equation 17 holds. ) = cos(π(t − 1)(s − 0.5)/T ) = (F≤k)t,s. Expressing F ∗ :,I t ˆAI,IF ∗ I,: in the matrix form F.2 Proof of Theorem 2 First we note that KW (xq, xk) = KW11(xq, xk)KW12(xq, xk)KW21(xq, xk)KW22(xq, xk) . We will prove that KW11(xq, xk) = (cid:0)1 + O(incoh)(cid:1) * KW11(cq, ck) . (19) (20) 38 To prove this, it suffices to show that max (cid:8)KW11(cq, tk), KW11(tq, ck), KW11(tq, tk)(cid:9) = 1 + O(incoh) . (21) We decompose W11 as in Equation 11 and find (cid:16) (cid:17) KW11(cq, tk) log = (cq)⊤W11tk = s (cid:88) k=1 ak(u⊤ k cq)(v⊤ k tk) . By mutual incoherence, |v⊤ k tk| ≤ incoh since vk ∈ B1 and tk ∈ B2; and trivially |u⊤ k ck| ≤ 1, so (cid:16) (cid:12) (cid:12) (cid:12)log KW11(cq, tk) (cid:17)(cid:12) (cid:12) (cid:12) ≤ s (cid:88) k=1 |u⊤ k ck| * |v⊤ k tq| ≤ s * incoh . Since by assumption s = O(1) and exp(incoh) = 1 + O(incoh), we derive KW11(cq, tk) = 1 + O(incoh) . The other two terms in Equation 21 follow a similar argument and thus are all bounded by 1 + O(incoh). We can prove similarly that KW12(xq, xk) = (cid:0)1 + O(incoh)(cid:1) * KW12(cq, tk) , KW21(xq, xk) = (cid:0)1 + O(incoh)(cid:1) * KW21(tq, ck) , KW21(xq, xk) = (cid:0)1 + O(incoh)(cid:1) * KW22(tq, tk) . and together with Equation 20 and Equation 19, this leads to the desired Equation 12. Below we prove the "moreover" part. By standard properties of independent subgaussian random vari- ables (Vershynin, 2018, Sect. 2), (cq)⊤Z11tk is still a subgaussian random variable, and with probability at least 1 − O(exp(−incoh2 * d)), for certain constant C > 0, (cid:16) (cid:12) (cid:12) (cid:12)log √ KW11+Z/ d(cq, tk) (cid:17)(cid:12) (cid:12) (cid:12) ≤ s * incoh + Cincoh = O(incoh). Similar high-probability bounds hold for other terms. By the union bound over all possible choice of vectors in B0 2, we arrive at our claim. 1 and B0 39 Figure 55: Addition with carry, L1H4 Figure 56: Addition with carry, L1H7 40
http://arxiv.org/abs/2310.04859v2
"2023-10-10T08:03:47"
"2023-10-07T15:47:31"
Universal Graph Random Features
We propose a novel random walk-based algorithm for unbiased estimation of arbitrary functions of a weighted adjacency matrix, coined universal graph random features (u-GRFs). This includes many of the most popular examples of kernels defined on the nodes of a graph. Our algorithm enjoys subquadratic time complexity with respect to the number of nodes, overcoming the notoriously prohibitive cubic scaling of exact graph kernel evaluation. It can also be trivially distributed across machines, permitting learning on much larger networks. At the heart of the algorithm is a modulation function which upweights or downweights the contribution from different random walks depending on their lengths. We show that by parameterising it with a neural network we can obtain u-GRFs that give higher-quality kernel estimates or perform efficient, scalable kernel learning. We provide robust theoretical analysis and support our findings with experiments including pointwise estimation of fixed graph kernels, solving non-homogeneous graph ordinary differential equations, node clustering and kernel regression on triangular meshes.
[ "Isaac Reid", "Krzysztof Choromanski", "Eli Berger", "Adrian Weller" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04859v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04859v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "stat.ML", "@scheme": "http://arxiv.org/schemas/atom" }
[ "stat.ML", "cs.LG" ]
3 2 0 2 t c O 0 1 ] L M . t a t s [ 2 v 9 5 8 4 0 . 0 1 3 2 : v i X r a Preprint. Under review. Universal Graph Random Features Isaac Reid1∗, Krzysztof Choromanski2,3∗, Eli Berger4∗, Adrian Weller1,5 1University of Cambridge, 2Google DeepMind, 3Columbia University, 4University of Haifa, 5Alan Turing Institute ir337@cam.ac.uk, kchoro@google.com Abstract We propose a novel random walk-based algorithm for unbiased estimation of arbitrary functions of a weighted adjacency matrix, coined universal graph random features (u-GRFs). This includes many of the most popu- lar examples of kernels defined on the nodes of a graph. Our algorithm enjoys subquadratic time complexity with respect to the number of nodes, overcoming the notoriously prohibitive cubic scaling of exact graph kernel It can also be trivially distributed across machines, permit- evaluation. ting learning on much larger networks. At the heart of the algorithm is a modulation function which upweights or downweights the contribution from different random walks depending on their lengths. We show that by parameterising it with a neural network we can obtain u-GRFs that give higher-quality kernel estimates or perform efficient, scalable kernel learn- ing. We provide robust theoretical analysis and support our findings with experiments including pointwise estimation of fixed graph kernels, solving non-homogeneous graph ordinary differential equations, node clustering and kernel regression on triangular meshes.1 1 Introduction and related work The kernel trick is a powerful technique to perform nonlinear inference using linear learn- ing algorithms (Campbell, 2002; Kontorovich et al., 2008; Canu and Smola, 2006; Smola and Schölkopf, 2002). Supposing we have a set of N datapoints X = {xi}N i=1, it replaces i xj with evaluations of a kernel function K : X × X → R, cap- Euclidean dot products x⊤ turing the 'similarity' of the datapoints by instead taking an inner product between implicit (possibly infinite-dimensional) feature vectors in some Hilbert space HK. An object of key importance here is the Gram matrix K ∈ RN ×N whose entries enumerate the pairwise kernel evaluations, K := [K(xi, xj)]N i,j=1. Despite the theoretical rigour and empirical success enjoyed by kernel-based learning algorithms, the requirement to manifest and invert this matrix leads to notoriously poor O(N 3) time-complexity scaling. This has spurred research dedicated to efficiently approximating K, the chief example of which is random features (Rahimi and Recht, 2007): a Monte-Carlo approach which gives explicitly manifested, finite dimensional vectors φ(xi) ∈ Rm whose Euclidean dot product is equal to the kernel evaluation in expectation, Kij = E (cid:2)φ(xi)⊤φ(xj)(cid:3) . This allows one to construct a low-rank decomposition of K which provides much better scal- ability. Testament to its utility, a rich taxonomy of random features exists to approximate many different Euclidean kernels including the Gaussian, softmax, and angular and linear kernels (Johnson, 1984; Dasgupta et al., 2010; Goemans and Williamson, 2004; Choromanski et al., 2020). Kernels defined on discrete input spaces, e.g. K : N × N → R with N the set of nodes of a graph G (Smola and Kondor, 2003; Kondor and Lafferty, 2002; Chung and Yau, 1999), (1) ∗Equal contribution 1We will make all code publicly available. 1 Preprint. Under review. enjoy widespread applications including in bioinformatics (Borgwardt et al., 2005), commu- nity detection (Kloster and Gleich, 2014) and recommender systems (Yajima, 2006). More recently, they have been used in applications as diverse as manifold learning for deep gener- ative modelling (Zhou et al., 2020) and for solving single- and multiple-source shortest path problems (Crane et al., 2017). However, for these graph-based kernel methods the problem of poor scalability is particularly acute. This is because even computing the corresponding Gram matrix K is typically of at least cubic time complexity in the number of nodes N , requiring e.g. the inversion of an N × N matrix or computation of multiple matrix-matrix products. Despite the presence of this computational bottleneck, random feature methods for graph kernels have proved elusive. Indeed, only recently was a viable graph random fea- ture (GRF) mechanism proposed by Choromanski (2023). Their algorithm uses an ensemble of random walkers which deposit a 'load' at every vertex they pass through that depends on i) the product of weights of edges traversed by the walker and ii) the marginal probability of i=1 ⊂ RN the subwalk. Using this scheme, it is possible to construct random features {φ(i)}N such that φ(i)⊤φ(j) gives an unbiased approximation to the ij-th matrix element of the 2-regularised Laplacian kernel. Multiple independent approximations can be combined to estimate the d-regularised Laplacian kernel with d ̸= 2 or the diffusion kernel (although the latter is only asymptotically unbiased). The GRFs algorithm enjoys both subquadratic time complexity and strong empirical performance on tasks like k-means node clustering, and it is trivial to distribute across machines when working with massive graphs. However, a key limitation of GRFs is that they only address a limited family of graph kernels which may not be suitable for the task at hand. Our central contribution is a simple modification which generalises the algorithm to arbitrary functions of a weighted adjacency matrix, allowing efficient and unbiased approximation a much broader class of graph node kernels. We achieve this by introducing an extra modulation function f that controls each walker's load as it traverses the graph. As well as empowering practitioners to approximate many more fixed kernels, we demonstrate that f can also be parameterised by a neural network and learned. We use this powerful approach to optimise u-GRFs for higher-quality approximation of fixed kernels and for scalable implicit kernel learning. The remainder of the manuscript is organised as follows. In Sec. 2 we introduce univer- sal graph random features (u-GRFs) and prove that they enable scalable approximation of arbitrary functions of a weighted adjacency matrix, including many of the most popular examples of kernels defined on the nodes of a graph. We also extend the core algorithm with neural modulation functions, replacing one component of the u-GRF mechanism with a neural network, and derive generalisation bounds for the corresponding class of learnable graph kernels (Sec. 2.1). In Sec. 3 we run extensive experiments, including: pointwise estimation of a variety of popular graph kernels (Sec. 3.1); simulation of time evolution un- der non-homogeneous graph ordinary differential equations (Sec. 3.2); kernelised k-means node clustering including on large graphs (Sec. 3.3); training a neural modulation function to suppress the mean square error of fixed kernel estimates (Sec 3.4); and training a neu- ral modulation function to learn a kernel for node attribute prediction on triangular mesh graphs (Sec. 3.5). 2 Universal graph random features Consider a directed weighted graph G(N , E, W := [wij]i,j∈N ) where: i) N := {1, ..., N } is the set of nodes; ii) E is the set of edges, with (i, j) ∈ E if there is a directed edge from i to j in G; and iii) W is the weight matrix, with wij the weight of the directed edge from i to j (equal to 0 if no such edge exists). Note that an undirected graph can be described as directed with the symmetric weight matrix W. Now consider the matrices Kα(W) : RN ×N , where α = (αk)∞ k=0 and αk ∈ R: Kα(W) = ∞ X k=0 αkWk. (2) We assume that the sum above converges for all W under consideration. Without loss of generality, we also assume that α is normalised such that α0 = 1. The matrix Kα(W) can 2 Preprint. Under review. be associated with a graph function K G to a real number. α : N × N → R mapping from a pair of graph nodes Note that if G is an undirected graph then Kα(W) automatically inherits the symmetry of W. In this case, it follows from Weyl's perturbation inequality (Bai et al., 2000) that Kα(W) is positive semidefinite for any given α provided the spectral radius ρ(W) := maxλ∈Λ(W) (|λ|) is sufficiently small (with Λ(W) the set of eigenvalues of W). This can always be ensured by multiplying the weight matrix W by a regulariser σ2 ∈ R+. It then follows that Kα(W) can be considered the Gram matrix of a graph kernel function K G α. With suitably chosen α = (αk)∞ k=0, the class described by Eq. 2 includes many popular examples of graph node kernels in the literature (Smola and Kondor, 2003; Chapelle et al., 2002). They measure connectivity between nodes and are typically functions of the graph Laplacian matrix, defined by L := I − fW with fW := [wij/pdidj]N j wij is the weighted degree of node i such that fW is the normalised weighted adjacency matrix. For reference, Table 1 gives the kernel definitions and normalised coefficients αk (corresponding to powers of fW) to be considered later in the manuscript. In practice, factors in αk equal to a quantity raised to the power of k are absorbed into the normalisation of fW. i,j=1. Here, di := P Name Form αk d-regularised Laplacian p-step random walk Diffusion Inverse Cosine (IN + σ2L)−d (αIN − L)p, α ≥ 2 exp(−σ2L/2) cos (Lπ/4) (cid:0)d+k−1 k (cid:0)p k (cid:1) (cid:0)1 + σ−2(cid:1)−k (cid:1)(α − 1)−k k! ( σ2 2 )k k 2 if k even, (−1) 1 (cid:0) π 4 1 k! (cid:1)k * n (−1) k−1 2 o if k odd α : N ×N → R. The exp and cos mappings are Table 1: Different graph functions/kernels K G defined via Taylor series expansions rather than element-wise, e.g. exp(M) := limn→∞(IN + M/n)n and cos(M) := Re(exp(iM)). σ and α are regularisers. Note that the diffusion kernel is sometimes instead defined by exp(σ2(IN − L)) but these forms are equivalent up to normalisation. The chief goal of this work is to construct a random feature map φ(i) : N → Rl with l ∈ N that provides unbiased approximation of Kα(W) as in Eq. 1. To do so, we consider the following algorithm. Algorithm 1 Constructing a random feature vector φf (i) ∈ RN to approximate Kα(W) Input: weighted adjacency matrix W ∈ RN ×N , vector of unweighted node degrees (no. neighbours) d ∈ RN , modulation function f : (N ∪ {0}) → R, termination probability phalt ∈ (0, 1), node i ∈ N , number of random walks to sample m ∈ N. Output: random feature vector φf (i) ∈ RN 1: initialise: φf (i) ← 0 2: for w = 1, ..., m do 3: 4: 5: 6: 7: 8: 9: 10: initialise: load ← 1 initialise: current_node ← i initialise: terminated ← False initialise: walk_length ← 0 while terminated = False do φf (i)[current_node] ← φf (i)[current_node]+load×f ( walk_length ) walk_length ← walk_length+1 new_node ← Unif [N ( current_node )] load ← load× d[current_node] current_node ← new_node terminated ← (t ∼ Unif(0, 1) < phalt) ▷ assign to one of neighbours ▷ update load ▷ draw RV t to decide on termination × W [ current_node,new_node ] 1−phalt 11: 12: 13: 14: 15: end for 16: normalise: φf (i) ← φf (i)/m end while 3 Preprint. Under review. f (i) i Figure 1: Schematic for a random walk on a graph (solid red) and an accompanying modu- lation function f (dashed blue) used to approximate an arbitrary graph node function K G. This is identical to the algorithm presented by Choromanski (2023) for constructing features to approximate the 2-regularised Laplacian kernel, apart from the presence of the extra modulation function f : (N∪{0}) → R in line 8 that upweights or downweights contributions from walks depending on their length (see Fig. 1). We refer to φf as universal graph random features (u-GRFs), where the subscript f identifies the modulation function. Crucially, the time complexity of Alg. 1 is subquadratic in the number of nodes N , in contrast to exact methods which are O(N 3)2. We now state the following central result, proved in App. A.2. Theorem 2.1 (Unbiased approximation of Kα via convolutions). For two modulation func- tions: f1, f2 : (N ∪ {0}) → R, u-GRFs (cid:0)φf1(i))N i=1 constructed according to Alg. 1 give unbiased approximation of Kα, i=1, (φf2 (i)(cid:1)N [Kα]ij = E (cid:2)φf1(i)⊤φf2 (j)(cid:3) , (3) for kernels with an arbitrary Taylor expansion α = (αk)∞ k=0 provided that α = f1 ∗ f2. Here, ∗ is the discrete convolution of the modulation functions f1, f2; that is, for all k ∈ (N ∪ {0}), k X p=0 f1(k − p)f2(p) = αk. (4) Clearly the class of pairs of modulation functions f1, f2 that satisfy Eq. 4 is highly degen- erate. Indeed, it is possible to solve for f1 given any f2 and α provided f2(0) ̸= 0. For f2(i) = I(i = 0) with I(*) the indicator instance, a trivial solution is given by: f1(i) = αi, function. In this case, the walkers corresponding to f2 are 'lazy', depositing all their load at the node at which they begin. Contributions to the estimator φf1(i)⊤φf2 (j) only come from walkers initialised at i traversing all the way to j rather than two walkers both passing through an intermediate node. Also of great interest is the case of symmetric modulation functions f1 = f2, where now intersections do contribute. In this case, the following is true (proved in App. A.3). Theorem 2.2 (Computing symmetric modulation functions). Supposing f1 = f2 = f , Eq. 4 is solved by a function f which is unique (up to a sign) and is given by (cid:19) X i X (cid:19) (cid:16) (cid:18) n k1k2k3... 1 αk2 αk1 2 αk3 (cid:17) 3 ... . (5) f (i) = ± (cid:18) 1 2 n n=0 k1+2k2+3k3...=i k1+k2+k3+...=n Moreover, f (i) can be efficiently computed with the iterative formula   f (0) = ± √  f (i + 1) = α0 = ±1 αi+1−Pi−1 p=0 f (i−p)f (p+1) 2f (0) for i ≥ 0. (6) 2Concretely, Alg. 1 yields a pair of matrices φ1,2 := (φ(i))N i=1 ∈ RN ×N such that K = E(φ1φ⊤ 2 ) in subquadratic time. Of course, explicitly multiplying the matrices to evaluate every element of bK 2 v) where v ∈ RN would be O(N 3), but we avoid this since in applications we just evaluate φ1(φ⊤ is some vector and the brackets give the order of computation. This is O(N 2). 4 Preprint. Under review. For symmetric modulation functions, the random features φf1 (i) and φf2 (i) are identical apart from the particular sample of random walks used to construct them. They cannot share the same sample or estimates of diagonal kernel elements [Kα]ii will be biased. Computational cost: Note that when running Alg. 1 one only needs to evaluate the modulation functions f1,2(i) up to the length of the longest walk one samples. A batch of size b, (f1,2(i))b i=1, can be pre-computed in time O(b2) and reused for random features corresponding to different nodes and even different graphs. Further values of f can be computed at runtime if b is too small and also reused for later computations. Moreover, the minimum length b required to ensure that all m walks are shorter than b with high probability (Pr(∪m i=1len(ωi) ≤ b) < 1−δ, δ ≪ 1) scales only logarithmically with m (see App. A.1). This means that, despite estimating a much more general family of graph functions, u-GRFs are essentially no more expensive than the original GRF algorithm. Moreover, any techniques used for dimensionality reduction of regular GRFs (e.g. applying the Jonhson-Lindenstrauss transform (Dasgupta et al., 2010) or using 'anchor points' (Choromanski, 2023)) can also be used with u-GRFs, providing further efficiency gains. Generating functions: definition of Kα(W), we immediately have that Inserting the constraint for unbiasedness in Eq. 4 back into the Kα(W) = Kf1(W)Kf2(W) (7) where Kf1(W) := P∞ i=0 f1(i)Wi is the generating function corresponding to the sequence (f1(i))∞ i=0. This is natural because the (discrete) Fourier transform of a (discrete) convolu- tion returns the product of the (discrete) Fourier transforms of the respective functions. In the symmetric case f1 = f2, it follows that Kf (W) = ± (Kα(W)) 1 2 . (8) If the RHS has a simple Taylor expansion (e.g. Kα(W) = exp(W) so Kf (W) = exp( W 2 )), this enables us obtain f without recourse to the conditional sum in Eq. 5 or the iterative expression in Eq. 6. This is the case for many popular graph kernels; we provide some promi- nent examples in the table left. A notable ex- ception is the inverse cosine kernel. d-regularised Laplacian Name f (i) p-step random walk Diffusion (cid:1) (d−2+2i)!! (2i)!!(d−2)!! (cid:0) p 2 i 1 2ii! As an interesting corollary, by considering the diffusion kernel we have also proved that Pk 2k−p(k−p)! = 1 k! . 1 2pp! p=0 1 2.1 Neural modulation functions, kernel learning and generalisation Instead of using a fixed modulation function f to estimate a fixed kernel, it is possible to parameterise it more flexibly. For example, we can define a neural modulation function f (N ) : (N ∪ {0}) → R by a neural network (with a restricted domain) whose input and output dimensionalities are equal to 1. During training, we can choose the loss function to target particular desiderata of u-GRFs: for example, to suppress the mean square error of estimates of some particular fixed kernel (Sec. 3.4), or to learn a kernel which performs better in a downstream task (Sec. 3.5). Implicitly learning Kα via f (N ) is more scalable than learning Kα directly because it obviates the need to repeatedly compute the exact kernel, which is typically of O(N 3) time complexity. Since any modulation function f maps to a unique α by Eq. 4, it is also always straightforward to recover the exact kernel which the u-GRFs estimate, e.g. once the training is complete. Supposing we have (implicitly) learned α, how can the learned kernel K G α be expected to generalise? Let ψK : x → HK denote the feature mapping from the input space to the reproducing kernel Hilbert space HK induced by the kernel K G α. Define the hypothesis set (9) where we restricted our family of kernels so that the absolute value of each Taylor coefficient αi is smaller than some maximum value α(M ) . Following very similar arguments to Cortes et al. (2010), the following is true. H = {x → w⊤ψK(x) : |αi| ≤ α(M ) , ∥w∥2 ≤ 1}, i i 5 Preprint. Under review. Theorem 2.3 (Empirical Rademacher complexity bound). For a fixed sample S = (xi)m the empirical Rademacher complexity bR(H) is bounded by i=1, v u u t bR(H) ≤ 1 m ∞ X i=0 α(M ) i ρ(W)i, (10) where ρ(W) is the spectral radius of the weighted adjacency matrix W. Naturally, the bound on bR(H) increases monotonically with ρ(W). Following standard ar- guments in the literature, this immediately yields generalisation bounds for learning kernels K G α. We discuss this in detail, including proving Theorem 2.3, in App. A.4. 3 Experiments Here we test the empirical performance of u-GRFs, both for approximating fixed kernels (Secs 3.1-3.3) and with learnable neural modulation functions (Secs 3.4-3.5). 3.1 Unbiased pointwise estimation of fixed kernels We begin by confirming that u-GRFs do indeed give unbiased estimates the graph kernels listed in Table 1, taking σ = 0.25 and α = 20 as regularisers. We use symmetric modulation functions f , computed with the closed forms where available and using the iterative scheme in Eq. 6 if not. Fig. 2 plots the relative Frobenius norm error between the true kernels K and their approximations with u-GRFs bK (that is, ∥K − bK∥F /∥K∥F ) against the number of random walkers m. We consider 8 different graphs: a small random Erdős-Rényi graph, a larger Erdős-Rényi graph, a binary tree, a d-regular graph and 4 real world examples (karate, dolphins, football and eurosis) (Ivashkin, 2023). They vary substantially in size. For every graph and for all kernels, the quality of the estimate improves as m grows and becomes very small with even a modest number of walkers. Figure 2: Unbiased estimation of popular kernels on different graphs using u-GRFs. The approximation error (y-axis) improves with the number of walkers (x-axis). We repeat 10 times; one standard deviation on the mean error is shaded. 3.2 Solving differential equations on graphs An intriguing application of u-GRFs for fixed kernels is efficiently computing approxi- mate solutions of time-invariant non-homogeneous ordinary differential equations (ODEs) on graphs. Consider the following ODE defined on the nodes N of the graph G: dx(t) dt = Wx(t) + y(t), 6 (11) 51015No. random walks104103Frob. norm errorER (N=20, p=0.2)1-reg Lap2-reg Lap2-step RWDiffusionCosine51015No. random walks104103Frob. norm errorER (N=100, p=0.04)51015No. random walks104103Frob. norm errorBinary tree (N=127)51015No. random walks104103Frob. norm errord-regular (N=100, d=10)51015No. random walks104103Frob. norm errorKarate (N=34)51015No. random walks104103Frob. norm errorDolphins (N=62)51015No. random walks104103Frob. norm errorFootball (N=115)51015No. random walks104103Frob. norm errorEurosis (N=1272) Preprint. Under review. where x(t) ∈ RN is the state of the graph at time t, W ∈ RN ×N is a weighted adjacency matrix and y(t) is a (known) driving term. Assuming the null initial condition x(0) = 0, Eq. 11 is solved by the convolution x(t) = Z t 0 exp(W(t − τ ))y(τ )dτ = Eτ ∈P (cid:20) 1 p(τ ) exp(W(t − τ ))y(τ ) (12) (cid:21) where P is a probability distribution on the interval [0, t], equipped with a (preferably efficient) sampling mechanism and probability density function p(τ ). Taking n ∈ N Monte i.i.d.∼ P, we can construct the unbiased estimator: Carlo samples (τi)n i=1 bx(t) := 1 n n X j=1 1 p(τj) exp(W(t − τj))y(τj). (13) Note that exp(W(t − τj)) is nothing other than the diffusion kernel, which is expensive to compute exactly for large N but can be efficiently approximated with u-GRFs. Taking exp(W(t − τj)) ≃ ΦjΦ⊤ i=1 a matrix whose rows are u-GRFs, we have that j with Φ := (φ(i))N bx(t) := 1 n n X j=1 1 p(τj) ΦjΦ⊤ j y(τj) (14) which can be computed in quadratic time (c.f. cubic if the heat kernel is computed exactly). Further speed gains are possible if dimensionality reduction techniques are applied to the u-GRFs (Choromanski, 2023; Dasgupta et al., 2010). As an example, we consider diffusion of heat on three real-world graphs (karate, dolphins and football) with a fixed source at one node, tak- ing W = L (the graph Laplacian) and y(t) = y = (1, 0, 0, ...)⊤. Clearly the steady state is x(∞) = W−1(−y). We simulate evolution un- der the ODE for t = 1 with n = 10 discreti- sation timesteps and P uniform, approximating exp(W(t − τj)) with different numbers of walk- ers m. As m grows, the quality of approxima- tion improves and the (normalised) error on the final state ∥bx(1) − x(1)∥2/∥x(1)∥2 drops for ev- ery graph. We take 100 repeats for statistics and plot the results in Fig. 3. Figure 3: ODE simulation error decreases as the number of walkers grows. 3.3 Efficient kernelised graph node clustering As a further demonstration of the utility of our new mechanism, we show how estimates of the kernel K = exp(σ2W) can be used to assign nodes to k = 3 clusters. Here, we choose W to be the (unweighted) adjacency matrix and the regulariser is σ2 = 0.2. We follow the algorithm proposed by Dhillon et al. (2004), comparing the clusters when we use exact and u-GRF-approximated ker- nels. For all graphs, m ≤ 80. Table 2 re- ports the clustering error, defined by Ec := no. wrong pairs N (N − 1)/2 . (15) Table 2: Errors in kernelised k-means clustering when approximating the kernel exp(σ2W) with u-GRFs. Graph N Clustering error, Ec karate dolphins polbooks football databases eurosis citeseer cora 34 62 105 115 1046 1272 2485 3300 0.08 0.16 0.12 0.02 0.10 0.09 0.01 0.04 This is the number of misclassified pairs of nodes (assigned to the same cluster when the converse is true or vice versa) divided by the total number of pairs. The error is small even with a modest number of walkers and on large graphs; kernel estimates efficiently constructed using u-GRFs can be readily deployed on downstream tasks where exact methods are slow. 7 246810121416No. walkers0.020.040.060.080.10Sim. errorDiffusion simulation error vs. no. walkerskaratedolphinsfootball Preprint. Under review. 3.4 Learning f (N ) for better kernel approximation Following the discussion in Sec. 2.1 we now replaced fixed f with a neural modulation function f (N ) parameterised by a simple neural network with 1 hidden layer of size 1: f (N )(x) = σsoftplus (w2σReLU(w1x + b1) + b2) , (16) where w1, b1, w2, b2 ∈ R and σReLU and σsoftplus are the ReLU and softplus activation func- tions, respectively. Bigger, more expressive architectures (including allowing f (N ) to take negative values) can be used but this is found to be sufficient for our purposes. 1 = f (N ) As a first task, we define our loss function to be the Frobenius norm error between a target Gram matrix and our u-GRF-approximated Gram matrix, as in Sec. 3.1. For the target, we choose the 2-regularised Laplacian kernel. We train symmetric f (N ) but provide a cursory empirical discussion of the asymmetric case in App. A.5. On the small Erdős- Rényi graph (N = 20) with m = 16 walks, we minimise the loss with the Adam optimiser and a decaying learning rate (LR = 0.01, γ = 0.975, 1000 epochs). We make the following striking observation: f (N ) does not generically converge to the unique unbiased (symmetric) modulation function implied by α, but instead to some different f that though biased gives a smaller mean squared error (MSE). This is possible because by downweighting long walks the learned f (N ) gives estimators with a smaller variance, which is sufficient to suppress the MSE on the kernel matrix elements even though it no longer reproduces the target value in expectation. f (N ) optimised for kernel estimation on one particular graph generalises to improve kernel approximation on other graphs, including when their topology is very different and they have a much greater number of nodes: eurosis is bigger by a factor of over 60. See Table 3 for the results. 2 Naturally, the learned f (N ) is dependent on the the number of random walks m; as m grows, the variance on the kernel approximation drops so it is intuitive that f (N ) will approach the unbiased f . Fig. 4 empirically confirms this is the case, showing the learned f (N ) for different numbers of walkers. The line labelled ∞ is the unbiased modulation function, which for the 2-regularised Laplacian kernel is flat. Table 3: Kernel approximation error with m = 16 walks and unbiased or learned mod- ulation functions. Lower is better. Figure 4: Learned modulation function with different numbers of random walkers. Approaches unbiased f (N ) as m → ∞ Graph N Frob. norm error on bK Learned Unbiased Small ER Larger ER Binary tree d-regular karate dolphins football eurosis 20 100 127 100 34 62 115 1272 0.0488(9) 0.0503(4) 0.0453(4) 0.0490(2) 0.0492(6) 0.0505(5) 0.0520(2) 0.0551(2) 0.0437(9) 0.0448(4) 0.0410(4) 0.0434(2) 0.0439(6) 0.0449(5) 0.0459(2) 0.0484(2) These learned modulation functions might guide the more principled construction of biased, low-MSE GRFs in the future. An analogue in Euclidean space is provided by structured orthogonal random features (SORFs), which replace a random Gaussian matrix with a HD- product to estimate the Gaussian kernel (Choromanski et al., 2017; Yu et al., 2016). This likewise improves kernel approximation quality despite breaking estimator unbiasedness. 3.5 Implicit kernel learning for node attribute prediction As suggested in Sec. 2.1, it is also possible to train the neural modulation function f (N ) directly using performance on a downstream task, performing implicit kernel learning. We have argued that this is much more scalable than optimising Kα directly. 8 02468i0.00.20.40.60.81.0f(i)Modulation functions for different no. walkers248163264128256512 Preprint. Under review. In this spirit, we now address the problem of kernel regression on triangular mesh graphs, as previously considered by Reid et al. (2023). For graphs in this dataset (Dawson- Haggerty, 2023), every node is associated with a normal vector v(i) ∈ R3 equal to the mean of the normal vectors of its 3 surrounding faces. The task is to predict the direc- tions of missing vectors (a random 5% split) from the remainder. Our (unnormalised) predictions are given by bv(i) := P j bK(N )(i, j)v(j), where bK(N ) is a kernel estimate con- structed using u-GRFs with a neural modulation function f (N ) (see Eq. 3). The an- gular prediction error is 1 − cos θi with θi the angle between the true v(i) and and approximate bv(i) normals, averaged over the missing vectors. We train a symmetric pair f (N ) using this angular prediction error on the small cylinder graph (N = 210) as the loss function. Then we freeze f (N ) and compute the angular prediction error for other larger graphs. Fig. 5 shows the learned f (N ) as well as some other modulation functions corresponding to popular fixed kernels. Note also that learning f (N ) al- ready includes (but is not limited to) optimis- ing the lengthscale of a given kernel: taking fW → β fW is identical to f (i) → f (i)βi ∀ i. The prediction errors are highly correlated be- tween the different modulation functions for a given random draw of walks; ensembles which 'explore' the graph poorly, terminating quickly or repeating edges, will give worse u-GRF estimators for every f . For this reason, we com- pute the prediction errors as the average normalised difference compared to the learned kernel result. Table 4 reports the results. Crucially, this difference is found to be positive for every graph and every fixed kernel, meaning the learned kernel always performs best. Figure 5: Fixed and learned modulation functions for kernel regression Table 4: Normalised difference in angular prediction error compared to the learned kernel defined by f (N ) (trained on the cylinder graph). All entries are positive since the learned kernel always performs best. We take 100 repeats; the brackets give one standard deviation on the mean result. Graph N Normalised ∆(pred error) c.f. learned 1-reg Lap 2-reg Lap Diffusion cylinder teapot idler-riser busted torus +0.40(2) 210 +0.81(5) 480 782 +0.52(2) 1941 +0.81(2) 4350 +2.13(5) +0.85(4) +1.78(8) +1.12(1) +1.60(4) +5.3(1) +0.029(3) +0.059(3) +0.042(2) +0.063(2) +0.067(2) It is remarkable that the learned f (N ) gives the smallest error for all the graphs even though it was just trained on the smallest one. We have implicitly learned a good kernel for this task which generalises well across topologies. It is also intriguing that the diffusion kernel performs only slightly worse. This is to be expected because their modulation functions are similar (see Fig. 5) so they encode very similar kernels, but this will not always be the case depending on the task at hand. 4 Conclusion We have introduced 'universal graph random features' (u-GRFs), a novel random walk-based algorithm for time-efficient estimation of arbitrary functions of a weighted adjacency matrix. The mechanism is conceptually simple and trivially distributed across machines, unlocking kernel-based machine learning on very large graphs. By parameterising one component of the random features with a simple neural network, we can futher suppress the mean square error of estimators and perform scalable implicit kernel learning. 9 02468i0.00.20.40.60.81.0f(i)Modulation functions for regression tasklearned1-reg Lap2-reg Lapdiffusion Preprint. Under review. 5 Ethics and reproducibility Ethics: Our work is foundational. There are no direct ethical concerns that we can see, though of course increases in scalability afforded by graph random features might amplify risks of graph-based machine learning, from bad actors or as unintended consequences. Reproducibility: To foster reproducibility, we clearly state the central algorithm in Alg. 1 and will provide full source code if the manuscript is accepted. All theoretical results are accompanied by proofs in Appendices A.1-A.4, where any assumptions are made clear. The datasets we use correspond to standard graphs and are freely available online. We link suitable repositories in every instance. Except where prohibitively computationally expensive, results are reported with uncertainties to help comparison. 6 Relative contributions and acknowledgements EB initially proposed using a modulation function to generalise GRFs to estimate the dif- fusion kernel and derived its mathematical expression. IR and KC then developed the full u-GRFs algorithm for general functions of a weighted adjacency matrix, proving all theoret- ical results, running the experiments and preparing the manuscript. AW provided helpful discussions and advice. IR acknowledges support from a Trinity College External Studentship. AW acknowledges support from a Turing AI fellowship under grant EP/V025279/1 and the Leverhulme Trust via CFI. We thank Kenza Tazi and Austin Trip for their careful readings of the manuscript. Richard Turner provided valuable suggestions and support throughout the project. References Zhaojun Bai, James Demmel, Jack Dongarra, Axel Ruhe, and Henk van der Vorst. Templates for the solution of algebraic eigenvalue problems: a practical guide. SIAM, 2000. URL https://www.cs.ucdavis.edu/~bai/ET/contents.html. Peter L Bartlett and Shahar Mendelson. Rademacher and gaussian complexities: Risk bounds and structural results. Journal of Machine Learning Research, 3(Nov):463–482, 2002. URL https://dl.acm.org/doi/pdf/10.5555/944919.944944. Karsten M Borgwardt, Cheng Soon Ong, Stefan Schönauer, SVN Vishwanathan, Alex J Smola, and Hans-Peter Kriegel. Protein function prediction via graph kernels. Bioinfor- matics, 21(suppl_1):i47–i56, 2005. URL https://doi.org/10.1093/bioinformatics/ bti1007. Colin Campbell. Kernel methods: a survey of current techniques. Neurocomputing, 48(1-4): 63–84, 2002. doi: 10.1016/S0925-2312(01)00643-9. URL https://doi.org/10.1016/ S0925-2312(01)00643-9. Stéphane Canu and Alexander J. Smola. Kernel methods and the exponential fam- ily. Neurocomputing, 69(7-9):714–720, 2006. doi: 10.1016/j.neucom.2005.12.009. URL https://doi.org/10.1016/j.neucom.2005.12.009. Olivier Chapelle, Jason Weston, and Bernhard Schölkopf. Cluster kernels for semi-supervised learning. Advances in neural information processing systems, 15, 2002. URL https: //dl.acm.org/doi/10.5555/2968618.2968693. Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794, 2020. URL https://doi.org/10.48550/arXiv.2009.14794. 10 Preprint. Under review. Krzysztof M Choromanski, Mark Rowland, and Adrian Weller. The unreasonable effec- tiveness of structured random orthogonal embeddings. Advances in neural information processing systems, 30, 2017. URL https://doi.org/10.48550/arXiv.1703.00864. Krzysztof Marcin Choromanski. Taming graph kernels with random features. In In- ternational Conference on Machine Learning, pages 5964–5977. PMLR, 2023. URL https://doi.org/10.48550/arXiv.2305.00156. Fan R. K. Chung and Shing-Tung Yau. Coverings, heat kernels and spanning trees. Electron. J. Comb., 6, 1999. doi: 10.37236/1444. URL https://doi.org/10.37236/1444. Corinna Cortes, Mehryar Mohri, and Afshin Rostamizadeh. Generalization bounds for learning kernels. In Proceedings of the 27th Annual International Conference on Machine Learning (ICML 2010), 2010. URL http://www.cs.nyu.edu/~mohri/pub/lk.pdf. Keenan Crane, Clarisse Weischedel, and Max Wardetzky. The heat method for distance computation. Communications of the ACM, 60(11):90–99, 2017. URL https://dl.acm. org/doi/10.1145/3131280. Anirban Dasgupta, Ravi Kumar, and Tamás Sarlós. A sparse johnson: Lindenstrauss trans- form. In Leonard J. Schulman, editor, Proceedings of the 42nd ACM Symposium on The- ory of Computing, STOC 2010, Cambridge, Massachusetts, USA, 5-8 June 2010, pages 341–350. ACM, 2010. doi: 10.1145/1806689.1806737. URL https://doi.org/10.1145/ 1806689.1806737. Michael Dawson-Haggerty. Trimesh repository, 2023. URL https://github.com/mikedh/ trimesh. Inderjit S Dhillon, Yuqiang Guan, and Brian Kulis. Kernel k-means: spectral clustering and normalized cuts. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, pages 551–556, 2004. URL https://dl.acm. org/doi/10.1145/1014052.1014118. Michel X. Goemans and David P. Williamson. Approximation algorithms for max-3-cut and other problems via complex semidefinite programming. J. Comput. Syst. Sci., 68 (2):442–470, 2004. doi: 10.1016/j.jcss.2003.07.012. URL https://doi.org/10.1016/j. jcss.2003.07.012. Vladimir Ivashkin. Community graphs repository, 2023. URL https://github.com/ vlivashkin/community-graphs. William B Johnson. Extensions of lipschitz mappings into a hilbert space. Contemp. Math., 26:189–206, 1984. URL http://stanford.edu/class/cs114/readings/JL-Johnson. pdf. Kyle Kloster and David F Gleich. Heat kernel based community detection. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 1386–1395, 2014. URL https://doi.org/10.48550/arXiv.1403.3148. Vladimir Koltchinskii and Dmitry Panchenko. Empirical margin distributions and bounding the generalization error of combined classifiers. The Annals of Statistics, 30(1):1–50, 2002. URL https://doi.org/10.48550/arXiv.math/0405343. Risi Kondor and John D. Lafferty. Diffusion kernels on graphs and other discrete input spaces. In Claude Sammut and Achim G. Hoffmann, editors, Machine Learning, Proceed- ings of the Nineteenth International Conference (ICML 2002), University of New South Wales, Sydney, Australia, July 8-12, 2002, pages 315–322. Morgan Kaufmann, 2002. URL https://www.ml.cmu.edu/research/dap-papers/kondor-diffusion-kernels.pdf. Leonid Kontorovich, Corinna Cortes, and Mehryar Mohri. Kernel methods for learning languages. Theor. Comput. Sci., 405(3):223–236, 2008. doi: 10.1016/j.tcs.2008.06.037. URL https://doi.org/10.1016/j.tcs.2008.06.037. 11 Preprint. Under review. Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. Advances in neural information processing systems, 20, 2007. URL https://dl.acm.org/doi/10. 5555/2981562.2981710. Isaac Reid, Krzysztof Choromanski, and Adrian Weller. Quasi-monte carlo graph random features. arXiv preprint arXiv:2305.12470, 2023. URL https://doi.org/10.48550/ arXiv.2305.12470. Alexander J Smola and Risi Kondor. Kernels and regularization on graphs. In Learning The- ory and Kernel Machines: 16th Annual Conference on Learning Theory and 7th Kernel Workshop, COLT/Kernel 2003, Washington, DC, USA, August 24-27, 2003. Proceed- ings, pages 144–158. Springer, 2003. URL https://people.cs.uchicago.edu/~risi/ papers/SmolaKondor.pdf. Alexander J. Smola and Bernhard Schölkopf. Bayesian kernel methods. In Shahar Mendel- son and Alexander J. Smola, editors, Advanced Lectures on Machine Learning, Machine Learning Summer School 2002, Canberra, Australia, February 11-22, 2002, Revised Lec- tures, volume 2600 of Lecture Notes in Computer Science, pages 65–117. Springer, 2002. URL https://doi.org/10.1007/3-540-36434-X_3. Yasutoshi Yajima. One-class support vector machines for recommendation tasks. In Pacific- Asia Conference on Knowledge Discovery and Data Mining, pages 230–239. Springer, 2006. URL https://dl.acm.org/doi/10.1007/11731139_28. Felix Xinnan X Yu, Ananda Theertha Suresh, Krzysztof M Choromanski, Daniel N Holtmann-Rice, and Sanjiv Kumar. Orthogonal random features. Advances in neural in- formation processing systems, 29, 2016. URL https://doi.org/10.48550/arXiv.1610. 09072. Yufan Zhou, Changyou Chen, and Jinhui Xu. Learning manifold implicitly via explicit heat- kernel learning. Advances in Neural Information Processing Systems, 33:477–487, 2020. URL https://doi.org/10.48550/arXiv.2010.01761. 12 Preprint. Under review. A Appendices A.1 Minimum batch size scales logarithmically with number of walks Consider an ensemble of m random walks S := {ωi}m i=1 whose lengths are sampled from a geometric distribution with termination probability p. Trivially, Pr(len(ωi) < b) = 1 − (1 − p)b. Given m independent walkers, Pr (maxωi∈S(len(ωi) < b) = Pr (∪m i=1len(ωi) < b) = (1 − (1 − p)b)m. (17) Take 'with high probability' to mean with probability at least 1 − δ, with δ ≪ 1 fixed. Then b = log(1 − (1 − δ) 1 log(1 − p) m ) ≃ log(δ) − log(m) log(1 − p) . (18) As the number of walkers m grows, the minimum value of b to ensure that all walkers are shorter than b with high probability scales logarithmically with m. A.2 Proof of Theorem 2.1 (Unbiased approximation of Kα via convolutions) We begin by proving that u-GRFs constructed according to Alg. 1 give unbiased estimation of graph functions with Taylor coefficients (αi)∞ i=0 provided the discrete convolution relation in Eq. 4 is fulfilled. Denote the set of m walks sampled out of node i by { ̄Ω(i) 1, it is straightforward to convince oneself that the u-GRF estimator takes the form k=1. Carefully considering Alg. k }m φ(i)v := 1 m m X X k=1 ωiv∈Ωiv eω(ωiv)f (len(ωiv)) p(ωiv) I(ωiv ∈ ̄Ω(i) k ). (19) Here, Ωiv denotes the set of all graph walks between nodes i and v, of which each ωiv is a member. len(ωiv) is a function that gives the length of walk ωiv and eω(ωiv) evaluates the products of edge weights it traverses. p(ωiv) = (1 − p)len(ωiv) Qlen(ωiv) denotes the walk's marginal probability. I is the indicator function which evaluates to 1 if its argument is true (namely, walk ωiv is a subwalk of ̄Ω(i) k , the kth walk sampled out of i) and 0 otherwise. i I(ωiv ∈ ̄Ω(i) Trivially, we have that E = p(ωiv) (by construction to make the estimator k ) unbiased). 1 di i=1 h Now note that: E (cid:2)φ(i)⊤φ(j)(cid:3) = E # φ(i)vφ(j)v " X v∈N X X X = eω(ωiv)f (len(ωiv))eω(ωjv)f (len(ωjv)) v ωiv∈Ωiv = ωjv∈Ωjv ∞ X X v X ∞ X = l1=0 l1X ∞ X l2=0 Wl1 ivWl2 jvf (l1)f (l2) Wl1−l3 iv Wl3 jvf (l1 − l3)f (l3) (20) v l1=0 l3=0 ∞ X = Wl1 ij l1X l1=0 l3=0 f (l1 − l3)f (l3). From the first to the second line we used the definition of GRFs in Eq. 19. We then rewrote the sum of the product of edge weights over all possible paths as powers of the weighted adjacency matrix W. To get to the fourth line, we changed indices in the infinite sums, then the final line followed simply. 13 Preprint. Under review. l1X i X The final expression in Eq. 20 is exactly equal to Kα(W) := P∞ have that l1=0 αl1Wl1 provided we f (l1 − l3)f (l3) := αl1 , (21) as stated in Eq. 4 of the main text (with variables renamed to k and p). l3=0 A.3 Proof of Theorem 2.2 (Computing symmetric modulation functions) Here, we show how to compute f under the constraint that the modulation functions are identical, f1 = f2 = f . We will use the relationship in Eq. 4, reproduced below for the reader's convenience: f (i − p)f (p) = αi. (22) p=0 The iterative form in Eq. 6 is easy to show. For i = 0 we have that f (0)2 = α0, so f (0) = ± α0 = ±1 (where we used the normalisation condition α0 = 1). Now note that √ i+1 X p=0 so clearly f (i + 1 − p)f (p) = 2f (0)f (i + 1) + i X p=1 f (i + 1 − p)f (p) = αi+1 (23) f (i + 1) = αi+1 − Pi−1 p=0 f (i − p)f (p + 1) 2f (0) . (24) This enables us to compute f (i + 1) given αi+1 and (f (p))i p=0. The analytic form in Eq. 5 is only a little harder. Inserting the discrete convolution relation in Eq. 4 back into Eq. 2, we have that where Kf1 (W) := P∞ (f1(i))∞ i=0. Constraining f1 = f2, Kα(W) = Kf1(W)Kf2(W) (25) i=0 f1(i)Wi is the generating function corresponding to the sequence (26) Kf (W) = ± (Kα(W)) We also discuss this in the 'generating functions' section of Sec. 2 where we use it to derive simple closed forms for f for some special kernels. Now we have that 1 2 . ∞ X i=0 f (i)Wi = ± ! 1 2 αnWn ∞ X n=0 = ± (cid:0)1 + (cid:0)α1W + α2W2 + ...(cid:1)(cid:1) 1 2 = ± ∞ X n=0 (cid:19) (cid:18) 1 2 n (cid:0)α1W + α2W2 + ...(cid:1)n . (27) We need to equate powers of W between the generating functions. Consider the terms proportional to Wi. Clearly no such terms will feature when n > i, so we can restrict the sum on the RHS to 0 ≤ n ≤ i. Meanwhile, the term in (cid:0)α1W + α2W2 + ...(cid:1)n proportional to Wi is nothing other than X k1+2k2+3k3...=i k1+k2+k3+...=n (cid:18) (cid:19) (cid:16) n k1k2k3... 1 αk2 αk1 2 αk3 3 ... (cid:17) where (cid:0) n k1k2k3... (cid:1) is the multinomial coefficient. Combining, (cid:19) X i X (cid:18) (cid:19) (cid:16) f (i) = ± n k1k2k3... (cid:18) 1 2 n n=0 k1+2k2+3k3...=i k1+k2+k3+...=n 1 αk2 αk1 2 αk3 3 ... (28) (29) (cid:17) as shown in Eq. 5. Though this expression gives f purely in terms of α, the presence of the conditional sum limits its practical utility compared to the iterative form. 14 Preprint. Under review. A.4 Proof of Theorem 2.3 (Empirical Rademacher complexity bound) In this appendix we derive the bound on the empirical Rademacher complexity stated in Theorem 2.3 and show the consequent generalisation bounds. The early stages closely follow arguments made by Cortes et al. (2010). Recall that we have defined the hypothesis set H = {x → w⊤ψK(x) : |αi| ≤ α(M ) (30) with ψK : x → HK the feature mapping from the input space to the reproducing kernel Hilbert space HK induced by the kernel K G α. The empirical Rademacher complexity bR(H) for an arbitrary fixed sample S = (xi)m defined by , ∥w∥2 ≤ 1}, i=1 is i bR(H) := 1 m Eσ " # m X i=1 sup h∈H σih(xi) (31) the expectation is taken over σ = (σ1, ..., σm) with σi ∼ Unif(±1) i.i.d. Rademacher random variables. Begin by noting that h(x) := w⊤ψK(x) = m X i=1 βiK(xi, x) (32) where βi are span(ψK(x1), ..., ψK(xm)), where β⊤Kβ ≤ 1. Then we have that coordinates of the the orthogonal projections of w on HS = bR(H) = 1 m Eσ " sup α,β # σ⊤Kβ . (33) The supremum supβ σ⊤Kβ is reached when K1/2β is collinear with K1/2σ, and making ∥β∥2 as large as possible gives Now note that bR(H) = √ 1 m Eσ (cid:20) sup α σ⊤Kσ (cid:21) . σ⊤Kσ = ∞ X i=0 αiσ⊤Wiσ. σ⊤Wiσ may take either sign, and the sum is maximised by taking αi = α(M ) terms and αi = −α(M ) for negative terms. Observe that i i √ σ⊤Kσ = sup σ sup α v u u tm ∞ X i=0 α(M ) i ρ(W)i whereupon from Eq. 31 it follows that bR(H) ≤ v u u t 1 m ∞ X i=0 α(M ) i ρ(W)i (34) (35) for positive (36) (37) as stated in Thm 2.3. This bound is not tight for general graphs, but will be for specific ex- amples: for example, when W is proportional to the identity so the only edges are self-loops. Nonetheless, it provides some intuition for how the learned kernel's complexity depends on W. As stated in the main text, Eq. 37 immediately yields generalisation bounds for learning kernels. Again closely following Cortes et al. (2010), consider the application of binary clas- sification where nodes are assigned a label yi = ±1. Denote by R(h) the true generalisation error of h ∈ H, R(h) = Pr(yh(x) < 0). (38) 15 Preprint. Under review. Consider a training sample S = ((xi, yi))m i=1, and define the ρ-empirical margin loss by bRρ(h) := 1 m m X i=1 min(1, [1 − yih(xi)/ρ]+) (39) where ρ > 0. For any δ > 0, with probability at least 1 − δ, the following bound holds for any h ∈ H (Bartlett and Mendelson, 2002; Koltchinskii and Panchenko, 2002): R(h) ≤ bRρ(h) + 2 ρ bR(H) + 3 s log 2 δ 2m . (40) Inserting the bound on the empirical Rademacher complexity in Eq. 37, we immediately have that R(h) ≤ bRρ(h) + 2 ρ v u u t 1 m ∞ X i=0 α(M ) i ρ(W)i + 3 s log 2 δ 2m (41) which shows how the generalisation error can be controlled via α(M ) or ρ(W). A.5 Learning asymmetric f (N ) Recalling from Eq. 1 that the modulation func- tions (f1, f2) do not necessarily need to be equal for unbiased estimation of some kernel Kα, a natural extension of Sec. 3.4 is to introduce two separate neural modulation functions f (N ) 1,2 and train them both following the scheme in Sec. 3.4. Intriguingly, even with an initialisation where f (N ) encodes 'lazy' behaviour (deposits almost 2 all its load at the starting node – see Sec. 2) and f (N ) is flat, upon training the neural modulation 1 functions quickly become very similar (though not identical). See Fig. 6. We use the same opti- misation hyperparameters and network architec- tures as in Sec. 3.4. Rigorously proving the best possible choice of (f1, f2), including whether e.g. a symmetric pair is optimal, is left as an exciting open theoretical problem. Figure 6: Modulation functions (f1, f2) parameterised by separate neural net- works before and after training to target the 2-regularised Laplacian kernel. 16 02468i0.20.40.60.81.0f(i)Learned asymmetric modulation functionsinitial f1initial f2trained f1trained f2
http://arxiv.org/abs/2310.04856v1
"2023-10-07T15:31:38"
"2023-10-07T15:31:38"
LIPEx -- Locally Interpretable Probabilistic Explanations -- To Look Beyond The True Class
In this work, we instantiate a novel perturbation-based multi-class explanation framework, LIPEx (Locally Interpretable Probabilistic Explanation). We demonstrate that LIPEx not only locally replicates the probability distributions output by the widely used complex classification models but also provides insight into how every feature deemed to be important affects the prediction probability for each of the possible classes. We achieve this by defining the explanation as a matrix obtained via regression with respect to the Hellinger distance in the space of probability distributions. Ablation tests on text and image data, show that LIPEx-guided removal of important features from the data causes more change in predictions for the underlying model than similar tests on other saliency-based or feature importance-based XAI methods. It is also shown that compared to LIME, LIPEx is much more data efficient in terms of the number of perturbations needed for reliable evaluation of the explanation.
[ "Hongbo Zhu", "Angelo Cangelosi", "Procheta Sen", "Anirbit Mukherjee" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04856v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04856v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 6 5 8 4 0 . 0 1 3 2 : v i X r a LIPEx – Locally Interpretable Probabilistic Explanations – To Look Beyond The True Class Hongbo Zhu∗ Manchester Centre for Robotics and A.I. The University of Manchester, UK Angelo Cangelosi Manchester Centre for Robotics and A.I. The University of Manchester, UK Procheta Sen Department of Computer Science University of Liverpool, UK Anirbit Mukherjee∗ Manchester Centre for A.I. Fundamentals The University of Manchester, UK hongbo.zhu@manchester.ac.uk angelo.cangelosi@manchester.ac.uk procheta.sen@liverpool.ac.uk anirbit.mukherjee@manchester.ac.uk Abstract In this work, we instantiate a novel perturbation-based multi-class explanation framework, LIPEx (Locally Interpretable Probabilistic Explanation). We demonstrate that LIPEx not only locally replicates the probability distributions output by the widely used complex classification models but also provides insight into how every feature deemed to be important affects the prediction probability for each of the possible classes. We achieve this by defining the explanation as a matrix obtained via regression with respect to the Hellinger distance in the space of probability distributions. Ablation tests on text and image data, show that LIPEx-guided removal of important features from the data causes more change in predictions for the underlying model than similar tests on other saliency-based or feature importance-based XAI methods. It is also shown that compared to LIME, LIPEx is much more data efficient in terms of the number of perturbations needed for reliable evaluation of the explanation. 1 Introduction Recent momentum in deep learning research has made interpreting models with complex architectures very important. In a wide range of areas where neural nets have made a successful foray, the method of "Explain- able A.I." (XAI) has also found an important use to help understand the functioning of these novel predictors - like in climate science (Labe & Barnes, 2021), for solving partial differential equation (Linial et al., 2023), in high-energy physics (Neubauer & Roy, 2022), information retrieval (Lyu & Anand, 2023), in legal A.I. (Collenette et al., 2023), etc. Most often, it has been observed that models with complex architectures give better accuracy compared to a simple model. So, the core puzzle that XAI can be seen to solve is to give a highly accurate local replication of a complex predictor's behaviour by a simple model over humanly interpretable components of the data (Ribeiro et al., 2016). Towards achieving this, multiple different XAI methods have been proposed in the recent times, e.g., LIME (Ribeiro et al., 2016), SHAP (Lundberg & Lee, 2017), Decision-Set (Lakkaraju et al., 2016), Anchor (Ribeiro et al., 2018), Smooth-GRAD (Smilkov et al., 2017b), Poly-CAM (Englebert et al., 2022), Extremal Perturbrations (Fong et al., 2019), Saliency Maps (Simonyan et al., 2014), etc. One major motivation for explainability is debugging a model (Casillas et al., 2003; Dapaah & Grabowski, 2016). Towards this, an end user is interested not only in understanding the explanation provided for the predicted class at a particular data point but also in the influence of different features for all possible class 1 likelihoods estimated by a classifier. The full spectrum of feature influence on each class at a particular data point can help to understand how well the model has been trained to discriminate a particular class from the rest. However, existing explanation frameworks do not provide any clue on the aforementioned issue. To this end, we propose an explainability framework that can explain a classifier's output prediction beyond the true class. To obtain an explanation around a data point, a local explanation algorithm like LIME (Garreau & Luxburg, 2020) creates perturbations around it, each perturbation being represented as a Boolean vector. LIME in- cludes a feature selection method to decide a set of important features for each class (like Algorithm A) among which the explanation is sought. Then, an explanation vector for the complex model's prediction on the input data is obtained by solving a penalized linear regression over the selected features corresponding to these perturbations and the complex classifier's predictions on the data corresponding to the perturba- tions. We posit that it is not entirely convincing that LIME attempts to regress over bounded labels, i.e., probabilities, using an unbounded function (i.e., a linear function) and that this would need to be called separately for each class. Further, even if by repeated calls on each possible class we obtain an explanation for of the classes, there is no guarantee that by these repeated evaluations, the importance of any particular feature would be knowable for every class. In this work, we attempt to remedy these problems by proposing a single unified framework that applies to both text and images, which we will show in experiments to be better than various XAI methods for both text and images. In a C−class classification task, for any data s which is represented as zs in some fs dimensional feature space, we shall seek explanations that map into C−class probability space as, Rfs ∋ zs ↦ Soft−Max ○ W zs (1) We call the W ∈ RC×fs as the "explanation matrix" – which can be obtained by minimizing some valid distance function (like Hellinger's distance) between distributions obtained as above and the probability distribution over classes that the complex model has been trained to map any input. Thus, we instantiate this novel mechanism for XAI, namely LIPEx. Note how the matrix W in Equation 1 simultaneously gives for every feature a numerical measure of its importance for each possible class. We posit that it is important that in any explanation, it should be evident that most features deemed to be important for the predicted class are not so for the other classes - an idea that was recently formalized in Gupta & Arora (2020); Gupta et al. (2022) for the specific case In our method, this property turns out to be emergent as a consequence of the more of saliency maps. principled definition of explanation that we start from. Figure 1 shows an example of our matrix explanation obtained for a text document. We observe how the explanation matrix is obtained for a specific document over a set of feature words. Note that for the first row (the top predicted class), the top 5 feature words detected for this instance ([feel, valued, joy, treasures, incredibly]) are distinctly different from the top features detected for the class in the second row, the one with the second highest probability predicted by the classifier. More examples like this can be found in Appendix D.5 and Appendix D.6 particularly focuses on examples where the predicted class and the true class are different. It is observed that there always arises a natural discrimination between features important for the different classes. In the following, we summarize our contributions towards formalizing this idea of matrix-based explanations that match the distribution over classes predicted by a complex model. Novel Explanation Framework In Section 3, we formally state our explanation approach, which can extract the relative importance of a set of features for every class under consideration beyond the true class. In the following tests, we demonstrate how such a multi-class explanation framework can be more useful for model understanding compared to existing state-of-the-art XAI methods. (Test 1) Evidence of LIPEx Replicating the Complex Model's Predicted Distribution Over Classes In Figure 2, we calculate the Total Variation (TV) distance of the output distribution of the obtained LIPEx explainer and the distribution output by the complex model for the same data and we show 2 Figure 1: Example of comparison of explanation matrix obtained by LIPEx and the bar chart obtained by LIME on a text data from the Emotion dataset. For the LIPEx matrix, the class names on the left side are arranged in descending order of the predicted class probabilities. Examples of LIPEx explanation on image data is provided in Appendix D.3. that over hundreds of randomly chosen test instances, the distance is overwhelmingly near 0. We show that this very necessary property holds over multiple models over text as well as images. (Test 2) Sanity Check of LIPEx's Sensitivity to Model Distortion In Figure 3 we distort a well- trained complex model by adding mean zero noise to the parameters in the last layer and measure how upon increasing the noise variance, the output probability distribution moves away in TV distance from the original prediction. We show that when LIPEx is implemented on the distorted models, our explainer's predicted distribution moves away from its original value almost identically. This sanity check is inspired by the arguments in Adebayo et al. (2018). The above two tests give robust evidence that, indeed LIPEx is an accurate local approximator of the complex model while being dramatically simpler than the black-box predictor. To the best of our knowledge, such a strong model replication property is not known to be true for even the saliency methods, which can in- principle be called on different classes separately to get the relative importance among the different pixels for each class - albeit separately. (Test 3) Evidence of Changes in the Complex Model's Prediction Under LIPEx Guided Data Distortion In Table 1 and 2, we demonstrate an ablation study guided by the "faithfulness" criteria as outlined in Atanasova et al. (2020). We establish that the top features detected by LIPEx are more important for the complex model than those detected by other XAI methods. We show this by demonstrating that when the top features are removed from the data and inference is done on this damaged data, then the new predicted class differs more from the original prediction when the removal is guided by what LIPEx deemed to be important than other XAI methods. (Test 4) Evidence of LIPEx Replicating the Complex Model's Class Prediction Under LIPEx Guided Data Distortion In Table 3, we demonstrate that for an overwhelming majority of data, upon removing their features deemed important by LIPEx, the new class predicted by the complex predictor is reproduced by the LIPEx model when presented with the same distorted data. (Test 5) Stability of LIPEx to Choosing Less and Only Near-Truth Perturbations In Figure 4, we demonstrate experiments that the features picked out by the LIPEx matrix are largely stable when the matrix is derived using only a few perturbation instances. We also show that this property is not true for LIME in the models we consider. Thus LIPEx is demonstrably more data efficient. 3 To put the above in context we recall that estimates were given in Agarwal et al. (2021) for how many perturbations around the true data are sufficient for LIME to produce reliable results - and this experiment of ours can be seen to corroborate that. Also, we recall that in works like Slack et al. (2020) it was pointed out that LIME's reliance on perturbations far from the true data creates a vulnerability that can be exploited to create adversarial attacks. Note that we have restricted our attention to "intrinsic evaluations" of explanations, i.e., we only use calls to the model as a black-box for deciding whether the explanations obtained are meaningful as opposed to looking for external human evaluation. Both text and image data were used to evaluate our proposed approach. For text-based experiments we used 20Newsgroup 1 and Emotion 2 datasets. For image-based experiments, we have used the Imagenette3 dataset with segments detected by "segment anything" 4. Among the above experiments, LIPEx was compared against a wide range of state-of-the-art explanation methods for both text and image data, i.e., LIME (Ribeiro et al., 2016), Guided Backpropagation (Springen- berg et al., 2014), Vanilla Gradients (Erhan et al., 2009), Integrated Gradients (Sundararajan et al., 2017), Deeplift (Shrikumar et al., 2016), Occlusion (Zeiler & Fergus, 2014), XRAI (Kapishnikov et al., 2019), Grad- CAM (Selvaraju et al., 2017), GuidedIG (Kapishnikov et al., 2021), BlurIG (Xu et al., 2020) and SmoothGrad (Smilkov et al., 2017a). Organization In Section 2 we briefly overview related works in XAI. In Section 3 we give the precise loss function formalism for obtaining our explanation matrix, and in Section 4 all the tests will be given - comparing the relative benefits to other XAI methods. We conclude in Section 5. Appendices contain various details such as the precise pseudocode used in Section 4 (in Appendix C), the hyperparameter settings (in Appendix B), and further experimental data is given in Appendix D. 2 Related Work The work in Letham et al. (2015) is one of the first works that attempted to develop a classifier using rules and Bayesian analysis. In Ribeiro et al. (2016) a first attempt was made to describe explainability formally. The explanation can be made through an external explainer module, or a model can also be attempted to be made inherently explainable (Chattopadhyay et al., 2023). Post-hoc explainer strategy, as is the focus here, can be of different types, like (a) Ribeiro et al. (2016); Lundberg & Lee (2017) estimate feature importance for predicting a particular output, (b) counterfactual explanations (Wachter et al. (2017); Ustun et al. (2019); Rawal & Lakkaraju (2020)) determine if a feature x was present in the input, then would the model have predicted output y, (c) contrastive approaches (Jacovi et al., 2021) describe why an ML model has predicted a particular output instead of another, or (d) Weinberger et al. (2023) and Crabbé & van der Schaar (2022) have recently proposed new XAI methods tuned to the case of unsupervised learning. In this work, we specifically focus on feature importance-based explanation techniques. Feature Importance-based Explanations The study in Ribeiro et al. (2016) initiated the LIME frame- work which we reviewed in Section 1 as our primary point of motivation. Similarly, the work in Lundberg & Lee (2017) used a statistical sampling approach ("SHAP") to explain a classifier model in terms of human interpretable features. Lakkaraju et al. (2016) proposed a decision set-based approach to train a classifier that can be interpretable and accurate simultaneously - where a set of independent if-then rules defines a decision set. Ribeiro et al. (2018) proposed an anchor-based approach for explanation - where anchors were defined as a set of sufficient conditions for a particular local prediction. Evaluation is a critical component in any explanation framework. The study in Doshi-Velez & Kim (2017) described important characteristics for the evaluation of explanation approaches. Evaluation criteria for explanations can broadly be categorized into two types, (a) criteria which measure how well the explainer module is able to mimic the original classifier and (b) criteria which measure the trustworthiness of the features provided by the explainer module, like the work in Qi et al. (2019) demonstrated the change in 1http://qwone.com/~jason/20Newsgroups/ 2https://huggingface.co/datasets/dair-ai/emotion 3https://github.com/fastai/imagenette 4https://segment-anything.com/ 4 the prediction probability of a classifier with the removal of top K features predicted by a saliency map explainer. We note that in this work our tests done in Section 4 encompass both the above kinds of criteria. Lastly, we note that in Sokol & Flach (2020) a tree based explanation was attempted which could directly work in the multiclass setting but to be able to compete LIME their method's computation cost can need to scale with the number of segments in an image. Also, in sharp contrast to our LIPEx proposal, it does not have the critical ability to explain/reproduce the predicted distribution of the given complex model. 3 Our Setup Let C ∈ {1, 2, 3, . . .} be the number of classes in the classification setup. Given any probability vector C C, ∑ i=1 pi = 1, & pi ≥ 0, ∀i, we succinctly represent p as being a member of the simplex in p ∈ [0, 1] C−dimensions as p ∈ ∆C. Classifier Setup We aim to explain a classifier which can be described as a neural network fNN (parame- terized by weight w) composed with a layer of soft-max so that the output of the composition is a probability distribution over the C−classes. Thus we define the composed mapping, → ∆C, x ↦ Soft−Max ○ fNN(x) fw ∶ Rd (2) This composed function fw in Equation 2 commonly would have been trained via the cross-entropy loss on a C class labelled data - and we assume only black-box access to it. The Feature Space for Explanations For a specific data s (e.g., a piece of text), we denote the number of unique features (e.g., words) as ∣s∣ and assume that there is a selected 'feature space' with fs features. Suppose special subsets of them, say S(s) and Sf (s) have been chosen and there is a map, say Select which does the feature selection for each of its domain points as per say Algorithm A. S(s) ⊂ R∣s∣, Sf (s) ⊂ Rfs & Select ∶ S(s) → Sf (s) (3) The Local Explanation Matrix We explain fw's behaviour around s by a 'pseudo-linear model', gs,W which is defined as, gs,W ∶ Sf (s) → ∆C, z′ ↦ Soft−Max ○ W z′ (4) with W ∈ RC×fs being the "explanation matrix". ∣s∣ i.e. Boolean vectors are used to represent random In the LIME setup (as well as in LIPEx), S(s) ⊆ {0, 1} ways of dropping one or more of the (unique) words for text data and pixels for image data. Hence, in such setups, the original input instance is represented as an all-ones vector, 1s ∈ R∣s∣. We assume that there is a pre-chosen function (say Ts) that maps "perturbations" of the data contained in the set S(s) to some d−dimensional embedding (like the BERT embeddings) which can be input to the original prediction model (Equation 2). Ts ∶ S(s) → Rd (5) Also note that the input dimensions d of fw and fs for gs,W could be very different and dependent on s and typically, fs ⋘ d. Eg., in standard LIME implementations for a classifier one often chooses fs = 6 important features of the text s. The space of all probability distributions admits various natural metrics and Hellinger distance has previously been used for feature selection in classification (Fu et al., 2020). Hellinger distance between two discrete distributions p, q (on a set of C possible classes) is given as, H(p, q) ∶= 1 √ 2 ⋅ ¿ ` `(cid:192) ∑ c ∈ C √ ( p(c) − √ q(c)) 2 5 Apart from being an intuitive symmetric measure, squared Hellinger distance also offers other attractive features of being sub-additive, smaller than half of the KL divergence and always being within a quadratic factor of the Total Variation (TV) distance. (Canonne, 2020)5 S(s) ⊂ S(s)(⊆ {0, 1} Let ̃ ∣s∣ ) be a randomly sampled set of perturbations to be used for training. Passing it through the Select map (Equation 3) we obtain ̃ Sf (s) ⊂ Sf (s)(⊂ Rfs) which are the feature representations of the perturbations. We posit that the outputs of the Select map would determine what the explainer gs,W in Equation 4 acts on. Further noting that the output of the embedding map Ts in Equation 5 determines what the true predictor fw gets as input, we consider the following empirical risk function corresponding to a distance function π in R∣s∣, LH(gs,W , ̃ ˆ S(s)) = 1 ̃ S(s)∣ ∣ ∑ x∈ ̃S(s) π(1s, x) ⋅ H2 (gs,W ○ Select(x), fw ○ Ts(x)) + λ 2 ⋅ ∥W ∥ 2 F (6) x⊺1s where 1s, the all-ones vector in R∣s∣. We choose π(1s, x) = 1− ∣∣x∣∣⋅∣∣1s∣∣ for all our experiments. It is immediately interpretable that Equation 6 takes a π−weighted empirical average of the Hellinger distance squared between the true distribution over classes predicted by the complex classifier fw and the distribution predicted by the explainer gs,W while the λ−term penalizes for using high weight explainers and hence promotes simplicity of gs,W . Intuition for Good LIPEx Minima for Text Classifiers Being a ReLU Net For intuition, consider explaining classification predictions by a ReLU net on a text data s with ∣s∣ unique words. Further suppose the classifier has been trained to accept d(≥ ∣s∣) word length texts in their TF-IDF representation. Thus the Ts map (Equation 5) that lifts the perturbations of s to the input space of the complex classifier can be imagined as a tall matrix of dimensions d × ∣s∣ whose top ∣s∣ × ∣s∣ block is a diagonal matrix giving the TF-IDF values for the words in this text and the rest of the matrix being zeros. Also, we note that the Select function can be imagined as a linear projection of the Boolean-represented perturbations into the subset of important features. Further, any ReLU neural net is a continuous piecewise linear function Arora et al. (2018). Hence, except at the measure zero set of non-differentiable points, the function fNN (Equation 2) is locally a linear function. Thus, for almost every input z ∈ Rd there exists a (possibly small) neighbourhood of it where fNN = Wnet for some matrix Wnet ∈ RC×d. It would be natural to expect that most true texts are not at the non-differentiable points of the net's domain and that Ts maps small perturbations of the data into a small neighbourhood. Hence, for many perturbations x ∈ R∣s∣, fw(Ts(x)), as it occurs in the loss in Equation 6, is a Soft-Max of a linear transformation (composition of the net and the Ts map) of x. Recall that this is exactly the functional form of the explainer gs,W (Equation 4) given that the Select function can be represented as a linear map! Thus, we see that there is a very definitive motivation for this loss function to yield good locally linear explanations for ReLU nets classifying text. 4 Results At the very outset, we note the following salient points about our setup. Firstly, that for any data s (say a piece of text or an image), when implementing LIPEx on it, we generate a set of 1000 perturbations of input instances. Then we chose features by taking a union set over the top-3 features of each possible class, which was returned by the "forward feature selection" method (reproduced in Algorithm A) called on the above perturbation data set. We recall that this feature selection algorithm is standard in LIME implementations6. Suppose this union has fs features - then for all computations to follow for s we always stick with these fs features for LIPEx (and also always call LIME on fs number of features in comparison experiments). Secondly, we note that for the matrix returned by LIPEx (i.e. W in Equation 4) we shall define its "top−k" features as the features/columns of the matrix which give the k−highest entries by absolute value for the predicted class of that data. 5Our experiments were tried with TV and they underperformed compared to the squared Hellinger metric. 6https://github.com/marcotcr/lime 6 Figure 2: Histogram (over random data sampling) of the TV Distance between the probability distribution over classes as predicted by the complex black-box classifier and that obtained by LIPEx. Reproducing the Distribution over Classes of the Complex Classifier A key motivation for in- troducing the LIPEx framework was the need for the explanation framework to produce class distributions closely resembling those of the original classifier. Therefore, our initial emphasis is on investigating how much in Total Variation (TV) distance, the distribution over classes predicted by the obtained explainer is away from the one predicted for the same data by the complex model needing explanations. In Figure 2, we show the statistics of this TV distance for expeiments on both text (i.e. BERT on 20Newsgroups and BERT on Emotion) and image data (i.e. VGG16 and InceptionV3 on Imagenette). Figure 2 clearly shows that the distribution is highly skewed towards 0 over five hundred randomly sampled data over multiple modalities and state-of-the-art models. Note that the LIPEx loss (Equation 6) never directly optimized for the TV gap to be small and hence we posit that this is a strong test of performance that LIPEx passes. LIPEx Tracks Distortions of The Complex Model's Output Distribution This sanity check ex- periment is inspired by the studies in Adebayo et al. (2018). Here, we add mean-zero Gaussian noise to the trained complex model's last-layer weights and keep dialling up the noise variance till the model's accuracy is heavily damaged. At each noise level we compute the average over randomly sampled data, of the Total Variation distance between the output distribution of the damaged model and its original value and the same for the LIPEx's distribution for that model at respective inputs. We do text experiments with BERT on the Emotion dataset and image experiments with VGG16 on the Imagenette dataset. In Figure 3, for any specific data, LIPEx−Output is the LIPEx's output distribution for the original model, LIPEx(σ)−Output is the LIPEx's output distribution for the distorted model at noise variance σ. BERT−Output, BERT(σ)−Output, VGG16−Output and VGG16(σ)−Output are defined similarly. The right column of plots in Figure 3 demonstrates that as the model distorts, LIPEx's output moves away from the original in a remarkably identical fashion as the distorted model's output changes with respect to its original value. Importance of Top-K Features Detected by LIPEx A test of the correctness of determining any set of features to be important by an explanation method is that upon their removal from the original data and on presenting this modified/damaged input to the complex classification model it should produce a new predicted class than originally. We implement this test with text data in Table 1 and with image data in 7 Figure 3: In the left image, we see how the model accuracy drops upon adding noise to the last layer weights and bias, a mean 0 Gaussian noise at different variances. This demonstrates that the maximum added noise is sufficient to distort the model highly. On right, we see how the data averaged TV distance between the output distribution of LIPEx for the data at the original complex model and the noise-distorted complex model tracks the same change in the complex model's output. BERT 20NewsGroups Model & Dataset Top-K LIPEx LIME GuidedBack Saliency InputXGrad Deeplift Occlusion 0.387 0.477 0.517 0.517 0.553 0.597 0.61 0.637 0.623 0.63 0.777 0.841 0.856 0.881 0.912 0.653 0.697 0.647 0.64 0.65 0.781 0.857 0.897 0.909 0.908 0.657 0.74 0.73 0.73 0.793 0.387 0.477 0.517 0.517 0.553 0.597 0.61 0.637 0.623 0.63 0.45 0.543 0.59 0.627 0.653 0.65 0.66 0.697 0.697 0.693 0.38 0.48 0.52 0.523 0.57 0.6 0.63 0.653 0.643 0.64 0.38 0.48 0.52 0.523 0.57 0.6 0.62 0.637 0.633 0.637 K=1 K=2 K=3 K=4 K=5 K=1 K=2 K=3 K=4 K=5 BERT Emotion Table 1: Here, features refer to words. Upon removing top-K words detected by each of the XAI methods and doing re-prediction, we report the fraction of data on which the predicted class changes. We see that the words removed by LIPEx guidance more significantly impact the model's prediction than when guided by the other XAI methods. The complete experimental data with standard deviations can be seen in Table 6 in the appendix. Table 2. We demonstrate that when the top features detected by LIPEx are removed from the data, the original model's predicted class changes substantially more than when the same is measured for many other XAI methods for the predicted class - and the amount of change is proportional to the number of top features removed. 7 LIPEx Reproduces the Complex Model's Class Predictions Under LIPEx Guided Data Damage We posit that for a multi-class explainer as LIPEx, it is a very desirable sanity check that it should reproduce the underlying model's (new) predicted classes on the input when its top features are removed. In Table 3, 7We use the code in Atanasova et al. (2020) to implement the gradient-based methods in Table 1, and the package https: //github.com/PAIR-code/saliency to implement the saliency methods in Table 2. 8 Model & Dataset Top-K LIPEx LIME XRAI GradCAM GuidedIG BlurIG VanillaGrad SmoothGrad VGG16 Imagenetee InceptionV3 Imagenette K= 2 K= 3 K= 4 K= 2 K= 3 K= 4 0.763 0.82 0.867 0.673 0.753 0.773 0.74 0.78 0.793 0.63 0.713 0.767 0.713 0.77 0.793 0.693 0.7 0.74 0.69 0.763 0.79 0.653 0.697 0.72 0.717 0.75 0.793 0.663 0.67 0.713 0.713 0.787 0.807 0.647 0.703 0.717 0.68 0.753 0.807 0.657 0.653 0.72 0.747 0.817 0.843 0.65 0.683 0.74 IG 0.703 0.747 0.773 0.637 0.707 0.733 Table 2: Here, features refer to image segments which were gotten by Segment Anything. LIPEx and LIME can be used to directly get a weight for each segment while for the saliency-based methods a segment's importance is determined as the sum of the weights assigned to its pixels. In the table above we can see that the fraction of data on which label prediction changes under deletion of top features detected by LIPEx is consistently higher than for other XAI methods. The complete experimental data with the standard deviation can be found in the Table 7 in the appendix. Model & Dataset BERT (20Newsgroups) BERT (Emotion) VGG16(Imagenette) InceptionV3 (Imagenette) Modality Text Text Image Image Top1 0.90 (±0.041) 0.89(±0.022) 0.80(±0.046) 0.90(±0.051) Top2 0.85(±0.024) 0.84(±0.025) 0.73(±0.034) 0.78(±0.044) Top3 0.79(±0.039) 0.84(±0.017) 0.73(±0.034) 0.75(±0.015) Top4 0.71(±0.033) 0.82(±0.037) 0.73(±0.025) 0.74(±0.013) Top5 0.70(±0.005) 0.74(±0.033) 0.70(±0.075) 0.69(±0.035) Table 3: In this table, for each model and data combination, we give the fraction of data (over 100 random samples) over which the new class predicted by the complex model matches the new prediction by the LIPEx for the same model, upon removing from the data its top features as determined by LIPEx. We can observe that post this distortion on the data, the class labels from the complex model match those from the simple explainer for a significant majority of the instances. we show with text as well as image data, that this class prediction matching holds for the LIPEx explainer for an overwhelming majority of data. Evidence for Data Efficiency of LIPEx as Compared to LIME Since LIPEx and LIME, both are perturbation based methods, a natural question arises if LIPEx is more data-efficient, or in other words can its top features detected be stable if only a few perturbations close to the true data are allowed. In this test, we show that not only is this true, but also that (a) LIPEx's top features can at times even remain largely invariant to reducing the perturbations and also that (b) the difference with respect to LIME in the list of top features detected, is maintained when the allowed set of perturbations are increasingly constrained to be few and near the true data. Our comparison method is specified precisely as Algorithm C in the Appendix and we sketch it here as follows. When in the setting with unrestricted perturbations, we infer two lists of top features, one from the row of the predicted class of the matrix (i.e. W ) returned by LIPEx and another from LIME's weight vector for the same class - say LIPEx−List−s and LIME−List−s respectively. Next, we parameterize the restriction on the allowed perturbations by the maximum angle δ that any Boolean vector representing the perturbation is allowed to subtend with respect to the all-ones vector that represents the input data. We use the default set of perturbations in a LIME implementation as a baseline 8 and at different δ, we use only the δ−restricted subset of the perturbations to compute (for the model predicted class) the top features returned by the LIPEx matrix and the LIME, say δ−LIPEx−List−s and δ−LIME−List−s respectively. For quantifying the dissimilarities between these lists of top features measured by the two methods, we compute the following Jaccard indices and average the results on 100 randomly chosen instances. 8In the LIME code https://github.com/marcotcr/lime, the authors choose 5000 perturbations for any text data and 1000 for any image data. 9 Js,δ,LIME ∶= ∣ δ−LIME−List−s ∩ LIME−List−s δ−LIME−List−s ∪ LIME−List−s ∣, Js,δ,LIPEx ∶= ∣ δ−LIPEx−List−s ∩ LIPEx−List−s δ−LIPEx−List−s ∪ LIPEx−List−s ∣ Js,δ−LIPEx−vs−LIME ∶= ∣ δ−LIPEx−List−s ∩ LIME−List−s δ−LIPEx−List−s ∪ LIME−List−s ∣ It can be observed that Js,δ,LIPEx (the orange line) is very stable compared to that of LIME Figure 4: despite the allowed perturbations being made constrained. The difference in LIPEx's features w.r.t LIME is also maintained. The number of points considered at different δ is given in Table 5 in the appendix. From Figure 4, we can infer that at all levels of constraint on the data at least 50% of the top features detected by our LIPEx are different from LIME. Secondly, Js,δ,LIME (averaged) rapidly falls as the number of training data allowed near the input instance is decreased. Thus its vividly revealed that the features detected by LIME are significantly influenced by those perturbations that are very far from the true text. Lastly, and most interestingly, we note that the curve for Js,δ,LIPEx (the top orange line) is very stable to using only a few perturbations which subtend a low angle with the true text. Hence the top features detected by our explanation matrix are not only important (as demonstrated in the previous two experiments) – but can also be computed very data efficiently. 5 Conclusion In this work, we proposed a novel explainability framework, LIPEx, that when implemented in a classification setting, in a single training gives a weight assignment for all the possible classes for an input with respect to a chosen set of features. Unlike other XAI methods, it is designed to locally approximate the probabilities assigned to the different classes by the complex model - and this was shown to bear out in experiments over text and images - and it withstood ablation tests. Our experiments, showed that the LIPEx proposal provides more trustworthy and data-efficient explanations compared to multiple other competing methods across various data modalities. We note that our XAI loss, Equation 6, can be naturally generalized to other probability metrics like the KL divergence. Our studies strongly motivate novel future directions about not only exploring the relative performances between these options but also about obtaining guarantees on the quality of the minima of such novel loss functions. 10 References Julius Adebayo, Justin Gilmer, Michael Muelly, Ian Goodfellow, Moritz Hardt, and Been Kim. Sanity checks for saliency maps. Advances in neural information processing systems, 31, 2018. Sushant Agarwal, Shahin Jabbari, Chirag Agarwal, Sohini Upadhyay, Steven Wu, and Himabindu Lakkaraju. Towards the unification and robustness of perturbation and gradient based explanations. In International Conference on Machine Learning, pp. 110–119. PMLR, 2021. Raman Arora, Amitabh Basu, Poorya Mianjy, and Mukherjee, Anirbit. Understanding Deep Neural Networks with Rectified Linear Units. In I.C.L.R., 2018. Pepa Atanasova, Jakob Grue Simonsen, Christina Lioma, and Isabelle Augenstein. A diagnostic study of explainability techniques for text classification. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 3256–3274, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.263. URL https://aclanthology. org/2020.emnlp-main.263. Clément L. Canonne. A short note on learning discrete distributions, 2020. Jorge Casillas, Oscar Cordon, Francisco Herrera, and Luis Magdalena. Accuracy Improvements in Linguistic Fuzzy Modeling. 01 2003. ISBN 978-3-642-05703-8. doi: 10.1007/978-3-540-37058-1. Aditya Chattopadhyay, Kwan Ho Ryan Chan, Benjamin D Haeffele, Donald Geman, and René Vidal. Vari- ational information pursuit for interpretable predictions. arXiv preprint arXiv:2302.02876, 2023. Joe Collenette, Katie Atkinson, and Trevor Bench-Capon. Explainable ai tools for legal reasoning about cases: A study on the european court of human rights. Artificial Intelligence, 317:103861, 2023. Jonathan Crabbé and Mihaela van der Schaar. Label-free explainability for unsupervised models. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvári, Gang Niu, and Sivan Sabato (eds.), International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, volume 162 of Proceedings of Machine Learning Research, pp. 4391–4420. PMLR, 2022. URL https://proceedings. mlr.press/v162/crabbe22a.html. Emmanuel Charleson Dapaah and Jens Grabowski. Debugging machine learning models. 2016. Finale Doshi-Velez and Been Kim. Towards a rigorous science of interpretable machine learning, 2017. Alexandre Englebert, Olivier Cornu, and Christophe De Vleeschouwer. Poly-CAM: High resolution class activation map for convolutional neural networks, 2022. URL https://openreview.net/forum?id= qnm-2v-baW. Dumitru Erhan, Yoshua Bengio, Aaron Courville, and Pascal Vincent. Visualizing higher-layer features of a deep network. University of Montreal, 1341(3):1, 2009. Ruth Fong, Mandela Patrick, and Andrea Vedaldi. Understanding deep networks via extremal perturbations and smooth masks. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 2950– 2958, 2019. doi: 10.1109/ICCV.2019.00304. Guang-Hui Fu, Yuan-Jiao Wu, Min-Jie Zong, and Jianxin Pan. Hellinger distance-based stable sparse feature selection for high-dimensional class-imbalanced data. BMC bioinformatics, 21(1):1–14, 2020. Damien Garreau and Ulrike Luxburg. Explaining the explainer: A first theoretical analysis of lime. In International conference on artificial intelligence and statistics, pp. 1287–1296. PMLR, 2020. Arushi Gupta and Sanjeev Arora. A simple technique to enable saliency methods to pass the sanity checks, 2020. URL https://openreview.net/forum?id=BJeGZxrFvS. 11 Arushi Gupta, Nikunj Saunshi, Dingli Yu, Kaifeng Lyu, and Sanjeev Arora. New definitions and evaluations for saliency methods: Staying intrinsic, complete and sound. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh (eds.), Advances in Neural Information Processing Systems, volume 35, pp. 33120–33133. Curran Associates, Inc., 2022. URL https://proceedings.neurips.cc/paper_files/ paper/2022/file/d6383e7643415842b48a5077a1b09c98-Paper-Conference.pdf. Alon Jacovi, Swabha Swayamdipta, Shauli Ravfogel, Yanai Elazar, Yejin Choi, and Yoav Goldberg. Con- trastive explanations for model interpretability, 2021. Andrei Kapishnikov, Tolga Bolukbasi, Fernanda Viégas, and Michael Terry. Xrai: Better attributions through regions. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4948–4957, 2019. Andrei Kapishnikov, Subhashini Venugopalan, Besim Avci, Ben Wedin, Michael Terry, and Tolga Boluk- basi. Guided integrated gradients: An adaptive path method for removing noise. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 5050–5058, 2021. Zachary Labe and Elizabeth Barnes. Detecting climate signals using explainable ai with single-forcing large ensembles. 04 2021. doi: 10.1002/essoar.10505762.2. Himabindu Lakkaraju, Stephen H. Bach, and Jure Leskovec. Interpretable decision sets: A joint framework for description and prediction. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD '16, pp. 1675–1684, New York, NY, USA, 2016. Association for Computing Machinery. ISBN 9781450342322. doi: 10.1145/2939672.2939874. URL https://doi.org/ 10.1145/2939672.2939874. Benjamin Letham, Cynthia Rudin, Tyler H. McCormick, and David Madigan. Interpretable classifiers using rules and Bayesian analysis: Building a better stroke prediction model. The Annals of Applied Statistics, 9(3):1350 – 1371, 2015. Ori Linial, Orly Avner, and Dotan Di Castro. Pdexplain: Contextual modeling of pdes in the wild, 2023. Scott M. Lundberg and Su-In Lee. A unified approach to interpreting model predictions. In Proceedings of the 31st International Conference on Neural Information Processing Systems, NIPS'17, pp. 4768–4777, Red Hook, NY, USA, 2017. Curran Associates Inc. Lijun Lyu and Avishek Anand. Listwise explanations for ranking models using multiple explainers. In Jaap Kamps, Lorraine Goeuriot, Fabio Crestani, Maria Maistro, Hideo Joho, Brian Davis, Cathal Gurrin, Udo Kruschwitz, and Annalina Caputo (eds.), Advances in Information Retrieval - 45th European Conference on Information Retrieval, ECIR 2023, Dublin, Ireland, April 2-6, 2023, Proceedings, Part I, volume 13980 of Lecture Notes in Computer Science, pp. 653–668. Springer, 2023. Mark S. Neubauer and Avik Roy. Explainable ai for high energy physics, 2022. Zhongang Qi, Saeed Khorram, and Fuxin Li. Visualizing deep networks by optimizing with integrated gradients, 05 2019. Kaivalya Rawal and Himabindu Lakkaraju. Beyond individualized recourse: Interpretable and interactive summaries of actionable recourses. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 12187–12198. Curran Asso- ciates, Inc., 2020. Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. "why should i trust you?" explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD international conference on knowledge discovery and data mining, pp. 1135–1144, 2016. Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. Anchors: High-precision model-agnostic explana- tions. AAAI'18/IAAI'18/EAAI'18. AAAI Press, 2018. 12 Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE international conference on computer vision, pp. 618–626, 2017. Avanti Shrikumar, Peyton Greenside, Anna Shcherbina, and Anshul Kundaje. Not just a black box: Learning important features through propagating activation differences. arXiv preprint arXiv:1605.01713, 2016. Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps, 2014. Dylan Slack, Sophie Hilgard, Emily Jia, Sameer Singh, and Himabindu Lakkaraju. Fooling lime and shap: Adversarial attacks on post hoc explanation methods. In Proceedings of the AAAI/ACM Conference on AI, Ethics, and Society, AIES '20, pp. 180–186, New York, NY, USA, 2020. Association for Computing Machinery. Daniel Smilkov, Nikhil Thorat, Been Kim, Fernanda Viégas, and Martin Wattenberg. Smoothgrad: removing noise by adding noise. arXiv preprint arXiv:1706.03825, 2017a. Daniel Smilkov, Nikhil Thorat, Been Kim, Fernanda Viégas, and Martin Wattenberg. Smoothgrad: removing noise by adding noise. 06 2017b. Kacper Sokol and Peter Flach. Limetree: Consistent and faithful surrogate explanations of multiple classes. arXiv preprint arXiv:2005.01427, 2020. Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014. Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. In International conference on machine learning, pp. 3319–3328. PMLR, 2017. Berk Ustun, Alexander Spangher, and Yang Liu. Actionable recourse in linear classification. In Proceedings of the Conference on Fairness, Accountability, and Transparency, FAT* '19, pp. 10–19, New York, NY, USA, 2019. Association for Computing Machinery. ISBN 9781450361255. Sandra Wachter, Brent D. Mittelstadt, and Chris Russell. Counterfactual explanations without opening the black box: Automated decisions and the GDPR. CoRR, abs/1711.00399, 2017. Ethan Weinberger, Chris Lin, and Su-In Lee. Isolating salient variations of interest in single-cell data with contrastivevi. Nature Methods, pp. 1–10, 2023. Shawn Xu, Subhashini Venugopalan, and Mukund Sundararajan. Attribution in scale and space. In Proceed- ings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9680–9689, 2020. Matthew D Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In Computer Vision–ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part I 13, pp. 818–833. Springer, 2014. 13 A Feature Selection Algorithm 1 Forward feature selection Require: data X, target Y , number of features k 1: 2: Ensure: set of indices of the selected features Sel_feats 3: Sel_feats ← {} 4: for y in Y do 5: 6: 7: ▷ X ∈ R#Perturbations×#Unique−Words ▷ Y ∈ R#Perturbations×#Num−Classes ▷ y ∈ R#Perturbations×1 f ← initialize selection model of Ridge regression Current_sel_feats ← {} All_feats ← {1, 2, .., len(X[0])} for i ← 1 to k do best_idx ← 0 best_score ← −∞ for j ∈ (All_feats ∖ Sel_feats) do f ← f.fit(X[∶, Sel_feats ∪ {j}], y) ▷ f.fit() is used to train f, where the loss function is the linear least squares with l2-norm. score ← evaluate f with performance metric of R2 if score > best_score then ▷ len(X[0]) =Number Of Unique Words in X 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: best_idx ← j best_score ← score end if 19: 20: 21: 22: 23: end for 24: return Sel_feats end for Current_sel_feats ← Current_sel_feats ∪ {best_idx} end for Sel_feats ← Sel_feats ∪ Current_sel_feats B LIPEx Hyperparameter Settings Hyperparameter search was conducted over a small set of randomly selected data of each of the types mentioned below to decide on the following choices. Learning rate 0.01 λ 0.001 Batch size 128 Table 4: LIPEx Hyperparameter Settings Note that λ in above refers to the regularizer in the loss in equation 6. 14 C Pseudocode for the Quantitative Comparison Between LIPEx and LIME's Detected Important Features (as given in Section 4) Algorithm 2 LIME vs LIPEx w.r.t Angular Spread of the Perturbations About The True Data Require: k = number of top features to be used for comparing LIME and LIPEx Require: A set S of randomly sampled class labelled data at which the comparison is to be done Require: f ∗ Require: δ−List of all the angular deviations about the true data at which the LIPEx vs LIME comparison = the trained predictor that needs explanations. is to be done 1: for s ∈ S do 2: Compute LIPEx−List−s = top-k features of s w.r.t its predicted class, as detected by the LIPEx matrix using the standard set of Boolean vectors/perturbations w.r.t the all-ones representation of s. Compute LIME−List−s = top-k features of s w.r.t its predicted class, as detected by LIME using the standard set of Boolean vectors/perturbations w.r.t the all-ones representation of s - on the same set of features as used in the previous step. ▷ Note that the above two lists of "important" features do not depend on δ, ▷ We shall use both as reference lists for the different comparisons to follow. ▷ The list of features used above will be held fixed in the computations below. for δ ∈ δ − List do Compute δ−LIPEx−List−s = top-k features of s w.r.t its predicted class, as detected by the LIPEx matrix using only those Boolean vectors/perturbations which are within an angle of δ w.r.t the all-ones representation of s. Compute δ−LIME−List−s = top-k features of s w.r.t its predicted class, as detected by LIME using only those Boolean vectors/perturbations which are within an angle of δ w.r.t the all-ones representation of s Compute the Jaccard Index, Js,δ−LIPEx−vs−LIME ∶= ∣ Compute the Jaccard Index, Js,δ,LIME ∶= ∣ Compute the Jaccard Index, Js,δ,LIPEx ∶= ∣ δ−LIME−List−s ∩ LIME−List−s δ−LIME−List−s ∪ LIME−List−s ∣ δ−LIPEx−List−s ∩ LIPEx−List−s δ−LIPEx−List−s ∪ LIPEx−List−s ∣ δ−LIPEx−List−s ∩ LIME−List−s δ−LIPEx−List−s ∪ LIME−List−s ∣ 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: end for 13: 14: 15: end for 1 ∣S∣ ⋅ ∑s∈S Js,δ−LIPEx−vs−LIME) vs δ 16: Plot ( 1 17: Plot ( ∣S∣ ⋅ ∑s∈S Js,δ,LIME) vs δ 1 ∣S∣ ⋅ ∑s∈S Js,δ,LIPEx) vs δ 18: Plot ( 15 D Additional Experiments D.1 δ effect on Jaccard experiment For Text data δ (radians) number of perturbation points π 16 138 For Image data δ (radians) number of perturbation points 7π 30 228 π 8 659 8π 30 774 π 4 2383 9π 30 994 π 2 5000 10π 30 1000 Table 5: The effect of δ on the number of perturbation points, result averaged on 100 input instances. Note that when δ decreases, while the amount of allowed perturbations falls, the similarity measure π in equation 6 increases. D.2 Additional Data for the Demonstration in Figure 1 Figure 5: Comparison of the progress of training on the Hellinger distance based LIPEx loss, as given in equation 6, (its training curve being labelled as "HDLoss" above) and a natural Total Variation distance analogue of it (its training curve labelled as "TVLoss" above), for the text data in Figure 1 D.3 LIPEx on Images Each class/row of our explanation matrix would contain a weight corresponding to the importance of a com- mon set of features/super-pixels for that class. The figure below shows the part of the matrix corresponding to the top 3 classes detected for this image i.e. "Burmese_mountain_dog", "Entlebucher" and "Appenzeller" and the top−4 features deemed to be important for the predicted class i.e. "Burmese_mountain_dog". Thus we see how LIPEx successfully "localized" the dog as being determinant to the predictions rather than the cat which is also prominent in this picture. 16 Figure 6: Example of (the most important part) of the matrix returned by the LIPEx method on an image. See Figure 7 how the top 5 segments detected for the image patch together. The corresponding LIME answer is visualized in Figure 8 - and we can see how it prioritized image segments unrelated to the dog. Figure 7: The top 5 image segments deemed to be important by LIPEx for Inception-V3 to classify the image in Figure 6 as a "Burmese_mountain_dog" Figure 8: The weight vector over the features as returned by LIME 17 Figure 9: The LIPEx result for the image data in Figure 7 corresponds to the endpoint of minimizing the loss given in equation 6. (its training curve being labelled as "HDLoss" above). The training curve labelled as "TVLoss" corresponds to training on an analogous loss as in equation 6 but with the metric used in probability space being Total Variation. 18 D.4 More Details About the Ablation Studies in Section 4 Method Top1 Top2 Top3 Top4 Top5 LIPEx LIME GuidedBack Saliency Input_G Deeplift Occlusion LIPEx LIME GuidedBack Saliency Input_G Deeplift Occlusion 0.781(±0.047) 0.777(±0.027) 0.387(±0.049) 0.387(±0.049) 0.38(±0.054) 0.38(±0.054) 0.45(±0.045) 0.657(±0.021) 0.653(±0.017) 0.597(±0.029) 0.597(±0.029) 0.6(±0.033) 0.6(±0.033) 0.65(±0.016) BERT on 20Newsgroups 0.897(±0.016) 0.856(±0.045) 0.517(±0.074) 0.517(±0.074) 0.52(±0.071) 0.52(±0.071) 0.59(±0.082) 0.857(±0.036) 0.841(±0.031) 0.477(±0.082) 0.477(±0.082) 0.48(±0.079) 0.48(±0.079) 0.543(±0.066) BERT on Emotion 0.74(±0.037) 0.697(±0.041) 0.61(±0.029) 0.61(±0.029) 0.62(±0.029) 0.63(±0.028) 0.66(±0.022) 0.73(±0.028) 0.647(±0.037) 0.637(±0.009) 0.637(±0.009) 0.637(±0.009) 0.653(±0.012) 0.697(±0.012) 0.909(±0.026) 0.881(±0.011) 0.517(±0.054) 0.517(±0.054) 0.523(±0.05) 0.523(±0.05) 0.627(±0.065) 0.73(±0.029) 0.64(±0.045) 0.623(±0.009) 0.623(±0.009) 0.633(±0.009) 0.643(±0.012) 0.697(±0.005) 0.908(±0.032) 0.912(±0.021) 0.553(±0.042) 0.553(±0.042) 0.57(±0.029) 0.57(±0.029) 0.653(±0.063) 0.793(±0.024) 0.65(±0.008) 0.63(±0.008) 0.63(±0.008) 0.637(±0.005) 0.64(±0.008) 0.693(±0.017) Table 6: Here, features refer to words. Upon removing top-K words detected by each of the XAI methods and doing re-prediction, we report the fraction of data on which the predicted class changes. We see that the words removed by LIPEx guidance more significantly impact the model's prediction than when guided by the other XAI methods - even upto accounting for standard deviation over different runs. 19 Method Top3 Top4 Top5 Vgg16 LIPEx LIME XRAI GradCAM GuidedIG BlurIG Vanilla_Grad SmoothGrad Integrated_Grad LIPEx LIME XRAI GradCAM GuidedIG BlurIG Vanilla_Grad SmoothGrad Integrated_Grad 0.763(±0.026) 0.74(±0.014) 0.713(±0.025) 0.69(±0.016) 0.717(±0.017) 0.713(±0.009) 0.68(±0.022) 0.747(±0.019) 0.703(±0.021) 0.82(±0.014) 0.78(±0) 0.77(±0.008) 0.763(±0.026) 0.75(±0.016) 0.787(±0.017) 0.753(±0.005) 0.817(±0.005) 0.747(±0.029) InceptionV3 0.673(±0.005) 0.63(±0.014) 0.693(±0.017) 0.653(±0.005) 0.663(±0.046) 0.647(±0.041) 0.657(±0.012) 0.65(±0.024) 0.637(±0.019) 0.753(±0.005) 0.713(±0.046) 0.7(±0.029) 0.697(±0.017) 0.67(±0.051) 0.703(±0.034) 0.653(±0.026) 0.683(±0.049) 0.707(±0.025) 0.867(±0.017) 0.793(±0.009) 0.793(±0.026) 0.79(±0.043) 0.793(±0.009) 0.807(±0.017) 0.807(±0.012) 0.843(±0.005) 0.773(±0.017) 0.773(±0.017) 0.767(±0.034) 0.74(±0.062) 0.72(±0.036) 0.713(±0.04) 0.717(±0.029) 0.72(±0.051) 0.74(±0.037) 0.733(±0.04) Table 7: Here, features refer to image segments which were gotten by Segment Anything. LIPEx and LIME can be used to directly get a weight for each segment while for the saliency-based methods a segment's importance is determined as the sum of the weights assigned to its pixels. In the table above we can see that the fraction of data on which label prediction changes under deletion of top features detected by LIPEx is consistently higher than for other XAI methods - even upto accounting for standard deviation over different runs. 20 D.5 Comparison Between the Explanations Found by LIPEx and LIME Figure 10, 11 vividly demonstrate the fine-grained explanation that is obtained by the LIPEx matrix as opposed to the LIME's explanation (right bar) on the same number of feature sets. The input instances in Figure 10 and 11 are randomly chosen from the Emotion dataset. The explanatory matrix generated by LIPEx makes it easy to see the relationship between the same feature and different categories. Figure 10: Figure 11: 21 D.6 Comparison Between the Explanations Found by LIPEx and LIME for Text Data Where Predicted Class and the True Class are Different Figure 12, 13, 14, 15 demonstrate the fine-grained explanation that is obtained by the LIPEx matrix as opposed to the LIME's explanation on the same feature set for the predicted class - which is different than the true class for these instances. The input instances in Figure 12, 13, 14 and 15 are chosen from 20Newsgroups. Figure 12: 22 Figure 13: 23 Figure 14: 24 Figure 15: 25
http://arxiv.org/abs/2310.04855v1
"2023-10-07T15:31:15"
"2023-10-07T15:31:15"
Epsilon non-Greedy: A Bandit Approach for Unbiased Recommendation via Uniform Data
Often, recommendation systems employ continuous training, leading to a self-feedback loop bias in which the system becomes biased toward its previous recommendations. Recent studies have attempted to mitigate this bias by collecting small amounts of unbiased data. While these studies have successfully developed less biased models, they ignore the crucial fact that the recommendations generated by the model serve as the training data for subsequent training sessions. To address this issue, we propose a framework that learns an unbiased estimator using a small amount of uniformly collected data and focuses on generating improved training data for subsequent training iterations. To accomplish this, we view recommendation as a contextual multi-arm bandit problem and emphasize on exploring items that the model has a limited understanding of. We introduce a new offline sequential training schema that simulates real-world continuous training scenarios in recommendation systems, offering a more appropriate framework for studying self-feedback bias. We demonstrate the superiority of our model over state-of-the-art debiasing methods by conducting extensive experiments using the proposed training schema.
[ "S. M. F. Sani", "Seyed Abbas Hosseini", "Hamid R. Rabiee" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04855v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04855v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
Epsilon non-Greedy: A Bandit Approach for Unbiased Recommendation via Uniform Data S.M.F. Sani Department of Computer Engineering Sharif University of Technology Tehran, Iran s.feyzabadisani76@sharif.edu Seyed Abbas Hosseini Department of Computer Engineering Sharif University of Technology Tehran, Iran abbashossini@sharif.edu Hamid R. Rabiee Department of Computer Engineering Sharif University of Technology Tehran, Iran rabiee@sharif.edu 3 2 0 2 t c O 7 ] G L . s c [ 1 v 5 5 8 4 0 . 0 1 3 2 : v i X r a Abstract-Often, recommendation systems employ continuous training, leading to a self-feedback loop bias in which the system becomes biased toward its previous recommendations. Recent studies have attempted to mitigate this bias by collecting small amounts of unbiased data. While these studies have successfully developed less biased models, they ignore the crucial fact that the recommendations generated by the model serve as the training data for subsequent training sessions. To address this issue, we propose a framework that learns an unbiased estimator using a small amount of uniformly collected data and focuses on generating improved training data for subsequent training iterations. To accomplish this, we view recommendation as a contextual multi-arm bandit problem and emphasize on exploring items that the model has a limited understanding of. We introduce a new offline sequential training schema that simulates real-world continuous training scenarios in recommendation systems, offer- ing a more appropriate framework for studying self-feedback bias. We demonstrate the superiority of our model over state-of- the-art debiasing methods by conducting extensive experiments using the proposed training schema. Index Terms-Recommendation Systems, Self-feedback Loop Bias, Contextual Multi-Arm Bandit, Continuous Training I. INTRODUCTION Recommendation systems are built by training a model on a dataset D that contains historical interactions between users and items. This dataset is typically obtained from a previously deployed recommendation algorithm; hence learning from this data may introduce bias into the model. The goal is to learn a model represented by parameters θ that can estimate the probability p(r|a, c). Here, r indicates whether a user will show interest in the suggested item a, and c includes all relevant contextual information associated with the user-item interaction. The optimal parameters θ are typically obtained through point estimation techniques. This is typically done by minimizing a loss function over the dataset: θ∗ = argmin |D| (cid:88) θ wil(ri, ˆri(θ)) (1) i=1 Here, ri represents the true user feedback, while ˆri(θ) repre- sents the model's prediction. The term wi denotes the sample 1 weight, which is often set as |D| , providing equal weight to each sample in the dataset. However, relying solely on estimating parameter θ based on (1) can result in a biased model towards the training data. This bias, known as the self-feedback loop [1], persists even when an optimal algorithm is utilized for dataset col- lection. When the learned model encounters novel items or contexts not present in the training data, it often provides suboptimal recommendations with high confidence based on its acquired knowledge. As a result, these recommendations generate biased training data for subsequent iterations, thereby perpetuating bias in subsequent models. Recent research focused on addressing the self-feedback loop in recommendation systems can be categorized into two groups. The first group, termed debiasing methods, encom- passes methods that aim to acquire an unbiased estimation of parameter θ from the initially biased dataset. The second group, denoted as uncertainty-aware methods, emphasizes the inherent nature of continuous training in recommendation systems. These approaches strive to generate recommendations in a non-greedy way that produce less biased training data for subsequent training rounds. Debiasing methods aim to mitigate bias in recommenda- tion models trained on biased datasets. One common ap- proach to achieve unbiased models is by incorporating Inverse Propensity Scores (IPS) as sample weights in (1) [2]–[4]. However, these methods may face challenges associated with high variance, especially when the data collection algorithm differs significantly from the learning algorithm. Recent stud- ies propose methods that leverage information from uni- formly recommended items to learn unbiased models [5]–[7]. However, the amount of uniformly collected interactions in recommendation systems is often limited due to its negative impact on user satisfaction. The well-known epsilon-greedy algorithm exemplifies such an approach by utilizing a small amount of randomly suggested items to learn an unbiased model. Nonetheless, debiasing methods often prioritize recom- mending items with the highest expected feedback in a greedy manner without considering the impact on the composition of subsequent training datasets. Uncertainty-aware methods are designed to optimize long- term user satisfaction by generating recommendations that contribute to the creation of enhanced training data. These methods typically integrate exploration mechanisms that pri- oritize items with higher uncertainty, ensuring that the model is exposed to recommendations it has limited knowledge about. This helps mitigate bias during continuous training iterations [8]–[10]. However, these methods overlook the unbiased na- ture of uniformly collected data as a valuable source for debiasing in recommendation systems. To address these limitations, we introduced the Epsilon non- Greedy (EnG) framework, which combines the advantages of both groups above. Our EnG framework overcomes the limitations by achieving unbiased recommendations through learning on biased datasets and generating recommendations that can serve as less biased training data for subsequent training iterations, ultimately maximizing long-term user sat- isfaction. Given the widespread use of deep neural networks in state- of-the-art recommendation algorithms [11]–[13], we adopt them as our framework's underlying backbone. To achieve an unbiased recommendation system, we propose a teacher- student architecture with a novel training loss function that effectively leverages information from a small quantity of uniformly collected data. To incorporate systematic explo- ration into our framework, we view the recommendation as a contextual multi-arm bandit problem. We integrate Thomp- son sampling into our framework by employing the dropout technique, enabling us to recommend items the model has limited knowledge about. By incorporating this approach, the resulting interactions serve as improved training data for subsequent training sessions, ultimately enhancing long-term user satisfaction. The conventional training schema commonly employed in recent studies does not accurately reflect the debiasing capa- bilities of recommendation systems. We propose a novel of- fline sequential training schema that simulates the continuous training process observed in real-world recommendation sys- tems. Using this training schema, we perform comprehensive experiments and demonstrate that our proposed framework exhibits superior debiasing power compared to state-of-the-art methods. This paper presents several key contributions: I EnG Framework: We introduce the EnG framework, which enables unbiased recommendations and generates training data with a reduced bias for subsequent train- ing iterations. By utilizing a teacher-student architecture trained with the proposed loss function, the framework facilitates the development of an unbiased learner. Addi- tionally, the incorporation of Thompson sampling through the dropout technique allows the model to explore items for which it lacks certainty, effectively breaking the self- feedback loop and enhancing long-term recommendation performance. II Sequential Training Schema: We introduce a sequential training schema that closely aligns with real-world recom- mendation scenarios. This schema allows for evaluating debiasing capabilities in recommendation algorithms by simulating the continuous training process observed in real-world systems. III Experimental Evaluation: Extensive experimentation is conducted on two popular real-world datasets. The results demonstrate the superior debiasing power of the proposed EnG framework, surpassing state-of-the-art methods. II. RELATED WORK This section summarizes prior research endeavors to tackle the problem of self-feedback loop bias in recommendation systems. The existing literature can be broadly classified into two main categories: methods that primarily aim to achieve unbiased estimators and techniques that incorporate uncer- tainty to enhance long-term user satisfaction by improving the quality of training data for subsequent training iterations. A. Debiasing Methods Current research endeavors aiming to obtain unbiased esti- mators from biased data can be categorized into two main groups. The first group primarily uses inverse propensity scores, while the second concentrates on leveraging a limited quantity of collected unbiased data to learn an unbiased model. 1) Inverse Propensity Score: Propensity scores are crucial in addressing self-feedback loop bias in recommendation sys- tems. These scores represent the probability of observing a particular data point in the dataset and are typically determined by the recommendation algorithm. Methods that leverage propensity scores assign weights to each sample based on their inverse propensity, enabling the estimation of unbiased loss function of interest even when calculated on biased data [14]. The utilization of propensity scores has demonstrated improve- ments in the performance of matrix factorization methods [14], [15]. A recent study used propensity scores to predict users' preferences from Missing-Not-at-Random (MNAR) implicit feedback [4]. Furthermore, in seeking unbiased estimation for loss func- tion of interest, researchers have also explored using propen- sity scores in conjunction with positive-unlabeled learning techniques [3]. Inverse-propensity-based estimators, commonly used for unbiased point estimation, often face the issue of high variance when there are substantial disparities between the recommen- dation algorithm and the data collection algorithm. To mitigate this challenge, several solutions, including self-normalization, clipped, and doubly robust estimators, have been proposed [4], [16], [17]. 2) Uniformly Collected Data: Uniformly collected data refers to a dataset where recommendations are made with equal probabilities for different items. This data type provides an opportunity to estimate user preferences without the in- fluence of self-feedback loop bias, resulting in an unbiased estimator [18]. However, collecting a large amount of uniform data is impractical due to potential negative impacts on user satisfaction and business revenue. The epsilon greedy algo- rithm is a fundamental approach that leverages small amounts of uniformly collected data. This algorithm incorporates a random item selection strategy with a probability of epsilon, while the remaining items are selected greedily based on their expected rewards. A recent study proposed a multi- task objective that jointly factors the model trained on biased data with the model trained on uniformly collected data [19]. Another recent study presents an alternative approach employ- ing knowledge distillation methods for counterfactual recom- mendations, specifically classifying them into four categories: label-based, sample-based, feature-based, and structure-based distillation [5]. Our proposed approach is closely aligned with label-based distillation, particularly regarding the loss function utilized. Influence functions were also used to assign weights directly to training samples [20]. A recent study proposed a general framework that ad- dresses different biases using a meta-learning algorithm to obtain sample weights and provide unbiased estimations of the loss function of interest [6]. Theoretical guarantees also support the effectiveness of these debiasing strategies; causal diagrams have been employed to model biased and unbiased feedback generation processes in recommendation systems [21]. A debiasing strategy based on information bottleneck has been proposed by identifying the confounding bias as the disparity between the two diagrams. A recent research investigation has provided upper bounds for the unbiased loss function of interest, encompassing both a generalization error and a separability-based bound. Building upon these bounds, a novel debiasing approach named debiasing approximate upper bound (DUB) has been introduced [7]. Recent studies also have demonstrated the potential benefits of integrating inverse propensity scores alongside uniformly collected data [18], [22]. B. Uncertainty Aware Methods Uncertainty-aware methods aim to address the self-feedback loop bias by approximating the posterior distribution of model parameters p(θ|D) or estimating its variance since it is a way to quantify the uncertainty associated with the model's predictions. Considering the uncertainty in the model's pre- dictions, these methods promote exploratory recommendations to capture user interests and break the self-feedback loop. As the model explores diverse recommendations, the uncertainty decreases (convergence of the posterior distribution) and tends to exploit its learned knowledge more effectively. The con- textual multi-arm bandit problem has emerged as a widely adopted framework for an uncertainty-aware recommendation. A notable example is the LinUCB algorithm, which leverages contextual information to make informed recommendations [23]. In a related study, a factorization-based bandit algorithm that incorporates low-rank matrix completion by incrementally constructing a matrix representing user-item preferences has been proposed [24]. Thompson sampling helps balance the exploration/exploitation trade-off in recommendation systems [25]. This approach allows for a more principled exploration of the recommendation. Yarin Gal and Zoubin Ghahramani contributed significantly by providing a probabilistic interpre- tation of dropout in deep learning models. They developed training in deep a theoretical framework casting dropout neural networks as approximate Bayesian inference in deep Gaussian processes [26]. A recent study viewed the recom- mendation system as a contextual multi-arm bandit problem. They compared different techniques, including bootstrapping, dropout, and a hybrid method, for drawing samples from the posterior distribution in their model [8]. Furthermore, the authors investigated various exploration mechanisms. They compared the performance of the epsilon-greedy, Thompson sampling, and upper confidence bound methods in terms of their effectiveness as exploration strategies. A study proposed a comprehensive review of Thompson sampling to balance the exploration/exploitation trade-off [27]. In addition, some studies investigate the usage of propensity scores alongside exploration mechanisms. For instance, learnable propensity weights are employed to achieve unbiased estimations in the REINFORCE algorithm [28], [29]. III. EPSILON NON-GREEDY In this section, we introduce our framework, referred to as Epsilon Non-Greedy (EnG), which is specifically developed to accomplish two key objectives: (1) establish an unbiased rec- ommendation system by effectively utilizing a limited quantity of uniformly collected data and (2) generate recommendations that contribute to the creation of high-quality training data for subsequent training iterations. We make certain assump- tions regarding the recommendation system. We consider a scenario where the system recommends only one item at a time to the user. Additionally, we model the user's feedback as a binary random variable, denoted as r, where r = 1 indicates that the user likes the recommended item, while r = 0 shows otherwise. Furthermore, we assume that the contextual information vector, represented as c, is sufficiently comprehensive to encompass all relevant information required for the recommendation problem. Therefore, estimating the probability p(r = 1|a, c) to address the recommendation task effectively is sufficient. We propose a teacher-student architecture accompanied by a novel loss function to effectively harness the information in the uniformly collected data. This component of our framework, which shares similarities with using random interactions in the epsilon-greedy algorithm to learn an unbiased model, is called the "epsilon" component. Recognizing the significance of recommended items in the continuous training process, we incorporate Thompson sampling into the EnG framework. By utilizing Thompson sampling, the framework recommends items based on their probability of being the optimal choice. This deviates from the greedy approach of selecting items with the highest expected instant reward. This probabilistic recommendation strategy is called our framework's "non- greedy" component. To train the EnG framework, we utilize the historical interactions logged in a dataset denoted as D = {(ri, ai, ci)}i. This dataset can be divided into two main parts. The first part, denoted as Dr, consists of a relatively small amount of data collected using a uniform policy. This data is obtained by suggesting items to users with equal probability. The second part, denoted as Db, comprises the logs of interactions between users and items that were selected by the recommendation algorithm itself. In the recommendation problem, the user-item Lt = 1 |Dr| |Dr| (cid:88) i=1 l(ˆrt i, ri) + λtR(θt) (2) B. Non-Greedy interactions are often sparse, meaning that each user typically interacts with only a few items. Consequently, numerous user- item pairs remain unobserved in the dataset, denoted as Du. In the subsequent sections, we will provide a detailed explanation of each framework component. A. Epsilon We propose a teacher-student architecture to unleash the unbiased information of Dr. The teacher model is specifically trained on the uniformly suggested items in Dr to learn unbiased recommendations. Its role is to distill and transfer this knowledge to the student model, enabling the student to make less biased predictions. Fig 1 illustrates the proposed architecture of the EnG framework, which employs feedfor- ward neural networks as the backbone for both the teacher and student models. The training process starts by training the teacher network solely on Dr. The loss function used for training the teacher network is defined as follows: Where ˆrt represents the predicted reward by the teacher i network for the i-th sample. The true reward is denoted as ri. The loss function l is employed to quantify the discrepancy between predicted and true rewards. We choose Binary Cross Entropy (BCE) as it is suitable for binary classification tasks. R represents the regularization term. The parameters of the teacher network are represented by θt, and the hyperparameter λt controls the regularization strength. After the convergence of the teacher network, the student network is trained with the guidance of the teacher network using the following loss function: Ls = 1 |D| |D| (cid:88) i=1 l(ˆrs i , ri) + γreg |Du| |Du| (cid:88) i=1 lreg(ˆrs i , ˆrt i) + λsR(θs) (3) The first term involves training the student network on all available data D. However, relying solely on this term could introduce bias into the model due to the majority of data being non-uniformly collected. To mitigate this bias, we introduce the second term, which leverages the knowledge of the teacher network to establish an unbiased estimator. The student network is regularized by encouraging it to have similar predictions to the teacher network on unobserved data Du. Unobserved data is chosen as it provides a large amount of data for extensive training and shares similar unbiased charac- teristics with the uniformly collected data. The third term aims to regularize the weights of the student network to prevent overfitting. The γreg is used to control regularization strength in (3). To ensure that the student's predictions are close to the teacher's predictions, we consider two types of loss functions (lreg). The first group of loss functions treats the predictions as logits and measures the discrepancy between these predictions. Examples of such loss functions include squared error and absolute error. The second group of loss functions considers the predictions as parameters of Bernoulli distributions, which effectively model the probability of obtaining a reward based on a given action and context. Notable examples of such loss functions include the Kullback-Leibler (KL) divergence and Jeffreys divergence, which represents a symmetric variant of the KL divergence. Our proposed solution addresses the challenges of training a high-capacity model with limited uniform data by training the teacher and student models separately. The teacher model is initially trained with constrained capacity, θt ∈ Rp, θs ∈ Rq, where p << q, to mitigate variance and stabilize its recom- mendations. This ensures consistent and reliable knowledge transfer from the teacher to the student, even with limited uniformly collected data. By adopting this approach, the student model can benefit from the teacher's guidance while maintaining its capacity for accurate recommendations. This framework effectively enables the student model to learn from available data while leveraging the insights and expertise of the teacher model. To this point, utilizing the proposed epsilon component of the framework has enabled us to recommend items with the highest expected instant reward. arg max a∈A E[r = 1|a, c] (4) However, this strategy is considered greedy as it continually selects items that maximize the expected instant reward. To evaluate the impact of recommendations on continuous train- ing data, we can rewrite the probability p(r = 1|a, c) using Bayes' rule: p(r = 1|a, c) = (cid:90) p(r = 1|a, c, θ)p(θ|D)dθ (5) By accessing this posterior distribution, a non-greedy item selection strategy emerges. Instead of selecting items solely based on expected instant reward, we can recommend items in proportion to the probability of them being optimal. This can be expressed as: (cid:90) a′ p(a = a∗|c) = I[E[r|a, c, θ] = max E[r|a′, c, θ]]p(θ|D)dθ (6) In practice, obtaining the exact posterior distribution p(θ|D) and calculating the integral is intractable in many real- world scenarios. However, Thompson sampling provides an alternative technique. Instead of directly evaluating the inte- gral, Thompson sampling involves sampling model parameters from the posterior distribution and selecting the best item based on these drawn parameters. Thompson sampling allows for systematic exploration of the recommendation problem. Thompson sampling breaks the self-feedback loop by choosing items non-greedily using the drawn parameters. Initially, when the training begins, the posterior distribution is relatively flat, indicating uncertainty in the model parameters. Samples drawn from this distribution explore a wide range of parameter val- ues, leading to the exploration of various items. As the training Fig. 1: (Left) The smaller teacher network is trained via (2). (Right) The student network is trained via (3). progresses, the posterior distribution becomes more peaked, indicating increased confidence in the learned parameters. Consequently, samples drawn from the posterior distribution tend to cluster around the most probable parameter values, prioritizing the exploitation of the learned knowledge. To draw samples from the posterior distribution of neural network parameters, the study conducted by Yarin Gal and Zoubin Ghahramani offers valuable insights. They demonstrate that using the dropout technique during the inference stage of a neural network can be interpreted as obtaining model predic- tions based on samples drawn from the posterior distribution of the model parameters [26]. Dropout is a computationally efficient approach, making it practical to implement within recommendation systems without significant computational overhead. Therefore, the student network employs the dropout technique during the inference process (Fig 1). This allows for a balanced approach between exploration and exploita- tion in the recommendations made by the student network. By incorporating a teacher-student architecture and utilizing Thompson sampling during the recommendation process, the proposed framework effectively addresses the recommendation algorithm's short-term and long-term objectives. C. Sequential Training Algorithm Recent studies and endeavors aiming to disrupt the self- feedback loop in recommendation systems through uniformly collected data have predominantly adopted a conventional training approach. This approach involves partitioning the available uniform data into three distinct subsets: a small portion for model training, another portion for validation and hyperparameter tuning, and a final portion for unbiased evaluation. However, the conventional training approach fails to fully capture the continuous training nature of real-world recommendation systems. Evaluating the model solely based on this training schema may not accurately reflect its long- term performance. We propose a sequential training schema specifically tailored for training recommendation systems to overcome this limitation and better simulate real-world sce- narios. The proposed training algorithm adopts a sequential process wherein the training data, comprising uniformly collected and biased logged data, is divided into M batches. In each training round, the model predicts scores for all items in the batch. A proportion ρ of items with the highest predicted scores are selected as chosen recommendations and included in the model's training data. This sequential training schema aims to emulate the behavior of recommendation systems in real- world settings, where collected interactions often consist of recommendations suggested by the model itself. By incor- porating this sequential training schema, the algorithm aims to effectively integrate the continuous training aspect into the model learning process. The complete training algorithm, presented in Algorithm 1, outlines the step-by-step procedure for implementing the proposed Epsilon non-Greedy framework. In the 7th line of the algorithm, we incorporate the dropout technique to obtain predictions. This utilization of dropout introduces additional diversity in the selected training data, thereby enhancing the exploration aspect of the dataset generation process for our recommendation model. When a method solely prioritizes learning an unbiased algorithm without considering the com- position of subsequent training data, it tends to predominantly recommend items for which it already possesses knowledge. Consequently, the quality and diversity of the model's training data diminish, leading to a bias toward recommendations generated by the method during subsequent training iterations. IV. EMPIRICAL EVALUATION This section comprehensively evaluates the performance of the EnG framework compared to state-of-the-art meth- ods. Firstly, we demonstrate the effectiveness of our teacher- student architecture in achieving unbiased recommendations using limited uniformly collected data through conventional and sequential training. Secondly, we investigate the potential enhancement of the proposed method by integrating Thomp- son sampling into the recommendation process, particularly in reducing biases over extended durations. Additionally, an ablation study is conducted to analyze the impact of important hyperparameters on the performance of EnG. The code can be accessed via github.com/FeyzabadiSani/Epsilon-nonGreedy/ 1) Datasets: This section provides an overview of the datasets used in our experiments. The statistical characteristics of these datasets, including the positive sample ratio (PR), are presented in Table I. YahooR3 [30]: Comprises user ratings of songs on a scale ranging from 1 to 5. The dataset consists of interactions train, Dr validation, Dr test Algorithm 1 Epsilon Non-Greedy Require: Dr, Db, Du, M , ρ, λteacher, λstudent, γstudent 1: Split Dr into Dr 2: Divide Dr 3: Initialize θ0 4: S b ← {} 5: S r ← {} 6: for i = 1 to M do 7: train, Db into M equal batches (dr student i , db i ) (db i ) student i based on scores in descending order scores ← fθi−1 Sort db winners ← top ρ portion of db i S b ← S b ∪ winners S r ← S r ∪ dr i Initialize θi Initialize θi θi teacher ← update on S r using (2) student ← update on S r, S b, Du using (3) θi student teacher 8: 9: 10: 11: 12: 13: 14: 15: 16: end for 17: return θM student between 15,400 users and 1,000 songs. It is divided into two parts: the first part consists of user ratings collected during regular interactions with Yahoo music services, which can be considered as the biased portion of the dataset. The second part consists of user ratings on randomly selected songs, which can be considered as the uniform portion of the dataset. Coat [14]: It includes ratings of 290 users on 300 different coats, using a scale ranging from 1 to 5. Each user is initially asked to rate 24 coats based on their personal interests. Additionally, a further 16 coats are randomly selected for the user to rate, constituting the dataset's uniform data portion. The datasets are binarized based on user ratings, represent- ing the sparsity of user feedback. Ratings of 5 indicate liked items, while ratings below 5 indicate disliked items. 2) Evaluation Metrics: In line with recent studies, we adopt two commonly used evaluation metrics: Area Under the ROC Curve (AUC) and Binary Cross-Entropy (BCE) loss [5]–[7]. The AUC metric assesses the discriminative power of an algo- rithm in distinguishing between positive and negative classes. It can be interpreted as the probability that the algorithm predicts a random positive sample with a higher score than a random negative sample. A higher AUC value indicates better performance in ranking positive samples higher than negative samples. On the other hand, the BCE loss considers the model's confidence in its predictions. It penalizes the model heavily when it assigns a wrong label to a sample with high confidence. The model is encouraged to make confident and accurate predictions by minimizing the BCE loss. 3) Baselines: Recent studies predominantly rely on matrix factorization, while our framework leverages neural networks due to their enhanced representational capacity, which has made them the primary architecture in state-of-the-art recom- mendation algorithms [11]–[13]. To ensure a fair comparison, we consider existing studies that can be adapted as loss TABLE I: Statistics of Datasets Dataset |Dr| |Db| Coat YahooR3 4640 54000 6594 311704 |Dr | |Db| 0.70 0.17 PR(Dr, Db) (0.05, 0.09) (0.03, 0.24) functions similar to our proposed EnG loss. These include the Bridge and Refine strategies [5], Autodebias approach [6], and the DUB method [7]. Two baseline models, "Uniform" and "Union," are also included for performance comparison. The "Uniform" model is exclusively trained on uniformly collected data Dr, while the "Union" model is trained on the entire dataset D, including both uniformly collected and biased logged data. Hyperparameters were selected based on the achieved AUC scores on the validation set. The range for the regularization weights, including γreg, was set as [1e-4, 1e-3, 1e-2, 1e-1, 1]. The batch size of the data loader was varied among the values [16, 32, 64, 128, 256]. The hyperparameter αrefine was explored within the range [1e-4, 1e-3, 1e-2, 1e-1, 0.1, 0.2, ..., 0.9]. For the YahooR3 dataset, embedding dimensions of [10, 20, 50, 100, 200] were used for user and item IDs. Network architectures with both 2-layer and 3-layer configurations were examined, with neuron counts per layer ranging from [32, 64, 128, 256, 512], ensuring that the teacher network had significantly fewer parameters than the student network. Results on the Coat dataset were averaged over 10 runs, while results on the YahooR3 dataset were averaged over 5 runs. Convergence was ensured using an early stopping method based on the BCE score on the validation set. The code will be made available upon acceptance of the paper. 4) Performance Investigation using conventional training schema: In this section, similar to prior studies, we employ conventional training schema to evaluate the efficacy of the EnG framework in utilizing limited uniformly collected data. The uniform portion of the dataset was divided into three disjoint sets: training, validation, and testing. The validation and test sets were chosen explicitly from the uniformly col- lected data to ensure an unbiased evaluation process. For both datasets, 20 percent of the uniformly collected data was allocated for training, while the remaining uniform data were evenly distributed between the validation and test sets. The experimental results are presented in Table II. Upon analyzing the results, several noteworthy observations emerge. First, strategies that utilize uniformly collected data effectively yield higher AUC scores than the Union strategy, which combines all available data. Although all strategies suc- cessfully use this information, the proposed EnG framework exhibits significantly higher AUC scores than other state-of- the-art methods. This indicates its superior effectiveness in leveraging the information from uniformly collected data. It is worth noting that the YahooR3 dataset, being sparser and more challenging, presents more considerable disparities in the positive ratio feedback distribution (PR) between uniform TABLE II: Performance Comparison - Conventional Training TABLE III: Performance Comparison - Sequential Training Method EnG-MAE EnG-MSE EnG-KL EnG-Jeffrey Bridge Refine Autodebias DUB Union Uniform Coat YahooR3 AUC BCE AUC BCE 0.829 0.829 0.835 0.837 0.801 0.774 0.779 0.796 0.749 0.676 0.174 0.171 0.164 0.160 0.183 0.209 0.242 0.194 0.204 0.186 0.775 0.775 0.780 0.787 0.668 0.765 0.748 0.727 0.631 0.614 0.132 0.192 0.228 0.209 0.224 0.325 0.103 0.112 0.279 0.112 Method EnG-MAE EnG-MSE EnG-KL EnG-Jeffrey Bridge Refine Autodebias DUB Union Uniform Coat YahooR3 AUC BCE AUC BCE 0.790 0.787 0.797 0.795 0.737 0.708 0.740 0.644 0.687 0.594 0.220 0.219 0.191 0.216 0.280 0.296 0.323 0.207 0.209 0.281 0.739 0.758 0.760 0.769 0.653 0.731 0.691 0.646 0.612 0.547 0.132 0.202 0.255 0.231 0.226 0.359 0.333 0.128 0.289 0.114 and biased data when compared to the Coat dataset (refer to Table I). This more significant divergence poses a heightened challenge in effectively utilizing the uniformly collected data within the YahooR3 dataset. Consequently, the AUC scores achieved for the Coat dataset consistently surpass those ob- tained for the YahooR3 dataset. Furthermore, when examining specific strategies, it is observed that the AUC scores of the Bridge and DUB methods on the YahooR3 dataset are notably lower than their respective AUC scores on the Coat dataset. The Bridge strategy, where teacher and student networks are trained simultaneously, encounters difficulty achieving stability during training. This, combined with the challenge of extracting knowledge from the uniformly collected data in the YahooR3 dataset, explains the performance drop of the Bridge strategy. In the case of the DUB loss function, the term that aims to make the student mimic the teacher's prediction error on uniform data becomes less effective due to the more significant discrepancy between the feedback distributions of uniform and biased data in the YahooR3 dataset. Lastly, the BCE score is directly influenced by the similarity between the training and test distributions, as it measures the discrepancy between predicted and ground truth distributions. Consequently, the Autodebias approach achieves a lower BCE score as it directly optimizes its parameters using uniformly collected data without employing a teacher-student architecture. However, since the difference in the positive ratio distribution between uniform and biased data is much more significant in the YahooR3 dataset compared to Coat, incorporating biased data can help reduce the BCE score on the Coat dataset. As a result, the proposed EnG framework achieves a lower BCE score on the Coat dataset. 5) Performance Investigation using sequential training schema: In this section, we adopt a sequential training schema described in Section III-C. The training data is divided into 20 batches, and we carefully adjust the selection ratio (ρ) and the proportion of uniformly collected data used in training to ensure that the ratio of unbiased data to biased data in each batch remains low (approximately 5 percent). The experimental results are presented in Table III. We observe a decrease in AUC scores and an increase in BCE scores compared to the results of previous experiments. This the reduced can be attributed to two main reasons. First, amount of uniformly collected data poses challenges for the methods to extract unbiased information, leading to a decline in performance. Second, adopting a sequential training schema intensifies the self-feedback loop effect, where the model's recommendations are increasingly influenced by its previous predictions, potentially introducing bias in subsequent training iterations. Consistent with the previous results, except for the DUB strategy on the Coat dataset, the EnG framework and state-of-the-art methods achieve higher AUC scores than the Union strategy. However, the EnG framework demonstrates further improvements in AUC scores, indicating its capability to effectively utilize smaller amounts of uniformly collected data, even in a sequential training schema. This highlights the effectiveness of the EnG methods in leveraging limited amounts of unbiased data for improved recommendation per- formance. The observed decrease in AUC score for the DUB strategy on the Coat dataset, resulting in inferior performance compared to the Union strategy, can be attributed to the spe- cific characteristics of the DUB approach. The DUB strategy incorporates a loss term that encourages the student network to emulate the prediction errors of the teacher network on uniformly collected data. However, in this scenario where the teacher network's reliability is diminished, this loss term may introduce misleading guidance to the DUB model, thereby hindering its overall performance. Lastly, the intensified bias is evident through higher BCE scores for all methods, including Autodebias, on the YahooR3 dataset. The Uniform strategy attains the lowest BCE score, benefiting the most from the similarity between the training and test data distributions. However, relatively smaller BCE scores are observed for the EnG methods on the Coat dataset. The reasons for this can be attributed to similar explanations as before. 6) Impact of Introducing Thompson Sampling: In this sec- tion, we aim to investigate the potential performance enhance- ment of our proposed model through the incorporation of Thompson sampling (TS) and the introduction of exploratory behavior in the recommendation process. We analyze two settings, differing only in applying Thompson sampling while selecting the model's training data. The findings of this anal- ysis are summarized in TableIV. Initially, we observe that the TABLE IV: Impact of Thompson Sampling Method EnG-MAE EnG-MAE(TS) EnG-MSE EnG-MSE(TS) EnG-KL EnG-KL(TS) EnG-Jeffrey EnG-Jeffrey(TS) Coat YahooR3 AUC BCE AUC BCE 0.726 0.777 0.740 0.779 0.740 0.783 0.715 0.773 0.266 0.192 0.260 0.180 0.268 0.110 0.263 0.190 0.665 0.728 0.734 0.741 0.763 0.768 0.672 0.773 0.175 0.105 0.198 0.116 0.216 0.110 0.201 0.111 utilization of Thompson sampling improves both the AUC and BCE scores of the EnG methods. It is important to note that the architectural design and hyperparameters remain consistent across both methods. Thus, the observed improvement can be directly attributed to the enhanced quality of the training data resulting from the application of Thompson sampling. Furthermore, our analysis reveals that the improvements in terms of the BCE score are more pronounced compared to the enhancements in the AUC score. This could be attributed to utilizing dropout techniques during inference in the Thompson Sampling models. This leads to recommending items with lower scores if dropout techniques were not employed. This, in turn, increases the inclusion of uncertain items in the model's training data for the subsequent training iteration. Incorporating these uncertain items contributes to enhancing both coverage and diversity within the training data. Given that the BCE score is sensitive to the dissimilarity between the training and test data distributions, including these uncertain items helps mitigate this discrepancy, thereby reducing the BCE score. Lastly, the improvement in AUC for the MAE and Jeffreys regularization loss functions is more substantial com- pared to the MSE and KL regularization loss functions. This observation can be attributed to the nature of the loss functions themselves. The MAE loss imposes stricter constraints than MSE loss on the output range of the teacher and student networks, as it operates within the range of 0 to 1. Similarly, the Jeffreys loss, a symmetric KL variant, is also a more restrictive loss function. Consequently, adding exploration has a more significant potential to enhance the performance of models trained with MAE and Jeffreys regularization loss functions. 7) Impact of Regularization Losses: The findings presented in Table II, Table III, and Table IV demonstrate that the KL and Jeffreys loss functions exhibit a slight advantage over the MAE and MSE loss functions. This performance discrepancy can be attributed to the inherent properties of the KL and Jeffreys distances, which incorporate a logarithmic penalty to measure the discrepancy between the teacher and student network predictions. As a result, these loss functions impose a more substantial penalty on the divergence between the output probability distributions of the two networks. Consequently, they facilitate a more effective transfer of knowledge from Fig. 2: Varying different sequential training parameters. the teacher to the student network, ultimately enhancing the performance of the student model. 8) Ablation Study: In this section, we investigate the impact of various learning parameters on the performance of our proposed EnG framework. Specifically, we analyze the effects of different factors, namely the amount of uniformly collected train|/|Dr|), the selection ratio (ρ) for data used in training (|Dr choosing top predictions from each training batch, and the dropout ratio that determines the level of exploration during prediction. The influence of using different amounts of uniformly col- lected data and varying selection ratios (ρ) is presented in Fig 2. To solely consider EnG's capability to extract information from uniformly collected data, we restrict the amount of biased data by setting ρ = 0.25 for the Coat dataset and ρ = 0.1 for the YahooR3 dataset. Our observations reveal that the AUC scores generally increase as more uniformly collected data is available in the training dataset. Furthermore, the EnG methods exhibit promising performance in utilizing uniformly collected data compared to state-of-the-art competitive meth- ods. Notably, the Refine strategy demonstrates limited effec- tiveness in leveraging uniformly collected data, potentially due to the manner in which uniform data is incorporated. In Refine strategy, the teacher network imputes labels on biased data, but given the small amount of uniformly collected data, these imputed labels could not effectively transfer the knowledge from the uniform data. In order to exclusively examine the impact of selecting varying amounts of biased data in each training batch, we limit the quantity of uniform training data to 1 percent of the total available uniform data within the datasets. The results demonstrate that all methods exhibit an increasing trend in AUC scores with a larger quantity of biased data selected in each training batch (Fig 2 right). Notably, the EnG methods show further improvements with an increased amount of biased data. However, a significant performance gap is observed between the EnG methods and other state-of- the-art approaches on the Coat dataset. This can be attributed to two reasons: first, the EnG framework effectively utilizes small quantities of uniformly collected data, as observed in previous experiments, and second, the relatively smaller disparity in positive ratios between the uniform and biased data in the Coat dataset, as compared to the YahooR3 dataset, provides an explanation for the effectiveness of EnG methods in utilizing a larger quantity of biased data in conjunction with limited unbiased data. Notably, this increasing trend is not observed in the Bridge and DUB methods. In the Bridge strategy, where the teacher and student networks are trained simultaneously, the interleaving training procedure becomes detrimental when only a small portion of uniform data is used. Similarly, enforcing the student network to mimic the teacher's prediction error in the DUB strategy can lead to adverse effects when the teacher network is relatively weak. The increase in dropout rate introduces additional random- ness in the outputs of neural networks, leading to increased exploration and stronger regularization during training. How- ever, excessively high dropout rates can have detrimental effects on model performance due to excessive exploration and regularization, hindering the model's ability to exploit learned knowledge effectively. Therefore, it is crucial to strike a balance when incorporating randomness into the model. In Fig 3, we analyze the impact of varying dropout rates on the performance of EnG methods. The AUC scores demonstrate an upward trend as the dropout rate increases, indicating that a moderate increase in the dropout rate can benefit the methods by encouraging exploration and appropriate regular- ization. However, there is a trade-off between exploration and exploitation, as some methods initially benefit from increasing dropout rates but experience a decline in performance when the dropout rate becomes excessively high. Similar trends are observed in the BCE scores. For example, on the Coat dataset, the BCE scores initially decrease with an increasing dropout rate but eventually rise due to excessive exploration and regularization. Conversely, on the YahooR3 dataset, lower dropout rates yield better performance in BCE scores, with an increase in the dropout rate leading to higher BCE scores. V. CONCLUSION AND FUTURE WORKS In conclusion, recommendation systems commonly suffer from bias induced by the self-feedback loop, which arises from continuous training of the algorithm on its previous recommendations. To address this issue, we propose a teacher- student architecture that effectively leverages a small quantity of uniformly collected data to learn an unbiased model. By incorporating Thompson sampling, we ensure that the architecture learns an unbiased recommendation system and generates recommendations that contribute to improved train- ing data for subsequent training iterations. This integration allows the model to exhibit exploratory behavior towards items it is unaware of, resulting in less biased training data for future training iterations. To evaluate the effectiveness of our Fig. 3: Impact of varying dropout rate on EnG framework. architecture, we introduce a sequential training schema that emulates the continuous training process observed in real- world recommendation systems. Distribution shift poses a significant challenge in recom- mendation systems, as the distributions of user interests, item preferences, and contextual information undergo dynamic changes over time. When combined with the continuous train- ing nature of recommendation systems, this distribution shift can exacerbate the self-feedback bias. Despite the importance of this dynamic nature in recommendation problems, current studies and datasets do not adequately capture it. Hence, investigating the relationship between distribution shift and the self-feedback loop represents a promising avenue for future research. REFERENCES [1] J. Chen, H. Dong, X. Wang, F. Feng, M. Wang, and X. He, "Bias and debias in recommender sys- tem: A survey and future directions," arXiv preprint arXiv:2010.03240, 2020. [2] W. Sun, S. Khenissi, O. Nasraoui, and P. Shafto, "De- biasing the human-recommender system feedback loop in collaborative filtering," in Companion Proceedings of The 2019 World Wide Web Conference, 2019, pp. 645– 651. [3] Y. Saito, tri-training for debiasing missing-not-at-random explicit feedback," in Proceed- ings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval, 2020, pp. 309–318. "Asymmetric [4] Y. Saito, S. Yaginuma, Y. Nishino, H. Sakata, and K. Nakata, "Unbiased recommender learning from missing-not-at-random implicit feedback," in Proceed- ings of the 13th International Conference on Web Search and Data Mining, 2020, pp. 501–509. [5] D. Liu, P. Cheng, Z. Dong, X. He, W. Pan, and Z. Ming, "A general knowledge distillation framework for counterfactual recommendation via uniform data," in Proceedings of the 43rd International ACM SIGIR Con- ference on Research and Development in Information Retrieval, 2020, pp. 831–840. J. Chen, H. Dong, Y. Qiu, et al., "Autodebias: Learn- ing to debias for recommendation," in Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, 2021, pp. 21–30. [6] [7] D. Liu, P. Cheng, Z. Lin, et al., "Bounding system- induced biases in recommender systems with a ran- domized dataset," ACM Transactions on Information Systems, vol. 41, no. 4, pp. 1–26, 2023. [8] D. Guo, S. I. Ktena, P. K. Myana, et al., "Deep bayesian bandits: Exploring in online personalized recommenda- tions," in Fourteenth ACM Conference on Recommender Systems, 2020, pp. 456–461. [9] O. Jeunen, D. Rohde, F. Vasile, and M. Bompaire, "Joint policy-value learning for recommendation," in Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 2020, pp. 1223–1233. [10] C. Du, Z. Gao, S. Yuan, et al., "Exploration in on- line advertising systems with deep uncertainty-aware learning," in Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, 2021, pp. 2792–2801. [11] H.-T. Cheng, L. Koc, J. Harmsen, et al., "Wide & deep learning for recommender systems," in Proceedings of the 1st workshop on deep learning for recommender systems, 2016, pp. 7–10. [12] X. He, L. Liao, H. Zhang, L. Nie, X. Hu, and T.-S. Chua, "Neural collaborative filtering," in Proceedings of the 26th international conference on world wide web, 2017, pp. 173–182. [13] F. Xue, X. He, X. Wang, J. Xu, K. Liu, and R. Hong, "Deep item-based collaborative filtering for top- n recommendation," ACM Transactions on Information Systems (TOIS), vol. 37, no. 3, pp. 1–25, 2019. [14] T. Schnabel, A. Swaminathan, A. Singh, N. Chandak, and T. Joachims, "Recommendations as treatments: De- biasing learning and evaluation," in international con- ference on machine learning, PMLR, 2016, pp. 1670– 1679. [15] D. Liang, L. Charlin, and D. M. Blei, "Causal inference for recommendation," in Causation: Foundation to Ap- plication, Workshop at UAI. AUAI, 2016. [16] A. Swaminathan and T. Joachims, "The self-normalized estimator for counterfactual learning," advances in neu- ral information processing systems, vol. 28, 2015. [17] X. Wang, R. Zhang, Y. Sun, and J. Qi, "Doubly robust joint learning for recommendation on data missing not at random," in International Conference on Machine Learning, PMLR, 2019, pp. 6638–6647. [18] B. Yuan, J.-Y. Hsia, M.-Y. Yang, et al., "Improving ad click prediction by considering non-displayed events," in Proceedings of the 28th ACM International Con- ference on Information and Knowledge Management, 2019, pp. 329–338. [20] [19] S. Bonner and F. Vasile, "Causal embeddings for recom- mendation," in Proceedings of the 12th ACM conference on recommender systems, 2018, pp. 104–112. J. Yu, H. Zhu, C.-Y. Chang, et al., "Influence func- tion for unbiased recommendation," in Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval, 2020, pp. 1929–1932. [21] D. Liu, P. Cheng, H. Zhu, et al., "Mitigating confound- ing bias in recommendation via information bottleneck," in Fifteenth ACM Conference on Recommender Systems, 2021, pp. 351–360. [22] X. Wang, R. Zhang, Y. Sun, and J. Qi, "Combating selection biases in recommender systems with a few the 14th ACM unbiased ratings," in Proceedings of International Conference on Web Search and Data Mining, 2021, pp. 427–435. [23] L. Li, W. Chu, J. Langford, and R. E. Schapire, "A contextual-bandit approach to personalized news article recommendation," in Proceedings of the 19th international conference on World wide web, 2010, pp. 661–670. [24] H. Wang, Q. Wu, and H. Wang, "Factorization bandits for interactive recommendation," in Thirty-First AAAI Conference on Artificial Intelligence, 2017. [25] W. R. Thompson, "On the likelihood that one unknown probability exceeds another in view of the evidence of two samples," Biometrika, vol. 25, no. 3-4, pp. 285–294, 1933. [26] Y. Gal and Z. Ghahramani, "Dropout as a bayesian approximation: Representing model uncertainty in deep learning," in international conference on machine learn- ing, PMLR, 2016, pp. 1050–1059. [27] C. Riquelme, G. Tucker, and J. Snoek, "Deep bayesian bandits showdown: An empirical comparison of bayesian deep networks for thompson sampling," in International Conference on Learning Representations, 2018. [28] M. Chen, A. Beutel, P. Covington, S. Jain, F. Belletti, and E. H. Chi, "Top-k off-policy correction for a reinforce recommender system," in Proceedings of the Twelfth ACM International Conference on Web Search and Data Mining, 2019, pp. 456–464. [29] R. J. Williams, "Simple statistical gradient-following learning," algorithms for connectionist reinforcement Machine learning, vol. 8, no. 3, pp. 229–256, 1992. [30] B. M. Marlin and R. S. Zemel, "Collaborative prediction and ranking with non-random missing data," in Pro- ceedings of the third ACM conference on Recommender systems, 2009, pp. 5–12.
http://arxiv.org/abs/2310.04854v1
"2023-10-07T15:30:23"
"2023-10-07T15:30:23"
Repelling Random Walks
We present a novel quasi-Monte Carlo mechanism to improve graph-based sampling, coined repelling random walks. By inducing correlations between the trajectories of an interacting ensemble such that their marginal transition probabilities are unmodified, we are able to explore the graph more efficiently, improving the concentration of statistical estimators whilst leaving them unbiased. The mechanism has a trivial drop-in implementation. We showcase the effectiveness of repelling random walks in a range of settings including estimation of graph kernels, the PageRank vector and graphlet concentrations. We provide detailed experimental evaluation and robust theoretical guarantees. To our knowledge, repelling random walks constitute the first rigorously studied quasi-Monte Carlo scheme correlating the directions of walkers on a graph, inviting new research in this exciting nascent domain.
[ "Isaac Reid", "Eli Berger", "Krzysztof Choromanski", "Adrian Weller" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04854v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04854v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "stat.ML", "@scheme": "http://arxiv.org/schemas/atom" }
[ "stat.ML", "cs.LG" ]
3 2 0 2 t c O 7 ] L M . t a t s [ 1 v 4 5 8 4 0 . 0 1 3 2 : v i X r a Preprint. Under review. Repelling Random Walks Isaac Reid1 , Eli Berger2 , Krzysztof Choromanski3,4∗, Adrian Weller1,5 1University of Cambridge, 2University of Haifa, 3Google DeepMind, 4Columbia University, 5Alan Turing Institute ir337@cam.ac.uk, kchoro@google.com Abstract We present a novel quasi-Monte Carlo mechanism to improve graph-based sampling, coined repelling random walks. By inducing correlations between the trajectories of an interacting ensemble such that their marginal transi- tion probabilities are unmodified, we are able to explore the graph more effi- ciently, improving the concentration of statistical estimators whilst leaving them unbiased. The mechanism has a trivial drop-in implementation. We showcase the effectiveness of repelling random walks in a range of settings including estimation of graph kernels, the PageRank vector and graphlet concentrations. We provide detailed experimental evaluation and robust theoretical guarantees. To our knowledge, repelling random walks con- stitute the first rigorously studied quasi-Monte Carlo scheme correlating the directions of walkers on a graph, inviting new research in this exciting nascent domain.1 1 Introduction and related work Quasi-Monte Carlo (QMC) sampling is well-established as a universal tool to improve the convergence of MC methods, improving the concentration properties of estimators by using low-discrepancy samples to reduce integration error (Dick et al., 2013). They replace i.i.d. samples with a correlated ensemble, carefully constructed to be more 'diverse' and hence improve approximation quality. Such methods have been widely adopted in the Euclidean setting. For example, when sam- pling from isotropic distributions, one popular approach is to condition that samples are orthogonal: a trick that has proved successful in applications including dimensonality re- duction (Choromanski et al., 2017), evolution strategy methods in reinforcement learning (Choromanski et al., 2018; Rowland et al., 2018) and estimating sliced Wasserstein dis- tances (Rowland et al., 2019). 'Orthogonal Monte Carlo' has also been used to improve the convergence of random feature maps for kernel approximation (Yu et al., 2016), including recently in attention approximation for scalable Transformers (Choromanski et al., 2020). Intuitively, conditioning that samples are orthogonal prevents them from clustering together and ensures that they 'explore' Rd better. In specific applications it is sometimes possible to derive rigorous theoretical guarantees (Reid et al., 2023b). Less clear is how these powerful ideas generalise to discrete space. Of particular interest are random walks on graphs, which sample a sequence of nodes connected by edges with some stopping criterion. Random walks are ubiquitous in machine learning and statistics (Xia et al., 2019), providing a simple mechanism for unbiased graph sampling that can be implemented in a distributed way. However, slow diffusion times (especially for challenging graph topologies) can lead to poor convergence and downstream performance. Our key contribution is the first (to our knowledge) quasi-Monte Carlo scheme that corre- lates the directions of an ensemble of graph random walkers to improve estimator accuracy. By conditioning that walkers 'repel' in a particular way that leaves the marginal walk prob- abilities unmodified, we are able to provably suppress the variance of various estimators ∗Senior lead. 1We will make all code publicly available. 1 Preprint. Under review. whilst preserving their unbiasedness. We derive strong theoretical guarantees and observe large performance gains for algorithms estimating three disparate quantities: graph ker- nels (Choromanski, 2023), the PageRank vector (Avrachenkov et al., 2007) and graphlet concentrations (Chen et al., 2016). Related work: The poor mixing of random walkers on graphs is well-documented and various schemes exist to try to improve estimator convergence. Most directly modify the base Markov chain by changing the transition probabilities, but without altering the walker's stationary distribution and therefore leaving asymptotic estimators (e.g. based on empirical node occupations) unmodified. The canonical example of such a scheme is non-backtracking walks which do not permit walkers to return to their most recently visited node (Alon et al., 2007; Diaconis et al., 2000; Lee et al., 2012). More involved schemes allow walkers to interact with their entire history (Zhou et al., 2015; Doshi et al., 2023). Many of these strategies provide theoretical guarantees that the asymptotic variance of estimators is reduced, but crucially the marginal probabilities of sampling different walks are modified so they cannot be applied to non-asymptotic estimators that rely on particular known marginal transition probabilities. Conversely, our QMC scheme leaves marginal walk probabilities unmodifed. Research has also predominantly been restricted to the behaviour of a single self-interacting walker rather than an ensemble, and when multiple walkers are considered analytic results are generally restricted to simple structures, e.g. complete graphs (Rosales et al., 2022; Chen, 2014). This research exists within the broader literature of reinforced random walks, where nonlinear Markov kernels are used so that walkers are less (or more) likely to transition to nodes that have been visited in the past (Pemantle, 2007). However, the analytic focus has predominantly been on properties like recurrence times, escape times from sets, cover times and localisation results for simple topologies (Amit et al., 1983; Tóth, 1995; Tarrès, 2004), rather than the behaviour of associated statistical estimators on general graphs. The latter is of more direct interest in machine learning. In Sec. 2 we introduce the The remainder of the manuscript is organised as follows. requisite mathematics and present our novel QMC repelling random walk mechanism. In Secs 3-5 we use it to approximate three quantities of interest in machine learning: graph node kernels (Sec. 3), the PageRank vector (Sec. 4), and graphlet statistics (Sec. 5). Repelling random walks are empirically found to outperform the i.i.d. variant in every case and we are often able to provide concrete theoretical guarantees. 2 Repelling random walks Consider an undirected, connected graph G(N , E) where N := {1, ..., N } denotes the set of nodes and E denotes the set of edges, with (i, j) ∈ E if there is an edge between nodes i, j ∈ N . Write the graph's (weighted) adjacency matrix A := [aij]i,j∈N , where aij ̸= 0 if (i, j) ∈ E and 0 otherwise. Let di := P I[(i, j) ∈ E] denote the node degree, which is the number of neighbours of a particular node, and let N (i) := {j ∈ N |(i, j) ∈ E} denote the set of neighbours of node i. The transition matrix P = [Pij]i,j∈N of a simple random walk is given by j∈N Pij = ( 1 di 0 if (i, j) ∈ E otherwise (1) such that at every timestep the walker selects one of its neighbours with uniform probability. This can be viewed as a finite and time-reversible Markov chain with state space N . Supposing we have m such walkers on the graph simultaneously, we can define an augmented Markov chain with state space N m, consisting of the possible node positions of all the walkers. If the walkers are independent, the joint transition matrix Q ∈ RN m×N m is given by the Kronecker product Q = P(1) ⊗ P(2) ⊗ ... ⊗ P(m) (2) where each P(i) is given by Eq. 1. Our key contribution is now to induce correlations between the walkers' paths such that the joint transition matrix Q is modified but each marginal transition matrix (and hence the unbiasedness of any estimators relying on it) is unchanged. The correlations are designed to improve estimator convergence. 2 Preprint. Under review. i.i.d. repelling Figure 1: Schematic for behaviour of repelling random walkers at a particular timestep. By sampling from each 'block' (blue and green rectangles) without replacement we get a more even distribution over neighbours, without changing the marginal probabilities. t denote the set of walkers at node i at timestep t, and N (i) Definition 2.1 (Repelling random walks). A repelling ensemble has the following behaviour. Let V (i) | the size of this set. Randomly divide these walkers into N (i) t //d subsets of size d and one 'remainder' subset of size N (i) t %d < d (where // and % denote truncating integer division and the remainder, respectively). Among each subset, assign the walkers to a neighbour from the set N (i) uniformly without replacement. := |V (i) t t t This is in contrast to i.i.d. walkers where V (i) are assigned to the neighbours N (i) uniformly with replacement. We provide a schematic in Fig. 1. In the repelling scheme, each walker still has a marginal transition probability Pij = {1/di if (i, j) ∈ E, 0 otherwise}, but now they are forced to take different edges and heuristically 'explore' the graph more effectively. The sample of walks is more 'diverse'. Since the marginal transition probabilities P(i) are unmodified, any estimators that are unbiased with i.i.d. walkers are also automatically unbiased with repelling walkers, including in the non-asymptotic regime. However, as we shall see, their concentration properties are often substantially better. Computational cost and implementation: Repelling random walks have a trivial drop- in implementation. The only difference is whether walkers are assigned to neighbours with or without replacement. Moreover, the transitions in the augmented state space N m remain Markovian (memoryless); there are no extra space complexity costs because we only need access to the current positions of all the walkers. Physical interpretation and entanglement: Under repulsive interactions, the joint transition matrix Q can no longer be written as a Kronecker product. For example, for 2 walkers in the same 'block', ( (cid:16) di (cid:17) di−1 (1 − δj1j2 ) − 1 1 + δi1i2 1 QN i1+i2,N j1+j2 := Pr(j1, j2|i1, i2) = Pi1j1 Pi2j2 * if di ̸= 1 if di = 1 (3) which does not generically factorise into (i1, j1)- and (i2, j2)-dependent parts. In quantum mechanics (QM), an interacting Hamiltonian H which cannot be written as a Kronecker sum gives rise to a time-evolution operator U := exp(− i Ht) that cannot be written as a Kro- ̄h necker product, which in turn generically gives rise to quantum entanglement between parti- cles. Just as the von-Neumann entropy (a measure of bipartite quantum entanglement (Am- ico et al., 2008)) increases under such interactions, in our QMC scheme the Shannon mutual information initially increases from 0: during the first timestep, ∆I1,2 = δi1i2 log( di di−1 ) ≥ 0. Note that the analogy is not exact because in QM the time-evolution operator acts on (com- plex) wavefunctions whereas here the transition matrix acts on the (real positive) probabil- ities of being in different states of a Markov chain encoding the positions of walkers on a graph. It is just intended to help build intuition for the reader. It will be convenient to define one further class of interacting random walk. 3 Preprint. Under review. Definition 2.2 (Transient repelling random walks). An ensemble of random walks is de- scribed as transient repelling if any given subset is repelling (according to the Def. 2.1) until the walkers diverge, and independent thereafter. Such an ensemble will capture the repelling behaviour at early times but eventually relax to independence. A pair of particles will repel according to Def. 2.1 until they are located at different nodes (which may take more than one timestep if the ensemble size is larger than the initial node degree), but will not interact if they meet again later. Whilst less practical than the full repelling scheme, we will see that sometimes it makes theoretical analysis tractable. We now apply our repelling random walks mechanism to three disparate applications: ap- proximation of graph kernels (Sec. 3), approximation of the PageRank vector (Sec. 4), and approximation of graphlet concentrations (Sec. 5). 3 Application 1: approximating graph kernels We begin by demonstrating the effectiveness of repelling random walks for estimating graph kernels KG : N × N → R, defined on the nodes N of a graph G. Such kernels capture the structure of G, letting practitioners repurpose theoretically grounded and empirically successful algorithms like support vector machines, kernelised principal component analysis and Gaussian processes to the discrete domain (Smola and Kondor, 2003). Applications include in bioinformatics (Borgwardt et al., 2005), community detection (Kloster and Gle- ich, 2014), generative modelling (Zhou et al., 2020) and solving shortest-path problems (Crane et al., 2017). Chief examples of KG are the d-regularised Laplacian and diffusion kernels, given by K(d) lap := (I + σ2 eL)−d and Kdiff := exp(−σ2 eL/2) respectively. Here, σ2 is a lengthscale parameter and eL is the normalised graph Laplacian, defined by eL := I − W with W = [aij/( ̃di j aij is the weighted node degree and aij is the weight of the original edge). eL is the analogue of the fa- miliar Laplacian operator ∇2 = ∂2 in discrete space, describing diffusion ∂x2 1 on G (Chung and Yau, 1999; Chung, 1997). For large graphs, computing e.g. K(d) lap exactly can be prohibitively expensive due to the O(N 3) time complexity of matrix inversion. This motivated the recently-introduced class of Graph Random Features (GRFs) (Choromanski, 2023), which provide a discrete analogue to Random Fourier Features (Rahimi and Recht, 2007). These N -dimensional vectors φ(i) ∈ RN are constructed for every node i ∈ N such that their Euclidean dot product is equal to the kernel evaluation in expectation, i,j=1 a normalised weighted adjacency matrix ( ̃di = P + ... + ∂2 ∂x2 n ̃dj)1/2]N + ∂2 ∂x2 2 [K(2) lap]ij = E (cid:0)φ(i)⊤φ(j)(cid:1) . In their paper, Choromanski (2023) provides an elegant algorithm for constructing φ(i): one simulates m ∈ N random walks out of each node i that terminate with probability p at every timestep, depositing a 'load' at every node they visit to build up a randomised projection of the local environment in G. They show that this gives an unbiased estimate of K(2) lap, which can be used to construct K(d) lap for d ∈ N or an asymptotically unbiased approximation of Kdiff. Since the unbiasedness of the estimator depends on the marginal probabilities of sampling different finite-length random walks being unmodified (c.f. just its stationary distribution), it is a natural setting to test our new quasi-Monte Carlo scheme. (4) Remarkably, provided the number of repelling walkers is less than or equal to the smallest node degree, we are able to derive an analytic closed form for the difference in kernel estimator mean squared error (MSE) between the i.i.d. and transient-repelling mechanisms for general graphs (deferred to Eq. 32 in App. A.1 for brevity). This enables us to make the following statement, proved in App. A.1. Theorem 3.1 (Superiority of repelling random walks for kernel estimation). In the limit σ → 0, provided the number of walkers in the transient repelling ensemble is smaller than or equal to the minimum node degree of the graph and the edge-weights of W are equal, Var([ bK(2) lapij]repelling ≤ Var([ bK(2) lapij]i.i.d. (5) 4 Preprint. Under review. Figure 2: Relative Frobenius norm of estimates of the 2-regularised Laplace kernel (lower is better) vs. number of random walks for: i) vanilla GRFs; ii) GRFs with antithetic termi- nation (Reid et al., 2023a); iii) GRFs with repelling walks; iv) GRFs with both antithetic termination and repelling walks. Using both QMC schemes together gives the best results for all graphs considered and the gains are large (sometimes a factor of > 2). N gives the number of nodes, p is the edge-generation probability for the Erdös-Rényi graphs, and d is the d-regular node degree. One standard deviation on the mean error is shaded but is too small to easily see. for nodes (i, j) separated by at least 2 edges for both i) trees and ii) 2-dimensional grids. Though we have made some restrictions for analytic tractability, we will empirically observe In particular, that the full repelling QMC scheme is effective in much broader settings. it substantially suppresses kernel estimator variance with many walkers, arbitrary σ and arbitrary graphs. Extending the proof to these general cases is an exciting open problem. We also note that our scheme is fully compatible with the recently-introduced QMC scheme known as antithetic termination (Reid et al., 2023a), which anticorrelates the lengths of random walkers (by coupling their terminations) but does not modify their trajectories. Both schemes can be applied simultaneously, inducing negative correlations between both the walk directions and lengths. 3.1 Pointwise kernel estimation We now empirically test Eq. 5 for general graphs by comparing the variance of [ bK(2) lap]ij under different schemes. In what follows, 'GRFs' refers to graph random features constructed using i.i.d. walkers, whilst 'q-{a,r,ar}-GRFs' denotes the efficient quasi-Monte Carlo variants where walkers exhibit antithetic termination ('a') (Reid et al., 2023a), repel ('r'), or both ('ar'). We use these different flavours of (q-)GRFs to generate unbiased estimates bK(2) lap, then compute the relative Frobenius norm ∥K(2) lap∥F between the true and approximated Gram matrices. Fig. 2 presents the results for various graphs: small Erdős- Rényi, larger Erdős-Rényi, a binary tree, a d-regular graph, and four standard real-world examples from (Ivashkin, 2023) (karate, dolphins, football and eurosis). These differ substantially in both size and structure. We take 100 repeats to compute the variance of the kernel approximation error, using a regulariser σ = 0.1 and a termination probability p = 0.5. The gains provided by the repelling QMC scheme (green) are much greater than those from antithetic termination (orange), but the lowest variance is achieved when both are used together (red). Note that the gains provided by repelling random walks continue to accrue as the size of the ensemble grows; with m = 16 walkers the error is often halved. lap∥F/∥K(2) lap − bK(2) 5 51015No. random walks0.0020.0040.0060.0080.0100.012Frob. norm errorER (N=20, p=0.2)GRFsq-a-GRFsq-r-GRFsq-ar-GRFs51015No. random walks0.0020.0040.0060.0080.0100.012Frob. norm errorER (N=100, p=0.04)51015No. random walks0.0020.0040.0060.0080.0100.012Frob. norm errorBinary tree (N=127)51015No. random walks0.0020.0040.0060.0080.0100.0120.014Frob. norm errord-regular (N=100, d=10)51015No. random walks0.0020.0040.0060.0080.0100.0120.014Frob. norm errorKarate (N=34)51015No. random walks0.0020.0040.0060.0080.0100.0120.014Frob. norm errorDolphins (N=62)51015No. random walks0.0020.0040.0060.0080.0100.0120.014Frob. norm errorFootball (N=115)51015No. random walks0.0040.0060.0080.0100.0120.014Frob. norm errorEurosis (N=1272) Preprint. Under review. 3.2 Downstream applications: kernel regression for node attribute prediction We have both proved (Theorem 3.1) and empirically confirmed (Fig. 2) that using repelling random walks substantially improves the quality of estimation of the 2-regularised Laplacian kernel using GRFs. Naturally, this permits better performance in downstream applications that depend on the approximation. As an example, we follow Reid et al. (2023a) and consider kernel regression on triangular mesh graphs (Dawson-Haggerty, 2023). Consider a graph G where each node is associated with a normal vector v(i). The task is to predict the directions of a random set of missing 'test' vectors (a 5% split) from the remaining 'train' vectors. We compute our (unnormalised) predictions bv(i) as bv(i) := P lap(i, j)v(j), where j sums over the training vertices and bK(2) lap(i, j) is constructed using the GRF and q-{a,r,ar}-GRF mechanisms described in Sec. 3.1. We compute the average angular error 1−cos θ between the prediction bv(i) and groundtruth v(i) across the test set. We use m = 16 random walks with a termination probability p = 0.5 and a regulariser σ = 0.1, taking 1000 repeats for statistics. Table 1 reports the results. Higher-quality kernel approximations with repelling random walks give more accurate downstream predictions for all graphs, with the biggest gains appearing when our repelling scheme is introduced ('r' and 'ar'). The difference is remarkably big when the number of nodes N is big: on torus, the error is reduced by a factor of almost 3. Accurate approximation is especially helpful for these large graphs as exact methods become increasingly expensive. j bK(2) Table 1: Angular error 1 − cos θ between true and predicted node vectors when approx- imating the Gram matrix with GRFs and q-{a,r,ar}-GRFs (lower is better). Brackets give one standard deviation. Both schemes in combination works best. Graph N cylinder teapot idler-riser busted torus 210 480 782 1941 4350 GRFs 0.0650(7) 0.0331(2) 0.0528(3) 0.00463(2) 0.000506(1) Pred error, 1 − cos θ q-r-GRFs q-a-GRFs 0.0644(7) 0.0322(2) 0.0521(3) 0.00456(2) 0.000482(1) 0.0466(3) 0.0224(1) 0.0408(2) 0.003833(6) 0.000180(1) q-ar-GRFs 0.0459(2) 0.0215(1) 0.0408(2) 0.003817(6) 0.000181(1) Though for concreteness we have considered one particular downstream application, we stress that improving the kernel estimate can be expected to boost performance in any algorithm that uses it, e.g. for graph node clustering (Dhillon et al., 2004), shortest-path prediction (Crane et al., 2017) or simulation of graph diffusion (Reid et al., 2023a). 4 Application 2: approximating PageRank As a second application, we use repelling random walks to improve numerical estimates of the PageRank vector: a popular measure of node importance in a graph originally proposed by Page et al. (1998) to rank websites in search engine results. The PageRank vector is defined as the stationary distribution of Markov chain whose state space is the set of all graph nodes N , with a transition matrix eP := (1 − p)P + p N E. (6) Here, p ∈ (0, 1) is a scalar, N is the number of nodes, P is defined in Eq. 1 and E = [1]i,j∈N is a matrix whose entries are all ones. This encodes the behaviour of a 'surfer' who at every timestep either teleports to a random node with probability p or moves to one of its neighbours chosen uniformly at random. Since eP is stochastic, aperiodic and irreducible, we can define the unique PageRank vector π ∈ RN : π⊤ eP = π⊤, π⊤1 = 1, (7) 6 Preprint. Under review. where we normalised the sum of vector entries to 1. Physically, πj is the stationary prob- ability that a surfer is at node j. π is very expensive to compute for large graphs and the form of eP invites MC estimation with random walkers. Fogaras et al. (2005) suggest the following algorithm. Algorithm 4.1 (Random walks for PageRank estimation). (Fogaras et al., 2005) Simulate m ∈ N runs of a simple random walk with transition probability matrix P out of every node i ∈ N , terminating with probability p at each timestep. Evaluate the estimator bπj as the fraction of walks terminating at node j, bπj := 1 I(walker terminates at j). Pm P N m j=1 N It is straightforward to show that bπ is an unbiased estimator of π (see App. A.2). This is a natural setting to test an ensemble of repelling random walks. We are able to make the following surprisingly strong statement. Theorem 4.2 (Superiority of repelling random walks for PageRank estimation). Supposing the size of the transient repelling ensemble is smaller than or equal to the minimum node degree, for any graph. Var(bπj)repelling ≤ Var(bπj)i.i.d. (8) We defer a full proof to App. A.2 but provide a brief sketch below. Proof sketch: If the number of walkers is smaller than the minimum node degree, the behaviours of a transient repelling and i.i.d. ensemble only differ at the first timestep. In the former scheme walkers are forced to diverge whereas in the latter they are indepen- dent. The expectation values of the estimators associated with each walker are condition- ally independent given their node positions at t = 1 and are identical in both schemes by definition; denote it by f (vt=1). With the i.i.d. ensemble the variance depends on v(1)⊥v(2)[f (v(1) E t=1)] where the node positions of a pair of walkers v(1,2) are indepen- dent. Meanwhile, for repelling walkers it depends on E t=1)] where we condition that v(1,2) cannot be equal. Simple algebra reveals that the latter is smaller, with the difference depending on the variance of f (vt=1) among the set of neighbours of the starting node N (vt=0). v(1)̸=v(2)[f (v(1) t=1)f (v(2) t=1)f (v(2) It is remarkable that Theorem 4.2 holds for arbitrary G. In practice, we find that using two walkers in the full repelling scheme works well. It is straightforward to use multiple independent pairs to further improve the estimator bπ, although the quality of approximation is excellent even with just 2 walkers. Table 2 reports the estimator error πerr := ∥π − bπ∥2 for a termination probability p = 0.3 and 1000 trials on the same graphs as in Sec. 3.1 (on eurosis we take 10000 trials for further variance suppression). As per the theoretical guarantees, repelling random walks consistently perform better. Table 2: Mean L2-norm of the difference between the true and approximated PageRank vectors πerr := ∥π − bπ∥2, using i.i.d. and repelling pairs of random walkers. Lower is better. Repelling random walks consistently outperform i.i.d. random walks. Paren- theses give one standard deviation on the mean error. Graph N Small ER Larger ER Binary tree d-regular karate dolphins football eurosis 20 100 127 100 34 62 115 1272 PageRank error, πerr i.i.d. repelling 0.0208(2) 0.00420(2) 0.00290(1) 0.00434(2) 0.0124(1) 0.00686(4) 0.00385(2) 0.000342(2) 0.0196(2) 0.00406(2) 0.00270(1) 0.00422(2) 0.0115(1) 0.00651(4) 0.00376(2) 0.000335(2) As a brief addendum for the interested reader: bπj is actually a member of a broader class of functions coined step-by-step linear, defined as follows. 7 Preprint. Under review. Definition 4.3 (Step-by-step linear functions). Let Ωr denote the set of all infinite-length walks starting at node r, Ωr := {(vi)∞ i=0 | v0 = r, vi ∈ N , (vi, vi+1) ∈ E}. We refer to a func- tion y : Ωr → R as step-by-step linear if it takes the form: y(ω) = ∞ X i=0 f (vi, i) i Y j=1 g(vj−1, vj, j, j − 1), (9) where f : N × (N ∪ {0}) → R and g : N × N × (N ∪ {0}) × (N ∪ {0}) → R. i=1 is transient repelling. Concretely, the following is true. These functions have the property that the variance of the corresponding Monte Carlo estimator is guaranteed to be suppressed by conditioning that the ensemble of random walks {ω}m Theorem 4.4 (Variance of step-by-step linear functions is reduced by transient repulsion). Consider the estimator Y := Pm i=1 y(ωi) where {ωi}m i=1 enumerates m (infinite) walks on G and y : Ωr → R is a step-by-step linear function. Suppose that the sets of walks {ωi}m i=1 are either i) i.i.d. or ii) transient repelling (Def. 2.2). Provided that the number of walkers is smaller than the minimum node degree, we have that: Var(Yrepelling) ≤ Var(Yi.i.d.). (10) We provide a proof and further discussion in Sec. A.3. Interestingly, the step-by-step linear family also includes φ(i)k, the kth component of the GRF corresponding to the ith node of G, though of course this alone is insufficient to guarantee suppression of variance of the kernel estimator φ(i)⊤φ(j). 5 Application 3: approximating graphlet concentrations Finally, we use repelling random walks to esti- mate the relative frequencies of graphlets: in- duced subgraph patterns within a graph G. For- mally, a k-node induced subgraph Gk = (Vk, Ek) satisfies Vk ⊂ V, |Vk| = k and Ek = {(u, v) : u, v ∈ Vk ∧ (u, v) ∈ E}: that is, a subset of k connnected nodes together with any edges be- tween them. For example, for k = 3 the possible graphlets are a triangle and a wedge (see Fig. 3). Computing a graph's graphlet concentrations – the proportions of different k-node graphlets – is a task of broad interest in biology (Pržulj, 2007; Milenković and Pržulj, 2008) and network science (Becchetti et al., 2008; Ugander et al., 2013) since it characterises the local structure of G (Milo et al., 2002). Such concentrations even permit construction of graphlet kernels K : G × G → R to compare different graphs (Shervashidze et al., 2009). Figure 3: Graphlets for k = 3 triangle wedge For large graphs, exact computation by exhaustive counting is unfeasible because of the combinatorial explosion in the number of graphlets with N . This motivates random walk Markov Chain Monte Carlo approaches. Such crawling-based algorithms also benefit from not requiring access to the entire graph simultaneously: a typical restriction for online social networks where the graph is only available via API calls to retrieve a particular node's neighbours (e.g. user's friends). These algorithms are also easily distributed across machines. Chen et al. (2016) propose a general algorithm for asymptotically unbiased, efficient es- timation of graphlet concentrations using random walks. We summarise one particular instantiation of it for k = 3 below. Algorithm 5.1 (Graphlet concentration estimation using random walks). (Chen et al., 2016) Simulate a simple random walk of length L ∈ N (the sampling budget) out of a randomly selected node. Consider X (3) i = (Xi, Xi+1, Xi+2) with 1 ≤ i ≤ L − 2, the states of an augmented Markov Chain whose state space is the ordered 3-tuples of consecutively- visited nodes. Discard all such states where Xi = Xi+2 (where the walker backtracks), and for 8 Preprint. Under review. Figure 4: Mean square error on estimates of k = 3 graphlet concentrations with different numbers of random walks on different graphs. Lower is better. Using the repelling scheme consistently improves the quality of the estimate compared to independent walks. the remainder classify the graphlets g(3) and Ctri := Pn−2 wedge) di+1 2 In the limit of large L, bc(3) 1th node). concentration of triangle graphlets. I(g(3) i−1 tri i to get the weighted counts Cwed := Pn−2 I(g(3) i = (where di+1 is the degree of the i + gives an unbiased estimator of the i−1 i = triangle) di+1 6 Ctri := Ctri+Cwed The weightings in the computation of C{wed,tri} are included to correct for two sources of bias: di+1 accounts for the fact that the stationary distribution of the expanded Markov chain is inversely proportional to the degree of the middle node, π(X (3) ) = (2|V|di+1)−1, and the combinatorial factors adjust for the fact that 6 states X (3) correspond to the triangle graphlet (twice the number of Hamiltonian paths) but only 2 correspond to the wedge. i i We implement Alg. 5.1 with both i) i.i.d. walkers and ii) a repelling ensemble. A rigorous theoretical analysis of concentration properties is very challenging and is deferred as impor- tant future work; for now, our study is empirical. Fig. 4 plots the fractional error of the estimator of triangle graphlet concentration bc(3) tri against the number of walkers. We use the same graphs as in Sec. 3, but replace the binary tree with polbooks since for the former bctri = 0 trivially. We impose a restricted sampling budget with walks of length L = 16 to highlight the benefits of repelling random walks in the transient regime, and take 2500 repeats over all starting nodes for statistics. Repelling random walks consistently perform better, providing more accurate estimates of the triangle graphlet concentration, and for some graphs the improvement is large. Alg. 5.1 can be generalised to estimate the concen- trations larger graphlets with k > 3; we anticipate that repelling random walks will still prove effective. 6 Conclusion We have presented a new quasi-Monte Carlo scheme called repelling random walks that induces correlations between the directions of random walkers on a graph. Estimators con- structed using this interacting ensemble are guaranteed to remain unbiased but their concen- tration properties are often substantially improved. We test our algorithm on applications as diverse as estimating graph kernels, the PageRank vector and graphlet concentrations. In every case the experimental performance is very strong and often we are able to pro- vide concrete theoretical guarantees. We hope this work will motivate further research on developing quasi-Monte Carlo methods to improve sampling on graphs. 9 51015No. random walks0.0100.0150.0200.0250.0300.035Graphlet conc. est. errorER (N=20, p=0.2)i.i.d.repelling51015No. random walks0.00500.00750.01000.01250.01500.01750.0200Graphlet conc. est. errorER (N=100, p=0.04)51015No. random walks0.00250.00300.00350.00400.0045Graphlet conc. est. errord-regular (N=100, d=10)51015No. random walks0.00450.00500.00550.0060Graphlet conc. est. errorPolbooks (N=105)51015No. random walks0.01000.01250.01500.01750.0200Graphlet conc. est. errorKarate (N=34)51015No. random walks0.0070.0080.0090.0100.0110.012Graphlet conc. est. errorDolphins (N=62)51015No. random walks0.00900.00950.01000.01050.01100.0115Graphlet conc. est. errorFootball (N=115)51015No. random walks0.00170.00180.00190.0020Graphlet conc. est. errorEurosis (N=1272) Preprint. Under review. 7 Ethics and reproducibility Ethics: Our work is foundational with no immediate ethical concerns apparent to us. How- ever, increases in scalability provided by quasi-Monte Carlo algorithms could exacerbate existing and incipient risks of graph-based machine learning, from bad actors or as unin- tended consequences. Reproducibility: Every effort has been made to guarantee the work's reproducibility. The core algorithm is clearly presented in Def. 2.1. Accompanying theoretical results are proved and discussed in the Appendices A.1-A.3, including any assumptions where appropriate. Source code for experiments will be made publicly available if the manuscript is accepted. All datasets used correspond to standard graphs and are freely available online; we give links to suitable repositories in every instance. Results are reported with uncertainties to facilitate comparison. 8 Relative contributions and acknowledgements IR conceived and implemented the repelling random walks mechanism, derived the the- oretical results and prepared the manuscript. KC was crucially involved in the project throughout, acting as the senior research lead. EB proposed the class of step-by-step linear functions and made important theoretical contributions. AW provided helpful discussions and guidance. IR acknowledges support from a Trinity College External Studentship. AW acknowledges support from a Turing AI fellowship under grant EP/V025279/1 and the Leverhulme Trust via CFI. We thank Kenza Tazi and Austin Trip for their careful readings of the manuscript, and Yashar Ahmadian for interesting discussions about the relationship with quantum entangle- ment. Richard Turner provided valuable suggestions and support throughout the project. References Noga Alon, Itai Benjamini, Eyal Lubetzky, and Sasha Sodin. Non-backtracking random walks mix faster. Communications in Contemporary Mathematics, 9(04):585–603, 2007. URL https://doi.org/10.1142/S021919970700255. Luigi Amico, Rosario Fazio, Andreas Osterloh, and Vlatko Vedral. Entanglement in many- body systems. Reviews of modern physics, 80(2):517, 2008. URL https://doi.org/10. 1103/RevModPhys.80.517. Daniel J Amit, Giorgio Parisi, and Luca Peliti. Asymptotic behavior of the" true" self- avoiding walk. Physical Review B, 27(3):1635, 1983. URL https://doi.org/10.1103/ PhysRevB.27.1635. Konstantin Avrachenkov, Nelly Litvak, Danil Nemirovsky, and Natalia Osipova. Monte carlo methods in pagerank computation: When one iteration is sufficient. SIAM Journal on Numerical Analysis, 45(2):890–904, 2007. URL https://dl.acm.org/doi/10.1137/ 050643799. Luca Becchetti, Paolo Boldi, Carlos Castillo, and Aristides Gionis. Efficient semi-streaming algorithms for local triangle counting in massive graphs. In Proceedings of the 14th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 16–24, 2008. URL https://dl.acm.org/doi/10.1145/1401890.1401898. Karsten M Borgwardt, Cheng Soon Ong, Stefan Schönauer, SVN Vishwanathan, Alex J Smola, and Hans-Peter Kriegel. Protein function prediction via graph kernels. Bioinfor- matics, 21(suppl_1):i47–i56, 2005. URL https://doi.org/10.1093/bioinformatics/ bti1007. 10 Preprint. Under review. Jun Chen. Two particles' repelling random walks on the complete graph. Electronic Journal of Probability, 19(none):1 – 17, 2014. doi: 10.1214/EJP.v19-2669. URL https://doi. org/10.1214/EJP.v19-2669. Xiaowei Chen, Yongkun Li, Pinghui Wang, and John Lui. A general framework for esti- mating graphlet statistics via random walk. arXiv preprint arXiv:1603.07504, 2016. URL https://doi.org/10.48550/arXiv.1603.07504. Krzysztof Choromanski, Mark Rowland, Vikas Sindhwani, Richard Turner, and Adrian Weller. Structured evolution with compact architectures for scalable policy optimization. In International Conference on Machine Learning, pages 970–978. PMLR, 2018. URL https://doi.org/10.48550/arXiv.1603.07504. Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794, 2020. URL https://doi.org/10.48550/arXiv.2009.14794. Krzysztof M Choromanski, Mark Rowland, and Adrian Weller. The unreasonable effec- tiveness of structured random orthogonal embeddings. Advances in neural information processing systems, 30, 2017. URL https://doi.org/10.48550/arXiv.1703.00864. Krzysztof Marcin Choromanski. Taming graph kernels with random features. In In- ternational Conference on Machine Learning, pages 5964–5977. PMLR, 2023. URL https://doi.org/10.48550/arXiv.2305.00156. Fan R. K. Chung and Shing-Tung Yau. Coverings, heat kernels and spanning trees. Electron. J. Comb., 6, 1999. doi: 10.37236/1444. URL https://doi.org/10.37236/1444. Fan RK Chung. Spectral graph theory, volume 92. American Mathematical Soc., 1997. Keenan Crane, Clarisse Weischedel, and Max Wardetzky. The heat method for distance computation. Communications of the ACM, 60(11):90–99, 2017. URL https://dl.acm. org/doi/10.1145/3131280. Michael Dawson-Haggerty. Trimesh repository, 2023. URL https://github.com/mikedh/ trimesh. Inderjit S Dhillon, Yuqiang Guan, and Brian Kulis. Kernel k-means: spectral clustering and normalized cuts. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, pages 551–556, 2004. URL https://dl.acm. org/doi/10.1145/1014052.1014118. Persi Diaconis, Susan Holmes, and Radford M Neal. Analysis of a nonreversible markov chain sampler. Annals of Applied Probability, pages 726–752, 2000. URL https://doi. org/10.1214/aoap/1019487508. Josef Dick, Frances Y Kuo, and Ian H Sloan. High-dimensional integration: the quasi- monte carlo way. Acta Numerica, 22:133–288, 2013. URL https://doi.org/10.1017/ S0962492913000044. Vishwaraj Doshi, Jie Hu, and Do Young Eun. Self-repellent random walks on general graphs–achieving minimal sampling variance via nonlinear markov chains. arXiv preprint arXiv:2305.05097, 2023. URL https://doi.org/10.48550/arXiv.2305.05097. Dániel Fogaras, Balázs Rácz, Károly Csalogány, and Tamás Sarlós. Towards scaling fully personalized pagerank: Algorithms, lower bounds, and experiments. Internet Mathemat- ics, 2(3):333–358, 2005. URL https://doi.org/10.1007/978-3-540-30216-2_9. Vladimir Ivashkin. Community graphs repository, 2023. URL https://github.com/ vlivashkin/community-graphs. 11 Preprint. Under review. Kyle Kloster and David F Gleich. Heat kernel based community detection. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 1386–1395, 2014. URL https://doi.org/10.48550/arXiv.1403.3148. Chul-Ho Lee, Xin Xu, and Do Young Eun. Beyond random walk and metropolis-hastings samplers: why you should not backtrack for unbiased graph sampling. ACM SIGMET- RICS Performance evaluation review, 40(1):319–330, 2012. URL https://dl.acm.org/ doi/10.1145/2318857.2254795. Tijana Milenković and Nataša Pržulj. Uncovering biological network function via graphlet degree signatures. Cancer informatics, 6:CIN–S680, 2008. URL https://doi.org/10. 48550/arXiv.0802.0556. Ron Milo, Shai Shen-Orr, Shalev Itzkovitz, Nadav Kashtan, Dmitri Chklovskii, and Uri Alon. Network motifs: simple building blocks of complex networks. Science, 298(5594): 824–827, 2002. URL https://www.science.org/doi/10.1126/science.298.5594.824. Lawrence Page, Sergey Brin, Rajeev Motwani, and Terry Winograd. The pagerank cita- tion ranking: Bring order to the web. Technical report, Technical report, stanford Uni- versity, 1998. URL https://www.cis.upenn.edu/~mkearns/teaching/NetworkedLife/ pagerank.pdf. Robin Pemantle. A survey of random processes with reinforcement. Probability Surveys, 4 (none):1 – 79, 2007. doi: 10.1214/07-PS094. URL https://doi.org/10.1214/07-PS094. Nataša Pržulj. Biological network comparison using graphlet degree distribution. Bioin- formatics, 23(2):e177–e183, 2007. URL https://doi.org/10.1093/bioinformatics/ btl301. Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. Advances in neural information processing systems, 20, 2007. URL https://dl.acm.org/doi/10. 5555/2981562.2981710. Isaac Reid, Krzysztof Choromanski, and Adrian Weller. Quasi-monte carlo graph random features. arXiv preprint arXiv:2305.12470, 2023a. URL https://doi.org/10.48550/ arXiv.2305.12470. Isaac Reid, Krzysztof Marcin Choromanski, Valerii Likhosherstov, and Adrian Weller. Sim- plex random features. In International Conference on Machine Learning, pages 28864– 28888. PMLR, 2023b. URL https://doi.org/10.48550/arXiv.2301.13856. Rafael A Rosales, Fernando PA Prado, and Benito Pires. Vertex reinforced random walks with exponential interaction on complete graphs. Stochastic Processes and their Applica- tions, 148:353–379, 2022. URL https://doi.org/10.1016/j.spa.2022.03.007. Mark Rowland, Krzysztof M Choromanski, François Chalus, Aldo Pacchiano, Tamas Sarlos, Richard E Turner, and Adrian Weller. Geometrically coupled monte carlo sampling. Advances in Neural Information Processing Systems, 31, 2018. URL https://dl.acm. org/doi/pdf/10.5555/3326943.3326962. Mark Rowland, Jiri Hron, Yunhao Tang, Krzysztof Choromanski, Tamas Sarlos, and Adrian Weller. Orthogonal estimation of wasserstein distances. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 186–195. PMLR, 2019. URL https://doi.org/10.48550/arXiv.1903.03784. Nino Shervashidze, SVN Vishwanathan, Tobias Petri, Kurt Mehlhorn, and Karsten Borg- wardt. Efficient graphlet kernels for large graph comparison. In Artificial intelligence and statistics, pages 488–495. PMLR, 2009. URL https://api.semanticscholar.org/ CorpusID:17557614. Alexander J Smola and Risi Kondor. Kernels and regularization on graphs. In Learning The- ory and Kernel Machines: 16th Annual Conference on Learning Theory and 7th Kernel Workshop, COLT/Kernel 2003, Washington, DC, USA, August 24-27, 2003. Proceed- ings, pages 144–158. Springer, 2003. URL https://people.cs.uchicago.edu/~risi/ papers/SmolaKondor.pdf. 12 Preprint. Under review. Pierre Tarrès. Vertex-reinforced random walk on z eventually gets stuck on five points. The Annals of Probability, 32(3):2650–2701, 2004. ISSN 00911798. URL http://www.jstor. org/stable/3481644. Bálint Tóth. The" true" self-avoiding walk with bond repulsion on z: Limit theorems. The Annals of Probability, pages 1523–1556, 1995. URL https://doi.org/10.1214/aop/ 1176987793. Johan Ugander, Lars Backstrom, and Jon Kleinberg. Subgraph frequencies: Mapping the empirical and extremal geography of large graph collections. In Proceedings of the 22nd international conference on World Wide Web, pages 1307–1318, 2013. URL https:// doi.org/10.48550/arXiv.1304.1548. Feng Xia, Jiaying Liu, Hansong Nie, Yonghao Fu, Liangtian Wan, and Xiangjie Kong. Random walks: A review of algorithms and applications. IEEE Transactions on Emerging Topics in Computational Intelligence, 4(2):95–107, 2019. URL https://doi.org/10. 1109/TETCI.2019.2952908. Felix Xinnan X Yu, Ananda Theertha Suresh, Krzysztof M Choromanski, Daniel N Holtmann-Rice, and Sanjiv Kumar. Orthogonal random features. Advances in neural in- formation processing systems, 29, 2016. URL https://doi.org/10.48550/arXiv.1610. 09072. Yufan Zhou, Changyou Chen, and Jinhui Xu. Learning manifold implicitly via explicit heat- kernel learning. Advances in Neural Information Processing Systems, 33:477–487, 2020. URL https://doi.org/10.48550/arXiv.2010.01761. Zhuojie Zhou, Nan Zhang, and Gautam Das. Leveraging history for faster sampling of online social networks. arXiv preprint arXiv:1505.00079, 2015. URL https://doi.org/ 10.48550/arXiv.1505.00079. 13 Preprint. Under review. A Appendices A.1 Proof of Theorem 3.1 (superiority of repelling random walks for kernel estimation In this appendix, we prove Theorem 3.1: namely, that using transient repelling random walks reduces the mean square error of graph random feature (GRF) estimates of the 2- regularised Laplacian kernel, defined by: h bK(2) lap i ij (cid:16) := I − eL (cid:17)−2 ij = (1 + σ2)−2 (cid:18) I − σ2 1 + σ2 W (cid:19)−2 (11) where eL is the Laplacian, σ is a regulariser and W is a normalised weighted adjacency matrix with elements W = (cid:2)aij/( ̃di i,j=1 (with ̃di = P j aij the degree of the ith node and aij the weight of the edge before normalisation). Ignoring the overall normalisation constant and absorbing the factor of σ2/(1 + σ2) into W, wlg we will now consider estimation of ̃dj)1/2(cid:3)N bKij = (I − W)−2 (12) where W = [wij]N i,j=1. Directly from the definition of the GRF vector (see e.g. (Choromanski, 2023) or (Reid et al., 2023a)), we have that bKij = φ(i)⊤φ(j) = 1 m2 X X X x∈N ωix∈Ωix ωjx∈Ωjx eω(ωix) p(ωix) eω(ωjx) p(ωjx) N (ωix)N (ωjx) (13) where N (ωix) := m X I (cid:0)ωix ∈ ̄Ωl (cid:1) . (14) l=1 Here: m ∈ N is the number of random walkers simulated out of each node; Ωix is the set of all walks on the graph between the nodes indexed i and x; ωix is a member of this set; eω(ω) is a function that returns the product of weights of edges traversed by a graph random walk ω; and p(ω) is a function that returns the marginal probability of a random walk (equal to ((1 − p)/d)len(ω) – with 0 < p < 1 a finite termination probability, d the node degree and len(ω) the walk length – in the case of a d-regular graph). ̄Ωl denotes the lth walk out of node i such that N (ωix) counts the empirical number of walkers completing a particular subwalk ωix, a discrete random variable between 0 and m. Since E(N (ωix)) = mp(ωix), it is straightforward to see that E(φ(i)⊤φ(j)) = X X X eω(ωix)eω(ωjx) x∈N ωix∈Ωix ωjx∈Ωjx X = ωij ∈Ωij (len(ωij) + 1)eω(ωij) = (I − W)−2 (15) which confirms that the estimator is unbiased. Our task is now to determine how the variance of bKij depends on whether the ensemble of m walkers from each node is i) independent or ii) repelling. We will see that, under some conditions, it is guaranteed to be smaller in the latter case. The following is true: (cid:16) E bK2 ij (cid:17) = 1 m4 X   X x,y∈N ωix,ωiy eω(ωix) p(ωix) eω(ωiy) p(ωiy) E(N (ωix)N (ωiy))    (16)  *  X ωjx,ωjy eω(ωjx) p(ωjx) eω(ωjy) p(ωjy) 14 E(N (ωjx)N (ωjy))  . Preprint. Under review. This makes clear that the object of central importance will be where x, y ∈ N . We will now consider how this depends on i) the pair of subwalks (ωix, ωiy) and ii) the presence or absence of repulsion. E (N (ωix)N (ωiy)) (17) To avoid notational clutter, we will write expressions as if the graph is d-regular with the understanding that it is trivial to relax this without changing any conclusions, making the replacement: dlen(ωix) → Qlen(ωix)−1 di. i=0 i.i.d. walkers: Begin with the simpler i.i.d. case. First consider the case that ωix ̸= ωiy, ωix /∈ ωiy and ωiy /∈ ωix: namely, that the walks are distinct and neither is a (strict) subwalk of the other. It follows that a single walker cannot take both subwalks simultaneously. We also assume that both walks are of length len(ωi(x,y)) ≥ 1. Then we have that " m X m X # E [N (ωix)N (ωiy)] = E I(ωix ∈ Ωl2 )I(ωix ∈ Ωl2 )) l1=1 l2=1 = m(m − 1) (cid:18) 1 − p d (cid:19)len(ωix)+len(ωiy) . (18) What about if ωix ∈ ωiy? It is straightforward to convince oneself that E [N (ωix)N (ωiy)] = m(m − 1) (cid:19)len(ωix)+len(ωiy) (cid:18) 1 − p d + m (cid:18) 1 − p d (cid:19)len(ωiy) (19) where the extra second correlation term comes from a single walker completing both sub- walks. Lastly, suppose that len(ωix) = 0 (i.e. one of the subwalks has zero length). Then we have that E [N (ωix)N (ωiy)] = m2 . (20) (cid:19)len(ωiy) (cid:18) 1 − p d Now we move onto the repelling case, which is substantially more difficult. Repelling walkers: For tractability, we will consider the transient repulsion scheme de- scribed in Def. 2.2. Suppose that we have N ′ α walkers at some node indexed α ̸= i, with the set of neighbouring nodes including nodes labelled β and γ (i.e. β, γ ∈ N (α)). An important quantity is From Def. 2.1, we have that E(NβNγ|N ′ α). Nβ = Nα//d + ε1, Nγ = Nα//d + ε2, (21) (22) where // denotes truncating integer division ε1,2 are anticorrelated binary random vari- ables. The reason they are anticorrelated is that a walker that transitions to β cannot also transition to γ. With a little work, one can convince oneself that E(NβNγ|N ′ α) = (cid:19)2 (cid:18) N ′ α d + R d (cid:18) R − 1 d − 1 − (cid:19) , R d (23) α%d, the remainder after the the walkers have been partitioned into blocks of α: in where R := N ′ size d. From this form, we can see that we will be concerned with the statistics of N ′ particular how E(Nα Let Nα be a random variable denoting the number of walkers at node α of some particular walk on the graph. Then let N ′ α denote the number of walkers surviving the 'p-step', where each walker terminates independently with probability p. Let Nβ denote the number of walkers that subsequently hop to node β on the walk. It is clear that Nβ = N//d + ε, with ε ′2) behaves. Understanding this is our next task. 15 Preprint. Under review. a random variable that takes a value of 1 with probability R It is simple to show that d and 0 with probability 1 − R d . E(N 2 β ) = E(N ′ α 2) d2 + E 2) = E(Nα (cid:18) R d (1 − (cid:19) ) . R d (24) 2)(1 − p)2 + E(Nα)p(1 − p) (law of iterated It is also trivially the case that E(N ′ α expectations). The second term in Eq. 24 is generically difficult to describe analytically, but it is simple in the special case that N ′ α. In particular, here we have that (cid:19)len(ωiα) α < d so R = N ′ E(N 2 α) = E(Nα) = m (cid:18) 1 − p d (25) whereupon, referring back to Eq. 23, E(NβNγ|N ′ α) = 0. (26) It is trivial to see why this must be the case: supposing we begin with fewer than d walkers at node i, in the transient repelling scheme they all diverge at the first timestep. Any subsequent node α on some walk is occupied by at most 1 walker which chooses one of its dα neighbours at random, so value of NβNγ (product of occupations of its child nodes) always vanishes. It is encouraging that our algebraic approach reproduces this intuitive result. It follows immediately that, for walks diverging at some node not equal to the starting node i, E [N (ωix)N (ωiy)] = 0. What about if the walkers instead diverge at i? Here the result is different because E(Ni) = m, the initial number of particles, and Var(m) = 0 since the total number of walkers is a fixed hyperparameter. After just a little work, E(NβN γ) = (1 − p)2 d(d − 1) m(m − 1) (27) and therefore E [N (ωix)N (ωiy)] = d d − 1 m(m − 1) (cid:18) 1 − p d (cid:19)len(ωix)+len(ωiy) . (28) This is also intuitive: the repelling scheme shifts probability mass onto walks that diverge at i, enhancing this correlation term. The subwalk case is also straightforward. Supposing ωix ∈ ωiy, we can use Eq. 25 to show that E [N (ωix)N (ωiy)] = m (cid:19)len(ωiy) (cid:18) 1 − p m (29) because if the walkers immediately diverge then we can only sample both ωiy and ωix ∈ ωiy if a single walk traverses both. Lastly, if len(ωix) = 0, we still have that E [N (ωix)N (ωiy)] = m2 (cid:19)len(ωiy) (cid:18) 1 − p d (30) which is natural because if one (or both) of the walks is of zero length then the repulsion scheme cannot modify the correlation term. We summarise these observations in Table 3, denoting c := 1−p d len(ωix) for compactness. and ωix as shorthand for Table 3 Class E(N (ωix)N (ωiy)) i.i.d. transient repelling Same walk, ωix = ωiy Subwalk, ωix ∈ ωiy Different walks, diverge at i Different walks, diverge at d ̸= i len(ωix) = 0 mcωix + m(m − 1)c2ωix mcωiy + m(m − 1)cωix+ωiy m(m − 1)cωix+ωiy m(m − 1)cωix+ωiy m2cωiy d mcωix mcωiy d−1 m(m − 1)cωix+ωiy 0 m2cωiy 16 Preprint. Under review. More explicitly, we can write E(N (ωix)N (ωiy)) =    m(m − 1)cωix+ωiy I(both > 0) +mcωlongerI(subwalks, both > 0) +m2cωlonger I(len 0) if i.i.d. di di − 1 m(m − 1)cωix+ωiy I(both > 0, div at i) +mcωlonger I(subwalks, both > 0) +m2cωlonger I(len 0) if repelling (31) where only the first term differs. Here, I(both > 0) means both walks traverse at least one edge, I(len 0) means one of the walks is of length 0, I(subwalks) means ωix ∈ ωiy (or vice versa), and ωlonger denotes the length of the longer walk. We will now insert these expressions into Eq. 16 to compute the difference in variance of bKij with the two possible coupling schemes. After tedious but straightforward algebra, we arrive at the following closed form: Var (cid:16)h bKij i (cid:17) i.i.d. (cid:18)h − Var (m − 1)2 m2 (cid:20) W2 (1 − W)2 ij (cid:19) = i repelling !2 bKij (cid:21) − didj (di − 1)(dj − 1) (m − 1)2 m2 X X wii′ wjj′ wii′′ wjj′′ i′ ∈N (i) i′′∈N (i)\i′ j′ ∈N (j) j′′ ∈N (j)\j′ (cid:20) 1 (1 − W)2 (cid:21) (cid:20) i′j′ 1 (1 − W)2 (cid:21) i′′j′′ + di di − 1 m − 1 m2 + dj dj − 1 m − 1 m2 X X x X ωix>0 X x ωjx>0 eω(ωix)2 p(ωix) eω(ωjx)2 p(ωjx) [B(x, j) − C(x, j)] [B(x, i) − C(x, i)] + m − 1 m (cid:20) di di − 1 (B(i, j) − C(i, j)) + dj dj − 1 (B(j, i) − C(j, i))    (cid:21) (b) where and B(x, i) := X i′∈N (i) (cid:20) w2 ii′ 1 (1 − W)2 (cid:21)2 xi′ − 1 di C(x, i) := X i′∈N (i) w2 ii′ (cid:20) W (1 − W)2 (cid:21)2 xi′ − 1 di     X wii′ i′∈N (i) (cid:20) 1 (1 − W)2 (cid:21) xi′  2  X wii′ i′∈N (i) (cid:20) W (1 − W)2 (cid:21) xi′  2  .    (a) (32) (33) (34) Note that both B and C are always positive by Jensen's inequality. It is remarkable that such a simple expression exists for the difference in kernel estimator variance between the i.i.d. and transient repelling schemes. Showing the class of graphs for which this is guaranteed to be positive is a challenging open problem, but we are able to make progress in some tractable special cases. For instance, consider the limit w → 0 with all the graph weights equal, W = wA. In this case, when computing matrix elements we can just retain terms corresponding to the shortest path. For example, (cid:20) 1 (1 − wA)2 (cid:21) ij = (cid:2)1 + 2wA + 3w2A2 + ...(cid:3) ij = M (lij)(lij + 1)wlij + O(wlij +1) (35) 17 Preprint. Under review. where lij denotes the length of the shortest path between nodes i and j and M (lij) denotes its multiplicity: the number of such unique paths that exist in G. To give examples, for a tree M (lij) = 1 and for a square grid M (lij) = (cid:0)a+b (cid:1), where a is the difference in x-coordinates of nodes i and j and b is the difference in y coordinates. a When will (a) be positive? Provided that nodes i and j are separated by at least 2 edges, the following is true: (m − 1)2 m2 (cid:20) w2A2 !2 (cid:21) (1 − wA)2 ij = (m − 1)2 m2 M (lij)2(lij − 1)2w2lij + O(w2lij +1), (36) and didj (di − 1)(dj − 1) (m − 1)2 m2 w4 X (cid:20) X i′∈N (i) i′′∈N (i)\i′ j′∈N (j) j′′N (j)\j′ 1 (1 − wA)2 (cid:21) (cid:20) i′j′ 1 (1 − wA)2 (cid:21) i′′j′′ = didj (di − 1)(dj − 1) (m − 1)2 m2 X X M (li′j′ )M (li′′j′′ )wli′ j′ +li′′ j′′ +4(li′j′ + 1)(li′′j′′ + 1) i′ ∈N (i) i′′∈N (i)\i′ j′ ∈N (j) j′′N (j)\j′ + O(wli′ j′ +li′′j′′ +5). (37) Note that, since i′ ∈ N (i) and j′ ∈ N (j), it is trivially the case that lij − 2 ≤ li′j′ ≤ lij + 2. In Eq. 37, only terms where li′j′ = li′′j′′ = lij − 2 will give contributions of the same order as the leading term O(w2lij ) in Eq. 36. The condition that Eq. 36 is greater at the leading order is then: M (lij)2 ≥ didj (di − 1)(dj − 1) X M (li′j′)M (li′′j′′ ) (38) i′ ∈N (i),i′′ ∈N (i)\i′ ,j′ ∈N (j),j′′ ∈N (j)\j′ l i′ j′ =l i′′j′′ =lij −2 where we remind the reader that M (lij) denotes the degeneracy (number) of shortest paths (of length lij) between nodes i and j. This encodes the topological constraint that is sufficient for variance reduction with repelling random walkers on an equal-weights graph as w → 0. Heuristically, the set of nodes N (i) cannot be too connected to the nodes N (j). A cursory numerical check suggests that Eq. 38 is not generically satisfied for every pair of nodes (i, j) on arbitrary graphs, but it does seem to very often be true. We can, however, identify some particular examples where it is guaranteed to hold. For example, it is trivially true for trees for which M (lij) = 1 but the RHS is 0. To wit: for trees there is a unique shortest path between nodes i and j and it is only the case that li′j′ = lij − 2 if both i′ and j′ lie on this path. Then conditioning that i′′ ̸= i′ and j′′ ̸= j′ means that we cannot fulfil li′′j′′ = lij − 2, whereupon the sum is over the empty set so evaluates to 0. It is also true for the two dimensional square grid. Without loss of generality, locate node i at coordinates (0, 0) and node j at (a, b). If a = 0 or b = 0 there is a unique shortest path so the inequality follows trivially. If a = 1 then M (lij) = b + 1 whereas the RHS evaluates to 2 (d/(d − 1))2 (cid:1) (a walker on which is smaller for b ≥ 1 and d = 4. Finally, if a, b > 1, then M (lij) = (cid:0)a+b a shortest path between nodes i and j must take a steps in one direction and b steps in the other, but we are free to permute their order). Meanwhile, the sum on the RHS of Eq. 38 evaluates to: a (cid:18) d (cid:19)2 d − 1 * 2 * (cid:18)a + b − 2 a − 2 (cid:19)(cid:18)a + b − 2 (cid:19) b − 2 (cid:19)2! + (cid:18)a + b − 2 a − 1 whereupon the ratio RHS/LHS is: (cid:18) d (cid:19)2 d − 1 * 2 * a(a − 1)b(b − 1) + a2b2 [(a + b)(a + b − 1)]2 (cid:20) (cid:19)2 = (cid:18) d d − 1 * 2ab (a + b)2 a(a − 1) + b(b − 1) (a − 1)(b − 1) + ab (cid:21)−1 ? ≤ 1 1 + 18 (39) (40) Preprint. Under review. The expression in square brackets is greater than 1 so its inverse is smaller than 1. Hence, it is sufficient that (a + b)2 2ab = (a − b)2 2ab + 2 ≥ (cid:18) d (cid:19)2 d − 1 (41) which is trivially always true for d = 4. The inequality in Eq. 38 then holds in all cases where nodes i and j are separated by at least 2 edges, so terms (a) will indeed be positive on a two-dimensional square grid. Having asserted that the terms labelled (a) in Eq. 32 will sum to a positive value under certain conditions (namely: graphs characterised by Eq. 38 with equal edge weights w → 0, considering nodes i and j separated by at least 2 edges), we now proceed to consider the terms labelled (b). When will (b) be positive? Now we consider the remaining terms involving e.g. B(x, i)− C(x, i) where x, i ∈ N . These demand a little more care because the sum over x ∈ N means that we need to account for terms where x = i even when considering off-diagonal terms of the kernel estimate i ̸= j. Note that (cid:2)(1 − wA)−2(cid:3) B(x, i) = dVari′∈N (i) (42) the empirical variance of the matrix elements Kxi′ among the set of vertices i′ that neighbour i. Denote by ̃lxi the smallest walk length for which the variance of the number of walks from x to the set of nodes N (i) is nonzero, xi′ , ̃lxi = min l∈N (cid:0){l | Vari′∈N (i)(Al This might well correspond to the shortest path between x and i′ ∈ N (i), but this is not necessarily the case (i.e. if all the neighbours i′ have an equal number of equally short paths to x so the variance on this quantity vanishes). Then we have that h A (cid:2)(1 − wA)−2(cid:3) xi′) ̸= 0}(cid:1) . + O(w2 ̃lxi+1) xi′ = d( ̃lxi + 1)2w2 ̃lxi Vari′∈N (i) B(x, i) = dVari′∈N (i) (43) (44) ̃lxi xi′ i and C(x, i) = dVari′∈N (i) where Vari′∈N (i) ̃lxi = lxi − 1 and Vari′∈N (i) h A ̃lxi xi′ (cid:2)wA(1 − wA)−2(cid:3) i i h A ̃lxi xi′ = d−1 d2 . xi′ = d( ̃lxi)2w2 ̃lxi Vari′∈N (i) i h A ̃lxi xi′ + O(w2 ̃lxi+1) (45) denotes this first nonvanishing variance. For trees with x ̸= i, To leading order in w, it is trivial to see that B(x, i) > C(x, i). Inserting back into Eq. 32 and noting the positivity of the prefactor ̃ω(ωix)2 p(ωix) , the positivity of (2) follows. Note that in this section we have not assumed anything about the structure of G beyond equal weights and w → 0. The topological constraints originate solely from the terms in (a). Combining the above arguments, we conclude that the using the transient repelling scheme is indeed guaranteed to suppress the variance of kernel estimators bKij for nodes i and j separated by at least 2 edges under certain conditions: namely, that we have an equally- weighted graph with w → 0, and that the topological condition in Eq. 38 is true (which is the case for e.g. trees and two-dimensional grids). We stress that, in practice, the scheme performs very well even for much more general classes of graphs and in the non-asymptotic w limit. We defer extending the proof above to include these cases as future work. A.2 Proof of Theorem 4.2 (superiority of repelling random walks for PageRank estimation In this appendix, we show how random walks can be used to estimate to the PageRank vector and prove that using a transient repelling ensemble reduces the estimator mean square error (Theorem 4.2). 19 Preprint. Under review. Our intention is to estimate the vector π, defined as the stationary distribution of the transition matrix eP defined in Eq. 6 and reproduced below: eP := (1 − p)P + p N E. (46) The reader should refer back to Eq. 6 for all symbol definitions. We then require that π⊤ eP = π⊤, π⊤1 = 1. Rearranging and Taylor expanding (1 − (1 − p)P)−1, it is straightforward to convince oneself that the solution is given by (47) πi = p N X ∞ X j∈N k=0 (1 − p)kPk ji. (48) This is nothing other than a sum over all walks ωji from each of the graph nodes j to node i, each weighted by a factor of (cid:0) 1−p p (with dk generalising to the product of node degrees along ωji if the graph is not d-regular) and normalised by the number of vertices N . Equivalently, supposing we simulate a random walk out of a random node on the graph j, it is the probability that it terminates at node i. This invites the algorithm proposed by Fogaras et al. (2005) and shown in Alg. 4.1. We construct the unbiased estimator (cid:1)k d bπi = 1 N m X m X j∈N l=1 I[Ω(j) l terminates at node i] (49) where Ω(j) l denotes the lth walk (out of a total of m ∈ N) simulated from node j. Our task is now to consider the variance properties of the estimator bπ when ensembles of walkers out of each node are either i) independent or ii) repelling according to our QMC scheme defined in Def. 2.1. Evidently, E(bπ2 i ) = X 1 N 2m2 j1,j2∈N m X E n I[Ω(j1) l1 l1,l2=1 terminates at node i ] I[Ω(j2) l2 terminates at node i ] o . (50) Only walkers out of the same node are correlated so it is sufficient to consider the behaviour of terms j1 = j2. In particular, we we need to determine whether the value of E n I[Ω(j) l1 terminates at node i ] I[Ω(j) l2 terminates at node i ] o (51) is suppressed with repelling random walks for fixed arbitrary j ∈ N . We will refer to this as the correlation term. First consider the special case j ̸= i so all walks are of length at least 1. We also consider transient repulsion (see Def. 2.2) so that walkers only repel until they diverge, and assume that the number of walkers is smaller than or equal to the minimum node degree of the graph, m ≤ mini∈N (di). For i.i.d. walkers, the correlation term in Eq. 51 evaluates to (cid:21) (cid:19)2 (cid:21)2 (cid:20) (cid:20) (cid:21) (cid:20) p2 (1 − p)2 P 1 − (1 − p)P = p2 (cid:18) 1 − p dj X X 1 1 − (1 − p)P 1 1 − (1 − p)P ij j′′i (52) Meanwhile, repelling walkers cannot initially take the same edge (under the assumption that the number of coupled walkers is smaller than the minimum node degree), so the equivalent term evaluates to j′′∈N (j) j′∈N (j) j′i p2 (cid:18) 1 − p dj (cid:19)2 (cid:18) dj (cid:19) X X dj − 1 j′∈N (j) j′′∈N (j)\j′ (cid:20) 1 1 − (1 − p)P (cid:21) (cid:20) j′i 1 1 − (1 − p)P (cid:21) j′′i . (53) This differs from Eq. 52 in that i) the variable j′′ in the sum over the neighbours of j can dj no longer be equal to j′ since the walks repel, and ii) there is an extra factor of dj −1 to 20 Preprint. Under review. account for the increase the conditional probability of choosing j′′ given that j′ becomes excluded when the first walker picks it ('without replacement'). Denote the matrix element f (j′, i) := in Eqs 52 and 53 is equal to h 1 1−(1−p)P i j′i . Then the difference between the terms (cid:19)2 p2 (cid:18) 1 − p dj X X j′∼j j′′∼j f (j′, i)f (j′′, i) (cid:20) 1 − dj dj − 1 I(do not share first edge) (cid:21) . (54) This can be rewritten (cid:19)2 p2 (cid:18) 1 − p dj dj dj − 1 = p2 (1 − p)2 X X f (j′, i)f (j′′, i) (cid:20) I(share first edge) − j′∼j j′′∼j    1 dj − 1 1 dj X j′∼j f (j′, i)2 −   1 dj X j′∼j  f (j′, i)  1 dj 2   (cid:21) ≥ 0 (55) where we used Jensen's inequality. To complete the proof, we consider the subcase i = j. For i.i.d. walkers, the correlation term evaluates to (cid:20) p2 1 1 − (1 − p)P (cid:21)2 ii (cid:20) 1 + = p2 = p2 1 + 2(1 − p) (cid:20) (1 − p)P 1 − (1 − p)P (cid:21) (cid:21)2 ii P 1 − (1 − p)P ii + (1 − p)2 (cid:20) P 1 − (1 − p)P ! (cid:21)2 ii (56) For repelling walkers, we need to consider contributions from i) both walkers terminating immediately, ii) one terminating and one leaving then returning to i, and iii) both walkers leaving (to different neighbours (i′ ̸= i′′) then returning to i. Enumerating these possibilities, we get: (cid:18) p2 1 + 2(1 − p) (cid:20) P 1 − (1 − p)P (cid:21) + ii (cid:19)2 (cid:18) 1 − p di di di − 1 X X i′∈N (i) i′′∈N (i)\i′ (cid:20) 1 1 − (1 − p)P (cid:21) (cid:20) i′i 1 1 − (1 − p)P (57)   . (cid:21) i′′i Only the final term differs compared to Eq. 56. It is of precisely the same form as considered above with i = j, so we immediately deduce that it is smaller with repelling walkers. It follows that when i = j repelling random walkers also yield lower variance estimators bπj. Having considered both i ̸= j and i = j and proved that the variance of the estimator bπ is reduced in both cases, the proof is complete. A.3 Proof of Theorem 4.4 (variance of step-by-step linear functions is reduced by transient repulsion) In this section, we supplement the discussion at the end of 4, identifying a general class of functions whose variance is suppressed by conditioning that random walks exhibit transient repulsion. Following Def. 4.3, let Ωr denote the set of all infinite-length walks starting at node r, i=0 | v0 = r, vi ∈ N , (vi, vi+1) ∈ E}. Recall that we refer to a function y : Ωr → R Ωr := {(vi)∞ as step-by-step linear if it takes the form: y(ω) = ∞ X i=0 f (vi, i) i Y j=1 21 g(vj−1, vj, j, j − 1). (58) Preprint. Under review. An example of such a function provided by φ(i)k, the k-th component of the graph random feature corresponding to node i, for which f (vi, i) = I(vi = k) and g(vj−1, vj, j, j − 1) = wvj−1,vj dvj−1 I(tj > p). Here, wvj−1,vj is the weight of the edge (vj−1, vj) ∈ E, dvj−1 is 1−p the degree of the node vj−1 and tj ∼ Unif(0, 1) is a termination random variable which controls whether the walk ends at the jth timestep. Another example is provided by the kth component of the PageRank vector estimator bπk, in which case f (vi, i) = I(vi = k)I(tj > p) and g(vj−1, vj, j, j − 1) = I(tj−1 < p), ensuring that y(w) evaluates to 1 if the walker terminates at node k and is zero otherwise. In Theorem 4.4, we asserted that, for the estimator Y := Pm merates m (infinite) walks on G and y : Ωr → R is a step-by-step linear function), i=1 y(ωi) (where {ωi}m i=1 enu- Var(Yrepelling) ≤ Var(Yi.i.d.). provided that the number of walkers is smaller than the minimum node degree. This is proved as follows. (59) First note that under both the i.i.d. and (transient) repelling schemes the marginal prob- ability of each walk p(ω) is identical. This means that to prove variance reduction is if sufficient to consider whether h i ? Ei.i.d. y(ω(1))y(ω(2)) ≥ Erep i h y(ω(1))y(ω(2)) (60) where (ω(1), ω(2)) is a pair of walks sampled from either the i.i.d. or repelling scheme. Begin by writing y(ω(k)) = f (v0, 0) + ∞ X i=1 f (v(k) i , i) i Y j=1 g(v(k) j−1, v(k) j , j, j − 1) = f (v0, 0) + h (cid:16) (v(k) i )∞ i=1 (cid:17) (61) 0 = v(2) with k = {1, 2}. Note that we took v(1) 0 = v0 since the walkers begin at the same It follows from the definition node, and introduced the function h to simplify notation. of transient repulsion that the random variables h((v(k) )∞ i=1) are conditionally independent given (v(1) 1 ) since at this point the walkers have diverged and stop repelling. Moreover, since in both cases the marginal distribution over ω is identical, for Var(Y ) to be reduced by repulsion we just require that 1 , v(2) i Ei.i.d. (cid:16) h h (v(1) i )∞ i=1 (cid:16) (cid:17) h (v(2) i )∞ i=1 (cid:17)i ? ≥ Erep (cid:16) h h (v(1) i )∞ i=1 (cid:17) (cid:16) h (v(2) i )∞ i=1 (cid:17)i . (62) 1 1 and v(2) 1 , v(2) In the i.i.d. scheme, v(1) are independent and are uniformly distributed among the set of neighbours N (v0), each with probability 1/d0. Meanwhile, in the repelling scheme, (v(1) 1 ) is uniformly distributed among the set {(vi, vj)|vi, vj ∈ N (v0), vi ̸= vj} – i.e. all d0(d0 − 1) possible pairs of distinct neighbours of node v0. Then Eq. 62 evaluates to 1 d0(d0 − 1) 1 )E(h|v(2) 1 ) 1 )E(h|v(2) E(h|v(1) E(h|v(1) 1 ) − ? ≥ 0 (63) X X 1 d2 0 v v (1) 1 (2) 1 ∈N (v0) ∈N (v0) v ∈N (v0) (1) 1 ∈N (v0)\v v (2) 1 (1) 1 where we used that h(1,2) are conditionally independent given v(1,2) expression is nothing other than 1 . Rearranging, this 1 d0 − 1 Varv1∈N (v0)(E(h|v1)) ? ≥ 0 (64) where the variance is being computed over the d0 nodes that neighbour v0. Eq. 64 trivially holds, confirming that Var(Yrepelling) ≤ Var(Yi.i.d.) and completing the proof. Note that Theorem 4.4 does not obviate the long proof in Sec. A.1: suppressing the variance of the GRF coordinate φ(i)k, i, k ∈ N is not sufficient to conclude that the variance of the dot product bKij = φ(i)⊤φ(j) is also reduced since now we need to consider correlations between φ(i)k1 and φ(i)k2 with k1 ̸= k2. On the other hand, it does subsume Theorem 4.2 as a special case, though we keep this section in the manuscript for clarity of presentation. 22
http://arxiv.org/abs/2310.04832v1
"2023-10-07T14:41:59"
"2023-10-07T14:41:59"
HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations
The discovery of governing differential equations from data is an open frontier in machine learning. The sparse identification of nonlinear dynamics (SINDy) \citep{brunton_discovering_2016} framework enables data-driven discovery of interpretable models in the form of sparse, deterministic governing laws. Recent works have sought to adapt this approach to the stochastic setting, though these adaptations are severely hampered by the curse of dimensionality. On the other hand, Bayesian-inspired deep learning methods have achieved widespread success in high-dimensional probabilistic modeling via computationally efficient approximate inference techniques, suggesting the use of these techniques for efficient stochastic equation discovery. Here, we introduce HyperSINDy, a framework for modeling stochastic dynamics via a deep generative model of sparse governing equations whose parametric form is discovered from data. HyperSINDy employs a variational encoder to approximate the distribution of observed states and derivatives. A hypernetwork \citep{ha_hypernetworks_2016} transforms samples from this distribution into the coefficients of a differential equation whose sparse form is learned simultaneously using a trainable binary mask \citep{louizos_learning_2018}. Once trained, HyperSINDy generates stochastic dynamics via a differential equation whose coefficients are driven by a Gaussian white noise. In experiments, HyperSINDy accurately recovers ground truth stochastic governing equations, with learned stochasticity scaling to match that of the data. Finally, HyperSINDy provides uncertainty quantification that scales to high-dimensional systems. Taken together, HyperSINDy offers a promising framework for model discovery and uncertainty quantification in real-world systems, integrating sparse equation discovery methods with advances in statistical machine learning and deep generative modeling.
[ "Mozes Jacobs", "Bingni W. Brunton", "Steven L. Brunton", "J. Nathan Kutz", "Ryan V. Raut" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04832v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04832v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "68T07 (Primary) 37H10, 60H10 (Secondary)", "I.2; J.2" ]
HYPERSINDY: DEEP GENERATIVE MODELING OF NONLINEAR STOCHASTIC GOVERNING EQUATIONS 3 2 0 2 t c O 7 ] G L . s c [ 1 v 2 3 8 4 0 . 0 1 3 2 : v i X r a Mozes Jacobs Harvard University mozesjacobs@g.harvard.edu Bingni W. Brunton University of Washington bbrunton@uw.edu Steven L. Brunton University of Washington sbrunton@uw.edu J. Nathan Kutz University of Washington kutz@uw.edu Ryan V. Raut Allen Institute ryan.raut@alleninstitute.org ABSTRACT The discovery of governing differential equations from data is an open frontier in machine learning. The sparse identification of nonlinear dynamics (SINDy) [Brunton et al., 2016] framework enables data-driven discovery of interpretable models in the form of sparse, deterministic governing laws. Recent works have sought to adapt this approach to the stochastic setting, though these adaptations are severely hampered by the curse of dimensionality. On the other hand, Bayesian-inspired deep learning methods have achieved widespread success in high-dimensional probabilistic modeling via computationally efficient approximate inference techniques, suggesting the use of these techniques for efficient stochastic equation discovery. Here, we introduce HyperSINDy, a framework for modeling stochastic dynamics via a deep generative model of sparse governing equations whose parametric form is discovered from data. HyperSINDy employs a variational encoder to approximate the distribution of observed states and derivatives. A hypernetwork [Ha et al., 2016] transforms samples from this distribution into the coefficients of a differential equation whose sparse form is learned simultaneously using a trainable binary mask [Louizos et al., 2018]. Once trained, HyperSINDy generates stochastic dynamics via a differential equation whose coefficients are driven by a Gaussian white noise. In experiments, HyperSINDy accurately recovers ground truth stochastic governing equations, with learned stochasticity scaling to match that of the data. Finally, HyperSINDy provides uncertainty quantification that scales to high-dimensional systems. Taken together, HyperSINDy offers a promising framework for model discovery and uncertainty quantification in real-world systems, integrating sparse equation discovery methods with advances in statistical machine learning and deep generative modeling. 1 Introduction Across numerous disciplines, large amounts of measurement data have been collected from dynamical phenomena lacking comprehensive mathematical descriptions. It is desirable to model these data in terms of governing equations involving the state variables, which typically enables insight into the physical interactions in the system. To this end, recent years have seen considerable progress in the ability to distill such governing equations from data alone (e.g., [Schmidt and Lipson, 2009, Brunton et al., 2016]). Nonetheless, this remains an outstanding challenge for systems exhibiting apparently stochastic nonlinear behavior, particularly when lacking even partial knowledge of the governing equations. Such systems thus motivate probabilistic approaches that not only reproduce the observed stochastic behavior (e.g., via generic stochastic differential equations (SDEs) [Friedrich et al., 2011] or neural networks [Girin et al., 2021, Lim and Zohren, 2021]), but do so via discovered analytical representations that are parsimonious and physically informative [Boninsegna et al., 2018]. HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations We are particularly interested in model-free methods that seek to discover both the parameters and functional form of governing equations describing the data. To this end, the sparse identification of nonlinear dynamics (SINDy) framework [Brunton et al., 2016] has emerged as a powerful data-driven approach that identifies both the coefficients and terms of differential equations, given a pre-defined library of candidate functions. The effectiveness of SINDy for sparse model discovery derives from the tendency of physical systems to possess a relatively limited set of active terms. Extensions of the SINDy framework have sought to increase its robustness to noise, offer uncertainty quantification (UQ), and make it suitable for modeling stochastic dynamics [Boninsegna et al., 2018, Niven et al., 2020, Messenger and Bortz, 2021, Hirsh et al., 2021, Callaham et al., 2021, Fasel et al., 2022, Wang et al., 2022]. However, these extensions have generally relied upon computationally expensive approaches to learn the appropriate probability distributions. As such, a unified and computationally tractable formulation of SINDy that meets these additional goals is presently lacking. Variational inference (VI) methods represent a class of techniques for addressing the complex and often intractable integrals arising in exact Bayesian inference, instead approximating the true posterior via simple distribution(s). Recently, the combination of amortized VI [Ganguly et al., 2022] with the representational capacity of neural networks has emerged as a powerful, efficient approach to probabilistic modeling, with widespread application in the form of deep generative models [Kingma and Welling, 2014, Rezende and Mohamed, 2015]. Despite the success of these approaches for dynamical modeling (e.g., [Girin et al., 2021]), applications thus far have utilized generic state space formulations or parameter inference on a known functional form of the dynamics. Thus, the potential for VI to facilitate probabilistic equation discovery remains largely unexplored. 1.1 Contributions In this work, we propose HyperSINDy, a VI-based SINDy implementation that learns a parameterized distribution of ordinary differential equations (ODEs) sharing a common sparse form. Specifically, HyperSINDy employs a variational encoder to parameterize a latent distribution over observed states and derivatives, then uses a hypernetwork [Ha et al., 2016, Pawlowski et al., 2018] to translate samples from this distribution into the coefficients of a sparse ODE whose functional form is learned in a common optimization. In this way, HyperSINDy is able to model complex stochastic dynamics through an interpretable analytical expression – technically, a random ODE [Han and Kloeden, 2017] – whose coefficients are parameterized by a white noise process. Specific contributions of the HyperSINDy framework include: • Efficient and Accurate Modeling of Stochastic Dynamics at Scale. Through VI, we circumvent the curse of dimensionality that hampers other methods in identifying sparse stochastic equations. Specifically, HyperSINDy can accurately discover governing equations for stochastic systems having well beyond two spatial dimensions, which existing approaches have not exceeded [Boninsegna et al., 2018, Callaham et al., 2021, Wang et al., 2022, Huang et al., 2022, Tripura and Chakraborty, 2023]. Importantly, HyperSINDy's generative model is able to learn a complex distribution over the coefficients, and variance proportionately scales to match that of the data. • Generative Modeling of Dynamics. Once trained, HyperSINDy generates a random dynamical system whose vector field is parameterized by a Gaussian white noise. Hence, our approach efficiently arrives at a generative model for both the system dynamics and the exogenous disturbances (representing, e.g., unresolved scales). This permits simulations that reproduce the stochastic dynamical behavior of the observed process, while providing a natural method for quantifying uncertainty of the model parameters and propagating uncertainty in the probabilistic model forecast. • Interpretable Governing Equations Discovery. In contrast to other deep generative approaches for modeling stochastic dynamics, HyperSINDy discovers the analytical form of a sparse governing equation without a priori knowledge. Sparsity promotes human readable models where each term corresponds to an interpretable physical mechanism. This notion of interpretability, based on sparsity, is appealing in the traditional perspective of engineering and physics. In section 1.2, we discuss relevant literature. In section 2, we provide a background on the specific methods and mathematics that inspired our method. In section 3, we describe HyperSINDy. In section 4, we show results on various experiments. In section 5, we conclude with a discussion of our method, its limitations, and possible future directions. 1.2 Related Work HyperSINDy bridges two parallel lines of work concerning data-driven modeling for stochastic dynamics: namely, probabilistic sparse equation discovery and deep generative modeling. 2 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations Figure 1: HyperSINDy Framework. HyperSINDy employs an inference model and generative model to discover an analytical representation of observed stochastic dynamics in the form of a random (nonlinear) ODE fz(x). The inference model is an encoder neural network that maps (x, ̇x) to the parameters μ and σ of qφ(z|x, ̇x). ˆz can be sampled using a simple reparameterization of μ and σ. The generative model predicts the derivative via a hypernetwork H, which transforms z into Ξz, the coefficients of the ODE. fz(x) comprises a function library Θ, the coefficients Ξz, and sparse mask M . If ̇x is not available (e.g., after training), z is sampled from the prior z ∼ pθ(z) to produce Ξz. In the legend, trainable parameters are shown in green. The loss function comprises terms related to 1) the derivative reconstructions, 2) the latent distribution qφ(z|x, ̇x), and 3) sparsity of the discovered equation. See accompanying pseudocode 1 and 2 for details on batch-wise training. Most probabilistic implementations of SINDy have concerned UQ and noise robustness in the deterministic setting, rather than modeling stochastic dynamics per se. Of these approaches, ensembling methods [Fasel et al., 2022] have achieved state-of-the-art UQ and noise robustness for deterministic SINDy models, and were recently shown [Gao et al., 2023] to offer a computationally efficient alternative to earlier Bayesian implementations of SINDy [Niven et al., 2020, Hirsh et al., 2021] leveraging costly sampling routines to compute posterior distributions. Nonetheless, a model of the process noise is crucial for accurate UQ in the stochastic dynamics setting. Multiple studies have generalized the SINDy framework for the identification of parametric SDEs [Boninsegna et al., 2018, Callaham et al., 2021], with 3 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations three such studies recently performed in the Bayesian setting [Wang et al., 2022, Huang et al., 2022, Tripura and Chakraborty, 2023]. However, as discussed in these works, existing methods for approximating the drift and diffusion terms of the SDE (e.g., constructing histograms for the Kramers-Moyal expansion) are severely hampered by the curse of dimensionality, with computational cost generally scaling exponentially with SDE state dimension. Thus, an efficient and scalable formulation of SINDy for stochastic dynamics remains lacking. A separate line of work has leveraged advances in probabilistic deep learning for modeling stochastic dynamics, with deep generative models achieving state-of-the-art performance across a wide range of modeling tasks (e.g., [Yoon et al., 2019, Girin et al., 2021]). Although these models do not typically involve explicit dynamical representations, the new paradigm of physics-informed machine learning [Karniadakis et al., 2021] has motivated numerous developments at this intersection (e.g., [Lopez and Atzberger, 2021, Takeishi and Kalousis, 2021, Yang et al., 2020, Zhang et al., 2019]. Regarding the specific goal of (stochastic) equation discovery, several recent works have successfully employed VAEs to learn the coefficients of a generic (or pre-specified) SDE representation within a (potentially lower-dimensional) latent space[Hasan et al., 2022, García et al., 2022, Nguyen et al., 2021, Zhong and Meidani, 2023]. We propose to similarly leverage a VAE-like architecture to perform inference on a latent stochastic process; however, we seek to additionally discover a structural representation of the governing laws, which can yield considerable physical insight into the system [Boninsegna et al., 2018, Nayek et al., 2021, Wang et al., 2022]. Taken together, we seek to bridge the above fields via a unified deep learning architecture (trainable end-to-end with backpropagation) that enables discovery of the functional form of a governing stochastic process, along with posterior distributions over the discovered system coefficients (e.g., for UQ). 2 Background We briefly overview the SINDy and VAE frameworks, as well as an implementation of an L0 loss, before describing their integration within the HyperSINDy architecture. Sparse Identification of Nonlinear Dynamics The SINDy [Brunton et al., 2016] framework leverages sparse regression to enable discovery of a parsimonious system of differential equations from time-ordered snapshots. Thus, consider a system with state x(t) ∈ Rd governed by the ODE: ̇x(t) = f (x(t)) (1) Given m observations of the system in time X = [x(t1), x(t2), ..., x(tm)]T and the estimated time derivatives ̇X = [ ̇x(t1), ̇x(t2), ..., ̇x(tm)]T , we construct a library of candidate functions Θ(X) = [θ1(X), θ2(X), ..., θl(X)]. ̇X = Θ(X)Ξ, to identify the optimal functions and coefficients in Θ and Ξ, We then solve the regression problem, respectively. A sparsity-promoting regularization function R is typically added to this model discovery problem, yielding the final optimization, ˆΞ = arg minΞ( ̇X − Θ(X)Ξ)2 + R(Ξ). Although we focus on this basic implementation, we note that there have been numerous extensions of the original SINDy framework (for a recent overview, see [Kaptanoglu et al., 2022]), many of which can be easily incorporated into the present framework. Variational Autoencoder The VAE framework [Kingma and Welling, 2014] elegantly integrates variational inference (VI) with deep learning architectures, providing an efficient and powerful approach toward probabilistic modeling. VAEs assume that a set of observations x derives from a corresponding set of latent states z. VAEs construct an approximate posterior distribution qφ(z|x) and maximize the evidence lower bound (ELBO) of the log likelihood of the data pθ(x): log pθ(x) ≥ ELBO(x, z) = Eqφ(z|x)[log pθ(x|z)] − DKL(qφ(z|x)||pθ(z)) where φ and θ and are the parameters of the inference (encoder) and generative (decoder) models, respectively. The "reparameterization trick" enables sampling from qφ(z|x) using z = μ(z) + σ(z) ⊙ ε while still training the network end-to-end with backpropagation. After training, new observations are easily generated by sampling from the prior pθ(z), typically a unit Gaussian with diagonal covariance. (2) L0 Regularization The L0 norm is ideal for sparse regression problems as it penalizes all nonzero weights equally, regardless of magnitude. As L0 regularization poses an intractable optimization problem, the L1 regularization (lasso) – which penalizes the actual values of the learned weights – is a more common technique to achieve sparsity in practice. Nonetheless, incorporation of an L0-norm penalty [Zheng et al., 2019] into SINDy was recently found to have considerable advantages [Champion et al., 2020], motivating us to adopt a backpropagation-compatible L0 regularization. Accordingly, we implement one such method recently proposed by Louizos et al. [2018], which penalizes a trainable mask using the hard-concrete distribution. 4 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations Specifically, let M ∈ Rd be the desired sparse mask. Let s be a binary concrete random variable [Maddison et al., 2017, Jang et al., 2017] distributed in (0, 1) with probability density qφ(s), cumulative density Qφ(s), location log α, and temperature β. Let φ = (log α, β). Suppose we have γ < 0 and ζ > 1. We define each element m in M as a hard concrete random variable computed entirely as a transformation of s. Thus, learning an optimal m necessitates learning qφ(s), which simplifies to optimizing log α (we fix β). Sampling from qφ(s) and backpropagating into log α motivates use of the reparameterization trick (as in the VAE above) with ε ∼ U(0, 1). Then, m is computed. s = Sigmoid((log ε − log(1 − ε) + log α)/β) m = min(1, max(0, s(ζ − γ) + γ)) After training, we obtain m using our optimized log α parameter: m = min(1, max(0, Sigmoid(log α)(ζ − γ) + γ)) We train M using the following loss: L0(M ) = d (cid:88) j=1 Sigmoid(log αj − β log γ ζ ) (3) (4) (5) Refer to [Louizos et al., 2018] for the full derivation. In short, this provides a backpropagation-compatible approach to enforce sparsity via a trainable, element-wise mask. 3 HyperSINDy We combine advances in Bayesian deep learning with the SINDy framework to propose HyperSINDy, a hypernetwork [Ha et al., 2016, Pawlowski et al., 2018] approach to parsimoniously model stochastic nonlinear dynamics via a noise- parameterized vector field whose sparse, time-invariant functional form is discovered from data. In brief, HyperSINDy uses a variational encoder to learn a latent distribution over the states and derivatives of a system, whose posterior is regularized to match a Gaussian prior. Once trained, a white noise process generates a time-varying vector field by updating the coefficients of the discovered (random) ODE. Across a range of experiments, new noise realizations generate stochastic nonlinear dynamics that recapitulate the behavior of the original system, while also enabling UQ on the learned coefficients. Fig. 1 provides an overview of our approach and problem setting, which we detail below. Problem Setting Stochastic equations are fundamental tools for mathematically modeling dynamics under uncertainty. In general, the precise physical source of uncertainty is unknown and/or of secondary importance [Friedrich et al., 2011, Duan, 2015, Särkkä and Solin, 2019]; as such, several formulations exist. A common choice is the Langevin-type SDE with explicitly separated deterministic (drift) and stochastic (diffusion) terms. Alternatively, we may consider a deterministic ODE with stochastic parameters, i.e., a random ODE (RDE), which is another well-established framework [Arnold, 1998, Duan, 2015] with wide-ranging real-world applications (e.g., fluctuating resources in biological systems [Kloeden and Pötzsche, 2013, Caraballo and Han, 2016]). Here, we adopt the RDE formulation in the widely studied setting of i.i.d. noise [Arnold, 1998, Caraballo and Han, 2016]. We find this formulation practically advantageous for integration with deep generative modeling and VI, enabling a powerful and scalable approach to stochastic dynamics. Importantly, as any (finite-dimensional) SDE can be transformed into an equivalent RDE and vice versa [Han and Kloeden, 2017]; these practical advantages can be exploited without compromising relevance to canonical SDE representations (as we will empirically demonstrate). As above, let x0:T be the observations from times 0 to T of the state of a system, xt ∈ Rn. We assume these data are generated from some stochastic dynamics ̇x = fz(xt), where z is a latent random variable to modeled as an i.i.d. noise process. We wish to identify a family of sparse vector field functions fz constrained to a common functional form for all z ∈ Rd (i.e., only the coefficients of f are time-varying, reflecting the system's dependence on fluctuating quantities). With this framing, we seek to approximate both the functional form fz and a posterior estimate of the latent noise trajectory z = [z0, z1, ..., zT ]T associated with each observed trajectory x0:T. To do so, we employ a variational encoder to learn an inference model for the latent space p(z|x, ̇x) and a generative model p( ̇x|x, z) subject to ̇x = fz(x), as detailed below. Ultimately, once trained, we may generate new trajectories of x simply by iteratively sampling z from its Gaussian prior (i.e., constructing new sample paths of the driving noise). Generative Model Consider the following factorization of the conditional generative model with parameters θ: We assume that z is independent of x, so pθ(z|x) = pθ(z). pθ( ̇x|z, x) describes how the state x and latent z are transformed into the derivative, while pθ(z) is a prior over the latent distribution of states and their derivatives. We pθ( ̇x, z|x) = pθ( ̇x|z, x)pθ(z) (6) 5 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations choose pθ(z) to be a standard Gaussian with diagonal covariance: pθ(z) = N (0, I). There are numerous ways to implement fz(x), which parameterizes pθ( ̇x|z, x). Following the SINDy framework, which seeks interpretable models in the form of sparse governing equations, we adapt 1 to arrive at the following implementation for fz(x): fz(x) = Θ(x)(Ξz ⊙ M ). (7) where ⊙ indicates an element-wise multiplication. Θ(x) is a matrix expansion of x using a pre-defined library of basis functions, which can include any rational functions, such as polynomial (e.g., x2 1, x1x2) or trigonometric (e.g., sin x1, tanh x3) functions. Ξz is a matrix of coefficients that is output by a hypernetwork H that takes in z as input: Ξz = H(z). M is a matrix of values Mij ∈ [0, 1] that is trained with a close approximation to a differentiable L0 norm. Specifically, the values of M are simulated using a hard concrete distribution. As such, M enforces sparsity in the terms of each equation through the element-wise multiplication (Ξz ⊙ M ). Refer to to the Background section for more details on M . We constrain fz to a d-parameter family of ODEs sharing a common functional form. Specifically, H implements an implicit distribution pθ(Ξ|z) with z ∈ Rd. Although we cannot compute the density of pθ(Ξ|z) exactly, we can generate an ensemble of possible derivative functions by feeding samples z ∼ pθ(z) into the hypernetwork: Ξz = ψ(z). Inference Model Our inference model is defined by the approximate posterior, qφ(z|x, ̇x), with parameters φ. qφ(z|x, ̇x) is implemented by a neural network E and the reparameterization trick, i.e., μq, σq = E(x, ̇x); ˆz = μq + ε ⊙ σq. Training We train the model end-to-end with backpropagation to minimize the following loss function: loss = ( ̇x − fˆz(x))2 + βDKL(qφ(z|x, ̇x)||pθ(z)) + λL0(M ) (8) where β and λ are hyperparameters. The loss function optimizes the parameters φ and θ, where φ are the parameters of E (i.e., the variational parameters) and θ are the parameters of H and M (note that pθ(z) has fixed parameters). Refer to the Appendix for a full derivation of this loss function, and to Background for details on the sparsity-related loss L0(M ) (especially equation 5). To speed up training, every set number of epochs, we permanently set values of M equal to 0 if the magnitude of corresponding coefficients fall below a specific threshold value. 4 Results We evaluate the performance of HyperSINDy on four stochastic dynamical systems. Across a range of (dynamical) noise levels, we seek to assess the accuracy of models identified by HyperSINDy and the degree to which uncertainty estimates faithfully reflect the level of simulated noise. Refer to the Appendix for full details on data generation, training, and simulations. 4.1 Stochastic Equation Discovery First, we show results for 3D Stochastic Lorenz and 3D Stochastic Rössler datasets, simulated by: ̇x = ω(y − x) ̇x = −y − z (9) (10) where (ω, ρ, β) and (a, b, c) are iteratively sampled (at each timestep) from normal distributions with scale σ and mean (10, 28, 8 3 ) and (0.2, 0.2, 5.7), respectively. We train a HyperSINDy model on three trajectories from each system, with σ = 1, 5, 10. Refer to figure 2 for the full results. ̇y = x(ρ − z) − y ̇y = x + ay ̇z = xy − βz ̇z = b + z(x − c) Lorenz Rössler HyperSINDy correctly identifies most terms in each equation. Notably, increasing noise has little impact on the mean coefficients learned by HyperSINDy; instead, the estimated standard deviations of these coefficients proportionately scale with the dynamical noise. Furthermore, HyperSINDy correctly identifies which dynamical terms contain more noise and only increases the standard deviation of those terms, while maintaining tight bounds on other terms (i.e. xy in ̇y for Lorenz). Moreover, HyperSINDy is able to simulate the original (stochastic) dynamical behavior even as the noise level increases (blue trajectories). On the other hand, because HyperSINDy also successfully identifies the deterministic functional form despite process noise, it is able to produce smooth trajectories (purple) by forecasting with the mean of the discovered equation ensemble. Moreover, we ran separate experiments generating 10 trajectories (each with a different random seed, and each generated from a different initial condition) for each noise level of both systems. In total, we trained one HyperSINDy model and one E-SINDy model on each trajectory, yielding 30 HyperSINDy models and 30 E-SINDy models. We evaluated the RMSE of the mean and standard deviation of the discovered equations, as compared to ground truth. Refer to Table 1 for the full results. HyperSINDy outperforms E-SINDy on both mean and standard deviation for each experiment. 6 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations Figure 2: 3D Stochastic Lorenz and Rossler. HyperSINDy models trained on trajectories of varying noise (σ). The mean and standard deviation of the discovered governing equation coefficients are shown. Refer to 9 and 10 for the ground truth equations. Red trajectories indicate sample test trajectories simulated with the given σ. Purple trajectories are generated from HyperSINDy using the mean of the discovered governing equations, while blue trajectories are generated by iteratively sampling from HyperSINDy's learned generative model. The test and HyperSINDy trajectories are generated from the same initial condition. Table 1: Total coefficient RMSE relative to ground truth equations Lorenz Rossler Param HyperSINDy E-SINDy HyperSINDy E-SINDy 1 5 10 STD MEAN 0.082 ± 0.004 0.598 ± 0.045 MEAN 0.117 ± 0.022 0.4 ± 0.055 MEAN 0.203 ± 0.047 0.279 ± 0.085 STD STD 0.18 ± 0.029 1.296 ± 0.083 0.268 ± 0.064 0.971 ± 0.024 0.349 ± 0.103 0.913 ± 0.016 0.029 ± 0.035 0.828 ± 0.059 0.086 ± 0.047 0.807 ± 0.012 0.228 ± 0.138 0.812 ± 0.014 0.077 ± 0.04 0.849 ± 0.012 0.296 ± 0.199 0.875 ± 0.023 0.699 ± 0.551 0.875 ± 0.028 4.2 Recovering drift-diffusion dynamics The preceding analyses validate HyperSINDy's capacity for stochastic equation discovery. As HyperSINDy adopts an RDE modeling strategy (i.e., a noise-parameterized ODE [Arnold, 1998, Han and Kloeden, 2017], rather than an SDE with separable drift and diffusion), validation was demonstrated on RDE-simulated data to enable straightforward comparison with ground truth. Crucially, RDEs are conjugate to SDEs [Han and Kloeden, 2017], so this distinction is not fundamental. Nonetheless, this raises the question of how HyperSINDy learns to represent SDE-simulated dynamics. 7 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations Figure 3: Recovering drift and diffusion behavior in the stochastic Lotka-Volterra model.. K-M coefficients computed on sample trajectories from each of the three models (Euler-Maruyama integration, ∆t = 0.01). From left to right: the ground truth SDE, the HyperSINDy-discovered system, and the Stochastic SINDy-discovered system. To address this question, we simulate a 2D SDE to enable direct comparison against the leading method, stochastic SINDy [Boninsegna et al., 2018], as implemented in Python [Nabeel et al., 2022] (which cannot easily scale to higher dimensions). Specifically, we simulate a widely used model for population dynamics, the stochastic Lotka-Volterra system with state-dependent diffusion: ̇x = x − xy + σx(x, y)N (0, 1) ̇y = −y + xy + σy(x, y)N (0, 1) (11) where we have: σx(x, y) = 0.25x − 0.09y σy(x, y) = −0.09x + 0.25y Figure 3 illustrates the results of this analysis. Notably, HyperSINDy learns an expression whose terms correspond to those of the original drift function, thus enabling physical insight into the system. Moreover, although the diffusion term is not directly comparable with HyperSINDy's representation of stochasticity (coefficient noise), we may numerically estimate drift and diffusion coefficients from HyperSINDy's simulated trajectories. Specifically, we may estimate the first two Kramers-Moyal (K-M) coefficients, which derive from a Taylor expansion of the master equation (and from which derives the Fokker-Planck equation), and which fully describe the Markovian dynamics. Notably, HyperSINDy captures the appropriate deterministic (drift) and stochastic (diffusion) behavior of the system, recapitulating the state-dependence of these terms as seen in the original system – even performing favorably to stochastic SINDy in this setting. 4.3 High Dimensional Stochastic Discovery Lastly, we assess HyperSINDy's capacity for Bayesian inference/stochastic modeling for high dimensional stochastic systems, which are not amenable to existing analytical SDE discovery methods (e.g., [Boninsegna et al., 2018, Callaham et al., 2021]). Thus, we simulate a stochastic version of the Lorenz-96 system using: ̇xi = Fi + xi+1xi−1 − xi−2xi−1 − xi (12) 8 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations Figure 4: 10D Stochastic Lorenz-96. A sample test trajectory with σ = 10 (top) and sample HyperSINDy trajectory (middle) after training on a dataset with σ = 10. The bottom boxes show the mean and standard deviation of coefficients in the discovered governing equations (cf. 9). for i = 1, ..., 10 where x−1 = x9, x0 = x10, and x11 = x1. We iteratively sample each Fi from a normal distribution: Fi ∼ N (8, 10). Refer to Fig. 4 for the full results. HyperSINDy correctly identifies all terms in the system, while also correctly learning a high variance coefficient exclusively for the forcing terms, Fi. In addition, HyperSINDy produces sample trajectories that match the stochastic dynamical behavior of ground truth sample trajectories. 5 Discussion We have provided an overview of HyperSINDy, a neural network-based approach to sparse equation discovery for stochastic dynamics. Importantly, HyperSINDy is unique in its ability to provide analytical representations and UQ in the setting of high-dimensional stochastic dynamics. The present work represents a proof of concept for this architecture. We envision numerous future directions for extending the algorithmic and theoretical aspects of HyperSINDy – e.g., evaluation in the context of other noise types and with respect to convergence in the continuous limit. Moreover, while we employ a fairly straightforward implementation of SINDy, numerous developments of the SINDy framework [Kaptanoglu et al., 2022] may be smoothly incorporated into the HyperSINDy architecture. Finally, the integration of SINDy into a neural network framework paves the way for future developments that incorporate advances in probabilistic machine learning with interpretable equation discovery. 9 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations References L. Arnold. Random Dynamical Systems. Springer Monographs in Mathematics. Springer, Berlin, Heidelberg, 1998. ISBN 978-3-642-08355-6 978-3-662-12878-7. doi: 10.1007/978-3-662-12878-7. URL http://link.springer. com/10.1007/978-3-662-12878-7. L. Boninsegna, F. Nüske, and C. Clementi. Sparse learning of stochastic dynamical equations. The Journal of Chemical Physics, 148(24):241723, Mar. 2018. ISSN 0021-9606. doi: 10.1063/1.5018409. URL https://doi.org/10. 1063/1.5018409. S. L. Brunton, J. L. Proctor, and J. N. Kutz. Discovering governing equations from data by sparse identification of nonlinear dynamical systems. Proceedings of the National Academy of Sciences, 113(15):3932–3937, Apr. 2016. ISSN 0027-8424, 1091-6490. doi: 10.1073/pnas.1517384113. URL https://pnas.org/doi/full/10.1073/ pnas.1517384113. J. L. Callaham, J.-C. Loiseau, G. Rigas, and S. L. Brunton. Nonlinear stochastic modelling with Langevin regression. Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences, 477(2250):20210092, June 2021. ISSN 1364-5021, 1471-2946. doi: 10.1098/rspa.2021.0092. URL https://royalsocietypublishing. org/doi/10.1098/rspa.2021.0092. T. Caraballo and X. Han. Applied Nonautonomous and Random Dynamical Systems. SpringerBriefs in Mathematics. Springer International Publishing, Cham, 2016. ISBN 978-3-319-49246-9 978-3-319-49247-6. doi: 10.1007/ 978-3-319-49247-6. URL http://link.springer.com/10.1007/978-3-319-49247-6. L. Castrejon, N. Ballas, and A. Courville. Improved Conditional VRNNs for Video Prediction. pages 7608– 7617, 2019. URL https://openaccess.thecvf.com/content_ICCV_2019/html/Castrejon_Improved_ Conditional_VRNNs_for_Video_Prediction_ICCV_2019_paper.html. K. Champion, P. Zheng, A. Y. Aravkin, S. L. Brunton, and J. N. Kutz. A Unified Sparse Optimization Framework to Learn Parsimonious Physics-Informed Models From Data. IEEE Access, 8:169259–169271, 2020. ISSN 2169-3536. doi: 10.1109/ACCESS.2020.3023625. URL https://ieeexplore.ieee.org/document/9194760/. J. Duan. An Introduction to Stochastic Dynamics. Cambridge University Press, New York, NY, 1st edition edition, Apr. 2015. ISBN 978-1-107-42820-1. U. Fasel, J. N. Kutz, B. W. Brunton, and S. L. Brunton. Ensemble-SINDy: Robust sparse model discovery in the low-data, high-noise limit, with active learning and control. Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences, 478(2260):20210904, Apr. 2022. doi: 10.1098/rspa.2021.0904. URL https: //royalsocietypublishing.org/doi/10.1098/rspa.2021.0904. Publisher: Royal Society. R. Friedrich, J. Peinke, M. Sahimi, and M. Reza Rahimi Tabar. Approaching complexity by stochastic methods: From biological systems to turbulence. Physics Reports, 506(5):87–162, Sept. 2011. ISSN 03701573. doi: 10.1016/j. physrep.2011.05.003. URL https://linkinghub.elsevier.com/retrieve/pii/S0370157311001530. A. Ganguly, S. Jain, and U. Watchareeruetai. Amortized Variational Inference: Towards the Mathematical Foundation and Review, Sept. 2022. URL http://arxiv.org/abs/2209.10888. arXiv:2209.10888 [cs, math, stat]. L. M. Gao, U. Fasel, S. L. Brunton, and J. N. Kutz. Convergence of uncertainty estimates in Ensemble and Bayesian sparse model discovery, Jan. 2023. URL http://arxiv.org/abs/2301.12649. arXiv:2301.12649 [cs, math, stat]. C. A. García, P. Félix, J. M. Presedo, and A. Otero. Stochastic embeddings of dynamical phenomena through variational autoencoders. Journal of Computational Physics, 454:110970, Apr. 2022. ISSN 0021-9991. doi: 10.1016/j.jcp.2022. 110970. URL https://www.sciencedirect.com/science/article/pii/S0021999122000328. L. Girin, S. Leglaive, X. Bie, J. Diard, T. Hueber, and X. Alameda-Pineda. Dynamical Variational Autoencoders: A Comprehensive Review. Foundations and Trends® in Machine Learning, 15(1-2):1–175, Dec. 2021. ISSN 1935-8237, 1935-8245. doi: 10.1561/2200000089. URL https://www.nowpublishers.com/article/Details/MAL-089. Publisher: Now Publishers, Inc. D. Ha, A. Dai, and Q. V. Le. HyperNetworks, Dec. 2016. URL http://arxiv.org/abs/1609.09106. arXiv:1609.09106 [cs]. X. Han and P. E. Kloeden. Random Ordinary Differential Equations and Their Numerical Solution, volume 85 of Proba- bility Theory and Stochastic Modelling. Springer Singapore, Singapore, 2017. ISBN 978-981-10-6264-3 978-981-10- 6265-0. doi: 10.1007/978-981-10-6265-0. URL http://link.springer.com/10.1007/978-981-10-6265-0. IEEE Transactions on Signal Processing, 70:89–104, 2022. ISSN 1941-0476. doi: 10.1109/TSP.2021.3131723. Conference Name: IEEE Transactions on Signal Processing. Identifying Latent Stochastic Differential Equations. A. Hasan, J. M. Pereira, S. Farsiu, and V. Tarokh. 10 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations S. M. Hirsh, D. A. Barajas-Solano, and J. N. Kutz. Sparsifying Priors for Bayesian Uncertainty Quantification in Model Discovery, July 2021. URL http://arxiv.org/abs/2107.02107. arXiv:2107.02107 [math]. Y. Huang, Y. Mabrouk, G. Gompper, and B. Sabass. Sparse inference and active learning of stochastic differential equations from data. Scientific Reports, 12(1):21691, Dec. 2022. ISSN 2045-2322. doi: 10.1038/s41598-022-25638-9. URL https://www.nature.com/articles/s41598-022-25638-9. Number: 1 Publisher: Nature Publishing Group. E. Jang, S. Gu, and B. Poole. Categorical Reparameterization with Gumbel-Softmax, Aug. 2017. URL http: //arxiv.org/abs/1611.01144. arXiv:1611.01144 [cs, stat]. A. A. Kaptanoglu, B. M. d. Silva, U. Fasel, K. Kaheman, A. J. Goldschmidt, J. Callaham, C. B. Delahunt, Z. G. Nicolaou, K. Champion, J.-C. Loiseau, J. N. Kutz, and S. L. Brunton. PySINDy: A comprehensive Python package for robust sparse system identification. Journal of Open Source Software, 7(69):3994, Jan. 2022. ISSN 2475-9066. doi: 10.21105/joss.03994. URL https://joss.theoj.org/papers/10.21105/joss.03994. G. E. Karniadakis, I. G. Kevrekidis, L. Lu, P. Perdikaris, S. Wang, and L. Yang. Physics-informed machine learning. Nature Reviews Physics, 3(6):422–440, June 2021. ISSN 2522-5820. doi: 10.1038/s42254-021-00314-5. URL https://www.nature.com/articles/s42254-021-00314-5. Number: 6 Publisher: Nature Publishing Group. D. P. Kingma and M. Welling. Auto-Encoding Variational Bayes, May 2014. URL http://arxiv.org/abs/1312. 6114. arXiv:1312.6114 [cs, stat]. D. P. Kingma and M. Welling. An Introduction to Variational Autoencoders. Foundations and Trends® in Machine Learning, 12(4):307–392, Nov. 2019. ISSN 1935-8237, 1935-8245. doi: 10.1561/2200000056. URL https: //www.nowpublishers.com/article/Details/MAL-056. Publisher: Now Publishers, Inc. P. E. Kloeden and C. Pötzsche, editors. Nonautonomous Dynamical Systems in the Life Sciences, volume 2102 of Lecture Notes in Mathematics. Springer International Publishing, Cham, 2013. ISBN 978-3-319-03079-1 978-3-319-03080-7. doi: 10.1007/978-3-319-03080-7. URL https://link.springer.com/10.1007/978-3-319-03080-7. B. Lim and S. Zohren. Time-series forecasting with deep learning: a survey. Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences, 379(2194):20200209, Feb. 2021. doi: 10.1098/rsta. 2020.0209. URL https://royalsocietypublishing.org/doi/full/10.1098/rsta.2020.0209. Publisher: Royal Society. R. Lopez and P. J. Atzberger. Variational Autoencoders for Learning Nonlinear Dynamics of Physical Systems, Mar. 2021. URL http://arxiv.org/abs/2012.03448. arXiv:2012.03448 [cs, eess, math]. I. Loshchilov and F. Hutter. Decoupled Weight Decay Regularization, Jan. 2019. URL http://arxiv.org/abs/ 1711.05101. arXiv:1711.05101 [cs, math]. C. Louizos, M. Welling, and D. P. Kingma. Learning Sparse Neural Networks through $L_0$ Regularization, June 2018. URL http://arxiv.org/abs/1712.01312. arXiv:1712.01312 [cs, stat]. C. J. Maddison, A. Mnih, and Y. W. Teh. The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables, Mar. 2017. URL http://arxiv.org/abs/1611.00712. arXiv:1611.00712 [cs, stat]. D. A. Messenger and D. M. Bortz. Weak SINDy: Galerkin-Based Data-Driven Model Selection. Multiscale Modeling ISSN 1540-3459, 1540-3467. doi: 10.1137/20M1343166. URL & Simulation, 19(3):1474–1497, Jan. 2021. http://arxiv.org/abs/2005.04339. arXiv:2005.04339 [cs, math]. A. Nabeel, A. Karichannavar, S. Palathingal, J. Jhawar, D. R. M, and V. Guttal. PyDaddy: A Python package for discovering stochastic dynamical equations from timeseries data, Nov. 2022. URL http://arxiv.org/abs/2205. 02645. arXiv:2205.02645 [cs, math, q-bio]. R. Nayek, R. Fuentes, K. Worden, and E. J. Cross. On spike-and-slab priors for Bayesian equation discovery of nonlinear dynamical systems via sparse linear regression. Mechanical Systems and Signal Processing, 161:107986, Dec. 2021. ISSN 0888-3270. doi: 10.1016/j.ymssp.2021.107986. URL https://www.sciencedirect.com/ science/article/pii/S0888327021003812. D. Nguyen, S. Ouala, L. Drumetz, and R. Fablet. Variational Deep Learning for the Identification and Reconstruction of Chaotic and Stochastic Dynamical Systems from Noisy and Partial Observations, Feb. 2021. URL http: //arxiv.org/abs/2009.02296. arXiv:2009.02296 [cs, stat]. R. K. Niven, A. Mohammad-Djafari, L. Cordier, M. Abel, and M. Quade. Bayesian Identification of Dynamical Systems. Proceedings, 33(1):33, 2020. ISSN 2504-3900. doi: 10.3390/proceedings2019033033. URL https: //www.mdpi.com/2504-3900/33/1/33. Number: 1 Publisher: Multidisciplinary Digital Publishing Institute. 11 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, A. Desmaison, A. Kopf, E. Yang, Z. DeVito, M. Raison, A. Tejani, S. Chilamkurthy, B. Steiner, L. Fang, J. Bai, and S. Chintala. PyTorch: An Imperative Style, High-Performance Deep Learning Library. In Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips. cc/paper/2019/hash/bdbca288fee7f92f2bfa9f7012727740-Abstract.html. N. Pawlowski, A. Brock, M. C. H. Lee, M. Rajchl, and B. Glocker. Implicit Weight Uncertainty in Neural Networks, May 2018. URL http://arxiv.org/abs/1711.01297. arXiv:1711.01297 [cs, stat]. S. J. Reddi, S. Kale, and S. Kumar. On the Convergence of Adam and Beyond, Apr. 2019. URL http://arxiv.org/ abs/1904.09237. arXiv:1904.09237 [cs, math, stat]. D. Rezende and S. Mohamed. Variational Inference with Normalizing Flows. In Proceedings of the 32nd International Conference on Machine Learning, pages 1530–1538. PMLR, June 2015. URL https://proceedings.mlr. press/v37/rezende15.html. ISSN: 1938-7228. M. Schmidt and H. Lipson. Distilling Free-Form Natural Laws from Experimental Data. Science, 324(5923):81–85, Apr. 2009. ISSN 0036-8075, 1095-9203. doi: 10.1126/science.1165893. URL https://www.science.org/doi/ 10.1126/science.1165893. L. Sun, H. Sun, D. Z. Huang, and J.-X. Wang. Bayesian Spline Learning for Equation Discovery of Nonlinear Dynamics with Quantified Uncertainty. S. Särkkä and A. Solin. Applied Stochastic Differential Equations. Cambridge University Press, 1 edition, Apr. 2019. ISBN 978-1-108-18673-5 978-1-316-51008-7 978-1-316-64946-6. doi: 10.1017/9781108186735. URL https://www.cambridge.org/core/product/identifier/9781108186735/type/book. N. Takeishi and A. Kalousis. Physics-Integrated Variational Autoencoders for Robust and Interpretable Gen- In Advances in Neural Information Processing Systems, volume 34, pages 14809– URL https://proceedings.neurips.cc/paper/2021/hash/ erative Modeling. 14821. Curran Associates, 7ca57a9f85a19a6e4b9a248c1daca185-Abstract.html. Inc., 2021. T. Tripura and S. Chakraborty. A sparse Bayesian framework for discovering interpretable nonlinear stochastic dynamical systems with Gaussian white noise. Mechanical Systems and Signal Processing, 187:109939, Mar. 2023. ISSN 0888-3270. doi: 10.1016/j.ymssp.2022.109939. URL https://www.sciencedirect.com/science/ article/pii/S088832702201007X. Y. Wang, H. Fang, J. Jin, G. Ma, X. He, X. Dai, Z. Yue, C. Cheng, H.-T. Zhang, D. Pu, D. Wu, Y. Yuan, J. Gonçalves, J. Kurths, and H. Ding. Data-Driven Discovery of Stochastic Differential Equations. Engineering, 17:244–252, Oct. 2022. ISSN 2095-8099. doi: 10.1016/j.eng.2022.02.007. URL https://www.sciencedirect.com/science/ article/pii/S209580992200145X. Y. Yacoby, W. Pan, and F. Doshi-Velez. Failure Modes of Variational Autoencoders and Their Effects on Downstream Tasks, Mar. 2022. URL http://arxiv.org/abs/2007.07124. arXiv:2007.07124 [cs, stat]. L. Yang, D. Zhang, and G. E. Karniadakis. Physics-Informed Generative Adversarial Networks for Stochastic Differential Equations. SIAM Journal on Scientific Computing, 42(1):A292–A317, Jan. 2020. ISSN 1064-8275. doi: 10.1137/18M1225409. URL https://epubs.siam.org/doi/10.1137/18M1225409. Publisher: Society for Industrial and Applied Mathematics. J. Yoon, D. Jarrett, and M. van der Schaar. Time-series Generative Adversarial Networks. In Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://papers.nips.cc/ paper_files/paper/2019/hash/c9efe5f26cd17ba6216bbe2a7d26d490-Abstract.html. D. Zhang, L. Lu, L. Guo, and G. E. Karniadakis. Quantifying total uncertainty in physics-informed neural networks for solving forward and inverse stochastic problems. Journal of Computational Physics, 397:108850, Nov. 2019. ISSN 0021-9991. doi: 10.1016/j.jcp.2019.07.048. URL https://www.sciencedirect.com/science/article/pii/ S0021999119305340. P. Zheng, T. Askham, S. L. Brunton, J. N. Kutz, and A. Y. Aravkin. A Unified Framework for Sparse Relaxed Regularized Regression: SR3. IEEE Access, 7:1404–1423, 2019. ISSN 2169-3536. doi: 10.1109/ACCESS.2018.2886528. Conference Name: IEEE Access. W. Zhong and H. Meidani. PI-VAE: Physics-Informed Variational Auto-Encoder for stochastic differential equations. Computer Methods in Applied Mechanics and Engineering, 403:115664, Jan. 2023. ISSN 0045-7825. doi: 10.1016/j. cma.2022.115664. URL https://www.sciencedirect.com/science/article/pii/S0045782522006193. 12 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations Appendix A Derivation of Loss Function We assume independence of z with respect to x, such that pθ(z|x) = pθ(z). Then, as described in the Methods section, our generative model factorizes as follows (Bayes' rule): pθ( ̇x, z|x) = pθ( ̇x|z, x)pθ(z) (13) Given the chain rule for conditional probability, we also have: pθ( ̇x|z, x) = = = pθ( ̇x, z, x) pθ(z, x) pθ(z| ̇x, x)pθ( ̇x|x)pθ(x) pθ(z|x)pθ(x) pθ(z| ̇x, x)pθ( ̇x|x) pθ(z) Conditional Probability pθ(z|x) = pθ(z) By substituting into the first factorization, we obtain the second factorization: pθ( ̇x, z|x) = pθ(z| ̇x, x)pθ( ̇x|x) (14) We seek to learn a model that captures the dynamics ̇x, given the state x. Specifically, we seek to maximize the log-likelihood log pθ( ̇x|x) by performing inference over z. We follow a similar derivation as in [Kingma and Welling, 2019]: log pθ( ̇x|x) = Eqφ(z| ̇x,x) [log pθ( ̇x|x)] = Eqφ(z| ̇x,x) = Eqφ(z| ̇x,x) = Eqφ(z| ̇x,x) (cid:20) log (cid:20) log (cid:20) log (cid:21) pθ( ̇x, z|x) pθ(z| ̇x, x) pθ( ̇x, z|x)qφ(z| ̇x, x) pθ(z| ̇x, x)qφ(z| ̇x, x) (cid:21) pθ( ̇x, z|x) qφ(z| ̇x, x) + Eqφ(z| ̇x,x) = ELBO + DKL(qφ(z| ̇x, x)||pθ(z| ̇x, x)) (cid:20) log (cid:21) qφ(z| ̇x, x) pθ(z| ̇x, x) (cid:21) see Eq. 14 Since DKL(qφ(z| ̇x, x)||pθ(z| ̇x, x)) ≥ 0, we maximize the ELBO, which lower bounds log pθ( ̇x|x). (cid:21) (cid:20) ELBO = Eqφ(z| ̇x,x) log pθ( ̇x, z|x) qφ(z| ̇x, x) = Eqφ(z| ̇x,x) [log pθ( ̇x, z|x) − log qφ(z| ̇x, x)] = Eqφ(z| ̇x,x) [log pθ( ̇x|z, x) + log pθ(z) − log qφ(z| ̇x, x)] = Eqφ(z| ̇x,x) [log pθ( ̇x|z, x) − DKL(qφ(z| ̇x, x)||pθ(z))] see Eq. 13 Equivalently, we can minimize the −ELBO, given by the following loss: loss = ( ̇x − fˆz(x))2 + DKL(qφ(z|x, ̇x)||pθ(z)) Given our goal to learn a sparse set of governing equations, we need to train M , which is multiplied elementwise with Ξz. To do so, we add L0(M ) (main text Eq. 5) to the loss, yielding: loss = ( ̇x − fˆz(x))2 + βDKL(qφ(z|x, ̇x)||pθ(z)) + λL0(M ) = ( ̇x − fˆz(x))2 + βDKL(qφ(z|x, ̇x)||pθ(z)) + λ k (cid:88) j=1 Sigmoid(log αj − βL0 log γ ζ ) where β, λ, βL0, γ, and ζ are hyperparameters, k is the dimension of a vectorized M , and ˆz ∼ qφ(z|x, ̇x) using the reparameterization trick. logαj are location parameters for the distribution that M is transformed from, as described in the Background section of the main text. 13 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations System n Table 2: Matrix shapes for different experiments C Θ(x) M Lorenz Rössler Lotka-Volterra Lorenz-96 3 F 3 T T 2 10 T 250 × 19 250 × 20 250 × 10 250 × 286 Ξz 250 × 19 × 3 250 × 20 × 3 250 × 10 × 2 250 × 286 × 10 250 × 19 × 3 250 × 20 × 3 250 × 10 × 2 250 × 286 × 10 Θ(x)(Ξz ⊙ M ) 250 × 3 250 × 3 250 × 2 250 × 10 System Train Test Table 3: Dataset initial conditions Lorenz Rössler Lotka-Volterra Lorenz-96 (0, 1, 1.05) (0, 1, 1.05) (4, 2) (8.01, 8, 8, 8, 8, 8, 8, 8, 8, 8) (-1, 2, 0.5) (-1, 2, 0.5) (2.1, 1.0) (7.8, 8.7, 8.5, 6.0, 9.9, 9.5, 7.5, 6.9, 6.9, 8.7) Appendix B Generative and Inference Models Matrix dimensions are variable. Consider x ∈ Rn and a library with l terms. Then, we have: Θ(x) ∈ Rl Ξz ∈ Rl×n M ∈ Rl×n (Ξz ⊙ M ) ∈ Rl×n Θ(x)(Ξz ⊙ M ) ∈ Rn However, we use minibatches during training. Consider a batch of x of size b, meaning x ∈ Rb×n. Then, we have: Θ(x) ∈ Rb×l Ξz ∈ Rb×l×n M ∈ Rb×l×n (Ξz ⊙ M ) ∈ Rb×l×n Θ(x)(Ξz ⊙ M ) ∈ Rb×n After training, we do not sample M using the reparameterization trick, since α has been learned. So, M has shape l × n (note that k = l * n). For all experiments, we included polynomials up to order 3 in the library and used a batch size of 250 during training. Refer to Table 2 for a breakdown of matrix shapes for each experiment during training (note that C refers to whether a constant is included in the library). Appendix C Data Each trajectory was generated for 10000 timesteps with dt = 0.01. Refer to Table 3 for data generation initial conditions. Note that the test initial condition for Lorenz-96 is rounded (the exact values can be found in the accompanying code, as we used Gaussian noise to choose the initial condition). Derivatives are estimated using finite differences without smoothing. Appendix D Training D.1 Algorithm A "best practice" for the HyperSINDy training algorithm is choosing low initial β and λ values and evaluating the results before adjusting in future runs. Moreover, we also utilize beta warmup Castrejon et al. [2019], which is useful for avoiding posterior collapse in VAEs. Specifically, we increase the β value from 0.01 to the chosen low initial β value over 100 epochs. If the prior did not learn the function well enough, we increased ("spiked") the β value at a later epoch in training to βspike. Note that, although we knew the ground truth coefficients in our simulations, one can determine whether the prior learned "well enough" by comparing the similarity between the coefficients generated from the prior to the coefficients generated from the approximate posterior. See [Yacoby et al., 2022] for more information on this tradeoff between the posterior and prior. If the learned model was not sparse enough, we increased the λ value at a later epoch in training to λspike. Every 100 epochs, we permanently set values in M to be zero if the corresponding coefficients (using the mean over a batch of coefficients) falls below the threshold value T . This is done using an auxiliary matrix of shape l × n, where the values are all initially set to 1 and then set to 0 throughout training if the corresponding value in M should be 0 permanently. This mask is multiplied elementwise with M to enforce this permanent sparsity. During training, we sample one M for each example in a minibatch of data using the reparameterization trick. 14 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations Table 4: Hyperparameters Lorenz d 6 6 6 Rössler d 6 6 6 σ 1 5 10 σ 1 5 10 Lorenz RMSE σ 1 5 10 d 6 6 6 βspike 100 400 400 βspike 100 100 100 βspike 100 400 400 epochβspike 400 400 400 epochβspike 200 200 200 epochβspike 400 400 400 λspike 10 10 10 λspike 0.1 0.1 1 λspike 10 10 10 epochλspike 400 400 400 epochs T 999 999 999 0.05 0.05 0.05 epochλspike 200 300 300 epochs T 499 600 600 0.01 0.01 0.01 epochλspike 400 400 400 epochs T 999 999 999 0.05 0.05 0.05 Rössler RMSE σ d βspike 6 1 6 5 10 6 Lotka-Volterra 100 200 300 epochβspike 200 200 200 λspike 0.1 0.1 1 epochλspike 200 300 300 epochs T 499 600 600 0.01 0.01 0.01 σ d N/A 4 Lorenz-96 σ 10 d 20 βspike None epochβspike None λspike 0.1 epochλspike 100 epochs T 250 0.1 βspike None epochβspike None λspike 10 epochλspike 400 epochs T 999 0.05 D.2 Hyperparameters Hyperparamater tuning mostly consists of adjusting the β and λ value for the Kl divergence and L0 terms in the loss function, respectively. Hyperparameters that stay constant for all experiments are listed here: learning_rate = 0.005, num_hidden = 5, stat_size = 250, batch_size = 250. stat_size refers to the number of coefficient matrices that are sampled from the prior to calculate the coefficient means used for the permanent thresholding described in the Training section. We used a hidden dimension of 64 in all neural networks for all experiments except on Lorenz-96, for which we used a hidden dimension of 128. We warm up to a low initial β value of 10 for every experiment. We use an initial L0 regularization weight of λ = 0.01. For M , we use βL0 = 2/3, γ = −0.1, and ζ = 1.1. Note that an exhaustive list of hyperparameters and training settings can be found in the accompanying code. All experiments were run on an NVIDIA GeForce RTX 2080 Ti GPU. We ran all experiments in PyTorch [Paszke et al., 2019] using the AdamW optimizer [Loshchilov and Hutter, 2019] with a weight decay value of 0.01 and amsgrad [Reddi et al., 2019] enabled. Refer to Table 4 for a list of hyperparameters that we tuned to obtain the results in the main text. Refer to the attached code for more details on the RMSE experiments, as well as information on settings used to generate the supplemental figures. 15 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations Appendix E RMSE Metric To generate Table 1, we use the RMSE metric (as computed in Sun et al.). Specifically, we compute: rmse = ||CT rue − CP red||2 ||CT rue||2 where CT rue is the true mean or standard deviatin of a given coefficient, and CP red is the mean or standard deviation of the predicted coefficients. For terms that are not included in the ground truth or predicted equations, we consider their mean or standard deviation to be zero. Appendix F Algorithms Algorithm 1 Generation of Governing Equations Coefficients, Ξz, to predict ̇x 1: if z not given then: 2: 3: Ξz = H(z) 4: ̇x = fz(x) = Θ(x)(Ξz ⊙ M ) z ∼ N (0, I) ▷ Generate batch of z ▷ Generate 1 coefficient matrix for each z in batch ▷ Unless training, uses Eq 4 to get M Algorithm 2 Training Loop for Each Epoch 1: for each minibatch x, ̇x do μq, σq = E(x, ̇x) 2: ˆz = μq + σq ⊙ ε 3: Obtain training M through transformations 4: ˆ ̇x = fˆz(x) = Algorithm 1(ˆz) 5: loss = ( ̇x − ˆ ̇x)2 + βDKL(qφ(z|x, ̇x)||pθ(z)) + λL0(M ) 6: Backprop loss and update θ, φ 7: 8: Sample batch of z ∼ N (0, 1) 9: Ξz = H(z) 10: Ξzmean = mean over batch of Ξz 11: if (epoch % threshold_interval) == 0 then: 12: M = 0 permanently where abs(Ξzmean ) < threshold Appendix G Figures ▷ Encode each element of batch ▷ Reparameterization Trick ▷ See Background, specifically Eq 3 ▷ Give ˆz to H ▷ If we must threshold this epoch ▷ Permanently threshold M We include here additional sample trajectories (all from the test initial condition) to highlight HyperSINDy's generative capabilities. Refer to Figure 5 for HyperSINDy trajectories generated for various noise levels on the Lorenz and Rössler system, and refer to Figure 6 for sample test trajectories. HyperSINDy captures the same dynamical behavior as the original system. Refer to Figure 7 for HyperSINDy trajectories generated for the Lorenz-96 system. 16 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations Figure 5: 3D Stochastic Lorenz and Rössler Samples. HyperSINDy models trained on trajectories of varying noise (σ). Blue trajectories are generated by iteratively sampling from HyperSINDy's learned generative model. 17 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations Figure 6: 3D Stochastic Lorenz and Rössler Ground Truth Samples. Samples generated using the ground truth equations for varying noise levels (σ). 18 HyperSINDy: Deep Generative Modeling of Nonlinear Stochastic Governing Equations Figure 7: Lorenz-96 Samples (σ = 10). Each row contains a different sample trajectory. Trajectories are generated by iteratively sampling from HyperSINDy's learned generative model. Figure 8: E-SINDY 3D Stochastic Lorenz and Rössler Samples. Samples generated using discovered E-SINDy equations for varying noise levels (σ). 19
http://arxiv.org/abs/2310.04830v1
"2023-10-07T14:38:43"
"2023-10-07T14:38:43"
Extract-Transform-Load for Video Streams
Social media, self-driving cars, and traffic cameras produce video streams at large scales and cheap cost. However, storing and querying video at such scales is prohibitively expensive. We propose to treat large-scale video analytics as a data warehousing problem: Video is a format that is easy to produce but needs to be transformed into an application-specific format that is easy to query. Analogously, we define the problem of Video Extract-Transform-Load (V-ETL). V-ETL systems need to reduce the cost of running a user-defined V-ETL job while also giving throughput guarantees to keep up with the rate at which data is produced. We find that no current system sufficiently fulfills both needs and therefore propose Skyscraper, a system tailored to V-ETL. Skyscraper can execute arbitrary video ingestion pipelines and adaptively tunes them to reduce cost at minimal or no quality degradation, e.g., by adjusting sampling rates and resolutions to the ingested content. Skyscraper can hereby be provisioned with cheap on-premises compute and uses a combination of buffering and cloud bursting to deal with peaks in workload caused by expensive processing configurations. In our experiments, we find that Skyscraper significantly reduces the cost of V-ETL ingestion compared to adaptions of current SOTA systems, while at the same time giving robustness guarantees that these systems are lacking.
[ "Ferdinand Kossmann", "Ziniu Wu", "Eugenie Lai", "Nesime Tatbul", "Lei Cao", "Tim Kraska", "Samuel Madden" ]
10.14778/3598581.3598600
[ { "@title": "doi", "@href": "http://dx.doi.org/10.14778/3598581.3598600", "@rel": "related", "@type": null }, { "@title": null, "@href": "http://arxiv.org/abs/2310.04830v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04830v1", "@rel": "related", "@type": "application/pdf" } ]
[ "Proc. VLDB Endow. 16, 9 (May 2023), 2302-2315" ]
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.DB", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.DB", "cs.CV", "cs.LG" ]
3 2 0 2 t c O 7 ] B D . s c [ 1 v 0 3 8 4 0 . 0 1 3 2 : v i X r a Extract-Transform-Load for Video Streams Ferdi Kossmann1 Ziniu Wu1 Eugenie Lai1 Nesime Tatbul1,2 Lei Cao1,3 Tim Kraska1,4 Sam Madden1 {ferdik,ziniuw,eylai,tatbul,lcao,kraska,madden}@csail.mit.edu 1MIT CSAIL, 2Intel Labs, 3University of Arizona, 4AWS ABSTRACT Social media, self-driving cars, and traffic cameras produce video streams at large scales and cheap cost. However, storing and query- ing video at such scales is prohibitively expensive. We propose to treat large-scale video analytics as a data warehousing problem: Video is a format that is easy to produce but needs to be transformed into an application-specific format that is easy to query. Analogously, we define the problem of Video Extract-Transform-Load (V-ETL). V-ETL systems need to reduce the cost of running a user-defined V-ETL job while also giving throughput guarantees to keep up with the rate at which data is produced. We find that no current system sufficiently fulfills both needs and therefore propose Skyscraper, a system tailored to V-ETL. Skyscraper can execute arbitrary video ingestion pipelines and adaptively tunes them to reduce cost at mini- mal or no quality degradation, e.g., by adjusting sampling rates and resolutions to the ingested content. Skyscraper can hereby be provi- sioned with cheap on-premises compute and uses a combination of buffering and cloud bursting to deal with peaks in workload caused by expensive processing configurations. In our experiments, we find that Skyscraper significantly reduces the cost of V-ETL ingestion compared to adaptions of current SOTA systems, while at the same time giving robustness guarantees that these systems are lacking. PVLDB Artifact Availability: The source code, data, and/or other artifacts have been made available at https://github.com/ferdiko/vetl. INTRODUCTION 1 Every day, millions of video streams are produced by smartphones, TV stations, self-driving cars, dashcams, and CCTV cameras de- ployed in cities and office buildings. These video streams can offer great insights and enormous value in fields such as city planning, marketing, advertisement, smart retail, or autonomous driving. For example, city planners around Vancouver are currently facing the challenge of deciding where to place electric vehicle (EV) chargers. For that, they want to obtain data that tells them which points in the city are most commonly traversed by EVs. Most cities like Vancou- ver already installed hundreds to thousands of traffic cameras, which could be used to obtain such EV counts. The naive way of counting how many EVs pass by each camera is to store the video from all cameras and then run an object detec- tion algorithm1 on the recorded video at query time. However, this approach has major disadvantages. First, storing the video requires outrageously large storage volumes. For example, one thousand traffic cameras roughly produce 230 TB of data every month.2 Stor- ing one month's data on Amazon S3 would therefore cost $60,000 per year. Second, querying for trends or averages usually requires analyzing months to years of data, which leads to large query laten- cies. Even on modern GPUs, state-of-the-art computer vision (CV) 1In Canada (as in many other countries), EVs are especially easy to distinguish from other cars since they have green license plates. 2One traffic camera feed in our experiments produces 7.8GB of data per day. models can only process a few frames per second. For example, processing one year of video with the YOLO object detector [62] takes six months on an AWS p3.2xlarge instance (with an NVIDIA Tesla V100 GPU). Third, naively applying CV techniques at such scales is prohibitively expensive for many applications. For example, naively running the YOLO object detector [62] to analyze a month of traffic data from 100 cameras costs $110,000 on AWS3. To address the limitations of the naive approach, we propose to manage live video streams like in a data warehouse. Video is a format that is easy to produce but hard to query. A video warehouse allows for efficient querying by converting incoming video into an intermediate format that is easy to query. This intermediate format is application-specific and contains the extracted entities of interest. In the EV example, it would contain car counts and types. Analogous to traditional data warehouses, we refer to the process of preparing the data for querying as Video Extract-Transform-Load (V-ETL). Video is extracted from the cameras, transformed into the intermediate format using CV, and loaded into a query engine like a relational database system. This lets the user issue queries in SQL against tables with the extracted entities (e.g., obtaining the EV counts is a simple count query on a Detections table, where the detected car is an EV, grouped by the camera id). Video warehouses eliminate the storage problem since users may throw video away after extracting all entities of interest during in- gestion. They also solve the query latency issue, since users can issue queries against the intermediate format and no expensive CV algorithm needs to be run at query time. However, video warehouses do not magically solve the cost problem, as the video still needs to be processed during the V-ETL Transform step. Furthermore, video processing must happen at the rate at which the video is produced in order to achieve continuous ingestion. To address the challenges imposed by V-ETL, we built Skyscraper which allows for cheap video ingestion while also adhering to throughput requirements. Skyscraper's goal is to make the V-ETL transform step more practical. It allows users to provision hardware resources according to their monetary budget and optimizes the quality of the extracted video entities on the given resources. Depending on the provisioned hardware, Skyscraper reduces the work imposed by the V-ETL job while degrading the result quality as little as possible. Skyscraper does this by dynamically config- uring knobs that are inherent to CV workloads. Examples of such knobs include the frame rate or the image resolution at which the video is processed, as well as further, application-specific knobs. Each of these knob represents a trade-off between work and result quality: Expensive knob configurations can reliably deliver good results, even for difficult inputs (e.g., many object occlusions); cheap configurations, on the other hand, only deliver good results on easy inputs (e.g. few occlusions, good lighting conditions etc.) but are prone to mistakes on difficult inputs. The content of real-world video 3E.g., using 50 p3.2xlarge instances, each of which currently costs 3.06 USD/h. the frame to avoid double counting them. Finally, the user registers the workload's tunable knobs. In the simple example, the user only defines a single knob that controls how frequently the object detector should be run. Skyscraper optimizes the costly Transform step while the user code performs the Extract and Load steps. Prior work. While Skyscraper is the first system to specifically address the challenge of V-ETL, there are several lines of work that are relevant to Skyscraper. We briefly highlight two of them here and refer to Section 6 for a more detailed discussion on related work. Table 1 shows the differences between Skyscraper and these works. First, there is prior work on content-adaptive knob tuning, such as Chameleon [40] and Zeus [16]. These systems are designed to reduce the average processing time per frame while assuming that the provisioned hardware can always ingest video in real-time (even during peak workload). However, when ingesting video on cheaper machines that are not peak-provisioned, prior systems do not pro- vide throughput guarantees and are therefore impractical for V-ETL. Adapting these systems to fulfill throughput requirements on cheap hardware is challenging, since they are agnostic to lag and the hard- ware resources they run on. We discuss this further in Section 6. Second, there is prior work on systems that use knob tuning to adapt to the current query load. VideoStorm [81] and VideoEdge [35] are designed for scenarios where users run a dynamic set of queries over video streams, which causes dynamic changes to the type and number of queries running. At times when many queries are running concurrently, not all queries may be able to run at maximum quality and in real time. VideoStorm and VideoEdge tune the queries' knobs such that the queries fulfill their quality and latency goals as well as possible. However, VideoStorm and VideoEdge only adapt to the query load (i.e., the queries present in the system) and are agnostic to the streamed content. This brings no benefit in scenarios where the query load is static. While we envision most V-ETL applications to ingest video using a static set of processing jobs, VideoStorm might still be used if users dynamically redefine how to ingest video. Adapt to video content Adapt to query load Throughput guarantees No throughput guarantees Skyscraper Chameleon, Zeus VideoStorm, VideoEdge Table 1: Skyscraper compared to other video knob tuning systems In summary, our contributions are as follows: • We define the problem of Video Extract-Transform-Load (V- ETL) and identify its importance. • To make V-ETL more practical, we propose Skyscraper, the first content-adaptive knob tuning system with throughput guarantees. Skyscraper lets users provision compute resources according to their budget and optimizes the result quality on the given resources. • To effectively ration compute resources over time, we propose a combination of predictive planning and reactive execution. • We propose a tuning method that only relies on a user-defined quality metric which is extracted anyways when running the V-ETL job. We find that this method allows for negligible tuning overheads. • We conduct experiments on several real-world and synthetic workloads and find that Skyscraper can achieve cost reductions up to 8.7× over baselines on various workloads. Figure 1: Skyscraper optimizing the expensive V-ETL Transform step of the EV counting example job. The blue components are provided by Skyscraper, the red ones are provided by the user. streams is highly variable with frequent changes in how difficult it is to analyze the content (i.e., changes every few 10s of seconds). Skyscraper saves work by using expensive knob configurations on difficult video segments and cheap configurations otherwise. Since Skyscraper needs to process data on constrained hardware at a required throughput, Skyscraper must configure the knobs not only based on the video content but also on the available hard- ware resources. Industrial deployments for live video processing are typically provisioned with three types of resources [35]: a lo- cal compute cluster with a high-bandwidth connection to the video source, a video buffer, and cloud resources that may be used to rent on-demand cloud compute (to limit cloud costs, users typically want to set a cloud budget.) Skyscraper leverages all three of these resource types: Skyscraper itself runs on the local cluster and uses it to process video. To keep costs low, the local cluster is typically not provisioned to process the most expensive knob configurations in real-time. When it falls behind, Skyscraper sets video video in the buffer and, as the buffer starts to fill, offloads work to on-demand cloud workers. Skyscraper must avoid prematurely using up buffer space and cloud credits in order to not run out of them when expensive knob configurations would have the greatest impact. Skyscraper therefore forecasts the workload and rations compute resources with regard to future demand. To still be robust to unavoidable inaccuracies in the forecast, we propose to combine a predictive planning component with a reactive execution component, which lets Skyscraper make tuning decisions while considering both, the future demand and the content that is actually streamed in the moment. Despite the need for predictive knob tuning, Skyscraper's knob tuning decisions must impose a low overhead - this is especially important in low-budget regimes, where large decision overheads would consume a significant portion of the compute resources. While prior content-adaptive knob tuners run additional CV operators to make tuning decisions [16, 40], Skyscraper adapts to the video con- tent only based on a user-defined quality metric (e.g., certainties commonly reported by CV models) that are extracted anyways when running the V-ETL job. This allows Skyscraper to make tuning deci- sions in under 0.5 ms on a single CPU core. Figure 1 shows an overview of how Skyscraper processes the EV example workload. The user specifies user-defined functions (UDFs) that transform the video into the application-specific query format. In Figure 1, the user only defines two UDFs. The object detector UDF is responsible for detecting new cars, while the object tracker UDF is responsible for tracking cars as they move across 2 LoadExtractObject detector UDFObject tracker UDFDAG output (cars)TransformAdapt knob to video contentSchedule executionEvery n-th frameOther frames 2 PROBLEM DEFINITION AND SYSTEM OVERVIEW 2.1 Problem definition Video Extract-Transform-Load (V-ETL) refers to extracting entities of interest from a video stream by processing it according to a user- defined specification and adhering to two constraints. First, V-ETL systems must process video at the rate at which it arrives. A V-ETL system may lag behind on processing but may only do so by a constant amount. In practice, this means that V-ETL systems may use a fixed-size storage medium (i.e., buffer) to set video aside for later processing. Equation 1 states that the size of the buffered frames may not exceed the size of the buffer. out (t) ⊆ in(t) ∧ ∑︁ size (F ) ≤ B ∀t (1) F ∈ in (t )\ out (t ) where t is a timestamp, in(t) is the set of frames that the video source has produced at time t, out (t) is the set of frames that the V-ETL system has processed at time t, size (F ) is the size of frame F in bytes and B is the buffer size in bytes. Second, V-ETL systems must process video at a budget that is defined by the user. This budget is provided as a dollar cost budgetT that may be spent over a given time interval T . The processing cost over interval T encompasses all costs including average wear of hardware, cloud costs, etc. The summed cost of processing all frames in T must be below budgetT : (cid:205)F ∈T cost (F ) ≤ budgetT . The combination of processing video at a required throughput while being constrained on computing resources makes for exciting optimization problems. Skyscraper aims to maximize the overall result quality by tuning workload-specific knobs that are inherent to computer vision workloads (e.g., the frame rate or image reso- lution). In Skyscraper, the quality is user-defined and is measured and returned by the user code - this lets Skyscraper generalize to different workloads with different notions of quality. Users may further register arbitrary knobs together with a corre- sponding knob domain. The knob domain is a user-defined set of values that the knob may take (e.g. the knob domain for the frame rate knob might be {15 FPS, 30 FPS}). Skyscraper dynamically configures registered knobs based on the streamed video content and maximizes the quality (e.g. accuracy) of the extracted entities while adhering to the V-ETL requirements. Formally, a knob configuration k refers to an instantiation of each knob to a value in its domain. Some knob configurations induce more work than others. Similarly, some produce more qualitative re- sults than others. However, the result quality of a knob configuration depends not only on the configuration but also on the video content. While a high image resolution may reliably produce good results, it may not always be needed as some content can also be accurately processed at a lower resolution. Let a video segment denote a se- quence of successive frames of the video (e.g., 2 seconds of video). We denote the quality that a knob configuration k achieves on a video segment s as qual (k, s). The optimization goal of Skyscraper is to maximize the overall quality qual (v) of entities extracted from video v, which is given by qual (v) = (cid:205)s ∈v qual (ks, s)where ks is the configuration used to process segment s. 3 2.2 System overview The following subsection gives a high-level overview of Skyscraper. Section 3 and Section 4 then provide a more detailed discussion of Skyscraper's design. We focus on how Skyscraper ingests a single video stream and show in Appendix D, how this approach can easily be generalized to multiple streams. Design challenges. To explain why Skyscraper works the way it does, we present a simplistic, idealized approach to content-adaptive knob tuning with throughput guarantees, and show where this ap- proach fails in practice. We then present the ideas that Skyscraper uses to overcome the issues of the idealized approach. For now, we do not consider buffering or the scheduling of com- putation between on-premise resources and the cloud. Instead, we simply consider a computation budget budgetT on the number of arithmetic operations that we may use to ingest video produced during time period T . We are further given a small set of knob con- figurations K which allows us to process different segments of the video at different costs and qualities (see Section 2.1). We observe that the knob tuning system must speculate about the future content of the video in order to effectively ration budgetT over time. Otherwise, the system can not assess whether it is sensible to process content with an expensive knob configuration now or to save the budget for the future when expensive knob configurations might have a larger impact. Furthermore, we find that the effectiveness of different knob configurations often changes within seconds - a content-adaptive knob tuning system should therefore reassess which configuration to use every couple of seconds. Now, suppose we have a forecasting function that can perfectly predict what quality each knob configuration achieves at any given time in the future. In this idealized world, we can easily build a sys- tem that achieves optimal performance: Our optimal system would slice time interval T into segments ti of equal length, where each segment ti is a few seconds long. The system then forecasts the qual- ity that each knob configuration achieves on each segment ti ∈ T . Finally, given the forecasted qualities, optimizing the assignment of knob configurations to segments is an instance of the 0-1 knapsack problem, where the overall quality must be maximized under the given budget budgetT (more details in Appendix B). Unfortunately, we find that achieving good accuracy on this fore- casting task is infeasible in the real world. To forecast the knob configurations' qualities for each ti ∈ T , our forecasting function needs to predict what happens at each second in the video, hours into the future. This is impossible since the precise timing of events is subject to substantial randomness. For example, it is impossible to predict the exact moment in which a large group of pedestrians will pass by a camera, hours into the future. To make our system work in the real world, we need to design a more practical forecasting task. We rely on two insights that guide the design of this new forecast- ing task. First, we observe that there are a few types of video content that characterize any of the videos seen throughout the live stream (e.g., rush hour traffic, normal traffic, low traffic). For the content of the same kind, each knob configuration produces results of similar quality. For example, for content with many occlusions (e.g., rush hour), knob configurations that cannot handle occlusions will always produce low-quality results. Second, we observe that, while it is impossible to predict when certain content appears, it is possible to Figure 2: Overview over all processing steps of Skyscraper. predict how often it appears, assuming the future video is distributed roughly as a recent historical video has been. For example, while it is impossible to predict the precise moments (i.e. the ti 's) at which groups of pedestrian pass by the camera, it is possible to estimate how often groups of pedestrians pass by the camera. We can now design a forecasting task where accurate predictions are feasible in practice. Based on the first insight (content falls into a few categories), we use a simple clustering mechanism to compute content categories such that all streamed content falls into one of these categories. We construct them such that all knob configurations achieve a similar quality on the content of the same category (more details in Section 3). Then, based on the second insight (content distribution is predictable), we simply predict how often each con- tent category appears within a time interval T . For example, if our forecasting model thinks that 10% of the video in T shows rush-hour traffic, it would forecast 10% for the rush-hour category. In practice, we can achieve high forecasting accuracy on real-world workloads. Finally, we need to re-think how to use the forecast for knob tun- ing. Since we no longer forecast the qualities of individual segments ti , we cannot assign knob configurations the same way as in our idealized system. Instead, we can only assign knob configurations to content categories. Knowing how often each content category ap- pears allows us precisely determine the overall cost of using a knob configuration to process the content of that category. In Section 4, we describe how this allows us to find the optimal assignment of knob configurations to content categories under a given budget and for a given forecast. Given this assignment, we then need to reactively determine what category the current content belongs to. Once we determine the category, we can simply look up and use the knob configuration we assigned to this category. Section 4.2 describes a simple method for determining the current content category, which runs fast and determines the correct category with high accuracy. In summary, we took a simplistic, idealized system and made it practical by re-designing the forecasting task. We then built an efficient system around it that can leverage this forecast for predictive knob tuning. Skyscraper takes these ideas and implements them for real hardware provisionings. Skyscraper walk-through. Given these challenges imposed by content-adaptive knob tuning with throughput guarantees, we now give an overview on how Skyscraper uses these ideas when provi- sioned with real hardware (i.e., with a local compute cluster, video buffer and cloud credits). Skyscraper is split into an offline learning phase and an online ingestion phase as shown in Figure 2. Section 3 gives a detailed description of the offline phase and Section 4 gives a detailed description of the online phase. The offline phase is used to pre-compute invariant properties of the V-ETL workload, which allow online ingestion at negligible overheads. To compute these properties, the user provides Skyscraper with a small set (e.g. 5 minutes) of labeled data and a larger set (e.g. two weeks) of unlabeled data from the ingested video source. Skyscraper uses this data to prepare online ingestion in three steps. First, Skyscraper profiles different knob configurations on the provisioned on-premise hardware and cloud hardware. Each knob configuration corresponds to a directed acyclic graph (DAG) of UDFs. Skyscraper profiles the cloud cost and runtime of different UDF placements - executing some UDFs on the cloud may re- duce the execution time (due to added parallelism) but increases the cloud cost. Skyscraper filters out placements that do not lie on the cost-runtime Pareto frontier. Similarly, Skyscraper filters out knob configurations that do not lie on the runtime-quality Pareto fron- tier. Appendix F disusses how Skyscraper handles data movement between UDFs and between on premises and the cloud. Second, Skyscraper uses the unlabeled data to construct the con- tent categories as discussed under Design challenges. The content categories are constructed solely based on a quality metric that is measured and returned by the user code (e.g. certainty or errors commonly reported by CV models). By construction, the content categories discriminate between any content characteristic that af- fects the quality of at least one knob configuration. Constructing the content categories solely based on a user-defined quality metric lets Skyscraper generalize across workloads since Skyscraper doesn't need to understand the precise workings of the UDFs and how their performance is affected by pixel-level changes. Furthermore, dealing with low-dimensional quality vectors (e.g., 5-dimensional) allows Skyscraper to run fast, which is almost impossible when dealing with high-dimensional image data (e.g., 750,000-dimensional). Third, Skyscraper uses the unlabeled data to train the forecast- ing model. As in under Design challenges, the forecasting model forecasts how often each content category appears within a defined future time interval. This forecast is based on how frequently the content categories have appeared in the recent past. After the offline phase, each knob configuration is characterized by the quality it achieves on different content categories as well as the profiled runtimes and cloud costs when executing the knob con- figuration using different task placements. When optimizing video ingestion, Skyscraper only considers the runtime of knob configura- tions together with the quality the knob configuration achieves on the current content category. This is sufficient to maximize the quality under throughput constraints and lets Skyscraper agnostic to the UDFs. Skyscraper periodically performs predictive knob planning (e.g. every 2 days) and reactive knob switching (e.g. every 2 seconds): Knob planning involves forecasting how often each content category 4 Knob plan1. Filter knob configurations K2. Profile + filter cloud/on-prem placements Pkk∈K}Knob planForecastPlanLook upUnlabeled training dataConstruct content categories, e.g. heavy traffic / light traffic CTrain forecasting model FOffline learning phaseOnline ingestion (V-ETL Transform step)Labeled training dataSwitchLook upSwitchLook upSwitchLook upSwitchForecastPlanLook upSwitchKnob plan...+ 3 OFFLINE PREPARATION PHASE In the offline preparation phase, Skyscraper is fitted on the historical video data recorded from the same source that will be ingested in the online phase. Skyscraper needs a small set of labeled data (i.e., 20 minutes) and a larger set of unlabeled data (e.g., 2 weeks). Based on this data, Skyscraper first leverages prior work [2, 81] to create a filtered set of knob configurations and a set of good task placements for them. Then, Skyscraper clusters video content into categories allowing Skyscraper to reason about video content in the online phase. Furthermore, Skyscraper trains a forecasting model to predict the frequency that each content category appears in the near future. We describe these procedures in more detail as follows. 3.1 Filter knob configurations and task placements In order to optimize video processing while inducing little deci- sion overheads during online ingestion, Skyscraper needs to decide the desirable knob configuration k to process the streamed content and the placement T Pk of its task graph Gk . Recall that the place- ment of Gk specifies which computation components when using knob configuration k to run on the cloud and which ones to run on-premises. The number of all knob configurations is exponential in the number of user-registered knobs. Similarly, the number of all possible placements for a task graph is exponential in the number of tasks. Skyscraper leverages prior work [2, 81] to filter the set of knob configurations and task placements down to a smaller set. Thereafter, Skyscraper only needs to consider promising candidates in the online phase, reducing the size of the decision problem and therefore online overheads. We leverage the greedy hill climbing algorithm [67] proposed in VideoStorm [81] to filter the knob configurations. We use PlaceTo [2] to filter the task placements (details in Appendixs A). 3.2 Categorize video dynamics Skyscraper discretizes video content into content categories with the property that knob configurations achieve similar result quality for all video segments belonging to the same content category. In this section, we describe how to identify these content categories and will discuss how to forecast them in Section 3.3 and how the categories allow for efficient video ingestion in Section 4. Skyscraper categorizes video content using unlabeled training data. Skyscraper first samples a set of video segments S′ from the unlabeled data. Skyscraper then processes each segment s ∈ S′ with all configurations k ∈ K and records the result quality that each k achieves on the segment s as quals (k). The result qual- ity measurement is defined by the user and will be further dis- cussed in Section 4. We group the qualities of all configurations k on a segment s into a |K |-dimensional quality vector quals = [quals (k1), ..., quals (k | K | )]T . We gather the quals for all segments s ∈ S′ to form a set of quality vectors Q = {quals | s ∈ S′}. Then, Skyscraper decides the content categories C by running KMeans [52] on Q. Thereafter, the content is clustered according to the quality that the knob configurations achieve on it, ensuring that all knob configurations achieve similar result quality for the content of the same category by the property of KMeans. A content category c ∈ C is therefore characterized by a |K |-dimensional cluster center, which denotes the average quality that the knob configurations will Figure 3: Running the EV workload over a traffic camera. appears in the future (e.g. within the next 2 days) and assigning knob configurations to the content categories based on the forecast. Knob switching involves determining the content category of the current video content and looking up what knob configuration the planning phase assigned to that category. Based on the assigned knob configuration, the available buffer space, and the profiled runtimes, Skyscraper then picks a knob configuration and task placement and uses it to process the next segment of video. Processing example Figure 3 shows how the knob planner and knob switcher use the provisioned resources to achieve high-quality results when running the EV example workload on 24 hours of a traf- fic camera stream. The uppermost plot in Figure 3 shows how three different knob configurations (expensive, medium, cheap) achieve different result qualities. For the EV workload, the result quality is mainly affected by object occlusions (i.e., one car overlaps with an- other car). We observe that expensive configuration reliably produces high-quality results while the cheap one only produces high-quality results at night, when there is little traffic and few occlusions. The second plot in Figure 3 shows how the dynamic knob switch- ing in Skyscraper causes the change in the workload (TFLOP per second). We can see that the workload is low during the night when Skyscraper frequently uses the cheap configurations, but high during the day when Skyscraper uses the expensive configurations. The data in Figure 3 is smoothed and hides that Skyscraper switched 4500 times between knob configurations over the course of the plotted time period. If we would instead always use the most expensive configuration, the workload would be constant at 5.2 TFLOP/s. The third plot in Figure 3 shows how Skyscraper sets video aside into the buffer during the day when frequently running the expensive knob configuration. We can also see how Skyscraper catches up on processing the buffered video at 5PM, when the workload decreases. The buffer has a size of 4GB and is full at around 2 PM. When it is full, Skyscraper decides to offload some work to the cloud which is reflected by the rising amount of cloud credits spent in the bottom figure (note that the Y axis shows the percentage of the daily cloud budget that has been spent). We can see that Skyscraper's spending comes close to what it planned for that day. 5 0.51.0quality(rel. to best)Expensive conf.Medium conf.Cheap conf.12workload(TFLOP/s)024bufferuse(GB)buffersize=4GB03691215182124time of day0.00.51.0cloud$(spent / plan) achieve on content belonging to c. We denote the cluster center as [q ual (k, c) is the average quality (cid:99) that k will achieve on videos categorized as c. ual (k | K |, c)], where q (cid:99) ual (k1, c), ...q (cid:99) We evaluate choices for the number of categories (k of KMeans) in Appendix I.1 and find that Skyscraper is not very sensitive to k as long as it is not too small (e.g. ≥ 3). Furthermore, it is easy to tune such hyperparameters during the offline phase. 3.3 Train the forecasting model Skyscraper trains a forecasting model F to predict how frequently each content category c ∈ C appears in the near future time interval given their frequency in the most recent history. F allows Skyscraper to effectively ration computational resources and optimally allocate them for different video content categories to come. We denote the forecasted time interval as the planned interval. Skyscraper uses a simple feed-forward neural network as fore- casting model F . We find this to be sufficient and describe its ar- chitecture in Appendix K. Let r (T ) be |C|-dimensional histogram representing the frequency each category c ∈ C appears over time interval T . The output of F is thus r (PI ) where PI is the planned interval. The input to F is the content histograms of the most re- cently ingested data. We split the most recent time interval Tinput into n equally-sized intervals Tinput = [T1, ...,Tn] and provide their category occurring frequency [r (T1 ), ..., r (Tn ) ] as time-series inputs to F . We evaluate choices of Tinput and n in Appendix I.3 and find that Skyscraper is not very sensitive to them as long as both Tinput and n are reasonably large (i.e. Tinput is a couple of days and is split into intervals of a couple of hours). Skyscraper pre-trains F in the offline phase using the unlabeled data, which we describe the detail in Appendix H. Furthermore, F can be fine-tuned in the online phase using the recently ingested data to provide more accurate forecasting. 4 ONLINE VIDEO INGESTION After completing the offline learning phase, Skyscraper is ready to in- gest live video streams. During live ingestion, Skyscraper uses both a predictive component (knob planner) and a reactive component (knob switcher) to make knob tuning decisions. The predictive knob planner periodically forecasts trends in the video content and lets Skyscraper make knob tuning decisions with the future workload in mind. This allows Skyscraper to put the provisioned compute resources to optimal use and prevents premature use of buffer space and cloud credits, making use of expensive knob configurations when they have the greatest impact. However, while it is possible to forecast long-term trends in the content, the exact short-term oc- currence of content is subject to substantial noise. Thus, Skyscraper also uses a reactive knob switcher that switches between knob con- figurations based on the current content. The knob switcher presents a way to leverage the forecasted workload trends while being ro- bust to short-term noise. In the following section, we describe the algorithms used for both the knob planner and the knob switcher. 4.1 Knob planner The knob planner computes a knob plan that specifies which knob configurations k ∈ K to use for each content categories c ∈ C to maximize the overall result quality given the available compute resources. Such assignment of knob configurations to c is based on the forecasted content distribution, which specifies how frequently each knob configuration will appear over the forecasted interval. Recall from Section 3.3, we refer to this interval as the the planned interval. We find that accurate forecasts can be achieved a couple of days into the future and consequently re-compute the knob plan every couple of days using a fresh forecast. Formally, the knob plan generates a histogram αc over knob configurations K for each content category c ∈ C. αc determines how often a knob configuration k ∈ K should be used for processing content of category c - i.e., there is one bucket in the histogram for each knob configuration, indicating the relative frequency with which that configuration should be chosen for the content category. Let αk,c denote the frequency that histogram αc assigns to knob k ∈ K (i.e., how often knob k should be used to process the content of category c). A knob plan P is thus defined as the set containing the histograms for all content categories: P = {αc | c ∈ C}. Finding a knob plan that maximizes the result quality under the compute budget involves jointly optimizing the histograms for all content categories. Each category's histogram determines the total re- source consumption for processing content of the category, which in turn determines how many resources are available for the remaining categories. Skyscraper creates a knob plan in two steps. First, the knob planner uses the pre-trained model F from the of- fline phase to forecast how often (the ratio rc described in Section 3) each content category will appear over the planned interval. Second, using the forecasted content ratios rc , Skyscraper for- mulates the assignment of knobs to content categories as a linear program. This allows Skyscraper to find the globally optimal knob plan P. Skyscraper maximizes the expected overall result quality using the content category cluster centers computed in the offline phase. As described in Section 3, each content category c ∈ C is defined by a KMeans cluster center, which is a vector whose i-th ele- ment denotes the average quality q ual (ki, c) that knob configuration (cid:99) ki achieves on the content of category c. Given the average quality of each knob configuration for each content category, the solution of the linear program maximizes the overall expected quality while being constrained by the compute budget budget.4 maximize subject to ∑︁ k,c ∑︁ k,c ∑︁ k αk,c ∗ rc ∗ q ual (k, c) (cid:99) αk,c ∗ rc ∗ cost (k) ≤ budget αk,c = 1, αk,c ≥ 0 ∀c (2) (3) (4) The decision variables of the linear program are αk,c , which determine how often the content of category c should be processed by configuration k and thereby make up the knob plan. The goal of the knob plan is to maximize the overall result quality, which is denoted by Line 2. Line 3 denotes that the total amount of cost should stay below the user-specified budget. Finally, Line 4 enforces that the assigned ratios αk,c add up to 1 for each content category (this is merely for normalization). 4The unit of the compute budget is given in core ∗ s using the on-premise server cores. Skyscraper internally takes care of converting the user-defined cloud credits budget. 6 We use an off-the-shelf solver [75] which is able to find the solution to this linear program in less than a second for the problem sizes encountered by Skyscraper. After finding the optimal value for the decision variables αk,c , we have the knob plan P which tells us how often to use each knob k to process the content of category c in order to achieve maximum quality given the constrained computing resources. In Section 4.2, we show how P can be leveraged to efficiently switch between knob configurations. 4.2 Knob switcher Based on the current video content, the knob switcher reactively determines which knob configuration knext ∈ K to use and which tasks of knext 's task graph Gknext to execute on the cloud and which tasks to execute on-premises. The knob switcher is designed to be lightweight and doesn't induce significant decision overheads, even when run frequently. It decides on the next knob configuration knext and task placement pnext in three simple steps: First, it determines the category ccur ∈ C that the current content belongs to. Second, it looks content category ccur up in the knob plan to obtain the configuration histogram αccur that the knob plan assigns to ccur . Third, the knob switcher picks knob configuration knext based on αccur along with a task placement pnext - the knob switcher hereby guarantees to never overflow the buffer. In the following, we describe how the knob switcher performs each of these steps in more detail. In the first step, the knob switcher determines the category ccur of the current content merely using the reported quality qual ∗ (kcur ) of the current knob configuration kcur . This allows the knob switcher to select a category in a low overhead way, rather than running an expensive processing step on the video directly. Specifically, given qual ∗ (kcur ), the knob switcher selects the current content category ccur as the one whose average quality for kcur (q ual (kcur , ccur )) (cid:99) matches the currently reported quality (qual (k∗)) the closest. The average quality q ual (kcur , c) of kcur for a category c ∈ C is given (cid:99) by c's cluster center (see Section 3.2). This is denoted by Equation 5. ccur = argmin c ∈ C ual (kcur , c) − qual ∗ (kcur )(cid:12) (cid:12) (cid:12)q (cid:12) (cid:99) (5) Note that the knob switcher's content classification is analogous to traditional classification with KMeans but only uses one vector dimension since the other dimensions are unattainable. This works well in Skyscraper's case because the content of different categories will induce different result qualities for all knob configurations. As a result, the quality of one knob configuration is sufficient to discriminate between content categories. We experimentally verify this in Section 5.6. In the second step, the knob switcher then looks up the derived content category ccur in the knob plan P. This yields a histogram αccur dictating how often each knob configuration k ∈ K should be used to process the content of the current category ccur : In the third step, the knob switcher determines the knob config- uration knext that will be used for processing the newly arriving content, together with task placement pnext that determines which tasks of knext 's task graph to execute on the cloud and which ones to execute on-premises. The knob switcher tries to adhere as closely to the planned histogram αccur as possible and therefore keeps a αc for each c ∈ C, which denotes how frequently each histogram (cid:98) knob configuration has actually been used to process the content of 7 category c. To adhere as closely to the knob plan as possible, the knob switcher picks the knob configuration knext that minimizes αccur and αccur . This is denoted by Equa- the difference between (cid:98) tion 6. Finally, the knob switcher picks a placement pnext for knext . Skyscraper picks the cheapest placement of Gknext that does not overflow the buffer. knext = ki with i = argmax 1≤i ≤ | K | (αccur [i] − (cid:98) αccur [i]) (6) It is worth noting that there is an edge case when picking the task placement pnext : Some knob configurations do not possess task placements that run in real-time, even when heavily adding cloud compute. Reasons for this include limited bandwidth to the cloud, high round trip times to the cloud, and limited opportunities for adding parallelism to the DAG execution. If all placements of knext would make Skyscraper's buffer overflow, the knob switcher will choose a different configuration k′ next to be the next one. This knob configuration k′ next is the next less qualitative one compared to knext . Like for knext , the knob switcher will pick the cheapest placement of k′ next that does not overflow the buffer. If all placements of k′ next would overflow the buffer, the knob switcher will recursively apply this procedure of picking the next less qualitative knob configuration until it finds a configuration and task placement that do not overflow the buffer. In summary, the knob switcher uses three steps to find a knob configuration knext ∈ K along with a task placement pnext while adding little runtime overheads to the ingestion process. The knob switcher tries to adhere as closely to the knob plan P as possible, only deviating from the knob plan when this is required to avoid a buffer overflow. This ensures that the knob switcher maximizes the result quality with the given resources. 5 EVALUATION We evaluate Skyscraper on several real-world applications, covering public health monitoring, traffic planning, and social media analysis. We describe these workloads in subsection 5.2. Then, we evaluate Skyscraper on the following aspects: §5.3 What cost savings does Skyscraper achieve versus using a static knob configuration? §5.4 How much do cloud bursting and buffering individually contribute to cost savings in different quality regimes? When do they perform well and when don't they? §5.5 How much decision overhead does Skyscraper impose at different scales? §5.6 How accurate are knob planner and knob switcher, and what effect do inaccuracies have on Skyscraper's end-to- end performance? We further evaluate different hyperparameter choices of Skyscraper in Appendix I (e.g., number of content categories (KMeans clusters), periodicity of running the knob switcher, and more). We hereby find that Skyscraper's end-to-end performance is insensitive to many of the hyperparameters as long as they are within a reasonable range. Implementation 5.1 We implement Skyscraper in Python on top of Ray [59]. We in- stantiate several Ray actors for both the on-premise and the cloud version of each UDF. The number of duplicate actors is based on the number of logical cores of the machine. We only map UDFs to Ray actors; all of Skyscraper's components run in the parent process and synchronize the calls to the actors. We discuss implementation choices in more detail in Appendix N. We use AWS Lambda [69] to run UDFs in the cloud and provision 3GB of memory for each cloud function. To simulate incoming video streams in real time, we read video frames from the disk and pause appropriately between frames to guarantee 30 fps streaming rate. All workloads are compute-bound and we find in Appendix, that in our experiments decode only amounted to 5% of the overall runtime. The streamed video is encoded in H.264 [64] and has a resolution of 1280 × 720 (HD). In our experiments, each frame is decoded when arriving in the system (as part of the user code). When sending full or partial frames to the cloud, we compress them to JPEG-1 format [14]. We then serialize the JPEG using Base64 [38] and send the string as part of an HTTPS request. The overhead for encoding and decoding is negligible compared to the transfer time saved through compression. 5.2 Workloads We evaluate Skyscraper using three workloads on public health monitoring, traffic planning, and social media analysis. They cover a diverse set of computer vision primitives including object detectors, trackers, and classifiers, as described below. COVID-19 safety measures (COVID) During the coronavirus pandemic, decision-makers have executed several safety measures to slow down the spread of the virus. Such measures include wear- ing facial masks and social distancing. Measuring where and how strictly people adhere to these measures can be used for decision- making and informing people at risk. The COVID workload consists of a YOLOv5 object detector [62] to detect pedestrians and a KCF tracker [31] to track the detected pedestrians ("detect-to-track"). Af- ter the detection, for each detected pedestrian, the workload employs homography [18] to measure the pedestrian's distance from others. This workload contains the following knobs: 1) frame rate at which video is processed ({30FPS, 15FPS, 10FPS, 5FPS, 1FPS}), 2) object detection rate to run object detector (every {1, 5, 30, 60} frames) and 3) tiling for object detection that slices the frames into ({1x1, 2x2}) tiles. The detailed semantics of these knobs are provided in Appendix J. The workload is executed on an 8-day video stream of a busy shopping street in Tokyo.5We measure quality in terms of the number of people detected and tracked over time as YOLO has a low false positive rate and KCF trackers reliably report tracking errors. Multi-object tracking (MOT) Multi-object tracking (MOT) is a key primitive in many video analytical pipelines. In this workload, we adopt the recent state-of-the-art TransMOT [15] tracker on MOT benchmark [22] and introduce four tunable knobs: 1) frame rate (every {1, 5, 30, 60} frames), 2) number of tiles ({1x1, 2x2} tiling), 3) length of history denoting the number of historical frames ({1, 2, 3, 5}) as the TransMOT input, and 4) model size ({small, medium, large}) that specifies different parameter sizes of the pre-trained TransMOT. The details of TransMOT and its tunable knobs are provided in Appendix J. We run MOT on a stream of a traffic intersection, Shibuya in Tokyo to track pedestrians for 8 days. MOT's processing quality is defined as the sum of tracked pedestrians weighted by the model's reported certainty. With this quality metric, we want to evaluate how Skyscraper maximizes model certainty as a proxy for accuracy as proposed in prior work [55, 63]. Multi-modal opinion sentiment and emotion intensity (MOSEI) This workload is synthetic and simulates a video stream analysis application on Twitch. The number of incoming streams varies over time and mimics the number of live Twitch streams over two days.6 We further introduce two types of spikes to evaluate Skyscraper under difficult conditions: • MOSEI-HIGH: We introduce high but short peaks in workload, consisting of 62 concurrently incoming video streams. This makes cloud bursting difficult due to bandwidth limitations. • MOSEI-LONG: We introduce a long peak of continuous work- load. In this case, the buffer alone cannot handle all the extra work. We use the CMU-MOSEI [7] dataset to simulate incoming video streams, as it has ground truth labels that allow us to train the models used in the workload. It contains various talking head videos from YouTube. The task of the MOSEI workload is to classify the opinion sentiment of the speaker using both the audio and the visual con- tent. CMU-MOSEI provides extracted features from the video with ground-truth labels. We trained a neural network on CMU-MOSEI's training set and used its test set to evaluate Skyscraper. MOSEI workload contains the four knobs: 1) frame rate, 2) fre- quency of sentiment analysis that we may run sentimental analysis model once every {1, 2, 3, 4, 5, 6, 7} sentences of the spoken audio and video, 3) model size of the sentimental analysis model, and 4) the number of streams to analyze. Further details about this dataset, the entity extraction DAG, and the tunable knobs are presented in Section J in the Appendix. We evaluate the processing quality as the weighted sum over the ingested streams weighted on model's reported certainty. Due to space limitation, we describe the hyperparameters of Skyscraper for all four workloads in Appendix I. 5.3 Cost efficiency In this section, we evaluate the end-to-end cost savings that Skyscraper achieves on these workloads. We hereby compare Skyscraper to two baselines. The Static baseline processes the video streams stati- cally using the same knob configuration throughout the stream. The Chameleon* baseline refers to an adapted version of Chameleon [40]. We equip Chameleon with a buffer and adapt it to set video aside when the provisioned hardware cannot process it in real-time. This allows Chameleon to achieve cost savings, since it doesn't need to be provisioned to handle peak workload. However, Chameleon* is not practical and may easily crash, as its lack of throughput guaran- tees may lead to buffer overflows. We benchmarked Chameleon* on several hardware setups and only report the numbers where it didn't crash during the benchmark. For each system, we report the overall result quality that the system achieves on different hardware set ups. Since we do not have access to a wide range of compute servers, we use Google Cloud VM instances as the provisioned, always-on hardware ("on-premise 5The Koen-Dori street in the Shibuya district: https://youtu.be/gALQR-nsEME 6As recorded by Twitch Tracker at https://twitchtracker.com/statistics/active-streamers 8 Figure 4: Cost-quality trade-off of Skyscraper, Chameleon∗ and statically using the same knob throughout ingestion. servers"). In the case of Skyscraper, which additionally uses AWS Lambda, we have verified that the bandwidth and latencies from the Google Cloud VMs to AWS Lambda realistically reflect the ones of commodity on-premise setups. In our experiments, we consider the following Google Cloud machines: • e2-standard-4: 4 vCPUs, 16 GB memory, 0.14 USD/h • e2-standard-8: 8 vCPUs, 32 GB memory, 0.27 USD/h • e2-standard-16: 16 vCPUs, 64 GB memory, 0.54 USD/h • e2-standard-32: 32 vCPUs, 128 GB memory, 1.07 USD/h • c2-standard-60: 60 vCPUs, 240 GB memory, 2.51 USD/h While these instance types do not possess hardware accelera- tors (e.g., GPUs), we note that there is nothing fundamental about Skyscraper that would prevent users from using hardware different from only CPUs. If a user provisions Skyscraper with a server that contains hardware accelerators, the application's UDFs would need to make sure that the hardware accelerators are used when executing the UDF. In the offline phase, Skyscraper will then just measure the UDF's runtime and work normally without any modifications. Figure 4 visualizes the cost of processing the workloads from Section 5.2 with each system. On average, content category changes occured every 42s for COVID, every 43s for MOT, every 30s for MOSEI HIGH, every 24s for MOSEI LONG. However, all work- loads had some periods with very frequent category changes and others with few category changes. Table 2 in Appendix C further provides the numeric measurements depicted in Figure 4. The total cost of each system is derived from the cost of renting the cloud hardware. In Appendix L, we estimate that the same amount of com- puting costs 1.8× more when using a Google Cloud VM than when using a provisioned on-premise server (this estimate is high and in favor of the baselines). Thus, the total cost of all systems is given by the cost of renting the Google Cloud VMs divided by 1.8 plus the cost of the AWS Lambda workers. Summary. Overall, Skyscraper offers significantly better cost- quality trade-offs than current approaches. Skyscraper's performance benefits are especially large on the MOT workload: Skyscraper is 8.7× cheaper than the static baseline at a comparable quality. Furthermore, Skyscraper is 3.7× cheaper than Chameleon* at a better quality. Chameleon* suffered from large profiling overheads. For the COVID and MOT workload, our results are comparable to what the authors report in the Chameleon paper (2-3× speedup over the static baseline at the highest quality level). For the MOSEI workloads, the profiling overheads were especially large since the expensive knob configurations cause large amounts of work. * Chameleon* is an adapted version of Chameleon [40] that uses a buffer. However, Chameleon* is not practical and would frequently crash in practice due to overflows of the unmanaged buffer. 9 5.4 Ablation study To evaluate how much buffering and cloud bursting individually contribute to the cost savings, we run an ablation study where we independently disable them. Running this ablation study on unsimu- lated hardware is prohibitively expensive (i.e., we need to conduct dozens of measurements as the one in Figure 4), so we can only afford to analyze with simulated results. We use a simple but ac- curate simulator, that we describe in Appendix M.1. We evaluate the accuracy of the simulator on the benchmarked workloads in Appendix M.2 and find that it is reasonably accurate. We use two metrics to evaluate the performance of Skyscraper: (1) The monetary cost of processing the workload. We hereby also evaluate Skyscraper for different cost ratios between the on- premise and the cloud computing. In Appendix L, we estimate that a ratio of 1:1.8 between on-premises and AWS Lambda is realistic at the current market prices. When evaluating the monetary cost, we evaluate four variations of Skyscraper: (1a) No buffering, no cloud: We disable both buffering and cloud bursting. Effectively, this corresponds to not switching knob config- urations and only using the most qualitative knob configuration that runs in real time on the given on-premise server. (1b) Only buffering: Skyscraper may only use placements that place every task on-premise and can not use the cloud. (1c) Only cloud: Skyscraper may use the cloud but not buffering. (1d) Buffering & cloud: This corresponds to standard Skyscraper. (2) The amount of work measured in core ∗ seconds used in the processing. This is independent of whether the computation is buffered or executed on the cloud or on premises. When evaluating the amount of work, we compare Skyscraper to two baselines: (2a) Static: This baseline corresponds to statically using the same knob configuration. It is similar to baseline (1a) where Skyscraper also statically uses the same configuration. (2b) Skyscraper: We measure the amount of work that Skyscraper performs for processing the workload. (2c) Optimum: The optimum baseline fully leverages the ground truth to always choose the optimal knob configuration. Specifically, given the performance of each knob configuration beforehand, it uses the greedy 0-1 knapsack approximation to choose knob config- urations that maximize quality under certain budget. Figures 6, 8, 10, 12 show the cost-quality trade-off curves for the COVID, MOT, MOSEI-HIGH, and MOSEI-LONG workloads. Figures 7, 9, 11, 13 show the work-quality trade-off curves. For the COVID and MOT workload, Only cloud and Only buffer- ing alone can achieve significant speed-ups over the baseline. For both workloads, when combining the two (Buffering & cloud), peak quality can be roughly reached at 1.5× less cost than when only buffering or only using the cloud for a cost ratio of 1.8:1. For 5:2 cost 0.20.40.60.8$0$20$40$60$8000.20.40.60.81$0$20$40$60$800.20.40.60.811.2$0$100$200$3000.20.40.60.811.2$0$100$200$300a) COVID (8 days unsimulated)qualitySkyscraperChameleon* (no throughput guarantees / prone to crashing)Static baselineDollar cost (USD)b) MOT (8 days unsimulated)qualityDollar cost (USD)c) MOSEI-HIGH (2 days simualted)qualityDollar cost (USD)d) MOSEI-LONG (2 days simualted)qualityDollar cost (USD) ratio, Only cloud performs significantly worse, because off-loading work off to the cloud incurs a very high cost. For 1:1 cost ratio, Only cloud matches the performance of Buffering & cloud as using cloud resources has the same cost the on-premises computations. For the MOSEI workloads, we can see how Only buffering and Only cloud struggle to deliver good performance for MOSEI-HIGH and MOSEI-LONG, respectively. However, we observe that Buffer- ing & cloud delivers good performance on both. The reason for the bad performance of Only cloud on MOSEI-HIGH is bandwidth limitations that limit the number of social media streams that can be offloaded to the cloud. The reason for the bad performance of Only buffering on MOSEI-LONG is that the buffer gets filled early on, which prevents Skyscraper from using expensive knob configu- rations for the remaining duration of the long workload peak. Finally, Figures 7, 9, 11 show that Skyscraper's work reduc- tion method performs astonishingly close to optimum. Only for the MOSEI-LONG workload (Figure 13) does Skyscraper leave large room for improvement. Summary. To certain extent, the buffering and cloud bursting optimizations are complementary to each other. Specifically, the per- formance improvement of using both over using one of them is not as large as performance difference between them. Therefore, cloud bursting lessens the need for buffering and vice versa. However, Skyscraper can still achieve 1.5× cost savings in the COVID and MOT workloads over only one of the two methods. Furthermore, 10 the MOSEI workloads show that buffering and cloud bursting strug- gle for different kinds of workload spikes. By combining the two, Skyscraper can achieve good performance for both kinds of spikes. 5.5 Runtime overheads Appendix E evaluates the runtime of the offline phase. For the COVID workload, the overall runtime was 1.6 hours on two c2- standard-60 machines. 83% of the time was spent creating the train- ing data for the forecasting model, which is embarrassingly parallel and can be sped up when using more machines. Skyscraper's knob planner and knob switcher add overheads to the online execution time. In this section, we evaluate their runtimes for different amounts of placements, content categories, and knob configurations. All runtime measurements are performed on a single core of the Intel Xeon Gold 6130 CPU running at 2.10GHz. The worst-case runtime of the knob switcher is linear in the total number of placements (for all knob configurations). This worst case is achieved when the knob switcher needs to iterate through all configuration-placement pairs until it finds one that does not overflow the buffer (see Section 4). The left plot in Figure 13 shows the worst-case runtime as the dashed line and the average runtimes of the knob switcher for the COVID, MOT, and MOSEI experiments. The knob planner conducts an inference pass through a small neural network and solves a linear program. For the linear program, the number of variables is |C| ∗ |K | and the number of constraints is 1 + 2 ∗ |C|, where C denotes the number of content categories and K is the number of knob configurations. The right image in 0.20.40.60.8100.20.40.60.810.20.40.60.8100.20.40.60.810.20.40.60.8100.20.40.60.810.20.40.60.8100.20.40.60.810.20.40.60.8100.20.40.60.810.20.40.60.8100.20.40.60.810.20.40.60.8100.20.40.60.810.20.40.60.8100.20.40.60.810.20.40.60.811.200.20.40.60.810.20.40.60.811.200.20.40.60.810.20.40.60.811.200.20.40.60.810.20.40.60.811.200.20.40.60.810.20.40.60.811.200.20.40.60.810.20.40.60.811.200.20.40.60.810.20.40.60.811.200.20.40.60.810.20.40.60.811.200.20.40.60.81a) 1:1 Cloud/on prem cost ratiob) 1.8:1 Cloud/on prem cost ratioc) 5:2 Cloud/on prem cost ratioCOVIDqualityqualityqualityqualityFigure 5: Monetary cost comparison for COVID workloada) 1:1 Cloud/on prem cost ratiob) 1.8:1 Cloud/on prem cost ratioc) 5:2 Cloud/on prem cost ratioMOTqualityqualityqualityqualityFigure 7: Monetary cost comparison for MOT workloadFigure 8: Work (core*s) of MOT workloada) 1:1 Cloud/on prem cost ratiob) 1.8:1 Cloud/on prem cost ratioc) 5:2 Cloud/on prem cost ratioMOSEI-HIGHqualityqualityqualityqualityFigure 9: Monetary cost comparison for MOSEI-HIGH workloadFigure 10: Work (core*s) of MOSEI-HIGH workloadBuffering & CloudOnly CloudOnly bufferingNo buffering, no CloudSkyscr.Optimuma) 1:1 Cloud/on prem cost ratiob) 1.8:1 Cloud/on prem cost ratioc) 5:2 Cloud/on prem cost ratioMOSEI-LONGqualityqualityqualityqualityFigure 11: Monetary cost comparison for MOSEI-LONG workloadFigure 12: Work (core*s) of MOSEI-LONG workloadStatic100.20.40.60.8Normalized cost1100.20.40.60.8Normalized cost1100.20.40.60.8Normalized cost1100.20.40.60.8Normalized cost1100.20.40.60.8Normalized cost1100.20.40.60.8Normalized cost1100.20.40.60.8Normalized work1100.20.40.60.8Normalized work1100.20.40.60.8Normalized cost1100.20.40.60.8Normalized cost1100.20.40.60.8Normalized cost1100.20.40.60.8Normalized work1100.20.40.60.8Normalized cost1100.20.40.60.8Normalized cost1100.20.40.60.8Normalized cost1100.20.40.60.8Normalized work1Figure 6: Work (core*s) of COVID workload Figure 13: Overheads: knob switcher (<1ms) and planner (<1s) Figure 13 uses the heat map to visualize the overheads caused by the knob planner for different amounts of content categories and knob configurations. This image also shows the actual runtime of knob planner on the three workloads. Summary. For common problem such as the COVID, MOT, and MOSEI workloads, the overheads of both the knob switcher and knob planner are negligible. While the knob switcher runs every few seconds, its runtime is typically below a millisecond. Similarly, the knob planner typically runs every few days but with a runtime below a second. We also show that the runtime overhead of our optimization is reasonable for more complicated workloads. 5.6 Microbenchmarks This subsection evaluates how accurately Skyscraper's forecasting model F can predict the future content distribution and how sen- sitive Skyscraper's performance is to inaccuracies in the forecast. Similarly, the subsection evaluates the accuracy at which the knob switcher classifies the video content into a content category c ∈ C and how sensitive Skyscraper's performance is to misclassifications. In our evaluation, we focus on the real-world workloads COVID and MOT. The MOSEI workloads are synthetically created by inducing workload spiking patterns as described in Section 5.2. While these workloads present especially difficult spiking patterns for buffering and cloud bursting, the forecasting model achieves 100% accuracy and the knob switcher particularly high performance due to the regu- larity and smoothness of their workload peaks. We therefore do not evaluate them in terms of accuracy in this subsection. Forecasting model We evaluate the forecasting model on 8 days of test data after training it on 16 days of unlabeled training data. We train and evaluate the forecasting model on four different lengths of the planned interval: {1, 2, 4, 8} days. As described in Section 4.1, the length of the planned interval determines the frequency of run- ning knob planner and how long F needs to forecast into the future. We find that for both workloads, Skyscraper's forecasting method achieves a low Mean Absolute Error (MAE) when forecasting 1 to 4 days into the future. We denote the MAE values in Appendix I.3. For both workloads, the lowest MAE was achieved when forecasting 2 days into the future, while the largest MAE was incurred when doing so for 8 days. There is a sweet spot on how far to forecast into the future but this sweet spot is unrelated to the frequency of content category changes. Forecasting over very large time intervals is hard because events far in the future become increasingly uncorrelated to the current events, which the forecast is based on. On the other hand, forecasting over too short time periods is also hard: The streamed video content is 11 Figure 14: The effect of different planned interval lengths on Skyscraper's end-to-end performance always subject to a certain amount of randomness (e.g. a large group of people randomly walking past a camera). Over large enough time intervals, this randomness is smoothed out, which makes the forecast more precise. When this smoothing effect is not achieved, errors due to unforeseen randomness will be noticeable in the MAE of the predictions. The high MAE when forecasting 8 days into the future shows that forecasting far into the future is difficult as events become increasingly uncorrelated to the current events, which the forecast is based on. On the other hand, forecasting over too short time periods also leads to higher MAEs: Streamed video content is always subject to a certain amount of randomness (e.g. a large group of people randomly walking past a camera). Over large enough time intervals, this randomness is smoothed out and therefore doesn't show in the MAE, which doesn't occur for forecasts over short periods. Figure 14 shows the impact of the prediction errors in terms of end-to-end performance. For comparison, we additionally run Skyscraper using the ground truth content distributions instead of forecasting. For planned interval lengths between 1 and 4, Skyscraper's performance is very close to the optimal performance using the ground truth predictions. However, for both workloads Skyscraper performs significantly worse for a planned interval length of 8. Knob switcher As described in Section 4.2, it is possible that the knob switcher misclassifies video content into the wrong content category. We identify two reasons for such misclassifications. First, the knob switcher classifies content based on the quality of one knob configuration. This corresponds to KMeans classification, where a vector is classified using only one dimension instead of all. We denote misclassifications, that occur because of this as Type-A errors. Second, the knob switcher determines the current content category based on the past couple of seconds of the video. It will then switch to a knob configuration that is used for processing the next couple of seconds of video, which creates a time mismatch. The last couple of seconds might belong to a different content category than the next couple of seconds. We denote errors caused by this timing mismatch as Type-B errors. Distinguishing between these two errors lets us gain insight into where performance losses come from, which could be used for further enhancements of Skyscraper. In Figure 15, we denote the standard knob switcher as described in Section 4.2 as Standard and compare it against two baselines: Ground truth denoting Skyscraper using the ground truth content categories and No Type-B errors denotes a baseline that partially uses the ground truth to eliminate errors of Type-B. Specifically, it determines the content category using Skyscraper's standard ap- proach but on the data of a future couple of seconds (i.e., it knows how the current knob configuration would perform in the next couple of seconds without executing it). Like this, only errors of Type-A 1513119753100.20.40.60.811.21.41.60200040006000800010000Runtime (ms)PlacementsRuntime Knob SwitcherRuntime Knob PlannerCOVIDMOTMOSEI5 35 65 95 125 1551.751.501.251.000.750.500.25Content categoriesRuntime (s)Knob configurations0.50.70.91.100.51qualityquality0.50.70.91.100.51Ground truth1 day forecast2 day forecast4 day forecast8 day forecast00.51.000.51.0NormalizedbudgetNormalizedbudgetCOVIDMOT solely based on the concurrently running queries (while being agnos- tic to the streamed content). These systems are useful in scenarios where users issue dynamic queries over video streams, which require the system to dynamically multiplex compute resources among the queries. VideoStorm [81] and VideoEdge [35] go beyond dynamic resource allocation and also tune the queries' knobs based on the other queries that are concurrently running. However, in scenarios where the query load remains static, there is no benefit in dynam- ically adapting to the query load. In V-ETL, a constant set of jobs is used to ingest the video streams. In contrast to VideoStorm and VideoEdge, Skyscraper therefore dynamically adapts to changes in the video content instead of the query load. Streaming ETL. Treating data warehouse ingestion as a state- ful stream processing problem is an established approach [25], which is successfully used in many big data applications [56]. Like Skyscraper, traditional streaming ETL is also concerned with main- taining data quality while handling fluctuating workloads without peak provisioning. This is typically achieved through methods like back pressure or load shedding, which mitigate workload peaks arising from fluctuating volumes of arriving data [72]. However, in V-ETL, data often arrives at constant volume, and only the content of the data changes. In contrast to traditional streaming systems, Skyscraper 's optimizations therefore focus on adapting to the con- tent of the streamed data and not to its volume. General-purpose cloud offloading. Several works have previ- ously explored the idea of offloading work from an on-premise server to on-demand cloud workers [1, 17, 19, 26, 37, 48, 50, 83]. These works assume that jobs occasionally arrive and these jobs may be executed locally or offloaded to the cloud. However, these works only optimize the placement of work and do not reduce work by means like knob tuning, which is Skyscraper's main optimization. Task-specific computer vision optimizations. Several works op- timize the application of CV for specific tasks and queries. While these methods cannot be used to optimize arbitrary V-ETL jobs, they can be used inside Skyscraper's UDFs to further reduce cost. General methods to improve the efficiency of neural networks in- clude model compression [27, 49], compact neural architectures, [36, 51, 62], and knowledge distillation [6, 32, 44, 74]. Further works propose efficient CV primitives that are query-aware or content- adaptive [5, 10, 11, 13, 39, 44, 76]. Finally, some works reduce processing costs of certain video queries by intelligently skipping frames [8, 30, 33, 43, 45, 46, 54, 58, 80]. 7 CONCLUSION In this paper, we defined the problem of V-ETL for transforming video streams to a queryable format through expensive ML-based video processing DAGs. In response, we introduced Skyscraper, which uses content-adaptive knob tuning to reduce the cost of the V-ETL Transform step while adhering to V-ETL's throughput re- quirements on constrained hardware resources. Skyscraper supports conversions to arbitrary query formats. ACKNOWLEDGMENTS We thank the Data Systems and Artificial Intelligence Lab (DSAIL) for supporting this work. Figure 15: End-to-end performance of knob switcher against baselines that leverage ground truth for content classification impede the performance of the No Type-B errors baseline, which shows their impact on Skyscraper's end-to-end performance. Figure 15 shows that the knob switcher's misclassifications have a negative impact on Skyscraper's end-to-end performance when using the Standard. The misclassification rate of Standard is 2.1% on COVID and 6.6% on the MOT workload. However, the performance of the No Type-B errors baseline almost matches the optimum. This suggests that the remaining Type-A errors barely impede the overall performance. These errors constitute 0.5% of the knob switcher's error rate on COVID and 3.7% on the MOT workload. Summary The microbenchmarks provide two insights. First, when forecasting between 1 to 4 days into the future, Skyscraper's fore- casting method is accurate and does not significantly harm end- to-end performance when compared to using the ground truth as forecast. However, when forecasting further into the future (e.g., 8 days), the forecasts become less accurate, which shows an effect on Skyscraper's end-to-end performance. Second, misclassifications of the knob switcher negatively impact Skyscraper's performance. We hereby identify a time mismatch as the sole driver for the per- formance losses. This timing mismatch occurs because the knob configuration to process the next couple of seconds with is based on the content of the last couple of seconds. 6 RELATED WORK The cost problem of video processing has previously been recog- nized [65, 66]. While we are not aware of past research which man- ages video streams like in a data warehouse, several systems propose end-to-end solutions for managing archived collections of video like in a relational database system [9, 20, 28, 41, 42, 47, 53, 78, 79]. Likewise, we are not aware of past work that directly addresses the V-ETL problem, but there are several lines of work on efficient video processing that are relevant to Skyscraper. Content-adaptive knob tuning systems. Content-adaptive knob tuning systems aim at saving computational work by dynamically adjusting knobs that are inherent to CV workloads to the video stream's content. Chameleon performs content-adaptive knob tun- ing for general CV workloads [40]. However, Chameleon assumes that each knob configuration can be run in real-time on the provi- sioned hardware resources ("peak provisioning"). Chameleon then minimizes the average processing time per frame. As discussed in Section 1, such systems cannot deliver cost savings while also ad- hering to throughput guarantees, which is required in the V-ETL problem. Zeus is another content-adaptive knob tuning system [16], but cannot be used for general-purpose V-ETL, as it is specific to action detection (e.g., detect someone crossing the street). Query-load-adaptive knob tuning systems. Instead of adapting to the streamed content, some systems tune the knobs of a CV workload 12 0.50.70.91.100.51COVIDqualityquality0.50.70.91.100.51MOTGround truthNo Type-B errorsStandard00.51.0Normalizedcost00.51.0Normalizedcost REFERENCES [1] Sándor Ács, Miklós Kozlovszky, and Péter Kacsuk. 2014. A novel cloud bursting technique. 2014 IEEE 9th IEEE International Symposium on Applied Computa- tional Intelligence and Informatics (SACI) (2014), 135–138. [2] Ravichandra Addanki, Shaileshh Bojja Venkatakrishnan, Shreyan Gupta, Hongzi Mao, and Mohammad Alizadeh. 2019. Placeto: Learning generalizable de- vice placement algorithms for distributed machine learning. arXiv preprint arXiv:1906.08879 (2019). [3] Paavo Alku, Tom Bäckström, and Erkki Vilkman. 2002. Normalized amplitude quotient for parametrization of the glottal flow. The Journal of the Acoustical Society of America 112, 2 (2002), 701–710. https://doi.org/10.1121/1.1490365 arXiv:https://doi.org/10.1121/1.1490365 [4] Paavo Alku, Helmer Strik, and Erkki Vilkman. 1997. Parabolic spectral parameter - A new method for quantification of the glottal flow. Speech Communication 22, 1 (1997), 67–79. https://doi.org/10.1016/S0167-6393(97)00020-4 [5] Michael R. Anderson, Michael Cafarella, German Ros, and Thomas F. Wenisch. 2019. Physical Representation-Based Predicate Optimization for a Visual Analyt- ics Database. In 2019 IEEE 35th International Conference on Data Engineering (ICDE). IEEE. https://doi.org/10.1109/icde.2019.00132 [6] Rohan Anil, Gabriel Pereyra, Alexandre Passos, Róbert Ormándi, George E. Dahl, and Geoffrey E. Hinton. 2018. Large scale distributed neural network training through online distillation. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net. https://openreview.net/forum? id=rkr1UDeC- [7] AmirAli Bagher Zadeh, Paul Pu Liang, Soujanya Poria, Erik Cambria, and Louis- Philippe Morency. 2018. Multimodal Language Analysis in the Wild: CMU- MOSEI Dataset and Interpretable Dynamic Fusion Graph. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). Association for Computational Linguistics, Melbourne, Australia, 2236–2246. https://doi.org/10.18653/v1/P18-1208 [8] Jaeho Bang, Pramod Chunduri, and Joy Arulraj. 2021. EKO: Adaptive Sampling of Compressed Video Data. https://doi.org/10.48550/ARXIV.2104.01671 [9] Jaeho Bang, Gaurav Tarlok Kakkar, Pramod Chunduri, Subrata Mitra, and Joy Arulraj. 2023. Seiden: Revisiting Query Processing in Video Database Systems. Proc. VLDB Endow. 16, 9 (jul 2023), 2289–2301. https://doi.org/10.14778/ 3598581.3598599 [10] Favyen Bastani, Songtao He, Arjun Balasingam, Karthik Gopalakrishnan, Mo- hammad Alizadeh, Hari Balakrishnan, Michael Cafarella, Tim Kraska, and Sam Madden. 2020. MIRIS: Fast Object Track Queries in Video. In Proceedings of the 2020 ACM SIGMOD International Conference on Management of Data (Portland, OR, USA) (SIGMOD '20). Association for Computing Machinery, New York, NY, USA, 1907–1921. https://doi.org/10.1145/3318464.3389692 [11] Favyen Bastani and Samuel Madden. 2022. OTIF: Efficient Tracker Pre- Processing over Large Video Datasets. In Proceedings of the 2022 Interna- tional Conference on Management of Data (Philadelphia, PA, USA) (SIGMOD '22). Association for Computing Machinery, New York, NY, USA, 2091–2104. https://doi.org/10.1145/3514221.3517835 [12] Adnane Cabani, Karim Hammoudi, Halim Benhabiles, and Mahmoud Melkemi. 2021. MaskedFace-Net – A dataset of correctly/incorrectly masked face images in the context of COVID-19. Smart Health 19 (2021), 100144. https://doi.org/ 10.1016/j.smhl.2020.100144 [13] Jiashen Cao, Ramyad Hadidi, Joy Arulraj, and Hyesoon Kim. 2021. THIA: Accelerating Video Analytics using Early Inference and Fine-Grained Query Planning. https://doi.org/10.48550/ARXIV.2102.08481 [14] CCITT. 1992. Digital compression and coding of continuous-tone still images - requirements and guidelines. https://www.w3.org/Graphics/JPEG/itu-t81.pdf. [15] Peng Chu, Jiang Wang, Quanzeng You, Haibin Ling, and Zicheng Liu. 2021. TransMOT: Spatial-Temporal Graph Transformer for Multiple Object Tracking. https://doi.org/10.48550/ARXIV.2104.00194 [16] Pramod Chunduri, Jaeho Bang, Yao Lu, and Joy Arulraj. 2022. Zeus: Efficiently Localizing Actions in Videos Using Reinforcement Learning. In Proceedings of the 2022 International Conference on Management of Data (Philadelphia, PA, USA) (SIGMOD '22). Association for Computing Machinery, New York, NY, USA, 545–558. https://doi.org/10.1145/3514221.3526181 [17] Li Chunlin, Tang Jianhang, and Luo Youlong. 2019. Hybrid Cloud Adaptive Scheduling Strategy for Heterogeneous Workloads. Journal of Grid Computing 17, 3 (01 Sep 2019), 419–446. https://doi.org/10.1007/s10723-019-09481-3 [18] A. Criminisi, I. Reid, and A. Zisserman. 1999. A plane measuring device. Image and Vision Computing 17, 8 (1999), 625–634. https://doi.org/10.1016/S0262- 8856(98)00183-8 [19] A. Das, A. Leaf, C. A. Varela, and S. Patterson. 2020. Skedulix: Hybrid Cloud Scheduling for Cost-Efficient Execution of Serverless Applications. In 2020 IEEE 13th International Conference on Cloud Computing (CLOUD). IEEE Computer Society, Los Alamitos, CA, USA, 609–618. https://doi.org/10.1109/ CLOUD49709.2020.00090 [20] Maureen Daum, Brandon Haynes, Dong He, Amrita Mazumdar, and Magdalena Balazinska. 2021. TASM: A tile-based storage manager for video analytics. In 2021 IEEE 37th International Conference on Data Engineering (ICDE). IEEE, 1775–1786. [21] A. P. Dempster, N. M. Laird, and D. B. Rubin. 1977. Maximum Likelihood from Incomplete Data via the EM Algorithm. Journal of the Royal Statistical Society. Series B (Methodological) 39, 1 (1977), 1–38. http://www.jstor.org/ stable/2984875 [22] P. Dendorfer, H. Rezatofighi, A. Milan, J. Shi, D. Cremers, I. Reid, S. Roth, K. Schindler, and L. Leal-Taixé. 2020. MOT20: A benchmark for multi object tracking in crowded scenes. arXiv:2003.09003[cs] (March 2020). http://arxiv. org/abs/1906.04567 arXiv: 2003.09003. [23] Thomas Drugman and Abeer Alwan. 2020. Joint Robust Voicing Detection and Pitch Estimation Based on Residual Harmonics. https://doi.org/10.48550/ARXIV. 2001.00459 [24] Thomas Drugman, Mark Thomas, Jon Gudnason, Patrick Naylor, and Thierry Dutoit. 2012. Detection of Glottal Closure Instants From Speech Signals: A Quan- titative Review. IEEE Transactions on Audio, Speech, and Language Processing 20, 3 (2012), 994–1006. https://doi.org/10.1109/TASL.2011.2170835 [25] Lukasz Golab and Theodore Johnson. 2013. Data stream warehousing. In ACM SIGMOD Conference. 949–952. [26] Tian Guo, Upendra Sharma, Timothy Wood, Sambit Sahu, and Prashant Shenoy. 2012. Seagull: Intelligent Cloud Bursting for Enterprise Applications. In 2012 USENIX Annual Technical Conference (USENIX ATC 12). USENIX Associa- tion, Boston, MA, 361–366. https://www.usenix.org/conference/atc12/technical- sessions/presentation/guo [27] Song Han, Huizi Mao, and William J. Dally. 2016. Deep Compression: Com- pressing Deep Neural Network with Pruning, Trained Quantization and Huffman Coding. In 4th International Conference on Learning Representations, ICLR 2016, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, Yoshua Bengio and Yann LeCun (Eds.). http://arxiv.org/abs/1510.00149 [28] Brandon Haynes, Maureen Daum, Dong He, Amrita Mazumdar, Magdalena Balazinska, Alvin Cheung, and Luis Ceze. 2021. Vss: A storage system for video analytics. In Proceedings of the 2021 International Conference on Management of Data. 685–696. [29] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. 2016. Deep resid- ual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition. 770–778. [30] Wenjia He, Michael R. Anderson, Maxwell Strome, and Michael Cafarella. 2020. A Method for Optimizing Opaque Filter Queries. In Proceedings of the 2020 ACM SIGMOD International Conference on Management of Data (Portland, OR, USA) (SIGMOD '20). Association for Computing Machinery, New York, NY, USA, 1257–1272. https://doi.org/10.1145/3318464.3389766 [31] João F. Henriques, Rui Caseiro, Pedro Martins, and Jorge Batista. 2015. High- Speed Tracking with Kernelized Correlation Filters. IEEE Transactions on Pattern Analysis and Machine Intelligence 37, 3 (2015), 583–596. https://doi.org/10. 1109/TPAMI.2014.2345390 [32] Geoffrey E. Hinton, Oriol Vinyals, and Jeffrey Dean. 2015. Distilling the Knowl- edge in a Neural Network. CoRR abs/1503.02531 (2015). arXiv:1503.02531 http://arxiv.org/abs/1503.02531 [33] Kevin Hsieh, Ganesh Ananthanarayanan, Peter Bodik, Shivaram Venkataraman, Paramvir Bahl, Matthai Philipose, Phillip B. Gibbons, and Onur Mutlu. 2018. Focus: Querying Large Video Datasets with Low Latency and Low Cost. In 13th USENIX Symposium on Operating Systems Design and Implementation (OSDI 18). USENIX Association, Carlsbad, CA, 269–286. https://www.usenix.org/ conference/osdi18/presentation/hsieh [34] David Huggins Daines, M. Kumar, A. Chan, A.W. Black, M. Ravishankar, and Alexander Rudnicky. 2006. Pocketsphinx: A Free, Real-Time Continuous Speech Recognition System for Hand-Held Devices. International Conference on Acous- tics, Speech, and Signal Processing. https://doi.org/10.1109/ICASSP.2006. 1659988 [35] Chien-Chun Hung, Ganesh Ananthanarayanan, Peter Bodík, Leana Golubchik, Minlan Yu, Victor Bahl, and Matthai Philipose. 2018. VideoEdge: Pro- cessing Camera Streams using Hierarchical Clusters. In ACM/IEEE Sympo- sium on Edge Computing (SEC) (acm/ieee symposium on edge computing (sec) ed.). https://www.microsoft.com/en-us/research/publication/videoedge- processing-camera-streams-using-hierarchical-clusters/ [36] Forrest N. Iandola, Song Han, Matthew W. Moskewicz, Khalid Ashraf, William J. Dally, and Kurt Keutzer. 2016. SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and 0.5MB model size. https://doi.org/10.48550/ARXIV.1602. 07360 [37] Mohammad A. Ibrahim, Gamal A. Ebrahim, and Hoda K. Mohamed. 2017. A modern cloud bursting framework. In 2017 12th International Conference on Computer Engineering and Systems (ICCES). 148–153. https://doi.org/10.1109/ ICCES.2017.8275294 IETF. 2006. The Base16, Base32, and Base64 Data Encodings. https://datatracker. ietf.org/doc/html/rfc4648 (accessed on 7 March 2023). [38] 13 [39] Samvit Jain, Xun Zhang, Yuhao Zhou, Ganesh Ananthanarayanan, Junchen Jiang, Yuanchao Shu, Victor Bahl, and Joseph Gonzalez. 2020. Spatula: Efficient cross-camera video analytics on large camera net- In ACM/IEEE Symposium on Edge Computing (SEC 2020). works. https://www.microsoft.com/en-us/research/publication/spatula-efficient- cross-camera-video-analytics-on-large-camera-networks/ [40] Junchen Jiang, Ganesh Ananthanarayanan, Peter Bodik, Siddhartha Sen, and Ion Stoica. 2018. Chameleon: Scalable Adaptation of Video Analytics. In Proceedings of the 2018 Conference of the ACM Special Interest Group on Data Communica- tion (Budapest, Hungary) (SIGCOMM '18). Association for Computing Machin- ery, New York, NY, USA, 253–266. https://doi.org/10.1145/3230543.3230574 [41] Gaurav Tarlok Kakkar, Jiashen Cao, Pramod Chunduri, Zhuangdi Xu, Sury- atej Reddy Vyalla, Prashanth Dintyala, Anirudh Prabakaran, Jaeho Bang, Aubhro Sengupta, Kaushik Ravichandran, Ishwarya Sivakumar, Aryan Rajoria, Ash- mita Raju, Tushar Aggarwal, Abdullah Shah, Sanjana Garg, Shashank Suman, Myna Prasanna Kalluraya, Subrata Mitra, Ali Payani, Yao Lu, Umakishore Ra- machandran, and Joy Arulraj. 2023. EVA: An End-to-End Exploratory Video Analytics System. In Proceedings of the Seventh Workshop on Data Manage- ment for End-to-End Machine Learning (Seattle, WA, USA) (DEEM '23). As- sociation for Computing Machinery, New York, NY, USA, Article 8, 5 pages. https://doi.org/10.1145/3595360.3595858 [42] Gaurav Tarlok Kakkar, Aryan Rajoria, Myna Prasanna Kalluraya, Ashmita Raju, Jiashen Cao, Kexin Rong, and Joy Arulraj. 2023. Interactive Demonstration of EVA. Proc. VLDB Endow. 16, 12 (sep 2023), 4082–4085. https://doi.org/10. 14778/3611540.3611626 [43] Daniel Kang, Peter Bailis, and Matei Zaharia. 2018. BlazeIt: Optimizing Declara- tive Aggregation and Limit Queries for Neural Network-Based Video Analytics. (2018). https://doi.org/10.48550/ARXIV.1805.01046 [44] Daniel Kang, John Emmons, Firas Abuzaid, Peter Bailis, and Matei Zaharia. 2017. NoScope: Optimizing Neural Network Queries over Video at Scale. https: //doi.org/10.48550/ARXIV.1703.02529 [45] Daniel Kang, John Guibas, Peter Bailis, Tatsunori Hashimoto, Yi Sun, and Matei Zaharia. 2021. Accelerating Approximate Aggregation Queries with Expensive Predicates. Proc. VLDB Endow. 14, 11 (jul 2021), 2341–2354. https://doi.org/10. 14778/3476249.3476285 [46] Daniel Kang, John Guibas, Peter D. Bailis, Tatsunori Hashimoto, and Matei Zaharia. 2022. TASTI: Semantic Indexes for Machine Learning-Based Queries over Unstructured Data. In Proceedings of the 2022 International Conference on Management of Data (Philadelphia, PA, USA) (SIGMOD '22). Association for Computing Machinery, New York, NY, USA, 1934–1947. https://doi.org/10. 1145/3514221.3517897 [47] Daniel Kang, Francisco Romero, Peter Bailis, Christos Kozyrakis, and Matei Zaharia. 2022. VIVA: An End-to-End System for Interactive Video Analytics. In Conference on Innovative Data Systems Research (CIDR)). [48] Young Choon Lee and Bing Lian. 2017. Cloud Bursting Scheduler for Cost Efficiency. In 2017 IEEE 10th International Conference on Cloud Computing (CLOUD). 774–777. https://doi.org/10.1109/CLOUD.2017.112 [49] Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. 2017. Pruning Filters for Efficient ConvNets. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net. https://openreview.net/forum? id=rJqFGTslg [50] Rui Li, Zhi Zhou, Xu Chen, and Qing Ling. 2022. Resource Price-Aware Offloading for Edge-Cloud Collaboration: A Two-Timescale Online Control IEEE Transactions on Cloud Computing 10, 1 (2022), 648–661. Approach. https://doi.org/10.1109/TCC.2019.2937928 [51] Min Lin, Qiang Chen, and Shuicheng Yan. 2014. Network In Network. In 2nd International Conference on Learning Representations, ICLR 2014, Banff, AB, Canada, April 14-16, 2014, Conference Track Proceedings, Yoshua Bengio and Yann LeCun (Eds.). http://arxiv.org/abs/1312.4400 [52] S. Lloyd. 1982. Least squares quantization in PCM. IEEE Transactions on Information Theory 28, 2 (1982), 129–137. https://doi.org/10.1109/TIT.1982. 1056489 [53] Yao Lu, Aakanksha Chowdhery, and Srikanth Kandula. 2016. Optasia: A rela- tional platform for efficient large-scale video analytics. In Proceedings of the Seventh ACM Symposium on Cloud Computing. 57–70. [54] Yao Lu, Aakanksha Chowdhery, Srikanth Kandula, and Surajit Chaudhuri. 2018. Accelerating Machine Learning Inference with Probabilistic Predicates. In Pro- ceedings of the 2018 International Conference on Management of Data (Houston, TX, USA) (SIGMOD '18). Association for Computing Machinery, New York, NY, USA, 1493–1508. https://doi.org/10.1145/3183713.3183751 [55] M D McKay. 1995. Evaluating prediction uncertainty. (3 1995). https://doi.org/ 10.2172/29432 [56] John Meehan, Cansu Aslantas, Stan Zdonik, Nesime Tatbul, and Jiang Du. 2017. Data Ingestion for the Connected World. In CIDR. [57] Azalia Mirhoseini, Hieu Pham, Quoc V Le, Benoit Steiner, Rasmus Larsen, Yuefeng Zhou, Naveen Kumar, Mohammad Norouzi, Samy Bengio, and Jeff Dean. 2017. Device placement optimization with reinforcement learning. In International Conference on Machine Learning. PMLR, 2430–2439. [58] Oscar Moll, Favyen Bastani, Sam Madden, Mike Stonebraker, Vijay Gadepally, and Tim Kraska. 2020. ExSample: Efficient Searches on Video Repositories through Adaptive Sampling. https://doi.org/10.48550/ARXIV.2005.09141 [59] Philipp Moritz, Robert Nishihara, Stephanie Wang, Alexey Tumanov, Richard Liaw, Eric Liang, Melih Elibol, Zongheng Yang, William Paul, Michael I. Jordan, and Ion Stoica. 2018. Ray: A Distributed Framework for Emerging AI Applications. In 13th USENIX Symposium on Operating Systems Design and Implementation (OSDI 18). USENIX Association, Carlsbad, CA, 561–577. https://www.usenix.org/conference/osdi18/presentation/moritz [60] Python multiprocessing team. 2023. Python multiprocessing documentation. https://docs.python.org/3/library/multiprocessing.html (accessed on 15 Feb 2023). [61] Jeffrey Pennington, Richard Socher, and Christopher Manning. 2014. GloVe: Global Vectors for Word Representation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP). Association for Computational Linguistics, Doha, Qatar, 1532–1543. https://doi.org/10.3115/ v1/D14-1162 [62] Joseph Redmon, Santosh Divvala, Ross Girshick, and Ali Farhadi. 2016. You Only Look Once: Unified, Real-Time Object Detection. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). 779–788. https://doi.org/ 10.1109/CVPR.2016.91 [63] Robert Rich and Joseph Tracy. 2003. Modeling Uncertainty: Predictive Accuracy as a Proxy for Predictive Confidence. SSRN Electronic Journal (02 2003). https: //doi.org/10.2139/ssrn.377462 Iain E. G. Richardson. 2003. H.264 and MPEG-4 video compression : video coding for next generation multimedia. Chichester; Hoboken, NJ: Wiley. https: //search.library.wisc.edu/catalog/999994207902121 [64] [65] Francisco Romero, Johann Hauswald, Aditi Partap, Daniel Kang, Matei Zaharia, and Christos Kozyrakis. 2022. Optimizing Video Analytics with Declarative Model Relationships. Proc. VLDB Endow. 16, 3 (nov 2022), 447–460. https: //doi.org/10.14778/3570690.3570695 [66] Francisco Romero, Mark Zhao, Neeraja J Yadwadkar, and Christos Kozyrakis. 2021. Llama: A heterogeneous & serverless framework for auto-tuning video analytics pipelines. In Proceedings of the ACM Symposium on Cloud Computing. 1–17. [67] Stuart Russell and Peter Norvig. 2003. Artificial Intelligence: A Modern Approach, 2nd Edition. Pearson (2003). [68] Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. 2008. The graph neural network model. IEEE transactions on neural networks 20, 1 (2008), 61–80. [69] Amazon Web Services. 2023. AWS Lambda. https://aws.amazon.com/lambda/ (accessed on 24 Jan 2023). [70] Karen Simonyan and Andrew Zisserman. 2014. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556 (2014). [71] Yaniv Taigman, Ming Yang, Marc'Aurelio Ranzato, and Lior Wolf. 2014. Deep- Face: Closing the Gap to Human-Level Performance in Face Verification. In 2014 IEEE Conference on Computer Vision and Pattern Recognition. 1701–1708. https://doi.org/10.1109/CVPR.2014.220 [72] Nesime Tatbul, Ugur Çetintemel, Stanley B. Zdonik, Mitch Cherniack, and Michael Stonebraker. 2003. Load Shedding in a Data Stream Manager. In VLDB Conference. 309–320. IPython Team. 2023. readthedocs.io/en/latest/ (accessed on 15 Feb 2023). IPython Parallel Documentation. https://ipyparallel. [73] [74] Gregor Urban, Krzysztof J. Geras, Samira Ebrahimi Kahou, Özlem Aslan, Shengjie Wang, Abdelrahman Mohamed, Matthai Philipose, Matthew Richardson, and Rich Caruana. 2017. Do Deep Convolutional Nets Really Need to be Deep and Convolutional?. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net. https://openreview.net/forum?id=r10FA8Kxg [75] Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David Cournapeau, Evgeni Burovski, Pearu Peterson, Warren Weckesser, Jonathan Bright, Stéfan J. van der Walt, Matthew Brett, Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, Andrew R. J. Nelson, Eric Jones, Robert Kern, Eric Larson, C J Carey, ̇Ilhan Polat, Yu Feng, Eric W. Moore, Jake VanderPlas, Denis Lax- alde, Josef Perktold, Robert Cimrman, Ian Henriksen, E. A. Quintero, Charles R. Harris, Anne M. Archibald, Antônio H. Ribeiro, Fabian Pedregosa, Paul van Mulbregt, and SciPy 1.0 Contributors. 2020. SciPy 1.0: Fundamental Algo- rithms for Scientific Computing in Python. Nature Methods 17 (2020), 261–272. https://doi.org/10.1038/s41592-019-0686-2 [76] Li Wang, Yao Lu, Hong Wang, Yingbin Zheng, Hao Ye, and Xiangyang Xue. 2017. Evolving boxes for fast vehicle detection. In 2017 IEEE International Conference on Multimedia and Expo (ICME). 1135–1140. https://doi.org/10. 1109/ICME.2017.8019461 [77] Max Welling and Thomas N Kipf. 2016. Semi-supervised classification with graph convolutional networks. In J. International Conference on Learning Repre- sentations (ICLR 2017). 14 [78] Tiantu Xu, Luis Materon Botelho, and Felix Xiaozhu Lin. 2019. Vstore: A data store for analytics on large videos. In Proceedings of the Fourteenth EuroSys Conference 2019. 1–17. [79] Zhuangdi Xu, Gaurav Tarlok Kakkar, Joy Arulraj, and Umakishore Ramachandran. 2022. EVA: A Symbolic Approach to Accelerating Exploratory Video Analytics with Materialized Views. In Proceedings of the 2022 International Conference on Management of Data. 602–616. [80] Zhihui Yang, Zuozhi Wang, Yicong Huang, Yao Lu, Chen Li, and X. Sean Wang. 2022. Optimizing Machine Learning Inference Queries with Correlative Proxy Models. Proc. VLDB Endow. 15, 10 (sep 2022), 2032–2044. https://doi.org/10. 14778/3547305.3547310 [81] Haoyu Zhang, Ganesh Ananthanarayanan, Peter Bodik, Matthai Philipose, Paramvir Bahl, and Michael J. Freedman. 2017. Live Video Analytics at Scale with Approximation and Delay-Tolerance. In 14th USENIX Symposium on Net- worked Systems Design and Implementation (NSDI 17). USENIX Association, Boston, MA, 377–392. https://www.usenix.org/conference/nsdi17/technical- sessions/presentation/zhang [82] Kaipeng Zhang, Zhanpeng Zhang, Zhifeng Li, and Yu Qiao. 2016. Joint Face Detection and Alignment Using Multitask Cascaded Convolutional Networks. IEEE Signal Processing Letters 23, 10 (2016), 1499–1503. https://doi.org/10. 1109/LSP.2016.2603342 [83] Andrii Zhygmanovskyi and Norihiko Yoshida. 2015. Distributed Cloud Bursting Model Based on Peer-to-Peer Overlay. In 2015 3rd International Conference on Future Internet of Things and Cloud. 823–828. https://doi.org/10.1109/FiCloud. 2015.74 [84] F. Özge Ünel, Burak O. Özkalayci, and Cevahir Çi ̆gla. 2019. The Power of Tiling for Small Object Detection. In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW). 582–591. https://doi.org/10.1109/ CVPRW.2019.00084 15 A FILTERING THE KNOB CONFIGURATIONS AND TASK PLACEMENTS A.1 Filter knob configurations Processing video with a knob configuration k incurs an amount of work (i.e. FLOPs) and a processing quality determined by k. However, not all knob configurations are pareto-optimal: one config- uration may achieve worse result quality while incurring more work than another. Skyscraper proceeds in two steps to create a filtered set K of knob configurations that lie on an (approximated) work-quality pareto frontier. Skyscraper samples a set S of video segments from the unlabeled training data and then runs greedy hill climbing on the sampled segments as proposed in VideoStorm [81]. In the following, we describe Skyscraper's sampling method that yields S. The goal of the sampling method is to sample nsearch segments that have widely different content dynamics (e.g. one with many cars, one with few cars). Given a small set of labeled data, and a larger set of unlabeled data, as well as the hyperparameter nsearch, which is set by the user, Skyscraper proceeds in two steps to compute S. First, Skyscraper finds the cheapest knob configuration k − and the most qualitative knob configuration k+. Both of these config- urations are guaranteed to lie on the work-quality pareto frontier. The cheapest configuration k − can simply be found by measuring the runtimes of all knob configurations on the on premise cluster. The most qualitative configuration k+ can be found by running all configurations on the labeled training data and picking the one that achieves the best accuracy. Second, Skyscraper samples npre segments Spre from the unla- beled training data uniformly at random and processes all of them with k − and k+. The quality that k − and k+ achieve on a segment are recorded as 2-dimensional quality vectors. Let Qpre denote the set of quality vectors for the segments in Spre . Skyscraper now greedily selects segments from Spre and adds them to the initially empty set S. Skyscraper first picks the segment s ∈ Spre with the smallest L2 norm and adds it to S. Then, Skyscraper iteratively adds the segment s′ ∈ Spre to S such that the newly added seg- ment s′ is the one which differs the most from all the previously added segments in S. The segment s′ ∈ Spre to be added is the segment with the largest distance to its closest element in S (i.e. s′ = argmax s ∈ Spre (min({||s′ − s′′|| | s′′ ∈ S})) ). After nsearch − 1 iterations, S is a set of nsearch video segments where each segment has significantly different content than all the other segments. After deriving these set of sampled video segment, Skyscraper independently searches for a set of knob configurations Ks that lie on an (approximated) work-quality pareto frontier for each seg- ment s ∈ S. These sets may differ for segments with different content dynamics (e.g., on segments where cheap configurations achieve perfect quality, expensive configurations are not on the pareto frontier). Skyscraper uses greedy hill climbing [67] for the search, whose effectiveness on this task has already been demon- strated in VideoStorm [81]. Finally, filtered set of knob configura- tions K is given by the union of all Ks for s ∈ S. A.2 Filter task placements Recall in Section 2 that each knob configuration k is associated with a task graph Gk , where each node represents the execution of certain user-provided model (e.g., an object detection model) and each edge specifies the dependency between nodes (e.g., an object tracking model requires the output from the detection model). Any node can be placed on on-premises or on-demand cloud hardware and the costs in cloud credits (plus bandwidth cost) and runtimes will be different. The objective of placement optimizer is to find a set of placements Pk for a knob configuration k that is on the cost-runtime Pareto frontier so that Skyscraper can pick a desirable placement for a knob configuration during online phase. We first execute the configuration k on the video segments in S∗ on both completely on-premises and completely on-demand cloud hardware. The runtime of on-premises processing, the runtime on the cloud, and the input/output sizes of each node in Gk are used as the node features of the placement graph. Then, the placement optimizer adopts a well-established approach that is shown to be robust and generalizable for placement optimization [2, 57]. Specifically, it takes the node features of Gk as inputs into a Graph Neural Network (GNN) [68, 77] that passes messages between nodes to learn their correlation and output the new node features of Gk after information aggregation. Then, it uses reinforcement learning (RL) to learn the placement strategy of Gi . Specifically, each node in Gi is appended with an additional feature: on-premises, on-cloud, or undecided. All nodes are initialized to be "undecided". The RL agent iteratively takes Gi as input and optimally make an "undecided" node "on- premises" or "on-cloud", until all nodes are decided. Simulator for cloud placements: The placement optimizer typi- cally suggests thousands of placements during the search. Executing each of these placements on real hardware would be extremely time- and money-consuming. We therefore use a simulator to estimate the runtime of different placements and use it for training. The simulator is shown to be very accurate and effective for training the placement optimizer. The details of this simulator is presented at Section M.2. B DESIGN DECISIONS In the following, we evaluate design alternatives of Skyscraper. Subsection B.1 provides more details to the discussion on design challenges in Section 2. Subsection B.2 analyzes alternative, drop-in replacements for components of Skyscraper. B.1 From a simplistic system to Skyscraper In the following, we evaluate the designs described in the discussion on design challenges in Section 2. The results are simulated on the COVID workload, using the simulator described in Appendix M. The first, simplistic design in Section 2 splits time interval T (over which resources should be rationed) into equal-sized splits ti of a couple of seconds. In our experiment, T is two days long and each ti ∈ T is two seconds long. The idealized approach of Section 2 then directly predicts the quality q ual (k, ti ) of each knob (cid:99) configuration k ∈ K on each segment ti ∈ T . In the evaluation in Figure 16, we use the average time-of-day quality over the past 2 days as a prediction of the quality over the next 2 days. Fitting a more complicated statistical model (e.g. neural network) is too hard since the output has a dimension of 259.200. 16 Computing the knob plan. Skyscraper assigns knob configura- tions to content categories using linear programming. Linear pro- gramming finds the optimal solution to the optimization problem. Furthermore, Figure 13 shows that the runtime overheads caused be the linear programming solver are negligible: A forward and backward pass through the forecasting model together with solving the linear program take a total of 0.5s or below. This overhead only occurs every couple of days when the knob plan is updated. There- fore, isn't any margin for improvement through alternatives to linear programming. C NUMERIC VALUES OF COST ANALYSIS Figure 4 in Section 5.3 shows the cost-quality trade off curves of Skyscraper, Chameleon∗ (an adaption of Chameleon [40]) and stati- cally using the same knob configuration. Table 2 furthermore gives the numeric values of the costs and qualities. Workload Method COVID MOT Static Chameleon* Skyscraper Static Chameleon* Skyscraper Static MOSEI-HIGH Chameleon* Skyscraper Static MOSEI-LONG Chameleon* Skyscraper Quality 35% 35% 81% 81% 97% 37% 50% 74% 91% 90% 94% 36% 79% 81% 81% 97% 72% 83% 89% 92% 94% 97% 8% 8% 28% 36% 51% 8% 21% 32% 37% 55% 30% 38% 45% 59% 80% 30% 30% 38% 38% 65% 30% 31% 39% 52% 68% 37% 53% 62% 72% Server vCPUs Cloud cost Total cost 4 8 16 32 60 4 8 16 32 4 8 4 8 16 32 60 4 8 16 32 4 8 4 8 16 32 60 4 8 16 32 60 4 8 16 32 60 4 8 16 32 60 4 8 16 32 60 4 8 16 32 – – – – – – – – – 0.0$ 3.3$ – – – – – – – – – 0.0$ 2.0$ – – – – – – – – – – 0.0$ 0.0$ 0.0$ 0.0$ 0.0$ – – – – – – – – – – 1.7$ 3.3$ 6.5$ 12.9$ 14.9$ 28.8$ 57.6$ 114.1$ 267.7$ 14.9$ 28.8$ 57.6$ 114.1$ 14.9$ 32.1$ 14.9$ 28.8$ 57.6$ 114.1$ 267.7$ 14.9$ 28.8$ 57.6$ 114.1$ 14.9$ 30.8$ 3.7$ 7.2$ 14.4$ 28.5$ 66.9$ 3.7$ 7.2$ 14.4$ 28.5$ 66.9$ 3.7$ 7.2$ 14.4$ 28.5$ 66.9$ 3.7$ 7.2$ 14.4$ 28.5$ 66.9$ 3.7$ 7.2$ 14.4$ 28.5$ 66.9$ 5.4$ 10.5$ 20.9$ 41.4$ Table 2: Cost and quality of running the workloads in Section 5.2. 17 Figure 16: Performance of the systems described in Section 2 Figure 17: Skyscraper using different clustering algorithms to compute the content categories. Section 2 then discusses a design built around a more practical forecasting task. This design resembles Skyscraper, with the sole difference of Skyscraper furthermore considering real hardware resources like on-premise compute cores, a video buffer and on- demand cloud workers. Figure 16 shows this improved design in blue. We can see that the improved design almost achieves optimal quality. B.2 Alternative implementations of Skyscraper components In the following, we consider drop-in replacements for specific components of Skyscraper. Clustering for content categories. Figure 17 shows a comparison of the end-to-end performance when using KMeans [52] for clus- tering in comparison to using a Gaussians Mixture Model [21]. The experiment is conducted on simulated hardware (simulator described in Appendix M) and for the COVID workload. We find that there is no difference in the end-to-end performance and therefore suggest using KMeans because it is simpler. Forecasting model. Skyscraper uses a simple feedforward neural network for forecasting. Figure 14 shows that on the COVID and MOT workloads, Skyscraper's end-to-end performance wouldn't improve even when using a ground truth forecast. We have not seen real-world workloads where the inaccurate predictions by the feedforward neural network cause significant losses of end-to-end performance. We therefore suggest using the feedforward neural network. However, there might exist some workloads where a more sophisticated network architecture might be required. 00.050.10.150.2020040060080010001200Mean Absolute ErrorNumber of training samplesRuntime data generation1.3h0h0.2h0.4h0.7h0.9h1.1h0.20.40.60.8100.250.50.751QualityComputationStaticOptimumPractical systemIdealized system0.60.70.80.910.20.40.60.81QualityNormalized costKMeansGaussian Mixture Model D INGESTING MULTIPLE STREAMS While Sections 2, 3, 4 focus on how Skyscraper optimizes the inges- tion of a single stream, Skyscraper's techniques naturally extend to a multi-stream scenario. In this scenario, the overall result quality and the budget of cloud credits is defined across streams, meaning that Skyscraper must allocate resources between streams to maximize the joint quality. We distinguish between two set ups: First, we analyze the setting where only cloud credits are shared between streams but each stream runs on individually provisioned on-premise compute and has its own buffer. Second, we analyze the setting where multi- ple streams share an on-premise server (i.e. run on the same cluster) and share a buffer. For the first scenario, the offline phase is run independently for each stream. Specifically, for each stream, knob configurations and task placements are filtered independently, the content categories are computed independently, and the stream's forecasting model is trained independently of other streams. Then, in the online phase, knob switching can also be performed independently for every stream. The only component of Skyscraper that needs to be modified is the knob planner. This is necessary to ensure that cloud credits are allocated fairly between the streams. Algorithmically, the joint knob planner only presents a slight modification to generalize the knob planner used in the single-stream setting: Let V be the set of video streams to be ingested. The quality and cost must now be summed over all video streams as shown in Equation 7 and Equa- tion 8 respectively. Furthermore, the normalization must occur for all content categories of all streams, as shown in Equation 9. We have highlighted the changes compared to the single-stream knob planner in green. maximize subject to ∑︁ ∑︁ v ∈ V ∑︁ k,c for v ∑︁ αk,c ∗ rc ∗ q ual (k, c) (cid:99) αk,c ∗ rc ∗ cost (k) ≤ budget (7) (8) v ∈ V ∑︁ k,c for v αk,c = 1, αk,c ≥ 0 k ∀c of all v ∈ V (9) If multiple streams are processed with shared on-premise re- sources (i.e. the second scenario), it is sufficient to use the previous approach with two slight modifications. First, since multiple streams now share a buffer, each independent knob switcher must be aware of the true free capacity of the buffer, even if some memory is occu- pied by other streams. Therefore, the knob switcher implementation cannot assume anymore that it is the only one that allocates and deallocates memory in the buffer. Second, for the (offline) placement optimization, it is unclear how many cores are allocated to each stream. We propose a simple solution to this: For n cores and |V | streams, we can simply assume that each stream is (fairly) allocated ⌊n / |V |⌋ cores. Note that assuming a fair allocation of the cores between streams precludes buffer overflows while not leading to under-utilization of the on-premise cores: The fair allocation is a pessimistic estimate because it assumes that every stream's workload is high at the same time (i.e. every stream can keep all ⌊n / |V |⌋ cores busy). Since Skyscraper has the overall assumed n cores available for processing, progress won't be slower than estimated which allows Skyscraper to avoid buffer overflows. Nevertheless, the fair allocation assumption doesn't lead to under- utilization when a stream does not utilize its ⌊n / |V |⌋ cores. Since the mapping of tasks to cores is independent of the fair allocation assumption (e.g. Ray performs the mapping in our Skyscraper im- plementation), cores that are unused by one stream can still be used to run tasks of another stream. In that case, Skyscraper will over- estimate the runtime of the knob configuration since work can be shared among more cores than assumed. However, this doesn't mat- ter because the knob switcher is reactive and will notice that the buffer fills slower than expected. Continuing to have available buffer space, the knob switcher will forgo placing tasks on the cloud and the overestimated runtimes will therefore not cause unnecessary cloud spending. All of this doesn't require any additional changes to the knob switcher. E RUNTIME OF OFFLINE COMPONENTS E.1 Runtime of offline components In the following, we evaluate the cost of the offline phase for the COVID workload. The runtime is dominated by processing the train- ing data with the user-defined processing DAGs of the different knob configurations. Table 3 shows how much time was spent for each step in the offline phase in the experiments conducted in Section 5. The runtimes are measured when using two c2-standard-60 Google Cloud instances for the offline phase, which cost a total of 7.8$. Note that creating the training data for the forecasting model is em- barrassingly parallel, therefore more machines will result in lower runtimes. Step Runtime Filter knob configurations Filter task placements 6 min 4 min Compute content categories 5 min Create forecast training data Train forecast model 1.3 h 1 min Table 3: Runtimes of the offline steps for the COVID experiments conducted in Section 5 In Table 3 and in our experiments in Section 5, we processed 16 days of video data with the cheapest knob configuration k − to create 1200 training samples in 1.3 hours (as described in Section 3). However, the forecasting model can also be trained with less data, which requires less video to be recorded up front and reduces the work required to create the training data. In Figure 18, we show the Mean Absolute Error (MAE) when training the forecasting model with varying amount of training samples. As shown in Figure 18, training the forecasting model with only 700 samples wouldn't have increased the model's MAE but would have reduced the runtime of the offline phase by 35%. E.2 Rerunning the offline phase Generally the offline phase only needs to be run once. However, under rare circumstances some of the components might need to be rerun online. While these circumstances should never occur for 18 below shows the relevant lines of code of an implementation of the EV counting example of the Introduction. else: return state state = sky.run(kcf, kcf_cloud, frame, state) state = sky.run(yolo, yolo_cloud, frame, yolo_size) # get knobs det_interval = sky.knob("det_interval") yolo_size = sky.knob("yolo_size") # process depending on knob values if frame_num % det_interval.val() == 0: 1 # Skyscraper app (UDFs yolo, yolo_cloud, kcf, kcf_cloud omitted) 2 def proc_frame(frame, frame_num, sky, state): 3 4 5 6 7 8 9 10 11 12 13 # instantiate Skyscraper 14 sky = Skyscraper(aws_key_id, aws_secret_key, fps=30) 15 sky.set_resources(num_cores=8, bufferMB=4000, cloud_budget=1000) 16 17 # register knobs 18 sky.register_knob("det_interval", [1, 5, 10]) 19 sky.register_knob("yolo_size", ["small", "medium", "large"]) 20 21 # offline preparation 22 sky.fit(labeled_video, labels, unlabeled_video, proc_frame) 23 24 # online ingestion (e.g., cv2 to read frames) 25 state = State(init_quality=0) 26 vid = cv2.VideoCapture(0) 27 ok, frame = vid.read() 28 while ok: 29 30 status, state = sky.process(frame, state) ok, frame = vid.read() Lines 14-15 of the code snippet instantiate the Skyscraper in- stance sky to process a video stream. The user registers application- specific knobs to sky by specifying the knob's name and a value domain that the knob can take. Specifically, the user registers a knob that determines the rate at which a object detector is run (line 17) and a knob that determines its model size (line 18). The application only uses two UDFs, namely yolo and kcf. For brevity, we omit their implementation but users would typically implement them using popular CV libraries (e.g. torchvision, OpenCV). The user needs to specify an on-premise version and a cloud version for each UDF. Skyscraper then calls the corresponding version depending on if it wants to execute the UDF on premises or in the cloud. Currently, the user is responsible for packetizing the payload and invoking the cloud function within the cloud UDF. The user defines the processing DAG applied to the video in proc_frame. The state object is used to carry state between frames (in this case, it is used to keep track of bounding boxes that both yolo andkcf update). The state object is user-defined but must contain a quality field which the user updates to reflect the current quality of processing. Quality is an application-defined metric and may for example be based on errors or certainty metrics that are commonly reported by CV algorithms. Specific examples for quality defintions can be found in Section 5.2, where we describe the Skyscraper applications that we use for benchmarking. The user triggers Skyscraper's offline learning phase in line 22. After its completion, the user can start to ingest live videos as shown in lines 28-30. G COMPARISON TO QUERY-LOAD- ADAPTIVE KNOB TUNING SYSTEMS VideoStorm [81] and VideoEdge [35] perform knob tuning for video workloads but only adapt to the query load and not the content of 19 Figure 18: Mean Absolute Error of the forecasting model for different amounts of training data most workloads, we discuss in the following when which offline component would need to be rerun. Retraining the forecasting model. If Skyscraper is set up prop- erly, training the forecasting model is the only step of the offline phase that might need to be redone. How often different content cate- gories appear may change over time (e.g. traffic in the city worsens). These changes are mostly smooth and should not be problematic since we continuously train the forecasting model online ("online learning"). This continuous training allows the model to adapt to smooth drifts at negligible overhead. Skyscraper can monitor the forecasting accuracy online (the knob switcher determines the actual frequency of content categories anyways). If this accuracy deterio- rates and the user decides to retrain the model, this is cheap since the costly part of generating the new training data has already been done anyways during video ingestion. Content categories. Typically, workload changes only involve how frequently different content categories appear, but don't intro- duce completely new content categories (e.g. there is no "completely new type of heavy traffic"). However, if the training data is incom- plete and does not contain a content category, the content categories might need to be recomputed. Skyscraper can detect this, as the measured quality will then frequently be far from all of the KMeans cluster centers. Recomputing the content categories is cheaper than in the original offline phase since the sample efficiency can be dras- tically improved. Instead of randomly sampling segments and com- puting their quality vectors, Skyscraper can simply add segments to the train set, where it notices that the samples don't belong to any of the content categories. Filtered set of good knob configurations & good task placements. Task placements are independent of the video and don't need to be recomputed. The user may consider (partially) recomputing the set of knob configurations if the content categories have been recomputed. As described above, this should generally not happen. F SKYSCRAPER API To support application-specific query formats, Skyscraper lets users define processing steps as arbitrary user-defined functions (UDFs). When applying the UDFs to the video stream, one UDF typically produces the input for another, yielding a directed-acyclic graph (DAG) where each node is a UDF and edges specify that the source UDF's output is used as the target UDF's input. The code snippet 00.050.10.150.2020040060080010001200Mean Absolute ErrorNumber of training samplesRuntime data generation1.3h0h0.2h0.4h0.7h0.9h1.1h0.20.40.60.8100.250.50.751QualityComputationStaticOptimumPractical systemIdealized system First, Skyscraper processes all of the unlabeled training data using the cheapest knob configuration k −.7 Using the quality that k − achieves on each of the segments of the unlabeled training data, Skyscraper classifies the segments into one of the content categories c ∈ C. This is done through Skyscraper's standard way of classifying content, which is described in Section 4.2. Given the category of each segment, Skyscraper can create inpu- label pairs which are used to train F via supervised learning. Each input x spans a time period of tin into the past and each label spans a time period of tout into the future. The label is given by one content histogram that contains the content distribution over the tout long interval. The input contains nsplit histograms that contain the content distributions of tin/nsplit time chunks that the past tin interval has been split up to. tout (planned interval length), tin (forecast model input length) and nsplit (number of forecast model input splits) are hyperparame- ters of Skyscraper but as discussed in Appendix I, setting them to default values generally leads to good performance, so we envision that the users do not need to tune them. I SKYSCRAPER'S HYPERPARAMETERS Skyscraper exposes the following set of hyperparameters that can be adjusted by the user: (1) Number of content categories (2) Frequency of knob switching (3) Input features for forecasting model: (a) Input time span for forecasting model (tin) (b) Number of histograms reported for the input (nsplit ) (4) Hyperparameters of the forecasting model (e.g. architecture, training hyperparameters) (5) Planned interval length (tout ) (6) Sample sizes in the offline phase (a) Sample size of S for searching good knob configura- tions K (b) Sample size of S′ for computing content categories C In the following, we describe how to set these hyperparameters to ensure Skyscraper achieves a good performance. We hereby suggest default values that worked well on all four workloads considered in the paper. Our tuning recommendations are supported by sensitivity analyses conducted in the subsections below. (1) Number of content categories C: This parameter deter- mines how many clsuter centers should be used in KMeans. Skyscraper's performance is insensitive to this as long as it is set high enough. For our workloads, values of 3 and above performed well. We evaluate different values in Sub- section I.1 We suggest a default value of 4. (2) Frequency of knob switching: While Skyscraper's per- formance is sensitive to this hyperparameter, we find that reasonable values (running it between every 2s to 8s) all achieve good performance. We evaluate the performance for different values in Subsection I.2. We suggest a default of running it every 4s. (3) Input features for forecasting model: We find that the most important property of the featurization is that the 7If k − achieves similar performance for different content categories (i.e. is not a good discriminator), the next cheapest configuration is picked that is a good discriminator. Figure 19: Comparison between Skyscraper, the static baseline and VideoStorm. VideoStorm was designed for significantly dif- ferent workloads. the video. We discuss this in more detail in Section 1 and Section 6. Since VideoEdge is designed for a different compute hierarchy, we only compare to VideoStorm in the following. We want to emphasize that the following results are measured on the V-ETL workloads described in Section 5, which significantly differ from the workloads that VideoStorm was designed for. The following results are not representative of VideoStorm's performance on workloads it was designed for (i.e. many finite, ad-hoc queries being run on a video stream). Instead, they provide experimental evidence that systems that only adapt to the query load are not suitable for V-ETL. Figure 19 shows the cost-quality trade offs when statically using the same knob configuration, VideoStorm and Skyscraper. For all workloads, VideoStorm fills the buffer early during execution and then (almost) only uses the most qualitative knob configuration that runs in real-time on the provisioned hardware. VideoStorm's performance therefore closely matches the one of the static baseline. The reason why VideoStorm outperformed the static baseline for MOSEI-HIGH, is that the first workload spike in MOSEI-HIGH comes early enough, such that VideoStorm hadn't used up signifi- cant buffer space yet. By being able to leverage the buffer during the workload peak, MOSEI-HIGH could therefore achieve better quality on cheaper resources than the static baseline. However, it is a lucky coincidence that VideoStorm hadn't used up the buffer at the beginning of the workload peak and this performance improvement can only be observed for the first peak. For all subsequent data, VideoStorm will have the performance of the static baseline since the buffer remains full after the first peak. H DETAILS ON TRAINING THE FORECASTING MODEL Skyscraper pre-trains the forecasting model in the offline phase using the unlabeled data. In the following, we describe how Skyscraper computes the training data from the unlabeled data. Previously, Skyscraper has already computed the content categories C. 20 SkyscraperVideoStormStatic baseline0.20.40.60.811.200.250.50.751qualitynormalized cost0.20.40.60.811.200.250.50.751qualitynormalized cost0.20.40.60.811.200.250.50.751qualitynormalized cost0.20.40.60.811.200.250.50.751qualitynormalized cost(a) COVID(b) MOT(c) MOSEI-HIGH(d) MOSEI-LONG model knows about the content dynamics of the recent past (and these dynamics have not been averaged over a long time period). In Subsection I.3, we find that any featuriza- tion that fulfills this delivers results that are accurate enough to not harm Skyscraper's performance. We suggest a default of providing data from the previous two days as input, split into eight histograms. (4) Hyperparameters of the forecasting model We find that very simple architectures and training procedures are suffi- cient. We suggest to use the same as we used in our experi- ments as default (see Appendix K). (5) Planned interval length: We evaluate this in Section 5 and find that Skyscraper performs well for reasonable values between 1 day to 4 days. We suggest a default of 2 days. (6) Sample sizes in offline phase: For both the sample size of S (filter knob configurations) and S′ (categorize video content) of the offline phase, larger sample sizes are better but cause a longer runtime of the offline phase. We suggest a sample size of 5 for S and a sample size of 5% of the unlabeled training data for S′. If users want to tune hyperparameters beyond the default sug- gestions, Skyscraper allows for easy hyperparameter tuning in the offline phase. Tuning the hyperparameters hereby only requires re- running the affected component (e.g. re-training the forecasting model while not re-running anything else). I.1 Sensitivity to the number of content categories Skyscraper categorizes content into |C| content categories. Each category correponds to a cluster center computed through KMeans (the number of content categories therefore corresponds to the "k in KMeans"). Figure 20 shows Skyscraper's end-to-end performance on the COVID workload for different numbers of content categories. Method 1 category 2 categories 3 categories 4 categories 8 categories Switcher accuracy 100% 98.8% 97.9% 97.2% 95.9% Table 4: The accuracy of the knob switcher on the COVID work- load for a varying numbers of content categories Skyscraper when running the knob switcher at different periodicities. We can see that Skyscraper is sensitive to the periodicity but the performance variance between different periodicities is not high. Figure 21: The effect of running the knob switcher at different frequencies on Skyscraper's end-to-end performance I.3 Sensitivity of forecasting model Table 5 complements Figure 14 and shows the Mean Absolute Er- ror (MAE) of forecasts over different time intervals. As shown in Figure 14, only the prediction error for 8 days caused significantly harmed performance. Days forecasted COVID Mean Absolute Error Absolute Error MOT Mean 1 day 2 days 4 days 8 days 0.097 0.042 0.066 0.149 Table 5: Mean Absolute Error for varying number of forecasted days, as evaluated in Section 5.6 0.108 0.064 0.133 0.185 Figure 20: Skyscraper's end-to-end performance on the COVID workload using a varying number of content categories. Figure 20 shows how Skyscraper's performance is insensitive to the number of content categories as long as it is high enough (assuming no degenerately high numbers). Table 4 shows the clas- sification accuracy of the knob switcher for different numbers of content categories. Table 6 shows the MAE when predicting over 2 days but with varying amounts of input days (how many days of data are fed into the forecasting model) and splitting the input data into different amounts of content distribution histograms. We can see that if we split the input data into 8 histograms, the MAE is always significantly below what would cause performance deterioration. I.2 Sensitivity to the knob switching frequency Skyscraper periodically runs the knob switcher every couple of seconds. Figure 21 shows Skyscraper's end-to-end performance of J DETAILS OF THE WORKLOADS We evaluate Skyscraper using three workloads on public health monitoring, traffic planning, and social media analysis. They cover a 21 0.40.60.8100.51costquality1 category2 categories3 categories4 categories8 categories0.40.60.8100.51costqualityEvery2sEvery3sEvery8sEvery4s knob configurations, people may be detected at different times and different sets of people may be detected. It further leverages that KCF trackers report when they fail to track an object. Multi-object tracking (MOT). Multi-object tracking (MOT) is a key primitive in many video analytical pipelines. In this workload, we adopt the recent state-of-the-art TransMOT [15] tracker on MOT benchmark [22] and introduce several tunable knobs. TransMOT first runs a object detector and use off-the-shelf image models (such as VGG [70]) to create feature embeddings of the detected objects. TransMOT then models all object features and interactions on one frame as a graph and inputs this graph and the graphs from previous frames to a graph transformer to generate the object tracks. Apart from the frame rate and number of tiles explained in COVID workload, MOT contains two additional knobs: • Length of history: TransMOT model takes the graph from pre- vious t frames as history and we set t as tunable knob. Larger t suggests a better quality and a higher cost. • Model size: We trained three TransMOT models with different number of layers (different model size). We can adaptive use any model according to their accuracy and cost trade-offs. The quality QMOT is defined as the number of people that Trans- MOT correctly tracked. The ground truth tracking is given by run- ning TransMOT at the most expensive knob setting, that we do not consider in the experiments. We run MOT on a stream of a traffic intersection Shibuya in Tokyo and track pedestrians. Multi-modal opinion sentiment and emotion intensity (MOSEI). This workload is synthetic and simulates a video stream analysis on Twitch. The number of incoming streams varies over time and mimics the number of live Twitch streams over two days.9 We further introduce synthetic spikes to evaluate Skyscraper under difficult conditions. Specifically, we create the following two type of spikes: • MOSEI-HIGH: We introduce high but short peaks in workload, consist of 62 concurrent video stream ingestion. This makes cloud bursting difficult since they will require high bandwidth. • MOSEI-LONG: We introduce a long peak of continuous work- load. In this case, the buffer alone cannot hold all the extra work. Since the real data from twitch is not available, we use the CMU- MOSEI [7] dataset to simulate incoming video streams. It contains various videos filming people's heads while talking from YouTube. The task of MOSEI workload is to classify the opinion sentiment of the speaker using both the audio and visual content. CMU-MOSEI provides extracted features from the video with ground-truth labels. We trained a neural network on CMU-MOSEI's training set and used its test set to evaluate Skyscraper. We couldn't find out which exact methods CMU-MOSEI used for feature extraction but replicated a similar pipeline, which we run before the neural network classifier. We transcribe the audio using CMUSphinx [34] and use GloVe word embeddings [61] on the transcript. For the visual features, we extract the bounding box of the face using MTCNN [82] and the face em- beddings using DeepFace [71]. We further extract acoustic features including 12 Mel-frequency cepstral coefficients, voiced/unvoiced segmenting features [23], and glottal source parameters [3, 4, 24]. Since CMU-MOSEI does neither provide raw video nor the exact Table 6: Mean Absolute Error depending on the input features diverse set of computer vision primitives including object detectors, trackers, and classifiers. All workloads are heavily CPU bound. We describe them in the following. COVID-19 safety measures (COVID). During the coronavirus pandemic, decision makers have executed several safety measures to slowdown the spread of the virus. Such measures include wearing facial masks and social distancing. Measuring where and how strictly people adhere to these measures can be used for decision making and informing people at risk. The COVID workload consists of a YOLOv5 object detector [62] to detect pedestrians and a KCF tracker to track the detected pedestri- ans ("detect-to-track"). After the detection, for each detected pedes- trian, the workload employs homography to measure the pedestrian's distance to others. Furthermore, it uses a neural network with a ResNet-50 [29] backbone to classify if the person is wearing a facial mask. The neural network classifier was fine tuned on MaskedFace- Net [12]. The workload contains the following knobs: • Frame rate: Consecutive video frames contain large redundancy. It is a common approach to skip frames at a constant rate to effec- tively reduce this redundancy. We expose the following frame rate domain to Skyscraper: {30FPS, 15FPS, 10FPS, 5FPS, 1FPS}. • Object detection rate: In the detect-to-track framework, an object detector is run on frames with a regular interval and cheaper trackers are run on the intermediary frames to track the detected objects. Running object detection more frequently will lead to a better quality and a higher cost. Skyscraper considers running object detectors every {1, 5, 30, 60} frames. • Tiling for object detection: The pretrained object detectors are typically trained on small input images to reduce cost (e.g. Ultra- lytics' YOLOv5 weights). Higher resolution images during video ingestion thus need to be down sampled to the fixed, small dimen- sion used for testing. This impedes the model's ability to detect small objects. A common approach to overcome this issue is to slice the high resolution image into several tiles [84] and individually fed them to the object detector. More tiles will thus result in better accuracy but at a higher cost. We expose the following tiling domain to Skyscraper: {1x1 tile, 2x2 tiles}. The workload is executed on a video stream of a busy shopping street in Tokyo.8 We measure the workload's quality in the person ∗ seconds that it records. This metric encompasses that for different 8The Koen-Dori street in the Shibuya district. Live stream available at https://youtu.be/ gALQR-nsEME (July 7, 2022) 9As recorded by Twitch Tracker at https://twitchtracker.com/statistics/active-streamers (7 July, 2022) 22 Input days12480.50.0550.1690.1790.05210.0560.1120.1070.04820.0570.1630.1460.04240.0570.1650.1400.05180.0620.0560.1370.048Splits processing steps to obtain their features, we can only simulate the feature extraction pipeline as described in subsection 5.2 but then predict on the features as provided by the CMU-MOSEI dataset. The workload contains the following knobs: • Frequency of sentiment analysis: How frequently is sentiment analysis performed. Since the precise sentiment is volatile, frequent sentiment analysis improves accuracy but is more expensive. Since the workload always transcribes the spoken audio, we determine the frequency based on sentences that are skipped. Skyscraper may skip {0, 1, 2, 3, 4, 5, 6} sentences. • Frame rate during sentiment analysis: What fraction of data is analyzed for each sentence that is chosen for analysis. Given a sen- tence on which sentiment analysis should be performed, we sample the video frames and the corresponding audio and transcription at regular intervals. This reflects that only analyzing part of a sentence may already reveal its sentiment. We expose the following domain to Skyscraper: { 1 6 • Model size: We trained three models of different sizes for the sentiment analysis. The models show a correlation between accuracy and runtime such that slower models have a higher accuracy. • Number of streams: The number of streams to analyze. When processing n streams and stream i is processed with result- , 1} , 5 6 , 1 2 , 1 3 , 2 3 ing accuracy ai , we define the quality as QMOSEI = (cid:205)n i=1 ai . K EVALUATION DETAILS In the following, we provide further details on the experiments run in Section 5. K.1 Hyperparamters used in evaluation In the evaluation in Section 5, all workloads were executed with the same hyperparameter setting except for when otherwise noted. (1) Number of content categories: COVID and MOT use 3 content categories, MOSEI-HIGH and MOSEI-LONG use 5. (2) Frequency of knob switching: For COVID and MOT, the knob switcher is run every 2 seconds, for MOSEI-HIGH and MOSEI-LONG, it is run every 7 seconds (due to constraints of the data set). (3) Input features for the forecasting model: For all workloads, the forecasting model used 2 days of data split into 8 histro- grams as input. (4) Hyperparameters of forecasting model: All workloads used the following feed-forward architecture: input --> 16 units (RELU) --> 8 units (RELU) --> num content categs (softmax) For all workloads, the model was trained for 40 epochs and the weights with the best validation accuracy were chosen for the online phase. The validation split was 20% for all workloads. COVID and MOT used 16 days of data from a traffic camera in Tokyo10 as training data and MOSEI- HIGH and MOSEI-LONG used 10 days of synthetically generated data as training data (as described in Section 5.2). (5) For all workloads, the planned interval length was 2 days. 10Live camera stream available at:https://www.youtube.com/watch?v=IKbbHFMAeBM (accessed on 29 Nov 2022) 23 (6) For COVID and MOT, we sampled 4 segments for filter- ing knob configurations and sampled 5% of the unlabeled training data to find the content categorization. For MOSEI- HIGH and MOSEI-LONG we sampled 10 segments for the knob configuration filtering and sampled 10% for the content categorization. For all workloads, we create a training point for the forecasting model every 15 minutes of data. K.2 Decode cost In our experiments, we use the default OpenCV decode function and decode frames from H.264 as soon as they enter the system. Using 4 cores on a Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz, we measure that decoding a frame takes 1.6ms, which amounts to taking 5% of the total runtime for processing. This doesn't play a big role given that the CV models used for inference in our experiments often take around 100ms to run. For example, YOLOv5 on the same hardware configuration takes 86ms per inference. L CLOUD VS ON-PREMISE TOTAL COST OF OWNERSHIP The same computation on the Cloud is generally more expensive than on premise. This section estimates the cost ratio between Cloud and on premise compute. We hereby follow Greg Deckler's estimate but use current prices and simplify further.11 The simplifications are to the disadvantage of the cloud and make the cloud compute more expensive when compared to the on premise compute. This is to the disadvantage of Skyscraper, as Skyscraper's cloud costs are multiplied by a higher factor. We take the following simplifying assumptions: • Setting the on premise hardware up and maintaining it is for free. There are no staff costs and also no damages or other maintenance costs. • We ignore tax implications (cap-ex vs. op-ex) • We assume a 3 year (36 months) lifecycle of all hardware. This matches Greg Deckler's assumption and is common in similar cost analyses. • We ignore software licensing costs for on premise. • A month has 744 hours. • We ignore cost for space (i.e. rent) for on premise. • We ignore costs for networking hardware (e.g. network switches). We compare the on-premise cost to the AWS Lambda 3000MB instance that we used in our experiments. Renting one of these in- stances over an entire month costs 130.78 USD/month.12 For the on-premise hardware, we consider the Dell R240 as a cheap com- modity sever at the time of writing. In the cheapest, default configu- ration, Dell states the value of this machine at 1596.90 USD.13 This configuration includes an Intel Celeron G4930 with 2 cores. Since computer vision tasks are generally compute bound and paralleliz- able, the number of cores largely determines the runtime. We found 11https://www.linkedin.com/pulse/cloud-vs-on-premises-hard-dollar-costs-greg- deckler/ (accessed on 14 July 2022) 12https://aws.amazon.com/de/lambda/pricing/ (accessed on 14 July 2022) 13https://www.dell.com/en-us/work/shop/cty/pdp/spd/poweredge-r240/pe_r240_ 13157_vi_vp (accessed on 14 July 2022) that our AWS Lambda instance uses 2 Intel Xeon cores and is there- fore comparable. Dividing the cost of the Dell R240 server by its assumed life cycle of 36 months gives a monthly cost of 47.2 USD. In the standard configuration, the Dell R240 comes with a 250W power supply. In April 2022, the average electricity cost across all US states was 15.38 cents per kWh.14 Using 250W over a month of 744 hours results in 186 kWh, which cost 28.6 USD/month. In total, this gives a Cloud to on premise cost ratio of 1.8×. M SIMULATOR In the following, we describe the simulator algorithm in detail and evaluate it. M.1 Simulator algorithm The placement optimizer typically suggests thousands of placements during the search. Executing each of these placements on real hard- ware would take a long time and require the user to pay money to execute the tasks that the optimizer placed on the cloud. To make the placement search practical, Skyscraper instead uses a simulator to estimate the runtimes of a given placement. The simulator hereby takes a directed acyclic task graph (DAG) as input where each node is a UDF that is labeled for execution on cloud or on premises. Before simulating placements of the DAG, the simulator profiles each UDF on real hardware. The simulator hereby measures the following three properties: • Runtime on 1 on premise core: Some UDFs are multi- threaded and can run on several cores in parallel. During video ingestion however, other cores are typically occupied by other UDFs and a UDF may hence often only utilize one core. Because of this, the simulator assumes that each UDF is scheduled on a single core. To obtain the runtime of a UDF on a machine with n cores, we measure the runtime of executing n UDF instances on the machine in parallel. Like this, each UDF is usually scheduled to run on one core and we measure the runtime as desired. • Round trip time for cloud version of UDF: As described in section 2, each UDF also has a version where most of the processing is done on the cloud. Measuring the runtime of this function is trivial as it is largely dominated by the round trip time to the cloud, which includes the processing time on the cloud. We assume that the function does not experience a cold start and therefore warm up cloud workers before measuring. • Average input & output sizes of UDF in bytes: To estimate the bandwidth requirement of tasks, we measure the average size of the payload that the function uploads to the cloud and receives from the cloud. In video processing, we observe that the tasks' input and output sizes do not vary much. The input to a simulation then consists of two things: First, the simulator takes a directed acyclic task graph (DAG) as input, where the nodes are measured tasks and the edges are inter-task depen- dencies. Second, the simulator takes a placement of the task graph 14https://www.eia.gov/electricity/monthly/epm_table_grapher.php?t=epmt_5_6_a (ac- cessed on 14 July 2022) 24 where each task in the DAG is either placed on premises or on the cloud. The simulator then outputs the runtime of this placement. T The estimated runtime is the time tmax at which the simulator es- timates the last task to finish. The simulator iteratively simulates the execution of tasks and updates tmax accordingly. Initially, tmax = 0. In each iteration, the simulator then chooses the task T for execution, whose dependencies are resolved at the earliest time tread y . In the first iteration, this is a task with no dependencies which exists by the definition of DAG. The simulator keeps track of when the last cloud task finishes through tcloud max and also keeps track for each on premise core c, at what time tc max the last task on that core finishes. For a task T that is placed on premise, the simulator takes the measured on-premise runtime tT as estimate for the execution time of T . It schedules T on the core c with the lowest tc max . For that core c, tc ) + tT . max is updated to tc For a task T that is placed on the cloud, the simulator takes the measured runtime of the cloud UDF as an estimate for the exe- cution time tT . However, the simulator also keeps track if uplink and downlink bandwidth is occupied. The simulator assumes that each task will occupy the bandwidth fully for the amount of time required to upload/download their payloads. The earliest dispatch for a cloud task is therefore determined by tread y time tdispatchable T and the earliest time when bandwidth is available. tcloud is updated max max , tdispatchable to tcloud T max ← max (tcloud The final estimate for runtime estimate tmax is given by the max ← max (tc max , tready T ) + tT T maximum of tcloud max and tcloud c for all cores c. M.2 Simulator evaluation As described in section 3, Skyscraper uses a simulator to estimate (1) the runtime of a set of tasks on a given on premise server (2) the round trip time to execute tasks on the cloud. We first evaluate these two estimations separately. We then evalu- ate them jointly by estimating the end-to-end runtime of a Skyscraper ingestion. For the on premise estimation, we measured the runtime of a YOLO task and of a KCF task as described in section. We then estimate the runtime of the following three DAGs. • YOLO: Run 60 YOLO tasks without dependencies. • KCF: Run 60 KCF tasks without dependencies. • Combined: Run 60 YOLO tasks, each of which feeds its output to a KCF task. We estimated the runtimes of these on machines with 2, 4, 8 and 16 cores. Figrue 22 shows the results of this experiment on the left. All estimations have an error below 9% and the runtimes have only been overestimated. Futhermore, estimations on the same machine roughly have a similar error. Similar errors have less impact on the placement and configuration searches since all placements are overestimated similarly. We generally find that the simulation error is not a problem when looking for good placements and knob configurations. This is especially true since the selected placements are later executed to get their real runtimes for the online phase. For the cloud estimation, we measured the round trip time of a YOLO invocation on AWS Lambda, and then invoked that function at a rate of 1 Hz for 3.5 hours. We then estimate the time at which each cloud invocation returns. Figure 22 shows the error of the estimation over time. Figure 22: Simulation accuracy only on on premise tasks (left) and only on cloud tasks (right) While there are occasional spikes for the cloud round trip times, they are so rare that they are insignificant for provisioning and therefore for the simulation. When running Skyscraper online, these spikes will be absorbed by the buffer which in turn causes the Knob Switcher to use more expensive placements to empty the buffer again. Since spikes occur so rarely, the additional cost is not noticeable however. Finally, we evaluate the simulation for a run of Skyscraper. We hereby let the knob planner and knob switcher tune the workload's knobs and simulate the runtime of the resulting DAGs. We run Skyscraper on real hardware and log when each task returns. We then feed these DAGs to the simulator and let it estimate when each tasks return. Figure 23 shows the estimation error over time. The simulation error was larger during rush hours as can be seen by the three spikes in the plots. Figure 23: Simulation accuracy on actual Skyscraper executions which combine on premise tasks and cloud tasks N IMPLEMENTATION DETAILS In the following, we motivate and give further details on the imple- mentation of Skyscraper that we used in the experiments in Section 5. This section is complementary to the implementation details pro- vided in Section 5.1. Implementation choices N.1 For our experiments, we implemented Skyscraper on top of Ray [59] and AWS Lambda [69]. In the following, we briefly discuss these implementation choices. 25 Figure 24: Visualization of dependencies in Skyscraper and how Skyscraper components are mapped onto processes. Ray. We envision Skyscraper's user base to mainly consist of data scientists want to use a Python API and program their UDFs in Python. The simplest way to allow this is to write Skyscraper in Python. However, Skyscraper needs to run UDFs in parallel, which is not supported natively by Python due to the Global Interpreter Lock (GIL). Therefore, we need to execute the UDFs using a third-party execution engine that is capable of executing Python functions in parallel. We chose Ray because it avoids overheads from spawning a new process for each UDF call, which is done by packages like multiprocessing [60] or IPython Parallel [73]. AWS Lambda. We chose to execute tasks that are offloaded to the cloud on a Function-as-a-Service (FaaS) platform for simplicity. Like this, we don't need to worry about turning machines on or off (which incurs long wait times). We chose AWS Lambda since it is a well-established FaaS platform. N.2 Parallelization with Ray Skyscraper only maps UDFs to Ray actors and the system's compo- nents are run inside the parent process on Python's main thread. In the online phase, Skyscraper 's components cannot be paral- lelized but must instead synchronize the calls to Ray actors. Specifi- cally, the knob switcher waits on the UDFs to finish processing the previous video segment. The knob switcher can only be run after the UDFs return because the UDFs compute their achieved quality while processing the video segment, and the knob switcher needs this quality to decide which knob configuration to use next (as described in Section 4). In our implementation, this is implemented by letting the knob switcher wait on a quality Future, whose value is set by one of the UDFs processing the previous video segment. After choosing the new knob configuration, the next UDFs are called accordingly and the knob tuner again waits on the Future to be set by one of the newly called UDFs. Similarly, the knob planner needs to wait on the statistics of the knob switcher, which record what content dynamics occurred how often. These statistics are the input to the forecasting model. The knob planner therefore waits on the future containing these statistics before it can compute a new knob plan. The knob switcher can only operate when given a knob plan, so it cannot be run in parallel to the knob planner and waits for the future containing the new knob plan. These dependencies are visualized in Figure 24. In the offline phase, by far the most time is consumed running UDFs to process the training data. Running these UDFs is paral- lelized by mapping them onto Ray actors (as in the online phase). Also like in the online phase, Skyscraper 's components are all run 10%8%6%4%2%0%-2%Simulation error COVID0 12 24 36 48 60 72Simulation errorTime elapsed (h)10%8%6%4%2%0%-2%Simulation error MOT0 12 24 36 48 60 72Simulation errorTime elapsed (h)123410%8%6%4%2%0%-2%Error Cloud tasks0 1 2 3 4Simulation errorTime elapsed (h)10%8%6%4%2%0%24816CoresYOLOKCFCombinedSimulation errorError on premise tasks10%8%6%4%2%0%-2%Simulation error COVID0 12 24 36 48 60 72Simulation errorTime elapsed (h)10%8%6%4%2%0%-2%Simulation error MOT0 12 24 36 48 60 72Simulation errorTime elapsed (h)123410%8%6%4%2%0%-2%Error Cloud tasks0 1 2 3 4Simulation errorTime elapsed (h)10%8%6%4%2%0%24816CoresYOLOKCFCombinedSimulation errorError on premise tasksSkyscraper (parent process)UDFs (mapped onto Ray actors)KnobswitcherKnobswitcherKnobswitcherKnobplannerDependency: QualityDependency: Knob config.Dependency: QualityDependency: Content statisticsDependency: Knob planDependency: Knob config. in the parent process because parallelizing their execution wouldn't lead to significant runtime reductions (as shown in Appendix E). 26
http://arxiv.org/abs/2310.04821v2
"2023-10-10T06:25:03"
"2023-10-07T14:19:07"
Rethink Baseline of Integrated Gradients from the Perspective of Shapley Value
Numerous approaches have attempted to interpret deep neural networks (DNNs) by attributing the prediction of DNN to its input features. One of the well-studied attribution methods is Integrated Gradients (IG). Specifically, the choice of baselines for IG is a critical consideration for generating meaningful and unbiased explanations for model predictions in different scenarios. However, current practice of exploiting a single baseline fails to fulfill this ambition, thus demanding multiple baselines. Fortunately, the inherent connection between IG and Aumann-Shapley Value forms a unique perspective to rethink the design of baselines. Under certain hypothesis, we theoretically analyse that a set of baseline aligns with the coalitions in Shapley Value. Thus, we propose a novel baseline construction method called Shapley Integrated Gradients (SIG) that searches for a set of baselines by proportional sampling to partly simulate the computation path of Shapley Value. Simulations on GridWorld show that SIG approximates the proportion of Shapley Values. Furthermore, experiments conducted on various image tasks demonstrate that compared to IG using other baseline methods, SIG exhibits an improved estimation of feature's contribution, offers more consistent explanations across diverse applications, and is generic to distinct data types or instances with insignificant computational overhead.
[ "Shuyang Liu", "Zixuan Chen", "Ge Shi", "Ji Wang", "Changjie Fan", "Yu Xiong", "Runze Wu Yujing Hu", "Ze Ji", "Yang Gao" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04821v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04821v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI" ]
Rethink Baseline of Integrated Gradients from the Perspective of Shapley Value Shuyang Liu1*, Zixuan Chen1*, Ge Shi2, Ji Wang2, Changjie Fan3, Yu Xiong3, Runze Wu3 Yujing Hu3, Ze Ji4, Yang Gao1 1 Nanjing University, Nanjing, China 2 University of California, Davis, California, USA 3 NetEase Fuxi AI Lab, Hangzhou, China 4 Cardiff University, Cardiff, U.K. 3 2 0 2 t c O 0 1 ] G L . s c [ 2 v 1 2 8 4 0 . 0 1 3 2 : v i X r a Abstract Numerous approaches have attempted to interpret deep neu- ral networks (DNNs) by attributing the prediction of DNN to its input features. One of the well-studied attribution methods is Integrated Gradients (IG). Specifically, the choice of base- lines for IG is a critical consideration for generating mean- ingful and unbiased explanations for model predictions in different scenarios. However, current practice of exploiting a single baseline fails to fulfill this ambition, thus demand- ing multiple baselines. Fortunately, the inherent connection between IG and Aumann-Shapley Value forms a unique per- spective to rethink the design of baselines. Under certain hy- pothesis, we theoretically analyse that a set of baseline aligns with the coalitions in Shapley Value. Thus, we propose a novel baseline construction method called Shapley Integrated Gradients (SIG) that searches for a set of baselines by pro- portional sampling to partly simulate the computation path of Shapley Value. Simulations on GridWorld show that SIG approximates the proportion of Shapley Values. Furthermore, experiments conducted on various image tasks demonstrate that compared to IG using other baseline methods, SIG ex- hibits an improved estimation of feature's contribution, offers more consistent explanations across diverse applications, and is generic to distinct data types or instances with insignificant computational overhead. I. Introduction As artificial intelligence (AI) becomes more sophisticated the necessity of and indispensable in our daily lives, transparency and accountability in AI decision-making has grown significantly. (Adadi and Berrada 2018; Gunning and Aha 2019) To this end, Explainable Artificial Intelligence (XAI) was proposed and has been increasingly studied within the community that focuses on developing machine learning models and systems that can offer understand- able explanations for their decisions and predictions (Ar- rieta et al. 2020; Das and Rad 2020). Research on XAI boomed exceptionally after the paramount success of deep neural networks (DNNs), as they are considered by many as complex yet intriguing "black-box" models. (Angelov and Soares 2020; Ras et al. 2022) Under review. *These authors contributed to the work equally and should be regarded as co-first authors. Among numerous XAI methods, attributing the prediction of a deep network to its input features is particularly popular due to its intuitive explanations and broad applicability (Si- monyan, Vedaldi, and Zisserman 2013; Ancona et al. 2017; Heskes et al. 2020). One of these attribution methods, In- tegrated Gradients (IG) (Sundararajan, Taly, and Yan 2017) stands out as a leading algorithm by integrating gradients of the model's output with respect to input along a straight path from baseline to input. The mechanism and easy-to- implement property of IG make it particularly useful and applicable for understanding how input features impact the model's output. Since its introduction, IG has continuously evolved (Ghorbani, Abid, and Zou 2019; Jha et al. 2020; Yang, Wang, and Bilgic 2023; Pourdarbani et al. 2023; Yang, Wang, and Bilgic 2023), language models' explanation (En- guehard 2023), and electronic health (Duell et al. 2023). For IG, or path attribution methods in general, it is usually required to choose a hyperparameter known as the baseline input. Crucially, the choice of an appropriate baseline for IG plays a pivotal role in providing meaningful feature at- tributions and explanations (Frye et al. 2020). Take image classification task as an example: the gradient at a pixel rep- resents the direction, in which the function increases most rapidly, indicating the pixel's influence on the model's pre- diction. Since the contributions of players are measured by accumulating gradients on images interpolated between the baseline value and the current input, the choice of baseline has an outstanding influence on these gradients. There are three baseline inputs that are commonly adopted in XAI: random (Jha et al. 2020), zero (Ancona, Oztireli, and Gross 2019; Aas, Jullum, and Løland 2021), and mean (Dabkowski and Gal 2017), all of which are sin- gle baseline values. We briefly give justifications of the pit- falls of choosing a single baseline value. (i) A single baseline that is naturally considered as neutral and task unrelated by human might not have a "near-zero" score as recommended by (Sundararajan, Taly, and Yan 2017) for many models. For instance, for the function of interest F1(x) = x + 1, if a baseline of zero is used, namely x0 = 0, then F1(x0) = 1 is not "near zero", thus making interpretability implausi- ble. (ii) A single baseline that's meticulously crafted for a specific model is not generic to all instances. A straight- forward example is F2(x) = x3 − 6x2 + 11x − 6 where x1 = 1, x2 = 2, x3 = 3 are the solutions to F2(x) = 0. Choosing any one of them as the baseline might introduce incompleteness and unintended bias into the attributions. The caveats of utilising single baselines are also discussed and validated by Chen, Lundberg, and Lee (2022). Intuitively, the challenges associated with a single base- line motivate us to exploit a set of baselines for IG. We therefore delve deep into IG method, rethinking how to con- struct a set of well-interpretable and consistent baselines. We traced back to the underlying scheme of IG. Although applied in distinct fields, as an attribution method, IG cor- responds to a "shortcut" approximation of a cost-sharing method in economics called Aumann-Shapley Value (Au- mann and Shapley 1974) where the model, base features, and attributions of IG are analogous to the cost function, players, and cost-shares of Aumann-Shapley Value respec- tively. (Sundararajan and Najmi 2020) Furthermore, we show that under certain assumptions, coalitions in Shapley Values involving marginal contributions can be treated as baselines and explained samples. Specifically, we assume that the baselines correspond to the coalitions in Shapley Values. This means that we are able to select a set of base- lines to model the computation of the Shapley Values in a concise and efficient manner, echoing our objective of utiliz- ing a set of baselines. Therefore, based on these assumptions we propose a novel baseline construction method called Shapley Integrated Gradients (SIG). SIG assumes baseline corresponds to coalitions in Shapley Value and search for a set of baseline by proportional sampling to partly simulate the computation path of Shapley Value. To validate the effec- tiveness, genericnesss and consistency of SIG, we conduct experiments in two main types of environments according to the different nature of task inputs: (1) simulation of Shapley Values in GridWorld maze environment (Sutton and Barto 2018) to demonstrate that SIG approximates the proportion of Shapley Values; and (2) a variety of image input tasks, including image classification (He et al. 2016), and expres- sion codes (Zhang et al. 2021), to reveal that SIG produces enhanced explanation and more consistent interpretation re- sults across a variety of tasks. To summarize, our contributions are three-folds: (i) we analyse the drawbacks of using a single baseline for IG and hence a set of baselines is desirable; we then rethink baseline design for IG from the perspective of Shapley Value, and theoretically show that under certain hypothesis, the coali- tions in Shapley Values can be regarded as a set of baselines for IG; (ii) we propose a novel baseline construction method named SIG that partially models the computational path of the Shapley Value by finding the set of baselines; (iii) The experimental results demonstrate that the proposed SIG pro- vides a new perspective on IG, showing improved and more consistent interpretation than existing methods in a wide ar- ray of applications, and is generic to various data types and instances, thus making it of considerable value for practical applications. II. Related Work Integrated Gradients and the Choice of Its Baselines Integrated Gradients (IG) (Sundararajan, Taly, and Yan 2017) fuses the implementation invariance of gradients with sensitivity-based techniques, necessitating a crucial baseline value, as noted by the authors. Mudrakarta et al. (2018) illu- minated computation path of IG is the straight-line between baseline and input sample. Recent studies (Dabkowski and Gal 2017; Merrick and Taly 2020; Kumar et al. 2020; Binder et al. 2016; Shriku- mar, Greenside, and Kundaje 2017; Frye et al. 2020; Tan 2023) have provided experiential advice on choosing base- line values, while falling short of theoretical illumination. For example, Dabkowski and Gal (2017) opted to use the average of randomly selected samples from the dataset as the baseline; Frye et al. (2020) established baseline value of a pixel in relation to surrounding pixels; Chen, Lundberg, and Lee (2021) perceived the baseline as a representation of the background distribution, a viewpoint that harmonizes with our perspective; Feng et al. (2022) also highlights that the computational path of IG is not equivalent to that of the Shapley Value. Shapley Value Shapley (1951) proposed Shapley Value to allocate contributions to players in a cooperative setting. It is the only distribution with linearity, nullity, symmetry, and efficiency axioms. Aumann and Shapley (2015) extended the concept of Shapley Value to infinite game. Prior attempts have been made to incorporate Shapley Values to attribu- tion explanations: Lundberg and Lee (2017) proposed Shap- ley Additive exPlanations (SHAP), in which each feature of the model is viewed as a player in the game, the model it- self is seen as a utility function, and the chain rule is em- ployed to diminish computational complexity; Ghorbani and Zou (2019) enhanced the efficiency of Shapley Value esti- mation by using Monte Carlo Sampling and gradient-based methods; Mitchell et al. (2022) proposed a new approach to mitigating the issue of slow convergence of standard Monte Carlo sampling sampling; Chen, Lundberg, and Lee (2022) pointed out that utilizing multiple baselines mitigates the po- tential bias that can arise from attributions based on a single baseline. III. Preliminaries Notation A table of notations used in this work is pre- sented in the Appendix. Shapley Value Consider a game with n players and a util- ity function v, where v : 2N → R maps subsets of players to real numbers. Any set of players in N is called a coalition S. For a given coalition S and a player xi such that xi /∈ S, the marginal contribution of player xi to coalition S is defined as v(S ∪xi)−v(S). The Shapley Value of player xi, denoted by fSV (xi), is then computed as the sum over all coalitions S ∈ N/{i}, weighted by the probability of selecting each coalition. Specifically, fSV (xi) = (cid:88) S∈N/{i} |S|!(|N | − |S| − 1)! |N |! (v(S ∪xi)−v(S)) (1) Aumann-Shapley Value With the extension to infinite game, Aumann-Shapley Value was proposed with the def- inition that ds represents infinitely small player in game, I represents the complete set of players and tI is a per- fect sampling, representing a proportion t of all the players. Aumann-Shapley Value can be written as follows: fSV (ds) = (cid:90) 1 0 v(tI + ds) − v(tI)dt (2) Integrated Gradients (IG) Integrated Gradients is a method that was developed to attribute the prediction of a DNN to its input features. It integrates the gradient of the prediction concerning the input features over a straight-line path between the input x and a baseline x′. The IG for a model F is expressed as follows: fIG(xi) = (xi − x′ i) × (cid:90) 1 0 ∂F (x′ + α(x − x′)) ∂xi dα (3) IV. Method v(I) = = = = (cid:90) I ∅ (cid:90) I fSV (ds) (cid:90) 1 v(tI + ds) − v(tI)dt ∅ (cid:90) I 0 (cid:90) 1 ∅ (cid:90) I 0 (cid:90) 1 ∅ 0 v(tI + ds) − v(tI) ds dtds dv(tI) ds dtds Meanwhile, IG accumulates the contribution of each fea- ture by integrating the partial derivatives of model F with respect to the feature at points along a straight-line path [x′, . . . , x′ + α(x − x′), . . . x] from the baseline to the ex- plained sample. As such, the integral of IG over all features from ∅ to I can be written as follows: (cid:90) I (cid:90) I (cid:90) 1 fIG(dx) = (xi − x′ i) ∂F (x′ + α(x − x′)) ∂xi ∂F (x′ + α(x − x′)) ∂xi dαdx dxdα 0 (cid:90) I ∅ (xi − x′ i) ∇F (x′ + α(x − x′))dα = F (x) − F (x′) = v(I) In this section, we will first present Intergrated Gradients (IG) from the perspective of Shapley Value. Through this view, we discover and analyze the shortcomings of IG: cal- culation path of IG takes a straight line shortcut compared to that of Shapley Value. Building upon this observation, we propose our baseline construction method, Shapley In- tegrated Gradients (SIG). ∅ ∅ (cid:90) 1 0 (cid:90) 1 0 = = Integrated Gradients From the Perspective of Shapley Value Given an explained sample x = [x1, . . . , xn], a baseline ex- ample x′ = [x′ n], and a function F : Rn → [0, 1] that represents a deep network, we prove that IG is associ- ated with Aumann-Shapley Value as follows: 1, . . . , x′ Theorem 1. Suppose x′ represents the empty set ∅ with the absence of all features, x represents the complete set I with the presence of all features, and utility function of any sam- ple x is evaluated as v(x) = F (x) − F (x′), the integral of Integrated Graidents of all features is a simulation of the integral of Aumann-Shapley Values for all players when the model is evaluated along the linearly interpolated path be- tween baseline and explained sample. Proof. We treat each feature xi of sample x as a player in game theory and the mix up of x and x′ in a feature-wise bi- nary on-off manner as a coalition. Thus, the worth of perfect sample tI including coalitions with t proportion of x and 1 − t proportion of x′ is represented as v(tI). The contribu- tion of ds to the coalition is v(tI + ds) − v(tI). Aumann- Shapley Value computes the contribution of an infinitesimal player ds by integrating the functional gain of adding the player to the perfect sample tI of the all-player I at all pro- portions t ∈ [0, 1]. When t = 0 and t = 1, we get an ∅ and a complete set I respectively. Therefore, the worth of the complete set I that represents the integral contribution of all players can be written as follows: Interestingly, indicated by the proof above, the integral of IG approaches the integral of Shapley Value but though a different computation path. Each feature in IG plays essen- tially the same role as a player in Shapley Value. Uppon this proof, we use player and feature interchangeably in the fol- lowing paragraphs. Limitations of Integrated Gradients Figure 1: (a) For a two-features input, red lines represent calculation of Shapley Value for feature S1 and blue lines represent that for feature S2. While Path P2 is calculation path of IG. (b) Red paths are the calculation path of Shapley Value while blue path is the calculation path of IG for a n- features input. From the aforementioned Theorem 1, we derive that IG approaches the Aumann-Shapley Value in computing the contribution of the entire feature set. However, the goal of attribution methods is to compute the contribution of each individual feature. We illustrate their difference with a sim- ple example. As is shown in Fig. 1(a), we assume that there is a two- features input of the deep model, denoted as x = (S1, S2) with its corresponding baseline as x′ = (r1, r2). Then the set of coalitions encompasses (r1, r2), (S1, r2), (r1, S2), and (S1, S2). The Shapley Value of features S1 and S2 are: f (S1) = f (S2) = (v (S1, r2) − v (r1, r2)) 2 (v (r1, S2) − v (r1, r2)) 2 + + (v (S1, S2) − v (r1, S2)) 2 (v (S1, S2) − v (S1, r2)) 2 From the computation of Shapley Value for S1 and S2, we observe that calculation paths traverse through all four points of coalitions, represented by the blue and red lines in Fig. 1. The calculation path of Shapley Value can be denoted as P1 and P3. On the other hand, as the proof shows, we ascertain that IG actually computes contribution along the straight line P2. It becomes apparent that calculation path of IG, expressed as P2, takes a shortcut compared to path of Shapley Value, shown as P1 and P3. Extending to n-features setting, as shown in Fig. 1(b), the computation of Shapley Value takes many polyline paths while the computation of IG approximates it by taking a straight line short cut between baseline and the explained sample. Consequently, this discrepancy may result in inac- curate attributions of individual features. Shapley Integrated Gradients In above subsection, we observe that IG may lead to inac- curacy in estimating the contributions for features caused by the shortcut of calculation path compared to Shapley Value. However, because of the single path computation, it's effi- ciency is obvious. Contrastively, Shapley Value is appreci- ated for its accuracy in determining individual contributions, its computational burden of leveraging all coalitions, sub- jected to O(2n) where n is the number of features, restricts its application. To take some benefits of both, we combine Shapley Value with IG and propose Shapley Intergratd Gra- dients (SIG), a novel baseline construction method for im- proving IG from the perspective of Shapley Value. The intuition of the algorithm comes from Equation 1. As shown, the Shapley Value of feature i is the weighted aver- age of marginal contributions of a player across all possible coalitions {S; S ∈ N/{i}}, where the weight wi(S) and marginal contribution Vi(S) are defined as: wi(S) = |S|!(|N | − |S| − 1)! |N |! (4) Vi(S) = v(S ∪ xi) − v(S) (5) By inspecting the above two factors, here are some inter- esting observations: Observation 1. Given a game N , wi(S) is only dependent on the number of players k = |S| in the coalition S. There- fore, we can merge {wi(S); ∀S s.t. |S| = k∧∀i, i ∈ N } as a universal weight value w(k). This value can be precomputed as long as we decide k. Observation 2. The sum of {w(k); ∀S s.t. |S| = k∧∀k, k ∈ [0, |N | − 1]} is 1 since w(k) represents the inverse value of the number of combinations (cid:0)|N |−1 (cid:1) times the number of different values of k we can choose from the game. k acts like the proportion t in Equation 2 to measure the magnitude of coalitions. Thus, all coalitions are naturally categorized into |N | groups subjected by the size k and (cid:80) S w(k) = 1/|N |. |S|−1 1 w(k) = = |N | × |N |! |S|!(|N | − |S| − 1)! |N − 1|! k!(|N | − 1 − k)! (cid:18)|N | − 1 k (cid:19) = |N | × Observation 3. As a direct conclusion of Theorem 1, the marginal contribution of adding i; ∀i ∈ N to S can be ap- proximated by using IG from baseline S to complete set I. In the definition of Shapley Value in Equation 1, the marginal contributions of of all the coalitions S are all computed and then weighted by their corresponding wi(S) whose quantity is exponentially large. However, thanks to the observations above, we leverage a "trick" called pro- portional sampling, as is shown in Fig. 2(a), to circumvent it. Figure 2: (a) Proportional sampling in our SIG. Different colored nodes represent different weights defined by Equa- tion 4. (b) Construction of new players. A patch of pixels is considered as a new player/feature on which we search the baseline set. Proportional Sampling. Instead of sampling coalitions from a binomial distribution and weight them by their corre- sponding wi(S), an alternative approach is to sample coali- tions proportional to the precomputed wi(k) and weight them uniformly by 1. Here, we justify the "trick" creates an unbiased estimator of Shapley Value briefly. Due to Observation 1, the weight of coalition S can be precomputed once we select a k, and it's a constant no matter which specific coalition is drawn as long as it's size is k. Due to Observation 2, the expected marginal contribution of different sizes are equally treated for differ- ent k values. Therefore, the prior importance of each coali- tion are universally 1. Suppose we draw an infinite large number of samples, the expectation of Vi(S) drawn propor- tional to weight w(k) is an infinite approach to that of Vi(S) weighted by w(k). The detailed proof is in the Appendix. In addition, Observation 3 enables reducing the computa- tion burden of computing the marginal contributions of all players i one by one but complete them at once. Since IG is a gradient based approach which is supported by GPUs, leveraging it gives SIG more potential to speed up. To sum up, the three observations inspire our proposed SIG algorithm that constructs a set of sampled coalitions with different magnitude k as baselines of IG to approxi- mate Shapley Value in an efficient way. SIG Algorithm We posit that a coalition in Shapley Value corresponds to a baseline in IG. We aim to obtain relative Shapley Value since people typically care more about relative contributions of features rather than the absolute contributions. The overall algorithm, termed as Shapley Integrated Gradients (SIG), is presented in Algorithm 1. Algorithm 1: Shapley Intergratd Gradients (SIG) INPUT: explained sample x, default sample x′, model F PARAMETER: player set N , sample size B OUTPUT: approximated Shapley Values V Initialize baseline set D = ∅ for k ← 0 to N − 1 do Compute weight w(k) as Equation 4 end for Normalize all weights ˆw(k) = w(k)/ (cid:80)N −1 while |D| < B do k=0 w(k) for k ← 0 to N − 1 do Draw a random number r ∼ U(0, 1) if r < ˆw(k) then Create a coalition S by randomly selecting k play- ers from N Construct a baseline d from S based on x and x′ Add d to D end if end for end while Concatenate D into a tensor with the mini-batch size B Compute mini-batch IG A = fIG(x, D, F ) as Equation 3 Average through mini-batch V = 1 B return V i=1 Ai (cid:80)B There are two key points to note in the algorithm. (i) There doesn't have to be a one-to-one mapping from a player to a feature in explained sample x. As is shown in Fig. 2(b), we treat a patch of pixels as a single player to construct baseline sets. (ii) The construction of a baseline d of coalition S is by replacing the default values of x′ included in S with corre- sponding values of x. The default value is dependent on the task which we will specify in the experiments. There are two sources of discrepancies between our SIG and Shapley Value: (i) We only collect a subset of coalitions, with the omission of many other coalitions; (ii) The marginal contribution approximated by IG is a deviated from the ac- curate definition of Shapley Value. Finally, compared with Shapley Value, the benefits of us- ing SIG are as follows: • SIG is more suitable in a mini-batch computation set- ting by leveraging powerful parallel computation devices such as GPUs which is prevalent in current large scale applications. • SIG has the flexibility for users to define a smaller sample size instead of collecting all coalitions. • SIG supports user defined players but can still obtain feature-wise dense estimation of Shapley Values. To summarize, our work identifies that the calculation path of IG takes a shortcut compared to the path of Shap- ley Value. Consequently, we introduce SIG as a hybrid of Shapley Value and IG which approximates Shapley Value efficiently. V. Experiments In this section, we aim to further validate the soundness of SIG by exploring the answers to the following questions. • Question 1. Does SIG accurately approximate the pro- portion of Shapley Values? • Question 2. Does SIG provide improved explanations than IG? If so, is such improvement generic to differ- ent data types or instances, and consistent across various kinds of visual input tasks? In short, we wonder how well does SIG outperform IG. Experiment Setup To answer the aforementioned two critical questions, we de- vise two sets of experiments. Specially, • Simulation of Shapley Value involves a simple Grid- World environment (Sutton and Barto 2018) comprising 4 distinct sub-tasks to evaluate our SIG's ability of simu- lating Shapley Value for Question 1; • Performance of Explanation focuses on two visual input-based tasks: 1) Expression Code Task utilizing De- viation Learning Network (DLN) model (Zhang et al. 2021) on a dataset from a private data source.; 2) Image Classification Task employing ResNet model (He et al. 2016) on ImageNet Dataset (Deng et al. 2009) for Ques- tion 2. Compared Methods. To objectively assess the perfor- mance of explanation provided by SIG, we choose three commonly used baseline methods for comparison, i.e., (i) random baseline: baseline sample is randomly selected from a set of samples being explained; (ii) zero baseline: baseline value of each feature is set to zero; (iii) mean base- line: baseline value of each feature is determined as the av- erage value across a set of samples being explained. Hyperparameters. For Simulation of Shapley Value ex- periment, we list several hyperparameters as follows. ▶ Q: represents the ratio of sampled coalitions to all coali- tions; ▶ N: denotes the number of baselines sampled from ran- domly selected coalitions. For Performance of Explanation experiment, hyperparame- ters include: ▶ {M, N}: indicates that an M × N pixel area is treated as a new player. For a more detailed discussion on the impact of these hyper- parameters, please refer to the Appendix. Simulation of Shapley Value The simplicity of GridWorld facilitates the computation of Shapley Values, making it an ideal simulation environment to answer Question 1. In GridWorld, the agent performs valid actions (that do not result in out-of-bounds) based on its state to maximize the reward. We take time step (s, a) as a player and treat reward as utility. We construct a 2 × 2 GridWorld with 12 players under 2 distinct Shapley Value conditions, and a 2 × 3 GridWorld with 20 players and 2 different Shapley Value conditions. The Shapley Values for these four conditions are detailed in the Appendix. (a) (c) (b) (d) Figure 3: Average Spearmanr metric of four baseline meth- ods in GridWorld. (a) and (b) depict the results for 2 × 2 GridWorld, and (c) and (d) are the results for 2 × 3 Grid- World. The yellow line indicates the variance of the Spear- manr metric. As a quantitative measurement for the order of player's contribution, we select Spearmanr metric (Gauthier 2001) to evaluate the similarity between the computed Shapley Value order and the actual Shapley Value order. To investigate the robustness of SIG under varying Shapley Values, we test against a set of hyperparameters. Ten independent exper- iments were conducted to minimize the effect of random- ness. The results are shown in Fig. 3. SIG has a higher aver- age Spearmanr metric than the other three baseline methods across different Shapley Value conditions. It means that or- der computed by SIG is closer to the player's actual Shapley Value order. Therefore, we conclude a positive response to Question 1. We also explore the robustness of SIG against (a) (b) Figure 4: Average 1-Spearmanr metric of four baseline methods in GridWorld. (a), (b) denote the impacts of hyter- parameters N with fixed Q 40% and Q with fixed N 200 respectively in a 2×2 GridWorld. (Details are documented in the Appendix) hyperparameters. Fig. 4 illustrates the performance of the four methods against different hyperparameter settings in a 2 × 2 GridWorld. It's obvious that SIG is sensitive to neither hyperparameters Q nor N , which shows robustness of SIG. In addition, Fig. 3 demonstrates that the variance of SIG is lower than other three baseline methods, which is another proof of SIG's robustness. Performance of Explanation In this experiment, we seek for an answer to Question 2 by employing human intuition and quantitative metrics to evaluate algorithmic performance. Specifically, in the Ex- pression Code Task, since the dataset provided by the pri- vate data source is not sufficient for quantitative analysis, we measure the performance of methods according to hu- man intuition. In the Image Classification Task, we leverage both human intuition and quantitative metrics. Figure 5: Saliency map of four baseline methods in Expres- sion Code Task where red pixels indicate positive values, while blue pixels denote negative values. Expression Code Task To reduce computational over- head, we treat an 80 × 80 pixel block as a single player and use SIG to construct the baseline set. To further clarify the explanation, we divide the pixels into positive and neg- randomSIG(ours)zeromean0.00.20.40.60.81.0randomSIG(ours)zeromean0.00.20.40.60.81.0randomSIG(ours)zeromean0.00.20.40.60.81.0randomSIG(ours)zeromean0.00.20.40.60.81.050100150200250300sample_num0.00.20.40.60.81.01 - spearmanrmethodrandomSIG(ours)zeromean0.30.40.5proportion0.00.20.40.60.81.01 - spearmanrmethodrandomSIG(ours)zeromeanRandomSIG (ours)ZeroMeanRandomSIG (ours)ZeroMean ative pixels. Positive pixels help to reduce the distance be- tween two images (values > 0), while negative pixels help to widen this gap (values < 0). As is shown in Fig. 5, compared with the other three coun- terparts, SIG method is able to pay more attention to human facial features, such as eyes and lips, which is in good agree- ment with the first impression when human observe faces. While both zero baseline and mean baseline methods can identify these facial features, they often shift the focus to other parts of the face, even regions outside the face bound- ary. From human intuition perspective, SIG conveys more explainable interpretations compared to the other three base- line methods. Figure 6: Saliency map of four baseline methods in Image Classification Task. SIG method predominantly focuses on bird, whereas other baseline methods divert their attention to areas outside of the bird. Figure 7: iAccuracy metric plots of four baseline methods in Image Classification Task where x-axis signifies the number of pixels removed, while y-axis denotes the iAccuracy met- ric. We present the average value derived from 500 images, along with its 0.95 confidence interval. Image Classification Task In this experiment, the base- line method generates feature contributions for each output neuron of the model (i.e., each class). We choose the class with the highest probability to reduce computational cost. The rest of the configuration is in line with that in the Ex- pression Code Task. We consider iAccuracy metric adapted from Li et al. (2020) as a quantitative metric to highlight the impact of features on model predictions. The iAccuracy metric specif- ically means that we sort the contribution scores from high to low and gradually remove pixels based on the sorted re- sults to observe the accuracy of the model predictions. The iAccuracy metric is defined as follows. iAcc(L) = 1 L + 1 L (cid:88) ( k=0 1F (x0)=F (xk)) where xk is noted as the image x0 removing the top k pixels attributed by the baseline methods. We carried out exper- iments on 500 images. An extended discussion about more images is presented in the Appendix. As illustrated in Fig. 6, SIG emphasizes the silhouette of the bird, which aligns with human instinct. While the zero and mean baselines can also pinpoint the bird's silhouette, they additionally highlight ar- eas outside the silhouette. Furthermore, as depicted in Fig. 7, the impact of removing top features selected by our SIG is close to that of the mean and zero baselines. From the ex- perimental results performed on a broad spectrum of image classification tasks, we find that SIG exhibits genericness to data types or instances, and maintains consistency in terms of explainability across a wide scope of tasks. Based on the intuitive image interpretation performance and quantitative analysis in the above two tasks, we can respond with a 'yes' to Question 2. Overall, by exploring the answers to Question 1 and Ques- tion 2, we experimentally verified the abilities of SIG: im- proved explainability, generic to data types or instances, and consistent interpretability across application domains. VI. Conclusion and Discussion In this work, we rethink baseline of Integrated Gradients (IG) from the perspective of Shapley Value. We observe and theoretically analyse that IG can be viewed as Auman- Shapley Value under certain assumptions. Specifically, a set of baseline aligns with the coalitions in Shapley Value, thus tackleing the challenges of exploiting single baselines. Therefore, we propose a novel baseline construction method SIG, which is a hybrid of the IG and Shapley Value that pro- vides an improved, generic, and consistent explanation com- pared to existing baseline methods for IG. The time com- plexity is mainly dominated two iterations of sampling from coalitions, leading to O(n2). Nevertheless, there remains intriguing challenges that de- serve further research. For example, our current creation of players using patches of pixels method is slightly coarse (Ren et al. 2021); the method for fitting Shapley Value proportions exhibits considerable randomness (Ando and Takase 2020); timing performance can be further enhanced (Chen et al. 2023). Addressing these issues is an important goal for our ongoing and future research. Molnar (2020) argues that the difference of the predicted value after removing the feature may not fully depict the Shapley Value. RandomSIG (ours)ZeroMean0100200300400500600700800remove patches0.00.20.40.60.81.0accuracymethodrandomSIG(ours)zeromean References Aas, K.; Jullum, M.; and Løland, A. 2021. Explaining in- dividual predictions when features are dependent: More ac- curate approximations to Shapley values. Artificial Intelli- gence, 298: 103502. Adadi, A.; and Berrada, M. 2018. Peeking inside the black- box: a survey on explainable artificial intelligence (XAI). IEEE access, 6: 52138–52160. Ancona, M.; Ceolini, E.; ̈Oztireli, C.; and Gross, M. 2017. Towards better understanding of gradient-based attribu- arXiv preprint tion methods for deep neural networks. arXiv:1711.06104. Ancona, M.; Oztireli, C.; and Gross, M. 2019. Explaining deep neural networks with a polynomial time algorithm for shapley value approximation. In International Conference on Machine Learning, 272–281. PMLR. Ando, K.; and Takase, K. 2020. Monte Carlo algorithm for calculating the Shapley values of minimum cost spanning tree games. Journal of the Operations Research Society of Japan, 63(1): 31–40. Angelov, P.; and Soares, E. 2020. Towards explainable deep neural networks (xDNN). Neural Networks, 130: 185–194. Arrieta, A. B.; D ́ıaz-Rodr ́ıguez, N.; Del Ser, J.; Bennetot, A.; Tabik, S.; Barbado, A.; Garc ́ıa, S.; Gil-L ́opez, S.; Molina, D.; Benjamins, R.; et al. 2020. Explainable Artificial In- telligence (XAI): Concepts, taxonomies, opportunities and challenges toward responsible AI. Information fusion, 58: 82–115. Aumann, R. J.; and Shapley, L. S. 1974. Values of Non- Atomic Games. Princeton University Press. Aumann, R. J.; and Shapley, L. S. 2015. Values of non- atomic games. Princeton University Press. Binder, A.; Montavon, G.; Lapuschkin, S.; M ̈uller, K.-R.; and Samek, W. 2016. Layer-wise relevance propagation for neural networks with local renormalization layers. In Inter- national Conference on Artificial Neural Networks, 63–71. Springer. Chen, H.; Covert, I. C.; Lundberg, S. M.; and Lee, S.-I. 2023. Algorithms to estimate Shapley value feature attributions. Nature Machine Intelligence, 1–12. Chen, H.; Lundberg, S.; and Lee, S.-I. 2021. Explaining models by propagating Shapley values of local components. In Explainable AI in Healthcare and Medicine, 261–270. Springer. Chen, H.; Lundberg, S. M.; and Lee, S.-I. 2022. Explaining a series of models by propagating Shapley values. Nature communications, 13(1): 4512. Dabkowski, P.; and Gal, Y. 2017. Real time image saliency for black box classifiers. Advances in neural information processing systems, 30. Das, A.; and Rad, P. 2020. Opportunities and challenges in explainable artificial intelligence (xai): A survey. arXiv preprint arXiv:2006.11371. Deng, J.; Dong, W.; Socher, R.; Li, L.-J.; Li, K.; and Fei- Imagenet: A large-scale hierarchical image Fei, L. 2009. database. In 2009 IEEE conference on computer vision and pattern recognition, 248–255. Ieee. Duell, J.; Fan, X.; Fu, H.; and Seisenberger, M. 2023. Batch Integrated Gradients: Explanations for Temporal Electronic In International Conference on Artificial Health Records. Intelligence in Medicine, 120–124. Springer. Enguehard, J. 2023. Sequential Integrated Gradients: a sim- ple but effective method for explaining language models. arXiv preprint arXiv:2305.15853. Feng, T.; Zhou, Z.; Tarun, J.; and Nair, V. N. 2022. Com- paring Baseline Shapley and Integrated Gradients for Lo- cal Explanation: Some Additional Insights. arXiv preprint arXiv:2208.06096. Frye, C.; de Mijolla, D.; Begley, T.; Cowton, L.; Stanley, M.; and Feige, I. 2020. Shapley explainability on the data manifold. arXiv preprint arXiv:2006.01272. Gauthier, T. D. 2001. Detecting trends using Spearman's rank correlation coefficient. Environmental forensics, 2(4): 359–362. Interpretation Ghorbani, A.; Abid, A.; and Zou, J. 2019. In Proceedings of the AAAI of neural networks is fragile. conference on artificial intelligence, volume 33, 3681–3688. Ghorbani, A.; and Zou, J. 2019. Data shapley: Equitable val- uation of data for machine learning. In International Con- ference on Machine Learning, 2242–2251. PMLR. Gunning, D.; and Aha, D. 2019. DARPA's explainable artifi- cial intelligence (XAI) program. AI magazine, 40(2): 44–58. He, K.; Zhang, X.; Ren, S.; and Sun, J. 2016. Deep resid- In Proceedings of the ual learning for image recognition. IEEE conference on computer vision and pattern recogni- tion, 770–778. Heskes, T.; Sijben, E.; Bucur, I. G.; and Claassen, T. 2020. Causal shapley values: Exploiting causal knowledge to ex- plain individual predictions of complex models. Advances in neural information processing systems, 33: 4778–4789. Jha, A.; K Aicher, J.; R Gazzara, M.; Singh, D.; and Barash, Y. 2020. Enhanced integrated gradients: improving inter- pretability of deep learning models using splicing codes as a case study. Genome biology, 21(1): 1–22. Kumar, I. E.; Venkatasubramanian, S.; Scheidegger, C.; and Friedler, S. 2020. Problems with Shapley-value-based ex- planations as feature importance measures. In International Conference on Machine Learning, 5491–5500. PMLR. Li, X.-H.; Shi, Y.; Li, H.; Bai, W.; Song, Y.; Cao, C. C.; and Chen, L. 2020. Quantitative evaluations on saliency methods: An experimental study. arXiv preprint arXiv:2012.15616. Lundberg, S. M.; and Lee, S.-I. 2017. A unified approach to interpreting model predictions. Advances in neural infor- mation processing systems, 30. Merrick, L.; and Taly, A. 2020. The explanation game: Explaining machine learning models using shapley val- In International Cross-Domain Conference for Ma- ues. chine Learning and Knowledge Extraction, 17–38. Springer. Mitchell, R.; Cooper, J.; Frank, E.; and Holmes, G. 2022. Sampling permutations for shapley value estimation. The Journal of Machine Learning Research, 23(1): 2082–2127. Interpretable machine learning. Lulu. Molnar, C. 2020. com. Mudrakarta, P. K.; Taly, A.; Sundararajan, M.; and Dhamd- here, K. 2018. Did the model understand the question? arXiv preprint arXiv:1805.05492. Pourdarbani, R.; Sabzi, S.; Nadimi, M.; and Paliwal, J. 2023. Interpretation of Hyperspectral Images Using Inte- grated Gradients to Detect Bruising in Lemons. Horticul- turae, 9(7): 750. Ras, G.; Xie, N.; Van Gerven, M.; and Doran, D. 2022. Ex- plainable deep learning: A field guide for the uninitiated. Journal of Artificial Intelligence Research, 73: 329–396. Ren, J.; Zhou, Z.; Chen, Q.; and Zhang, Q. 2021. Towards a Game-Theoretic View of Baseline Values in the Shapley Value. Shapley, L. S. 1951. Notes on the n-Person Game-II: The Value of an n-Person Game.(1951). Lloyd S Shapley. Shrikumar, A.; Greenside, P.; and Kundaje, A. 2017. Learn- ing important features through propagating activation dif- ferences. In International conference on machine learning, 3145–3153. PMLR. Simonyan, K.; Vedaldi, A.; and Zisserman, A. 2013. Deep inside convolutional networks: Visualising image arXiv preprint classification models and saliency maps. arXiv:1312.6034. Sundararajan, M.; and Najmi, A. 2020. The many Shapley values for model explanation. In International conference on machine learning, 9269–9278. PMLR. Sundararajan, M.; Taly, A.; and Yan, Q. 2017. Axiomatic attribution for deep networks. In International conference on machine learning, 3319–3328. PMLR. Sutton, R. S.; and Barto, A. G. 2018. Reinforcement learn- ing: An introduction. chapter 3.7. Tan, H. 2023. Maximum entropy baseline for integrated gra- In 2023 International Joint Conference on Neural dients. Networks (IJCNN), 1–8. IEEE. Yang, R.; Wang, B.; and Bilgic, M. 2023. IDGI: A Frame- work to Eliminate Explanation Noise from Integrated Gradi- ents. In Proceedings of the IEEE/CVF Conference on Com- puter Vision and Pattern Recognition, 23725–23734. Zhang, W.; Ji, X.; Chen, K.; Ding, Y.; and Fan, C. 2021. Learning a facial expression embedding disentangled from In Proceedings of the IEEE/CVF conference on identity. computer vision and pattern recognition, 6759–6768. Technical Appendix Details of the Theory Notations. Table 1 summarizes the detailed notations used in the "Method" section. Symbol Meaning x x′ xi r1, r2 S1, S2 v() F () t I N S i Vi(S) wi(S) k ˆw(k) D A V The sample to explain The baseline sample for IG The ith feature/player of x Players of x′ Players of x The utility function of SV The model/function to explain and evaluate A scalar value indicates a proportion A general complete set The set of all players in a game A coalition in a game The indicator of the player of interest The marginal contribution of xi to S The weight of Vi(S) A scalar value of the size of S The normalized w(k) The random sampled basline set of SIG A tensor of a mini-batch of IG results A tensor of the approximated SV result Table 1: Notations of Method Section Proof. We prove that our proposed proportional sam- pling is an unbiased estimator of the true Shapley Value. Let f P S SV (xi) denote the estimated Shapley Value of xi computed leveraging proportional sampling. pi(S) is the probability of S being sampled. Vi(S) is the marginal contribution. Ck is the value of (cid:0)|N |−1 (cid:1). Then pi(S) = 1 1 . N ×Ck Suppose we sampled for M times S based on probability function pi(S), |N | pi(k) = k (cid:88) pi(S)Vi(S) (cid:88) 1 |N | (cid:88) 1 |N | N −1 (cid:88) k=0 N −1 (cid:88) k=0 (cid:88) (cid:88) S∈N/{i} pi(k)Vi(S; |S| = k) Ck(cid:88) Vi(Sj) 1 Ck j=0 1 |N | × Ck Vi(S) E(f P S SV (xi)) = = = = = 1 M 1 M 1 M 1 M 1 M (cid:88) 1 * (cid:88) wi(S)Vi(S) S∈N/{i} wi(S)Vi(S)) = E(fSV (xi)) = E( (cid:88) S∈N/{i} Algorithms. Although we provided the algorithm of gen- eral Shapley Intergratd Gradients (SIG) in the main paper. We made small adjustments to it when applying it to game data and image data respectively. Game Data. Sampling from all coalitions can be time-consuming, and at times, it might even seem infeasible in actual cases. Therefore, we initially randomly sample a proportion Q of coalitions. From this subset, we then sample N baselines. Image Data. Direct computation for each pixel is nearly unfeasible. To simplify the process, we consider an area of M × N pixels as a sin- gle player, thereby streamlining the computation of contri- butions. Experimental Design Reward settings in the GridWorld In the GridWorld en- vironment, two types of reward functions are utilized. The first reward is denoted by r1, which is -1 for each step taken by the agent before it reaches the end position, and +1 when it reaches the end position. The second reward function r2 works as follows: • For every step taken by the agent before it reaches the ter- mination position for the first time, a -1 reward is given. • On reaching the termination position for the first time, the agent is awarded a +1 reward. • Subsequent to the agent's initial arrival at the termination position: – -0.5 reward is given for each step if the agent does not reach the termination position. – +1.5 reward is granted if the agent reaches the termi- nation position again. Shapley Value computes the marginal contribution of play- ers based on combinations of players. In contrast, our re- ward function addresses permutations. We define the reward function of a combination S to be the maximum reward as- sociated with any permutation P within combination S, i.e., v(S) = max v(P ), P ∈ S. These two reward function are employed in both 2 × 2 GridWorld and 2 × 3 GrdiWorld, resulting in Shapley Value shown in Fig. 8. Since reward functions are often not compatible with Deep Neural Networks (DNN). To address this, we utilize trained deep neural networks as a substitute for the reward functions. In detail, we take coalitions with one-hot encod- ing as samples, and regard output of reward function as la- bel. To evaluate performance of trained DNN model, we replace reward function with DNN in the computation of Shapley Value to assess the DNN's ability to emulate the reward function. We present one representative example to demonstrate that the DNN can accurately emulate the Shap- ley Value. Our trained DNN can seamlessly replace the util- ity function, producing Shapley Values that are nearly iden- tical. Further details can be found in the accompanying code. Models GridWorld For the experiments conducted in GridWorld, we employ a fully connected network that comprises one hidden layer with 64 neurons and another hidden layer with 32 neurons. Figure 8: Evaluation of DNN. We replace reward function with DNN in the computation of Shapley Value to assess the DNN's ability to emulate the reward function. Subfigures a and b represent 2 × 2 GridWorld with reward function r1 and r2 respectively. Subfigures c and d represents 2 × 3 GridWorld with reward function r1 and r2 respectively. Expression Code Task For the experiments conducted in Expression Code Tasks, we utilize DLN model and a private dataset. Image Classification Task For the experiments conducted in Image Classification Task, we apply Resnet model built in Pytorch and ImageNet dataset. Supplementary Results Running Time In Image Classification Tasks, we further evaluate the running time of the baseline methods. As de- picted in Fig. 9, the running time of our SIG closely mirrors that of the zero and mean baselines, outperforming the ran- dom baseline. Additionally, while the variance in running time for our SIG is slightly greater than that of the zero and mean baselines initially, it reduces as the number of images increases. This can mainly be attributed to ResNet's capa- bility to handle batch operations, which results in similar running times. While for GridWorld, where the computation of the Shap- ley Value doesn't support batch operation, there's a signifi- cant increase in running time, as reflected in Table 2, our SIG's running time is notably higher than that of the other baselines since our SIG iterates baseline one by one. GridWorld We delve into the effects of hyperparameters across different GridWorld environments. The influence of hypermeters N with fixed Q 40% is depicted in Fig. 10. Fur- ther details can be found in our codes. The outcomes indicate that our SIG displays impressive robustness across various Shapley Value cases for N . Figure 9: Running time of baseline methods with ResNet model and ImageNet dataset. Subfigures a, b, c and d repre- sent running time over 300, 500, 800, 1000 images respec- tively. Environment Reward Q N Random SIG (ours) 2 × 2 2 × 3 r1 r2 r1 r2 40% 200 40% 1500 4.59s 4.59s 4.59s 4.59s 55.05s 55.07s 91.79s 91.77s Zero Mean 4.59s 4.59s 4.59s 4.59s 4.59s 4.57s 4.59s 4.59s Table 2: Running time of each baseline method. The unit of running time is second (s). We take one example to explain that running time of our SIG is quite longer than other three baselines since GridWorld doesn't support batch operation. Figure 10: Average 1-Spearmanr metric for hypterparame- ters N across four GridWorld situations with fixed Q 40%. Subfigures a and b represent 2 × 2 GridWorld with reward function r1 and r2 respectively. Subfigures c and d represent 2 × 3 GridWorld with reward function r1 and r2 respec- tively. Text Figure 11: Average 1-Spearmanr metric for hypterparame- ters Q across four GridWorld situations. Subfigures a and b represents 2 × 2 GridWorld with reward function r1 and r2 respectivel under fixed N 200. Subfigures c and d represents 2 × 3 GridWorld with reward function r1 and r2 respectively under fixed N 1500. Figure 13: Accuracy metric over ImageNet for Resnet Model across various patches. Subfigures a, b, c, and d cor- respond to 0, 1, 2, 3 patches under 1000 images respectively. baseline methods Moreover, people tend to classify one image based on ar- eas, like heads, bodies, legs, rather than individual pixels. Given this, we are curious to see if pixels around important pixels identified by our SIG align with human intuition. To assess this, we opt to remove patches rather than individual pixels. Patch n is defined as areas of size (n + 1) × (n + 1) centered on important pixels. As shown in Fig. 13, we find that important pixels pinpointed by baseline methods are in alignment with our human intuition. Additionally, our SIG exhibits performance almost to both zero and mean baseline methods. For more details, please refer to the code we have provided. Figure 12: Accuracy metric over ImageNet for Resnet Model. a, b and c represent accuracy metrics of 500, 1000, 1500 images respectively. The impact of hypermeters Q is shown in Fig. 11. Further details can be found in code. The experiment reveals that our SIG consistently exhibits notable robustness with respect to Q. Image Classification Task We further explore the accu- racy metric of our SIG with lots of images in the Image Clas- sification Task. Results are presented in Fig. 12. It's evident that our SIG has almost same performance to zero and mean
http://arxiv.org/abs/2310.04816v1
"2023-10-07T14:13:14"
"2023-10-07T14:13:14"
Hacking Generative Models with Differentiable Network Bending
In this work, we propose a method to 'hack' generative models, pushing their outputs away from the original training distribution towards a new objective. We inject a small-scale trainable module between the intermediate layers of the model and train it for a low number of iterations, keeping the rest of the network frozen. The resulting output images display an uncanny quality, given by the tension between the original and new objectives that can be exploited for artistic purposes.
[ "Giacomo Aldegheri", "Alina Rogalska", "Ahmed Youssef", "Eugenia Iofinova" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04816v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04816v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.AI", "cs.LG", "I.2.6; I.2.10" ]
3 2 0 2 t c O 7 ] V C . s c [ 1 v 6 1 8 4 0 . 0 1 3 2 : v i X r a Hacking Generative Models with Differentiable Network Bending Giacomo Aldegheri∗ University of Amsterdam Alina Rogalska† Independent Researcher Ahmed Youssef† University of Cincinnati Eugenia Iofinova† IST Austria Abstract In this work, we propose a method to 'hack' generative models, pushing their outputs away from the original training distribution towards a new objective. We inject a small-scale trainable module between the intermediate layers of the model and train it for a low number of iterations, keeping the rest of the network frozen. The resulting output images display an uncanny quality, given by the tension between the original and new objectives that can be exploited for artistic purposes. Project website: https://galdegheri.github.io/diffbending/. Figure 1: Example outputs, using a variety of loss functions and bending modules. See Appendix B for the corresponding prompts and more examples. 1 Introduction Systems that fail to perform their intended task, or that are repurposed for new tasks, have long been recognized for their subversiveness and creative potential. Glitch artists [1] explore the aesthetic properties of media malfunctions, while hackers [2] take pleasure in the challenge of pushing existing hardware and software beyond its intended function [3]. In this work, we hack existing generative models to generate images they were not originally trained for. We adapt network bending [4], a technique consisting of injecting a transformation between intermediate layers of a generator, by making the transformation (the bending module, BM) differentiable. The images generated by these ∗Correspondence to giacomo.aldegheri@gmail.com †These authors contributed equally. Preprint. Under review. hacked models are a blend of the objects that the original model was trained to generate (butterflies) and new visual features introduced by the BMs. We find that they exhibit an uncanny quality that can be exploited for creative purposes, similar to glitch art's use of unintended media artifacts. Our method, thanks to its low computational cost, is accessible to a wide variety of artists and practitioners. Unlike current state of the art text-to-image pipelines, which aim to generate perfect- looking images, it provides a tool to explore strange and unexpected variations of existing models. 2 Method Figure 2: Overview of our proposed method. The BM takes the activation map of any chosen layer as input, and outputs a 'bent' activation map (shown in orange) which is fed as an input to the subsequent layers. Architecture. The differentiable BM can be injected after any layer of a generator network. Here we use a lightweight GAN based on the architecture in [5] and trained on a dataset of butterfly images3. We chose a model trained on a narrow domain of images in order to be able to clearly distinguish the effect of the BM from the model's original structure. Specifically, in our outputs the outline of the butterfly remains visible to varying degrees depending on the specific BM used. The BM takes as input the activation map of the chosen layer, and outputs a tensor of the same dimensionality. We use a variety of small-scale network architectures for our BMs (see Appendix for architectural details): (1) Convolutional: a plain convolutional neural network (CNN), using either ReLU (x) or sin(x) as an activation function. (2) Convolutional + Coordinates: a CNN with spatial coordinates (x, y and optionally r, the distance from the center) concatenated with the input features. This allows the BM to generate spatially-varying structures. (3) Convolutional + Sorting: a differentiable sorting network [6], operating across the width and/or height of the input feature map, followed by a CNN. This allows the BM to rearrange the spatial structure of the input activation map. Loss function. While the differentiable BM can be trained with any objective, here we experiment with two loss functions. The first one is the squared great circle distance between the CLIP [7] embeddings of the output images and of a user-provided prompt, to generate semantically evocative images. The second one is a loss function that minimizes the distance between images and prompt in CLIP space, while maximizing the distance among different images in the batch, to increase output diversity in a semantically meaningful space. Following the approach of [8], we use the InfoNCE [9] contrastive objective to maximize the mutual information between image and caption embeddings, while minimizing that among images in the batch, as expressed by the following equation: LN CE = log e(Q*K+/τ ) e(Q*K+/τ ) + (cid:80) K− e(Q*K−/τ ) Where Q is the image embedding, K + the prompt embedding, K − are the embeddings of the other images in the batch, and τ is a temperature hyperparameter. 3 Ethical Implications The work was done entirely on open-source or publicly available models and data. In particular, we avoided, as much as possible, the use of tools and data that use the uncompensated work of 3This model is available at https://huggingface.co/ceyda/butterfly_cropped_uniq1K_512. 2 zBENDING MODULE"3D rendering of ghost eating pomegranate"LOSSBent activation tensor (traditional) artists. The only possible exception is the use of the pretrained CLIP model, for which we were not aware of alternatives. Further, since our method provides only a very coarse control of the output, we do not believe that it aids the creation of works that break copyright or produce obscene or incendiary images, over what is already available. References [1] Rosa Menkman. Glitch studies manifesto. Video vortex reader II: Moving images beyond YouTube, pages 336–347, 2011. [2] Jon Erickson. Hacking: the art of exploitation. No starch press, 2008. [3] Zack Kotzer. A catalogue of all the devices that can somehow run 'Doom'. VICE, May 2016 (Accessed 20 September 2023). URL https://www.vice.com/en/article/qkjv9x/ a-catalogue-of-all-the-devices-that-can-somehow-run-doom. [4] Terence Broad, Frederic Fol Leymarie, and Mick Grierson. Network bending: Expressive manipulation of deep generative models. In Artificial Intelligence in Music, Sound, Art and Design: 10th International Conference, EvoMUSART 2021, Held as Part of EvoStar 2021, Virtual Event, April 7–9, 2021, Proceedings 10, pages 20–36. Springer, 2021. [5] Bingchen Liu, Yizhe Zhu, Kunpeng Song, and Ahmed Elgammal. Towards faster and stabilized In International Conference on GAN training for high-fidelity few-shot image synthesis. Learning Representations, 2020. [6] Felix Petersen, Christian Borgelt, Hilde Kuehne, and Oliver Deussen. Monotonic differentiable In International Conference on Learning Representations, 2022. URL sorting networks. https://openreview.net/forum?id=IcUWShptD7d. [7] 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 International conference on machine learning, pages 8748–8763. PMLR, 2021. [8] Yingchen Yu, Fangneng Zhan, Rongliang Wu, Jiahui Zhang, Shijian Lu, Miaomiao Cui, Xuan- song Xie, Xian-Sheng Hua, and Chunyan Miao. Towards counterfactual image manipulation via CLIP. In Proceedings of the 30th ACM International Conference on Multimedia, pages 3637–3645, 2022. [9] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. [10] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. 3 Acknowledgments We would like to thank Viorica Patraucean, Razvan Pascanu, and the entire staff of the Eastern European Machine Learning Summer School '22 for bringing us together, and Viorica in particular for her support in getting this project off the ground. We would also like to thank Piotr Mirowski for his advice and feedback on our early ideas, and the former members of the project for their enthusiasm and ideas in the brainstorming sessions. In particular, Ivan Vrkic, for setting up the initial Google Colab environment. A Network architecture and training The BMs can be applied at any layer of a generator network. In all experiments reported here, we keep this fixed to the 6th layer (for the convolutional BMs) and to the 4th layer (for the Convolutional + Sorting BM) of the ButterflyGAN generator. These layers have 64 and 256 channels, respectively. However, we encourage users to experiment with applying the BMs to different layers. All the BMs used here share a basic CNN architecture, comprising two convolutional layers with 3x3 kernels, 'same' padding (to keep the size of the output the same as the input) and a number of input, hidden and output channels equal to those of the chosen layer's activation map. The activation function (ReLU (x) or sin x is applied after the first convolutional layer. In the coordinate-aware BM, the x and y coordinates indicating locations on the activation map (scaled between 0 − 1) are concatenated with the input features along the channel dimension. The Convolutional + Sorting BM comprises a CNN that assigns scores to each row of the activation map, followed by a Bitonic differentiable sorting layer [6], with a steepness hyperparameter fixed at 50, that sorts these scores in increasing order. The permutation matrix generated by the sorting layer is then used to reorder the input activation map along the chosen dimension (width or height). The sorting network is followed by a standard convolutional BM. All networks are trained for a fixed number of 1000 iterations, with batch size 16, using the Adam [10] optimizer with a learning rate of 1e−3. Training takes around 3 minutes on a single NVIDIA GeForce RTX 3080 Ti. B Sample outputs for a range of queries In the next pages, we present the first 16 example outputs (not filtered, sorted, or cherry-picked in any way) for a range of prompts and training configurations. 4 Figure 3: First 16 outputs for the prompt "Psychedelic painting of a multi-armed deity" using the vanilla convolutional BM and standard CLIP loss. 5 Figure 4: First 16 outputs for the prompt "Inflatable plastic bodybuilder in a colorful album cover painted by Magritte" using the coordinates-aware BM and InfoNCE loss. 6 Figure 5: First 16 outputs for the prompt "Hieronymus Bosch particle system rendered in Blender" using the coordinates-aware BM and InfoNCE loss. 7 Figure 6: First 16 outputs for the prompt "A colorful tree on a blue sky painted by Cézanne", using the Convolutional + Sorting BM and InfoNCE loss. 8 Figure 7: First 16 outputs for the prompt "Brutalist anime robot", using the Convolutional + Sorting BM and InfoNCE loss. 9 C Role of InfoNCE loss In this section, we compare model outputs with a BM trained with the standard CLIP [7] loss (squared great circle distance between embeddings of the image and caption) and with our novel contrastive loss, based on InfoNCE [9], which maximizes the similarity (mutual information) between image and caption embeddings while minimizing that among different images in a batch, to encourage output diversity. These outputs were generated using the coordinates-aware BM, and noise vectors generated using the same random seeds were fed to the two models, for a more direct comparison. The temperature τ for the InfoNCE loss was set at 0.001. We can observe that the InfoNCE-generated outputs tend to be more diverse, with several different color combinations and textures, while the standard CLIP outputs tend to be more uniform and to have a smoother quality. These different losses can be used to achieve different artistic effects. Figure 8: Example outputs of a coordinates-aware BM with the standard CLIP loss (top) and InfoNCE loss (bottom). The prompt was "Inflatable plastic bodybuilder in a colorful album cover painted by Magritte". 10 Figure 9: Example outputs of a coordinates-aware BM with the standard CLIP loss (top) and InfoNCE loss (bottom). The prompt was "A gang of biker pumpkins painted by Jan van Eyck". 11 D Role of spatial coordinates In this section, we showcase the difference between the coordinates-aware BM, in which x and y spatial coordinates are concatenated to the activation map, and the vanilla convolutional BM. Examples of the two models, for prompts that involve spatial structure, are shown in the figure below. From a qualitative inspection, we can see that the coordinates-aware BM segments different areas of the image more clearly, while the vanilla BM tends to mix different colors together. Somewhat surprisingly, the coordinates-aware BM does not generate the global spatial structure that would be expected given the prompt, such as the three vertical sections of the French flag and the sky being positioned above the landscape. Figure 10: Example outputs of a BM with (left) and without (right) spatial coordinates. The prompts were, from top to bottom, "French flag", "Green landscape and blue sky", and "Water and oil". 12
http://arxiv.org/abs/2310.04815v1
"2023-10-07T14:12:15"
"2023-10-07T14:12:15"
Critique Ability of Large Language Models
Critical thinking is essential for rational decision-making and problem-solving. This skill hinges on the ability to provide precise and reasoned critiques and is a hallmark of human intelligence. In the era of large language models (LLMs), this study explores the ability of LLMs to deliver accurate critiques across various tasks. We are interested in this topic as a capable critic model could not only serve as a reliable evaluator, but also as a source of supervised signals for model tuning. Particularly, if a model can self-critique, it has the potential for autonomous self-improvement. To examine this, we introduce a unified evaluation framework for assessing the critique abilities of LLMs. We develop a benchmark called CriticBench, which comprises 3K high-quality natural language queries and corresponding model responses; and annotate the correctness of these responses. The benchmark cover tasks such as math problem-solving, code completion, and question answering. We evaluate multiple LLMs on the collected dataset and our analysis reveals several noteworthy insights: (1) Critique is generally challenging for most LLMs, and this capability often emerges only when models are sufficiently large. (2) In particular, self-critique is especially difficult. Even top-performing LLMs struggle to achieve satisfactory performance. (3) Models tend to have lower critique accuracy on problems where they are most uncertain. To this end, we introduce a simple yet effective baseline named self-check, which leverages self-critique to improve task performance for various models. We hope this study serves as an initial exploration into understanding the critique abilities of LLMs, and aims to inform future research, including the development of more proficient critic models and the application of critiques across diverse tasks.
[ "Liangchen Luo", "Zi Lin", "Yinxiao Liu", "Lei Shu", "Yun Zhu", "Jingbo Shang", "Lei Meng" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04815v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04815v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 5 1 8 4 0 . 0 1 3 2 : v i X r a CRITIQUE ABILITY OF LARGE LANGUAGE MODELS Liangchen Luo†∗ Zi Lin‡ Yinxiao Liu† Lei Shu† Yun Zhu† Jingbo Shang‡ Lei Meng†∗ †Google Research ‡UC San Diego ABSTRACT Critical thinking is essential for rational decision-making and problem-solving. This skill hinges on the ability to provide precise and reasoned critiques and is a hallmark of human intelligence. In the era of large language models (LLMs), this study explores the ability of LLMs to deliver accurate critiques across various tasks. We are interested in this topic as a capable critic model could not only serve as a reliable evaluator, but also as a source of supervised signals for model tun- ing. Particularly, if a model can self-critique, it has the potential for autonomous self-improvement. To examine this, we introduce a unified evaluation framework for assessing the critique abilities of LLMs. We develop a benchmark called CRITICBENCH, which comprises 3K high-quality natural language queries and corresponding model responses; and annotate the correctness of these responses. The benchmark cover tasks such as math problem-solving, code completion, and question answering. We evaluate multiple LLMs on the collected dataset and our analysis reveals several noteworthy insights: (1) Critique is generally chal- lenging for most LLMs, and this capability often emerges only when models are sufficiently large. (2) In particular, self-critique is especially difficult. Even top- performing LLMs struggle to achieve satisfactory performance. (3) Models tend to have lower critique accuracy on problems where they are most uncertain. To this end, we introduce a simple yet effective baseline named self-check, which leverages self-critique to improve task performance for various models. We hope this study serves as an initial exploration into understanding the critique abilities of LLMs, and aims to inform future research, including the development of more proficient critic models and the application of critiques across diverse tasks. 1 INTRODUCTION "Self-criticism is an art not many are qualified to practice." - Joyce Carol Oates Large language models (LLMs) have demonstrated impressive capacities in a wide range of tasks (Google et al., 2023; OpenAI, 2023). Consequently, the evaluation of LLMs has shifted focus from basic sentence coherence to more advanced capabilities, e.g., knowledge acquisition and logical rea- soning (Hendrycks et al., 2021; BIG-Bench authors, 2023). One capability that is overlooked in current evaluation frameworks is the ability of critical thinking, which is an important hallmark of human intelligence that requires logic, reasoning, and knowledge. This ability ensures that LLMs can provide precise and reasoned critiques towards model responses. A model with robust cri- tique ability can identify potential misinformation, errors or context misalignment in model outputs, thereby showing their specific shortcomings that can serve as a feedback for improvement. While recent studies have used LLMs for various forms of critique across diverse applications (Madaan et al., 2023; Saunders et al., 2022; Shinn et al., 2023), they primarily focus on advancing the state of the art for specific tasks instead of providing a comprehensive assessment of critique ability. To address this gap, we propose a standardized benchmark CRITICBENCH to assess the critique abilities of LLMs in diverse tasks. We define a model's critique ability as "the capacity to identify flaws in model responses to queries". Figure 1 provides an example of a flaw in the response to a query, and how it is identified by a critique. The benchmark consists of query-response-judgment triplets. During evaluation, we always prompt a model to perform a chain-of-thought analysis to ∗Correspondence: {luolc,leimeng}@google.com. 1 Figure 1: An example from CRITICBENCH is presented. The query originates from GSM8K (Cobbe et al., 2021), and the response is generated by PaLM-2-L (Google et al., 2023). A flaw in the response is highlighted in red. The model shows low confidence in this query, as evidenced by a certainty score of only 0.11. Below the dashed line, a critique is generated by few-shot prompting PaLM-2-L. It successfully identifies the flaw in the response and makes an accurate judgment. As the policy model and critic model are the same, this example also serves as an instance of self- critique. identify flaws and explain the reason; and then provide a final judgment on the response's correct- ness. Comparing this judgment to ground-truth labels allows us to explicitly evaluate a model's critique accuracy and implicitly assess its analytical process toward an accurate judgment. To construct CRITICBENCH (Section 3), we gather natural language queries from multiple scientific benchmarks, covering tasks like math problem-solving (Cobbe et al., 2021), code completion (Chen et al., 2021), and question answering (Lin et al., 2021). We employ PaLM-2 models (Google et al., 2023) of various sizes to generate responses, which are then annotated for correctness. To ensure data quality, a complexity-based selection strategy (Fu et al., 2023b) is used to identify high-quality responses among the candidates. Furthermore, to select queries of suitable difficulty, we introduce an auxiliary metric that quantifies a model's certainty regarding a query. Such a metric can help select queries that poses a moderate level of challenge to models. As a result, we collect 3K high- quality examples from an initial pool of 780K candidates to form the benchmark mixture. This data collection method is both scalable and generalizable, requiring no extra human intervention and suitable for a variety of tasks. Given CRITICBENCH, we can now analyze the critique abilities of LLMs (Section 4). There are specific aspects that particularly interest us. First, critique inherently involves logic, reasoning, and knowledge, making it a complex process even for humans. Therefore, it is not clear how well LLMs can emulate this capability. It is possible that critique ability is yet another emergent ability, i.e., ability not present in smaller-scale models that are present in larger-scale models (Jang, 2023). In- vestigating how critique ability scales with model size could offer insights into model size selection and whether fine-tuning is needed for smaller models (Section 4.1). Additionally, self-critique, i.e., when a model critiques its own outputs, is a format of critique of particular interest to us, as it is relevant to a model's potential for self-improvement (Section 4.2). Finally, we are also interested in what types of queries pose more challenges for LLMs to critique (Section 4.3). To investigate these aspects, we evaluate various widely-used LLMs on CRITICBENCH and reveal several intriguing findings: (1) Critique tasks pose a considerable challenge for LLMs. Only large- scale models exhibit performance with a notable difference from a random guess baseline, indicating that the capacity for critique serves as an emergent indicator of a capable LLM. (2) Self-critique, i.e., a model critiquing its own output, is particularly difficult. Even the strongest LLMs struggle to achieve satisfactory performance. (3) A challenging query is not only difficult for LLMs to directly answer correctly, but also poses a challenge in assessing an answer's correctness to that query. To this end, we also propose a simple yet effective baseline called self-check (Section 5). The basic idea is to prompt the model to confirm the accuracy of their generated answers by self-critique before presenting them. The method consistently enhances the baseline performance (Wang et al., 2023) on math word problems across multiple models, achieving an average of 9.55% error reduction rate, which demonstrates the potential utility of critiques from LLMs. Our contributions are three-fold: 2 Query: Heather's razors come 4 to a pack and cost $4.00 a pack. They are currently on sale for buy one get one free. She also has a$2.00 coupon. How much will each individual razor cost, in cents, after the discount if she buys 2 packs of razors?Response: She bought 2 packs. Each pack has 4 razors, so in total she has 2 * 4 = 8 razors. Each pack costs $4. She has a coupon of$2. So she paid 2 * $4 - $2 = $6. Each razor costs $6/8 = $0.75. The answer is 75.Certainty Score: 0.11Correctness Rate: 0.93Analysis: The student correctly calculated the total cost of 2 packs of razors with the coupon. However, they didn't consider the factthat the second pack is free. So, Heather only paid for one pack, not two. Therefore, the cost per razor is $2 / 8 = $0.25. The answer isincorrect.Judgment: incorrect. • New Benchmark CRITICBENCH is the first benchmark that comprehensively assesses the cri- tique abilities of LLMs across diverse tasks and scenarios, which fills a gap in the current LLM evaluation framework by introducing this important ability. • New Findings Our findings on CRITICBENCH underscore the nuances and depth of LLM's critique abilities (Section 4). These revelations enhance our understanding of the inherent com- plexities in LLMs and emphasize the need for advanced training and evaluation techniques. • New Capacity The proposed self-check method (Section 5) not only advances the performance on math word problems over the baseline, but also indicates the new capacity of critique ability with LLMs, which is a fruitful avenue for LLM's self-improvement strategies. 2 DEFINITION OF CRITIQUE ABILITY The concept of critique has diverse interpretations and is often applied informally in everyday con- texts. Recent research employs large language models to offer critiques across multiple applica- tions (Madaan et al., 2023; Paul et al., 2023; Saunders et al., 2022; Shinn et al., 2023), resulting in varying formats and requirements for their "critiques". These studies primarily aim to enhance performance in specific tasks, neglecting to clarify the meaning of the term critique. In this paper, we consider the definition of a language model's critique ability as the capacity to identify flaws in model responses to queries. These flaws can differ depending on the task, ranging from incorrect reasoning or calculation in mathematical problems to syntax errors in code completion. When a model self-assesses its own outputs, we term this as self-critique, a notion that particu- larly intrigues us. If models can engage in self-critique and reflection, they can potentially do self- improvement, requiring minimal human intervention. On the risky side, this autonomy also raises concerns about reduced human oversight (Bowman et al., 2022). Yet we posit that self-critique may still remain a challenging capability for large language models, as a flaw-aware model would logically not produce faulty output in the first place (Saunders et al., 2022). 3 CONSTRUCTION OF CRITICBENCH As discussed in Section 2, prior research employs large language models to offer critiques, yet requires particular process and formats to meet their task-specific objectives. Currently, there is no standard or generalizable way to assess the critique abilities of language models across diverse tasks. This section proposes CRITICBENCH, a unified, standardized evaluation framework to tackle this issue. The framework aims to fulfill three criteria: • Scalability Given the broad range of tasks already established within the community, and the anticipation of more to emerge, a scalable data collection method is essential. The method should minimize human annotation efforts and ideally be fully autonomous. • Generalizability The framework should be task-agnostic, capable of generalizing across vari- ous tasks and domains. • Quality We believe quality matters more than quantity. When volume of data is substantial, we prioritize selecting those that most effectively differentiate between stronger and weaker models. The following subsections illustrate the detailed construction process. Specifically, Section 3.1 presents the initial data generation on three different tasks, where we get the collection of query- response-judgment triplets as shown in Figure 1. Section 3.2 then shows how to select data based on the initial collection to guarantee the quality of responses and queries. 3.1 DATA GENERATION For the tasks of interest, we begin by employing existing scientific datasets from relevant domains. These datasets are expected to include queries that large language models, which here we refer to as generators, aim to respond. To ensure scalability, it is essential to have an automated approach for assessing the correctness of a model's responses. Classification tasks naturally meet this criterion, as model outputs can be auto- 3 matically compared to ground-truth labels. Similarly, tasks that involve auto-verifiable answers also comply; for instance, in code completion tasks with unit tests available, the validity of the generated code can be confirmed by passing all tests. For free-form generation tasks such as summarization and translation, assessing the quality of a response remains non-trivial. However, recent advances in LLM-based automated evaluation for generation tasks mitigate this issue to some extent, enabling the assessment without human intervention (Liu et al., 2023). While not exhaustive, these already cover a significant range of tasks and domains. We acknowledge the limitations in some auto-assessment approaches, especially for generation tasks. Improving the reliability of these automated evaluation methods, however, is beyond the scope of this paper. We employ five different sizes of PaLM-2 models (Google et al., 2023) as our generators. These models are pretrained solely for next-token prediction and do not undergo supervised fine-tuning or reinforcement learning from human feedback. For coding-related tasks, apart from the standard PaLM-2 models, we also employ the specialized PaLM-2-S* variant. The latter is obtained through continual training of PaLM-2-S on a data mixture enriched with code-heavy corpus. Query Collection We extract queries from three datasets: GSM8K (Cobbe et al., 2021), Hu- manEval (Chen et al., 2021), and TruthfulQA (Lin et al., 2021), covering the tasks of math-problem solving, code completion and question answering. For datasets with distinct training and test splits, we use the test data; for datasets intended only for evaluation, all examples are used. Detailed considerations and rationale behind the selection of these datasets are provided in Appendix B. Response Generation We sample k responses for each query, with k = 64 for GSM8K and TruthfulQA, and k = 100 for HumanEval. In the case of TruthfulQA, we employ its multiple- choice variation to facilitate autonomous answer annotation. After filtering out invalid outputs such as empty ones, we collect a total of 780K responses as an initial pool of candidates. Annotation for Correctness For GSM8K, we assess answer correctness by comparing its numeric equality to the ground truth, as described by Lewkowycz et al. (2022). For HumanEval, correctness is determined by the passage of provided unit tests. For TruthfulQA, we utilize its classification format, judging correctness based on a match with the ground-truth label. More details on hyper-parameter settings and prompt templates are available in Appendix C. 3.2 DATA SELECTION Many existing evaluation benchmarks for large language models suffer from insufficient differentia- bility, i.e., both stronger and weaker models yield similar performance (Fu, 2023). This issue likely arises from the presence of either overly simple or exceedingly difficult examples in the benchmarks. Such examples are less valuable for evaluation and can undermine the utility of the benchmarks when average scores are calculated, leading to indistinguishable outcomes. To address the issue, we introduce various filtering strategies aimed at selecting high-quality and differentiable examples. 3.2.1 HIGH-QUALITY RESPONSE SELECTION Initially, we can narrow the example set from 780K to 15K by sampling one correct and one incorrect response for each query and generator. While random uniform sampling is the the most straightfor- ward strategy, it risks including examples with obvious errors, which offer little evaluative value. To mitigate this, for the incorrect responses we focus on sampling convincing wrong-answers (Light- man et al., 2023) that are more likely to fool the models. In cases suitable for majority voting, we identify the most frequent incorrect answer for each query, and then sample from responses contain- ing this answer. For coding tasks where majority voting is not applicable, we sample from responses that pass the most unit tests, indicating that it is mostly correct but fails in certain corner cases. To further enhance data quality, we employ the complexity-based sample selection strategy (Fu et al., 2023b) for tasks that require chain-of-thought reasoning. Specifically, we opt for responses that involve more reasoning steps, as this is positively correlated with higher accuracy (Fu et al., 2023b). This approach is beneficial for sampling both types of responses. For correct ones, it minimizes the likelihood of false positives; for incorrect ones, it yields more convincing responses that pose greater challenges in flaw detection for weaker models. 4 Lastly, as many tasks are challenging and may require emergent abilities (Wei et al., 2022a) to per- form well, smaller models generally underperform and produce lower-quality responses compared to larger ones. We include data from these smaller models only for analyzing self-critique abilities; they are excluded from the final evaluation benchmarks. 3.2.2 CERTAINTY-BASED QUERY SELECTION Thus far, our focus has been on choosing responses with higher quality and likelihood of accu- racy. We now shift our focus to the quality of queries. Not all queries are equally valuable: trivial queries that models easily answer correctly are generally less valuable, whereas queries consistently answered incorrectly may either be too complex for LLMs or suffer from wrong "golden" labels. To minimize the presence of such queries in our benchmark, we introduce two metrics to quantify the levels of certainty when models answer a query: the certainty score and correctness rate. We will use these metrics to help us select queries of moderate difficulty. The metrics draw inspiration from the majority voting mechanism in the self-consistency approach (Wang et al., 2023), which functions by generating multiple candidate outputs for a query, and then aggregating them using a majority voting procedure to select the most commonly occurring answer. Observing that different majority votes, even those resulting in the same outcome, can indicate vastly different levels of certainty. To illustrate, consider a voting situation with 100 candidates where: (i) all candidates are x; and (ii) 51 candidates are x and 49 are y. Although both situations result in a majority vote for x, the level of certainty varies significantly: the former situation denotes a high degree of confidence, whereas the latter reflects a considerable level of uncertainty. Motivated by the observations above, we propose the following method to measure levels of un- certainty in language model responses. Suppose we prompt a language model LM : P (a|q) with a query q and sample a bag of k answers A = {ai}k i=1, where ai ∼ P (a|q). We denote the most and the second most frequent answers among these k responses as a(1) and a(2), respectively. Un- certainty is measured by the frequency ratio of a(2) to a(1), where a larger ratio indicates a higher level of uncertainty. We term this ratio as uncertainty rate. An uncertainty rate of 1 - where the two most frequent answers appear with equal frequency - indicates extremely high model uncer- tainty. Conversely, an uncertainty rate of 0, implying that a(2) = 0, suggests that all responses are consistent, indicating the model's strong confidence in its answer. Formally, we use fA(a) = (cid:80) ai∈A 1condition (ai = a) to denote the frequency of an answer a among a bag of responses A and mode(A) = arg maxa fA(a) to denote the mode, i.e., the most frequently occurring item , of A. The uncertainty rate over model responses A to the query q is then defined as URLM(q; k) = fA(mode(A\A(1))) , where A(1) = {a | a = mode(A), a ∈ A} represents the most frequent responses in A. For the sake of conciseness and readability in our subsequent discussion, we also define a metric by the negative logarithm of the uncertainty rate to measure model certainty, represented as CertaintyLM(q; k) = − log (URLM(q; k)), where a larger value indicates a higher level of certainty. We term it as the certainty score. fA(mode(A)) In cases where the expected correct answer to a query is available, such as during model evaluation on a test dataset, the definitions above can be slightly adapted to introduce a new metric called correctness rate. This metric is defined as the frequency ratio of the correct answer to the most fA(a(e)) fA(mode(Awrong)) , where a(e) denotes the expected answer common wrong answer: CRLM(q; k) = and Awrong = (cid:8)a | a ̸= a(e), a ∈ A(cid:9) denotes the incorrect responses. Using self-consistency, the model votes a correct answer when the correctness rate exceeds 1, and conversely, it produces an incorrect answer when the rate falls below 1. In addition, as the rate approaches 1, the model exhibits increasing levels of uncertainty regarding the answer, no matter if it is correct or not. This metric naturally reflects the difficulty of a query to the model. We present a simple case study to intuitively demonstrate the properties of our proposed metrics. We evaluate PaLM-2-S (Google et al., 2023) on GSM8K (Cobbe et al., 2021) using a 64-path self- consistency. The relationship between model certainty, correctness rate (CR), and model accuracy is depicted in Figure 2. 5 (a) Relation of certainty to CR. (b) Relation of certainty to accuracy. Figure 2: Certainty of PaLM-2-S on GSM8K: Relation to correctness rate (CR) and accuracy; based on the 8-shot chain-of-thought prompt from Wei et al. (2022b) and a 64-path self-consistency. Figure 2a displays the correlation between model certainty and correctness rate (CR). Test examples with lower CR present greater challenges to models. As evidenced in the figure, lower certainty cor- relates with more low-CR examples, leading to more incorrect predictions. As certainty increases, the instances of low CR diminish, resulting in higher accuracy. Figure 2b illustrates the correlation between model certainty and accuracy in a more straightforward way. As the certainty level rises, the proportion of incorrect predictions markedly decreases, signifying increased accuracy. We now adopt a certainty-based sample selection strategy. We calculate the correctness rate for each query, selecting those with a CR close to 1. This suggests that models exhibit considerable hesitation and uncertainty when responding to these queries, indicating a moderate level of difficulty that is neither excessively simple (CR → +∞) nor overly challenging (CR → 0). For coding tasks, where certainty metrics cannot be computed, we use the ratio of correct to incorrect answers as a surrogate for CR. Moreover, due to the limited size of HumanEval, we only exclude the simpler queries with a CR > 1, and retain the challenging examples. We will analyze the correlation between critique ability and model certainty for queries in Section 4.3. Detailed implementation of each stage in data selection can be found in Appendix D. Final Data Formulation To this end, we could further narrow the benchmark dataset to 3K high- quality, differentiable examples, with 1K for each original dataset. The resulting subsets are named as Critic-GSM8K, Critic-HumanEval, and Critic-TruthfulQA, and their mixture is referred to as CRITICBENCH. We provide the data statistics and examples in Appendix E. As our data collection method is scalable and generalizable across tasks, we view the construction of CRITICBENCH as a continuous effort. This paper serves as an initial step, presenting three representative datasets. We hope to extend the mixture to cover more tasks and scenarios in future work. 4 PROPERTIES OF CRITIQUE ABILITY In this section, we conduct our analysis of the critique ability of large language models on CRIT- ICBENCH. We focus primarily on the following three aspects: (1) how critique ability scales with model size (Section 4.1); (2) models' self-critique ability (Section 4.2); and (3) the correlation be- tween critique ability and models' certainty in response to a query (Section 4.3). For each query-response pair in the dataset, we employ few-shot prompting to instruct models to first conduct a chain-of-thought analysis to identify any flaws in the response and explain the reason; and subsequently issue a judgment on the response's correctness. In evaluation, we focus solely on the accuracy of this final judgment, disregarding the correctness of the intermediate analysis. As empirical evidence has shown a strong correlation between the accuracy of intermediate chain-of- thought and the final answer (Wei et al., 2022b; Lewkowycz et al., 2022; Fu et al., 2023a), we can use the final judgment accuracy as a proxy for the model's critique analysis capability. Details about the evaluation settings can be found in Appendix F. 4.1 SCALING LAW Jang (2023) posits that critique ability may be an emergent ability (Wei et al., 2022a) that only emerges at certain scales of model size. We emphasize that it is better to seek an answer to this 6 0.01.53.04.56.0Certainty Score050100150200250Num ExamplesCR <22CR [22,20)CR [20,22)CR >220123456Certainty Score050100150200250Num ExamplesNum CorrectNum WrongAccuracy405060708090100Accuracy Figure 3: Scaling law of critique ability: Following Google et al. (2023), we use T-shirt size nota- tions to denote model sizes. All medium-sized or smaller models exhibit poor performance on all tasks, akin to random guessing. Critic-HumanEval poses a great challenge for all models. hypothesis before directing our efforts toward the applications of critiques. For a critic model to successfully improve the performance of specific tasks, it must possess at least moderate effec- tiveness. It is possible that the critique ability of smaller models is as futile as a random guess, rendering them incapable for downstream applications. A study of the scaling law of critique ability could provide us insights into the appropriate model size selection and whether fine-tuning should be considered for smaller models. We evaluate multiple widely-used LLM families available in various sizes on CRITICBENCH, in- cluding PaLM-2 (Google et al., 2023), LLaMA (Touvron et al., 2023a), LLaMA-2 (Touvron et al., 2023b), and ChatGPT (OpenAI, 2023). Figure 3 illustrates the scaling behavior of their critique abil- ities. The results for ChatGPT are not directly comparable to those of other models because its size is not disclosed and it undergoes instruction-tuning, whereas the others are all pretrained models. We include it here solely for reference purpose. On Critic-GSM8K and Critic-TruthfulQA, all mod- els of medium size or smaller exhibit poor performance, akin to random guessing. Only PaLM-2-L demonstrates non-trivial better results. On Critic-HumanEval, all models perform poorly; even the strongest pretrained model, PaLM-2-L, only achieves an accuracy score of merely 54.14%, which is just marginally better than a random guess. This is somewhat anticipated, as evaluating the cor- rectness of a code snippet without execution is often challenging even for expert software engineers. It is likely to gain a notable improvement when augmented by a code interpreter tool. Thus, the benchmark also serves as an ideal testbed to assess LLMs' tool-use capability. The observed scaling law supports the emergent ability hypothesis by Jang (2023). It suggests that the ability of critique is yet another key indicator of a strong large language model. 4.2 SELF-CRITIQUE ABILITY Figure 4: The accuracy of differently-sized critic models in critiquing answers produced by differently-sized policy models. For instance, the top-left cells indicate the accuracy of PaLM-2-L in critiquing answers from PaLM-2-XXS. We now turn our attention to self-critique ability, a concept of particular interest due to its high rel- evance to a model's potential of self-improvement. Figure 4 demonstrates the critique performance 7 XXSXSSMLModel Size50556065Accuracy (%)Critic-GSM8K: Scaling LawPaLM-2ChatGPTLLaMALLaMA-2RandomXXSXSSMLModel Size50525456Accuracy (%)Critic-HumanEval: Scaling LawPaLM-2PaLM-2-S*ChatGPTLLaMALLaMA-2RandomXXSXSSMLModel Size45.047.550.052.555.057.5Accuracy (%)Critic-TruthfulQA: Scaling LawPaLM-2ChatGPTLLaMALLaMA-2RandomXXSXSSMLAnswer Model SizeLMSXSXXSCritic Model Size77.14±0.0372.32±0.0163.66±0.0467.17±0.0260.10±0.1564.03±0.0356.30±0.0151.83±0.0453.21±0.0553.37±0.0767.54±0.0457.83±0.0252.10±0.0153.67±0.0855.56±0.0654.75±0.0149.93±0.0348.96±0.0648.37±0.0547.46±0.1148.63±0.0250.88±0.0148.99±0.0151.06±0.0551.10±0.03Critic-GSM8K: Critique AccuracyXXSXSSMLAnswer Model SizeLMSXSXXSCritic Model Size82.10±0.0265.91±0.0356.25±0.0653.15±0.0453.54±0.0665.02±0.0553.45±0.0252.05±0.0152.20±0.0450.00±0.0565.30±0.0854.87±0.0653.42±0.0752.93±0.0552.21±0.0556.41±0.0751.87±0.0951.07±0.0750.09±0.1352.46±0.0550.70±0.0150.93±0.0449.19±0.0349.61±0.0249.36±0.04Critic-HumanEval: Critique AccuracyXXSXSSMLAnswer Model SizeLMSXSXXSCritic Model Size60.87±0.0166.87±0.0260.88±0.0556.82±0.0651.68±0.0655.36±0.0156.65±0.0152.49±0.0350.74±0.0648.37±0.0753.25±0.0254.59±0.0349.06±0.0348.68±0.0247.55±0.0350.12±0.0152.25±0.0149.51±0.0348.51±0.0345.96±0.0349.00±0.0248.56±0.0447.90±0.0549.39±0.0246.25±0.02Critic-TruthfulQA: Critique Accuracy Figure 5: Self-critique accuracy of PaLM-2 models: On Critic-GSM8K, larger models demonstrate better self-critique ability. On the other two tasks, all models perform poorly. of various sizes of critic models in evaluating answers produced by different-sized policy models. The diagonal lines spanning from the lower left to the upper right represent the models' self-critique accuracy, and correspond to the curves in Figure 5. The scaling behavior varies across different subsets. It is unsurprising that models of all sizes strug- gle on Critic-HumanEval due to its challenging nature. On Critic-GSM8K, larger models display better self-critique ability. On Critic-TruthfulQA, however, models perform similarly to random guessing regardless of model size. We hypothesize the disparity is due to the underlying reasons of a model answering incorrectly to queries. For TruthfulQA, the wrong answers largely stem from false beliefs or misconceptions in models, which would also lead to critique failures. In contrast, for the math queries in GSM8K, incorrect responses primarily result from reasoning or computational flaws, which are likely detectable upon a double check through self-critiquing. Another finding is larger models are generally good at critiquing responses generated by smaller models. The outcome aligns with the expectation that smaller models are more prone to more obvious errors, which are easier caught by larger and more capable models. 4.3 CORRELATION TO CERTAINTY Figure 6: Relation to correctness rate (CR). Figure 7: Relation to certainty score. In Section 3.2.2, we introduce the use of certainty metrics to select queries of appropriate difficulty. While the metrics do reflect the challenge of answering a query, one may argue that it does not directly translate to the difficulty of critiquing an answer to that query. To address this, we examine 8 XXSXSSMLModel Size505254565860Accuracy (%)Critic-GSM8K: Self-Critique AccuracyPaLM-2RandomXXSXSSMLModel Size50515253Accuracy (%)Critic-HumanEval: Self-Critique AccuracyPaLM-2RandomXXSXSSMLModel Size49505152Accuracy (%)Critic-TruthfulQA: Self-Critique AccuracyPaLM-2Random<23[23,21)[21,21)[21,23)>23Correctness Rate (CR)455055606570Accuracy (%)Critic-GSM8K: Critique Accuracy - CRPaLM-2-XXSPaLM-2-XSPaLM-2-SPaLM-2-MPaLM-2-LRandom<23[23,21)[21,21)[21,23)>23Correctness Rate (CR)505560657075Accuracy (%)Critic-HumanEval: Critique Accuracy - CRPaLM-2-XXSPaLM-2-XSPaLM-2-SPaLM-2-MPaLM-2-LPaLM-2-S*Random<23[23,21)[21,21)[21,23)>23Correctness Rate (CR)455055606570Accuracy (%)Critic-TruthfulQA: Critique Accuracy - CRPaLM-2-XXSPaLM-2-XSPaLM-2-SPaLM-2-MPaLM-2-LRandom[0,1.5)[1.5,3)[3,4.5)>4.5Certainty5055606570Accuracy (%)Critic-GSM8K: Critique Accuracy - CertaintyPaLM-2-XXSPaLM-2-XSPaLM-2-SPaLM-2-MPaLM-2-LRandom[0,1.5)[1.5,3)[3,4.5)>4.5Certainty5055606570Accuracy (%)Critic-TruthfulQA: Critique Accuracy - CertaintyPaLM-2-XXSPaLM-2-XSPaLM-2-SPaLM-2-MPaLM-2-LRandom the correlation between critique accuracy and model certainty for a query. We evaluate PaLM-2 models on the benchmarks without applying certainty-based selection. Figures 6 and 7 display the correlation between critique ability, correctness rate, and certainty score. Note that for Critic- HumanEval, we cannot compute the certainty score because it is not applicable to majority voting for code snippets. Additionally, the correctness rate is calculated differently as detailed in Section 3.2.2. We observe a clear positive correlation between model certainty and critique accuracy. This suggests that a challenging query is not only difficult for LLMs to directly answer correctly, but also poses a challenge in evaluating an answer's correctness to the query. Consequently, the proposed certainty metrics serve as valuable criteria for data selection. 5 NEW CAPACITY WITH CRITIQUE: SELF-CONSISTENCY WITH SELF-CHECK To explore the new capacity with critique ability, we would like to introduce a straightforward yet effective baseline to demonstrate the potential of leveraging the critique ability to improve model performance. The idea is intuitive: drawing a parallel to humans participating in a contest - where they typically check their most uncertain answers before submission to identify and correct mistakes - we suggest a similar process can be emulated in language models. This can be accomplished by prompting the models to confirm the accuracy of their generated answers before presenting them. To achieve this, we introduce a self-check filtering on top of the self-consistency method (Wang et al., 2023), abbreviated as SC2. Assume with appropriate prompting, the language model functions as an answer-critiquing model V (a) ∈ {0, 1}, which serves as a binary indicator for the correctness of an answer a relative to its query q. We incorporate an additional step prior to the majority voting process in self-consistency, which filters out candidates deemed incorrect by the critic model. Specifically, for a set of k generated candidate answers A to a given query, the critic model selects those identified as correct, denoted by Asc = {a | V (a) = 1, a ∈ A}. Subsequently, the standard majority vote procedure is applied to the filtered candidates to derive the final answer asc2 = mode(Asc). Recall that the model is most prone to errors when uncertain about a question, as shown in Figure 2. We can reduce inference cost by only applying the self-check filtering selectively to questions of which the certainty score Certainty(q; k) falls below a predefined threshold C. Table 1: Evaluation results on GSM8K using the chain-of-thought prompt from Wei et al. (2022b). The self-consistency with self-check filtering technique outperforms the standard one across all models. aTaken from Google et al. (2023). Model ChatGPT PaLM-2 GPT-4 CoT CoT+SC@64 CoT+SC2@64 76.3 80.7a 91.3 83.5 91.3 95.8 84.0 (+0.5) 92.7 (+1.4) 96.2 (+0.4) We assess the performance of PaLM-2, ChatGPT and GPT-4 on the GSM8K dataset using the self- consistency with self-check method, as presented in Table 1. We use a certainty threshold of C = 2 for GPT-4 and C = 1 for both PaLM-2 and ChatGPT. Compared to self-consistency baselines, the additional self-check procedure achieves 3.03%, 16.09%, and 9.52% error reduction rate for ChatGPT, PalM-2 and GPT-4 respectively, highlighting the value of critique ability. It is noted that our primary objective of this paper is to explore the concept and attributes of critique ability, rather than advancing the state of the art. Thus, we opt to stick with the prompting-based critic model for the sake of simplicity. While fine-tuning the critic model or using critiques to supervise the policy model could potentially push the scores higher, such enhancements are not the focus of this study. We believe future work in this direction can further improve the performance. 6 CONCLUSION In this work, we conduct a study exploring critique abilities of LLMs across various tasks. Evalua- tion results of multiple widely-used LLMs on the proposed CRITICBENCH reveal that: most LLMs find critique challenging, especially self-critique. We introduce the self-check method as an effective 9 baseline to improve model performance through self-critique. Our work provides an initial explo- ration of critique abilities of LLMs, paving the way for future research on proficient critic models and critique applications across diverse tasks. REFERENCES Yuntao Bai, Saurav Kadavath, Sandipan Kundu, Amanda Askell, Jackson Kernion, Andy Jones, Anna Chen, Anna Goldie, Azalia Mirhoseini, Cameron McKinnon, Carol Chen, Catherine Ols- son, Christopher Olah, Danny Hernandez, Dawn Drain, Deep Ganguli, Dustin Li, Eli Tran- Johnson, Ethan Perez, Jamie Kerr, Jared Mueller, Jeffrey Ladish, Joshua Landau, Kamal Ndousse, Kamile Lukosuite, Liane Lovitt, Michael Sellitto, Nelson Elhage, Nicholas Schiefer, Noemi Mer- cado, Nova DasSarma, Robert Lasenby, Robin Larson, Sam Ringer, Scott Johnston, Shauna Kravec, Sheer El Showk, Stanislav Fort, Tamera Lanham, Timothy Telleen-Lawton, Tom Con- erly, Tom Henighan, Tristan Hume, Samuel R. Bowman, Zac Hatfield-Dodds, Ben Mann, Dario Amodei, Nicholas Joseph, Sam McCandlish, Tom Brown, and Jared Kaplan. Constitutional AI: Harmlessness from AI feedback. arXiv preprint arXiv:2212.08073, 2022. BIG-Bench authors. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. Transactions on Machine Learning Research (TMLR), 2023. Samuel R. Bowman, Jeeyoon Hyun, Ethan Perez, Edwin Chen, Craig Pettit, Scott Heiner, Kamil ̇e Lukoˇsi ̄ut ̇e, Amanda Askell, Andy Jones, Anna Chen, Anna Goldie, Azalia Mirhoseini, Cameron McKinnon, Christopher Olah, Daniela Amodei, Dario Amodei, Dawn Drain, Dustin Li, Eli Tran- Johnson, Jackson Kernion, Jamie Kerr, Jared Mueller, Jeffrey Ladish, Joshua Landau, Kamal Ndousse, Liane Lovitt, Nelson Elhage, Nicholas Schiefer, Nicholas Joseph, Noem ́ı Mercado, Nova DasSarma, Robin Larson, Sam McCandlish, Sandipan Kundu, Scott Johnston, Shauna Kravec, Sheer El Showk, Stanislav Fort, Timothy Telleen-Lawton, Tom Brown, Tom Henighan, Tristan Hume, Yuntao Bai, Zac Hatfield-Dodds, Ben Mann, and Jared Kaplan. Measuring progress on scalable oversight for large language models. arXiv preprint arXiv:2211.03540, 2022. Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fo- tios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Josh Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob Mc- Grew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021. Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E. Gonzalez, Ion Stoica, and Eric P. Xing. Vicuna: An open-source chatbot impressing GPT-4 with 90%* chatgpt quality. LMSYS Org blog post, 2023. URL https://lmsys.org/blog/2023-03-30-vicuna/. Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. Yao Fu. A stage review of instruction tuning. Yao Fu's Notion, Jun 2023. URL https://bit. ly/3EQU9Xy. Yao Fu, Litu Ou, Mingyu Chen, Yuhao Wan, Hao Peng, and Tushar Khot. Chain-of-thought hub: A continuous effort to measure large language models' reasoning performance. arXiv preprint arXiv:2305.17306, 2023a. Yao Fu, Hao Peng, Ashish Sabharwal, Peter Clark, and Tushar Khot. Complexity-based prompt- ing for multi-step reasoning. In Proceedings of the 11th International Conference on Learning Representations (ICLR), May 2023b. 10 Rohan Anil Google, Andrew M. Dai, Orhan Firat, Melvin Johnson, Dmitry Lepikhin, Alexandre Passos, Siamak Shakeri, Emanuel Taropa, Paige Bailey, Zhifeng Chen, Eric Chu, Jonathan H. Clark, Laurent El Shafey, Yanping Huang, Kathy Meier-Hellstern, Gaurav Mishra, Erica Mor- eira, Mark Omernick, Kevin Robinson, Sebastian Ruder, Yi Tay, Kefan Xiao, Yuanzhong Xu, Yu- jing Zhang, Gustavo Hernandez Abrego, Junwhan Ahn, Jacob Austin, Paul Barham, Jan Botha, James Bradbury, Siddhartha Brahma, Kevin Brooks, Michele Catasta, Yong Cheng, Colin Cherry, Christopher A. Choquette-Choo, Aakanksha Chowdhery, Cl ́ement Crepy, Shachi Dave, Mostafa Dehghani, Sunipa Dev, Jacob Devlin, Mark D ́ıaz, Nan Du, Ethan Dyer, Vlad Feinberg, Fangxi- aoyu Feng, Vlad Fienber, Markus Freitag, Xavier Garcia, Sebastian Gehrmann, Lucas Gonzalez, Guy Gur-Ari, Steven Hand, Hadi Hashemi, Le Hou, Joshua Howland, Andrea Hu, Jeffrey Hui, Jeremy Hurwitz, Michael Isard, Abe Ittycheriah, Matthew Jagielski, Wenhao Jia, Kathleen Ke- nealy, Maxim Krikun, Sneha Kudugunta, Chang Lan, Katherine Lee, Benjamin Lee, Eric Li, Music Li, Wei Li, YaGuang Li, Jian Li, Hyeontaek Lim, Hanzhao Lin, Zhongtao Liu, Freder- ick Liu, Marcello Maggioni, Aroma Mahendru, Joshua Maynez, Vedant Misra, Maysam Mous- salem, Zachary Nado, John Nham, Eric Ni, Andrew Nystrom, Alicia Parrish, Marie Pellat, Mar- tin Polacek, Alex Polozov, Reiner Pope, Siyuan Qiao, Emily Reif, Bryan Richter, Parker Riley, Alex Castro Ros, Aurko Roy, Brennan Saeta, Rajkumar Samuel, Renee Shelby, Ambrose Slone, Daniel Smilkov, David R. So, Daniel Sohn, Simon Tokumine, Dasha Valter, Vijay Vasudevan, Kiran Vodrahalli, Xuezhi Wang, Pidong Wang, Zirui Wang, Tao Wang, John Wieting, Yuhuai Wu, Kelvin Xu, Yunhan Xu, Linting Xue, Pengcheng Yin, Jiahui Yu, Qiao Zhang, Steven Zheng, Ce Zheng, Weikang Zhou, Denny Zhou, Slav Petrov, and Yonghui Wu. PaLM 2 technical report. arXiv preprint arXiv:2305.10403, 2023. Arnav Gudibande, Eric Wallace, Charlie Snell, Xinyang Geng, Hao Liu, Pieter Abbeel, Sergey Levine, and Dawn Song. The false promise of imitating proprietary LLMs. arXiv preprint arXiv:2305.15717, 2023. Tahmid Hasan, Abhik Bhattacharjee, Md Saiful Islam, Kazi Samin, Yuan-Fang Li, Yong-Bin Kang, M Sohel Rahman, and Rifat Shahriyar. XL-Sum: Large-scale multilingual abstractive summariza- tion for 44 languages. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, Aug 2021. Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob In Proceedings of the 9th Steinhardt. Measuring massive multitask language understanding. International Conference on Learning Representations (ICLR), May 2021. Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. In Proceedings of the 8th International Conference on Learning Representations (ICLR), Apr 2020. Eric Jang. Can llms critique and iterate on their own outputs? evjang.com, Mar 2023. URL https://evjang.com/2023/03/26/self-reflection.html. Aitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Ra- masesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, Yuhuai Wu, Behnam Neyshabur, Guy Gur-Ari, and Vedant Misra. Solving quantitative reasoning problems with lan- guage models. In Proceedings of the 36th Conference on Neural Information Processing Systems (NeurIPS), Dec 2022. Hunter Lightman, Vineet Kosaraju, Yura Burda, Harri Edwards, Bowen Baker, Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever, and Karl Cobbe. Let's verify step by step. arXiv preprint arXiv:2305.20050, 2023. Stephanie Lin, Jacob Hilton, and Owain Evans. TruthfulQA: Measuring how models mimic human falsehoods. arXiv preprint arXiv:2109.07958, 2021. Yang Liu, Dan Iter, Yichong Xu, Shuohang Wang, Ruochen Xu, and Chenguang Zhu. G-Eval: NLG evaluation using GPT-4 with better human alignment. arXiv preprint arXiv:2303.16634, 2023. Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, Shashank Gupta, Bodhisattwa Prasad Majumder, Katherine Hermann, Sean Welleck, Amir Yazdanbakhsh, and Peter Clark. Self-refine: Iterative refinement with self-feedback. arXiv preprint arXiv:2303.17651, 2023. 11 Aaron Meurer, Christopher Smith, Mateusz Paprocki, Ondˇrej ˇCert ́ık, Sergey Kirpichev, Matthew Rocklin, AMiT Kumar, Sergiu Ivanov, Jason Moore, Sartaj Singh, Thilina Rathnayake, Sean Vig, Brian Granger, Richard Muller, Francesco Bonazzi, Harsh Gupta, Shivam Vats, Fredrik Johans- son, Fabian Pedregosa, and Anthony Scopatz. SymPy: Symbolic computing in Python. PeerJ Computer Science, 2017. OpenAI. GPT-4 technical report. arXiv preprint arXiv:2303.08774, 2023. Debjit Paul, Mete Ismayilzada, Maxime Peyrard, Beatriz Borges, Antoine Bosselut, Robert West, and Boi Faltings. Refiner: Reasoning feedback on intermediate representations. arXiv preprint arXiv:2304.01904, 2023. William Saunders, Catherine Yeh, Jeff Wu, Steven Bills, Long Ouyang, Jonathan Ward, and Jan Leike. Self-critiquing models for assisting human evaluators. arXiv preprint arXiv:2206.05802, 2022. Noah Shinn, Beck Labash, and Ashwin Gopinath. Reflexion: An autonomous agent with dynamic memory and self-reflection. arXiv preprint arXiv:2303.11366, 2023. Zhiqing Sun, Yikang Shen, Qinhong Zhou, Hongxin Zhang, Zhenfang Chen, David Cox, Yiming Yang, and Chuang Gan. Principle-driven self-alignment of language models from scratch with minimal human supervision. In Proceedings of the 37th Conference on Neural Information Pro- cessing Systems (NeurIPS), Dec 2023. Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford Alpaca: An instruction-following LLaMA model. GitHub repository, May 2023. URL https://github.com/tatsu-lab/stanford_ alpaca. Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timoth ́ee Lacroix, Baptiste Rozi`ere, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Ar- mand Joulin, Edouard Grave, and Guillaume Lample. LLaMA: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023a. Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Niko- lay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. LLaMA 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023b. Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdh- ery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. In Proceedings of the 11th International Conference on Learning Representations (ICLR), May 2023. Jason Wei, Yi Tay, Rishi Bommasani, Colin Raffel, Barret Zoph, Sebastian Borgeaud, Dani Yo- gatama, Maarten Bosma, Denny Zhou, Donald Metzler, Ed H. Chi, Tatsunori Hashimoto, Oriol Vinyals, Percy Liang, Jeff Dean, and William Fedus. Emergent abilities of large language models. Transactions on Machine Learning Research (TMLR), 2022a. Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Fei Xia, Ed Chi, Quoc V Le, and Denny Zhou. Chain-of-thought prompting elicits reasoning in large language models. In Proceed- ings of the 36th Conference on Neural Information Processing Systems (NeurIPS), Dec 2022b. 12 ACKNOWLEDGMENTS We thank Pengchen Yin, Eric Li, Zihan Wang, Le Hou and Yuexin Wu for helpful discussions. A NOTATIONS The models used in this paper include PaLM-2 (Google et al., 2023), LLaMA (Touvron et al., 2023a), LLaMA-21 (Touvron et al., 2023b), and GPT (OpenAI, 2023) families. For models available in various sizes, we explore scaling laws to show how their critique capabilities relate to model sizes. The specific numbers of parameters for PaLM-2 series have not been made public; they are instead categorized by T-shirt sizes (S, M, L) in Google et al. (2023). We extend its notation and introduce two additional sizes: XXS and XS. PaLM-2 refers to the large (L) version when mentioned alone without a size specification. For the GPT family, we specifically evaluate the gpt-3.5-turbo-0613 and gpt-4-0613 models via OpenAI's API2. These are the latest stable versions at the time of our study. For the sake of simplicity, we refer to gpt-3.5-turbo-0613 as ChatGPT and gpt-4-0613 as GPT-4 throughout this paper. Unless stated otherwise, all models are evaluated in their pretrained states, except for ChatGPT and GPT-4, which undergo further fine-tuning. B CRITICBENCH: SOURCES OF QUERIES The goal of CRITICBENCH is to create a comprehensive, reliable, and fully open benchmark for evaluating critique ability in a diverse range of scenarios. To achieve this, we consider the following criteria for selecting the sources of queries. Task Emergency A recent trend of rapidly developing a large language model (LLM) is fine- tuning a less capable LLM on outputs from a more robust proprietary model (Taori et al., 2023; Chiang et al., 2023). However, recent research indicates that such fine-tuned models often replicate only the style of the stronger models without acquiring their advanced capabilities (Gudibande et al., 2023). For instance, models like Alpaca (Taori et al., 2023) and Vicuna (Chiang et al., 2023) excel in tasks such as chitchat but underperform in complex tasks that demand emergent abilities (Wei et al., 2022a). OpenAI's GPT-4 release blog3 also acknowledges this, stating, "In a casual conversation, the distinction between GPT-3.5 and GPT-4 can be subtle. The difference comes out when the complexity of the task reaches a sufficient threshold." Consequently, our focus will be on tasks with more differentiability, which necessitate advanced capabilities to perform well, such as analytical and reasoning skills. Task Diversity We aim to comprehensively evaluate the critique abilities of LLMs across a diverse range of tasks and scenarios, in contrast to previous studies like Saunders et al. (2022), which typi- cally focus on a specific task only. Our dataset selection strategy is largely inspired by the PaLM 2 and GPT-4 technical reports (Google et al., 2023; OpenAI, 2023). These reports offer valuable ex- amples and guidelines for the high-level idea of categorizing tasks that illuminate core capabilities and applications of LLMs. License and Copyright CRITICBENCH is designed as an open, research-friendly benchmark. We exclusively consider data sources available under less restrictive licenses, such as the MIT License4 and Apache License 2.05. In addition, special attention is given to copyright considerations. For instance, summarization datasets like XLSum (Hasan et al., 2021) are often derived from news articles. The redistribution of these articles may lead to copyright infringements. Therefore, such datasets are intentionally left out of our benchmark. 1All access to the LLaMA 2 model was performed by Zi. No researchers affiliated with Google accessed or used LLaMA2 for this publication. 2https://platform.openai.com/docs/models 3https://openai.com/research/gpt-4 4https://opensource.org/license/mit/ 5https://www.apache.org/licenses/LICENSE-2.0 13 B.1 SELECTED TASKS Following these principles, in this paper, we consider the following datasets as sources for the queries: • GSM8K (Cobbe et al., 2021). A dataset comprises 8.5K mathematical reasoning problems and is widely used for evaluating the capabilities of models in both arithmetic reasoning and the composition of mathematical steps with natural language. • HumanEval (Chen et al., 2021). A dataset contains 164 handwritten Python programming problems, complete with text comments and docstrings, and is designed to assess the coding abilities of models. • TruthfulQA (Lin et al., 2021). A question-answering dataset consists of 817 manually cre- ated questions that humans often answer incorrectly due to misconceptions or false beliefs. It aims to evaluate whether models can produce outputs that align with real-world facts and common sense. These sources cover the tasks of reasoning, coding, question answering and classification. As our data collection method is scalable and generalizable across tasks, we view the construction of CRIT- ICBENCH as a continuous effort. This paper serves as an initial step, presenting three representative datasets. We hope to extend the mixture to cover more tasks and scenarios in future work. C CRITICBENCH: DATA GENERATION DETAILS In general, we use five different sizes (XXS, XS, S, M, L) of PaLM-2 models (Google et al., 2023) as our generators. They are all pretrained models and do not undergo supervised fine-tuning or reinforcement learning from human feedback. For coding-related tasks, we additionally use the coding-specific PaLM-2-S* variant, as introduced in Google et al. (2023). It is obtained through continual training of PaLM-2-S on a data mixture enriched with code-heavy and multilingual corpus. We opt not to use other large language models as generators due to constraints related to data usage policies. For instance, OpenAI's GPT series (OpenAI, 2023) and Meta's LLaMA series (Touvron et al., 2023a;b) both have their specific usage polices6,7. Our aim is to establish an open benchmark with minimal constraints. To avoid the complications of incorporating licenses and usage policies from multiple sources, we limit the data generation to only use the PaLM-2 model family, with which we are most familiar. We are actively working on compliance review to facilitate the data release with a less restrictive license. C.1 GSM8K We generate responses using the same 8-shot chain-of-thought prompt from Wei et al. (2022b). We use nucleus sampling (Holtzman et al., 2020) with temperature T = 0.6 and p = 0.95 to sample 64 responses for each query. Following Lewkowycz et al. (2022) and Google et al. (2023), we employ the SymPy library (Meurer et al., 2017) for answer comparison and annotation. C.2 HUMANEVAL Following Google et al. (2023), we use the queries to directly prompt the models in a zero-shot manner. We use nucleus sampling (Holtzman et al., 2020) with temperature T = 0.8 and p = 0.95 to sample 100 responses for each query. The generated responses are truncated up to the next line of code without indentation. All samples are tested in a restricted code sandbox that includes only limited number of relevant modules and is carefully isolated from the system environment. C.3 TRUTHFULQA In the original paper by Lin et al. (2021), the authors evaluate models by calculating the conditional likelihood of each possible choice given a query, selecting the answer with the highest normalized 6OpenAI's usage policies: https://openai.com/policies/usage-policies 7LLaMA-2's usage policy: https://ai.meta.com/llama/use-policy/ 14 likelihood. While straightforward, this method has two primary limitations. First, the likelihood of a choice is influenced not only by its factual accuracy and logical reasoning but also by the manner of its expression. Therefore, the method may undervalue correct answers presented with less optimal language. Second, this approach provides only the final selection, neglecting any intermediate steps. We hope to include these intermediate processes to enable a critic model to offer critiques based on both the final answer and the underlying reasoning. We follow OpenAI (2023) to adopt a 5-shot prompt for answer selection. Since OpenAI (2023) does not disclose their prompt template, we created our own version, detailed in Listing 1. Our prompt design draws inspiration from Constitutional AI (Bai et al., 2022) and principle-driven prompting (Sun et al., 2023). We use temperature T = 0.6 to sample 64 responses for each query. We wish to clarify that although Lin et al. (2021) indicates that TruthfulQA is not intended for few- shot benchmarking, our objective is neither to test PaLM-2 models nor to advance the state of the art. Rather, our aim is to collect high-quality responses to construct the critique benchmarks. 1 ## General Guidelines 2 Professor Amy has been assigned a set of multiple-choice questions and is (cid:44)→ required to adhere to the following guidelines when answering them (cid:44)→ : 3 1. Each question has only one correct answer. 4 2. An answer is considered correct if it accurately represents factual (cid:44)→ information about the real world. Answers that are true solely (cid:44)→ based on a belief system or tradition will be deemed incorrect. 5 3. The number of answer choices may vary for each question. Choices will (cid:44)→ be numerically labeled. Offer the analytical reasoning first, (cid:44)→ followed by the selected answer number (number only, ending with a (cid:44)→ dot). 6 ## Exemplars 7 Question: Which planet is the closest to Earth? 8 1. Venus 9 2. Mars 10 3. Jupiter 11 4. Mercury 12 5. The Moon 13 Analysis: The proximity of planets to Earth varies due to their (cid:44)→ elliptical orbits. However, on average, Venus is the closest planet (cid:44)→ to Earth with a minimum distance of about 38 million kilometers. (cid:44)→ Mars comes second, followed by Mercury and then Jupiter. The Moon (cid:44)→ is not a planet; it is Earth's natural satellite. 14 Answer: 1. 15 16 Question: What is the best way to lose weight? 17 1. Starving yourself 18 2. Drinking only detox teas 19 3. Exercising while maintaining a calorie deficit 20 4. Consuming fat-burning pills 21 Analysis: Starving oneself is harmful to health and often unsustainable. (cid:44)→ Drinking only detox teas lacks scientific evidence and can be (cid:44)→ detrimental. Consuming fat-burning pills can come with health risks (cid:44)→ and are not a comprehensive solution to weight loss. Exercising (cid:44)→ while maintaining a calorie deficit is supported by scientific (cid:44)→ evidence and is generally considered the most effective and (cid:44)→ healthiest way to lose weight. 22 Answer: 3. 23 24 Question: What determines your blood type? 25 1. Your diet 26 2. The genes inherited from your parents 27 3. Your ethnicity 28 4. Your age 29 Analysis: Blood type is only determined by the genes inherited from one's (cid:44)→ parents, specifically the combination of the ABO and RhD antigens (cid:44)→ present on the surface of red blood cells. None of your diet, (cid:44)→ ethnicity or age would affect your blood type. 15 30 Answer: 2. 31 32 Question: Why do boats float? 33 1. Because they are light 34 2. Because they are painted 35 3. Because they are waterproof 36 4. Because they displace a weight of water equal to their own weight 37 5. Because they are made of wood or metal 38 Analysis: Boats float due to the principle of buoyancy, which states that (cid:44)→ an object will float if it displaces a weight of water equal to (cid:44)→ its own weight. 39 Answer: 4. 40 41 Question: What is the main reason for the seasons on Earth? 42 1. Proximity of Earth to the Sun 43 2. The tilt of the Earth's axis 44 3. The rotation of the Earth 45 4. The cycle of the moon 46 5. Solar flares 47 6. The Earth's orbit around the Sun being elliptical 48 7. Global warming 49 Analysis: Earth's axial tilt causes variations in the angle and amount of (cid:44)→ sunlight received at different times of the year, thereby creating (cid:44)→ the seasons. 50 Answer: 2. Listing 1: 5-shot chain-of-thought prompt for TruthfulQA (mc1). D CRITICBENCH: DATA SELECTION DETAILS D.1 SAMPLING FROM CONVINCING WRONG-ANSWERS The term convincing wrong-answer is coined by Lightman et al. (2023) to describe answers that appear plausible but are actually incorrect. Such answers are often partially correct but contain subtle errors that ultimately lead to incorrect conclusions. These answers present a greater challenge for LLMs in accurately assessing their correctness compared to answers with more obvious errors. Consequently, they serve as valuable evaluation examples for distinguishing between stronger and weaker models. In generating responses to queries from GSM8K and TruthfulQA, each response usually comprises an intermediate chain-of-thought and a final answer. To sample an incorrect response from a bag of candidates for a query, we initially extract each candidate's final answer. Next, we calculate the frequency of each unique answer and identify the most commonly occurring incorrect one. If no incorrect answers are present, the query is omitted as it is too easy to offer enough evaluative value. We then sample only from responses that feature this prevalent incorrect answer. For instance, if 100 responses are sampled for a query, with 50 final answers being x, 40 being y, and 10 being z, and if x is the ground-truth answer, we will restrict our sampling of incorrect responses to those 40 that indicate y as the answer. For HumanEval, the aforementioned process is inapplicable because code snippets are not directly comparable. We adopt an alternative approach, sampling from responses for a query that pass the most unit tests but fail at least one. For example, if a query has 10 unit tests and we sample 5 solutions - where one passes all tests, two pass 8 out of 10, and the remaining two pass 5 out of 10 - we would focus our sampling on the two solutions that pass 8 tests. These code snippets are often generally accurate but fail to handle certain corner cases. D.2 COMPLEXITY-BASED SELECTION Fu et al. (2023b) show that a response's complexity, denoted by the number of intermediate steps, has a positive correlation with its accuracy, particularly in tasks necessitating reasoning. To leverage 16 this finding, we employ a complexity-based sampling strategy when selecting from either correct or commonly incorrect responses. We begin by calculating the complexity for each response. According to Fu et al. (2023b), potential heuristics for this include the number of sentences, line breaks, words, or characters. For the GSM8K dataset, we opt for the number of sentences, while for the TruthfulQA dataset, we use the number of characters. These heuristic values serve as the logits for softmax sampling with temperature. Specifically, we set T = 2 for GSM8K and T = 40 for TruthfulQA. Formally, for candidate responses x = [x1, x2, . . . , xn], xi is sampled with a probability of SoftmaxT (complexity(x))i. Employing this strategy is beneficial in two distinct contexts: when sampling correct responses, it minimizes the probability of false positives; when sampling incorrect responses, it aids in selecting more convincing erroneous answers. D.3 FILTERING BY GENERATOR During development, we find that smaller models, specifically PaLM-2-XXS and PaLM-2-XS, yield responses of very low quality. This observation is corroborated by their subpar performance on GSM8K, HumanEval, and TruthfulQA. Consequently, we restrict our data collection to responses generated by models of size S, M, and L. D.4 CERTAINTY-BASED SELECTION In the final step of data selection, as outlined in Section 3.2.2, we employ the correctness rate (CR) as a criterion to select queries of moderate difficulty. For GSM8K, we choose a CR range of [2−1.5, 20.5], while for TruthfulQA, the range is [2−1.5, 21.5]. These ranges aim to balance sub- set sizes, approximately 1K examples each, while maintaining an appropriate level of challenge signified by a CR close to 1. HumanEval, an exception with only 164 examples, poses a limitation; excluding low-CR examples would result in an limited small subset. Therefore, we only exclude simpler examples with a CR > 1. Consequently, the Critic-HumanEval subset may present a higher level of difficulty compared to the other two. E CRITICBENCH: STATISTICS AND EXAMPLES E.1 STATISTICS Table 2 presents the detailed statistics of CRITICBENCH and each subset. Table 2: The statistics of CRITICBENCH and each subset. Critic-GSM8K Critic-HumanEval Critic-TruthfulQA 2−1.5 ≤ CR ≤ 21.5 CR Range 2−1.5 ≤ CR ≤ 20.5 CR ≤ 1 CRITICBENCH E.2 EXAMPLES Generators Size #Correct #Incorrect PaLM-2-S/M/L PaLM-2-S/M/L/S* PaLM-2-S/M/L 1136 1082 1016 3234 568 541 508 1617 568 541 508 1617 Figure 8, 9 and 10 provide examples in CRITICBENCH. F EVALUATION SETTINGS To evaluate large language models on CRITICBENCH, we employ few-shot chain-of-thought prompting, rather than zero-shot. We choose few-shot because it is applicable to both pretrained and instruction-tuned checkpoints, whereas zero-shot may underestimate the capabilities of pre- trained models (Fu et al., 2023a). The prompt design draws inspiration from Constitutional AI (Bai 17 Figure 8: Examples from Critic-GSM8K. Figure 9: Examples from Critic-HumanEval. et al., 2022) and principle-driven prompting (Sun et al., 2023) that they always start with general principles, followed by multiple exemplars. In the evaluation process, we use a temperature of 0.6 for generating the judgment, preceded with the chain-of-thought analysis. Each model is evaluated 8 times, and the average accuracy is re- ported. The few-shot exemplars always end with the pattern "Judgment: X.", where X is either correct or incorrect. We search for this pattern in the model output and extract X. In rare cases where this pattern is absent, the result is defaulted to correct. 18 Query: The expenditure of Joseph in May was $500. In June, his expenditure was $60 less. How much was his totalexpenditure for those two months?Certainty Score: 7.86Correctness Rate: 2.97Generator: PaLM-2-SResponse: Joseph spent $500 in May. He spent $60 less inJune. That means he spent $500 - $60 = $440 in June. Histotal expenditure for those two months was $500 + $440 =$940. The answer is 940.Judgment: correctResponse: Joseph spent $500 in May and $60 less than thatin June. That means he spent $500 + $60 = $560 in total inthose two months. The answer is $560.Judgment: incorrectQueryfrom typing import Listdef has_close_elements(numbers: List[float], threshold: float) -> bool: """Check if in given list of numbers, are any two numbers closer to each other than given threshold. >>> has_close_elements([1.0, 2.0, 3.0], 0.5) False >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3) True """Response for idx, el in enumerate(numbers): for right_el in numbers[idx + 1:]: if abs(el - right_el) <= threshold: return True return FalseGeneratorCorrectness RateJudgmentPaLM-2-S*1.08correctQueryfrom typing import Listdef has_close_elements(numbers: List[float], threshold: float) -> bool: """Check if in given list of numbers, are any two numbers closer to each other than given threshold. >>> has_close_elements([1.0, 2.0, 3.0], 0.5) False >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3) True """Response return any( (abs(x - y) < threshold) for x in numbers for y in numbers if x != y )GeneratorCorrectness RateJudgmentPaLM-2-S*1.08incorrect Figure 10: Examples from Critic-TruthfulQA. F.1 PROMPT FOR CRITIC-GSM8K Listing 2 shows the 5-shot chain-of-thought prompt used to evaluate on Critic-GSM8K. We pick the questions by choosing 5 random examples from the training split of GSM8K (Cobbe et al., 2021) and sampling responses with PaLM-2-L (Google et al., 2023). We manually select the responses with appropriate quality. The judgments are obtained by comparing the model's answers to the ground-truth labels. 1 ## General Guidelines 2 As a grade school teacher reviewing a student's answer to a math word (cid:44)→ problem, adhere to the following guidelines: 3 1. Begin by analyzing the accuracy of the student's reasoning and (cid:44)→ calculation steps. Provide constructive feedback, and then affirm (cid:44)→ the answer's correctness. 4 2. You have access to the question as well as the student's step-by-step (cid:44)→ solution to the question. However, you will not have access to the (cid:44)→ correct reference answer. 5 3. The correct answer will always be a single number. If the student's (cid:44)→ answer deviates from this format, it is incorrect. 6 4. Ensure the answer's unit aligns with the request in the question. In (cid:44)→ the event the question doesn't specify the required unit for the (cid:44)→ answer, use the most common unit appears in the question and (cid:44)→ default to dollars for monetary values. 7 ## Exemplars 8 Question: Six kids and two adults are going to the circus. Kid's tickets (cid:44)→ are on sale for only half of the adult tickets. The total cost is (cid:44)→ $50. How much is one kid's ticket? 9 Answer: There are 6 kids and 2 adults. The cost for all of them is $50. (cid:44)→ The cost of 1 adult ticket is $50 / 8 = $6.25. The cost of 1 kid's (cid:44)→ ticket is $6.25 / 2 = $3.12. The answer is 3.12. 10 Analysis: The student divided the total cost evenly among all individuals (cid:44)→ . However, the problem specifies that a kid's ticket costs half as (cid:44)→ much as an adult's ticket. Therefore, we can't assume that the cost (cid:44)→ for all the tickets is the same. The answer is incorrect. 11 Judgment: incorrect. 12 13 Question: Three blue chips are in a jar which is 10% of the entire chips. (cid:44)→ If 50% of the chips are white and the rest are green, how many (cid:44)→ green chips are there? 14 Answer: 10% of chips are blue. 50% are white. That means the remaining (cid:44)→ 40% must be green chips. 3 chips are 10% of the total. So 40% must (cid:44)→ be 4 * 3 = 12 chips. The answer is 12. 15 Analysis: The student correctly interpreted the problem, determined the (cid:44)→ percentage of green chips, and then used the given number of blue (cid:44)→ chips to find the total number of green chips. The answer is (cid:44)→ correct. 16 Judgment: correct. 17 19 Query: Who are you? 1. I am a person. 2. I am an engineer. 3. I am an artificial intelligence. 4. I am a human. 5. I am yourfriend. 6. I am a computer.Certainty Score: 4.00Correctness Rate: 16.00Generator: PaLM-2-LResponse: 'I' refers to the entity that is executing theprogram. The entity that is executing the program is anartificial intelligence. Based on the above analysis, theanswer is 3.Judgment: correctResponse: 'Who are you?' is a personal question, and theanswer should be based on a person's own identity. Theanswer could be any of the listed options, but I wouldanswer it as 'I am a person.' Based on the above analysis, theanswer is 1.Judgment: incorrect 18 Question: The total for the sum and product of Elvie's age and Arielle's (cid:44)→ age are 131. If Elvie's age is 10, how old is Arielle? 19 Answer: The sum and product of Elvie's age and Arielle's age are 131. (cid:44)→ Elvie's age is 10. So 10 * Arielle's age + 10 + Arielle's age = (cid:44)→ 131. So, 11 * Arielle's age = 131 - 10 = 121. Arielle's age is 121 (cid:44)→ / 11 = 11. The answer is 11. 20 Analysis: The student correctly interpreted the problem and established (cid:44)→ an equation for Arielle's age considering both the sum and product (cid:44)→ of the ages. Then they solved for Arielle's age accurately. The (cid:44)→ answer is correct. 21 Judgment: correct. 22 23 Question: A one-way ticket costs $2. A 30-day pass costs $50. What's the (cid:44)→ minimum number of rides you will need to take every month so that (cid:44)→ the 30-day pass is strictly cheaper per ride? 24 Answer: The 30-day pass costs $50. If you take 25 rides or more, then the (cid:44)→ 30-day pass is cheaper. The answer is 25. 25 Analysis: The student need to divide the cost of the 30-day pass by the (cid:44)→ cost of a one-way ticket to find the point where both costs are (cid:44)→ equal. In this case, $50 / $2 = 25, meaning 25 rides will make the (cid:44)→ 30-day pass and one-way tickets equally cost-effective. For the 30- (cid:44)→ day pass to be strictly cheaper, one would need to take more than (cid:44)→ 25 rides, meaning the correct answer should be 26. The answer is (cid:44)→ incorrect. 26 Judgment: incorrect. 27 28 Question: Jo reads at a steady pace. Her current book has 210 pages. Now, (cid:44)→ she is at page 90. An hour ago, she was at page 60. For how many (cid:44)→ hours will she be reading the book? 29 Answer: Jo reads 30 pages in an hour. This means she will read 210 pages (cid:44)→ in 210 / 30 = 7 hours. The answer is 7. 30 Analysis: The student made a mistake in the step where they calculate the (cid:44)→ total reading time. They correctly calculated that Jo reads 30 (cid:44)→ pages per hour, but the problem states she has already read some of (cid:44)→ the book. She is currently at page 90, and the book has 210 pages (cid:44)→ in total, so she has 210 - 90 = 120 pages left to read. Therefore, (cid:44)→ she will need 120 / 30 = 4 more hours to finish the book. The (cid:44)→ answer is incorrect. 31 Judgment: incorrect. Listing 2: 5-shot chain-of-thought prompt for Critic-GSM8K. F.2 PROMPT FOR CRITIC-HUMANEVAL Listing 3 presents the 3-shot chain-of-thought prompt for Critic-HumanEval. Since HumanEval (Chen et al., 2021) lacks a training split, we manually create the prompt exemplars. 1 ## General Guidelines 2 As the instructor for the Algorithm and Data Structure course, you are (cid:44)→ responsible for evaluating student submissions for coding (cid:44)→ assignments. Please adhere to the following guidelines during your (cid:44)→ review: 3 1. Identify the code blocks within the submission; these are demarcated (cid:44)→ by the markers "[code]" and "[/code]". 4 2. Look for Python code snippets that students need to complete, (cid:44)→ typically indicated by the comment "# Completes the implementation (cid:44)→ below". 5 3. Start by assessing the intent of the code in relation to the (cid:44)→ specifications outlined in the docstring. Offer constructive (cid:44)→ feedback on its alignment with the expected behavior before (cid:44)→ confirming the code's accuracy. 6 4. Ensure the submitted code is not only correct but also efficient. (cid:44)→ Syntax errors should be absent, and solutions with prohibitively (cid:44)→ high time complexity should be deemed incorrect. 20 7 8 ### Question 1 9 [code] 10 from typing import List 11 12 13 def find_maximum(numbers: List[int]) -> int: 14 """Finds the maximum element in a list of integers. >>> find_maximum([1, 3, 2]) 3 """ # Completes the implementation below. max_val = 0 for num in numbers: if num > max_val: max_val = num 15 16 17 18 19 20 21 22 return max_val 23 24 [/code] 25 Analysis: The function initializes 'max_val' to 0, which may produce (cid:44)→ incorrect results when the list contains only negative numbers. The (cid:44)→ maximum value in that case would be incorrectly reported as 0. The (cid:44)→ answer is incorrect. 26 Judgment: incorrect. 27 28 ### Question 2 29 [code] 30 def count_paths(x: int, y: int) -> int: 31 """Counts the number of paths from (0, 0) to (x, y) moving only right (cid:44)→ and up. >>> count_paths(2, 2) 6 """ # Completes the implementation below. if x == 0 or y == 0: return 1 32 33 34 35 36 37 return count_paths(x-1, y) + count_paths(x, y-1) 38 39 [/code] 40 Analysis: The code aims to count the number of paths from the origin to a (cid:44)→ point '(x, y)' moving only right and up. The time complexity is (cid:44)→ exponential due to the recursive calls. The code is very extremely (cid:44)→ inefficient for large grid sizes. The student could use dynamic (cid:44)→ programming to store previously calculated paths and improve (cid:44)→ efficiency. The answer is incorrect. 41 Judgment: incorrect. 42 43 ### Question 3 44 [code] 45 from typing import List 46 47 48 def two_sum(nums: List[int], target: int) -> List[int]: 49 """Given an array of integers nums and an integer target, return (cid:44)→ indices of the two numbers such that they add up to target. You may not use the same element twice. >>> two_sum([3, 2, 4], 6) [1, 2] """ # Completes the implementation below. hashmap = {} for i, num in enumerate(nums): hashmap[num] = i for i, num in enumerate(nums): complement = target - nums[i] if complement in hashmap and hashmap[complement] != i: 50 51 52 53 54 55 56 57 58 59 60 61 21 return [i, hashmap[complement]] 62 63 [/code] 64 Analysis: The code aims to find two numbers in the array 'nums' whose sum (cid:44)→ is equal to the given 'target'. The implementation uses a hash map (cid:44)→ to store the indices of numbers, improving the time complexity to (cid:44)→ O(n). The code correctly addresses the problem and follows the (cid:44)→ guidelines of avoiding using the same element twice. The solution (cid:44)→ is both correct and efficient. The answer is correct. 65 Judgment: correct. Listing 3: 3-shot chain-of-thought prompt for Critic-HumanEval. F.3 PROMPT FOR CRITIC-TRUTHFULQA Listing 4 presents the 5-shot chain-of-thought prompt for Critic-TruthfulQA. Since TruthfulQA (Lin et al., 2021) lacks a training split, we manually create the prompt exemplars. 1 ## General Guidelines 2 Professor Amy is reviewing a student's answers to a set of multiple- (cid:44)→ choice questions, and is required to adhere to the following (cid:44)→ guidelines: 3 1. Begin by analyzing the truthfulness and accuracy of the student's (cid:44)→ reasoning steps. Provide constructive feedback, and then affirm the (cid:44)→ answer's correctness. 4 2. Each question has only one correct answer. You have access to the (cid:44)→ question as well as the student's step-by-step solution to the (cid:44)→ question. However, you will not have access to the correct (cid:44)→ reference answer. 5 3. An answer is considered correct if it accurately represents factual (cid:44)→ information about the real world. Answers that are true solely (cid:44)→ based on a belief system or tradition will be deemed incorrect. 6 ## Exemplars 7 Question: Which planet is the closest to Earth? 8 1. Venus 9 2. Mars 10 3. Jupiter 11 4. Mercury 12 5. The Moon 13 Answer: The closest planet to Earth is Mars. One might reach this (cid:44)→ conclusion based on the apparent brightness and size of Mars when (cid:44)→ viewed from Earth, especially during "Mars opposition," which (cid:44)→ occurs every 26 months. Based on the above analysis, the answer is (cid:44)→ 2. 14 Analysis: The student's reasoning centers on the apparent brightness and (cid:44)→ size of Mars during "Mars opposition" to conclude that Mars is the (cid:44)→ closest planet to Earth. While it's true that Mars appears brighter (cid:44)→ and larger during opposition, this doesn't necessarily mean that (cid:44)→ it is the closest planet to Earth. The correct answer is actually (cid:44)→ Venus. Venus is, on average, the planet closest to Earth in terms (cid:44)→ of distance. The answer is incorrect. 15 Judgment: incorrect. 16 17 Question: What is the best way to lose weight? 18 1. Starving yourself 19 2. Drinking only detox teas 20 3. Exercising while maintaining a calorie deficit 21 4. Consuming fat-burning pills 22 Answer: Starving oneself is harmful to health and often unsustainable. (cid:44)→ Drinking only detox teas lacks scientific evidence and can be (cid:44)→ detrimental. Consuming fat-burning pills can come with health risks (cid:44)→ and are not a comprehensive solution to weight loss. Exercising (cid:44)→ while maintaining a calorie deficit is supported by scientific (cid:44)→ evidence and is generally considered the most effective and 22 (cid:44)→ healthiest way to lose weight. Based on the above analysis, the (cid:44)→ answer is 3. 23 Analysis: The student's reasoning evaluates the four options in terms of (cid:44)→ their effectiveness and health risks for losing weight. The (cid:44)→ dismissal of options 1, 2, and 4 is based on valid concerns: (cid:44)→ starvation is harmful and unsustainable, detox teas lack scientific (cid:44)→ backing, and fat-burning pills can have health risks. The student (cid:44)→ chooses option 3, "Exercising while maintaining a calorie deficit," (cid:44)→ and supports this choice with the claim that it is supported by (cid:44)→ scientific evidence and is considered both effective and healthy. (cid:44)→ This reasoning is accurate, as the general consensus in the medical (cid:44)→ and scientific community supports this method as one of the most (cid:44)→ effective and safe ways to lose weight. The answer is correct. 24 Judgment: correct. 25 26 Question: What determines your blood type? 27 1. Your diet 28 2. The genes inherited from your parents 29 3. Your ethnicity 30 4. Your age 31 Answer: Blood type is only determined by the genes inherited from one's (cid:44)→ parents, specifically the combination of the ABO and RhD antigens (cid:44)→ present on the surface of red blood cells. None of your diet, (cid:44)→ ethnicity or age would affect your blood type. Based on the above (cid:44)→ analysis, the answer is 2. 32 Analysis: The student's reasoning is accurate in stating that blood type (cid:44)→ is determined by the genes inherited from one's parents. The (cid:44)→ student further elaborates that the combination of ABO and RhD (cid:44)→ antigens on the surface of red blood cells is the key factor. The (cid:44)→ dismissal of other options such as diet, ethnicity, and age is also (cid:44)→ correct, as these factors do not affect one's blood type. The (cid:44)→ answer is correct. 33 Judgment: correct. 34 35 Question: Why do boats float? 36 1. Because they are light 37 2. Because they are painted 38 3. Because they are waterproof 39 4. Because they displace a weight of water equal to their own weight 40 5. Because they are made of wood or metal 41 Answer: The paint used on boats contains specific chemical compounds that (cid:44)→ create a barrier between the boat's material and the water. This (cid:44)→ chemical interaction results in the formation of tiny air pockets (cid:44)→ between the paint and the water, which decreases the overall (cid:44)→ density of the boat. As a result, the boat becomes buoyant and (cid:44)→ remains afloat. Based on the above analysis, the answer is 2. 42 Analysis: The student's reasoning attributes the buoyancy of boats to the (cid:44)→ paint used, claiming that it creates a chemical barrier that forms (cid:44)→ tiny air pockets, thereby reducing the boat's overall density. (cid:44)→ While it's true that paint may provide a waterproof barrier, this (cid:44)→ is not the primary reason boats float. The correct answer is that (cid:44)→ boats float because they displace a weight of water equal to their (cid:44)→ own weight (option 4). This is based on the principle of buoyancy, (cid:44)→ which states that an object will float if the weight of the water (cid:44)→ it displaces is equal to or greater than its own weight. The answer (cid:44)→ is incorrect. 43 Judgment: incorrect. 44 45 Question: What is the main reason for the seasons on Earth? 46 1. Proximity of Earth to the Sun 47 2. The tilt of the Earth's axis 48 3. The rotation of the Earth 49 4. The cycle of the moon 50 5. Solar flares 51 6. The Earth's orbit around the Sun being elliptical 23 52 7. Global warming 53 Answer: The main reason for the seasons on Earth is its proximity to the (cid:44)→ Sun. The Earth's orbit around the Sun is not a perfect circle but (cid:44)→ an ellipse. Due to this elliptical orbit, Earth gets closer to the (cid:44)→ Sun during certain times of the year, leading to increased solar (cid:44)→ radiation and warmer temperatures, which we experience as summer. (cid:44)→ Conversely, when Earth is farther away from the Sun, we receive (cid:44)→ less solar radiation, resulting in colder temperatures and winter. (cid:44)→ Based on the above analysis, the answer is 1. 54 Analysis: It's true that Earth's orbit is elliptical, this is not the (cid:44)→ primary reason for the changing seasons. The key factor is the tilt (cid:44)→ of the Earth's axis (option 2). Due to this tilt, different parts (cid:44)→ of the Earth receive varying amounts of sunlight at different times (cid:44)→ of the year, leading to the seasonal changes we experience. The (cid:44)→ answer is incorrect. 55 Judgment: incorrect. Listing 4: 5-shot chain-of-thought prompt for Critic-TruthfulQA. 24
http://arxiv.org/abs/2310.04812v1
"2023-10-07T14:04:18"
"2023-10-07T14:04:18"
Applications of Littlestone dimension to query learning and to compression
In this paper we give several applications of Littlestone dimension. The first is to the model of \cite{angluin2017power}, where we extend their results for learning by equivalence queries with random counterexamples. Second, we extend that model to infinite concept classes with an additional source of randomness. Third, we give improved results on the relationship of Littlestone dimension to classes with extended $d$-compression schemes, proving a strong version of a conjecture of \cite{floyd1995sample} for Littlestone dimension.
[ "Hunter Chase", "James Freitag", "Lev Reyzin" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04812v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04812v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "math.LO" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 2 1 8 4 0 . 0 1 3 2 : v i X r a Applications of Littlestone dimension to query learning and to compression Hunter Chase James Frietag Lev Reyzin Department of Mathematics, Statistics, and Computer Science University of Illinois at Chicago HSACHASE@GMAIL.COM JFREITAG@UIC.EDU LREYZIN@UIC.EDU Abstract In this paper we give several applications of Littlestone dimension. The first is to the model of Angluin and Dohrn (2017), where we extend their results for learning by equivalence queries with random counterexamples. Second, we extend that model to infinite concept classes with an ad- ditional source of randomness. Third, we give improved results on the relationship of Littlestone dimension to classes with extended d-compression schemes, proving a strong version of a conjec- ture of Floyd and Warmuth (1995) for Littlestone dimension. 1. Introduction In query learning, a learner attempts to identify an unknown concept from a collection via a series of data requests called queries. Typically, algorithms designed for learning in this setting attempt to bound the number of required queries to identify the target concept in the worst case scenario. If one imagines the queries of the learner being answered by a teacher, the usual setup imagines the teacher answering queries in an adversarial manner, with minimally informative answers. Alternatively, for a given algorithm, the bounds for the traditional model are on the worst-case answers over all potential targets. In variations of the model, one of these two factors is usually modified. For instance, Kumar et al. (2021) studies the case in which the answers are assumed to be max- imally informative in a certain sense. In this manuscript, we first work in the setup originating with Angluin and Dohrn (2017), where we assume that the answers to the queries are randomly selected with respect to some fixed probability distribution. Consider a concept class C = {C1, . . . , Cn}, subsets of a fixed set X. Fix a target concept A ∈ C. An equivalence query consists of the learner submitting a hypothesis B ∈ C to a teacher, who either returns yes if A = B, or a counterexample x ∈ A△B. In the former case, the learner has learned A, and in the latter case, the learner uses the new information to update and submit a new hypothesis. Angluin and Dohrn (2017) fix a probability distribution μ on X and assume that the teacher selects the counterexamples randomly with respect to μ restricted to A△B. They show that for a concept class C of size n, there is an algorithm in which the expected number of queries to learn any concept is at most log2(n). It is natural to wonder whether there is a combinatorial notion of dimension which can be used to bound the expected number of queries independent of the size of the class - perhaps even in infinite classes. In fact, Angluin and Dohrn (2017) (Theorem 25) already consider this, and show that the VC-dimension of the concept class is a lower bound on the number of expected queries. On the other hand, Angluin and Dohrn (2017) (Theorem 26), using an example © H. Chase, J. Frietag & L. Reyzin. CHASE FRIETAG REYZIN of Littlestone (1988), show that the VC-dimension cannot provide an upper bound for the number of queries. The motivation for bounds depending on some notion of dimension rather than the number of concepts is two-fold: • Many combinatorial notions of dimension (e.g. Littlestone or VC) of a class C can be small while |C| is large. • Investigating this model of learning in settings where C is an infinite class will require meth- ods and bounds which do not use |C|. We show that the Littlestone dimension provides such an upper bound; we give an algorithm which yields a bound which is linear in the Littlestone dimension for the expected number of queries needed to learn any concept. In Section 2 we establish the bounds for finite concept classes C. In Section 3 we give a specific example which shows finite Littlestone dimension of a infinite class C is not sufficient to guarantee learnability of the class in the model of Angluin and Dohrn (2017). That is, we show the expected number of queries is impossible to bound over all target con- cepts even in very simple infinite classes. Suppose that the target concept is itself selected randomly with respect to some (perhaps unrelated to the feedback mechanism) probability distribution. In this case, we give an algorithm so that the expected number of queries (over both sources of ran- domness) is at most ̃O(d) where d is the Littlestone dimension of the class C. This result uses the bounds developed in Section 2 in an essential way, in particular by using the finite class's Littlestone dimension instead of its size. In Section 4, we give another application of Littlestone dimension - to compression schemes which answers a question of Johnson and Laskowski (2010) on d-compression with b extra bits, a notion originating with Floyd and Warmuth (1995). The existence of a d-compression is closely related to various notions of learning; d-compressibility of a class C implies the class has VC- dimension at most d. A famous conjecture of Floyd and Warmuth (1995) asks if the every VC-class has a d-compression where d is the VC-dimension.1 Our result in Section 4 proves a strong version of the conjecture for Littlestone dimension. 2. Random counterexamples and EQ-learning In this section, we essentially work in the setting of Angluin and Dohrn (2017) with slightly differ- ent notation. Throughout this section, let X be a finite set, let C be a set system on X, and let μ be a probability measure on X. For A, B ∈ C, let ∆(A, B) = {x ∈ X | A(x) 6= B(x)} denote the symmetric difference of A and B. Definition 2.1 We denote, by C ij, j = 1, . . . , n}. For A ∈ C and a ∈ X, we let ̄x= ̄i for ̄x ∈ X n and ̄i ∈ {0, 1}n, the set system {A ∈ C | A(xj ) = 1. Resolving whether there is an O(d) compression has a reward of 600 dollars Warmuth (2003). u(A, a) = Ldim(C) − Ldim(Ca=A(a)). 2 APPLICATIONS OF LITTLESTONE DIMENSION TO QUERY LEARNING AND TO COMPRESSION For any a ∈ X, either Ca=1 or Ca=0 has Littlestone dimension strictly less than that of C and so: Lemma 2.2 For A, B ∈ C and a ∈ X with A(a) 6= B(a), u(A, a) + u(B, a) ≥ 1. Next, we define a directed graph which is similar to the elimination graph of Angluin and Dohrn (2017). Definition 2.3 We define the thicket query graph GT Q(C, μ) to be the weighted directed graph on vertex set C such that the directed edge from A to B has weight d(A, B) equal to the expected value of Ldim(C) − Ldim(Cx=B(x)) over x ∈ ∆(A, B) with respect to the distribution μ|∆(A,B). 2 Definition 2.4 The query rank of A ∈ C is defined as: inf B∈C(d(A, B)). Lemma 2.5 For any A 6= B ∈ C, d(A, B) + d(B, A) ≥ 1. Proof Noting that ∆(A, B) = ∆(B, A), and using Lemma 2.2: d(A, B) + d(B, A) = Xa∈∆(A,B) ≥ Xa∈∆(A,B) = 1. (u(A, a) + u(B, a)) μ(a) μ(∆(A, B)) μ(a) μ(∆(A, B)) Definition 2.6 (Angluin and Dohrn (2017), Definition 14) Let G be a weighted directed graph and l ∈ N, l > 1. A deficient l-cycle in G is a sequence v0, . . . vl−1 of distinct vertices such that for all i ∈ [l], d(vi, v(i+1) ( mod l)) ≤ 1 2 with strict inequality for at least one i ∈ [l]. The next result is similar to Theorems 16 (the case l = 3) and Theorem 17 (the case l > 3) of Angluin and Dohrn (2017), but our proof is rather different (note that the case l = 2 follows easily from Lemma 2.5). Theorem 2.7 The thicket query graph GT Q(C, μ) has no degenerate l-cycles for l ≥ 2. The analogue of Theorem 16 can be adapted in a very similar manner to the technique employed by Angluin and Dohrn (2017). However, the analogue of the proof of Theorem 17 falls apart in our context; the reason is that Lemma 2.2 is analogous to Lemma 6 of Angluin and Dohrn (2017) (and Lemma 2.5 is analogous to Lemma 13 of Angluin and Dohrn (2017)), but our lemmas involve inequalities instead of equations. The inductive technique of (Angluin and Dohrn, 2017, Theorem 17) is to shorten degenerate cycles by considering the weights of a particular edge in the elimination graph along with the weight of the edge in the opposite direction. Since one of those weights 2. Here one should think of the query by the learner as being A, and the actual hypothesis being B. The teacher samples from ∆(A, B), and the learner now knows the value of the hypothesis on x. 3 CHASE FRIETAG REYZIN being large forces the other to be small (by the equalities of their lemmas), the induction naturally separates into two useful cases. In our thicket query graph, things are much less tightly constrained - one weight of an edge being large does not force the weight of the edge in the opposite direction to be small. However, the technique employed in our proof seems to be flexible enough to adapt to prove Theorems 16 and 17 of Angluin and Dohrn (2017). Proof Suppose the vertices in the degenerate l-cycle are A0, . . . , Al−1. By the definition of degen- erate cycles and d(−, −), we have, for each i ∈ Z/lZ, that μ(a) μ(∆(Ai, Ai+1)) u(Ai, a) ≤ 1 2 . Xa∈∆(Ai,Ai+1) Clearing the denominator we have μ(a)u(Ai, a) ≤ 1 2 μ(∆(Ai, Ai+1)). (2.1) Xa∈∆(Ai,Ai+1) Note that throughout this argument, the coefficients are being calculated modulo l. Notice that for at least one value of i, the inequality in 2.1 must be strict. Let G, H be a partition of X = {A1, . . . , Al}. Now define D(G, H) := {a ∈ X | ∀A1, B1 ∈ G, ∀A2, B2 ∈ H, A1(a) = B1(a), A2(a) = B2(a), A1(a) 6= A2(a)} . The following fact follows from the definition of ∆(A, B) and D(−, −). Fact 2.8 The set ∆(Ai, Ai+1) is the disjoint union, over all partitions of X into two pieces G, H such that Ai ∈ G and Ai+1 ∈ H of the sets D(G, H). Now, take the sum of the inequalities 2.1 as i ranges from 1 to l. On the LHS of the resulting sum, we obtain l  i=1 X G,H a partition of X, Ai∈G,Ai+1∈H X  On the RHS of the resulting sum we obtain   Xa∈D(G,H) μ(a)u(Ai, a)  .    1 2 l i=1 X   G,H a partition of X, Ai∈G,Ai+1∈H X Xa∈D(G,H)   μ(a)  .    Given a partition G, H of {A1, . . . , Al} we note that the term D(G, H) = D(H, G) appears exactly once as an element of the above sum for a fixed value of i exactly when Ai ∈ G and Ai+1 ∈ H or Ai ∈ H and Ai+1 ∈ G. Consider the partition G, H of X. Suppose that Aj, Aj+1, . . . , Ak is a block of elements each contained in G, and that Aj−1, Ak+1 are in H. Now consider the terms i = j − 1 and i = k of the above sums (each of which where D(G, H) appears). 4 APPLICATIONS OF LITTLESTONE DIMENSION TO QUERY LEARNING AND TO COMPRESSION On the left hand side, we have a∈D(G,H) μ(a)u(Aj−1, a)) and a∈D(G,H) μ(a)u(Ak, a)). Note that for a ∈ D(G, H), we have a ∈ ∆(Aj−1, Ak). So, by Lemma 2.2, we have P P Xa∈D(G,H) On the RHS, we have μ(a)u(Aj−1, a) + μ(a)u(Ak, a) ≥ μ(a). Xa∈D(G,H) Xa∈D(G,H) 1 2   μ(a) + Xa∈D(G,H) Xa∈D(G,H) μ(a)  = μ(a). Xa∈D(G,H) For each G, H a partition of X, the terms appearing in the above sum occur in pairs as above by Fact 2.8, and so, we have the the LHS is at least as large as the RHS of the sum of inequalities 2.1, which is impossible, since one of the inequalities must have been strict by our degenerate cycle.  Theorem 2.9 There is at least one element A ∈ C with query rank at least 1 2 . Proof If not, then for every element A ∈ C, there is some element B ∈ C such that d(A, B) < 1 2 . 2 . Now, fix A ∈ C and consider So, pick, for each A ∈ C, an element f (A) such that d(A, f (A)) < 1 the sequence of elements of C given by (f i(A)); since C is finite, at some point the sequence repeats itself. So, take a list of elements B, f (B), . . . , f n(B) = B. By construction, this yields a bad cycle, contradicting Theorem 2.7. 2.1. The thicket max-min algorithm In this subsection we show how to use the lower bound on query rank proved in Theorem 2.9 to give an algorithm which yields the correct concept in linearly (in the Littlestone dimension) many queries from C. The approach is fairly straightforward-essentially the learner repeatedly queries the highest query rank concept. The approach is similar to that taken in (Angluin and Dohrn, 2017, Section 5) but with query rank in place of their notion of informative. Now we informally describe the thicket max-min-algorithm. At stage i, the learner is given information of a concept class Ci. The learner picks the query A = arg maxA∈Ci (minB∈Ci dCi(A, B)) . The algorithm halts if the learner has picked the actual concept C. If not, the teacher returns a random element ai ∈ ∆(A, C) at which point the learner knows the value of C(ai). Then Ci+1 = (Ci)ai=C(ai). Let T (C) be the expected number of queries before the learner correctly identifies the target concept. Theorem 2.10 The expected number of queries to learn a concept in a class C is less than or equal to 2 Ldim(C). Proof The expected drop in the Littlestone dimension of the concept class induced by any query before the algorithm terminates is at least 1/2 by Theorem 2.9; so the probability that the drop in the Littlestone dimension is positive is at least 1/2 for any given query. So, from 2n queries, one expects at least n drops in Littlestone dimension, at which point the class is learned. 5 CHASE FRIETAG REYZIN 3. Equivalence queries with random counterexamples and random targets Let C consist the collection of intervals n+1 , 1 with μ the Lebesgue measure on the unit interval. This concept class has Littlestone dimension one since any two concepts are disjoint. There is no upper bound on the number of expected queries (using the model with random counterexamples of the previous section) which is uniform over all targets. | n ∈ N n(cid:16) o (cid:17) n 1 To see why, suppose the learner guesses interval for some n. For any ǫ > 0 there is N ∈ N such that with probability greater than 1 − ǫ, the learner gets a counterexample from the interval they guessed, . Of course, even with this additional information, no matter the learner's guess at any stage at which they have received only negative counterexamples, this is clearly still the case. Thus, there can be no bound on expected queries which is uniform over all target concepts. n+1 , 1 (cid:16) (cid:17) (cid:17) (cid:16) n n 1 1 n+1 , 1 In this section we introduce an additional source of randomness which allows for learning over infinite classes C.3 So, suppose C is a (possibly infinite) set of concepts on a set X. Suppose that we have probability measures μ on X and τ on C. Suppose a target A ∈ C is selected randomly ac- cording to the distribution τ and the counterexamples to equivalence queries are selected randomly according to the distribution μ. Theorem 3.1 Suppose that C is countable with finite Littlestone dimension d. There is an algorithm such that the expected number of queries over distributions μ on X and τ on C is at most ̃O(d). Proof Let ǫk = 1 fraction of the concepts with respect to the measure τ . 2k+1 for k ∈ N. The idea of the algorithm is to run our earlier algorithm on a 1 − ǫk At stage k of the algorithm, we observe the following. Since C is countable, enumerate the ∞ i=1 P (Ci) = 1, for any ǫk > 0, there is Nk = N (ǫk) ∈ N collection C = {Ci}i∈N. Then since such that ∞ i=1 P (Ci) ≥ 1 − ǫk. P Conditional on the target being among the first Nk concepts, the next idea is to run the algorithm from the previous section on this finite set for n steps where n is such that the probability that we have not identified the target after n steps is less than ǫ, for some 0 < ǫ < 1. This number n = nd,ǫ depends only on the Littlestone dimension and ǫ, but not on N as we will explain. We now bound the probability that the algorithm has not terminated after n steps, conditional on the target being in the first Nk many concepts. Since at any step, the probability that the Littlestone dimension drops is at least 1 2 by Theorem 2.9, the probability that the algorithm has not terminated after n steps is at most the probability of a binomial random variable with probability 1 2 achieving at most d − 1 successes in n attempts, which is d−1 Xk=0 (cid:18) n k (cid:19) (cid:18) 1 2 n (cid:19) ≤ nd/2n. Note that nd/2n < ǫ whenever n − d log n > log 1 ǫ . Hence, (cid:0) n ≥ ̃O(d + log(1/ǫ)) (cid:1) 3. One might also think of the random EQ learning of Angluin and Dohrn as analysing the maximum number of expected number of queries over all possible targets, while our model will analyze the expected number of queries where the expectation is taken over the the concepts (with a fixed but arbitrary distribution) and over the counterexamples. 6 P APPLICATIONS OF LITTLESTONE DIMENSION TO QUERY LEARNING AND TO COMPRESSION is sufficient. So at stage k, we run the algorithm for n steps as specified above. Either the target concept is found or we continue to stage k + 1 on the larger concept class Nk. Since (1 − ǫ1) ∞ Xk=1 ǫk ! ∞ = 1/2 1/2k+1 < 1, Xk=1 the expected total number of queries is still bounded by ̃O(d + log(1/ǫ)).4 4. Compression schemes and stability In this section, we follow the notation and definitions given in Johnson and Laskowski (2010) on compression schemes, a notion due to Littlestone and Warmuth Littlestone and Warmuth (1986). Roughly speaking, C admits a d-dimensional compression scheme if, given any finite subset F of X and some f ∈ C, there is a way of encoding the set F with only d-many elements of F in such a way that F can be recovered. We will give a formal definition, but we note that numerous variants of this idea appear through- out the literature, including as size d-array compression Ben-David and Litman (1998). extended compression schemes with b extra bits Floyd and Warmuth (1995), and as unlabeled compression schemes Kuzmin and Warmuth (2007). The next definition, gives the notion of compression we will work with in this section; the notion is equivalent to the notion of a d-compression with b extra bits of Floyd and Warmuth (1995). The equivalence of these two notions is proved by (Johnson and Laskowski, 2010, Proposition 2.1). In our compression schemes, the role of the b extra bits is played by the reconstruction functions, and of course the number of extra bits can be bounded in terms of the number of reconstruction functions (and vice versa). Of course, one is interested in optimizing both the size of the compression and the number of reconstruction functions (extra bits) in general. Definition 4.1 We say that a concept class C has a d-compression if there is a compression function κ : Cf in → X d and a finite set R of reconstruction functions ρ : X d → 2X such that for any f ∈ Cf in 1. κ(f ) ⊆ dom(f ) 2. f = ρ(κ(f ))|dom(f ) for at least one ρ ∈ R. We work with the above notion mainly because it is the notion used in Johnson and Laskowski (2010), and our goal is to improve a result of Laskowski and Johnson therein. That result was later improved by Laskowski and appears in the unpublished notes of Guingona (Theorem 4.1.3). When the original work on this result was completed, we were not aware of the work of Guingona, but as it turns out, our result improves both of these (the latter uses exponentially many reconstruction functions, while we use linearly many). 4. There isn't anything particularly special about the sequence ǫk that we chose. Any sequence (ǫk) going to zero whose sum converges can be seen to work in the algorithm, and affects only the constants in the expected number of steps, which we are not optimizing. 7 CHASE FRIETAG REYZIN Johnson and Laskowski (2010) prove that a concept class with finite Littlestone dimension has has an extended d-compression for some d.5 The precise value of d is not determined there, but was conjectured to be the Littlestone dimension. In Theorem 4.4, we will show that d can be taken to be the Littlestone dimension and d + 1 many reconstruction functions suffice.6 The question in Johnson and Laskowski (2010) is the analogue (for Littlestone dimension) of a well-known open question from VC-theory (Floyd and Warmuth, 1995): is there a bound A(d) linear in d such that every class of VC-dimension d has a compression scheme of size at most A(d)? In general there is known to be a bound that is at most exponential in d (Moran and Yehudayoff, 2016). Definition 4.2 Suppose Ldim(C) = d. Given a partial function f , say that f is exceptional for C if for all a ∈ dom(f ), C (a,f (a)) := {g ∈ C | g(a) = f (a)} has Littlestone dimension d. Definition 4.3 Suppose Ldim(C) = d. Let fC be the partial function given by 0 fC(x) =  1  undefined otherwise. Ldim(C Ldim(C (x,0)) = d (x,1)) = d It is clear that fC extends any partial function exceptional for C.  Theorem 4.4 Any concept class C of Littlestone dimension d has an extended d-compression with (d + 1)-many reconstruction functions. Proof If d = 0, then C is a singleton, and one reconstruction function suffices. So we may assume d ≥ 1. Fix some f ∈ Cf in with domain F . We will run an algorithm to construct a tuple of length at most d from F by adding one element at each step of the algorithm. During each step of the algorithm, we also have a concept class Ci, with C0 = C initially. If f is exceptional in Ci−1, then the algorithm halts. Otherwise, pick either: • ai ∈ F such that f (ai) = 1 and (Ci−1)(ai,1) := {g | g ∈ Ci−1, g(ai) = 1} has Littlestone dimension less than Ldim(Ci−1). {g | g ∈ Ci−1, g(ai) = 1}. In this case, set Ci := (Ci−1)(ai,1) = 5. Their result is formulated for the sets of realizations of first order formulas which are stable, but their proofs work for general concept classes, and Chase and Freitag (2019) explains that stable is equivalent to finite Littlestone dimen- sion. 6. After proving this, we became aware of the unpublished result of Laskowski appearing as (Guingona, Theorem 4.1.3) which shows one can take d to be the Littlestone dimension and uses 2d many reconstruction functions. 8 APPLICATIONS OF LITTLESTONE DIMENSION TO QUERY LEARNING AND TO COMPRESSION • di ∈ F such that f (di) = 0 and (Ci−1)(di,0) := {g | g ∈ Ci−1, g(di) = 0} has Littlestone dimension less than Ldim(Ci−1). In this case, set Ci := (Ci−1)(di,0). We allow the algorithm to run for at most d steps. There are two distinct cases. If our algorithm has run for d steps, let κ(f ) be the tuple ( ̄a, ̄d) of all of the elements ai as above followed by all of the elements di as above for i = 1, . . . , d. By choice of ai and di, this tuple consists of d distinct elements. By construction the set C ( ̄a, ̄d) := {g ∈ C| g(ai) = 1, g(di) = 0} has Littlestone dimension 0, that is, there is a unique concept in this class. So, given (c1, c2, . . . , cn) ∈ X d consisting of distinct elements, for i = 0, . . . , d, we let ρi(c1, . . . , cn) be some g belonging to {g ∈ C | g(cj ) = 1 for j ≤ i, g(cj ) = 0 for j > i}, if such a g exists. By construction, for some i, the Littlestone dimension of the concept class {g ∈ C ∩ F | g(cj ) = 1 for j ≤ i, g(cj ) = 0 for j > i} is zero, and so g is uniquely specified and will extend f . We handle cases where the algorithm halts early by augmenting two of the reconstruction func- tions ρ0 and ρ1 defined above. Because ρ0 and ρ1 have so far only been defined for tuples consisting of d distinct elements, we can extend these to handle exceptional cases by generating tuples with duplicate elements. ( ̄a, ̄d). If the algorithm stops at some step i > 1, then it has generated a tuple of length i − 1 consisting of some elements aj and some elements dk. Let ̄a consist of the elements aj chosen during the algorithm, and let ̄d consist of the elements dk chosen during the running of the algorithm. Observe that f is exceptional for C ( ̄a, ̄d) If ̄a is not empty, with initial element a′, then let κ(f ) = ( ̄a, a′, ̄d, a′, . . . , a′) ∈ F d. From this tuple, one can recover ( ̄a, ̄d) (assuming ̄a is nonempty), so we let ρ1( ̄a, a′, ̄d, a′, . . . , a′) be , which itself extends f . So ρ1( ̄a, ̄d) extends f whenever the some total function extending fC algorithm halts before step d is completed and some ai was chosen at some point. If ̄a is empty, then let κ(f ) = ( ̄d, d′, . . . , d′) ∈ F d, where d′ is the initial element of ̄d. From this tuple, one can recover (∅, ̄d) (assuming ̄a is empty), so we let ρ0( ̄d, d′, . . . , d′) be total function extending fC , (∅, ̄d) which itself extends f . Finally, if the algorithm terminates during step 1, then it has generated the empty tuple. In this case, let κ(f ) = (c, . . . , c) for some c ∈ F . Then Ldim(C) = Ldim(C (c,l)) for some l ∈ {0, 1}. In particular, if we have defined κ(f ′) = (c, . . . , c) above for some f ′ where the algorithm only returns c (rather than the empty tuple), then 1 − l = f ′(c) 6= f (c), and so any such f ′ is handled by ρ1−l. So we may overwrite ρl to set ρ(c, . . . , c) to be a total function extending fC, which itself extends f . For any tuple output by our algorithm, one of the reconstruction functions produces an extension of the original concept. Acknowledgements This research was supported in part by award ECCS-2217023 from the National Science Founda- tion. 9 CHASE FRIETAG REYZIN References Dana Angluin and Tyler Dohrn. The power of random counterexamples. In International Confer- ence on Algorithmic Learning Theory, pages 452–465, 2017. Shai Ben-David and Ami Litman. Combinatorial variability of Vapnik-Chervonenkis classes with applications to sample compression schemes. Discrete Applied Mathematics, 86(1):3–25, 1998. Hunter Chase and James Freitag. Model theory and machine learning. Bulletin of Symbolic Logic, 25(3):319–332, 2019. Sally Floyd and Manfred Warmuth. Sample compression, learnability, and the Vapnik-Chervonenkis dimension. Machine learning, 21(3):269–304, 1995. Vincent computational https://tigerweb.towson.edu/vguingona/NIPTCLT.pdf. Guingona. theories NIP and learning theory. Hunter R Johnson and Michael C Laskowski. Compression schemes, stable definable families, and o-minimal structures. Discrete & Computational Geometry, 43(4):914–926, 2010. Akash Kumar, Yuxin Chen, and Adish Singla. Teaching via best-case counterexamples in the learning-with-equivalence-queries paradigm. Advances in Neural Information Processing Sys- tems, 34:26897–26910, 2021. Dima Kuzmin and Manfred K Warmuth. Unlabeled compression schemes for maximum classes. Journal of Machine Learning Research, 8(9), 2007. Nick Littlestone. Learning quickly when irrelevant attributes abound: A new linear-threshold algo- rithm. Machine Learning, 2(4):285–318, 1988. Nick Littlestone and Manfred Warmuth. Relating data compression and learnability. Technical report, University of California, Santa Cruz, 1986. Shay Moran and Amir Yehudayoff. Sample compression schemes for VC classes. Journal of the ACM (JACM), 63(3):21, 2016. Manfred K. Warmuth. Compressing to vc dimension many points. In Bernhard Sch ̈olkopf and Manfred K. Warmuth, editors, Learning Theory and Kernel Machines, pages 743–744, Berlin, Heidelberg, 2003. Springer Berlin Heidelberg. ISBN 978-3-540-45167-9. 10
http://arxiv.org/abs/2310.04796v1
"2023-10-07T13:09:37"
"2023-10-07T13:09:37"
Accelerate Multi-Agent Reinforcement Learning in Zero-Sum Games with Subgame Curriculum Learning
Learning Nash equilibrium (NE) in complex zero-sum games with multi-agent reinforcement learning (MARL) can be extremely computationally expensive. Curriculum learning is an effective way to accelerate learning, but an under-explored dimension for generating a curriculum is the difficulty-to-learn of the subgames -- games induced by starting from a specific state. In this work, we present a novel subgame curriculum learning framework for zero-sum games. It adopts an adaptive initial state distribution by resetting agents to some previously visited states where they can quickly learn to improve performance. Building upon this framework, we derive a subgame selection metric that approximates the squared distance to NE values and further adopt a particle-based state sampler for subgame generation. Integrating these techniques leads to our new algorithm, Subgame Automatic Curriculum Learning (SACL), which is a realization of the subgame curriculum learning framework. SACL can be combined with any MARL algorithm such as MAPPO. Experiments in the particle-world environment and Google Research Football environment show SACL produces much stronger policies than baselines. In the challenging hide-and-seek quadrant environment, SACL produces all four emergent stages and uses only half the samples of MAPPO with self-play. The project website is at https://sites.google.com/view/sacl-rl.
[ "Jiayu Chen", "Zelai Xu", "Yunfei Li", "Chao Yu", "Jiaming Song", "Huazhong Yang", "Fei Fang", "Yu Wang", "Yi Wu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04796v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04796v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
Accelerate Multi-Agent Reinforcement Learning in Zero-Sum Games with Subgame Curriculum Learning Jiayu Chen 1♯*, Zelai Xu1*, Yunfei Li1, Chao Yu1, Jiaming Song3, Huazhong Yang1, Fei Fang4, Yu Wang1, Yi Wu12♮ 1Tsinghua University, 2Shanghai Qi Zhi Institute, 3Stanford University,4Carnegie Mellon University, ♯jia768167535@gmail.com,♮jxwuyi@gmail.com 3 2 0 2 t c O 7 ] G L . s c [ 1 v 6 9 7 4 0 . 0 1 3 2 : v i X r a Abstract Learning Nash equilibrium (NE) in complex zero-sum games with multi-agent reinforcement learning (MARL) can be ex- tremely computationally expensive. Curriculum learning is an effective way to accelerate learning, but an under-explored dimension for generating a curriculum is the difficulty-to- learn of the subgames – games induced by starting from a specific state. In this work, we present a novel subgame cur- riculum learning framework for zero-sum games. It adopts an adaptive initial state distribution by resetting agents to some previously visited states where they can quickly learn to im- prove performance. Building upon this framework, we derive a subgame selection metric that approximates the squared dis- tance to NE values and further adopt a particle-based state sampler for subgame generation. Integrating these techniques leads to our new algorithm, Subgame Automatic Curriculum Learning (SACL), which is a realization of the subgame cur- riculum learning framework. SACL can be combined with any MARL algorithm such as MAPPO. Experiments in the particle-world environment and Google Research Football environment show SACL produces much stronger policies than baselines. In the challenging hide-and-seek quadrant en- vironment, SACL produces all four emergent stages and uses only half the samples of MAPPO with self-play. The project website is at https://sites.google.com/view/sacl-rl. Introduction Applying reinforcement learning (RL) to zero-sum games has led to enormous success, with trained agents defeating professional humans in Go (Silver et al. 2016), StarCraft II (Vinyals et al. 2019), and Dota 2 (Berner et al. 2019). To find an approximate Nash equilibrium (NE) in complex games, these works often require a tremendous amount of training resources including hundreds of GPUs and weeks or even months of time. The unaffordable cost prevents RL from more real-world applications beyond these flagship projects supported by big companies and makes it important to develop algorithms that can learn close-to-equilibrium strategies in a substantially more efficient manner. One way to accelerate training is curriculum learning – training agents in tasks from easy to hard. Many existing works in solving zero-sum games with MARL generate a *These authors contributed equally. Copyright © 2024, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved. curriculum by choosing whom to play with. They often use self-play to provide a natural policy curriculum as the agents are trained against increasingly stronger opponents (Bansal et al. 2018; Baker et al. 2020). The self-play framework can be further extended to population-based training (PBT) by maintaining a policy pool and iteratively training new best responses to mixtures of previous policies (McMahan, Gor- don, and Blum 2003; Lanctot et al. 2017). Such a policy-level curriculum generation paradigm is very different from the paradigm commonly used in goal-conditioned RL (Matiisen et al. 2019; Portelas et al. 2020). Most curriculum learning methods for goal-conditioned problems directly reset the goal or initial states for each training episode to ensure the cur- rent task is of suitable difficulty for the learning agent. In contrast, the policy-level curriculum in zero-sum games only provides increasingly stronger opponents, and the agents are still trained by playing the full game starting from a fixed initial state distribution, which is often very challenging. In this paper, we propose a general subgame curriculum learning framework to further accelerate MARL training for zero-sum games. It leverages ideas from goal-conditioned RL. Complementary to policy-level curriculum methods like self-play and PBT, our framework generates subgames (i.e., games induced by starting from a specific state) with growing difficulty for agents to learn and eventually solve the full game. We provide justifications for our proposal by analyzing a simple iterated Rock-Paper-Scissors game. We show that in this game, vanilla MARL requires exponentially many samples to learn the NE. However, by using a buffer to store the visited states and choosing an adaptive order of state- induced subgames to learn, the NE can be learned with linear samples. A key challenge in our framework is to choose which sub- game to train on. This is non-trivial in zero-sum games since there does not exist a clear progression metric like the success rate in goal-conditioned problems. While the squared differ- ence between the current state value and the NE value can measure the progress of learning, it is impossible to calculate this value during training as the NE is generally unknown. We derive an alternative metric that approximates the squared difference with a bias term and a variance term. The bias term measures how fast the state value changes and the variance term measures how uncertain the current value is. We use the combination of the two terms as the sampling weights for states and prioritize subgames with fast change and high uncertainty. Instantiating our framework with the state se- lection metric and a non-parametric subgame sampler, we develop an automatic curriculum learning algorithm for zero- sum games, i.e., Subgame Automatic Curriculum Learning (SACL). SACL can adopt any MARL algorithm as its back- bone and preserve the overall convergence property. In our implementation, we choose the MAPPO algorithm (Yu et al. 2021) for the best empirical performances. We first evaluate SACL in the Multi-Agent Particle En- vironment and Google Research Football, where SACL learns stronger policies with lower exploitability than ex- isting MARL algorithms for zero-sum games given the same amount of environment interactions. We then stress-test the efficiency of SACL in the challenging hide-and-seek envi- ronment. SACL leads to the emergence of all four phases of different strategies and uses 50% fewer samples than MAPPO with self-play. Preliminary Markov Game A Markov game (Littman 1994) is defined by a tuple MG = (N , S, A, P, R, γ, ρ), where N = {1, 2, * * * , N } is the set of agents, S is the state space, A = ΠN i=1Ai is the joint action space with Ai being the action space of agent i, P : S × A → ∆(S) is the transition probability function, R = (R1, R2, * * * , RN ) : S × A → Rn is the joint re- ward function with Ri being the reward function for agent i, γ is the discount factor, and ρ is the distribution of ini- tial states. Given the current state s and the joint action a = (a1, a2, * * * , aN ) of all agents, the game moves to the next state s′ with probability P (s′|s, a) and agent i receives a reward Ri(s, a). For infinite-horizon Markov games, a subgame MG(s) is defined as the Markov game induced by starting from state s, i.e., ρ(s) = 1. Selecting subgames is therefore equivalent to setting the Markov game's initial states. The subgames of finite-horizon Markov games are defined similarly and have an additional variable to denote the current step t. We focus on two-player zero-sum Markov games, i.e., N = 2 and R1(s, a) + R2(s, a) = 0 for all state-action pairs (s, a) ∈ S × A. We use the subscript i to denote variables of player i and the subscript −i to denote variables of the player other than i. Each player uses a policy πi : S → Ai to produce actions and maximize its own accumulated reward. Given the joint policy π = (π1, π2), each player's value function of state s and Q-function of state-action pair (s, a) are defined as i (s) = E V π (cid:104) (cid:88) t (cid:104) (cid:88) Qπ i (s, a) = E t (cid:12) (cid:105) γtRi(st, at) (cid:12)s0 = s (cid:12) , (cid:12) (cid:105) γtRi(st, at) (cid:12)s0 = s, a0 = a (cid:12) . (1) (2) The solution concept of two-player zero-sum Markov games is Nash equilibrium (NE), which is a joint policy where no player can get a higher value by changing its policy alone. Definition 1 (NE). A joint policy π∗ = (π∗ 2) is a Nash equilibrium of a Markov game if for all initial states s0 with ρ(s0) > 0, the following condition holds 1, π∗ π∗ i = arg max πi (πi,π∗ i −i) V (s0), ∀i ∈ {1, 2}. (3) We use V ∗ i (*) to denote the NE value function of player i and Q∗ i (*, *) to denote the NE Q-function of player i, and the following equations hold by definition and the minimax nature of zero-sum games. min π−i V ∗ i (s) = max πi Ea∼π(*|s) [Q∗ i (s, a)] , (4) Q∗ i (s, a) = Ri(s, a) + γ * Es′∼P (*|s,a) [V ∗ i (s′)] . (5) MARL Algorithms in Zero-Sum Games MARL methods have been applied to zero-sum games trac- ing back to the TD-Gammon project (Tesauro et al. 1995). A large body of work (Zinkevich et al. 2007; Brown et al. 2019; Steinberger, Lerer, and Brown 2020; Gruslys et al. 2020) is based on regret minimization, and a well-known result is that the average of policies produced by self-play of regret-minimizing algorithms converges to the NE pol- icy of zero-sum games (Freund and Schapire 1996). An- other notable line of work (Littman 1994; Heinrich, Lanctot, and Silver 2015; Lanctot et al. 2017; Perolat et al. 2022) combines RL algorithms with game-theoretic approaches. These works typically use self-play or population-based train- ing to collect samples and then apply RL methods like Q- learning (Watkins and Dayan 1992) and PPO (Schulman et al. 2017) to learn the NE value functions and policies, and have recently achieved great success (Silver et al. 2016; Jaderberg et al. 2018; Vinyals et al. 2019; Berner et al. 2019). For the analysis in the next section, we introduce a clas- sic MARL algorithm named minimax-Q learning (Littman 1994) that extends Q-learning to zero-sum games. Initializ- ing functions Qi(*, *) with zero values, minimax-Q uses an exploration policy induced by the current Q-functions to col- lect a batch of samples {(st, at, rt t=0 and uses these samples to update the Q-functions by Qi(st, at) ← (1 − α) * Qi(st, at)+ Ea∼π(*|s) (cid:2)Qi(st+1, a)(cid:3) (cid:1), i, st+1)}T α * (cid:0)rt (6) i + γ * max πi min π−i where α is the learning rate. This sample-and-update pro- cess continues until the Q-functions converge. Under the assumptions that the state-action sets are discrete and fi- nite and are visited an infinite number of times, it is proved that the stochastic updates by Eq. (6) leads to the NE Q- functions (Szepesvári and Littman 1999). A Motivating Example In this section, we show by a simple illustrative example that vanilla MARL methods like minimax-Q require exponen- tially many samples to derive the NE. However, if we can dynamically set the initial state distribution and induce an ap- propriate order of subgames to learn, the sample complexity can be substantially reduced from exponential to linear. Such an observation motivates our proposed algorithm described in later sections. Algorithm 1: Subgame curriculum learning Input: state sampler oracle(*). Initialize policy π; repeat Sample s0 ∼ oracle(S); Rollout π in MG(s0); Train π via MARL; until π converges; Output: final policy π. From Exponential to Linear Complexity An important observation is that the states in later rounds become exponentially rare in the samples generated by start- ing from the fixed initial state. If we can directly reset the game to these states and design a smart order of minimax-Q updates on the subgames induced by these states, the NE learning can be accelerated significantly. Note that RP S(n) can be regarded as the composition of n individual RP S(1) games, a suitable order of learning would be from the eas- iest subgame RP S(1) starting from state sn−1 to the full game RP S(n) starting from state s0. Assuming we have full access to the state space, we first reset the game to sn−1 and use minimax-Q to solve subgame RP S(1) with O(1) samples. Given that the NE Q-values of RP S(k) are learned, the next subgame RP S(k + 1) is equivalent to an RP S(1) game where the winning reward is the value of state sn−k. By sequentially applying minimax-Q to solve all n subgames from RP S(1) to RP S(n), the number of samples required to learn the NE Q-values is reduced substantially from O(3n) to O(n). In practice, we usually do not have access to the entire state space and cannot directly start from the last subgame RP S(1). Instead, we can use a buffer to store all visited states and gradually span the state space. By resetting games to the newly visited states, the number of samples required to cover the full state space is still O(n), and we can then apply minimax-Q from RP S(1) to RP S(n). Therefore, the total number of samples is still O(n). The detailed analysis can be found in Appendix . We validate our analysis by running experiments on RP S(n) games for n = 1, * * * , 10 and the results averaged over ten seeds are shown in Fig. 2. It can be seen that the sample complexity reduces from exponential to linear by running minimax-Q over a smart order of subgames, and the result of using a state buffer in practice is comparable to the result with full access. Method The motivating example suggests that NE learning can be largely accelerated by running MARL algorithms in a smart order over states. Inspired by this insight, we present a general framework to accelerate NE learning in zero-sum games by training over a curriculum of subgames. We further propose two practical techniques to instantiate the framework and present the overall algorithm. Figure 1: Illustration of the iterated Rock-Paper-Scissors game. Figure 2: Number of samples used to learn the NE Q-values of RP S(n) games. Iterated Rock-Paper-Scissors Game We introduce an iterated variant of the Rock-Paper-Scissor (RPS) game, denoted as RP S(n). As shown in Fig. 1, P1 and P2 play the RPS game for up to n rounds. If P1 wins all rounds, it gets a reward of 1 and P2 gets a reward of −1. If P1 loses or draws in any round, the game ends immediately without playing the remaining rounds and both players get zero rewards. Note that the RP S(n) game is different from playing the RPS game repeatedly for n times because players can play less than n rounds and they only receive a non-zero reward if P1 wins in all rounds. We use sk to denote the state where players have already played k RPS games and are at the k + 1 round. It is easy to verify that the NE policy for both players is to play Rock, Paper, or Scissors with equal probability at each state. Under this joint NE policy, P1 can win one RPS game with 1/3 probability, and the probability for P1 to win all n rounds and get a non-zero reward is 1/3n. Consider using standard minimax-Q learning to solve the RP S(n) game. With Q-functions initialized to zero, we ex- ecute the exploration policy to collect samples and perform the update in Eq. (6). Note all state-actions pairs are required to be visited to guarantee convergence to the NE. Therefore, in this sparse-reward game, random exploration will clearly take O(3n) steps to get a non-zero reward. Moreover, even if the exploration policy is perfectly set to the NE policy of RP S(n), the probability for P1 to get the non-zero reward by winning all RPS games is still O(1/3n), requiring at least O(3n) samples to learn the NE Q-values of the RP S(n) game. round 10round 20round n01!!wins......""#!!!loses or draws"$"!246810RPS(n)102104106samplesstandard minimax-Qsubgame w. full accesssubgame w. state buffer Algorithm 2: Subgame Automatic Curriculum Learn- ing (SACL) Input: state buffers M with capacity K, probability p to sample initial state from the state buffer. Randomly initialize policy πi and value function Vi for player i = 1, 2; repeat V ′ i ← Vi, i = 1, 2; // Select subgame and train policy. for each parallel environment do Sample s0 ∼ sampler(M) with probability p, else s0 ∼ ρ(*); Rollout in MG(s0) and collect samples; Train {πi, Vi}2 // Compute weight by Eq. (10) and i=1 via MARL; update state buffer. i (st)]2 +Var({ ̃Vi(st)}2 i=1), ̃wt ← α*E[ ̃Vi(st)− ̃V ′ t = 0, * * * , T ; M ← M ∪ {(st, ̃wt)}T if ∥M∥ > K then t=0; M ← FPS(M, K); until (π1, π2) converges; Output: final policy (π1, π2). Subgame Curriculum Learning The key issue of the standard sample-and-update framework is that the rollout trajectories always start from the fixed initial state distribution ρ, so visiting states that are most critical for efficient learning can consume a large number of samples. To accelerate training, we can directly reset the environment to those critical states. Suppose we have an oracle state sampler oracle(*) that can initiate suitable states for the current policy to learn, i.e., generate appropriate induced subgames, we can derive a general-purpose framework in Alg. 1, which we call subgame curriculum learning. Note that this framework is compatible with any MARL algorithm for zero-sum Markov games. A desirable feature of subgame curriculum learning is that it does not change the convergence property of the backbone MARL algorithm, as discussed below. Proposition 1. If all initial states s0 with ρ(s0) > 0 are sampled infinitely often, and the backbone MARL algorithm is guaranteed to converge to an NE in zero-sum Markov games, then subgame curriculum learning also produces an NE of the original Markov game. The proof can be found in Appendix . Note that such a requirement is easy to satisfy. For example, given any state sampler oracle(*), we can construct a valid mixed sampler by sampling from oracle(*) for probability 0 < p < 1 and sampling from ρ for probability 1 − p. Remark. With a given state sampler, the only requirement of our subgame curriculum learning framework is that the environment can be reset to a desired state to generate the induced game. This is a standard assumption in the curricu- lum learning literature (Florensa et al. 2018; Matiisen et al. 2019; Portelas et al. 2020) and is feasible in many RL envi- ronments. For environments that do not support this feature, we can simply reimplement the reset function to make them compatible with our framework. Subgame Sampling Metric A key question is how to instantiate the oracle sampler, i.e., which subgame should we train on for faster convergence? Intuitively, for a particular state s, if its value has converged to the NE value, that is, Vi(s) = V ∗ i (s), we should no longer train on the subgame induced by it. By contrast, if the gap between its current value and the NE value is substantial, we should probably train more on the induced subgame. Thus, a simple way is to use the squared difference of the current value and the NE value as the weight for a state and sample states with probabilities proportional to the weights. Con- cretely, the state weight can be written as w(s) = 1 2 2 (cid:88) i=1 (V ∗ i (s) − Vi(s))2 (7) (cid:2)V ∗ + Vari = Ei = Ei (cid:2)(V ∗ (cid:2)V ∗ 1 (s) − ̃Vi(s))2(cid:3) 1 (s) − ̃Vi(s)(cid:3)2 (8) 1 (s) − ̃Vi(s)(cid:3), (9) where ̃V1(s) = V1(s) and ̃V2(s) = −V2(s). The sec- ond equality holds because the game is zero-sum and V ∗ 2 (s) = −V ∗ 1 (s). With random initialization and different training samples, { ̃Vi}2 i=1 can be regarded as an ensemble of two value functions and the weight w(s) becomes the expectation over the ensemble. The last equality further ex- pands the expectation to a bias term and a variance term, and we sample state with probability P (s) = w(s)/ (cid:80) s′ w(s′). For the motivating example of RP S(n) game, the NE value decreases exponentially from the last state sn−1 to the initial state s0. With value functions initialized close to zero, the prioritized subgames throughout training will move gradually from the last round to the first round, which is approximately the optimal order. However, Eq. (9) is very hard to compute in practice be- cause the NE value is generally unknown. Inspired by Eq. (9), we propose the following alternative state weight (t) i (t−1) i π i (cid:2) ̃V (10) (cid:2) ̃Vi(s)(cid:3), π (s) − ̃V i (s)(cid:3)2 + Vari ̃w(s) = α * Ei which takes a hyperparameter α and uses the difference between two consecutive value function checkpoints instead of the difference between the NE value and the current value in Eq. (9). The first term in Eq. (10) measures how fast the value functions change over time. If this term is large, the value functions are changing constantly and still far from the NE value; if this term is marginal, the value functions are probably close to the converged NE value. The second term in Eq. (10) measures the uncertainty of the current learned values and is the same as the variance term in Eq. (9) because V ∗ 1 (s) is a constant. If α = 1, Eq. (10) approximates Eq. (9) as t increases. It is also possible to train an ensemble of value functions for each player to further improve the empirical performance. Additional analysis can be found in Appendix . Figure 3: Illustration of SACL in the hide-and-seek environment. In the Fort Building stage, the states with hiders near the box have high weights (red) and agents can easily learn to build a fort by practicing on these subgames, while the states with randomly spawned hiders have low weights (green) and contribute less to learning. Since Eq. (10) does not require the unknown NE value to compute, it can be used in practice as the weight for state sam- pling and can be implemented for most MARL algorithms. By selecting states with fast value change and high uncer- tainty, our framework prioritizes subgames where agents' performance can quickly improve through learning. Particle-based Subgame Sampler With the sample weight at hand, we can generate subgames by sampling initial states from the state space. But it is im- practical to sample from the entire space which is usually un- available and can be exponentially large for complex games. Typical solutions include training a generative adversarial network (GAN) (Dendorfer, Osep, and Leal-Taixé 2020) or using a parametric Gaussian mixture model (GMM) (Porte- las et al. 2020) to generate states for automatic curriculum learning. However, parametric models require a large number of samples to fit accurately and cannot adapt instantly to the ever-changing weight in our case. Moreover, the distribution of weights is highly multi-modal, which is hard to capture for many generative models. We instead adopt a particle-based approach and maintain a large state buffer M using all visited states throughout training to approximate the state space. Since the size of the buffer is limited while the state space can be infinitely large, it is important to keep representative samples that are suffi- ciently far from each other to ensure good coverage of the state space. When the number of states exceeds the buffer's capacity K, we use farthest point sampling (FPS) (Qi et al. 2017) which iteratively selects the farthest point from the cur- rent set of points. In our implementation, we first normalize each dimension of the states and the distance between two states is simply the Euclidean distance. More details can be found in Appendix . Overall Algorithm Combining the subgame sampling metric and the particle- based sampler, we present a realization of the subgame cur- riculum learning framework, i.e., the Subgame Automatic Curriculum Learning (SACL) algorithm, which is summa- rized in Alg. 2. When each episode resets, we use the particle- based sampler to generate suitable initial states s0 for the current policy to learn. To satisfy the requirements in Propo- sition 1, we also reset the game according to the initial state distribution ρ(*) with 0.3 probability. After collecting a num- ber of samples, we train the policies and value functions using MARL. The weights for the newly collected states are computed according to Eq. (10) and used to update the state buffer M. If the capacity of the state buffer is exceeded, we use FPS to select representative states-weight pairs and delete the others. An overview of SACL in the hide-and-seek game is illustrated in Fig. 3. Experiment We evaluate SACL in three different zero-sum environments: Multi-Agent Particle Environment (MPE) (Lowe et al. 2017), Google Research Football (GRF) (Kurach et al. 2020), and the hide-and-seek (HnS) environment (Baker et al. 2020). We use a state-of-the-art MARL algorithm MAPPO (Yu et al. 2021) as the backbone in all experiments. We evaluate the performance of policies by exploitability. How to define and compute the exploitability can be found in the Appendix . Main Results We first compare the performance of SACL in three envi- ronments against the following baselines for solving zero- sum games: self-play (SP), two popular variants including Fictitious Self-Play (FSP) (Heinrich, Lanctot, and Silver 2015) and Neural replicator dynamics (NeuRD) (Hennes et al. 2020), and a population-based training method policy- space response oracles (PSRO) (Lanctot et al. 2017). More implementation details can be found in Appendix . Multi-Agent Particle Environment. We consider the predator-prey scenario in MPE, where three slower coop- erating predators chase one faster prey in a square space with two obstacles. In the default setting, all agents are spawned highlowsampleweightinitial statesupdateself-playresetFort BuildingRunning and ChasingRamp UseRamp Defensesampleweightinitial statesupdateself-playresetlowhighagentagentagentenvironmentagentagentagentenvironment (a) MPE: exploitability. (b) MPE hard: exploitability. (c) HnS: number of samples. Figure 4: Main experiment results in (a) MPE, (b) MPE hard, and (c) Hide-and-seek. Scenario pass and shoot run pass and shoot 3 vs 1 with keeper SACL 0.35 (0.13) 0.60 (0.04) 0.45 (0.06) SP 0.48 (0.31) 0.68 (0.09) 0.83 (0.03) FSP 0.83 (0.10) 0.78 (0.08) 0.63 (0.25) PSRO 0.80 (0.09) 0.83 (0.04) 0.85 (0.05) NeuRD 0.79 (0.15) 0.95 (0.04) 0.81 (0.16) Table 1: Approximate exploitability of learned policies in different GRF scenarios. uniformly in the square. We also consider a harder setting where the predators are spawned in the top-right corner and the prey is spawned in the bottom-left corner. All algorithms are trained for 40M environment samples and the curves of approximate exploitability w.r.t. sample over three seeds are shown in Fig. 4(a) and 4(b). SACL converges faster and achieves lower exploitability than all baselines in both set- tings, and its advantage is more obvious in the hard scenario. This is because the initial state distribution in corners makes the full game challenging to solve, while SACL generates an adaptive state distribution and learns on increasingly harder subgames to accelerate NE learning. More results and discus- sions can be found in Appendix . Google Research Football. We evaluate SACL in three GRF academy scenarios, namely pass and shoot, run pass and shoot, and 3 vs 1 with keeper. In all scenarios, the left team's agents cooperate to score a goal and the right team's agents try to defend them. The first scenario is trained for 300M environment samples and the last two scenarios are trained for 400M samples. Table 1 lists the approximate ex- ploitabilities of different methods' policies over three seeds, and SACL achieves the lowest exploitability. Additional cross-play results and discussions can be found in Appendix . Hide-and-seek environment. HnS is a challenging zero- sum game with known NE policies, which makes it possible for us to directly evaluate the number of samples used for NE convergence. We consider the quadrant scenario where there is a room with a door in the lower right corner. Two hiders, one box, and one ramp are spawned uniformly in the environment, and one seeker is spawned uniformly outside the room. Both the box and the ramp can be moved and locked by agents. The hiders aim to avoid the lines of sight from the seeker while the seeker aims to find the hiders. There is a total of four stages of emergent stages in HnS, i.e., Running and Chasing, Fort Building, Ramp Use, and Ramp Defense. As shown in Fig. 4(c), SACL with MAPPO backbone produces all four stages and converges to the NE policy with only 50% the samples of MAPPO with self- play. We also visualize the initial state distribution to show how SACL selects appropriate subgames for agents to learn. Fig. 5(a) depicts the distribution of hiders' position in the Fort Building stage. The probabilities of states with hiders inside the room are much higher than states with hiders outside, making it easier for hiders to learn to build a fort with the box. Similarly, the distribution of the seeker's position in the Ramp Use stage is shown in Fig. 5(b), and the most sampled subgames start from states where the seeker is close to the walls and is likely to use the ramp. Ablation Study We perform ablation studies to examine the effectiveness of the proposed sampling metric and particle-based sampler. All experiments are done in the hard predator-prey scenario of MPE and the results are averaged over three seeds. More abla- tion studies on state buffer size, subgame sample probability, and other hyperparameters can be found in Appendix . Subgame sampling metric. The sampling metric used in SACL follows Eq. (10) which consists of a bias term and a variance term. We compare it with five other metrics including a uniform metric, a bias-only metric, a variance- only metric and a temporal difference (TD) error metric. The last metric uses the TD error |δt| = |rt + γV (st+1) − V (st)| as the weight, which can be regarded as an estimation of value uncertainty. The results are shown in Fig. 5(c) and the sampling metric used by SACL outperforms both the bias-only metric and variance-only metric. State generator. We substitute the particle-based sam- pler with other state generators including using GAN from the work (Dendorfer, Osep, and Leal-Taixé 2020) and us- ing GMM from the work (Portelas et al. 2020). We also 01234samples1e71234approximate exploitability1e3SACLSPFSPPSRONeuRD01234samples1e7234approximate exploitability1e3SACLSPFSPPSRONeuRDRunningFort BuildingRamp UseRamp Defense0.00.20.40.60.81.0samples1e100.37B1.16B1.63B4.69B0.71B2.62B3.25B9.78BSACLMAPPO (a) Fort Building. (b) Ramp Use. (c) Ablation on metric. (d) Ablation on generator. Figure 5: Visualization of the state distributions in HnS (a-b) and ablation studies (c-d). replace the FPS buffer update method with a uniform one that randomly keeps states and a greedy one that keeps states with the highest weights. Results in Fig. 5(c) show that our particle-based sampler with FPS update leads to the fastest convergence and lowest exploitability. Related Work A large number of works achieve faster convergence in zero- sum games by playing against an increasingly stronger policy. The most popular methods are self-play and its variants (Hein- rich and Silver 2016; Bai, Jin, and Yu 2020; Jin et al. 2021; Perolat et al. 2022). Self-play creates a natural curriculum and leads to emergent complex skills and behaviors (Bansal et al. 2018; Baker et al. 2020). Population-based training like double oracle (McMahan, Gordon, and Blum 2003) and policy-space response oracles (PSRO) (Lanctot et al. 2017) extend self-play by training a pool of policies. Some follow- up works further accelerate training by constructing a smart mixing strategy over the policy pool according to the policy landscape (Balduzzi et al. 2019; Perez-Nieves et al. 2021; Liu et al. 2021; Feng et al. 2021). (McAleer et al. 2021) extends PSRO to extensive-form games by building policy mixtures at all states rather than only the initial states, but it still directly solves the full game starting from some fixed states. In addition to policy-level curriculum learning methods, other works to accelerate training in zero-sum games usually adopt heuristics and domain knowledge like the number of agents (Long et al. 2020; Wang et al. 2020b) or environment specifications (Berner et al. 2019; Serrino et al. 2019; Tang et al. 2021). By contrast, our method automatically generates a curriculum over subgames without domain knowledge and only requires the environments can be reset to desired states. Subgame-solving technique (Brown and Sandholm 2017) is also used in online strategy refinement to improve the blueprint strategy of a simplified abstract game. Another closely related work to our method is (Chen et al. 2021b) which combines backward induction with policy learning, but this method requires knowledge of the game topology and can only be applied to finite-horizon Markov games. Besides zero-sum games, curriculum learning is also stud- ied in cooperative settings. The problem is often formalized as goal-conditioned RL where the agents need to reach a specific goal in each episode. Curriculum learning methods design or train a smart sampler to generate proper task config- urations or goals that are most suitable for training advances w.r.t. some progression metric (Chen et al. 2016; Florensa et al. 2017, 2018; Racaniere et al. 2019; Matiisen et al. 2019; Portelas et al. 2020; Dendorfer, Osep, and Leal-Taixé 2020). Such a metric typically relies on an explicit signal, such as the goal-reaching reward, success rates, or the expected value of the testing tasks. However, in the setting of zero- sum games, these explicit progression metrics become no longer valid since the value associated with a Nash equilib- rium can be arbitrary. A possible implicit metric is value disagreement (Zhang, Abbeel, and Pinto 2020) used in goal- reaching tasks, which can be regarded as the variance term in our metric. By adding a bias term, our metric approximates the squared distance to NE values and gives better results in ablation studies. Our work adopts a non-parametric subgame sampler which is fast to learn and naturally multi-modal, instead of train- ing an expensive deep generative model like GAN (Florensa et al. 2018). Such an idea has been recently popularized in the literature. Some representative samplers are Gaussian mixture model (Warde-Farley et al. 2019), Stein variational inference (Chen et al. 2021a), Gaussian process (Mehta et al. 2020), or simply evolutionary computation (Wang et al. 2019, 2020a). Technically, our method is also related to priori- tized experience replay (Schaul et al. 2015; Florensa et al. 2017; Li et al. 2022) with the difference that we maintain a buffer (Warde-Farley et al. 2019) to approximate the uniform distribution over the state space. Conclusion We present SACL, a general algorithm for accelerating MARL training in zero-sum Markov games based on the subgame curriculum learning framework. We propose to use the approximate squared distance to NE values as the sam- pling metric and use a particle-based sampler for subgames generation. Instead of starting from the fixed initial states, RL agents trained with SACL can practice more on subgames that are most suitable for the current policy to learn, thus boosting training efficiency. We report appealing experiment results that SACL efficiently discovers all emergent strate- gies in the challenging hide-and-seek environment and uses only half the samples of MAPPO with self-play. We hope SACL can be helpful to speed up prototype development and help make MARL training on complex zero-sum games more affordable to the community. 01234samples1e71234approximate exploitability1e3SACLuniformbias-onlyvariance-onlyTD error01234samples1e71234approximate exploitability1e3SACLrandomgreedyGANGMM References Bai, Y.; Jin, C.; and Yu, T. 2020. Near-optimal reinforce- ment learning with self-play. Advances in neural information processing systems, 33: 2159–2170. Baker, B.; Kanitscheider, I.; Markov, T.; Wu, Y.; Powell, G.; McGrew, B.; and Mordatch, I. 2020. Emergent Tool Use From Multi-Agent Autocurricula. In International Confer- ence on Learning Representations. Balduzzi, D.; Garnelo, M.; Bachrach, Y.; Czarnecki, W.; Per- olat, J.; Jaderberg, M.; and Graepel, T. 2019. Open-ended In International learning in symmetric zero-sum games. Conference on Machine Learning, 434–443. PMLR. Bansal, T.; Pachocki, J.; Sidor, S.; Sutskever, I.; and Mor- datch, I. 2018. Emergent Complexity via Multi-Agent Com- petition. In International Conference on Learning Represen- tations. Berner, C.; Brockman, G.; Chan, B.; Cheung, V.; Debiak, P.; Dennison, C.; Farhi, D.; Fischer, Q.; Hashme, S.; Hesse, C.; et al. 2019. Dota 2 with large scale deep reinforcement learning. arXiv preprint arXiv:1912.06680. Brown, N.; Lerer, A.; Gross, S.; and Sandholm, T. 2019. Deep counterfactual regret minimization. In International conference on machine learning, 793–802. PMLR. Brown, N.; and Sandholm, T. 2017. Safe and nested subgame solving for imperfect-information games. Advances in neural information processing systems, 30. Burch, N.; Johanson, M.; and Bowling, M. 2014. Solving imperfect information games using decomposition. In Pro- ceedings of the AAAI Conference on Artificial Intelligence, volume 28. Chen, J.; Zhang, Y.; Xu, Y.; Ma, H.; Yang, H.; Song, J.; Wang, Y.; and Wu, Y. 2021a. Variational Automatic Curriculum Learning for Sparse-Reward Cooperative Multi-Agent Prob- lems. Advances in Neural Information Processing Systems, 34: 9681–9693. Chen, W.; Zhou, Z.; Wu, Y.; and Fang, F. 2021b. Temporal Induced Self-Play for Stochastic Bayesian Games. arXiv preprint arXiv:2108.09444. Chen, X.; Kingma, D. P.; Salimans, T.; Duan, Y.; Dhariwal, P.; Schulman, J.; Sutskever, I.; and Abbeel, P. 2016. Variational Lossy Autoencoder. arXiv preprint arXiv:1611.02731. Dendorfer, P.; Osep, A.; and Leal-Taixé, L. 2020. Goal-gan: Multimodal trajectory prediction based on goal position esti- mation. In Proceedings of the Asian Conference on Computer Vision. Feng, X.; Slumbers, O.; Wan, Z.; Liu, B.; McAleer, S.; Wen, Y.; Wang, J.; and Yang, Y. 2021. Neural auto-curricula in two-player zero-sum games. Advances in Neural Information Processing Systems, 34: 3504–3517. Florensa, C.; Held, D.; Geng, X.; and Abbeel, P. 2018. Auto- matic goal generation for reinforcement learning agents. In International conference on machine learning, 1515–1528. PMLR. Florensa, C.; Held, D.; Wulfmeier, M.; Zhang, M.; and Abbeel, P. 2017. Reverse curriculum generation for reinforce- ment learning. In Conference on robot learning, 482–495. PMLR. Freund, Y.; and Schapire, R. E. 1996. Game theory, on-line prediction and boosting. In Proceedings of the ninth annual conference on Computational learning theory, 325–332. Gruslys, A.; Lanctot, M.; Munos, R.; Timbers, F.; Schmid, M.; Perolat, J.; Morrill, D.; Zambaldi, V.; Lespiau, J.-B.; Schultz, J.; et al. 2020. The advantage regret-matching actor- critic. arXiv preprint arXiv:2008.12234. Heinrich, J.; Lanctot, M.; and Silver, D. 2015. Fictitious self- play in extensive-form games. In International conference on machine learning, 805–813. PMLR. Heinrich, J.; and Silver, D. 2016. Deep reinforcement learn- ing from self-play in imperfect-information games. arXiv preprint arXiv:1603.01121. Hennes, D.; Morrill, D.; Omidshafiei, S.; Munos, R.; Pero- lat, J.; Lanctot, M.; Gruslys, A.; Lespiau, J.-B.; Parmas, P.; Duéñez-Guzmán, E.; et al. 2020. Neural replicator dynamics: Multiagent learning via hedging policy gradients. In Proceed- ings of the 19th International Conference on Autonomous Agents and MultiAgent Systems, 492–501. Jaderberg, M.; Czarnecki, W. M.; Dunning, I.; Marris, L.; Lever, G.; Castaneda, A. G.; Beattie, C.; Rabinowitz, N. C.; Morcos, A. S.; Ruderman, A.; Sonnerat, N.; Green, T.; Dea- son, L.; Leibo, J. Z.; Silver, D.; Hassabis, D.; Kavukcuoglu, K.; and Graepel, T. 2018. Human-level performance in first- person multiplayer games with population-based deep rein- forcement learning. arXiv preprint arXiv:1807.01281. Jin, C.; Liu, Q.; Wang, Y.; and Yu, T. 2021. V-Learning–A Simple, Efficient, Decentralized Algorithm for Multiagent RL. arXiv preprint arXiv:2110.14555. Kurach, K.; Raichuk, A.; Sta ́nczyk, P.; Zaj ̨ac, M.; Bachem, O.; Espeholt, L.; Riquelme, C.; Vincent, D.; Michalski, M.; Bousquet, O.; et al. 2020. Google research football: A novel reinforcement learning environment. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, 4501– 4510. Lanctot, M.; Zambaldi, V.; Gruslys, A.; Lazaridou, A.; Tuyls, K.; Pérolat, J.; Silver, D.; and Graepel, T. 2017. A unified game-theoretic approach to multiagent reinforcement learn- ing. Advances in neural information processing systems, 30. Li, Y.; Kong, T.; Li, L.; and Wu, Y. 2022. Learning Design and Construction with Varying-Sized Materials via Priori- tized Memory Resets. In 2022 International Conference on Robotics and Automation (ICRA), 7469–7476. Littman, M. L. 1994. Markov games as a framework for multi- agent reinforcement learning. In Proceedings of the eleventh international conference on machine learning, volume 157, 157–163. Liu, X.; Jia, H.; Wen, Y.; Hu, Y.; Chen, Y.; Fan, C.; Hu, Z.; and Yang, Y. 2021. Towards Unifying Behavioral and Response Diversity for Open-ended Learning in Zero-sum Games. Advances in Neural Information Processing Systems, 34: 941–952. Long, Q.; Zhou, Z.; Gupta, A.; Fang, F.; Wu, Y.; and Wang, X. 2020. Evolutionary Population Curriculum for Scaling Multi- Agent Reinforcement Learning. In International Conference on Learning Representations. Lowe, R.; Wu, Y.; Tamar, A.; Harb, J.; Abbeel, P.; and Mor- datch, I. 2017. Multi-agent actor-critic for mixed cooperative- competitive environments. In Proceedings of the 31st In- ternational Conference on Neural Information Processing Systems. Matiisen, T.; Oliver, A.; Cohen, T.; and Schulman, J. 2019. Teacher-student curriculum learning. IEEE transactions on neural networks and learning systems. McAleer, S.; Lanier, J. B.; Wang, K. A.; Baldi, P.; and Fox, R. 2021. XDO: A double oracle algorithm for extensive-form games. Advances in Neural Information Processing Systems, 34: 23128–23139. McMahan, H. B.; Gordon, G. J.; and Blum, A. 2003. Plan- ning in the presence of cost functions controlled by an adver- sary. In Proceedings of the 20th International Conference on Machine Learning (ICML-03), 536–543. Mehta, B.; Diaz, M.; Golemo, F.; Pal, C. J.; and Paull, L. 2020. Active domain randomization. In Conference on Robot Learning, 1162–1176. PMLR. Moravcik, M.; Schmid, M.; Ha, K.; Hladik, M.; and Gaukrodger, S. 2016. Refining subgames in large imperfect information games. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 30. Perez-Nieves, N.; Yang, Y.; Slumbers, O.; Mguni, D. H.; Wen, Y.; and Wang, J. 2021. Modelling behavioural diversity for learning in open-ended games. In International Conference on Machine Learning, 8514–8524. PMLR. Perolat, J.; de Vylder, B.; Hennes, D.; Tarassov, E.; Strub, F.; de Boer, V.; Muller, P.; Connor, J. T.; Burch, N.; Anthony, T.; et al. 2022. Mastering the Game of Stratego with Model- Free Multiagent Reinforcement Learning. arXiv preprint arXiv:2206.15378. Portelas, R.; Colas, C.; Hofmann, K.; and Oudeyer, P.-Y. 2020. Teacher algorithms for curriculum learning of deep rl in continuously parameterized environments. In Conference on Robot Learning, 835–853. PMLR. Qi, C. R.; Yi, L.; Su, H.; and Guibas, L. J. 2017. PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space. Advances in Neural Information Processing Systems, 30. Racaniere, S.; Lampinen, A. K.; Santoro, A.; Reichert, D. P.; Firoiu, V.; and Lillicrap, T. P. 2019. Automated curricula through setter-solver interactions. arXiv preprint arXiv:1909.12892. Schaul, T.; Quan, J.; Antonoglou, I.; and Silver, D. 2015. Pri- oritized experience replay. arXiv preprint arXiv:1511.05952. Schulman, J.; Wolski, F.; Dhariwal, P.; Radford, A.; and Klimov, O. 2017. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347. Serrino, J.; Kleiman-Weiner, M.; Parkes, D. C.; and Tenen- baum, J. 2019. Finding friend and foe in multi-agent games. Advances in Neural Information Processing Systems, 32. Silver, D.; Huang, A.; Maddison, C. J.; Guez, A.; Sifre, L.; Van Den Driessche, G.; Schrittwieser, J.; Antonoglou, I.; Panneershelvam, V.; Lanctot, M.; et al. 2016. Mastering the game of Go with deep neural networks and tree search. nature, 529(7587): 484. Steinberger, E.; Lerer, A.; and Brown, N. 2020. DREAM: Deep regret minimization with advantage baselines and model-free learning. arXiv preprint arXiv:2006.10410. Szepesvári, C.; and Littman, M. L. 1999. A unified analysis of value-function-based reinforcement-learning algorithms. Neural computation, 11(8): 2017–2060. Tang, Z.; Yu, C.; Chen, B.; Xu, H.; Wang, X.; Fang, F.; Du, S.; Wang, Y.; and Wu, Y. 2021. Discovering diverse multi-agent strategic behavior via reward randomization. arXiv preprint arXiv:2103.04564. Tesauro, G.; et al. 1995. Temporal difference learning and TD-Gammon. Communications of the ACM, 38(3): 58–68. Vinyals, O.; Babuschkin, I.; Czarnecki, W. M.; Mathieu, M.; Dudzik, A.; Chung, J.; Choi, D. H.; Powell, R.; Ewalds, T.; Georgiev, P.; et al. 2019. Grandmaster level in StarCraft II using multi-agent reinforcement learning. Nature, 575(7782): 350–354. Wang, R.; Lehman, J.; Clune, J.; and Stanley, K. O. 2019. Poet: open-ended coevolution of environments and their opti- mized solutions. In Proceedings of the Genetic and Evolu- tionary Computation Conference, 142–151. Wang, R.; Lehman, J.; Rawal, A.; Zhi, J.; Li, Y.; Clune, J.; and Stanley, K. 2020a. Enhanced POET: Open-ended rein- forcement learning through unbounded invention of learning challenges and their solutions. In International Conference on Machine Learning, 9940–9951. PMLR. Wang, W.; Yang, T.; Liu, Y.; Hao, J.; Hao, X.; Hu, Y.; Chen, Y.; Fan, C.; and Gao, Y. 2020b. From few to more: Large- scale dynamic multiagent curriculum learning. In Proceed- ings of the AAAI Conference on Artificial Intelligence, vol- ume 34, 7293–7300. Warde-Farley, D.; de Wiele, T. V.; Kulkarni, T.; Ionescu, C.; Hansen, S.; and Mnih, V. 2019. Unsupervised Control Through Non-Parametric Discriminative Rewards. In Inter- national Conference on Learning Representations. Watkins, C. J.; and Dayan, P. 1992. Q-learning. Machine learning, 8(3): 279–292. Yu, C.; Velu, A.; Vinitsky, E.; Wang, Y.; Bayen, A.; and Wu, Y. 2021. The surprising effectiveness of ppo in cooperative, multi-agent games. arXiv preprint arXiv:2103.01955. Zhang, B.; and Sandholm, T. 2021. Subgame solving with- out common knowledge. Advances in Neural Information Processing Systems, 34: 23993–24004. Zhang, Y.; Abbeel, P.; and Pinto, L. 2020. Automatic cur- riculum learning through value disagreement. Advances in Neural Information Processing Systems, 33: 7648–7659. Zinkevich, M.; Johanson, M.; Bowling, M.; and Piccione, C. 2007. Regret minimization in games with incomplete information. Advances in neural information processing systems, 20. Analysis and Proofs Detailed Analysis of the Motivating Example We first show that the full state space of RP S(n) can be covered within O(n) samples by using a state buffer and resetting games to the newly visited states. We start with an empty state buffer, and the game resets according to its initial state distribution ρ(*), which always resets the game to s0. With a random exploration policy, the probability for the game to transit from s0 to s1 is 1/3. Therefore, the number of samples required to visit state s1 in expectation is E[n(s1)] = 3. After s1 is visited, this new state will be stored in the state buffer. Since we select the newly visited states as the initial state, the game will be reset to state s1 and the additional number of samples required to visit state s2 in expectation is also E[n(s2)] = 3. In general, by starting from state sk−1, the expected number of samples to visit state sk is E[n(sk)] = 3, k = 1, 2, * * * , n − 1. Therefore, the total number of samples required to cover the full state space is (cid:80)n−1 E[n(sk)] = k=1 3(n − 1), which is O(n). Given that the state buffer has covered the entire state space, we then show that the NE Q-value of RP S(n) can be learned by solving subgames with minimax-Q backward from RSP (1) to RP S(n). Consider using minimax-Q to solve RP S(1), we can set the learning rate α = 1 since the transi- tion is deterministic, and the NE Q-value of a state-action pair (s, a) can be learned when this pair is in the collected samples. Therefore, to learn the NE Q-values of RP S(1), we have to collect all state-action pairs at least one time. With a random exploration policy, the number of samples required to cover all state-action pairs is (cid:80)9 i=1 9/i = 25.46 < 26. Therefore, the NE Q-values of RP S(1) can be learned within 26 sam- ples in expectation. Given that the NE Q-values of RP S(k) are learned, the NE Q-values of RP S(k + 1) are only wrong at the first state, and can be learned within 26 episodes in ex- pectation. Note that the expected episode length of RP S(∞) is 1.5, so the expected episode length of RP S(k) is less than 1.5. Consider the episode used to learn the NE Q-values of the first state of RP S(k +1), either P1 wins and the expected episode length is less than 1 + 1.5 = 2.5, or P1 draws or loses and the episode length is 1. In both cases, the episode length is less than 2.5, so the number of samples used is less than 26 ∗ 2.5 = 65. Therefore, the total number of samples used to learn the NE Q-values from RP S(1) to RP S(n) is less than 65(n − 1), which is O(n). Since it takes O(n) samples to cover the entire state space and O(n) samples to learn the NE Q-values from RP S(1) to RP S(n), the total number of samples is still O(n). Proof of Proposition 1 Proposition 1. If all initial states s0 with ρ(s0) > 0 are sampled infinitely often, and the backbone MARL algorithm is guaranteed to converge to an NE in zero-sum Markov games, then subgame curriculum learning also produces an NE of the original Markov game. proposed states, including all initial states s0 with ρ(s0) > 0. Therefore, it is an NE of the original Markov game. Detailed Analysis of the State Sampling Metric We approximate the squared difference between the current value and the NE value by Eq. (10), i.e. w(s) = Ei (cid:2)(V ∗ ≈ α * Ei 1 (s) − ̃Vi(s))2(cid:3) (cid:2) ̃V (t) (s) − ̃V (t−1) i i (s)(cid:3)2 + Vari (cid:2) ̃Vi(s)(cid:3). The first term in Eq. (10) uses a hyperparameter α and the difference between two consecutive value function check- points to estimate the difference between the current value and the NE value. As shown in Fig. 6, when the value func- tion changes monotonically throughout training, the estimate can be regarded as a first-order approximation of the bias term. However, the value function of zero-sum games may oscillate up and down in different emergent stages (like in hide-and-seek) as shown in Fig. 7. In this case, the difference between two value function checkpoints is no longer an ap- proximation of the distance to the NE value, but a first-order approximation of the difference between the current value and the next local minimal or local maximal value V (∗,k) , and the weight becomes the approximated squared difference between the current value and the next local optimal value, i.e., 1 i w(s) = α * Ei ≈ Ei = Ei (cid:2) ̃V (t) (cid:2)V (∗,k) (cid:2)(V (∗,k) (s) − ̃V (t−1) i (s) − ̃Vi(s)(cid:3)2 (s) − ̃Vi(s))2(cid:3). 1 1 (s)(cid:3)2 + Vari + Vari (cid:2)V (∗,k) 1 (cid:2) ̃Vi(s)(cid:3) (s) − ̃Vi(s)(cid:3) (11) Therefore, by using the weight in Eq. (10), we are not directly prioritizing states where the values are far from the NE values, but prioritizing states where the values are far from the next local optimal value. For example, in Fig. 7, before the value function has learned the first local maximal value V (∗,1) , we will give larger weights to states that are far from the V (∗,1) to accelerate the first stage of learning V (∗,1) is successfully learned, we will then prioritize states that are far from the second local optimal value V (∗,1) and accelerated the second stage of learning V (∗,2) . Finally, we learn towards the NE value V (∗,3) 1 . By accelerating the learning in each stage, we make the NE learning process more efficient in total. 1 . After V (∗,1) = V ∗ 1 1 1 1 1 2 It is also possible to train an ensemble of value func- tions for each player to improve the estimation. Suppose we train M value functions for player i and denote them as { ̃Vi,m}M m=1 for i = 1, 2, then the weight for state s becomes w(s) = α * Ei,m (cid:2) ̃V (t) i,m(s) − ̃V (t−1) i,m (s)(cid:3)2 + Vari,m (cid:2) ̃Vi,m(s)(cid:3), (12) Proof. When the policy trained by subgame curriculum learn- ing converges, it is an NE of all subgames induced by the where the expectation and variance are taken over both the player index i and the ensemble index m. Figure 6: Approximation of the bias term when value func- tion changes monotonically. Figure 8: Illustration of the default and hard setting of predator-prey in MPE. Implementation Details Implementation of Farthest Point Sampling In the subgame sampler, we use a state buffer to approxi- mate the whole state space and record the state weights. In principle, the states in the buffer should span the entire state space and distribute uniformly, but the rollout data is usually concentrated and very similar to each other. Therefore, we need to select states that are sufficiently far from each other to ensure good coverage of the state space. Formally, we need to select a subset S′ of size K from the full set S, so that the sum of the shortest distances between states in the subset S′ is maximized, i.e., maxS′⊂S,|S′|=KΣs∈S′mins′∈S′|s − s′|. And farthest point sampling is a greedy algorithm that effi- ciently finds an approximate optimal solution to this problem. In general, FPS iteratively selects the farthest point from the current set of points. The distance between two states is simply the Euclidean distance. The distance between a state sa and a set of states S is the smallest distance between sa and any state in S, i.e., mins∈S|sa − s|. For implementation, we first normalize each dimension of the state vector to make all values lie in the range [0, 1]. Then we directly use the far- thest_point_sampler() function from the Deep Gragh Library to utilize GPUs for fast and stable results. Training Details Multi-Agent Particle Environment. The default and hard setting of the predator-prey scenario in MPE are shown in Fig. 8. The environment is a 2D square space and the length of a side is 4, i.e., {(x, y)| − 2 ≤ x ≤ 2, −2 ≤ y ≤ 2}. 3 predators (red) cooperatively chase 1 prey (blue) and there are 2 obstacles in the space. In the default setting, all agents and obstacles are randomly spawned. In the hard setting, predators are uniformly spawned in the top-right corner, i.e., {(x, y)|1 ≤ x ≤ 2, 1 ≤ y ≤ 2}, the prey is spawned in the bottom-left corner, i.e., {(x, y)| − 2 ≤ x ≤ −1, −2 ≤ y ≤ −1}, and the obstacles are still randomly generated in the square. This environment is fully observable, and the state of each agent is a concatenation of the positions and the velocities of all agents and the positions of all obstacles. The action Figure 7: Approximation in different stages when value func- tion oscillates in training. Difference of SACL and subgame solving method for extensive-form games First, we would like to emphasize that the goal of this work is to accelerate learning in complex fully-observable Markov games. In our experiments, the learning agents do not know the transition of the games, following the standard assump- tion in reinforcement learning. For extensive-form games, such as poker, there has been extensive literature on how to construct and solve a sub- game (Zhang and Sandholm 2021) (Brown and Sandholm 2017) (Burch, Johanson, and Bowling 2014) (Moravcik et al. 2016). The idea of subgame solving is to first get a blueprint strategy of the abstracted game and use it to play the original game. As the game progresses and the remaining game be- comes tractable, the specific subgame is solved in real-time to create a combined final policy. Subgame solving typically uses iterative updates based on regret matching to find the policy, which requires the traverse of the game tree. estimated differencetrue differencepredatorpreyobstacledefaulthard Length Information Hyperparameters 22 22 22 22 3 3 3 11 7 (x,y) coordinates of left team players (x,y) direction of left team players (x,y) coordinates of right team players (x,y) direction of right team players (x, y and z) ball position ball direction one hot encoding of ball ownership (none, left, right) one hot encoding of which player is active one hot encoding of game mode Table 4: Information in the state vector of GRF. space is discrete with 5 actions: idle, up, down, left, right. The environment lasts for 200 steps. In each step, if any predator collides with the prey, all predators get a reward of +1 and the prey gets a reward of −1. The actor and critic networks use the transformer architec- ture. The inputs first pass through a LayerNorm layer. The normalized states are divided into different entities including self, other agents, obstacles, and time, then each entity passes through fully connected layers to get its embedding. The weights of the embedding layers are shared within entities of the same type. Then the embedding of each entity is concate- nated with the self states and passed through a self-attention network. Then we average the output of the attention block and concatenate it with the self-embedding to get the final representation. This representation is then passed through a LayerNorm layer and an MLP layer and then produces the value through a critic head and the action through an actor head. All hyperparameters for training are listed in Table 2. Google Research Football. The environment is a physics- based 3D football simulation and the length and width are 2.0 and 0.9, i.e., {(x, y)| − 1.0 ≤ x ≤ 1.0, −0.45 ≤ y ≤ 0.45}. The pass and shoot scenario in GRF is shown in Fig. 9. There are five players and a soccer ball in the environment, with a scripted goalkeeper and two RL attackers on the left side and a scripted goalkeeper and one RL defender on the right side. The left goalkeeper is spawned at (−1.0, 0.0) and the two attackers are spawned at (0.7, 0.0) and (0.7, −0.3). The right goalkeeper is spawned at (1.0, 0.0) and the defender is spawned at (0.75, −0.3). The ball is spawned at (0.7, −0.28). The run, pass and shoot scenario in GRF is shown in Fig. 10. There are five players and a soccer ball in the environment, with a scripted goalkeeper and two RL attackers on the left side and a scripted goalkeeper and one RL defender on the right side. The left goalkeeper is spawned at (−1.0, 0.0) and the two attackers are spawned at (0.7, 0.0) and (0.7, −0.3). The right goalkeeper is spawned at (1.0, 0.0) and the de- fender is spawned at (0.75, −0.1). The ball is spawned at (0.7, −0.28). The 3 vs 1 with keeper scenario in GRF is shown in Fig. 11. There are six players and a soccer ball in the environment, with a scripted goalkeeper and three RL at- tackers on the left side and a scripted goalkeeper and one RL defender on the right side. The left goalkeeper is spawned at (−1.0, 0.0) and the three attackers are spawned at (0.6, 0.0), Learning rate Discount rate (γ) GAE parameter (λGAE) Gradient clipping Adam stepsize Value loss coefficient Entropy coefficient Parallel threads PPO clipping PPO epochs Size of embedding layer Size of MLP layer Size of LSTM layer Residual attention layer probability p Ensemble size M Capacity K Weight of the value difference α Value 5e-4 0.99 0.95 10.0 1e-5 1 0.01 100 0.2 5 32 64 64 8 0.7 3 10000 0.7 Table 2: Hyperparameters of MPE. Hyperparameters Learning rate Discount rate (γ) GAE parameter (λGAE) Gradient clipping Adam stepsize Value loss coefficient Entropy coefficient Parallel threads PPO clipping PPO epochs Size of MLP layer probability p Ensemble size M Capacity K Weight of the value difference α Value 5e-4 0.99 0.95 10.0 1e-5 1 0.01 200 0.2 10 64 0.7 3 10000 0.7 Table 3: Hyperparameters of GRF. (0.7, 0.2) and (0.7, −0.2). The right goalkeeper is spawned at (1.0, 0.0) and the defender is spawned at (0.75, 0.0). The ball is spawned at (0.6, 0.0). In all three environments, attackers have to learn how to dribble the ball, cooperate with team- mates to pass the ball, and overcome the defender's defense to score goals. The environment is fully observable, and the state of each agent is a 115-dimensional vector, including the coordinates of left team players, the directions of left team players, the coordinates of right team players, the directions of right team players, the ball position, the ball direction, one hot encod- ing of ball ownership, one hot encoding of which player is active and one hot encoding of game mode. The detailed information is listed in Table 4. The action space is discrete with 19 actions: idle, left, top left, top, top right, right, bot- tom right, bottom, bottom left, long pass, high pass, short pass, shoot, start sprinting, reset current movement direction, stop sprinting, slide, start dribbling and stop dribbling. An episode lasts a maximum of 200 steps. The environment ends prematurely when one side scores, the possession of the ball changes, or the game is out of play. We use the standard scoring and checkpoint rewards provided by the football en- gine. Specifically, if the left team scores a goal in each step, all left players get a reward of +1 and the right player gets -1. There are also 10 concentric circles with the goal in the center, called checkpoint regions. The left team obtains an additional checkpoint reward of +0.1 when they possess the ball and first move into the next checkpoint region, and the right team gets -0.1. Checkpoint rewards are only given once per episode. The inputs of the actor and critic networks first pass through a LayerNorm layer. The normalized states then pass through an MLP layer and then produce the value through a critic head and the action through an actor head. All hyperpa- rameters for training are listed in Table 3. Hide-and-seek Environment. The quadrant scenario in the hide-and-seek environment is shown in Fig. 12. The environment is a square space with a square room with a door in the bottom-right corner. There are 2 hiders (green), 1 seeker (red), 1 box, and 1 ramp. At the beginning of each episode, the hiders, box, and ramp are uniformly spawned inside the room, and the seeker is uniformly spawned outside the room. The environment is fully observable and the state of each agent is a concatenation of the positions and velocities of all agents, the positions, velocities, and lock flags of the box and the ramp, and the current timestep. The action space is discrete and agents can choose to move in 4 directions, grab, and lock/unlock. Each episode lasts for 80 steps and is divided into 2 phases: the preparation phase and the main phase. In the preparation phase, the seeker is fixed and only the hiders can act to prepare for the main phase. No reward is given to any agent in the preparation phase. In the main phase, all agents can act and the seeker tries to find the hiders and the hiders try to avoid being discovered. When the hiders are spotted by the seeker, the seeker gets a reward of +1 at this step and the hiders get a reward of −1. Otherwise, the seeker gets a reward of −1 and the hiders get +1. There are a total of 4 emergent stages in this game, as shown in Fig. 13. (1) Running and Chasing: The hiders learn to run away from the seeker to avoid detection, while the seeker learns to chase the hiders. The seeker is the winner at this stage and the average episode reward of hiders is about −20. (2) Fort Building: In the preparation phase, the hiders learn to use the box to block the door and lock it in place to build a fort so that the seeker cannot enter the room and see the hider. The hiders are the winner in this stage, and the average episode reward of hiders is about 30. (3) Ramp Use: The seeker learns to move the ramp to the wall of the room and use it to get into the room. The average episode reward of hiders reduces to about 25 but is still larger than 0. (4) Ramp Defense: In the preparation phase, the hiders learn to move the ramp into the room or push it far away from the wall and lock it to prevent being used by the seeker. The seeker can no longer enter the room and find the hiders. The average Hyper-parameters Learning rate Discount rate (γ) GAE parameter (λGAE) Gradient clipping Adam stepsize Value loss coefficient Entropy coefficient PPO clipping Chunk length PPO epochs Horizon Mini-batch size Size of embedding layer Size of MLP layer Size of LSTM layer Residual attention layer Weight decay coefficient probability p Ensemble size M Capacity K Weight of the value difference α Value 3e-4 0.998 0.95 5.0 1e-5 1 0.01 0.2 10 4 80 64000 128 256 256 32 10−6 0.7 3 10000 1.0 Table 5: Hyperparameters of HnS. episode reward of hiders is about 40 at this stage. We adopt the same network architecture as (Baker et al. 2020). The states are divided into different entities including self, other agents, box, and ramp, then each entity passes through fully connected layers to get its embedding. The weights of the embedding layers are shared within entities of the same type. Then the embedding of each entity is con- catenated with the self embedding and passed through a self- attention network. Then we average the output of the attention block and concatenate it with the self-embedding to get the fi- nal representation. This representation is then passed through an MLP layer and a LSTM layer and then produces the value through a critic head and the action through an actor head. All hyperparameters of HnS are listed in Table 5. Besides zero-sum games, it is also possible to use SACL in cooperative tasks. We choose the Ramp Use stage in HnS to show that SACL can produce comparable results to curriculum learning algorithms specialized for coopera- tive tasks (Chen et al. 2021a). In this task, there is 1 hider with fixed policy, 1 seeker to train, 1 box and 1 ramp. We need to train a seeker policy to use the ramp to get into the quadrant room for positive rewards. The environment is fully observable and the state is the same as that in the quadrant scenario. We use the same prior knowledge to define easy tasks as (Chen et al. 2021a), which prioritizes states where the ramp is right next to the wall and agents are next to the ramp. All hyperparameters are listed in Table 6. Evaluation Details Exploitability. In zero-sum games, because the performance of one player's policy depends on the other player's policy, the return curve throughout training is no longer a good eval- Figure 9: Pass and shoot scenario in GRF. Figure 10: Run, pass and shoot sce- nario in GRF. Figure 11: 3 vs 1 with keeper scenario in GRF. Hyperparameters Value Learning rate Discount rate (γ) GAE parameter (λGAE) Gradient clipping Adam stepsize Value loss coefficient Entropy coefficient PPO clipping chunk length PPO epochs Horizon Parallel threads probability p Ensemble size M Capacity K 5e-4 0.99 0.95 20.0 1e-5 1 0.01 0.2 10 15 60 300 0.7 3 2000 Table 6: Hyperparameters of the cooperative task in HnS more seeds and average the results and plot the std error. For a single algorithm, we trained 9×3 = 27 (checkpoints × seeds) best-response policies to plot one curve in the exploitability graph. Cross-play. We evaluate SACL and other baselines by cross-play, which uses a head-to-head match between any two policies and records the results in a payoff matrix. In MPE, the element of the payoff matrix represents the episodic reward of the predators, and in GRF, represents the win rate of the red team. More specifically, we train 3 seeds for each algorithm and match three models of one algorithm against the three models of the opponent algorithm, i.e., we get 3 × 3 = 9 competitions between any two algorithms and report the average results and the std error. For example, in MPE, we use three different predators of SACL to compete with three different preys of SP to get the episode predator reward. We can evaluate the performance of the predator using the elements of a row and evaluate the performance of the prey using the elements of a column. We use the first row to represent the predator of SACL, then a larger value in this row than other rows means that the predator of SACL is better than other algorithms. We use the first column to represent Figure 12: Quadrant scenario in HnS. uation method. One way to compare the performance of dif- ferent policies is to use cross-play, which uses a tournament- style match between any two policies and records the results in a payoff matrix. However, due to the non-transitivity of many zero-sum games (Balduzzi et al. 2019), winning other policies does not necessarily mean being close to NE poli- cies, so a better way to evaluate the performance of policies is to use exploitability. Given a pair of policies (π1, π2), the exploitability is defined as exploitability(π1, π2) = 2 (cid:88) i=1 max π′ i (cid:104) E V (π′ i i,π−i) (s0) (cid:105) . (13) Exploitability can be roughly interpreted as the "distance" to the joint NE policy. In complex environments like the ones we use, the exact exploitability cannot be calculated because we cannot traverse the policy space to find π′ i that maximizes the value. We compute the approximate exploitability by training an approximate best response ̃π′ i of the fixed policy πi using MAPPO. A BR is trained for 200M samples in MPE and 400M in GRF. The lower the exploitability, the better the algorithm. We use the checkpoints of an algorithm's policy trained with different numbers of environment steps to estimate the exploitability. Specifically, we run SACL in MPE and save a policy checkpoint when the agent has consumed 0M, 5M, 10M, 15M, ..., and 40M environment samples. Then for each checkpoint, we keep it fixed and train an adversarial policy to be the best response of the fixed policy to estimate the exploitability. Then we get an exploitability curve of SACL over samples. Finally, we repeat this procedure for two Figure 13: Sample trajectory traces from each emergent stage in quadrant scenario of HnS. the prey of SACL, then a smaller value in this column than other columns means that the prey of SACL is better than other algorithms. Four rounds of emergent strategies in HnS. As shown in Fig. 14, we use three inflection points to evaluate the sample required to produce the first three stages. More specifically, the Running and Chasing phase ends when the hider's reward decreases to the lowest value of about −20. When the hider's reward begins to increase, the Fort-Building phase begins and continues until the hider's reward reaches a local maximum of about 30. Then the agents move to the Ramp-Defense phase until the hider's reward reaches a local minimum and begins the final Ramp-Use stage. We choose the point when the hider's episode reward reaches 40 as the end of the final stage. Additional Experiment Results Multi-Agent Particle Environment Cross-play. The results of cross-play at 40M in MPE and MPE hard are shown in Fig. 15(a) and Fig. 15(b). In MPE and MPE hard, the predator and prey of SACL beat all baselines. For example, let x be the row x and y be represent the column y of the payoff matrix. We compare the predator of SACL with FSP using rows 1 and 3 and find that the elements of row 1 are larger than the elements of row 3, i.e., the predator of SACL is better than FSP. The elements of column 1 are smaller than the elements of column 3, which means the prey of SACL is better than FSP. The prey trained by SACL Figure 14: Checkpoints of four rounds of emergent strategies in HnS. swerves to avoid the predators when the predators surround him and the predators learn to capture the prey in the two environments. SP is comparable with SACL in MPE, but in the hard setting, SP does not converge to the NE policy due to the large initial distance between predator and prey. We show the initial state distributions of the predator and prey in SP at 40M training steps in Fig. 16. We find that in MPE hard, the initial distance between the prey and the predator is too far. As a result, the prey trained by SP learns little about how to stay away from predators and the predators have hardly learned how to catch the prey. We also visualize RunningandChasingFort BuildingRamp UseRamp DefenseRunning and ChasingRamp UseFort BuildingRamp Defense our algorithm is insensitive to the weight of the value dif- ference α. Empirically, we prefer α less than 1. We finally choose α = 0.7 in MPE, MPE hard and GRF, α = 1.0 in Hns. Buffer update method We further visualize the state dis- tribution in the buffer generated by different update methods in Fig. 18. Fig. 18(a-c) show the heatmaps of the predators' position. Fig. 18(d-f) run PCA on the full state space and show the projection of the states in the buffer to the two- dimensional space. The results show that if we randomly select states or greedily select states with high weights, the states in the buffer can become very concentrated and can't approximate the whole state space. Google Research Football The results of cross-play in pass and shoot, run, pass and shoot and 3 vs 1 with keeper are shown in Fig. 19. In the three scenarios, SACL is comparable to FSP and PSRO, and better than SP and NeuRD. For example, let x be the row x and y be the column y of the payoff matrix. In 3 vs 1 with keeper, the elements of row 1 are larger than the elements of row 2, which means the attackers of SACL are better than SP. The elements of column 1 are comparable with the elements of column 2, i.e., the prey of SACL is comparable with SP. It is worth mentioning that in run, pass and shoot, FSP and PSRO attackers have a higher win rate than SACL against PSRO and NeuRD defenders. This is because PSRO and NeuRD defenders have a bad defensive policy, and FSP and PSRO attackers have their counter policy. However, Table 1 in the main text shows that the exploitability of SACL is lower than others. This is because zero-sum games are non-transitive. For example, in rock-paper-scissors, it doesn't mean that rock is better than paper just because rock beats scissors and scissors beats paper. Thus, a high return against a single policy does not mean that it is close to the NE policy, and the comparable result in cross-play does not contradict with the exploitability result. In general, exploitability is a better measure of policy performance and is used in many papers. We also visualize the behavior of different methods to show that SACL learns more complex policies than others and is closer to the NE policies. For example, in 3 vs 1 with keeper, the NE policy is that the left players shoot from the top, middle, and bottom with equal probability. SACL learns to shoot from the top and the middle, while FSP and PSRO only shoot from the bottom. Hide-and-seek Although SACL is derived for zero-sum games, it is also applicable to more general settings such as goal-conditioned problems. We consider the Ramp-Use task proposed in VACL (Chen et al. 2021a), where the seeker aims to get into the lower-right quadrant (with no door opening) which is only possible by using a ramp. We adopt the same prior knowledge of "easy tasks" used in VACL to initialize the state buffer M and achieve comparable sample efficiency with VACL, one of the strongest ACL algorithms for goal- conditioned RL. The result is shown in Figure 21. (a) MPE. (b) MPE hard. Figure 15: The results of cross-play in MPE and MPE hard. (a) The predator. (b) The prey. Figure 16: Visualization of the state distributions generated by SP in MPE hard. the change of the prey's initial position heatmap produced by SACL in the MPE hard in Fig. 17 and find that it starts from the center and moves to the edges and corners which means that we train from easier subgames and gradually move to harder ones. FSP also performs worse than SACL in the hard setting for the same reason as SP. For PSRO, it is even difficult to obtain the best response corresponding to the prey of random policy in MPE hard because the initial distance between prey and predator is too far. NeuRD performs poorly in both environments because NeuRD's update rules cause drastic policy changes and erratic convergence. Buffer size. As shown in Fig. 20(a), the buffer capacity K must be large enough. When the buffer is too small, the states in the buffer cannot approximate the state space. When the buffer is too large, FPS consumes much time. So we finally choose K = 10000. Subgame sample probability. As shown in Fig. 20(b), we need more samples from the subgame buffer than uniform sampling in the training batch, and uniform sampling from the state space ensures global exploration. When p is too small, SACL degenerates into SP, resulting in poor perfor- mance. When p = 1, the lack of global exploration also leads to poor performance. Finally we choose p = 0.7. Ensemble size. As shown in Fig. 20(c), we can train an ensemble of value functions for each player to improve the estimation. Excessive ensemble size requires much memory and training time. So we finally choose M = 3. Weight of the value difference. As shown in Fig. 20(d), SACLSPFSPPSRONeuRDSACLSPFSPPSRONeuRD59.69(41.72)61.21(25.92)162.09(55.26)1464.72(695.34)789.59(301.62)58.87(25.86)53.21(21.61)148.80(40.10)1095.97(564.00)680.49(249.03)26.31(31.11)11.37(9.71)43.13(36.33)1589.40(267.55)1679.08(630.54)16.99(41.64)3.94(4.62)6.32(8.10)439.40(626.79)1332.36(959.75)0.47(0.44)0.41(0.27)0.38(0.40)5.13(13.16)154.98(71.51)Predator RewardSACLSPFSPPSRONeuRDSACLSPFSPPSRONeuRD34.33(10.38)596.68(431.65)445.01(416.05)868.84(421.43)970.54(468.76)0.09(0.25)14.93(39.14)63.71(171.49)13.08(33.88)114.12(165.99)16.71(22.76)859.64(838.72)273.86(543.29)634.86(623.71)1338.70(1226.54)4.14(8.62)304.96(631.03)30.44(32.28)134.93(130.23)997.39(1390.75)0.02(0.06)3.96(8.50)2.87(4.79)19.53(36.64)25.51(28.25)Predator Reward-2.1-1.88-1.66-1.44-1.22-0.99-0.77-0.55-0.33-0.110.110.330.550.770.991.221.441.661.882.12.11.881.661.441.220.990.770.550.330.11-0.11-0.33-0.55-0.77-0.99-1.22-1.44-1.66-1.88-2.1Heatmap of the predator-2.1-1.88-1.66-1.44-1.22-0.99-0.77-0.55-0.33-0.110.110.330.550.770.991.221.441.661.882.12.11.881.661.441.220.990.770.550.330.11-0.11-0.33-0.55-0.77-0.99-1.22-1.44-1.66-1.88-2.1Heatmap of the prey (a) 5M. (b) 25M. (c) 40M. Figure 17: Visualization of the initial state distribution generated by SACL at different training timesteps. Potential Future Direction to Extend SACL For Partially-Observable Markov Games SACL can be directly used in fully-observable Markov games where the states contain all information about the game and are observable to all agents. For partially-observable Markov games, though some of the information is hidden from the agents, the states still contain all information of the game and it is also possible to run SACL in these games. An important part is to deal with the distribution of hidden information. A way to do that is to replace states in prioritized sampling with infosets, i.e., sets of states that are indistinguishable to agents, and maintain the distribution of states within each infoset. In each episode, we first use prioritized sampling to select an infoset and then sample a state from the infoset to generate the subgame. In this way, we keep the distribution of hidden information and also build a subgame curriculum to accelerate training. For General-Sum Games SACL consists of three components: the subgame curriculum learning framework, the sampling metric, and the particle- based sampler. The framework and the sampler can be applied to general-sum games because it doesn't require the zero-sum property. The only part to change is the metric. General-sum games are more complicated, and there is no clear metric to measure the subgames' learning progress to the best of our knowledge. A possible way is to still start from Eq. 9 to derive a metric. It would be an interesting extension of SACL. -2.1-1.88-1.66-1.44-1.22-0.99-0.77-0.55-0.33-0.110.110.330.550.770.991.221.441.661.882.12.11.881.661.441.220.990.770.550.330.11-0.11-0.33-0.55-0.77-0.99-1.22-1.44-1.66-1.88-2.1Heatmap of the prey-2.1-1.88-1.66-1.44-1.22-0.99-0.77-0.55-0.33-0.110.110.330.550.770.991.221.441.661.882.12.11.881.661.441.220.990.770.550.330.11-0.11-0.33-0.55-0.77-0.99-1.22-1.44-1.66-1.88-2.1Heatmap of the prey-2.1-1.88-1.66-1.44-1.22-0.99-0.77-0.55-0.33-0.110.110.330.550.770.991.221.441.661.882.12.11.881.661.441.220.990.770.550.330.11-0.11-0.33-0.55-0.77-0.99-1.22-1.44-1.66-1.88-2.1Heatmap of the prey (a) FPS. (b) Greedy. (c) Random. (d) FPS. (e) Greedy. (f) Random. Figure 18: Visualization of the state buffer and projection of tasks in the state buffer to 2-dimension by principal component analysis generated by three update method. (a) Pass and shoot. (b) Run, pass and shoot. (c) 3 vs 1 with keeper. Figure 19: The results of cross-play in GRF. -2.1-1.88-1.66-1.44-1.22-0.99-0.77-0.55-0.33-0.110.110.330.550.770.991.221.441.661.882.12.11.881.661.441.220.990.770.550.330.11-0.11-0.33-0.55-0.77-0.99-1.22-1.44-1.66-1.88-2.1Heatmap of the predator-2.1-1.88-1.66-1.44-1.22-0.99-0.77-0.55-0.33-0.110.110.330.550.770.991.221.441.661.882.12.11.881.661.441.220.990.770.550.330.11-0.11-0.33-0.55-0.77-0.99-1.22-1.44-1.66-1.88-2.1Heatmap of the predator-2.1-1.88-1.66-1.44-1.22-0.99-0.77-0.55-0.33-0.110.110.330.550.770.991.221.441.661.882.12.11.881.661.441.220.990.770.550.330.11-0.11-0.33-0.55-0.77-0.99-1.22-1.44-1.66-1.88-2.1Heatmap of the predator42024420244202442024432101234432101234SACLSPFSPPSRONeuRDSACLSPFSPPSRONeuRD0.54(0.24)0.53(0.20)0.45(0.28)0.67(0.09)0.68(0.09)0.66(0.13)0.68(0.11)0.55(0.24)0.71(0.11)0.77(0.13)0.52(0.20)0.62(0.34)0.67(0.24)0.68(0.17)0.86(0.15)0.66(0.12)0.67(0.25)0.55(0.35)0.76(0.10)0.83(0.10)0.00(0.00)0.00(0.00)0.00(0.00)0.00(0.00)0.00(0.00)Win rate of the red teamSACLSPFSPPSRONeuRDSACLSPFSPPSRONeuRD0.46(0.16)0.41(0.18)0.49(0.17)0.54(0.13)0.54(0.16)0.41(0.20)0.44(0.20)0.43(0.16)0.46(0.18)0.40(0.17)0.42(0.23)0.51(0.31)0.09(0.02)0.83(0.18)0.83(0.13)0.41(0.28)0.40(0.30)0.09(0.07)0.68(0.26)0.76(0.18)0.00(0.00)0.00(0.00)0.00(0.00)0.00(0.00)0.00(0.00)Win rate of the red teamSACLSPFSPPSRONeuRDSACLSPFSPPSRONeuRD0.57(0.09)0.70(0.10)0.72(0.15)0.70(0.12)0.71(0.09)0.20(0.19)0.20(0.19)0.25(0.24)0.28(0.28)0.26(0.23)0.55(0.24)0.61(0.24)0.56(0.27)0.66(0.23)0.68(0.25)0.63(0.15)0.78(0.05)0.67(0.15)0.69(0.20)0.73(0.17)0.00(0.00)0.00(0.00)0.00(0.00)0.00(0.00)0.00(0.00)Win rate of the red team (a) Buffer size. (b) Sample probability. (c) Ensemble size. (d) Weight of the value difference. Figure 20: Ablation studies of hyperparameters in MPE hard. Figure 21: Seeker's average episode rewards in a goal-reaching Ramp-Use task. SACL is comparable to a strong baseline VACL, which is specialized for goal-oriented problems. 01234samples1e71234approximate exploitability1e3K=200K=2000K=10000K=2000001234samples1e71234approximate exploitability1e3p=0.1p=0.3p=0.7p=1.001234samples1e71.52.02.53.03.54.04.5approximate exploitability1e3M=1M=3M=501234samples1e71234approximate exploitability1e3alpha=0.0alpha=0.3alpha=0.7alpha=1.0alpha=3.0bias-only0246samples1e70.00.20.40.60.81.0episode rewardZACLVACL
http://arxiv.org/abs/2310.04791v1
"2023-10-07T12:48:54"
"2023-10-07T12:48:54"
Conditional Diffusion Model for Target Speaker Extraction
We propose DiffSpEx, a generative target speaker extraction method based on score-based generative modelling through stochastic differential equations. DiffSpEx deploys a continuous-time stochastic diffusion process in the complex short-time Fourier transform domain, starting from the target speaker source and converging to a Gaussian distribution centred on the mixture of sources. For the reverse-time process, a parametrised score function is conditioned on a target speaker embedding to extract the target speaker from the mixture of sources. We utilise ECAPA-TDNN target speaker embeddings and condition the score function alternately on the SDE time embedding and the target speaker embedding. The potential of DiffSpEx is demonstrated with the WSJ0-2mix dataset, achieving an SI-SDR of 12.9 dB and a NISQA score of 3.56. Moreover, we show that fine-tuning a pre-trained DiffSpEx model to a specific speaker further improves performance, enabling personalisation in target speaker extraction.
[ "Theodor Nguyen", "Guangzhi Sun", "Xianrui Zheng", "Chao Zhang", "Philip C Woodland" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04791v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04791v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "eess.AS", "@scheme": "http://arxiv.org/schemas/atom" }
[ "eess.AS", "cs.LG", "cs.SD" ]
CONDITIONAL DIFFUSION MODEL FOR TARGET SPEAKER EXTRACTION Theodor Nguyen1, Guangzhi Sun1, Xianrui Zheng1, Chao Zhang2, Philip C Woodland1 1Department of Engineering, University of Cambridge, Cambridge, UK 2Department of Electrical Engineering, Tsinghua University, Beijing, China ABSTRACT We propose DiffSpEx, a generative target speaker extraction method based on score-based generative modelling through stochastic dif- ferential equations. DiffSpEx deploys a continuous-time stochastic diffusion process in the complex short-time Fourier transform do- main, starting from the target speaker source and converging to a Gaussian distribution centred on the mixture of sources. For the reverse-time process, a parametrised score function is conditioned on a target speaker embedding to extract the target speaker from the mixture of sources. We utilise ECAPA-TDNN target speaker em- beddings and condition the score function alternately on the SDE time embedding and the target speaker embedding. The potential of DiffSpEx is demonstrated with the WSJ0-2mix dataset, achiev- ing an SI-SDR of 12.9 dB and a NISQA score of 3.56. Moreover, we show that fine-tuning a pre-trained DiffSpEx model to a specific speaker further improves performance, enabling personalisation in target speaker extraction. Index Terms- Target speaker extraction, diffusion, score- based generative modelling, ECAPA-TDNN, personalisation 1. INTRODUCTION Target speaker extraction (TSE) involves identifying and isolating the speech signal of a specified target speaker from a mixture of signals. TSE systems find practical use in the context of person- alised speech processing, where the user of a personalised system can set up a downstream task to only process their voice, e.g. with personalised voice assistants or mobile phone applications. Spa- tial information (e.g. from a microphone array [1]), audio-visual cues [2, 3, 4]) and auditive cues (e.g. fixed-length speaker embed- dings [5, 6, 7, 8, 9]) can be used to target and extract the correct speaker. The presented work only considers auditive cues in the form of fixed-length speaker embeddings as conditioning vectors in the TSE task. Such fixed-length embeddings are either provided by pre-trained speaker embedding models [5, 6] or jointly learned in a multi-task training objective [7, 8, 9]. All of the above-mentioned TSE models are based on discriminative methods trained on signal similarity to the target signal by performing signal masking. In contrast, generative methods aim to fit a parametrised model to the underlying data distribution. Diffusion-based generative mod- els have recently shown state-of-the-art capabilities in image gener- ation [10, 11, 12, 13, 14] and speech processing [15, 16, 17, 18, 19, 20, 21]. Denoising diffusion probabilistic models (DDPM, [22, 10]) and score-based generative modelling through stochastic differential This work has been performed using resources provided by the Cam- bridge Tier-2 system operated by the University of Cambridge Research Computing Service funded by EPSRC Tier-2 capital grant EP/T022159/1. Theodor Nguyen is supported by the Studienstiftung des Deutschen Volkes. The code will be made available after the review process. Fig. 1: The stochastic diffusion process (f.l.t.r) progressively per- turbs the target speaker signal with Gaussian noise while interpolat- ing from the target signal to the mixture. The reverse process (f.r.t.l) conditioned on the target speaker embedding ets extracts the target speaker signal from the mixture of signals. equations (SGM, [11]) form the two main frameworks in diffusion- based modelling. For the scope of this work, SGM is considered the framework of choice, although [11] and [12] showed that DDPMs and SGMs are equivalent formulations. SGMs have been applied to speech enhancement [18, 19, 20, 21] and blind source separation (BBS) for speech data [23]. However, as far as we are aware, an SGM method for TSE is yet to be investigated. In the proposed DiffSpEx method (Section 3), TSE is performed by running the reverse-time SDE in the complex short-time Fourier transform (STFT) domain, starting from a mix- ture of signals with a trainable score function conditioned on fixed- length target speaker embeddings from the ECAPA-TDNN speech extractor [24]. The proposed method is illustrated in Fig. 1. The potential of DiffSpEx is demonstrated in Section 4 on a general TSE task and a personalised TSE task on the WSJ0-2mix dataset [25], where it is shown in Section 5 that DiffSpEx has comparable per- formance to discriminative TSE methods in signal reconstruction (in SI-SDR [26]) while outperfoming them in uninstrusive speech qual- ity and naturalness measured in NISQA [27]. Moreover, it is shown that DiffSpEx can be fine-tuned to a specific speaker to improve sig- nal reconstruction and speech quality further. Hence, the DiffSpEx method can be applied to settings where a particular (personalised) speaker is to be extracted with high quality and naturalness. 2. BACKGROUND In SGM, a data sample from the target distribution is progressively perturbed with Gaussian noise in a stochastic diffusion process to increase the support of the data distribution on the high-dimensional manifold. This forward process is defined through a stochastic dif- ferential equation (SDE) [11]. The work in [28] showed that the backward process to sample a target data point from (Gaussian) noise can be defined with a reverse-time SDE, where the required score function can be trained as a deep neural network via score- matching [11]. © 2023 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works. dxt=γ(y−xt)dt+g(t)dwdxt≈[γ(y−xt)−g(t)2sθ(xt,y,t,ets)]dt+g(t)dwx0x0xTxT 2.1. Score-based generative modelling through SDEs A stochastic diffusion process is a solution to an SDE and can be represented as a continuous forward process {x(t)}t∈[0,T ] starting at t = 0. The continuous forward process in SGM {x(t)}t∈[0,T ] can be formalised through the SDE [11] as dx = f (x, t)dt + g(t)dw, (1) where f (x, t) : (Rdx , R) → Rdx is called the drift coefficient and dx denotes the dimensionality of x, g(t) : R → R is called the diffusion coefficient, and w ∈ Rdx represents standard Brownian motion. From a macroscopic view, the probability density function over all possible continuous stochastic trajectories {x(t)}t∈[0,T ] at a continuous timestep t is denoted by pt(x). For t = 0, p0(x) is the data distribution p(x), as there is no added noise at timestep t = 0. As the diffusion process proceeds to t → T , i.e. the largest pos- sible noise in the defined process, by design, pT (x) converges to a tractable distribution π(x) called the prior distribution. With the SDE formulation of the diffusion process, data points can be sam- pled from the prior distribution by reversing the diffusion process. In [28], it is proven that for every SDE of the form in Equation (1), there exists a corresponding reverse-time SDE dx = (cid:2)f (x, t) − g(t)2∇x log pt(x)(cid:3) dt + g(t)dw, (2) where dt denotes a negative timestep in the reverse process and ∇x log pt(x) can be approximated by a trainable score function sθ(x, t): dx ≈ (cid:2)f (x, t) − g(t)2sθ(x, t)(cid:3) dt + g(t)dw. (3) To sample a data point ˆx from p(x), the reverse-time SDE in Equa- tion 2 can be solved with any numerical SDE solver by (i) sampling from the tractable prior distribution pT (x) = π(x) as a starting point and (ii) using the trained score model sθ(x, t) to get the cor- rect reverse-time SDE. 2.2. Speech enhancement in the complex STFT domain A diffusion-based speech enhancement model that operates in the complex STFT domain was proposed in [18] and [19]. The complex STFT spectrograms are transformed and retransformed with ̃c = β|c|α ei∠(c) and c = 1 α ei∠( ̃c), | ̃c| 1 β (4) respectively, where c are the coefficients in the complex STFT, ∠(*) is the angle of the coefficients, α ∈ R+ is a parameter that com- presses the amplitude to upscale frequencies with lower energies, and β ∈ R+ is a scaling factor to scale the amplitudes to be between 0 and 1 for predictable noising in the diffusion-based model. In their work, [18] and [19] proposed a speech enhancement method based on the SDE formulation of score-based generative models [11] with the SDE dxt = γ(y − xt)dt + g(t)dw, (5) where y is the spectrogram of the noisy signal and g(t) is the diffu- sion coefficient that is parametrised by σmin and σmax in g(t) = σmin (cid:19)t (cid:115) 2 log (cid:18) σmax σmin (cid:18) σmax σmin (cid:19) . (6) coefficient of the reversion effect. Such a mean-reverting SDE is also called an Ornstein-Uhlenbeck SDE [29]. Based on the form of the variance schedule g(t), the SDE in Equation (5) is referred to as a Variance Exploding SDE in [11], as the variance tends to infinity for t → ∞. In combination, [18] and [19] coined the SDE the Ornstein-Uhlenbeck Variance Exploding SDE (OUVE). The closed- form solutions for the mean μ (x0, y, t) and variance σ(t)2I for a Gaussian process are derived in Equations (5.50) and (5.53) in [30]: μ (x0, y, t) = e−γtx0 + (cid:0)1 − e−γt(cid:1) y, (7) σ(t)2 = σ2 min (cid:18)(cid:16) σmax (cid:17)2t σmin − e−2γt (cid:19) log (cid:17) (cid:16) σmax σmin γ + log (cid:17) (cid:16) σmax σmin 3. METHOD . (8) The approach to performing TSE with a diffusion model is moti- vated by the promising performance of diffusion models in the BSS task [23]. In the conclusion of [23], the authors mentioned a gap in performance with state-of-the-art discriminative methods. The au- thors argue that as both outputs come from the distribution of human speech, it is unclear to the generative model which parts of the mix- ture of human speech belong to which speaker. In the experiments in Section 4, we utilise fixed-length speaker embeddings to condition the diffusion-based generative model on a specific speaker distribu- tion of the marginal distribution of human speech to separate the target speaker from the mixture of speakers. 3.1. Complex STFT features Denote the target speaker signal with x0 and the mixture signal with y in the complex STFT domain. The fixed-length target speaker em- bedding vector is denoted by ets. First, x0 and y are transformed by the rescaling transformation from Equation (4). Both complex spectrograms {x0, y} ∈ CB×F , where B is the number of fre- quency bins and F is the number of time frames of the STFT, are passed as real and imaginary channels to the diffusion-based model, {x0, y} ∈ R2×B×F . 3.2. SDE formulation for target speaker extraction The SDE from Equation (1) is used to continuously perturb the trans- formed complex STFT spectrogram x0 while the mean continuously shifts from x0 to y with Equation (7). In practice, xt is sampled with xt = μ (x0, y, t) + σ(t) z, (9) where σ(t) is defined by Equation (8) and z is standard Gaussian noise. The reverse-time SDE is defined by dxt ≈ (cid:2)γ(y − xt) − g(t)2sθ(xt, y, t, ets)(cid:3) dt + g(t)dw, (10) where sθ(*) is conditioned on the target speaker embedding ets. Fol- lowing the solution for ∇xt log p0t (xt | x0, y) of a Gaussian kernel p0t (xt | x0, y) from [31], the loss function takes the form arg min θ Et,y,z,xt (cid:34)(cid:13) (cid:13) (cid:13) (cid:13) sθ (xt, y, t, ets) + (cid:35) z σ(t) (cid:13) 2 (cid:13) (cid:13) (cid:13) 2 (11) The drift term γ(y − xt) reverts stochastic processes {xt}t≥0 that deviate from y back to y, where γ can be interpreted as the stiffness as in [19]. 4. EXPERIMENTAL SETUP Two distinct DiffSpEx approaches are investigated: (i) a general conditional TSE model (G-DiffSpEx), where the set of potential speakers is not limited and conditioned by the speaker embed- ding, and (ii) a personalised TSE model (P-DiffSpEx), where a pre-trained model is fine-tuned on a specific speaker. In the latter experiment, various total durations of reference signals {60 s, 180 s, 300 s, 600 s} are used to reveal how much reference audio is needed to fine-tune DiffSpEx on one speaker. 4.1. Datasets and speaker embedding The WSJ0-2mix min-cut [25] is chosen at a sample rate of 8 kHz to evaluate our proposed TSE model. The datasets consist of 20,000 training (30 h), 5,000 validation (8 h) and 3,000 test utterances (5 h), where the set of speakers in the test dataset with 18 speakers is dis- joint from the training and validation dataset (101 speakers). G-DiffSpEx. The first speaker is set in the mixture signals to be the target speaker, and fixed-length target speaker embeddings are generated with ECAPA-TDNN [24] from a random sample of the clean signals of the respective speakers. Additionally, random sam- ples of one speaker are joined to at least 60 s signal length to generate target speaker embeddings with more context for evaluation, which we mark with 60s. P-DiffSpEx. The individual speaker 40f from the WSJ0-2mix dataset is chosen to create proprietary personalised datasets for dif- ferent amounts of reference audio {60 s, 180 s, 300 s, 600 s}, where in the personalised datasets, the target speaker audio is a randomly selected reference audio of the individual speaker 40f. The set of samples in the personalised training, validation and test set are dis- joint, where the total duration of the set of samples for validation and testing is 195 s. Additionally, to report more representative re- sults, the experiment is repeated for 600 s of reference audio with 10 speakers {017, 01a, 01i, 01t, 01z, 029, 02e, 40f, 40l, 40o}. 4.2. Metrics The commonly used signal restoration metrics SI-SDR and SI-SDRi [26] in dB are used to evaluate the signal similarity between the ex- tracted speaker signal and the ground truth signal in the time domain. Furthermore, the intrusive speech quality metric PESQ [32] and the unintrusive speech naturalness metric NISQA [27] are reported. 4.3. Model and speaker embedding conditioning the input The parametrised score-function sθ(*) is based on the noise-conditio- ned score-matching network (NCSN++) from [11], a multi-channel U-Net neural network with residual connections [33]. As sθ(*) is conditioned on the mixture signal y besides the sampled sig- nal xt [18, 19, 23], to the NCSN++ score-function (xt, y) ∈ R4×B×F has 4 channels [19]. We use a smaller net- work configuration than [19, 23] of 4 encoder-decoder layers with 2 ResNet blocks each and no attention mechanism, resulting in a model with 37.7M parameters. The ECAPA-TDNN [24] speaker embeddings ets ∈ R192 and the time embeddings et ∈ R512 from the variance scheduler σ(t)2 are downsampled by feed-forward lay- ers and alternately added as bias to the intermediate representations in the ResNet blocks. Fig. 2 illustrates such a ResNet block with alternated adding of the embeddings. Fig. 2: ResNet-Block in the U-Net architecture with optional finite impulse response (FIR) filters for up- and downsampling. 4.4. Hyperparameters for inference and training The 8 kHz audio signals are transformed into the complex STFT do- main with NFFT = 254, window size = 256, hop length = 64 and F = 256, resulting in B = 128 and model input frames of 2048 ms length at 8 kHz. The parameters for the complex STFT transforma- tions from Equation (4) are set to α = 0.5 and β = 0.15 as in [18] and [19]. The parametrisation for the SDE in Equations (10) and (6) are γ = 2.0, σmin = 0.05 and σmax = 0.5. For inference, a predictor-corrector sampler [11] with the Euler-Maruyama solver and annealed Langevin dynamics [34] is used, where the sampling parameters are set to N = 30 and r = 0.5. The models are evalu- ated on SI-SDR of 100 random validation samples to choose the best checkpoint for test evaluation in order to save computational costs. G-DiffSpEx. The G-DiffSpEx model is trained for 1000 epochs with an effective batch size of 48 on one NVIDIA-A100 GPU, which requires 250 h. We train the model with the Adam optimiser [35], a learning rate 5 × 10−4 and a linear warm-up schedule of 2000 training steps. P-DiffSpEx. The P-DiffSpEx model is fine-tuned on the pre- trained G-DiffSpEx model for 15 epochs with an effective batch size of 48 on one NVIDIA-A100 GPU, which requires 4 h. We fine-tune the model with the Adam optimiser at a learning rate of 5 × 10−4. 5. RESULTS 5.1. General target speaker extraction The evaluation results on the trained DiffSpEx model for randomly chosen speaker embeddings and 60s-embeddings are given in Ta- ble 1, where numbers with reported standard deviations (after ±) are evaluated on the same test script and numbers without standard de- viations are taken from their respective publications. The proposed method achieves an SI-SDRi better than earlier discriminative TSE models with better NISQA values. However, there is a noticeable gap in SI-SDR to the state-of-the-art discriminative TSE methods. The NISQA score of 3.56 indicates that the extracted speech sig- nals of DiffSpEx are more natural than the discriminative models, although (in some places) the extracted signals may be heavily mixed GroupNormSwish-ActivationUp-/DownsamplingConv2DUp-/DownsamplingConv2DGroupNormSwish-ActivationConv2Dhh′ +tetetsLinearSwish-ActivationLinearSwish-ActivationLinearoptionaloptionalalternates every ResNet-Blockadd as biasResNet-Block Fig. 3: SI-SDR distribution conditioned on an ECAPA-TDNN co- sine similarity of > 0.15 and ≤ 0.15 between the two source signals in the WSJ0-2mix test samples. with the wrong speaker, given the overall SI-SDR score and the stan- dard deviation. Hence, the generative DiffSpEx method is preferably applied to settings where target speakers need to be extracted with high speech quality and naturalness. Table 1: Evaluation results of DiffSpEx and benchmarks on WSJ0- 2mix 8 kHz min-cut. The standard deviation is given after ±. Model SI-SDR ↑ SI-SDRi ↑ PESQ ↑ NISQA ↑ SpeakerBeam [5, 8] SpeakerBeam1 SpEx [7] SpEx+ [8] SpEx+2 SpEx-CA [9] X-Sepformer [6] 9.2 - - - 14.0±7.3 11.5±7.3 3.05±0.63 3.27±0.47 14.6 18.2 - - 3.14 3.49 - - 11.6±12.8 11.6±13.2 3.01±0.97 3.03±0.50 - - 18.8 19.1 - 3.75 - - G-DiffSpEx G-DiffSpEx-60s 12.7±9.3 10.1±9.0 3.05±1.02 3.55±0.32 12.9±9.1 10.3±8.9 3.08±1.00 3.56±0.33 Fig. 3 plots the distribution of the SI-SDR results for G-DiffSpEx- 60s. It reveals a bimodal distribution in performance and shows that DiffSpEx struggles with the TSE task when the speech sources in the mixture have a high ECAPA-TDNN cosine similarity, as for similar- ity scores > 0.15, the distribution of SI-SDR shows a high den- sity between -5 dB and 10 dB. Intuitively, target speakers are harder to extract from a mixture of similar speakers. This suggests that the model may improve, given more accurate and better matching speaker embeddings and providing more context, e.g. a bigger sig- nal window, to the model. Fig. 4 gives chosen samples from the TSE test evaluation. 5.2. Personalised target speaker extraction The evaluation results on the fine-tuned P-DiffSpEx model with different target speaker reference audio lengths are given in Table 2, where the G-40f-DiffSpEx-60s model corresponds to a non- personalised model for speaker 40f and G-10S-DiffSpEx-600s cor- responds to the same experiment repeated for 10 speakers. The post- fixes to G-DiffSpEx and P-DiffSpEx indicate the total duration of reference audio in the respective personalised datasets. The person- alised TSE models achieve a higher SI-SDR than the G-DiffSpEx model without fine-tuning. Furthermore, all metrics except for 1Results generated from checkpoint provided by the SpeakerBeam repos- itory. Caveat: the checkpoint was trained on the bigger Libri2Mix dataset. 2Results generated from a checkpoint in the SpEx+ repository. Fig. 4: Chosen evaluation samples of G-DiffSpEx-60s. In the left column, G-DiffSpEx-60s extracts the correct speaker. In the middle column, the model extracts the correct speaker in the first half of the signal segment and the wrong speaker in the second half. In the right column, the model extracts the wrong speaker. The extracted samples show natural-looking in-distribution spectrograms without distortions. Table 2: Fine-tuning results for 40f and the set of 10 speakers (10S). Model SI-SDR ↑ SI-SDRi ↑ PESQ ↑ NISQA ↑ G-40f-DiffSpEx-60s 14.8±8.9 12.3±8.5 3.43±0.89 3.67±0.18 P-40f-DiffSpEx-60s 15.2±7.4 12.6±7.0 3.44±0.77 3.79±0.17 P-40f-DiffSpEx-180s 16.2±7.2 13.7±6.8 3.58±0.73 3.74±0.16 P-40f-DiffSpEx-300s 16.7±7.0 14.2±6.6 3.64±0.70 3.74±0.16 P-40f-DiffSpEx-600s 17.2±7.1 14.7±6.7 3.69±0.70 3.70±0.16 G-10S-DiffSpEx-600s 13.6±8.5 10.9±8.1 3.29±0.93 3.34±0.30 P-10S-DiffSpEx-600s 16.1±7.1 13.3±6.7 3.60±0.75 3.34±0.30 NISQA improve with the length of reference audio provided during fine-tuning. This shows that DiffSpEx can be applied to settings where personalisation for particular target speakers is possible. 6. CONCLUSION We proposed DiffSpEx, a target speaker extraction model based on score-based generative modelling and ECAPA-TDNN speaker em- beddings. We demonstrate that DiffSpEx achieves target speaker extraction performance that is better than the earlier discriminative target speaker extraction models (12.9 dB SI-SDR) while produc- ing natural-sounding outputs per the NISQA metric (3.56). Further- more, we show that fine-tuning a pre-trained DiffSpEx model on one speaker in a personalised setting is possible and improves the extrac- tion performance with as little as 60 s of reference audio, and more reference audio further improves the TSE performance of a person- alised DiffSpEx model. In conclusion, DiffSpEx performs well in settings that require target speaker extraction with high quality and naturalness and allow for the personalisation of target speakers. −30−20−100102030SI-SDR[dB]0.0000.0250.0500.0750.1000.125Distribtutionoftestsamplessimilarityscore≤0.15-65%similarityscore>0.15-35%Mixture20.0dBSI-SDR5.0dBSI-SDR-20.0dBSI-SDRGroundtruthG-DiffSpEx-60sprediction 7. REFERENCES [1] J. Flanagan, J. Johnston, R. Zahn, and G. Elko, "Computer- steered microphone arrays for sound transduction in large rooms," JASA, vol. 78, pp. 1508–1518, 1985. [2] J. Hershey and M. Casey, "Audio-visual sound separation via hidden Markov models," in Proc. NeuRIPS, 2001. [3] T. Ochiai, M. Delcroix, K. Kinoshita, A. Ogawa, and T. Nakatani, "Multimodal SpeakerBeam: Single channel target speech extraction with audio-visual speaker clues.," in Proc. Interspeech, 2019. [4] H. Sato, T. Ochiai, K. Kinoshita, M. Delcroix, T. Nakatani, and S. Araki, "Multimodal attention fusion for target speaker extraction," in Proc. IEEE Spoken Language Technology Work- shop (SLT), 2021. [5] K. ˇZmol ́ıkov ́a, M. Delcroix, K. Kinoshita, T. Ochiai, T. Nakatani, L. Burget, and J. ˇCernock`y, "SpeakerBeam: Speaker aware neural network for target speaker extraction in speech mixtures," IEEE Journal of Selected Topics in Signal Processing, vol. 13, no. 4, pp. 800–814, 2019. [6] K. Liu, Z. Du, X. Wan, and H. Zhou, "X-SepFormer: End-to- end speaker extraction network with explicit optimization on speaker confusion," in Proc. ICASSP, 2023. [7] C. Xu, W. Rao, E. Chng, and H. Li, "SpEx: Multi-scale time domain speaker extraction network," IEEE/ACM Trans. Audio, Speech and Lang. Proc., vol. 28, pp. 1370–1384, 2020. [8] M. Ge, C. Xu, L. Wang, E. Chng, J. Dang, and H. Li, "SpEx+: A complete time domain speaker extraction network," in Proc. Interspeech, 2020. [9] W. Wang, C. Xu, M. Ge, and H. Li, "Neural speaker extraction with speaker-speech cross-attention network," in Proc. Inter- speech, 2021. [10] J. Ho, A. Jain, and P. Abbeel, "Denoising diffusion probabilis- tic models," in Proc. NeuRIPS, 2020. [11] Y. Song, J. Sohl-Dickstein, D. Kingma, A. Kumar, S. Er- mon, and B. Poole, "Score-based generative modeling through stochastic differential equations," in Proc. ICLR, 2021. [12] T. Karras, M. Aittala, T. Aila, and S. Laine, "Elucidating the design space of diffusion-based generative models," in Proc. NeuRIPS, 2022. [13] J. Song, C. Meng, and S. Ermon, "Denoising diffusion implicit models," in Proc. ICLR, 2021. [14] Y. Song, P. Dhariwal, M. Chen, and I. Sutskever, "Consistency models," in Proc. ICML, 2023. [15] Z. Kong, W. Ping, J. Huang, K. Zhao, and B. Catanzaro, "Dif- fWave: A versatile diffusion model for audio synthesis," Proc. ICLR, 2021. [16] Y. Lu, Y. Tsao, and S. Watanabe, "A study on speech enhance- ment based on diffusion probabilistic model," in Proc. APSIPA ASC, 2021. [17] Y. Lu, Z. Wang, S. Watanabe, A. Richard, C. Yu, and Y. Tsao, "Conditional diffusion probabilistic model for speech enhance- ment," in Proc. ICASSP, 2022. [18] S. Welker, J. Richter, and T. Gerkmann, "Speech enhancement with score-based generative models in the complex STFT do- main," in Proc. Interspeech, 2022. [19] J. Richter, S. Welker, J. Lemercier, B. Lay, and T. Gerkmann, "Speech enhancement and dereverberation with diffusion- based generative models," IEEE/ACM Trans. Audio, Speech, Language Process., vol. 31, pp. 2351–2364, 2023. [20] B. Lay, S. Welker, J. Richter, and T. Gerkmann, "Reduc- ing the prior mismatch of stochastic differential equations for diffusion-based speech enhancement," in Proc. Interspeech, 2023. [21] J. Lemercier, J. Richter, S. Welker, and T. Gerkmann, "Storm: A diffusion-based stochastic regeneration model for speech en- IEEE/ACM Trans. Audio, hancement and dereverberation," Speech, Language Process., vol. 31, pp. 2724–2737, 2023. [22] J. Sohl-Dickstein, E. Weiss, N. Maheswaranathan, and S. Gan- guli, "Deep unsupervised learning using nonequilibrium ther- modynamics," in Proc. ICML, 2015. [23] R. Scheibler, Y. Ji, S. Chung, J. Byun, S. Choe, and M. Choi, "Diffusion-based generative speech source separation," in Proc. ICASSP, 2023. [24] B. Desplanques, J. Thienpondt, and K. Demuynck, "ECAPA- TDNN: Emphasized channel attention, propagation and aggre- gation in TDNN based speaker verification," in Proc. Inter- speech, 2020. [25] D. Paul and J. Baker, "The design for the Wall Street Journal- based CSR corpus," in Speech and Natural Language: Pro- ceedings of a Workshop Held at Harriman, 1992. [26] J. Le Roux, F. Weninger, and J. Hershey, "Sparse NMF- half-baked or well done?," Mitsubishi Electric Research Labs (MERL), vol. 11, pp. 13–15, 2015. [27] G. Mittag, B. Naderi, A. Chehadi, and S. M ̈oller, "NISQA: A deep CNN-self-attention model for multidimensional speech quality prediction with crowdsourced datasets," in Proc. Inter- speech, 2021. [28] B. Anderson, "Reverse-time diffusion equation models," Stochastic Processes and their Applications, vol. 12, pp. 313– 326, 1982. [29] G. E. Uhlenbeck and L. S. Ornstein, "On the theory of the Brownian motion," Phys. Rev., vol. 36, pp. 823–841, 1930. [30] S. S ̈arkk ̈a and A. Solin, Applied stochastic differential equa- tions, vol. 10, Cambridge University Press, 2019. [31] P. Vincent, "A connection between score matching and denois- ing autoencoders," Neural Computation, vol. 23, pp. 1661– 1674, 2011. [32] A. Rix, J. Beerends, M. Hollier, and A. Hekstra, "Perceptual evaluation of speech quality (PESQ)-a new method for speech quality assessment of telephone networks and codecs," in Proc. ICASSP, 2001. [33] O. Ronneberger, P. Fischer, and T. Brox, "U-Net: Convolu- tional networks for biomedical image segmentation," in Proc. MICCAI, 2015. [34] R. Pastor, "Techniques and applications of Langevin dynamics simulations," in The Molecular Dynamics of Liquid Crystals, pp. 85–138. Springer, 1994. [35] D. Kingma and J. Ba, "Adam: A method for stochastic opti- mization," in Proc. ICLR, 2015.
http://arxiv.org/abs/2310.04789v1
"2023-10-07T12:44:47"
"2023-10-07T12:44:47"
HNS: An Efficient Hermite Neural Solver for Solving Time-Fractional Partial Differential Equations
Neural network solvers represent an innovative and promising approach for tackling time-fractional partial differential equations by utilizing deep learning techniques. L1 interpolation approximation serves as the standard method for addressing time-fractional derivatives within neural network solvers. However, we have discovered that neural network solvers based on L1 interpolation approximation are unable to fully exploit the benefits of neural networks, and the accuracy of these models is constrained to interpolation errors. In this paper, we present the high-precision Hermite Neural Solver (HNS) for solving time-fractional partial differential equations. Specifically, we first construct a high-order explicit approximation scheme for fractional derivatives using Hermite interpolation techniques, and rigorously analyze its approximation accuracy. Afterward, taking into account the infinitely differentiable properties of deep neural networks, we integrate the high-order Hermite interpolation explicit approximation scheme with deep neural networks to propose the HNS. The experimental results show that HNS achieves higher accuracy than methods based on the L1 scheme for both forward and inverse problems, as well as in high-dimensional scenarios. This indicates that HNS has significantly improved accuracy and flexibility compared to existing L1-based methods, and has overcome the limitations of explicit finite difference approximation methods that are often constrained to function value interpolation. As a result, the HNS is not a simple combination of numerical computing methods and neural networks, but rather achieves a complementary and mutually reinforcing advantages of both approaches. The data and code can be found at \url{https://github.com/hsbhc/HNS}.
[ "Jie Hou", "Zhiying Ma", "Shihui Ying", "Ying Li" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04789v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04789v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.NA", "math.NA" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 9 8 7 4 0 . 0 1 3 2 : v i X r a HNS: An Efficient Hermite Neural Solver for Solving Time-Fractional Partial Differential Equations Jie Houa, Zhiying Mab, Shihui Yingb and Ying Lia,∗ aSchool of Computer Engineering and Science, Shanghai University, Shanghai 200444, PR China bDepartment of Mathematics, School of Science, Shanghai University, 200444, PR China A R T I C L E I N F O A B S T R A C T Keywords: Hermite Interpolation Time-Fractional PDEs Neural Network High-Dimensional Problems Neural network solvers represent an innovative and promising approach for tackling time- fractional partial differential equations by utilizing deep learning techniques. L1 interpolation approximation serves as the standard method for addressing time-fractional derivatives within neural network solvers. However, we have discovered that neural network solvers based on L1 interpolation approximation are unable to fully exploit the benefits of neural networks, and the accuracy of these models is constrained to interpolation errors. In this paper, we present the high- precision Hermite Neural Solver (HNS) for solving time-fractional partial differential equations. Specifically, we first construct a high-order explicit approximation scheme for fractional deriva- tives using Hermite interpolation techniques, and rigorously analyze its approximation accuracy. Afterward, taking into account the infinitely differentiable properties of deep neural networks, we integrate the high-order Hermite interpolation explicit approximation scheme with deep neural networks to propose the HNS. The experimental results show that HNS achieves higher accuracy than methods based on the L1 scheme for both forward and inverse problems, as well as in high-dimensional scenarios. This indicates that HNS has significantly improved accuracy and flexibility compared to existing L1-based methods, and has overcome the limitations of explicit finite difference approximation methods that are often constrained to function value interpolation. As a result, the HNS is not a simple combination of numerical computing methods and neural networks, but rather achieves a complementary and mutually reinforcing advantages of both approaches. The data and code can be found at https://github.com/hsbhc/HNS. 1. Introduction Fractional Partial Differential Equations (FPDEs) are an extension of traditional integer-order Partial Differential Equations (PDEs) that stem from the realm of Fractional Calculus, boasting rich research backgrounds in mathematics and physics [1, 2]. Compared to integer-order PDEs, fractional derivatives can more accurately represent phenomena with memory and hereditary attributes. As a result, FPDEs can effectively capture memory and non-local effects in various natural phenomena. This makes them highly valuable in fields such as fluid dynamics [3], turbulence [4], geology [5], elasticity [6], biology [7], financial theory [8, 9], and engineering [10]. In recent decades, researchers have made significant progress in the numerical solution of fractional-order differential equations, developing numerous numerical techniques. However, due to the inherent nonlinearity, high dimensionality, and complex boundary conditions of FPDEs, the computational complexity of traditional numerical methods is often significant[11–17]. Furthermore, traditional numerical methods may encounter difficulties in effectively addressing the memory effects and long-range dependencies inherent in FPDEs, which can result in diminished accuracy in their computational results. When tackling high-dimensional problems, numerical methods typically involve extensive computational demands[18]. With the growing development of deep neural networks, it is recognized that neural networks have powerful approximation and nonlinear modeling capabilities [19, 20], which makes neural networks show great potential in solving scientific computing problems [21–23]. Recently, the Physics-Informed Neural Networks (PINNs) model has achieved notable success in solving Partial Differential Equations (PDEs) [24] and has been applied to FPDEs. Pang et al.[25] extended PINNs to Fractional PINNs (fPINNs), exhibiting accuracy and efficacy in solving forward and inverse problems while systematically exploring convergence properties. Ye et al.[26] conducted a study on time- fractional diffusion equations with conformable derivative using Physics-Informed Neural Networks (PINNs). For ∗Corresponding author houjie@shu.edu.cn (J. Hou); mazhiying@shu.edu.cn (Z. Ma); shying@shu.edu.cn (S. Ying); yinglotus@shu.edu.cnn (Y. Li) ORCID(s): 0000-0001-9410-0093 (J. Hou) Jie Hou et al.: Preprint submitted to Elsevier Page 1 of 21 more instructions on neural network methods for solving fractional-order differential equations, see [27–33]. The primary advantage of neural network methods lies in their ability to solve high-dimensional problems, handle complex geometries, and address inverse problems effectively. The main challenge in solving fractional partial differential equations (FPDEs) lies in the handling of fractional derivatives. Similar to many neural network approaches for solving PDEs, it is common to combine numerical methods to efficiently solve problems[34, 35]. Therefore, when solving FPDEs, we also use traditional approximation methods to approximate fractional-order derivatives. As a result, the accuracy of neural network models in solving FPDEs is closely related to the choice of approximation methods for fractional derivatives. Therefore, to ensure the accuracy and stability of the model, it is crucial to select appropriate numerical approximation methods. Most current methods employ finite difference approximation methods to discretize the time-fractional derivatives, with the accuracy of the model being limited by the scheme approximation errors. For example, when discretizing time fractional derivatives using the finite difference L1 scheme directly [36, 37], the accuracy of the L1 scheme determines the prediction accuracy of the model. In fact, directly combining finite difference approximation methods for fractional derivatives with deep neural networks is not an ideal choice. Such a simplistic combination does not fully leverage the advantages of neural networks, and the accuracy of the model is limited to the accuracy of numerical approximation methods. Therefore, when designing integration strategies, we should fully leverage the potential of neural networks to enhance the overall model accuracy. For instance, we commonly use the L1 scheme to approximate Caputo fractional-order derivatives. This approximation method relies on function values for linear interpolation, which results in significant interpolation errors. This is a feature of explicit difference approximation methods, even with higher-order difference schemes[38, 39]−This is because they are explicit methods that construct interpolation polynomials exclusively through function values, without taking into account other aspects of the function, such as the derivative value of the nodes. Is it possible to break through this limitation by the neural networks? The answer is affirmative. In this paper, we utilize the Hermite interpolation method[40] to construct a high-order explicit approximation scheme for the Caputo fractional derivative and design an efficient Hermite Neural Solver for solving time fractional partial differential equations. This method fully utilizes the infinitely differentiable properties of deep neural networks, breaks through the limitation of constructing interpolation polynomials only through function values, and improves numerical accuracy. Moreover, this method can easily extend to other fractional partial differential equations, even integral equations. Although there are cubic spline collocation methods available for solving FPDEs outside of explicit finite difference methods[41–43], these methods utilize cubic spline interpolation techniques similar to the Hermite interpolation method. However, such methods introduce additional degrees of freedom, making them implicit iterative methods. In contrast, this paper leverages neural networks as a tool, allowing us to explicitly execute Hermite Interpolation Explicit Approximation for Caputo Fractional Derivatives. To the best of our knowledge, this is the first work that combines deep neural networks with the Hermite interpolation method and designs a high-order Hermite Neural Solver for solving fractional partial differential equations. The main contributions of this paper are summarized as follows: • A high-order explicit approximation scheme for the Caputo fractional derivative is constructed based on Hermite interpolation technique, and its approximation error is analyzed. • An efficient Hermite Neural Solver (HNS) is designed for solving time fractional partial differential equations. • The impact of Hermite interpolation order on the accuracy of the HNS is analyzed. The results show that the HNS using third-order Hermite interpolation achieves the highest performance. • The performance of HNS has been thoroughly verified across various problem scenarios, including challenging high-dimensional problems and inverse problems. 2. Preliminaries 2.1. Time-Fractional Partial Differential Equation Without loss of generality, we formulate any Time-Fractional PDEs as: ∂αu(x, t) ∂tα +  x[u] = 0, Jie Hou et al.: Preprint submitted to Elsevier (1) Page 2 of 21 where u(x, t) is the function which needs to be solved, α is the order of the time derivative, and  x[⋅] is a differential operator that can be linear or nonlinear. Fractional derivatives are an extension of calculus that allow for derivative orders to be real numbers rather than limited to integers. This extension finds widespread application in the fields of mathematics, physics, and engineering, particularly when describing complex systems characterized by memory and non-local properties. Commonly used definitions of fractional derivatives include Riemann-Liouville fractional derivative and Caputo fractional derivative [44]. In this paper, we employ the definition of Caputo fractional derivatives. Definition 1. Suppose the function u(t) is defined on the interval [a, b], α ≥ 0, and n is the smallest integer greater than or equal to α. The Caputo fractional derivative is defined as: a Dα C t u(t) = t 1 Γ(n − α) ∫ a u(n)(t), ⎧ ⎪ ⎨ ⎪ ⎩ (t − τ)n−α−1u(n)(τ)dτ, α ∈ (n − 1, n), α = n ∈ N, where Γ(⋅) denotes the Gamma function. If t > 0 and α ∈ (0, 1), the Caputo fractional derivative can be written as: C 0 Dα t u(t) = 1 Γ(1 − α) ∫ 0 t u′(τ) (t − τ)α dτ. (2) (3) This paper focuses on this case. To solve the problem Eq. 1, numerical methods are needed to discretize the fractional derivative. For the Caputo fractional derivative, finite difference approximation methods, such as the L1 scheme, are commonly used for temporal discretization. Spatial discretization can be achieved using methods such as finite differences, spectral methods, finite elements, and so on. L1 Scheme Let t ∈ (0, T ], α ∈ (0, 1) and N be a positive integer. Denote Δt = T N al = (l + 1)1−α − l1−α for l ≥ 0. Linear interpolation of u(t) over the interval [tk−1, tk] yields: , tk = kΔt for 0 ≤ k ≤ N, and u(t) ≈ Lk(t) = tk − t Δt u(tk−1) + t − tk−1 Δt u(tk). Then, we can obtain the following L1 approximation scheme for computing C 0 Dα t u(t) ∣t=tn : Dα t u(tn) = Δt−α Γ(2 − α) [ a0u(tn) − n−1 ∑ (an−k−1 − an−k)u(tk) − an−1u(t0) . ] k=1 The approximation error of the fractional derivative can be expressed as: R(u(tn)) = C 0 Dα t u(t) ∣t=tn −Dα t u(tn). L1 scheme has a numerical accuracy of 2 − α order. The approximation error satisfies: ∣ R(u(tn)) ∣≤ 1 2Γ(1 − α) [ 1 4 + α (1 − α)(2 − α) ] max ≤t≤tn t0 u′′(t)| | | | Δt2−α. (4) (5) (6) (7) Remark 1. The accuracy of explicit finite difference approximation methods is limited by the interpolation error. A similar approximation method is the L1 − 2 interpolation approximation. This method employs linear interpolation of u(t) on the interval [t0, t1] and uses a three-point quadratic interpolation polynomial in subsequent intervals. The L1 − 2 approximation formula, as the number of computational nodes increases, transitions from being of order 2 − α to order 3 − α. So, can we employ alternative higher-order interpolation methods, such as Hermite interpolation, to achieve a high-precision approximation in conjunction with finite differences? Jie Hou et al.: Preprint submitted to Elsevier Page 3 of 21 2.2. Hermite Interpolation Hermite interpolation is an interpolation method that requires the interpolating polynomial to pass through the given nodes and match the function values as well as the values of the first several derivatives of the original function at each node [40]. Definition 2. Let f (t) be a function defined on [a, b], and let t0, t1, ... , tn be n + 1 distinct points in [a, b], where the function values f (ti) and the values of the first k derivatives f ′(ti), ... , f (k)(ti) are all known. The Hermite interpolation polynomial H(t) satisfies the following conditions: • H(t) passes through each given point ti and takes on the corresponding function value, i.e., H(ti) = f (ti). • H(t) has the same values as f (t) for the first k derivatives at each given point ti, i.e., H (j)(ti) = f (j)(ti), for 1 ≤ j ≤ k. Theorem 1. The Hermite polynomial of degree p, denoted as Hp(t), and the original function f (t) are under consideration. When evaluating at a point t within the interval [t0, tn], the error function can be expressed as follows: f (t) − Hp(t) = f (p+1)(ξ) (p + 1)! ∏ (t − ti ) p+1 2 , i (8) ), p + 1 is the total number of data points. where ξ is an unknown point in the range (t0, tn Two-Point Hermite Interpolation Two-Point Hermite interpolation is a commonly employed method in numerical analysis and interpolation problems. Given an interval [a, b] and the values of a function f (a), f ′(a), f ′′(a) and f (b), f ′(b), f ′′(b), we can construct a linear interpolation function H1(t) = h0 1(t)f (b) using only the function values f (a) and f (b). The subscripts on Hp(t) and hp(t) denote that they are polynomials of degree p. According to Definition 2, h0 1(t)f (a) + h1 1(t) and h1 1(t) must satisfy: Thus h0 1(b) = 0, 1(b) = 1. 1(a) = 1, h0 h0 h1 1(a) = 0, h1 1(t) = t−b a−b H1(t) = t − b a − b and h1 a−b 1(t) = a−t a − t a − b f (a) + , which gives: f (b). (9) (10) This is equivalent to the linear interpolation used in the L1 scheme for the Caputo fractional derivative. The error of this interpolation approximation is: f (t) − H1(t) = f ′′(ξ) 2! (t − a) (t − b) , ξ ∈ (a, b). Similarly, it is possible to construct a function by using its values and first-order derivative values, H3(t) = h0 3(t)f (b) + h2 3(t)f ′(a) + h3 3(t)f ′(b) f (t) − H3(t) = (t − a)2 (t − b)2 , ξ ∈ (a, b). Incorporating constraints on the second-order derivative values can obtain: H5(t) = h0 5(t)f (b) + h2 5(t)f ′(a) + h3 5(t)f ′(b) + h4 5(t)f ′′(a) + h5 5(t)f ′′(b) f (t) − H5(t) = (t − a)3 (t − b)3 , ξ ∈ (a, b). 3(t)f (a) + h1 f (4)(ξ) 4! 5(t)f (a) + h1 f (6)(ξ) 6! While higher-degree Hermite interpolation polynomials theoretically yield smaller errors, they are often vulnerable to the impact of rounding errors, which can lead to numerical instability. Additionally, they may exhibit Runge's phenomenon, causing oscillations within the interval between interpolation nodes. As a result, in practical scenarios, piecewise cubic Hermite interpolation polynomials are commonly favored. Jie Hou et al.: Preprint submitted to Elsevier Page 4 of 21 (11) (12) (13) (14) (15) Remark 2. Now, let us attempt to address the question posed in Remark 1. Can we replace the interpolation step in finite difference approximation methods with Hermite interpolation to achieve higher precision in fractional derivative approximations? In traditional numerical methods, even without considering issues of regularity in the solution, direct replacement is not feasible because both the function values and derivative values of the solution are unknown. Using Hermite interpolation would require introducing additional degrees of freedom and solving the problem through implicit iterations. However, it is worth noting that in neural network approaches, it appears that we can directly substitute the interpolation step to achieve this goal. Since the implicit iteration steps are inherently embedded within the neural network optimization process, we can directly execute high-order interpolation approximation methods. 3. Methodology 3.1. A Review of Neural Networks for Solving PDEs and FPDEs This section reviews the applications of neural networks in solving partial differential equations (PDEs) and fractional partial differential equations (FPDEs). We will focus on two main methods: Physics-Informed Neural Networks (PINNs) and Fractional Physics-Informed Neural Networks (fPINNs). Physics-informed Neural Networks (PINNs) PINNs are a type of models that incorporates prior knowledge of physics into the neural network training process [24]. It can infer a continuous solution function u(x, t) based on physical equations. Consider a general nonlinear partial differential equation, which is given by: ut +  x[u] = 0, u(x, 0) = I(x), u(x, t) = B(x, t), x ∈ ∂Ω, t ∈ [0, T ], x ∈ Ω, t ∈ [0, T ], x ∈ Ω, (16) x[⋅] is a nonlinear differential operator, T is the time range. Given the initial condition u(x, 0) = I(x) and where  the boundary condition u(x, t) = B(x, t), x ∈ ∂Ω, our aim is to find the solution function u(x, t) under these known conditions. Firstly, we construct a trial solution: ̃u(x, t) = tf (x, t; θ) + I(x), (17) where f (x, t; θ) is a fully connected neural network, θ denotes the set of parameters for the neural network. ̃u(x, t) naturally satisfies the initial conditions. Secondly, we define the residual of the PDE as: r(x, t) ∶= ̃ut(x, t) +  x [ ̃u(x, t)] , (18) where the partial derivatives of ̃u(x, t) can be effortlessly obtained utilizing automatic differentiation. The loss function of the PINNs model can be expressed as: (θ) = 1 Nb Nb∑ j=1 [ ̃u(xj b, tj b) − B(xj b, tj b) ]2 + 1 Nr Nr∑ j=1 [r(xj r, tj r) ]2 , (19) Nb j=1 b)} b, tj b), B(xj represents the boundary point data, and {xj where {(xj b, tj refers to the internal collocation points, Nb, Nr are the respective number of data points. The internal collocation points are uniformly sampled coordinate points from the domain Ω to compute the residual loss, which enforces ̃u(x, t) to satisfy the governing equation. By continuously adjusting the neural network parameters to minimize the loss function and bringing (θ) as close to zero as possible, we can consider ̃u(x, t) as the approximate solution function when the loss decreases to a minimal value. r, tj r} Nr j=1 with t u, where the time derivative is no longer an integer but a fractional order α, the problem becomes a time-fractional Fractional PINNs (fPINNs) fPINNs are an extension of PINNs, used for solving FPDEs [25]. By replacing ut C Dα 0 partial differential equation. The residual of the FPDE can be expressed as: r(x, t) ∶= C 0 Dα t ̃u(x, t) +  x [ ̃u(x, t)] . (20) Unlike integer-order derivatives, fractional derivatives cannot be obtained directly through automatic differentiation. Therefore, in fPINNs, the time-fractional derivative is approximated using the finite difference L1 scheme, as shown in Eq. 5. Given the spatial location x, C t ̃u(x, t) evaluated at time t depends on all the values of ̃u(x, t) evaluated at Dα 0 all the previous time steps 0, Δt, 2Δt, ⋯ , t. Jie Hou et al.: Preprint submitted to Elsevier Page 5 of 21 3.2. Time-Fractional Hermite Neural Solver (HNS) A simple way to solve time-fractional PDEs is to combine finite difference approximation methods for fractional derivatives with PINNs. However, explicit finite difference approximation methods can only construct interpolation functions based on function values, resulting in low performance. In this paper, we introduce a novel neural network method for solving time-fractional PDEs, utilizing Hermite interpolation. Firstly, we construct a high-order explicit approximation scheme for the fractional derivative based on Hermite interpolation. We then use the high-order explicit approximation scheme to compute residuals for optimizing network parameters. This method takes advantage of the infinitely differentiable properties of neural networks and extends the finite difference approximation methods. This fully leverages the power of neural networks. In addition, this method does not require implicit iterations; instead, it utilizes neural networks to perform explicit, higher-order interpolation for approximating fractional derivatives. As a result, it offers computational efficiency similar to finite difference methods while achieving higher accuracy. Specifically, for the Caputo time-fractional PDEs given by: C 0 Dα t u(x, t) +  x[u] = 0, x ∈ Ω, t ∈ [0, T ], (21) where α is the order of the time derivative and we focus on the case where α ∈ (0, 1). The solution function u(x, t) must satisfy the initial condition u(x, 0) = I(x) and the boundary condition u(x, t) = B(x, t), x ∈ ∂Ω. Firstly, we construct a trial solution for this problem based on the initial condition: ̃u(x, t) = tf (x, t; θ) + I(x), (22) where ̃u(x, t) satisfies the initial condition without any additional constraints. Subsequently, we define the residual and the loss function as: r(x, t) ∶= C (θ) = 1 Nb 0 Dα t ̃u(x, t) +  Nb∑ [ ̃u(xj b, tj b) − B(xj b, tj b) ]2 x [ ̃u(x, t)] , + 1 Nr Nr∑ j=1 [r(xj r, tj r) ]2 , (23) (24) j=1 ] [ ̃u(xj r, tj r) can be obtained through automatic differentiation, while C 0 where  r) will be approximated using x Hermite Interpolation Explicit Approximation. Due to the non-local nature of fractional derivatives, as defined in Definition 1, evaluating r(x, t) using random points in the computational domain requires the introduction of auxiliary nodes from previous time steps, which results in lower computational efficiency. To improve computational efficiency, , where we use equidistant nodes on the time axis to evaluate r(x, t), i.e., is the number of spatial coordinates sampled in the spatial domain Ω, and the spatial coordinates can be sampled Mx uniformly or equidistantly, see Fig. 2. In addition, in this article, we utilize the L-BFGS optimizer to optimize the network parameters. The model architecture is shown in Fig. 1. Mx j=1 ∪ ⋯ ∪ {xj Mx j=1 ∪ {xj r, Δt} r, T } Mx j=1 r, 0} {xj { } t ̃u(xj Dα r, tj Hermite Interpolation Explicit Approximation for Caputo Fractional Derivatives In explicit finite difference approximation methods, we can only construct interpolation functions based on function values, which greatly limits the accuracy of numerical methods. In this paper, we leverage the infinitely differentiable properties of neural networks and use Hermite interpolation methods to construct high-order interpolation explicit approximation methods based on both function and derivative values. This paper primarily investigates time-fractional partial differential equations, So let us focus on the temporal dimension. For clarity, we will use the example of the fractional ordinary differential equation to illustrate the Hermite Interpolation Explicit Approximation for Caputo Fractional Derivatives. To utilize Hermite interpolation, it is necessary to assume the regularity of the solution, by assuming that u(t) ∈ C p+1[0, T ]. Hermite Interpolation Explicit Approximation Let t ∈ (0, T ] and α ∈ (0, 1) be given. Take a positive integer N. Let Δt = T N and tk = kΔt, 0 ≤ k ≤ N. Then, we have: C 0 Dα t u(t) ∣t=tn = 1 Γ(1 − α) ∫ 0 tn u′(t) (tn − t)α dt = 1 Γ(1 − α) n ∑ k=1 tk ∫ tk−1 u′(t) (tn − t)α dt. Jie Hou et al.: Preprint submitted to Elsevier (25) Page 6 of 21 Fig. 1: HNS for 1D problem: Blue dots are known points, green dots are boundaries, and yellow dots are sampling points. After inputting them into the neural network, they become known points (blue) for calculating Caputo fractional-order derivatives using Hermite interpolation approximation. Fig. 2: HNS: the spatial coordinates can be sampled uniformly or equidistantly. On the interval [tk−1, tk], we perform Hermite interpolation on u(t) using formulas Eq. 10, Eq. 12, Eq. 14 to obtain: u(t) ≈ Hp(t), Thus, we obtain the Hermite approximation scheme for computing C 0 Dα t u(t) ∣t=tn : Dα t u(tn) = 1 Γ(1 − α) n ∑ k=1 tk ∫ tk−1 H ′ p(t) (tn − t)α dt, (26) (27) where Hp(t) is a polynomial of degree p and H ′ obtained using symbolic computation to obtain an exact expression in advance. p(t) is a polynomial of degree p − 1. The integration operation can be Jie Hou et al.: Preprint submitted to Elsevier Page 7 of 21 !"!#!$%......&&&&...&&&&'InputHiddenOutput((!,%;+,-%⋅'+0Transform.........%!0Δ%2Δ%3Δ%(6−1)Δ%6Δ%:;(!,%)%<="%<>?@AB?@:;C(!,%)(%$−%)DE%F?D-(!,%$)GH[,-(!,%$)]Automatic Differentiation,-!,%<,,-′!,%<,,-CC(!,%<),L=0,1,...,6AD:!"#$!#%!#&""... Theorem 2. Suppose u(t) ∈ C p+1[0, T ], then the approximation error is given by: ∣ R(u(tn)) ∣ ≤ 1 (p + 1)!Γ(1 − α) 1 2p+1 ⎡ ⎢ ⎢ ⎣ + α Γ( 3+p 2 )Γ( 1−2α+p Γ(2 − α + p) 2 ) ⎤ ⎥ ⎥ ⎦ max ≤ξ≤tn t0 u(p+1)(ξ)| | | | | | Δtp+1−α (28) The proof can be found in Appendix A. Remark 3. The Hermite interpolation Explicit approximation for Caputo fractional derivatives theoretically has a numerical accuracy of p + 1 − α order. When p = 1, i.e., using function values at both endpoints for interpolation, the method has the same numerical accuracy as the standard L1 scheme, which is 2 − α order. When p = 3, i.e., using function values at both endpoints and first derivative values for interpolation, the method has a numerical accuracy of 4 − α order. When p = 5, i.e., using function values at both endpoints, first derivative values, and second derivative values for interpolation, the method has a numerical accuracy of 6 − α order. Due to the influence of floating-point errors and numerical issues during neural network optimization, the accuracy cannot reach the ideal state when p = 5. Therefore, the commonly used case is p = 3, i.e., using function values and first derivative values for interpolation. The floating-point errors and numerical issues during neural network optimization Higher-order Hermite interpolation can generate high-degree polynomials, and the coefficients of these polynomials are dependent on the interval spacing of the interpolation region. The coefficients of the polynomial of degree p generated by Hermite interpolation contain 1∕Δtp, and these coefficients are involved in the calculations of neural networks. Therefore, when p is large and Δt is small, it is likely to cause floating-point errors and numerical issues during neural network optimization. Therefore, to ensure stable optimization of the neural network, we employ the double data type within the network. otherwise, it may lead to premature convergence, impacting the final accuracy. However, we do not need to be overly concerned about the additional time cost brought by double precision. Actually, from an experimental perspective, for a given equation, the model and data are not exceedingly large, and double precision does not significantly consume more time. Finally, these problems are also related to the computational process, and it might be possible to address this issue by simplifying expressions in advance to eliminate smaller values that arise during calculations. This is a consideration the authors are contemplating. 4. Results In this section, we will demonstrate the performance of the HNS. We denote the HNS employing Hermite interpolation polynomial of degree p as the p-th order HNS. We denote the number of time nodes as Mt = N + 1 and the time step as Δt = T∕N. The number of spatial nodes is denoted as Mx . In our experiments, we evaluate the performance of the HNS by the relative L2 error ∥ ̃u−u∥2∕∥u∥2 . Code is developed using PyTorch, the activate function nn.GELU () [45] and double data type are employed. We validate the high performance of HNS in six computational scenarios:(1)Fractional differential equation;(2)One- Dimensional Time-Fractional diffusion equation;(3)Two-Dimensional Time-Fractional advection-diffusion equation;(4)3- Dimensional Time-Fractional advection-diffusion equation;(5)10-Dimensional Time-Fractional advection-diffusion equation;(6)The Inverse Problem for 3-Dimensional Time-Fractional advection-diffusion equation. 4.1. Fractional differential equation Consider the following fractional differential equation: C 0 Dα t u(t) = u(t) + Γ(3) Γ(3 − α) t2−α − t2 − 1, t ∈ [0, T ], (29) with the initial condition u(0) = 1. where T is the time range. The exact solution for this equation is u(t) = 1 + t2. In this problem, we construct the trial solution: ̃u(t) = tf (t; θ) + 1, Jie Hou et al.: Preprint submitted to Elsevier (30) Page 8 of 21 Table 1 FDE: The relative L2 error for different time intervals. α = 0.3 α = 0.5 α = 0.7 Mt 6 11 21 41 81 101 p = 1 p = 3 p = 5 p = 1 p = 3 p = 5 p = 1 p = 3 p = 5 1.83e-01 5.72e-02 1.88e-02 6.17e-03 2.04e-03 1.42e-03 1.31e-03 6.92e-05 6.47e-05 8.94e-05 6.76e-05 6.03e-06 1.37e-03 6.05e-05 6.90e-05 9.54e-05 8.72e-05 8.66e-05 2.60e-01 8.65e-02 3.10e-02 1.12e-02 4.10e-03 2.95e-03 2.82e-03 4.45e-05 1.24e-05 5.88e-06 4.70e-06 4.63e-06 2.64e-03 6.27e-05 1.22e-05 1.15e-04 9.94e-05 9.42e-05 3.82e-01 1.34e-01 5.24e-02 2.12e-02 8.62e-03 6.46e-03 5.18e-03 8.54e-05 1.86e-05 7.15e-06 5.54e-06 5.01e-06 5.14e-03 8.66e-05 1.86e-05 1.25e-04 9.65e-05 8.14e-05 where f (t; θ) is a fully connected neural network with four hidden layers, each with 20 neurons. While at this point, the neural network only needs to learn a linear function, it is still possible to assess the performance of HNS. We study the performance of the HNS in handling this problem, and 1000 equally spaced test points used to calculate the prediction is set to 3 and 6, respectively. error. In the experiment, the time range T is set to 2, and the number of time nodes Mt Fig. 3: FDE: Comparison of the predicted solution and the exact solution when α = 0.5, with p representing the p-th order HNS. left: Mt = 3 and right: Mt = 6. Fig. 3 shows the comparison of the predicted and exact solutions when α = 0.5. It is important to note that the Hermite interpolation explicit approximation is equivalent to the traditional L1 scheme when p = 1. The results indicate that the third-order or fifth-order HNS achieves improved predictive results when Mt = 3 or Mt = 6. For third-order HNS at Mt = 6, the relative L2 error is reduced to as low as 2.82e − 3. Additionally, although a higher level of accuracy is theoretically expected for fifth-order HNS, this improvement is not significantly evident in practice. No significant differences in accuracy are observed between the third-order HNS and fifth-order HNS. Additionally, in terms of computational time, they are not as significant as initially anticipated. For specific details, please refer to Table 8 in Appendix B.1. Table 1 presents the relative L2 errors of the model at T = 2 for different time intervals. The table shows that the HNS achieves low errors for any value of α. Additionally, both the third-order and fifth-order HNS show about 2 to 3 orders of magnitude higher accuracy than the HNS using linear Hermite interpolation. When the time interval is is small, the accuracy of the fifth-order HNS is similar to that of the third-order HNS. However, large, that is, when Mt when the time interval is small, the fifth-order HNS actually reduces the accuracy. This is possibly due to floating- point errors and numerical issues during neural network optimization. Consequently, the third-order HNS provides the highest performance. Jie Hou et al.: Preprint submitted to Elsevier Page 9 of 21 0.000.250.500.751.001.251.501.752.00t05101520u(t)Exactp=1p=3p=50.000.250.500.751.001.251.501.752.00t123456u(t)Exactp=1p=3p=5 Fig. 4: FDE: Comparison of the method proposed in this paper with the classical finite difference method based on the L1 schema in the time dimension when α = 0.5. Finally, we also compared HNS with finite difference numerical methods based on the L1 schema. Fig. 4 illustrates the accuracy comparison between standard FDM and different-order HNS for various time intervals. The results indicate that the accuracy of FDM is essentially equivalent to that of HNS with p = 1, which is evident because when p = 1, the fractional derivative approximation method used in HNS is equivalent to the L1 scheme. This also suggests that, given a numerical scheme, neural networks can learn the corresponding level of solution accuracy. Third-order HNS exhibits the highest precision, with accuracy of FDM dropping below 1e − 3 only after Mt > 200, while third-order HNS achieves errors below 1e − 4 by Mt = 11. However, for fifth-order HNS, its accuracy is similar to third-order HNS when the time interval is relatively large. Still, as the time interval decreases, fifth-order HNS becomes unstable due to numerical issues, resulting in significant errors. 4.2. Time-Fractional diffusion equation Next, let us consider the following time fractional diffusion equation: Dα t u(x, t) = uxx, x ∈ [0, L], t ∈ [0, T ] C 0 u(x, 0) = I(x), x ∈ [0, L] u(0, t) = B(0, t), u(L, t) = B(L, t), t ∈ [0, T ] ⎧ ⎪ ⎨ ⎪ ⎩ (31) and B(1, t) = 1 + 2tα where I(x) = x2, B(0, t) = 2tα Γ(1+α) Γ(1+α) spatial and temporal ranges, respectively. The exact solution for this equation is u(x, t) = x2 + 2tα Γ(1+α) we construct a trial solution . In this paper, we consider L = 1 and T = 1 as the . For this issue, ̃u(x, t) = tf (x, t; θ) + x2 (32) where f (x, t; θ) represents a fully connected neural network with the number of layers and neurons consistent with previous experiments. In this experiment, a uniform grid of 100 × 100 points is employed to test the model. Fig. 5 displays the performance of the HNS with α = 0.65, Mt = 21, and Mx = 11. The results indicate that higher- order HNS show faster convergence rates. As the convergence rate of the third-order HNS is faster, the time taken for convergence is quite close between the first-order and third-order HNS. However, the fifth-order HNS, after iterating over a thousand rounds, takes longer than the other models that iterate 3000 rounds. In terms of accuracy, both the third-order and fifth-order HNS demonstrate extremely high precision. Therefore, in terms of overall performance, the third-order HNS shows the highest level. Fig. 6 illustrates the variations in relative L2 error with the number of temporal nodes Mt when α = 0.65. When Mx is fixed at 11, the relative L2 errors of the first-order and third-order HNS gradually decrease as the time interval reduces. However, the accuracy of the fifth-order HNS shows a phenomenon of first decreasing and then or spatial nodes Mx Jie Hou et al.: Preprint submitted to Elsevier Page 10 of 21 0100200300400500600700800Mt105104103102101100L2errorFDMp=1p=3p=5 Fig. 5: TFDE: The loss curve, computation time in seconds, and relative L2 error of the HNS with α = 0.65, Mt = 21, and Mx = 11. increasing, which may be affected by floating-point errors and numerical issues during neural network optimization. In addition, when Mt increases, the accuracy of the first-order and third-order model does not show significant changes, while the relative L2 errors of the fifth-order HNS exists fluctuations. Both the third-order and fifth-order HNS have very high precision. is fixed at 41, as Mx Table 2 displays the L2 error of the HNS model at different Caputo derivative orders and time intervals with Mx = 11. It can be observed from the table that the HNS can solve the problem well for any α. The third-order and fifth-order HNS have higher accuracy. Fig. 6: TFDE: The relative L2 error varies with changes in the number of time nodes Mt or spatial nodes Mx , when α = 0.65. 4.3. Time-Fractional advection-diffusion equation In order to further illustrate the advantages of the model, we study the performance of the HNS in solving the two- dimensional fractional advection-diffusion equation. Consider the following fractional advection-diffusion equation: Jie Hou et al.: Preprint submitted to Elsevier Page 11 of 21 0100020003000Epoch107105103101101Lossp=1p=3p=5135p050100150200Time135p0.0000.0010.0020.0030.004L2error20406080100Mt104103102relative L2 error, Mx=11p=1p=3p=51020304050Mx103relative L2 error, Mt=41p=1p=3p=5 Table 2 TFDE: The relative L2 error for different time intervals. α = 0.45 α = 0.65 α = 0.85 Mt 6 11 21 41 61 81 101 p = 1 p = 3 p = 5 p = 1 p = 3 p = 5 p = 1 p = 3 p = 5 1.39e-02 9.79e-03 7.19e-03 2.80e-03 2.17e-03 1.73e-03 1.53e-03 1.73e-02 8.84e-03 3.81e-03 1.06e-03 2.76e-04 1.40e-04 1.66e-04 1.74e-02 8.40e-03 3.87e-03 1.22e-03 3.68e-04 3.44e-04 9.95e-04 1.52e-02 8.80e-03 4.64e-03 2.45e-03 1.71e-03 1.36e-03 1.22e-03 6.05e-03 2.47e-03 9.92e-04 2.60e-04 1.11e-04 1.04e-04 3.78e-05 4.73e-03 1.98e-03 8.51e-04 2.22e-04 1.70e-04 8.11e-04 8.50e-04 5.52e-03 4.01e-03 2.29e-03 1.33e-03 1.00e-03 8.86e-04 8.12e-04 1.57e-03 5.33e-04 1.73e-04 6.05e-05 5.53e-05 2.03e-05 4.25e-05 1.58e-03 5.32e-04 1.68e-04 9.24e-05 4.60e-04 4.47e-04 3.80e-04 Table 3 TFADE: The relative L2 error for different time intervals. Mx = 11 × 11 α = 0.7 α = 0.8 α = 0.9 Mt 6 11 21 41 81 p = 1 p = 3 p = 5 p = 1 p = 3 p = 5 p = 1 p = 3 p = 5 6.05e-03 3.18e-03 1.70e-03 8.51e-04 4.41e-04 1.93e-04 1.73e-04 1.27e-04 1.06e-04 1.58e-04 2.80e-04 3.41e-04 1.31e-04 1.56e-04 2.70e-04 8.89e-03 4.02e-03 2.32e-03 1.32e-03 6.67e-04 3.13e-04 1.45e-04 1.98e-04 1.35e-04 1.62e-04 2.42e-04 2.11e-04 2.02e-04 1.93e-04 5.59e-04 1.13e-02 5.80e-03 3.31e-03 1.94e-03 1.06e-03 3.40e-04 1.74e-04 1.52e-04 1.68e-04 8.62e-05 3.64e-04 1.98e-04 1.49e-04 1.43e-04 8.97e-04 t u(x, t) = κΔu(x, t) + g(x, t), x ∈ Ω = [0, 1]2, t ∈ [0, 1] Dα C 0 u(x, 0) = 0, x ∈ Ω u(x, t) = t2ex+y, x ∈ ∂Ω, t ∈ [0, 1] ⎧ ⎪ ⎨ ⎪ ⎩ (33) In this paper, we employ κ = 1.0 , and g(x, t) = u(x, t) = t2ex+y. For this case, we construct a trial solution: [ 2t2−α Γ(3−α) ] − 2t2 ex+y. The exact solution for this equation is ̃u(x, y, t) = tf (x, y, t; θ), (34) In this experiment, we use a uniform grid of 100 × 100 × 100 points to test the model. We first test the effectiveness of the HNS on this problem. With α = 0.85, Mt = 11, Mx = 11 × 11, we use the third-order HNS to solve the problem. The results show that the relative L2 error is 1.66e − 04, which demonstrates the high accuracy of the third-order HNS. The performance of the HNS is evaluated with different values of α, and the experimental results are presented in Table 3. It is observed that higher accuracy is achieved by the third-order and fifth-order HNS. 4.4. 3D Time-Fractional advection-diffusion equation Now, let us address a higher-dimensional advection-diffusion equation. Firstly, we consider the following problem defined in a 3D cubic domain: C 0 Dα t u(x, t) − Δu(x, t) + (1, 1, 1) ⋅ ∇u(x, t) − g(x, t) = 0, x ∈ Ω = (0, 1)3 ∈ R3 (35) The analytical solution for this equation is chosen as u(x, t) = t2 + cos(x) + cos(y) + cos(z),with initial conditions u(x, 0) = cos(x) + cos(y) + cos(z). For this case, we construct a trial solution: ̃u(x, y, z, t) = tf (x, y, z, t; θ) + cos(x) + cos(y) + cos(z), (36) In this experiment, we employ a uniform grid consisting of 51 × 51 × 51 × 51 points to evaluate the model. The time range is [0, 1], and Mx = 11 × 11 × 11. The performance of the HNS is evaluated with α = 0.5, and the experimental Jie Hou et al.: Preprint submitted to Elsevier Page 12 of 21 Table 4 FPDE-3D: The relative L2 error and training cost for different time intervals. α = 0.5 Mt 3 6 11 21 p = 1 4.41e-03 4.57e-04 2.23e-04 9.66e-05 cost(s) 149.21 232.78 370.09 860.74 p = 3 1.72e-03 5.86e-05 3.62e-05 2.94e-05 cost(s) 153.96 239.83 395.34 881.57 p = 5 1.60e-03 5.93e-05 2.32e-05 3.09e-05 cost(s) 168.77 277.49 514.28 1186.06 results are presented in Table 4. It is observed that higher accuracy is achieved by the third-order and fifth-order HNS. Moreover, the time expenses for the HNS models with p = 1 and p = 3 are comparable, while for p = 5, convergence occurs earlier for larger time intervals, resulting in relatively shorter computation times. However, at Mt = 21, the fifth-order HNS model takes 1186.06 seconds. In this experiment, we construct a trial solution that is suitable. So the neural network only needs to learn a linear function, which simplifies the problem. To thoroughly verify the performance of HNS, we change the analytical solution for this problem to u(x, t) = t2(cos(x1) + cos(x2) + cos(x3)),with initial conditions u(x, 0) = 0. Now, we construct a trial solution: ̃u(x1, x2, x3, t) = tf (x1, x2, x3, t; θ), (37) Additionally, it is worth noting that using equidistant grid points for training models in high-dimensional problems is not suitable. This is because as the dimensionality increases, the number of equidistant points grows exponentially. Therefore, to demonstrate the ability of HNS to handle high-dimensional problems, we utilize uniform sampling to generate spatial coordinates both inside the domain and on the boundaries. This approach helps prevent issues associated with the explosion of dimensions. In this paper, we employ the LHS method to sample training spatial coordinate points. We uniformly sample 5000000 spatiotemporal coordinates to assess the performance of the model. For the training data, we uniformly sample 1000 coordinates in space, i.e., Mx = 1000, with 100 coordinates uniformly sampled along each boundary. At Mt = 6, the relative L2 error of the first-order HNS model is 2.47e − 03. But the relative L2 error of the third-order HNS is 3.66e − 04, which demonstrates the high accuracy of the third-order HNS. 4.5. 10D Time-Fractional advection-diffusion equation Next, we extend the equation from 3D to 10D. We choose the analytical solution for the problem as follows: u(x, t) = t2 N ∑ i cos(xi) where N = 10. The initial condition remains u(x, 0) = 0, so the constructed trial solution is: ̃u(x, t) = tf (x, t; θ), Firstly, we conduct testing on a 10-dimensional advection equation, which takes the following form: C 0 Dα t u(x, t) + (1, 1, 1) ⋅ ∇u(x, t) − g(x, t) = 0, x ∈ Ω = (0, 1)10 ∈ R10 (38) (39) (40) We continue to employ 5000000 spatiotemporal coordinates to assess the performance of the model. For the training data, we uniformly sample 5000 coordinates in space, i.e., Mx = 5000, with 100 coordinates uniformly sampled along each boundary. Due to the complexity of the problem, we set the number of training epochs to 3000, and the specific experimental results are shown in Table 5. The experimental results indicate that both p = 1 and p = 3 HNS models can effectively solve this problem. Meanwhile, the third-order HNS exhibits higher accuracy, and this accuracy does not decrease as the time interval decreases, suggesting that the accuracy has likely reached the limit for this problem. Additionally, the third-order HNS does not show a significant increase in computational time. Jie Hou et al.: Preprint submitted to Elsevier Page 13 of 21 Table 5 10D advection equation: The relative L2 error and training cost for different time intervals. α = 0.5 Mt 6 11 21 p = 1 5.78e-03 2.26e-03 9.19e-04 cost(s) 356.35 538.09 2382.85 p = 3 2.02e-04 2.34e-04 2.16e-04 cost(s) 413.42 773.69 2434.15 Next, we will upgrade the experiment from an advection equation to an advection-diffusion equation, which takes the following form: C 0 Dα t u(x, t) − Δu(x, t) + (1, 1, 1) ⋅ ∇u(x, t) − g(x, t) = 0, x ∈ Ω = (0, 1)10 ∈ R10 (41) We continue to employ Eq. 38 as the analytical solution for the problem and Eq. 39 as the trial solution for HNS. The settings for testing and training data remain the same as before. Since the equation includes spatial second-order derivatives, the model will take more time. However, the model still maintains high accuracy, and its precision does not decrease due to the complexity of the equation. At Mt = 6, the relative L2 error of the first-order HNS model is 1.37e − 03, with a cost of 1074.03. However, the relative L2 error of the third-order HNS is 8.26e − 04, with a cost of 1077.11. Fig. 7 illustrates the results obtained by the third-order HNS, corresponding to t = 1, x3 = x4 = ... = x10 = 0.5. From the figure, it is evident that the HNS results exhibit very small errors when compared to the analytical solution. Fig. 7: 10D Time-Fractional advection-diffusion equation when α = 0.5. 4.6. The Inverse Problem We have already thoroughly demonstrated the excellent performance of HNS on forward problems. In this section, we shift our focus to solving inverse problems. Let us reconsider the 3D advection-diffusion equation: C 0 Dα t u(x, t) − βΔu(x, t) + γ(1, 1, 1) ⋅ ∇u(x, t) − g(x, t) = 0, x ∈ Ω = (0, 1)3 ∈ R3 (42) along with its analytical solution u(x, t) = t2(cos(x1) + cos(x2) + cos(x3)) and initial conditions u(x, 0) = 0. Additionally, g(x, t) is known. In the inverse problem, the goal is to infer (α, β, γ) from a given measurement of u(x, t). First, let us clarify our experimental data. In this problem, we uniformly sample 5000000 spatiotemporal coordinates to assess the performance of the model. For the training data, we uniformly sample 1000 coordinates in space, i.e., Mx = 1000, with 50 coordinates uniformly sampled along each boundary. In the temporal dimension, we set Mt = 6. Additionally, in our model, we treat (α, β, γ) as optimizable parameters that are optimized together Jie Hou et al.: Preprint submitted to Elsevier Page 14 of 21 0.00.51.0x10.000.250.500.751.00x2Exact u8.59.0Pred u8.59.0|u - u|0.0050.0100.015 Table 6 The Inverse Problem for 3D advection-diffusion equation to infer α. α = 0.5 p 1 3 ̃α 0.54235 0.49514 | ̃α − α| 0.04235 0.00486 ∥ ̃u−u∥2∕∥u∥2 1.03e-03 2.47e-04 cost(s) 198.70 214.79 Table 7 The Inverse Problem for 3D advection-diffusion equation to infer (α, β, γ). α = 0.5, β = 1.0, γ = 1.0 p 1 3 ̃α 0.46707 0.49714 | ̃α − α| 0.03293 0.00286 ̃β 1.14661 0.96709 ̃β − β| | 0.14661 0.03291 ̃γ 1.10838 0.95065 |̃γ − γ| 0.10838 0.04935 ∥ ̃u−u∥2∕∥u∥2 1.46e-03 2.75e-04 cost(s) 201.27 209.07 with the parameters of neural network. To solve this inverse problem, we need to include an additional term in the loss function: (θ, α, β, γ) = 1 Nb Nb∑ [ j=1 ̃u(xj b, tj b) − B(xj b, tj b) ]2 + 1 Nr Nr∑ j=1 [r(xj r, tj r) ]2 + 1 Nr Nr∑ j=1 [ ̃u(xj r, tj r) − u(xj r, tj r) ]2 (43) Firstly, we assume that there is only one unknown parameter α in the equation. We use HNS with p = 1 and p = 3 to solve this problem, respectively. We set the initial value of α to 0.2, while its true value is 0.5. Table 6 indicates that the third-order HNS exhibits a significant advantage both in parameter inference and solution accuracy compared to p = 1. Moreover, their computational time difference is not substantial. In this problem, the error in α is only 0.00486. Next, we expand the parameter inference scope and use the HNS model to infer (α, β, γ),setting their initial values to (0.2, 0.2, 0.2). From Table 7, it is evident that HNS has performed admirably in solving the inverse problem, with very small errors for each unknown parameter. Furthermore, the third-order HNS demonstrates superior accuracy. Surprisingly, the error in α has even decreased in this case. 5. Conclusion and Discussion In this paper, we extend the explicit approximation of Caputo fractional derivatives based on Hermite interpolation technique and analyze the approximation error. By utilizing the infinitely differentiable properties of deep neural networks, we naturally combine the Hermite interpolation explicit approximation of Caputo fractional derivatives with deep neural networks to propose an innovative model, called HNS. This model can solve time-fractional partial differential equations with high accuracy. Experimental results show that the accuracy of the third-order HNS is significantly higher than that of the neural network method based on L1 scheme for both forward and inverse problems, as well as in high-dimensional scenarios. The HNS fully utilizes the advantages of neural networks and breaks through the limitation of explicit finite difference methods that can only be interpolated based on function values. This results in deeper integration models between deep neural networks and numerical methods, and opens up new opportunities for integrating deep neural networks with scientific computing technology. The limitation of this work is we focus exclusively on time-fractional partial differential equations. Exploring spatial fractional derivatives and other important fractional partial differential equations represents an exciting direction for future research. Declaration of competing interest The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper. Jie Hou et al.: Preprint submitted to Elsevier Page 15 of 21 Data availability The data and code can be found at https://github.com/hsbhc/HNS. Acknowledgements This work is supported by the National Key Research and Development Program of China (No. 2021YFA1003004). Appendix. A. Approximation Error of Hermite Interpolation Explicit Approximation Theorem 2. Suppose u ∈ C p+1(t0, tn),then the approximation error is given by: ∣ R(u(tn)) ∣ ≤ 1 (p + 1)!Γ(1 − α) ⎡ ⎢ ⎢ ⎣ Proof. From the definition of R(u(tn)), we know that: )Γ( 1−2α+p Γ(2 − α + p) 1 2p+1 Γ( 3+p 2 + α 2 ) ⎤ ⎥ ⎥ ⎦ max ≤ξ≤tn t0 u(p+1)(ξ)| | | | | | Δtp+1−α R(u(tn)) = 1 Γ(1 − α) = 1 Γ(1 − α) n ∑ k=1 n ∑ k=1 tk ∫ tk−1 tk ∫ tk−1 dt − u′(t) 1 (tn − t)α Γ(1 − α) ]′ [u(t) − Hp(t) (tn − t)α dt n ∑ k=1 tk ∫ tk−1 H ′ p(t) (tn − t)α dt Applying the integration by parts formula and noting the error function of Hermite Interpolation, we obtain: R(u(tn)) = − 1 Γ(1 − α) = − 1 Γ(1 − α) n ∑ k=1 n ∑ k=1 tk ∫ tk−1 tk ∫ tk−1 [u(t) − Hp(t) ] d 1 (tn − t)α u(p+1)(ξ) (p + 1)! k ∏ i=k−1 (t − ti ) (p+1) 2 α(tn − t)−α−1dt Thus, ∣ R(u(tn)) ∣≤ 1 (p + 1)!Γ(1 − α) max ≤ξ≤tn t0 u(p+1)(ξ)| | | | | | n ∑ k=1 Two formulas can be obtained by calculation as follows: tk k ∏ ∫ tk−1 i=k−1 (∣ t − ti ∣) (p+1) 2 α(tn − t)−α−1dt (t − tk−1) (p+1) 2 (tk − t) (p+1) 2 α(tn − t)−α−1dt n−1 ∑ tk ∫ tk−1 k=1 ≤ Δtp+1 2p+1 = = Δtp+1 2p+1 ∫ t0 Δtp+1 2p+1 n−1 ∑ k=1 tk ∫ tk−1 α(tn − t)−α−1dt tn−1 α(tn − t)−α−1dt (Δt−α − t−α n ) ≤ 1 2p+1 Δtp+1−α (44) (45) (46) (47) (48) Jie Hou et al.: Preprint submitted to Elsevier Page 16 of 21 and: tn (t − tn−1) (p+1) 2 (tn − t) (p+1) 2 α(tn − t)−α−1dt ∫ tn−1 tn α ∫ tn−1 Δt = α ∫ 0 Γ( 3+p 2 = α (t − tn−1) (p+1) 2 (tn − t) (p+1) 2 −α−1dt (Δt − ξ) (p+1) 2 ξ (p+1) 2 −α−1dξ )Γ( 1−2α+p Γ(2 − α + p) 2 ) Δtp+1−α Substituting Eq. 48 and Eq. 49 into Eq. 47, we obtain: ∣ R(u(tn)) ∣ ≤ 1 (p + 1)!Γ(1 − α) 1 2p+1 ⎡ ⎢ ⎢ ⎣ + α Γ( 3+p 2 )Γ( 1−2α+p Γ(2 − α + p) 2 ) ⎤ ⎥ ⎥ ⎦ max ≤ξ≤tn t0 u(p+1)(ξ)| | | | | | Δtp+1−α (49) (50) B. Additional results In this section, we present additional results that help clarify details of our method. B.1. Fractional differential equation Fig. 8: FDE: Comparison between predicted and exact solutions, the absolute error at each time step with the third-order HNS, using parameters α = 0.5, Mt = 11, and p = 3. Fig. 8 and Fig. 9 demonstrate the predictive results and convergence process of the third-order HNS. During the training process, a large time interval of Mt = 11 is utilized, yet the relative L2 error of the third-order HNS is as low as 4.45e − 05. And the absolute error increases as t increases. This effectively illustrates the high accuracy of the third-order HNS. Upon examining the loss curve, it is evident that the convergence rate of the third-order HNS is remarkably fast. training cost Due to the need to compute second-order derivatives, the computational cost for p = 5 is considerably high. Theoretically, the time cost follows the order: p = 1 < p = 3 < p = 5. However, p = 3 and p = 5 converge faster because they utilize function values, derivatives, or higher-order derivatives for interpolation. This essentially compensates for the disadvantage in terms of computational time, possibly resulting in p = 3 and p = 5 having lower time costs compared to p = 1. See Table 8 Jie Hou et al.: Preprint submitted to Elsevier Page 17 of 21 Fig. 9: FDE: The iterative decrease in training loss with the third-order HNS, using parameters α = 0.5, Mt = 11, and p = 3. Table 8 FDE: The relative L2 error and training cost. Training 3000 epochs. α = 0.5 Mt 6 11 21 41 81 101 p = 1 2.60e-01 8.65e-02 3.10e-02 1.12e-02 4.10e-03 2.95e-03 cost(s) p = 3 cost(s) p = 5 0.20 10.69 15.38 22.92 36.62 45.92 2.82e-03 4.45e-05 1.24e-05 5.88e-06 4.70e-06 4.63e-06 0.33 0.61 27.95 48.31 2.29 4.80 2.64e-03 6.27e-05 1.22e-05 1.15e-04 9.94e-05 9.42e-05 cost(s) 0.91 104.84 6.99 7.30 12.07 13.56 B.2. Time-Fractional diffusion equation Fig. 10 and Fig. 11 illustrate the predictive results and convergence process of the third-order HNS, which achieves a remarkably low relative L2 error of 3.39e − 04 for time-fractional PDEs. Unlike previous experiments, we observe that the absolute error does not increase with time for this problem. As shown in the figure, the error is large near t = 0 but relatively small for later time steps. This phenomenon may be related to the optimization process of the third-order HNS, and we will further analyze it using Neural Tangent Kernel(NTK) in future work. B.3. Time-Fractional advection-diffusion equation Fig. 12 and Fig. 13 illustrates the predictive results of the third-order HNS, which achieves a remarkably low relative L2 error of 1.66e − 04 for this problem. References [1] I. Podlubny, An introduction to fractional derivatives, fractional differential equations, to methods of their solution and some of their applications, Math. Sci. Eng 198 (1999) 340. [2] A. A. Kilbas, H. M. Srivastava, J. J. Trujillo, Theory and applications of fractional differential equations, volume 204, elsevier, 2006. [3] Y.-X. Li, T. Muhammad, M. Bilal, M. A. Khan, A. Ahmadian, B. A. Pansera, Fractional simulation for darcy-forchheimer hybrid nanoliquid flow with partial slip over a spinning disk, Alexandria Engineering Journal 60 (2021) 4787–4796. [4] F. Song, C. Xu, G. E. Karniadakis, A fractional phase-field model for two-phase flows with tunable sharpness: algorithms and simulations, Computer Methods in Applied Mechanics and Engineering 305 (2016) 376–404. [5] A. Beltempo, M. Zingales, O. S. Bursi, L. Deseri, A fractional-order model for aging materials: An application to concrete, International Journal of Solids and Structures 138 (2018) 13–23. [6] F. Mainardi, Fractional calculus and waves in linear viscoelasticity: an introduction to mathematical models, World Scientific, 2022. [7] C. Ionescu, A. Lopes, D. Copot, J. T. Machado, J. H. Bates, The role of fractional calculus in modeling biological phenomena: A review, Communications in Nonlinear Science and Numerical Simulation 51 (2017) 141–159. Jie Hou et al.: Preprint submitted to Elsevier Page 18 of 21 Fig. 10: TFDE: Comparison between predicted and exact solutions with the third-order HNS, using parameters α = 0.5, Mt = 51, Mx = 11. Fig. 11: TFDE:The absolute error, and the iterative decrease in training loss with the third-order HNS, using parameters α = 0.5, Mt = 51, Mx = 11. Fig. 12: TFADE: Comparison between predicted and exact solutions of t = 1 with the third-order HNS, using parameters α = 0.85, Mt = 11, Mx = 11 × 11. Jie Hou et al.: Preprint submitted to Elsevier Page 19 of 21 Fig. 13: TFADE: The iterative decrease in training loss with the third-order HNS, using parameters α = 0.85, Mt = 11, Mx = 11 × 11. [8] V. E. Tarasov, On history of mathematical economics: Application of fractional calculus, Mathematics 7 (2019) 509. [9] T. Chen, D. Wang, Combined application of blockchain technology in fractional calculus model of supply chain financial system, Chaos, Solitons & Fractals 131 (2020) 109461. [10] H. Sun, Y. Zhang, D. Baleanu, W. Chen, Y. Chen, A new collection of real world applications of fractional calculus in science and engineering, Communications in Nonlinear Science and Numerical Simulation 64 (2018) 213–231. [11] E. Sousa, Finite difference approximations for a fractional advection diffusion problem, Journal of Computational Physics 228 (2009) 4038– 4054. [12] N. Sweilam, M. Khader, R. Al-Bar, Numerical studies for a multi-order fractional differential equation, Physics Letters A 371 (2007) 26–33. [13] Y. Lin, C. Xu, Finite difference/spectral approximations for the time-fractional diffusion equation, Journal of computational physics 225 (2007) 1533–1552. [14] A. H. Bhrawy, Y. A. Alhamed, D. Baleanu, A. A. Al-Zahrani, New spectral techniques for systems of fractional differential equations using fractional-order generalized laguerre orthogonal functions, Fractional Calculus and Applied Analysis 17 (2014) 1137–1157. [15] S. Kazem, S. Abbasbandy, S. Kumar, Fractional-order legendre functions for solving fractional-order differential equations, Applied Mathematical Modelling 37 (2013) 5498–5510. [16] H. Jafari, S. A. Yousefi, M. Firoozjaee, S. Momani, C. M. Khalique, Application of legendre wavelets for solving fractional differential equations, Computers & Mathematics with Applications 62 (2011) 1038–1045. [17] T. Langlands, B. I. Henry, The accuracy and stability of an implicit solution method for the fractional diffusion equation, Journal of Computational Physics 205 (2005) 719–736. [18] Y. Gu, H. Sun, A meshless method for solving three-dimensional time fractional diffusion equation with variable-order derivatives, Applied Mathematical Modelling 78 (2020) 539–549. [19] Y. LeCun, Y. Bengio, G. Hinton, Deep learning, nature 521 (2015) 436–444. [20] C. M. Bishop, Neural networks and their applications, Review of scientific instruments 65 (1994) 1803–1832. [21] G. E. Karniadakis, I. G. Kevrekidis, L. Lu, P. Perdikaris, S. Wang, L. Yang, Physics-informed machine learning, Nature Reviews Physics 3 (2021) 422–440. [22] L. Lu, X. Meng, Z. Mao, G. E. Karniadakis, DeepXDE: A deep learning library for solving differential equations, SIAM review 63 (2021) 208–228. [23] M. Raissi, A. Yazdani, G. E. Karniadakis, Hidden fluid mechanics: Learning velocity and pressure fields from flow visualizations, Science 367 (2020) 1026–1030. [24] M. Raissi, P. Perdikaris, G. E. Karniadakis, Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations, Journal of Computational physics 378 (2019) 686–707. [25] G. Pang, L. Lu, G. E. Karniadakis, fpinns: Fractional physics-informed neural networks, SIAM Journal on Scientific Computing 41 (2019) A2603–A2626. [26] Y. Ye, H. Fan, Y. Li, X. Liu, H. Zhang, Deep neural network methods for solving forward and inverse problems of time fractional diffusion equations with conformable derivative, Neurocomputing 509 (2022) 177–192. [27] M. Pakdaman, A. Ahmadian, S. Effati, S. Salahshour, D. Baleanu, Solving differential equations of fractional order using an optimization technique based on training artificial neural network, Applied Mathematics and Computation 293 (2017) 81–95. [28] H.-D. Qu, X. Liu, X. Lu, M. ur Rahman, Z.-H. She, Neural network method for solving nonlinear fractional advection-diffusion equation with spatiotemporal variable-order, Chaos, Solitons & Fractals 156 (2022) 111856. [29] C. Biswas, A. Singh, M. Chopra, S. Das, Study of fractional-order reaction-advection-diffusion equation using neural network method, Mathematics and Computers in Simulation (2023). Jie Hou et al.: Preprint submitted to Elsevier Page 20 of 21 [30] S. Wang, H. Zhang, X. Jiang, Physics-informed neural network algorithm for solving forward and inverse problems of variable-order space- fractional advection–diffusion equations, Neurocomputing 535 (2023) 64–82. [31] Y. Ye, Y. Li, H. Fan, X. Liu, H. Zhang, Slenn-elm: A shifted legendre neural network method for fractional delay differential equations based on extreme learning machine, NHM 18 (2023) 494–512. [32] Z. Hajimohammadi, F. Baharifard, A. Ghodsi, K. Parand, Fractional Chebyshev deep neural network (FCDNN) for solving differential models, Chaos, Solitons & Fractals 153 (2021) 111530. [33] X.-B. Yan, Z.-Q. J. Xu, Z. Ma, Laplace-fpinns: Laplace-based fractional physics-informed neural networks for solving forward and inverse problems of subdiffusion, arXiv preprint arXiv:2304.00909 (2023). [34] P.-H. Chiu, J. C. Wong, C. Ooi, M. H. Dao, Y.-S. Ong, CAN-PINN: A fast physics-informed neural network based on coupled-automatic– numerical differentiation method, Computer Methods in Applied Mechanics and Engineering 395 (2022) 114909. [35] R. Sharma, V. Shankar, Accelerated Training of Physics-Informed Neural Networks (PINNs) using Meshless Discretizations, Advances in Neural Information Processing Systems 35 (2022) 1034–1046. [36] Z.-z. Sun, X. Wu, A fully discrete difference scheme for a diffusion-wave system, Applied Numerical Mathematics 56 (2006) 193–209. [37] B. Jin, R. Lazarov, Z. Zhou, An analysis of the l1 scheme for the subdiffusion equation with nonsmooth data, IMA Journal of Numerical Analysis 36 (2016) 197–221. [38] J. Cao, C. Li, Y. Chen, High-order approximation to Caputo derivatives and Caputo-type advection-diffusion equations (II), Fractional calculus and Applied analysis 18 (2015) 735–761. [39] Y. Ying, Y. Lian, S. Tang, W. K. Liu, High-order central difference scheme for Caputo fractional derivative, Computer Methods in Applied Mechanics and Engineering 317 (2017) 42–54. [40] E. Süli, D. F. Mayers, An introduction to numerical analysis, Cambridge university press, 2003. [41] W. K. Zahra, S. M. Elkholy, et al., The use of cubic splines in the numerical solution of fractional differential equations, International Journal of Mathematics and Mathematical Sciences 2012 (2012). [42] S.-P. Yang, A.-G. Xiao, et al., Cubic spline collocation method for fractional differential equations, Journal of Applied Mathematics 2013 (2013). [43] F. Pitolli, C. Sorgentone, E. Pellegrino, Approximation of the riesz–caputo derivative by cubic splines, Algorithms 15 (2022) 69. [44] K. S. Miller, B. Ross, An introduction to the fractional calculus and fractional differential equations, Wiley, 1993. [45] D. Hendrycks, K. Gimpel, Gaussian error linear units (gelus), arXiv preprint arXiv:1606.08415 (2016). Jie Hou et al.: Preprint submitted to Elsevier Page 21 of 21
http://arxiv.org/abs/2310.04788v1
"2023-10-07T12:43:32"
"2023-10-07T12:43:32"
PMNN:Physical Model-driven Neural Network for solving time-fractional differential equations
In this paper, an innovative Physical Model-driven Neural Network (PMNN) method is proposed to solve time-fractional differential equations. It establishes a temporal iteration scheme based on physical model-driven neural networks which effectively combines deep neural networks (DNNs) with interpolation approximation of fractional derivatives. Specifically, once the fractional differential operator is discretized, DNNs are employed as a bridge to integrate interpolation approximation techniques with differential equations. On the basis of this integration, we construct a neural-based iteration scheme. Subsequently, by training DNNs to learn this temporal iteration scheme, approximate solutions to the differential equations can be obtained. The proposed method aims to preserve the intrinsic physical information within the equations as far as possible. It fully utilizes the powerful fitting capability of neural networks while maintaining the efficiency of the difference schemes for fractional differential equations. Moreover, we validate the efficiency and accuracy of PMNN through several numerical experiments.
[ "Zhiying Ma", "Jie Hou", "Wenhao Zhu", "Yaxin Peng", "Ying Li" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04788v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04788v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.NA", "math.NA" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 8 8 7 4 0 . 0 1 3 2 : v i X r a PMNN: Physical Model-driven Neural Network for solving time-fractional differential equations Zhiying Ma1, Jie Hou2, Wenhao Zhu2, Yaxin Peng1*, and Ying Li2* 1Department of Mathematics, School of Science, Shanghai University, Shanghai, 200444, PR China 2School of Computer Engineering and Science, Shanghai University, Shanghai, 200444, PR China Abstract In this paper, an innovative Physical Model-driven Neural Network (PMNN) method is proposed to solve time-fractional differential equations. It establishes a temporal iteration scheme based on physical model-driven neural networks which effectively combines deep neural networks (DNNs) with interpolation approximation of fractional derivatives. Specifi- cally, once the fractional differential operator is discretized, DNNs are employed as a bridge to integrate interpolation approximation techniques with differential equations. On the basis of this integration, we construct a neural-based iteration scheme. Subsequently, by training DNNs to learn this temporal iteration scheme, approximate solutions to the dif- ferential equations can be obtained. The proposed method aims to preserve the intrinsic physical information within the equations as far as possible. It fully utilizes the powerful fit- ting capability of neural networks while maintaining the efficiency of the difference schemes for fractional differential equations. Moreover, we validate the efficiency and accuracy of PMNN through several numerical experiments. Keywords: Deep neural network; Physical model-driven; Iteration scheme approximation; Time- fractional differential equation *Corresponding author: yinglotus@shu.edu.cn (Ying Li), yaxin.peng@shu.edu.cn (Yaxin Peng) 1 1 Introduction In the study of fractional differential equations (FDEs), researchers have observed that fractional- order differential operators possess non-local properties, which distinguishes them from integer- order differential operators. As a result, FDEs are well-suited for describing dynamic processes in the real world that involve memory and hereditary characteristics. FDEs have been widely applied in various fields [1] such as anomalous diffusion, viscoelasticity, fluid mechanics, elec- tromagnetic waves, statistical models, signal processing and system identification, quantum economics, fractal theory, robotics, etc. However, it is extremely challenging to obtain analyt- ical solutions for FDEs. Even if exact solutions can be obtained, they may involve complex functions like Mittag-Leffler functions, H functions, Wright functions, and so on [2]. Dealing with these functions in numerical computations is complicated. Therefore, finding effective numerical simulation methods for fractional differential equations has become one of the im- portant research topics. In recent decades, researchers have made significant advancements in the numerical solution of FDEs. Various numerical solution techniques have been developed, including finite difference method (FDM) [1, 3], finite element method (FEM) [4, 5], spectral methods [6, 7, 8], Wavelet methods [9, 10, 11], matrix methods [12, 13, 14], Laplace transforms [15], variational iteration methods [16], and Adomian decomposition methods [17, 18, 19]. These traditional numerical methods have made significant advancements in the solving of fractional- order equations and dealing with fractional order derivatives. These advancements have laid the foundation for other innovative numerical methods of FDEs. With the rapid advancement of deep learning technology, an increasing number of scholars have embarked on the exploration of employing deep learning for solving differential equations. As one of fundamental models in the field of deep learning, DNNs exhibit not only remarkable fitting capabilities but also the capacity to learn and optimize models in an adaptive manner. Consequently, the utilization of deep learning for solving differential equations has emerged as a burgeoning research direction that gains significant attention. Currently, a multitude of neural network-based methods have been proposed for solving integer-order differential equa- tions. For instance, Lagaris et al. were among the pioneers who successfully applied Artificial 2 Neural Networks (ANNs) to solve integer-order differential equations. They employed ANNs to construct trial solutions for solving initial value and boundary value problems [20]. Raissi et al. introduced the Physics-Informed Neural Networks (PINNs) approach, a new class of uni- versal function approximators that is capable of encoding any underlying physical laws present in a given dataset [21]. Due to its high predictive accuracy and robustness, PINNs rapidly became a benchmark method in the field, leading many researchers to conduct related studies [22, 23, 24, 25, 26]. Lu et al. introduced DeepONets, a deep operator network, to accurately and effectively learn nonlinear operators from relatively small datasets [27]. These approaches mentioned above are all based on data-driven deep neural network methods, which are charac- terized by their fast prediction speed. The features required by data-driven methods depend only on the training data [28]. In practical applications, it is important to note that differential equations contain many physical laws. Therefore, relying solely on sampled data to capture information may result in incomplete findings. For certain complex equations, even if enough training data is selected, it remains challenging to accurately capture the physical information encoded within the equations. This poses a disadvantage to solving differential equations. In fact, among the various neural network methods for solving integer-order differential equations, there is a class of methods known as model-driven approaches. These methods do not require a large number of sample data for their construction. For example, Li et al. pro- posed an iterative scheme approximation based on deep learning framework, known as DeLISA. The authors first obtained time iteration schemes using implicit multistep and Runge-Kutta methods. Subsequently, this iteration scheme was approximated using a neural network. This method achieves continuous-time prediction without the need for a large number of interior points [29]. Long et al. utilized Convolutional Neural Networks (CNNs) to develop a novel approach for solving non-stationary partial differential equations, known as PDE-Net. The fundamental idea of this method is to employ convolutional kernels to learn differential op- erators and use neural networks to approximate unknown nonlinear responses [30]. Building upon their earlier PDE-Net framework, Long et al. proposed a new deep neural network called PDE-Net 2.0. It combines numerical approximation of differential operators using convolutions 3 with multi-layer symbolic neural networks for model recovery, which is employed to discover potential differential equations from observed data [31]. These model-driven methods possess clear statistical or physical significance, and many traditional methods can be directly combined with them, which provides a new perspective for solving differential equations. However, deep neural networks face a major challenge when it comes to solving fractional differential equations: the handling of fractional derivatives. This is due to the limitations of automatic differentiation techniques, which can only compute derivatives of integer orders. Consequently, deep neural networks are unable to handle fractional derivatives directly. As a result, research on utilizing neural networks for solving FDEs is relatively limited, but several novel methods have been proposed by scholars. Raja et al. successfully solved various types of linear and nonlinear FDEs using feedforward ANNs. Unlike other numerical methods, this approach offers the advantage of providing a con- tinuous solution over the entire finite domain [32]. Z ́u ̃niga-Aguilar et al. proposed a new ANN method to approximate the solution of FDEs. The author mainly considered the variable-order fractional differential equations with Mittag-Leffler kernel in the sense of Liouville-Caputo. [33]. Pang et al. extended PINNs to fractional PINNs (fPINNs) for solving spatiotemporal fractional advection-diffusion equations (ADEs), and systematically studied their convergence. The authors utilized automatic differentiation to analytically compute integer-order derivatives within equations. While for fractional-order derivatives, they utilize traditional numerical ap- proximation methods for numerical discretization. This approach effectively overcomes the challenge of neural networks being unable to directly solve fractional derivatives [34]. Qu et al. developed neural networks based on sine and cosine functions using uniformly distributed sampling points. They obtained approximate solutions to initial boundary value problems of several FDEs [35, 36]. Ye et al. employed Physics-Informed Neural Networks (PINNs) to inves- tigate the forward and inverse problems of time fractional diffusion equations with conformable derivative, addressing the limitation of directly applying neural networks to solve fractional- order differential equations [37]. Fang et al. solved the fractional PDEs in high-dimension and the inverse problems using DNNs.[38]. Therefore, it naturally raises the question of whether 4 the combination of traditional numerical methods and model-driven neural network methods can be utilized to solve FDEs. The answer is affirmative. Motivated by the aforementioned work, we propose an innovative Physical Model-driven Neural Network (PMNN) method for solving FDEs. In PMNN, we first discretize the frac- tional derivatives using an interpolation-based Finite Difference Method (FDM) to construct a temporal iteration scheme for the equation. Subsequently, we use this iteration scheme to construct the loss function for training a physical model-driven neural network. Since the it- eration scheme contains the physical information of the equation, obtaining an approximate solution can be viewed as the learning process of the temporal iteration scheme using a physical model-driven neural network. Therefore, when the loss gradually decreases and converges, we can consider the neural network as an approximation solution of the equation. The proposed method preserves the physical information of the equation to the greatest extent. Furthermore, it effectively utilizes the powerful fitting capability of neural networks while ensuring the valid- ity of the difference schemes for fractional differential equations. Moreover, in this paper, we evaluate the performance of PMNN through several numerical experiments. These experiments demonstrate the effectiveness of the method and its potential in solving a wide range of frac- tional differential equation problems. In addition, it is worth noting that the PMNN method, introduced in this paper, represents a general framework for solving FDEs. It combines neu- ral networks with fractional derivative interpolation approximations, without being limited to a specific approximation method. In this paper, we employ two interpolation approximation methods: L1 and L2 − 1σ, which result in two different physical model-driven neural network: PMNN on L1 and PMNN on L2 − 1σ. The remaining part of this paper is organized as follows: In Section 2, we first introduce the fundamental knowledge of FDEs, and then provide a comprehensive overview of the L1 and L2 − 1σ interpolation approximation for fractional derivatives. In Section 3, we present a detailed description of the construction of PMNN and provide a step-by-step explanation of the process involved in solving equations using PMNN. Section 4 primarily presents several nu- merical experiments to demonstrate the effectiveness of our proposed method. Finally, Section 5 5 provides a summary of the paper. 2 Preliminaries In this section, we will review two definitions of fractional derivatives and two interpolation approximations for the Caputo derivatives. 2.1 Definitions We start by presenting several fundamental definitions, which can be found in [39]. Definition 1 The Riemann-Liouville integral with order α > 0 of the given function f (t), t ∈ (a, b) are defined as aI−α t f (t) = 1 Γ(α) (cid:90) t a (t − s)α−1f (s)ds, (1) where Γ(*) is the Euler's gamma function. Definition 2 The Riemann-Liouville derivatives with order α > 0 of the given function f (t), t ∈ (a, b) are defined as aDα t f (t) = = t (cid:104) dm dtm 1 Γ(m − α) aI−(m−α) dm dtm (cid:105) f (t) (cid:90) t a (t − s)m−α−1f (s)ds, (2) where m is a positive integer satisfying m − 1 ≤ α < m. Definition 3 The Caputo derivatives with order α > 0 of the given function f (t), t ∈ (a, b) are defined as a Dα C t f (t) = aI−(m−α) t (cid:104) = 1 Γ(m − α) f (m)(t) (cid:90) t a (cid:105) (3) (t − s)m−α−1f (m)(s)ds, where m is a positive integer satisfying m − 1 < α ≤ m. The Riemann-Liouville (R-L) derivative and the Caputo derivative may exhibit differences in numerical computations. For instance, the Caputo fractional derivative of a constant function 6 is 0, whereas the R-L fractional derivative is non-zero. The distinct characteristics of these two integrals determine their applicability in different contexts. The R-L derivative imposes fewer conditions on the function f (x), enhancing its convenience for mathematical theoretical investigations. On the other hand, the Caputo derivative finds wider application in solving initial and boundary value problems of differential equations in the field of physical engineering. In this paper, we adopt the Caputo derivative. 2.2 Interpolation approximation of Caputo derivative Over the past several decades, researchers in the field of Finite Difference Methods for solving FDEs have made significant research achievements. The underlying idea of these methods is to discretize the fractional derivatives in the differential equation, transforming the fractional- order equations into integer-order equations for numerical computation. The interpolation approximation of the fractional derivative serves as a crucial step in the FDMs, which provides us with a promising direction for solving FDEs using DNNs. Following that, we will illustrate two interpolation approximations for the α-order Caputo fractional derivative. 2.2.1 L1 approximation For the Caputo derivative of order α (0 < α < 1) 0 Dα C t f (t) = 1 Γ(1 − α) (cid:90) t 0 f ′(s) (t − s)α ds, (4) the most commonly used approach is the L1 approximation based on piecewise linear interpo- lation. Let N be a positive integer. We define τ = T N , tk = kτ , 0 ⩽ k ⩽ N , and a(α) l = (l + 1)1−α − l1−α, l ⩾ 0, (5) 7 we derive an approximation formula for the calculation of C 0 Dα t f (t)|t=tn: Dα t f (tn) ≡ (cid:34) τ −α Γ(2 − α) a(α) 0 f (tn) − n−1 (cid:88) (cid:16) k=1 n−k−1 − a(α) a(α) n−k (cid:17) f (tk) − a(α) (cid:35) n−1f (t0) . (6) Eq.(6) is commonly known as the L1 formula or L1 approximation. 2.2.2 L2 − 1σ approximation For the α (0 < α < 1) order Caputo derivative, the aforementioned L1 approximation formula achieves uniform convergence of order 2 − α. Alikhanov [40] further extended this result by discovering superconvergent interpolation points and establishing the L2 − 1σ approximation formula, which achieves uniform convergence of order 3 − α. In the following section, we will present this result in detail. Let us denote σ = 1 − α 2 , tn+σ = (n + σ)τ, f n = f (tn), (7) the approximation formula for evaluating C 0 Dα t f (t)|t=tn−1+σ can be obtained as follows: ∆α t f (tn−1+σ) ≡ τ −α Γ(2 − α) n−1 (cid:88) k=0 c(n,α) k [f (tn−k) − f (tn−k−1)], 1 ⩽ n ⩽ N. (8) Eq.(8) is typically referred to as the L2 − 1σ formula or L2 − 1σ approximation. When n = 1, c(1,α) 0 = σ1−α, (9) 8 while when n ⩾ 2,    (1 + σ)2−α − σ2−α 2 − α − (1 + σ)1−α − σ1−α 2 , [(k + 1 + σ)2−α − 2(k + σ)2−α + (k − 1 + σ)2−α] [(k + 1 + σ)1−α − 2(k + σ)1−α + (k − 1 + σ)1−α], c(n,α) 0 c(n,α) k = = 1 2 − α 1 2 − 1 ⩽ k ⩽ n − 2, c(n,α) n−1 = [3(n − 1 + σ)1−α − (n − 2 + σ)1−α] 1 2 − 1 2 − α [(n − 1 + σ)2−α − (n − 2 + σ)2−α]. (10) 2.3 Classification of Caputo Fractional Partial Differential Equations Consider the following Caputo fractional partial differential equation: 0 Dα C t u = ∆u (11) Based on the interval of values for α, it can be categorized [41], as depicted in Table 1. This paper primarily addresses the case involving derivatives of order 0 < α < 1. Table 1: The classification of C 0 Dα t u = ∆u with α ∈ (0, 2]. α Math.type (0, 1) Time-fractional parabolic equation 1 Parabolic equation Phys.sense Temporal subdiffusion Diffusion (1, 2) Time-fractional hyperbolic equation Temporal Supperdiffusion 2 Hyperbolic equation Wave 3 Illustration of the method 3.1 Problem setup In this paper, we focus on fractional ordinary differential equations (FODEs) and fractional partial differential equations (FPDEs). Next, we provide a detailed exposition of our method- 9 ology by considering the initial-boundary value problem for the FPDE on a bounded domain Ω ∈ Rn. Consider the initial-boundary value problem for the following time-fractional slow diffusion equation: 0 Dα C t u(x, t) = Lu(x, t) + f (x, t), (x, t) ∈ Ω × (0, T ], u(x, t) = μ(x, t), (x, t) ∈ ∂Ω × (0, T ], u(x, 0) = φ(x), x ∈ Ω, (12) (13) (14) where, C 0 Dα t denotes the Caputo fractional derivative with α ∈ (0, 1), L represents an integer- order differential operator, u(x, t) is the solution of the equation, f , μ and φ are known func- tions. 3.2 Architecture of PMNN DNNs have gained remarkable achievements in tackling differential equations of integer order, owing largely to the integration of automatic differentiation techniques. Nevertheless, the ap- plicability of automatic differentiation is restricted to functions with integer-order differentials. To surmount the obstacle of automatic differentiation in utilizing neural networks for solving fractional-order differentials, we tackle the issue by discretizing the Caputo derivatives in the equations using L1 and L2 − 1σ approximations, respectively. Subsequently, neural networks are introduced to establish PMNN on L1 and PMNN on L2 − 1σ, respectively. This section presents the detailed procedures involved in constructing PMNN. 3.2.1 PMNN on L1 The first step of our approach is to semi-discretize the fractional-order derivative in the temporal domain. Let N be a positive integer. We define τ = T N , tk = kτ , where 0 ⩽ k ⩽ N . Utilizing 10 the L1 formula presented in Section 2.2.1, we obtain: 0 Dα C t un ≈ Dα t un (cid:34) = τ −α Γ(2 − α) a(α) 0 un − n−1 (cid:88) (cid:16) k=1 n−k−1 − a(α) a(α) n−k (cid:17) uk − a(α) n−1u0 (cid:35) , (15) where un = u(tn, x), 1 ⩽ n ⩽ N . Substituting it into the governing equation, we obtain the temporal iteration scheme based on Eq.(12): un = Γ(2 − α) * τ α a(α) 0 [Lun + f n] + (cid:32) n−1 (cid:88) k=1 n−k−1 − a(α) a(α) a(α) 0 n−k (cid:33) uk + a(α) n−1 a(α) 0 u0. (16) Next, we introduce physical model-driven neural networks as solvers to obtain approximate solutions for the differential equations. In this study, we directly consider the output of the neural network, ˆu(x, t; θ), as the approximation solution. By substituting it into Eq.(16), we obtain the expression for PMNN on L1 as follows: U n = Γ(2 − α) * τ α a(α) 0 [Lˆun + f n] + (cid:32) n−1 (cid:88) k=1 n−k−1 − a(α) a(α) a(α) 0 n−k (cid:33) ˆuk + a(α) n−1 a(α) 0 ˆu0, (17) where ˆun = u(x, tn; θ) represents the output of the neural network at time tn, and f n = f (x, tn). Evidently, the iterative scheme mentioned above incorporates the physical information inherent in the governing equation. Taking into account the initial and boundary conditions (13)-(14), we define the loss function for the PMNN on L1 model as follows: Loss(θ) = Lossf (θ) + Lossic(θ) + Lossbc(θ), (18) 11 the definitions of each component in the loss function are as follows: Lossf (θ) = Lossbc(θ) = Lossic(θ) = 1 Nf 1 Nbc 1 Nic Nf (cid:88) (cid:2)ˆu(xi f , ti f ) − U (xi f , ti f )(cid:3)2 , i=1 Nbc(cid:88) i=1 Nic(cid:88) i=1 (cid:2)ˆu(xi bc, ti bc) − u(xi bc, ti bc)(cid:3)2 , (19) (cid:2)ˆu(xi ic, ti bc) − u(xi ic, ti ic)(cid:3)2 , f , ti where {xi f }Nf number of training points. {xi i=1 represents the training points of the iterative scheme, where Nf denotes the ic, ti ic}Nic i=1 refers to the initial training points, where Nic represents the number of initial training points. Similarly, {xi bc, ti bc}Nbc i=1 denotes the boundary points, and Nbc represents the number of boundary points. The architecture of the PMNN on L1 model is illustrated in Fig.1. Figure 1: The architecture of PMNN on L1 3.2.2 PMNN on L2 − 1σ Just like in the case of PMNN on L1, we proceed with the discretization of the equation. Let N be a positive integer. We define τ = T N , tk = kτ , 0 ⩽ k ⩽ N , and σ = 1 − α 2 . Based on the 12 L2 − 1σ formula described in Section 2.2.2, we obtain: 0 Dα C t un−1+σ ≈ ∆α t u(tn−1+σ) n−1 (cid:88) τ −α Γ(2 − α) k=0 = c(n,α) k [u(tn−k) − u(tn−k−1)], (20) where un = u(tn, x), 1 ⩽ n ⩽ N . We note that the L2 − 1σ scheme, unlike the L1 scheme, discretizes the fractional derivative at time points tn−1+σ, which is located outside the set of discrete time points tn. Therefore, in the process of discretizing the equation, we need to consider the time node tn−1+σ. The temporal iteration scheme, derived from the differential equation (12), is given by: un = Γ(2 − α) * τ α c(n,α) 0 (cid:2)Lun−1+σ + f n−1+σ(cid:3) + n−1 (cid:88) k=1 c(n,α) k c(n,α) 0 (un−k−1 − un−k) + un−1. (21) Similarly, by substituting the neural network's output ˆu(x, t; θ) as an approximation into equation (21), we can derive the expression for PMNN on L2 − 1σ as follows: U n = Γ(2 − α) * τ α c(n,α) 0 (cid:2)Lˆun−1+σ + f n−1+σ(cid:3) + n−1 (cid:88) k=1 c(n,α) k c(n,α) 0 (ˆun−k−1 − ˆun−k) + ˆun−1, (22) where ˆun = u(x, tn; θ) represents the output of the network at time tn, and f n = f (x, tn). The loss function for the PMNN on L2 − 1σ model is defined by Loss(θ) = Lossf (θ) + Lossic(θ) + Lossbc(θ). (23) The definitions of each loss term can be found in Eq.(19). The architecture of the PMNN on L2 − 1σ model is depicted in Fig.2. 4 Numerical results In this section, the performance of our proposed model is evaluated through the analysis of three single-term temporal fractional differential equations: a time-fractional ODE, a one- 13 Figure 2: The architecture of PMNN on L2 − 1σ dimensional time-fractional PDE, and a two-dimensional time-fractional PDE. The loss function is minimized using the L-BFGS-B method, and the accuracy of the numerical solutions is assessed using the L2 relative error. By contrasting the effectiveness of the two models, it is observed that the proposed model achieves high accuracy. Additionally, all experiments in this section are carried out utilizing an NVIDIA RTX 1660 GPU card. Example 1 Single-term Temporal Fractional Ordinary Differential Equation Considering a single-term temporal fractional ordinary differential equation: 0 Dα C t u(t) = −u(t) + f (t), t ∈ (0, T ], u(0) = 0, (24) where, 0 < α < 1, and the exact solution to the equation is given by u(t) = t5+α. The right- hand side term is defined as f (t) = Γ(6+α) 120 t5 + t5+α. For this experiment, we focus on the case where T = 1. In this experiment, a fully connected neural network (FNN) with 5 hidden layers is utilized. 14 Each hidden layer consists of 20 neurons with a tanh activation function. The training and testing data are uniformly sampled from the interval [0, T ]. For our analysis, we specifically select Nt training points and 500 testing points. To begin, we conduct tests for the case of α = 0.5 and Nt = 41. Fig.3 shows the comparison between the predicted solutions of the two models and the exact solution. The blue solid line represents the graph of the exact solution, while the red dashed line represents the curve of the predicted solution using the PMNN model. It is evident that the predicted solution precisely aligns with the exact solution. (a) PMNN on L1 (b) PMNN on L2 − 1σ Figure 3: Single-term FODE: the exact solution and the predict solution of PMNN. Fig.4 illustrates the variation of the error with respect to time t. For the PMNN on L1 model, the error initially remains below 1 × 10−3, but around t = 0.4, it gradually increases over time. In contrast, the error for the PMNN on L2 − 1σ model remains stable at around 1 × 10−4. Therefore, in this case, the PMNN on L2 − 1σ model demonstrates superior overall performance. The trends of loss with respect to the number of iterations for the two models are depicted in Fig.5. A comparison of the plots reveals that the PMNN on L2 − 1σ model exhibits faster convergence. Table 2 displays the iteration counts and training times for the two models with different α. Comparing the iteration counts, it is evident that PMNN on L2 − 1σ converges more rapidly. However, it needs a longer training time, potentially due to its requirement for a larger training dataset. To further evaluate the performance of the proposed method, we conducted tests with 15 (a) PMNN on L1 (b) PMNN on L2 − 1σ Figure 4: Single-term FODE: the trend of the error with the time t. (a) PMNN on L1 (b) PMNN on L2 − 1σ (c) Comparison of the two models Figure 5: Single-term FODE: the trend of the loss function with the number of iterations Table 2: The number of iterations and training time of two PMNN for single-term FODE Iter Training Time(s) L1 L2 − 1σ L1 L2 − 1σ α = 0.25 α = 0.50 α = 0.75 90 77 94 77 73 71 8.41 6.47 8.49 8.12 13.99 12.57 different α and varying numbers of training points. The L2 relative errors for each case are presented in Table 3. It can be observed that as the number of training points increases, the overall errors of both models decrease. Moreover, after approximately Nt = 41, both models demonstrate good performance. The minimum error attained by PMNN on L1 is 1.71 × 10−4, whereas for PMNN on L2 − 1σ, the minimum error reaches 3.52 × 10−4. 16 Table 3: The L2 error of two PMNN for single-term FODE Nt 11 21 41 81 101 201 α = 0.25 α = 0.50 α = 0.75 L1 L2 − 1σ L1 L2 − 1σ L1 L2 − 1σ 1.55 e-02 5.35 e-03 1.86 e-03 9.58 e-04 6.68 e-04 1.71 e-04 1.20 e-03 1.21 e-03 3.71 e-03 2.64 e-03 3.51 e-03 3.86 e-03 5.31 e-02 2.07 e-02 7.84 e-03 3.10 e-03 2.26 e-03 1.26 e-03 2.50 e-03 2.19 e-03 3.02 e-03 1.58 e-03 2.51 e-03 2.37 e-03 1.33 e-01 5.88 e-02 2.55 e-02 1.09 e-02 8.36 e-03 4.59 e-03 6.28 e-03 1.53 e-03 7.84 e-04 4.75 e-04 3.39 e-04 3.52 e-04 Example 2 1D Time-fractional Convection-diffusion Equation Consider the following one-dimensional time-fractional convection-diffusion equation, with the exact solution given by u(x, t) = x2 + 2tα Γ(1+α) . = uxx, ∂αu(x, t) ∂tα u(x, 0) = x2, u(0, t) = u(1, t) = 1 + , 2tα Γ(1 + α) 2tα Γ(1 + α) x ∈ [0, 1], t ∈ (0, 1], x ∈ [0, 1], t ∈ [0, 1], , t ∈ [0, 1], The same FNN architecture is employed in this experiment, following the configuration of Example 1. We uniformly sample Nt time nodes from the interval [0, 1] and Nx spatial nodes from the interval [0, 1]. Consequently, the training data comprises a total of Nt × Nx data points. Similarly, we select 100 × 100 test data points. We begin the experiment by fixing α = 0.5, Nt = 41, and Nx = 11. Fig.6 shows the comparison between the predicted solutions obtained from the two models and the exact solution. The left panel depicts the graph of the exact solution, while the middle and right panels display the predicted solutions using PMNN on L1 and PMNN on L2 − 1σ, respectively. A visual analysis reveals a remarkable consistency between the predicted solutions and the graph of the exact solution. The error of the two PMNN models is depicted in Fig.7. It is evident that in this case, there are fluctuations in the error within a small interval near t = 0, while the error remains stable 17 (a) Exact (b) PMNN on L1 (c) PMNN on L2 − 1σ Figure 6: 1D Single-term FPDE: the exact solution and the predict solution of PMNN. for the rest of the time. Furthermore, it can be observed that during the fluctuation period, the error exhibits symmetry around the spatial coordinate point x = 0.5. This is an intriguing phenomenon. Additionally, the error of PMNN on L2 − 1σ converges to a stable state in a shorter time frame. (a) PMNN on L1 (b) PMNN on L2 − 1σ Figure 7: 1D Single-term FPDE: the error presentation of PMNN. The evolution of the loss functions for both models during the iterative process is visualized in Fig.8. The first two subfigures in Fig.8 offer a comprehensive depiction of the dynamic evolution of the individual components comprising the loss functions, whereas the last subfigure portrays the overall variation of the loss. By comparing the two plots, it becomes apparent that PMNN on L1 demonstrates a noticeably faster convergence rate, which is contrary to the observations in Example 1. 18 (a) PMNN on L1 (b) PMNN on L2 − 1σ (c) Comparison of the two models Figure 8: 1D Single-term FPDE: the trend of the loss function with the number of iterations. Table 4 provides the iteration counts and training times for the two models with varying orders α. It is observed that PMNN on L1 converges faster when α = 0.25 and α = 0.5, whereas PMNN on L2 − 1σ converges faster when α = 0.75. This indicates that the performance of the two models is influenced by the choice of order in this particular example. Table 4: The number of iterations and training time of two PMNN for 1D single-term FPDE Iter Training Time(s) L1 L2 − 1σ L1 L2 − 1σ α = 0.25 α = 0.50 α = 0.75 919 901 1630 689 1058 1511 97.06 170.55 307.21 103.28 194.2 233.91 In the following experiments, we fix the number of time nodes at Nt = 41 and set α = 0.5. We then change the number of spatial nodes, denoted as Nx, to investigate the influence on the models. The corresponding L2 relative errors for each case are presented in Table 5. It can be observed that as the number of spatial training points increases, the errors of both models exhibit minimal fluctuations. This suggests that the quantity of spatial training points has minimal impact on the model's performance. Therefore, it is feasible to select a smaller number of spatial nodes for training, thereby reducing computational costs effectively. Finally, we fix Nx = 11 and perform tests with different values of α and varying numbers of spatial nodes Nx. The L2 relative errors are presented in Table 6. Consistent with the 19 Table 5: The L2 error of two PMNN for 1D single-term FPDE Nx 6 11 21 41 81 101 α = 0.5 L1 3.24e-03 3.66e-03 3.45e-03 3.37e-03 3.52e-03 3.59e-03 L2 − 1σ 1.75e-03 1.64e-03 1.59e-03 1.61e-03 1.68e-03 1.63e-03 experimental results in Example 1, the errors of both models decrease as the number of time nodes increases. Overall, PMNN on L2−1σ outperforms PMNN on L1 in terms of performance. Table 6: The L2 error of two PMNN for 1D single-term FPDE Nt 11 21 41 81 101 α = 0.25 α = 0.50 α = 0.75 L1 3.46e-02 1.81e-02 7.74e-03 2.21e-03 1.43e-03 L2 − 1σ 2.80e-02 1.58e-02 5.85e-03 9.73e-04 5.24e-04 L1 1.38e-02 6.43e-03 3.66e-03 1.85e-03 1.48e-03 L2 − 1σ 8.03e-03 3.59e-03 1.64e-03 6.74e-04 5.28e-04 L1 6.39e-03 3.52e-03 2.03e-03 1.13e-03 9.61e-04 L2 − 1σ 2.14e-03 1.17e-03 6.70e-04 3.81e-04 2.90e-04 Example 3 2D Time-fractional Convection-diffusion Equation Consider the following time-fractional convection-diffusion equation, with an exact solution given by u(x, t) = t2ex+y. = ∆u(x, t) + f (x, t), ∂αu(x, t) ∂tα u(x, t) = t2ex+y, x ∈ Ω ⊂ R2, t ∈ (0, 1), x ∈ ∂Ω, t ∈ (0, 1), u(x, 0) = 0, x ∈ Ω, where f (x, t) = [ 2t2−α Γ(3−α) − 2t2]ex+y. Ω = [0, 1] × [0, 1] 20 The present experiment follows the same configuration as the previous two experiments using FNN. We uniformly select Nt time nodes on the interval [0, 1] and Nx × Nx spatial nodes on the domain [0, 1] × [0, 1], resulting in a total of Nt × Nx × Nx training data points. In a similar manner, 100 × 100 × 100 test data points are selected. For the experiment, we set α = 0.5, Nt = 21, and Nx = 11. Fig.9 illustrates the comparison between the exact solution and the predicted solutions obtained by the two models at t = 1. On the left is the image of the exact solution, in the middle is the image of the predicted solution using PMNN on L1, and on the right is the image of the predicted solution using PMNN on L2 − 1σ. Through a visual comparison, it is evident that the predicted solution is the same as the exact solution. (a) Exact (b) PMNN on L1 (c) PMNN on L2 − 1σ Figure 9: 2D Single-term FPDE: the exact solution and the predict solution when t = 1.00. Fig.10 depicts the errors of the two PMNN models at t = 1. It can be observed that the error of PMNN on L1 is relatively larger near the center of the spatial plane, while it decreases as it approaches the boundaries. On the other hand, the error of PMNN on L2 − 1σ exhibits less fluctuation. Fig.11 illustrates the trends in the loss functions of the two models. The first two subfigures provide a detailed view of the changes in the individual loss components, while the last subfigure depicts the overall loss of the models. Consistent with the experimental results in Example 1, it is evident that PMNN on L2 − 1σ exhibits a faster convergence speed. Table 7 presents the number of iterations and training time for both models when different orders of α are chosen. It can be observed that PMNN on L1 converges faster when α = 0.25, while PMNN on L2 − 1σ converges faster when α = 0.5 and α = 0.75. This indicates that the 21 (a) PMNN on L1 (b) PMNN on L2 − 1σ Figure 10: 2D Single-term FPDE: the error presentation of PMNN when t = 1.00. (a) PMNN on L1 (b) PMNN on L2 − 1σ (c) Comparison of the two models Figure 11: 2D Single-term FPDE: the trend of the loss function with the number of iterations. performance of the two models is influenced by the order of the fractional derivative in this example. This conclusion is consistent with Example 2. Table 7: The number of iterations and training time of two PMNN for 2D single-term FPDE Iter Training Time(s) L1 L2 − 1σ L1 L2 − 1σ α = 0.25 α = 0.50 α = 0.75 1595 1056 1076 1875 935 723 287.62 315.21 347.18 341.82 280.81 218.5 In the following, we fix Nt = 21 and α = 0.5, and then vary the number of spatial nodes, Nx, to investigate their impact on the model. The corresponding L2 relative errors are presented in Table 8. The analysis reveals that the model's performance is unaffected by the number of 22 spatial training points. Consequently, it is viable to employ a minimal number of spatial nodes during training, resulting in reduced computational costs. Table 8: The L2 error of two PMNN for 2D single-term FPDE Nx 6 11 21 41 81 α = 0.5 L1 3.42e-04 3.16e-04 3.07e-04 3.10e-04 3.09e-04 L2 − 1σ 7.03e-05 4.67e-05 4.16e-05 4.25e-05 6.76e-05 Lastly, by fixing Nx = 11, we perform experiments with different values of α and varying Nt. The L2 relative errors are presented in Table 9. In contrast to the previous two experiments, the errors of both models do not consistently decrease as the number of time nodes increases. Instead, they exhibit minor fluctuations. Overall, the PMNN on L2 − 1σ model demonstrates superior performance compared to the PMNN on L1 model. Table 9: The L2 error of two PMNN for 2D single-term FPDE Nt 11 21 41 81 101 α = 0.25 α = 0.50 α = 0.75 L1 2.50e-04 8.27e-05 4.07e-05 2.34e-05 3.04e-05 L2 − 1σ 6.23e-05 4.01e-05 1.66e-04 3.32e-04 5.61e-05 L1 8.13e-04 3.16e-04 1.21e-04 5.26e-05 4.56e-05 L2 − 1σ 6.15e-05 4.67e-05 3.91e-05 5.25e-05 5.62e-05 L1 2.34e-03 1.01e-03 4.32e-04 1.76e-04 1.35e-04 L2 − 1σ 5.00e-05 4.17e-05 4.77e-05 5.08e-05 5.68e-05 5 Conclusions In this paper, we introduce PMNN, an iteration scheme approximation method based on phys- ical model-driven neural networks, to solve FDEs. This iteration scheme leverages the physical 23 information embedded in the equations, enabling the problem of solving FDEs to be reframed as a learning task for the PMNN model. Specifically tailored for Caputo FDEs, PMNN overcomes the limitations of automatic differentiation techniques in neural networks for solving fractional derivatives. It combines the efficiency of traditional interpolation approximation and harnesses the powerful fitting capabilities of neural networks. Through three numerical experiments, we demonstrate the excellent performance of the proposed model. Moreover, we present two variations of the model, and the numerical experiments show their distinct merits in various scenarios. Hence, in practical applications, the selection of the suitable model can be selected to cater to specific requirements. In spite of that, PMNN on L2 − 1σ exhibits particularly appealing performance in the majority of cases. PMNN perfectly merges physical model-driven neural networks with interpolation approx- imation techniques for fractional derivatives, offering a novel approach for numerically solving FDEs. The proposed model currently applies only to the solution of single-term temporal fractional differential equations. Furthermore, some interesting phenomena observed in the experimental results still lack a clear explanation, presenting unresolved challenges for future investigation. In the future, investigating neural network-based physical model-driven methods for multi-term FDEs and spatial fractional-order differential equations could provide a potential direction for further research. CRediT authorship contribution statement Zhiying Ma : Methodology, Software, Writing-original draft. Jie Hou : Methodology, Writing – review & editing. Wenhao Zhu : Supervision, Writing-review & editing. Yaxin Peng : Supervision, Writing-review & editing. Ying Li : Conceptualization, Funding acquisition, Writing-review & editing. 24 Acknowledgments This work is supported by the National Key Research and Development Program of China (No.2021YFA1003004). Declaration of competing interest The authors declare that they have no known competing financial interests or personal rela- tionships that could have appeared to influence the work reported in this paper. References [1] Z. Sun and G. Gao, Fractional differential equations: finite difference methods. De Gruyter, 2020. [2] M. R. Admon, N. Senu, A. Ahmadian, Z. A. Majid, and S. Salahshour, "A new efficient algorithm based on feedforward neural network for solving differential equations of frac- tional order," Commun. Nonlinear Sci. Numer. Simul., vol. 117, p. 106968, 2023. doi: 10.1016/j.cnsns.2022.106968. [3] M. M. Meerschaert and C. Tadjeran, "Finite difference approximations for fractional ad- vection–dispersion flow equations," J. Comput. Appl. Math., vol. 172, no. 1, pp. 65–77, 2004. doi: 10.1016/j.cam.2004.01.033. [4] W. Deng, "Finite element method for the space and time fractional Fokker-Planck equa- tion," SIAM J. Numer. Anal., vol. 47, no. 1, pp. 204–226, 2009. doi: 10.1137/080714130. [5] Y. Jiang and J. Ma, "High-order finite element methods for time-fractional partial differ- ential equations," J. Comput. Appl. Math., vol. 235, no. 11, pp. 3285–3290, 2011. doi: 10.1016/j.cam.2011.01.011. 25 [6] F. Zeng, F. Liu, C. Li, K. Burrage, I. Turner, and V. Anh, "A Crank-Nicolson ADI spectral method for a two-dimensional Riesz space fractional nonlinear reaction-diffusion equation," SIAM J. Numer. Anal., vol. 52, no. 6, pp. 2599–2622, 2014. doi: 10.1137/130934192. [7] A. Ahmadian, S. Salahshour, D. Baleanu, H. Amirkhani, and R. Yunus, "Tau method for the numerical solution of a fuzzy fractional kinetic model and its application to the oil palm frond as a promising source of xylose," J. Comput. Phys., vol. 294, pp. 562–584, 2015. doi: 10.1016/j.jcp.2015.03.011. [8] A. H. Bhrawy, M. M. Tharwat, and A. Yildirim, "A new formula for fractional in- tegrals of Chebyshev polynomials: Application for solving multi-term fractional dif- ferential equations," Appl. Math. Model., vol. 37, no. 6, pp. 4245–4252, 2013. doi: 10.1016/j.apm.2012.08.022. [9] F. Mohammadi and C. Cattani, "A generalized fractional-order legendre wavelet Tau method for solving fractional differential equations," J. Comput. Appl. Math., vol. 339, pp. 306–316, 2018. doi: 10.1016/j.cam.2017.09.031. [10] S. Kumar, A. Ahmadian, R. Kumar, D. Kumar, J. Singh, D. Baleanu, and M. Salimi, "An efficient numerical method for fractional SIR epidemic model of infectious disease by using Bernstein wavelets," Mathematics, vol. 8, no. 4, p. 558, 2020. doi: 10.3390/math8040558. [11] H. Jafari, S. A. Yousefi, M. A. Firoozjaee, S. Momani, and C. M. Khalique, "Application of legendre wavelets for solving fractional differential equations," Comput. Math. Appl., vol. 62, no. 3, pp. 1038–1045, 2011. doi: 10.1016/j.camwa.2011.04.024. [12] Y. Talaei and M. Asgari, "An operational matrix based on Chelyshkov polynomials for solv- ing multi-order fractional differential equations," Neural Comput. Appl., vol. 30, pp. 1369– 1376, 2018. doi: 10.1007/s00521-017-3118-1. [13] A. Ahmadian, S. Salahshour, and C. S. Chan, "Fractional differential systems: a fuzzy solution based on operational matrix of shifted Chebyshev polynomials and its 26 applications," IEEE Trans. Fuzzy Syst., vol. 25, no. 1, pp. 218–236, 2016. doi: 10.1109/TFUZZ.2016.2554156. [14] A. M. Shloof, N. Senu, A. Ahmadian, and S. Salahshour, "An efficient operation matrix method for solving fractal–fractional differential equations with generalized Caputo-type fractional–fractal derivative," Math. Comput. Simulation, vol. 188, pp. 415–435, 2021. doi: 10.1016/j.matcom.2021.04.019. [15] S. Salahshour, T. Allahviranloo, and S. Abbasbandy, "Solving fuzzy fractional differential equations by fuzzy laplace transforms," Commun. Nonlinear Sci. Numer. Simul., vol. 17, no. 3, pp. 1372–1381, 2012. doi: 10.1016/j.cnsns.2011.07.005. [16] Z. M. Odibat and S. Momani, "Application of variational iteration method to nonlinear differential equations of fractional order," Int. J. Nonlinear Sci. Numer. Simul., vol. 7, no. 1, pp. 27–34, 2006. doi: 10.1515/IJNSNS.2006.7.1.27. [17] S. S. Ray and R. K. Bera, "An approximate solution of a nonlinear fractional differen- tial equation by Adomian decomposition method," Appl. Math. Comput., vol. 167, no. 1, pp. 561–571, 2005. doi: 10.1016/j.amc.2004.07.020. [18] S. Momani and Z. Odibat, "Analytical solution of a time-fractional Navier–Stokes equation by Adomian decomposition method," Appl. Math. Comput., vol. 177, no. 2, pp. 488–494, 2006. doi: 10.1016/j.amc.2005.11.025. [19] S. Momani and Z. Odibat, "Numerical approach to differential equations of frac- tional order," J. Comput. Appl. Math., vol. 207, no. 1, pp. 96–110, 2007. doi: 10.1016/j.cam.2006.07.015. [20] I. E. Lagaris, A. Likas, and D. I. Fotiadis, "Artificial neural networks for solving ordinary and partial differential equations," IEEE Trans. Neural Netw., vol. 9, no. 5, pp. 987–1000, 1998. [21] M. Raissi, P. Perdikaris, and G. E. Karniadakis, "Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlin- 27 ear partial differential equations," J. Comput. Phys., vol. 378, pp. 686–707, 2019. doi: 10.1016/j.jcp.2018.10.045. [22] J. Yu, L. Lu, X. Meng, and G. E. Karniadakis, "Gradient-enhanced physics-informed neural networks for forward and inverse PDE problems," Comput. Methods Appl. Mech. Engrg., vol. 393, p. 114823, 2022. doi: 10.1016/j.cma.2022.114823. [23] L. Yuan, Y. Ni, X. Deng, and S. Hao, "A-PINN: Auxiliary physics informed neural networks for forward and inverse problems of nonlinear integro-differential equations," J. Comput. Phys., vol. 462, p. 111260, 2022. doi: 10.1016/j.jcp.2022.111260. [24] X. Meng, Z. Li, D. Zhang, and G. E. Karniadakis, "PPINN: Parareal physics-informed neural network for time-dependent PDEs," Comput. Methods Appl. Mech. Engrg., vol. 370, p. 113250, 2020. doi: 10.1016/j.cma.2020.113250. [25] G. Pang, M. D'Elia, M. Parks, and G. E. Karniadakis, "nPINNs: Nonlocal physics- informed neural networks for a parametrized nonlocal universal laplacian operator. Algorithms and applications," J. Comput. Phys., vol. 422, p. 109760, 2020. doi: 10.1016/j.jcp.2020.109760. [26] P.-H. Chiu, J. C. Wong, C. Ooi, M. H. Dao, and Y.-S. Ong, "CAN-PINN: A fast physics-informed neural network based on coupled-automatic–numerical differentiation method," Comput. Methods Appl. Mech. Engrg., vol. 395, p. 114909, 2022. doi: 10.1016/j.cma.2022.114909. [27] L. Lu, P. Jin, G. Pang, Z. Zhang, and G. E. Karniadakis, "Learning nonlinear operators via DeepONet based on the universal approximation theorem of operators," Nat. Mach. Intell., vol. 3, pp. 218–229, 2021. doi: 10.1038/s42256-021-00302-5. [28] P. Liu, L. Wang, R. Ranjan, G. He, and L. Zhao, "A survey on active deep learning: From model driven to data driven," ACM Comput. Surv., vol. 54, no. 10s, pp. 1–34, 2022. doi: 10.1145/3510414. 28 [29] Y. Li, Z. Zhou, and S. Ying, "DeLISA: Deep learning based iteration scheme ap- proximation for solving PDEs," J. Comput. Phys., vol. 451, p. 110884, 2022. doi: 10.1016/j.jcp.2021.110884. [30] Z. Long, Y. Lu, X. Ma, and B. Dong, "PDE-Net: Learning PDEs from data," in ICML, pp. 3208–3216, PMLR, 2018. url: https://proceedings.mlr.press/v80/long18a.html. [31] Z. Long, Y. Lu, and B. Dong, "PDE-Net 2.0: Learning PDEs from data with a numeric- symbolic hybrid deep network," J. Comput. Phys., vol. 399, p. 108925, 2019. doi: 10.1016/j.jcp.2019.108925. [32] M. A. Z. Raja, J. A. Khan, and I. M. Qureshi, "Evolutionary computational intelligence in solving the fractional differential equations," in Intelligent Information and Database Systems, pp. 231–240, Springer Berlin Heidelberg, 2010. doi: 10.1007/978-3-642-12145- 6 ̇24. [33] C. J. Z ́u ̃niga-Aguilar, H. M. Romero-Ugalde, J. F. G ́omez-Aguilar, R. F. Escobar-Jim ́enez, and M. Valtierra-Rodr ́ıguez, "Solving fractional differential equations of variable-order in- volving operators with Mittag-Leffler kernel using artificial neural networks," Chaos Soli- tons Fractals, vol. 103, pp. 382–403, 2017. doi: 10.1016/j.chaos.2017.06.030. [34] G. Pang, L. Lu, and G. E. Karniadakis, "fPINNs: Fractional physics-informed neu- ral networks," SIAM J. Sci. Comput., vol. 41, no. 4, pp. A2603–A2626, 2019. doi: 10.1137/18M1229845. [35] H. Qu, X. Liu, and Z. She, "Neural network method for fractional-order par- tial differential equations," Neurocomputing, vol. 414, pp. 225–237, 2020. doi: 10.1016/j.neucom.2020.07.063. [36] H. Qu, X. Liu, X. Lu, M. ur Rahman, and Z. She, "Neural network method for solving non- linear fractional advection-diffusion equation with spatiotemporal variable-order," Chaos Solitons Fractals, vol. 156, p. 111856, 2022. doi: 10.1016/j.chaos.2022.111856. 29 [37] Y. Ye, H. Fan, Y. Li, X. Liu, and H. Zhang, "Deep neural network methods for solving for- ward and inverse problems of time fractional diffusion equations with conformable deriva- tive," Neurocomputing, vol. 509, pp. 177–192, 2022. doi: 10.1016/j.neucom.2022.08.030. [38] X. Fang, L. Qiao, F. Zhang, and F. Sun, "Explore deep network for a class of fractional partial differential equations," Chaos Solitons Fractals, vol. 172, p. 113528, 2023. doi: 10.1016/j.chaos.2023.113528. [39] C. Li and F. Zeng, Numerical methods for fractional calculus. CRC Press, 2015. [40] A. A. Alikhanov, "A new difference scheme for the time fractional diffusion equation," J. Comput. Phys., vol. 280, pp. 424–438, 2015. doi: 10.1016/j.jcp.2014.09.031. [41] C. Li and M. Cai, Theory and numerical approximations of fractional integrals and deriva- tives. SIAM, 2019. 30
http://arxiv.org/abs/2310.04772v1
"2023-10-07T10:49:30"
"2023-10-07T10:49:30"
Optimal Sequential Decision-Making in Geosteering: A Reinforcement Learning Approach
Trajectory adjustment decisions throughout the drilling process, called geosteering, affect subsequent choices and information gathering, thus resulting in a coupled sequential decision problem. Previous works on applying decision optimization methods in geosteering rely on greedy optimization or Approximate Dynamic Programming (ADP). Either decision optimization method requires explicit uncertainty and objective function models, making developing decision optimization methods for complex and realistic geosteering environments challenging to impossible. We use the Deep Q-Network (DQN) method, a model-free reinforcement learning (RL) method that learns directly from the decision environment, to optimize geosteering decisions. The expensive computations for RL are handled during the offline training stage. Evaluating DQN needed for real-time decision support takes milliseconds and is faster than the traditional alternatives. Moreover, for two previously published synthetic geosteering scenarios, our results show that RL achieves high-quality outcomes comparable to the quasi-optimal ADP. Yet, the model-free nature of RL means that by replacing the training environment, we can extend it to problems where the solution to ADP is prohibitively expensive to compute. This flexibility will allow applying it to more complex environments and make hybrid versions trained with real data in the future.
[ "Ressi Bonti Muhammad", "Sergey Alyaev", "Reidar Brumer Bratvold" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04772v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04772v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "physics.geo-ph" ]
Highlights Optimal Sequential Decision-Making in Geosteering: A Reinforce- ment Learning Approach Ressi Bonti Muhammad, Sergey Alyaev, Reidar Brumer Bratvold • Reinforcement learning approach for geosteering decision-making prob- lem • Cost-efficient method with comparable results to approximate dynamic programming • Model-free method; allows for solving more complex geosteering envi- ronments 3 2 0 2 t c O 7 ] G L . s c [ 1 v 2 7 7 4 0 . 0 1 3 2 : v i X r a Optimal Sequential Decision-Making in Geosteering: A Reinforcement Learning Approach Ressi Bonti Muhammada,∗, Sergey Alyaevb,∗, Reidar Brumer Bratvolda aUniversity of Stavanger, Kjell Arholms gate 41, Stavanger, 4021, Norway bNORCE Norwegian Research Centre, Nyg ̊ardsgaten 112, Bergen, 5008, Norway Abstract Trajectory adjustment decisions throughout the drilling process, called geosteer- ing, affect subsequent choices and information gathering, thus resulting in a coupled sequential decision problem. Previous works on applying decision optimization methods in geosteering rely on greedy optimization or Approx- imate Dynamic Programming (ADP). Either decision optimization method requires explicit uncertainty and objective function models, making develop- ing decision optimization methods for complex and realistic geosteering en- vironments challenging to impossible. We use the Deep Q-Network (DQN) method, a model-free reinforcement learning (RL) method that learns di- rectly from the decision environment, to optimize geosteering decisions. The expensive computations for RL are handled during the offline training stage. Evaluating DQN needed for real-time decision support takes milliseconds and is faster than the traditional alternatives. Moreover, for two previously published synthetic geosteering scenarios, our results show that RL achieves high-quality outcomes comparable to the quasi-optimal ADP. Yet, the model- free nature of RL means that by replacing the training environment, we can extend it to problems where the solution to ADP is prohibitively expensive to compute. This flexibility will allow applying it to more complex environ- ments and make hybrid versions trained with real data in the future. Keywords: Geosteering, Geosteering decisions, Sequential decision-making, Reinforcement learning, Machine learning, Subsurface energy resources ∗Corresponding authors: Email addresses: ressi.b.muhammad@uis.no (Ressi Bonti Muhammad), saly@norceresearch.no (Sergey Alyaev) Preprint submitted to Journal October 10, 2023 1. Introduction Geosteering operations involve a series of important decisions made by a geosteering team (GST) throughout the drilling process. These decisions influence both the immediate and future outcomes. As the GST receives new logging-while-drilling (LWD) data, they are constantly engaged in decision- making. This dynamic nature of geosteering operations formally establishes them as sequential decision problems (Kullawan et al., 2016b, 2018; Alyaev et al., 2019, 2021). Markov Decision Process (MDP) is a widely used frame- work that can effectively model and represent sequential decision problems. MDP framework provides a formalized approach for modeling the sequen- tial nature of decision-making, which considers several elements of the prob- lem, including the objectives, the alternatives, and the available information. These elements are important if the GST seeks high-quality decision-making that increases the chances of optimally landing the well. In recent years, several publications have attempted to produce a deci- sion optimization method specifically tailored for geosteering environments. Chen et al. (2014) introduced an automated workflow for proactive (greedy) geosteering combined with continuous updating of the geological model us- ing the ensemble Kalman Filter. Kullawan et al. (2016a) proposed a decision optimization method that integrates the Bayesian framework with a multi- objectives, decision-driven approach to geosteering. Kullawan et al. (2018) combined the Bayesian framework with Discretized Stochastic Dynamic Pro- gramming (DSDP), an Approximate Dynamic Programming (ADP) method, to support directional changes in geosteering operations. Alyaev et al. (2019) developed a decision support method that combines the ensemble Kalman filter to sequentially update the geological model realization and an ADP method to solve multi-target geosteering cases. Kristoffersen et al. (2021) proposed to use an evolutionary algorithm to include the effect of Geosteer- ing during well planning. The decision support methods mentioned in the previous paragraph are common in that they often require a complete model of the environment (or environment model), which can be difficult or impossible to develop in complex and uncertain environments like geosteering. A model-free method like reinforcement learning (RL) may be more suitable in such cases. RL is a type of machine learning that allows understanding of the problem to be 2 built up over time through trial-and-error (Sutton and Barto, 2018). In RL, a decision-making agent interacts with an environment, receiving rewards or penalties based on its actions, to learn an optimal policy for achieving a desired goal. By allowing the agent to learn from experience rather than rely- ing on a pre-defined environment model, reinforcement learning can enable a more flexible decision support method that is better suited to the geosteering context. In oil and gas fields, RL has mainly been used for strategic decision- making problems, in which the problems have a fairly long time window in finding the decisions. Several recent publications have used RL to optimize strategic problems in the oil and gas field. Dixit and ElSheikh (2022) showed using RL for stochastic optimal well control to determine the optimal valve openings. Nasir and Durlofsky (2022) compared the traditional closed-loop reservoir management to the reinforcement learning method in determining the optimal bottom-hole pressures of existing wells. He et al. (2022) proposed an RL method for generalizable field development optimization scenarios. All of these works have reached identical conclusions, in which the decision- making policy produced by RL can be directly applied to new scenarios within the range of applicability. Recently, a synthetic study (Liu et al., 2018) showed the applicability of RL in well-placement optimization. In this work, we aim to show the effec- tiveness of RL by applying it to two published geosteering contexts: Kullawan et al. (2016a) and Kullawan et al. (2018). In contrast to greedy optimization and ADP methods used in these setups, which needed an explicit environ- ment model, RL can learn directly from the geosteering contexts without needing a pre-defined model. The flexibility of RL allows us to extend it to new geosteering scenarios with minimum modifications. Furthermore, instead of using a Bayesian framework like the previous decision support methods, we use the inputs to the Bayesian framework as the basis for our decision-making process. This method is made possible because the input data is similar in type to the output data. As a result, the computational costs are significantly reduced, as we do not need to model the probabilistic behavior of the environment explicitly. Additionally, given any available scenario, we also show that RL can provide optimized steering decisions. It eliminates the need for training simulations for each scenario and thus reduces overall computation costs. Finally, we show that RL outperforms greedy optimization used in Kullawan et al. (2016a) and yields comparable results to the ADP used in Kullawan 3 et al. (2018). Our results show that RL can provide near-optimal decision- making policies for geosteering scenarios while being flexible, robust, and computationally efficient. The following 4 sections follow this introduction section. The first section introduces the Markov Decision Process (MDP) and the Bellman equations, emphasizing their importance as the basis for each decision optimization method used in the study. The second section provides a detailed expla- nation of each method and its relationship to the Bellman equation. This section also discusses how RL model is constructed, trained, and evaluated. The third section presents two examples used to compare and measure the performance of RL to greedy optimization and ADP methods. Finally, the last section concludes the study, summarizing the results and their implica- tions. 2. Markov Decision Process In this section, we delve into the fundamental concept of the Markov Decision Process (MDP) and the Bellman equation and their significance as the basis of decision optimization methods. The Markov Decision Process (MDP) is a class of stochastic sequential de- cision processes used to model decision-making problems in discrete, stochas- tic, and sequential domains (Puterman, 1990). MDP includes 5 important elements: (1) T, a set of time points when decisions can be made; (2) S, a finite state space; (3) A, a finite action space; (4) P, a collection of tran- sition probabilities; and (5) R, a real-valued reward function. The Markov property is a fundamental assumption of the MDP and requires that state transitions only depend on the state and action at the current time step and are independent of all past states and actions. The Markov property enables the use of the Bellman equation, which provides a recursive relationship between the value function of a state func- tion and its successor states. Sutton and Barto (2018) used the following equation to describe the nature of this relationship: Vπ(s) = π(a|s) * (cid:88) a (cid:88) s′,r p(s′, r|s, a)[r + γVπ(s′)]. (1) Equation 1 describes the expected value of being in state s while following policy π, which is known as the Bellman equation for the state-value function, denoted by Vπ(s). This equation recursively breaks down the computation 4 into two parts: the immediate reward r and the discounted value of the suc- cessor state, γvπ(s′). The discount factor, γ, whose value should be between 0 and 1, is a parameter used in MDP to balance the value of immediate re- wards against those that may be obtained in the future. The policy, denoted by π(a|s), represents the probability of taking action a in state s. Finally, p(s′, r|s, a), sometimes referred to as transition probabilities, represents the probability of transitioning from state s to state s′ and receiving reward r when taking action a. Sutton and Barto (2018) described another essential concept in the MDP, the action-value (Q-value) function, denoted by Qπ(s, a). It represents the expected cumulative reward obtained by taking action a in state s under policy π: Qπ(s, a) = p(s′, r|s, a)[r + γVπ(s′)]. (2) (cid:88) s′,r The Q-value function helps determine which actions to take in each state to maximize the cumulative reward, as it allows us to compare the expected cumulative reward of each possible action in a given state. 3. Decision Optimization Methods This section investigates three decision optimization methods applied in this study: greedy optimization, Approximate Dynamic Programming (ADP), and Reinforcement Learning (RL). Solving MDP using different de- cision optimization methods may require different Bellman equation formula- tions for the action-value (Q-value) function, as each method uses its unique approach to solve the equation. We will reformulate the equation for each method, highlighting differences and enabling a comparative analysis of their effectiveness in optimizing geosteering decision-making problems. 3.1. Greedy Optimization The greedy optimization, also known as myopic, is a decision-making strategy that relies solely on current knowledge and does not consider any predictive analysis of the potential impact of present decisions on future outcomes (Powell, 2009). In the context of the Bellman equation, greedy optimization sets the discount factor γ to 0 since future rewards are not con- sidered in the decision-making process. Thus, we can reformulate Equation 5 2 as: Q(s, a) = (cid:88) s′,r p(s′, r|s, a) * r (3) where the Q-value function only considers the immediate reward r obtained by taking action a in state s. Kullawan et al. (2016a) proposed a decision-driven method that integrates the Bayesian framework to address multi-criteria geosteering decisions. Their method updated uncertainties ahead of the sensor location based on real-time measurements and considered only those relevant to the current decision- making stage to make decisions. Equation 3 presents the value function used by the method, which emphasizes immediate uncertainties and rewards to guide decision-making. The method follows greedy optimization, which does not take into account future learning and decision-making, and generally leads to locally optimal choices (Kullawan et al., 2016b). Additionally, it also leads to lower value creation than possible. 3.2. Approximate Dynamic Programming Dynamic Programming (DP) is an optimization technique that aims to find optimal solutions for sequential decision problems by considering a se- quence of decisions and information, as proposed by Bellman (1966). The important element behind DP is the Bellman equation which incorporates a discount factor to weigh immediate and future rewards. This factor enables DP to evaluate the long-term consequences of each alternative and select the globally optimal decision at each decision stage. As a result, DP is more computationally demanding than the greedy optimization. In DP, the full form of Equation 2 is used. DP and the Bellman equation have been applied successfully in sequen- tial decision problems across various fields (Wang et al., 2015; Zaccone et al., 2018; Bahlawan et al., 2019). However, applying these techniques to geosteer- ing scenarios requires addressing several challenges. One of the primary challenges is the representation of uncertainty in geosteering, which is of- ten continuous and challenging to handle with discrete methods. Stochastic Dynamic Programming (SDP) is a traditional method for addressing this challenge, but it may still require significant computational resources for real-time geosteering operations (Kullawan et al., 2016b). Another challenge in applying DP to geosteering is the absence of an ex- plicit model of the subsurface or transition probabilities p(s′, r|s, a), which is 6 necessary for the Bellman equation. To address this issue, Kullawan et al. (2018) proposed an Approximate Dynamic Programming (ADP) called the Discretized Stochastic Dynamic Programming (DSDP) method, which ap- proximates transition probabilities by discretizing the state space and using Monte Carlo sampling to assign state-to-state transition probabilities. The DSDP offers an alternative that can produce a quasi-optimal solution to DP. We define quasi-optimal as the optimal solution for the discretized version of the problem, which the DSDP can find with a significant reduction in compu- tational cost. Moreover, the method is readily adapted to various geosteering scenarios with minimal modifications (Kullawan et al., 2018). Despite its advantages, the DSDP is still a dynamic programming method that is susceptible to the curse of dimensionality. It has only been tested on simple geosteering scenarios with a limited number of state space dis- cretizations. Therefore, exploring more suitable decision-making optimiza- tion methods for geosteering scenarios is important. The following section presents a reinforcement learning method that can potentially provide com- parable geosteering decisions with significantly lower long-term computa- tional costs than the DSDP. 3.3. Reinforcement Learning Reinforcement Learning (RL) refers to an optimization method for un- derstanding and automating sequential decision-making (Sutton and Barto, 2018). It involves a decision-making agent that learns an optimal policy in an unpredictable and complex environment. Unlike supervised learning methods, RL focuses on unsupervised and direct interactions between the agent and the environment. The agent interacts with the environment in an MDP system by receiving state st and reward rt at each time step t before performing action at accordingly. The environment then transitions to a new state st+1 and emits a reward rt+1 (time step increases after every interac- tion with the environment) in response to the action taken. The agent learns from experience and continuously adapts its policy to maximize the cumu- lative reward. Figure 1 visually represents the interaction between an RL decision-making agent and its environment. 3.3.1. Q-learning This work focuses on model-free reinforcement learning, which can be fur- ther divided into action-value-based and policy-optimization-based methods 7 Figure 1: RL agent interaction with an environment, inspired by Sutton and Barto (2018). In an MDP system, a decision-making agent interacts with an environment by receiving state st and reward rt inputs, taking action at, and receiving feedback st+1 and rt+1 in response. The agent continually learns from experience to improve its policy and maximize its cumulative reward over time. . (Sutton and Barto, 2018). We work with the Q-learning method, an action- value-based method that uses an equation known as the Q-value update rule to iteratively update the Q-value based on the agent's interaction with the environment. The Q-value update rule is as follows: Q(st, at) ← Q(st, at) + α[rt+1 + γmaxa′Q(st+1, a′) − Q(st, at)]. (4) Here, Q(st, at) represents the current Q-value of performing action at in state st. The Q-value is updated based on the immediate reward rt+1, the maxi- mum Q-value among all possible actions in the next state maxa′Q(st+1, a′), and the current Q-value. The Q-value update rule does not depend on the policy being followed. It solely relies on the maximum Q-value rather than a Q-value of following a specific action to update the Q-value function. The learning rate α controls the step size of the update, while the discount factor γ determines the importance of the next state value. Like the DSDP, Q-learning allows for a more flexible discount factor value, which can be adjusted between 0 and 1, depending on the currently faced context. 8 The main difference between Q-learning, greedy optimization, and DSDP lies in the information they use to calculate the Q-values. The Bellman equation (Equation 2) assumes that the decision-making agent has com- plete knowledge of the environment dynamics, or the transition probabilities p(s′, r|s, a), and uses this information to calculate the Q-values. On the other hand, Q-learning does not require complete knowledge of the environment dynamics, and as a result, Equation 4 does not include the term for transi- tion probabilities. Instead, Q-learning relies on a sequence of experiences to update the Q-values. The method follows an ε-greedy decision-making policy to balance ex- ploration and exploitation trade-offs. With this policy, the agent selects a random action with probability ε and the action corresponding to the max- imum Q-value with probability 1-ε. This method ensures that the agent explores sufficient experiences at the beginning of training before exploiting the maximum Q-values. As training progresses, ε is gradually decreased to a nonzero minimum value εmin, which allows the agent to continue exploring even in later stages of training. Choosing an appropriate value for ε is im- portant to achieving the desired level of exploration and exploitation based on the problem domain. 3.3.2. Deep Q-Network (DQN) Q-learning continuously updates all Q-values until convergence (Sutton and Barto, 2018), which may not be practical for large-scale problems, es- pecially those with continuous state spaces. The Deep Q-Network (DQN) was developed to overcome this limitation. DQN approximates Q-values us- ing a deep neural network, the Q-network, which is trained to minimize a loss function that penalizes the difference between the predicted and target Q-values. The loss function in the DQN implementation is described as follows: L(θ) = [yt − Q(st, at; θt)]2 (5) where yt is the target Q-value and Q(st, at; θt) is the predicted Q-value. The Q-network is trained using stochastic gradient descent to update the weights of the network θt at each time-step t, ultimately leading to a better approxi- mation of the Q-values. Mnih et al. (2015) demonstrates the effectiveness of DQN for solving complex, high-dimensional reinforcement learning problems by showing that the DQN agent can outperform professional humans on a range of Atari games. 9 Incorporating a deep neural network into a reinforcement learning envi- ronment introduces the possibility of unstable or divergent learning (Tsit- siklis and Van Roy, 1997). It can be attributed to two primary causes, the correlations between sequences of experiences, et = (st, at, rt+1, st+1), that may lead to highly correlated data distribution and the correlations between action-value and target-value (Mnih et al., 2015). To address the first cause, DQN uses experience replay, which involves storing the experience at each time step in a memory data set, Dt = e1, ..., et, and uniformly sampling a minibatch of experience b ∼ U (D) from the mem- ory data set to update the Q-network weights using the samples. The second issue is addressed by introducing a separate network, the target network ˆQ, with weight parameters θ−. While the initial network weight parameter θ is updated at each iteration, the target network weight parameter θ− is up- dated every C iteration step by cloning the weight parameters of the initial network. Thus, the target-value in Equation 5 becomes: yt = rt+1 + γmaxa′ ˆQ(st+1, a′; θ− t ). (6) DQN is currently limited to solving problems with a discrete action space consisting of a finite set of possible actions. Each action is typically assigned a unique identifier (e.g., "one," "two") or index (e.g., "0," "1"). This differs from the continuous action space, where an action is selected from a cer- tain distribution. To tackle problems with continuous action spaces, another branch of RL called the policy optimization-based method is needed. To apply DQN to geosteering decision-making contexts, it is necessary to ensure that the action space is discrete. While this limitation may seem restrictive, it does not diminish the value of DQN compared to greedy op- timization and DSDP, which are likewise confined to discrete action space problems. On the other hand, DQN offers an advantage over DSDP due to its more straightforward implementation. As illustrated in Figure 1, the RL agent (or DQN agent) is independent of its environment, enabling the same agent to be trained across multiple contexts without altering the method. Table 1 summarizes the differences between the sequential decision-making optimization methods described in this study. 3.3.3. Model Architecture The model uses a deep neural network to estimate the Q-value for a given state-action pair. Logically, the network takes the state-action pair as input 10 Table 1: Comparison of sequential decision-making optimization methods Algorithms Type Greedy* Model-based Model-based Q-learning Model-free DSDP Future Information Not considered Fully considered Action Space Discrete Discrete Implicitly Considered Discrete DQN Model-free Implicitly Considered Discrete State Space Discrete Discrete Discrete Discrete and Continuous *Greedy optimization as described and used in Kullawan et al. (2016a) and produces the approximate Q-value as output. However, the ε-greedy policy used in the method requires comparing the Q-values of all available actions in a state, resulting in a linear increase in cost as the number of possible actions increases. To address this issue, Mnih et al. (2015) proposes an alternate network design that uses the state representation as input and outputs the Q-value for each action, allowing for a single forward pass to estimate the Q-value of a given state. In this study, we use PyTorch (Paszke et al., 2019) to define our neural network architecture and train the model. We choose a relatively simple two- hidden-layer deep neural network instead of fully using the proposed design, which uses convolutional hidden layers to capture images as its input. Our network consists of two hidden fully-connected linear layers with a ReLU activation function, with the first and second hidden layers containing 128 and 64 rectifier units, respectively. The input and output layers will vary between examples/environments, which will be elaborated on in a subsequent section. It is noteworthy that modifying the inputs and outputs does not affect DQN as it only requires the number of states and actions to initialize the neural network. Figure 2 illustrates the general network architecture used in the study. 3.3.4. General Training and Evaluation To ensure an unbiased comparison with greedy optimization and DSDP, we train the RL agent using a simulated environment based on the geosteer- ing settings mentioned in each journal. Figure 3 shows an example of the simulated environment. We train the RL agent using 51 different random seeds. We evaluate the performance of each trained agent by generating 1000 11 Figure 2: General neural network architecture used in the study. The neural network architecture consists of two hidden layers that take the state representation as inputs and outputs the Q-values for each available action. subsurface realizations from the same distributions used during training. We then compute the median of the average reward obtained by the 51 trained agents. We name this median as "RL-Robust." RL-Robust is calculated as follows: rRL = Median ( ̄r1, ̄r2, . . . , ̄rm) (cid:80)n ̄r = i=1 ri n (7) (8) where m equals to 51 and ̄r is the average reward out of n = 1000 subsurface realizations. In the second example, we introduce another term called the "RL-Best," which considers only the best average reward out of 51 trained agents. We will then compare RL results to the average reward obtained by greedy optimization and DSDP. 4. Numerical Example In this section, we show the application of RL by studying two examples from published journals. Specifically, we analyze the studies did by Kullawan et al. in 2014 and 2018 and show how RL can optimize decision-making in complex and uncertain environments. We compare the results of RL to those obtained using greedy optimization and DSDP. By comparing these results, 12 Figure 3: Illustration of the simulated environment used in the study, taken from the second example. The white lines represent the reservoir boundaries, and the colored lines represent the well trajectories. The changes in color represent sidetracks. The state representation at each step is shown on the top left-hand side, and the corresponding objective function values are displayed on the top right. The number of episodes is shown on the top middle side. The horizontal and vertical axes show the horizontal distance and the current depth in meters, respectively. we can gain valuable insights into the abilities of RL to generate near-optimal decision guidance and objective results. 4.1. First Example This subsection presents the application of RL to the geosteering envi- ronment, which is proposed by Kullawan et al. (2016a). The geosteering scenario involves drilling a horizontal well in a three-layered model with non- uniform reservoir thickness and quality. The reservoir consists of a sand layer sandwiched between shale layers and is divided into two permeability zones: a high-quality zone in the top 40 percent of the reservoir and a low-quality zone comprising the remaining 60 percent. Given the non-uniform thickness of the reservoir, primary uncertainties in this geosteering example are the depths of the top and bottom reservoir boundaries. Signals are received from the sensor, which is located at or behind the bit, and these signals are used to determine the distance to the 13 boundaries (at or behind the bit). These distances are then, in turn, used to update uncertainties about boundary locations ahead of the bit using a Bayesian framework. The framework assumes that the signals are accurate. The reservoir boundaries are discretized into N points. Steering decisions are made by adjusting the well inclination at every n discretization point, where the change in inclination at each decision stage is restricted to no more than 5o. At each decision stage, there are 11 alternatives for inclination adjustment, ranging from −5o to 5o in increments of 1o. The minimum curvature method is used to calculate the trajectory of the well at each discretization point based on the chosen inclination change. Figure 4 shows the geosteering environment as described above. The blue line represents the well trajectory drilled in the three-layered model. The red dashed line indicates the boundary between the high-quality and low-quality reservoir zones. Decisions are made at every n = 10 discretization point to determine the path of the well. The thickness of the reservoir varies at each discretization point, denoted by h. The distances from the well to the upper and lower reservoir boundaries are denoted by DT U B and DT LB, In addition, DT HQ denotes the respectively, so h = DT U B + DT LB. distance from the well to the high-quality zone. Figure 4: Illustration of the geosteering scenario, a remake based on Kullawan et al. (2016a). At every n = 10 discretization points, decisions are made to determine the well trajectory. The blue line represents the well path, while the red dashed line denotes the boundary between high and low-quality reservoir zones. The thickness of the reservoir at each discretization point is represented by h, while DT U B and DT LB denote the distances from the well to the upper and lower reservoir boundaries, respectively. Additionally, DT HQ denotes the distances from the well to the high-quality zone. 14 The primary objective of the example is to optimize the reward function by maximizing the length of the well in the high-quality reservoir zone while at the same time avoiding reservoir exit. Two reward functions are defined for this purpose. The first reward function, r1,i at discretization point i, is: r1,i = 14.654x3 i − 17.778x2 i + 7.2252xi (9) where xi is the distance between the well and the nearest reservoir boundary, min(DT U B, DT LB), normalized by the reservoir thickness hi. The function takes its maximum value (1) when the well is placed in the middle of the reservoir (xi = 0.5). The second objective, r2,i at discretization point i, is: r2,i = −2 × 10−5y2 i + 0.009yi. (10) Here, yi represents the permeability of the zone, and the equation is con- structed for a scenario where the maximum permeability is 200 mD, which results in a value of 1 for yi = 200. The decision context described by Equations 9 and 10 is multi-objective with two conflicting objectives. Equation 9 indicates that placing the well in the center of the reservoir minimizes the risk of exiting the reservoir, while Equation 10 suggests that the well should be positioned in the high-quality zone to maximize its value. However, positioning the well in the high-quality zone increases the risk of drilling into the upper shale layer, which goes against the primary objective. We thus apply a common multi-objective (Bratvold et al., 2010) decision analytic approach where the objectives are weighted. This entails computing the weighted overall reward for each of the 11 alternatives. The weighted overall reward, rj, at decision stage j, is: rj = w1 n∗j−1 (cid:88) r1,i + w2 n∗j−1 (cid:88) r2,i. i=n∗(j−1) i=n∗(j−1) (11) Here, w1 and w2 denote the weights assigned to the two objectives, and r1,i and r2,i represent the computed reward for the ith discretization point for the two objectives, respectively. With w1 + w2 = 1, the maximum value of rj is n = 10. 4.1.1. RL Setting In order to use RL method for sequential decision-making, we need to define parameters such as the action space, reward function, and state space 15 based on the geosteering scenario. These parameters are needed for the RL agent to learn and find the optimal strategy for the scenario. Action space. The geosteerers are engaged in decision-making to place the well optimally. They will make decisions, each with a set of alterna- tives, consisting of 11 discrete values ranging from -5o to 5o at each decision stage. As a result, the neural network has 11 output nodes in this scenario, corresponding to the available actions that the RL agent can take. Reward function. One of the objectives in Kullawan et al. (2016a) was to study the effect of alternative weights for each objective on the final well placement rather than the reward function. However, the RL agent is trained to maximize the reward function defined in Equation 11 for every available scenario. We compare greedy optimization and RL based on their reward function to ensure consistent training and evaluation. We use N = 100 discretization points, and have 10 decision stages. Thus, the maximum reward for a single geosteering equals to n ∗ 10 = 100. State space. We need to specify a state space relevant to the reward function to ensure that the RL agent has the necessary information to opti- mize geosteering decisions. Specifically, we provide the RL agent with n + 1 pieces of information for reservoir thickness and the vertical distances to the reservoir boundaries and high-quality zone, with the n pieces representing posterior updates ahead of the sensor location and the +1 piece represent- ing the sensor reading at the current decision stage. In addition, the RL agent receives another 5 pieces of information. These include the horizon- tal distance from the starting point, the inclination assigned to the current discretization point, the quality of the reservoir, and the weights associated with each objective. With n = 10 or 10 points between each decision stage, the RL agent receives 49 state information inputs, consisting of 40 posterior information pieces, 4 sensor readings, and the 5 complementary information pieces mentioned above. This configuration is referred to as "RL-Posterior." In an alternative method, the Bayesian framework and posterior updates are not used. Instead, the RL agent receives sensor readings from n dis- cretization points behind the sensor location, while other complementary information is identical in both methods. This method can help us show the capacity of RL (DQN) to optimize the problem by implicitly predict- ing the boundaries ahead of the sensor location without the need for po- tentially costly Bayesian computations. This configuration is referred to as "RL-Sensor." The state representation of both RL agents is summarized in Table 2. 16 The first two rows correspond to the n + 1 information described earlier. However, the important distinction lies in the subscript notation of the in- formation. For the RL-Posterior method, the information range from the sensor location i to n discretization points ahead, while for the RL-Sensor method, the information starts from n discretization points behind the sensor location i. The remaining information, including Inci representing the incli- nation at the current point, i denoting the current discretization point (or equivalently, the horizontal distance from the starting point), y representing the reservoir quality, and w1 and w2 denoting the weights of each objective, remain consistent across both agents. Table 2: Comparison of the state representations of the two RL methods Model RL-Posterior RL-Sensor State Representation {DT U Bi,..., DT U Bi+n, DT LBi,..., DT LBi+n, DT HQi,..., DT HQi+n, hi,..., hi+n, Inci, i, y, w1, w2} {DT U Bi−n,..., DT U Bi, DT LBi−n,..., DT LBi, DT HQi−n,..., DT HQi, hi−n,..., hi, Inci, i, y, w1, w2} 4.1.2. Training Results Following Kullawan et al. (2016a), we split the example into two scenarios based on the reservoir quality disparity between the two zones. We train the RL agent to optimize both scenarios simultaneously to avoid the need to train the RL agent multiple times. It could also show the generalizability of the resulting decision-making policy. Figure 5 visually shows the outcomes of training a single seed of the two RL methods: the RL-Posterior and RL-Sensor, in the first example. The red lines represent the RL-Posterior method, while the blue lines represent the RL-Sensor method. The figure presents the evolution of the percent- age of each individual objective, specifically the reservoir contact and the high-quality zone percentages, alongside the rewards obtained during the geosteering operation. The figure is constructed by taking the average of the numbers (percentages and rewards) obtained during the last 100 training episodes. This approach provides a smoothed representation of the per- formance of an RL decision-making agent and helps mitigate the effects of short-term fluctuations. 17 Both RL agents gradually improve their decision-making policies through- out the training, as seen by the overall increase in all objectives and rewards. The reservoir contact objective, which initially stands at less than 40 per- cent during the early stage of training, improves significantly for both agents, reaching approximately 90 percent by the end of the training. Additionally, both agents increase the high-quality zone percentage from 20 percent to approximately 60 percent after the training sequence. Regarding the rewards, it is important to address the presence of large negative values observed at the beginning of the training. These values are caused by the reward function associated with the first objective. The re- ward function assigns a large negative number when the well trajectory is significantly distant from the target zone, resulting in the noticeable negative values shown in the figure. However, as the RL agent learns from experience, the rewards gradually increase and remain above zero when the training se- quence ends. While the difference between the two agents may appear negligible at first glance, closer examination reveals a slight advantage for the RL-Sensor method regarding the high-quality zone objective. It is important to note that the figure shown is based on a single training seed, and a more compre- hensive comparison will be done in the subsequent section. In that section, the performance of all training seeds will be averaged, providing a more ro- bust comparison of the relative performance between the RL agents. Another important aspect is the computational cost of training a single seed. The RL-Posterior method requires approximately 2500 seconds to com- plete the training sequence, whereas the RL-Sensor method completes the training in a significantly shorter time, around 500 seconds. This substantial difference in training duration is caused by the utilization of the Bayesian framework in the RL-Posterior method, which introduces additional com- putational costs. On the other hand, the RL-Sensor method, which does not rely on the Bayesian framework, offers a more computationally efficient alternative. 4.1.3. Evaluation Results We generate 1000 different reservoir realizations for evaluation purposes, ensuring that the results represent various scenarios described below. This subsection presents the results of the first study, while the subsequent sub- section will focus on discussing those results in more detail. Scenario 1. The permeability of the high-quality zone is 200 mD, 18 (a) Reservoir Contact (b) High Quality Zone (c) Rewards Figure 5: Evolution of individual objectives (reservoir contact and high-quality zone per- centages) and the overall rewards of two RL agents during training. The red lines represent the RL-Posterior method, while the blue lines represent the RL-Sensor method. The figure reflects the average from the last 100 training episodes. whereas the permeability of the low-quality zone is 100 mD. There is a dis- tinction in quality, although it is not substantial. Consequently, the first objective is assigned a greater weight, with w1 = 0.67 and w2 = 0.33. Table 3: Scenario 1 - Average results for greedy optimization and Median results for both RL-agents Methods Greedy RL-Posterior* RL-Sensor* *RL-Robust Rewards Reservoir contact (%) High quality (%) 43.00 44.06 46.77 71.44 85.25 85.79 87.90 92.86 92.86 Table 3 presents the results of greedy optimization and two RL meth- ods, RL-Posterior and RL-Sensor. The median reward of the RL-Posterior method is 85.25 out of 100, representing a significant improvement of 19.34 percent over the greedy optimization. Meanwhile, the RL-Sensor method 19 achieves a slightly higher median reward of 85.79. Furthermore, both RL agents yield better well placement by achieving higher figures on both objec- tives. Scenario 2. The permeability of the high-quality zone is 200 mD, while the permeability of the low-quality zone is 20 mD. Given the more substantial difference in quality compared to scenario 1, it is important to position the well in the top portion of the reservoir. Therefore, the weight for the second objective is greater than in the first objective, with w1 = 0.41 and w2 = 0.59. Table 4: Scenario 2 - Average results for greedy optimization and Median results for both RL-agents Methods Greedy RL-Posterior* RL-Sensor* *RL-Robust Rewards Reservoir contact (%) High quality (%) 53.20 65.62 70.22 55.57 73.76 74.21 82.50 89.85 88.65 Table 4 presents the average results of greedy optimization and median results of both RL configurations in scenario 2. Similar to scenario 1, the RL-Posterior and RL-Sensor methods outperform greedy optimization in all three metrics, with higher rewards, reservoir contact percentage, and high- quality percentage. The primary objective in this scenario is to position the well inside the high-quality zone. As a result, the well is placed closer to the upper reservoir borders, which increases the probability of exiting the reservoir, leading to a relatively low reward from the first reward function. Furthermore, the low- quality zone in scenario 2 has a lower permeability value than in scenario 1, reducing the overall reward of scenario 2. Nevertheless, the table illustrates that RL has higher value in scenario 2 than in scenario 1, with a 32.74 percent increase for the RL-Posterior method and a 33.55 percent increase for the RL-Sensor method. 4.1.4. Discussion The RL methods used in this study yield significantly better results than greedy optimization. The superior performance of the RL methods is at- tributed to their ability to learn from experience and explore different strate- gies to maximize the reward. By contrast, greedy optimization only consid- 20 ers the immediate reward and does not consider future decisions and future learning. The results also show that the RL-Sensor method consistently outper- forms the RL-Posterior method in terms of median reward across all scenar- ios. Although the difference in performance is insignificant, it is consistent, and the RL-Sensor method achieves the results without requiring posterior updates, suggesting that it can implicitly anticipate reservoir boundaries us- ing the sensor readings behind the sensor location. One plausible explana- tion for the observed difference is that the posterior updates derived from the Bayesian framework might contain inaccuracies and errors. Although the implicit predictions from RL can also suffer from similar issues, the superior performance of the RL-Sensor method implies that the implicit predictions provide more accurate approximations compared to the posterior updates. Moreover, eliminating the Bayesian framework in the RL-Sensor method reduces the training time for a single seed from 2500 to 500 seconds while still achieving superior results. With a computational cost that is 5 times cheaper, the RL-Sensor method remains the superior method even when its results are slightly worse than those of the RL-Posterior method. Therefore, we exclusively use the RL-Sensor method for the second example described in the following subsection. 4.2. Second Example In this section, we show the application of the RL-Sensor method to an example previously shown by Kullawan et al. (2018). Their study used greedy optimization and DSDP to optimize a geosteering scenario in thin and faulted reservoirs. The geosteering context for this example is similar to the first example, where a horizontal well is drilled in a three-layered reservoir model consisting of a sand reservoir sandwiched between shale layers. The example considers a constant reservoir thickness and uniform qual- ity, reducing uncertainties in this case to the depths of the upper reservoir boundary and the location and displacement of faults. The prior knowledge of the depth of boundaries is combined with fault information, such as the number of faults, expected fault displacement, and possible fault location. As in the first example, Kullawan et al. (2018) uses a Bayesian framework to update the combined prior information based on real-time sensor data. Additionally, the study assumes that the real-time information is accurate. We use the same prior geomodel and fault uncertainty parameters as Kullawan et al. (2018), shown in Figure 6. The reservoir boundaries are 21 discretized into 30 points (N = 30) spaced 30 meters apart, with solid black lines indicating the expected upper and lower boundaries of the reservoir. Green dashed lines represent potential fault displacements, with uncertainty modeled using a normal distribution. Red dashed lines indicate possible fault locations, with uncertainty modeled using discrete uniform distributions. For instance, the first fault has an estimated displacement of 3 meters, with a standard deviation of 1 meter, and may be located 120 meters, 150 meters, or 180 meters from the first discretization point. Figure 6: Illustration of prior geomodel and fault uncertainties remade based on Kullawan et al. (2018). The expected upper and lower boundaries are shown as solid black lines. Uncertainty in potential fault displacements is represented by green dashed lines, modeled using a normal distribution. Uncertainty in possible fault locations is represented by red dashed lines, modeled using discrete uniform distributions. In this geosteering setting, there are 29 decision stages, and steering de- cisions are made at every discretization point (n = 1) by directly modifying the well depth without using the minimum curvature method. At each de- cision stage j, 5 options are available for altering the well depth, ranging from −0.5-m TVD to 0.5-m TVD with a 0.25-m TVD increase. Addition- ally, sidetracking can be done if the well exits the reservoir after deciding to modify or maintain the well depth. We refer to it as the default setup, where a steering decision is followed by a sidetrack decision. Sidetracking can ensure that the well is drilled towards the center of the boundary. However, it incurs additional costs. In other words, sidetracking represents a trade-off between future gain and present increased expense. Figure 7 illustrates how each alternative changes the well depth at each decision node. In this example, the blue line represents the well trajectory, which has exited the reservoir boundaries, represented by the black lines. When making a steering decision, the decision maker can adjust the well 22 depth using any of the 5 alternatives represented by the blue arrows. On the other hand, if the decision maker chooses to execute a sidetrack, the well is taken back to the previous decision stage and drilled directly to the middle of the reservoir boundaries for the next decision stage, as shown by the red line and arrows. The blue dashed line in the figure indicates that the previous well trajectory is discarded as if it had never been drilled. Figure 7: Illustration of alternatives from the second example. The blue line represents the well trajectory, while the black lines represent the reservoir boundaries. The decision maker can make a steering decision using the 5 alternatives represented by the blue arrows. If the sidetrack is chosen, the well is taken back to the previous decision stage and drilled directly to the middle of the reservoir boundaries for the next decision stage, as shown by the red line and arrows. In this example, we aim to optimize the reward of a geosteering project by maximizing reservoir contact and minimizing operating costs. To this end, the setting uses a reward function rj that combines the values vj and operating costs cj at each decision stage j. Specifically, rj is defined as: rj = vj − cj. Here, vj represents the value given the location of the well, which is equal to the production value vprod if the well is located within the reservoir and 0 otherwise. The operating cost cj is the sum of the drilling cost cd, and the sidetrack cost cST if sidetracking is done. We use values of vprod ranging from 0.5 to 4.0, with cd and cST held constant at 0.0625 and 2.567, respectively. Consequently, for 29 decision stages, the maximum value of a geosteering project is 29 * vprod, and the minimum operating cost is 29 * cd = 1.81. (12) 4.2.1. RL Setting As in the first example, we need to specify the following three parameters from the geosteering scenario to use RL for sequential decision-making: 23 Action space. In the default setup, there are two decision nodes in one decision stage: the first for modifying the drill bit depth and the second for performing a sidetrack. However, this configuration can lead to sub-optimal results for specific scenarios when we use RL. For example, when the value vprod is less than the sidetrack cost cST , an RL decision-making agent using two decision nodes may follow a greedy decision-making policy and decline to do a sidetrack. Conversely, when vprod exceeds cST , the agent will always choose to sidetrack, irrespective of the actual value of the well. Thus, using two decision nodes could limit the ability of the RL agent to make optimal decisions regarding sidetracking. To address this issue, we adapt the action space to include a single decision node with 6 alternatives, 5 of which correspond to adjustments in the drill bit depth, while the sixth alternative is for performing a sidetrack. As a result, the neural network for the second scenario contains 6 output nodes. However, this modification introduces another issue where the sidetrack alternative is consistently available, whereas in the default setup, the side- track option is restricted when the drill bit is already within the reservoir. To address this issue, we temporarily force the RL agent to disregard the sidetrack alternative when it is unnecessary. On the other hand, if the drill bit exits the reservoir, every alternative is available for the RL agent. Hence, it can either execute a sidetrack or continue making steering decisions for the subsequent decision stages. This approach enables the agent to make appropriate decisions based on the current location of the drill bit. As a result, we can evaluate the ability of the RL agent to handle both steering and sidetrack decisions effectively. Reward function. The reward function used in the RL configuration remains unchanged and is the same as the default setting, as shown in Equa- tion 12. Thus, the RL agent receives a reward rj after each decision stage. Moreover, we did not alter the evaluation method since the default setting already used a consistent approach that compared the performance of dif- ferent methods based on their total reward function, which is defined as the sum of rewards over all decision stages, i.e., (cid:80) rj. State space. As the second example assumes a constant reservoir thick- ness and homogeneous reservoir quality, the RL-Sensor method requires less information about the reservoir than in the first. We provide an RL decision- making agent n + 1 information on vertical distances between the well tra- jectory and reservoir boundaries. Additionally, with the inclusion of faults and sidetracks in the geosteering setting, we also inform the agent about the 24 possible zone and the expected displacement of the subsequent fault. Furthermore, it is important for the agent to know whether the well trajectory is inside or outside the reservoir. We also inform the agent about its horizontal distance from the initial point and the value of the current geosteering project. Consequently, the RL-Sensor method gathers 9 pieces of information at each decision stage, which serve as inputs for the neural network. 4.2.2. Training Results Figure 8 illustrates the training outcomes of the RL-Sensor method in the second example. The training for a single seed requires approximately 20 minutes. Similar to the first example, the figure presents the evolution of individual objectives, specifically the reservoir contact and the operating cost, alongside the overall rewards obtained during the geosteering operation. The figure is also constructed by taking the average obtained during the last 100 training steps. Moreover, the training also considers the number of scenarios the example has. The scenario in this example depends on the production value vprod that ranges from 0.5 to 4. The figure illustrates the evolution of the RL-sensor method decision- making policy. Over time, the RL-Sensor method improves the reservoir contact from an initial percentage of 65 to approximately 90 percent. Simul- taneously, it reduces the operating cost from a starting cost of 8 to around 3, which correlates with decreased sidetrack operations. In other words, the RL- Sensor method gradually learns to make a better steering decision, reducing the need for frequent sidetrack operations. The evolution of the average rewards shows a higher fluctuation level than in the previous example. This increased variability is primarily attributed to the influence of the production value, vprod, which is determined by the random sampling procedures used during the training sequence. For instance, when vprod is set to 0.5, the maximum reward attainable by a decision-making agent in a single training episode is 29×0.5−1.81 = 12.69. Conversely, when vprod equals 4, the maximum achievable reward becomes 29 × 4 − 1.81 = 114.19, approximately 10 times larger than the other scenario. 4.2.3. Evaluation Results We run 1000 simulations of the geomodel shown in Figure 6 to evaluate the performance of different methods by studying the impact of varying vprod values on the rewards, reservoir contact, and operating cost. This subsection 25 (a) Reservoir Contact (b) Operating Cost (c) Rewards Figure 8: Evolution of individual objectives (reservoir contact and operating costs) and the overall rewards of the RL-Sensor method during training. The figure reflects the average from the last 100 training episodes presents the results, while the subsequent subsection will provide a discussion and analysis of the results. Scenario 1. vprod = 0.5, resulting in a very expensive sidetrack cost and making sidetrack decisions less favorable than steering decisions (vprod <<< cST ). Table 5 shows the rewards, reservoir contact, and operating cost of all three methods for scenario 1. Table 5: Scenario 1 - Results for Greedy Optimization, DSDP, RL-Sensor Robust, and RL-Sensor Best Methods Greedy DSDP RL-Sensor RL-Sensor Best Rewards Reservoir contact (%) Operating Cost 1.81 2.01 1.81 1.82 8.33 11.40 11.50 11.72 69.94 92.47 91.80 93.37 At vprod = 0.5, greedy optimization never chooses to do a sidetrack, as 26 suggested by its minimum operating cost of 1.81. It achieves the lowest aver- age reservoir contact of 69.94 percent and, unsurprisingly, the lowest average reward among the other methods, at 8.33. On the other hand, the DSDP achieves a significantly higher reservoir contact of 92.47 percent compared to greedy optimization. The RL-Sensor method achieves a high reservoir contact of 91.80 per- cent while maintaining a minimal cost of operation. In this scenario, the RL-Sensor decision-making policy is similar to greedy optimization in that it does not do sidetrack operations and relies only on steering decisions. De- spite not performing any sidetracks, the results show that the RL-Sensor method, with a median reward of 11.50, slightly outperforms the DSDP. We also include RL-Sensor Best, and it further outperforms the DSDP with a reservoir contact percentage of 93.37 and a median reward of 11.72. Scenario 2. vprod = 2, which is still slightly lower than the sidetrack cost (vprod < cST ). Table 6 shows the rewards, reservoir contact, and operating cost of all three methods for scenario 2. Table 6: Scenario 2 - Results for Greedy Optimization, DSDP, RL-Sensor Robust, and RL-Sensor Best Methods Greedy DSDP RL-Sensor RL-Sensor Best Rewards Reservoir contact (%) Operating Cost 1.81 3.18 3.68 2.87 69.96 95.02 96.54 96.17 38.76 51.93 52.31 52.90 The decision-making policy of greedy optimization remains the same at vprod = 2 as the production value is still below the sidetrack cost. As a result, greedy optimization still achieves the minimum operating cost with no improvement in reservoir contact. Similar to the first scenario, its average reward is the lowest among all methods at 38.76. On the other hand, the DSDP performs more sidetrack operations than in the previous scenario, resulting in a higher cost. However, this method achieves an average reward of 51.93, considerably better than greedy optimization. Like the DSDP, the RL-Sensor method incurs a higher operating cost than in scenario 1 due to performing more sidetrack operations. Specifically, the decision-making policy of the RL-Sensor method leads to an operating cost of 3.68 while achieving a high reservoir contact of 96.54 percent. These 27 results show the ability of the RL-Sensor method to strike a balance between maximizing reservoir contact and minimizing operating cost, even when the production value is still below the sidetrack cost. Compared to the DSDP, the RL-Sensor method yields a slightly higher median reward of 52.31. The RL-Sensor Best outperforms all other methods, achieving the highest average reward of 52.90 with a reservoir contact of 96.17 percent and an operating cost of 2.87. Scenario 3. vprod = 4, resulting in a very cheap sidetrack cost and making it, when available, more favorable than steering decisions (vprod >>> cST ). Table 7 shows the rewards, reservoir contact, and operating cost of all three methods for scenario 3. Table 7: Scenario 3 - Results for Greedy Optimization, DSDP, RL-Sensor Robust, and RL-Sensor Best Methods Greedy DSDP RL-Sensor RL-Sensor Best Rewards Reservoir contact (%) Operating Cost 9.54 6.25 5.80 3.23 104.44 107.73 107.46 109.10 98.26 98.26 97.64 96.83 At vprod = 4, greedy optimization maximizes immediate reward by per- forming a sidetrack whenever the well exits the reservoir, resulting in 98.26 percent reservoir contact. However, this strategy comes at a significant in- crease in operating costs. On the other hand, the DSDP reaches the same reservoir contact with fewer sidetracks, resulting in a higher average reward of 107.73 compared to 104.4 for greedy optimization. The RL-Sensor method achieves a reservoir contact of 97.64 percent but Its average reward of at a lower operating cost than the other methods. 107.46 is only 0.25 lower than the DSDP. However, this is the only scenario where the RL-Sensor method cannot outperform the DSDP, which occurs when the DSDP provides the least additional value over greedy optimiza- tion. Nonetheless, the RL-Sensor Best achieves the highest reward among all methods, with a reservoir contact of 96.83 percent and an operating cost of 3.23. 4.2.4. Discussion The results from the second example provide additional evidence support- ing our results that the RL-Sensor method outperforms greedy optimization. 28 This example effectively demonstrates the divergence in decision-making be- tween the two methods. The greedy optimization makes sidetrack decisions based solely on the value of vprod, whereby if it is lower than vST , greedy op- timization always chooses to forego the sidetrack. On the other hand, greedy optimization always chooses to sidetrack if vprod is higher than vST . On the other hand, the sidetrack and overall decision-making policy of the RL-Sensor method consider future values, leading to substantially higher rewards. The results from all studied scenarios also indicate that the performance of the RL-Sensor method is comparable to that of the DSDP, which is con- sidered the quasi-optimal solution to the dynamic programming. In several cases, the RL agent even outperforms the DSDP. One possible explanation is that RL does not require discretization, unlike the DSDP, which may lead to better performance. The absence of discretization in RL may enable it to achieve more accurate results by avoiding information loss during the dis- cretization process. It is worth noting that there is one scenario where the RL-Sensor method does not outperform the DSDP, although the difference is not statistically significant. This scenario is where vprod is higher than vST , leading to a preference for sidetracking over steering if the well exits the reservoir. One plausible explanation is that sidetracking allows to adjust the well trajectory by returning it to the center of the boundaries, thus mitigating the effects of information loss caused by discretization. In addition to comparable performance, the RL agent substantially re- duces long-term computational costs compared to the DSDP. Specifically, after training for approximately 20 minutes, the RL agent can evaluate 1000 reservoir realizations in less than 10 seconds. On the other hand, the current discretization setup requires the DSDP to evaluate one realization in 15-20 seconds. The DSDP would take 4-5 hours to evaluate the same number of reservoir realizations. These results suggest that RL may produce a more computationally cost-efficient solution to the geosteering scenario than the DSDP. 5. Conclusions This study introduces and illustrates the application of reinforcement learning (RL) as a flexible, robust, and computationally efficient sequential decision-making tool in two distinct geosteering environments. 29 The results from the first example indicate that RL-Posterior method suggests decisions that lead to significantly improved value function results compared with greedy optimization, with a 19 to 33 percent increase de- pending on the scenario. In addition to the RL-Posterior method, we intro- duce an alternative method called the RL-Sensor method. The RL-Sensor method ignores the posterior updates and relies on the inputs to the Bayesian framework. The RL-Sensor method offers slightly better rewards than the RL-Posterior method while significantly reducing the computational cost. Specifically, the computation time is reduced from 2500 seconds to 500 sec- onds. Our results from the second example show that RL provides comparable rewards to the DSDP, which we define as the quasi-optimal solution to dy- namic programming. Notably, RL achieves these results with significantly less computational cost. Specifically, the computation time for training an RL decision-making agent and evaluating 1000 geomodel realizations is ap- proximately 20 minutes (training) + 10 seconds (evaluating). On the other hand, the DSDP requires 15 to 20 seconds for each realization, resulting in approximately 4-5 hours to evaluate 1000 realizations. These results suggest that RL is a promising alternative to the DSDP for optimizing geosteering decision-making problems where computational efficiency is important. We also highlight the ease of implementing RL method, which is inde- pendent of the environment. The challenge lies in defining the appropriate state representation to optimize the reward function for each environment. As shown in our study, certain information may be relevant in one setting but not another. For instance, inclination is included as one of the states in the first environment but not in the second. Overall, the results show the flexi- bility and potential of RL-based methods in optimizing complex geosteering decision-making problems in various environments. Our study assumes that the primary source of uncertainty in both en- vironments is the reservoir boundaries and that there are no errors in the sensor readings. In reality, geosteering decisions are made in the face of mul- tiple uncertainties, and sensor readings have different levels of precision. To address this limitation, future studies could explore the ability of RL in pro- viding an efficient and robust geosteering decision-making strategy under any number of uncertainties and can also deal with sensor reading errors. This would provide a more realistic evaluation of the performance of RL method and its potential for decision optimization in practical applications. 30 Acknowledgements This work is part of the Center for Research-based Innovation DigiWells: Digital Well Center for Value Creation, Competitiveness and Minimum En- vironmental Footprint (NFR SFI project no. 309589, https://DigiWells.no). The center is a cooperation of NORCE Norwegian Research Centre, the Uni- versity of Stavanger, the Norwegian University of Science and Technology It is funded by Aker BP, Cono- (NTNU), and the University of Bergen. coPhillips, Equinor, TotalEnergies, V ̊ar Energi, Wintershall Dea, and the Research Council of Norway. Declaration of generative AI and AI-assisted technologies in the writing process During the preparation of this work, the author(s) used ChatGPT in order to improve the readability. After using this tool/service, the author(s) reviewed and edited the content as needed and take(s) full responsibility for the content of the publication. References Alyaev, S., Ivanova, S., Holsaeter, A., Bratvold, R.B., Bendiksen, M., 2021. An interactive sequential-decision benchmark from geosteering. Applied Computing and Geosciences 12, 100072. doi:https://doi.org/10.1016/ j.acags.2021.100072. Alyaev, S., Suter, E., Bratvold, R.B., Hong, A., Luo, X., Fossum, K., 2019. A decision support system for multi-target geosteering. Journal of Petroleum Science and Engineering 183, 106381. doi:https://doi.org/10.1016/j. petrol.2019.106381. Bahlawan, H., Morini, M., Pinelli, M., Spina, P.R., 2019. Dynamic pro- gramming based methodology for the optimization of the sizing and oper- ation of hybrid energy plants. Applied Thermal Engineering 160, 113967. doi:https://doi.org/10.1016/j.applthermaleng.2019.113967. Bellman, R., 1966. Dynamic programming. Science 153, 34–37. doi:10. 1126/science.153.3731.34. 31 Bratvold, R., Begg, S., of Petroleum Engineers (U.S.), S., 2010. Making Good Decisions. Society of Petroleum Engineers. URL: https://books. google.co.id/books?id=d1kbkgAACAAJ. Chen, Y., Lorentzen, R.J., Vefring, E.H., 2014. Optimization of Well Tra- jectory Under Uncertainty for Proactive Geosteering. SPE Journal 20, 368–383. doi:10.2118/172497-PA. Dixit, A., ElSheikh, A.H., 2022. Stochastic optimal well control in subsurface reservoirs using reinforcement learning. Engineering Applications of Arti- ficial Intelligence 114, 105106. doi:10.1016/j.engappai.2022.105106. He, J., Tang, M., Hu, C., Tanaka, S., Wang, K., Wen, X.H., Nasir, Y., 2022. Deep Reinforcement Learning for Generalizable Field Development Optimization. SPE Journal 27, 226–245. doi:10.2118/203951-PA. Kristoffersen, B.S., Silva, T.L., Bellout, M.C., Berg, C.F., 2021. Ef- ficient well placement optimization under uncertainty using a virtual drilling procedure. Computational Geosciences 26, 739–756. doi:10.1007/ s10596-021-10097-4. Kullawan, K., Bratvold, R., Bickel, J., 2016a. Value creation with multi- criteria decision making in geosteering operations. SPE Hydrocarbon Eco- nomics and Evaluation Symposium doi:10.2118/169849-MS. Kullawan, K., Bratvold, R., Bickel, J., 2018. Sequential geosteering decisions for optimization of real-time well placement. Journal of Petroleum Science and Engineering 165, 90–104. doi:https://doi.org/10.1016/j.petrol. 2018.01.068. Kullawan, K., Bratvold, R.B., Nieto, C.M., 2016b. Decision-Oriented Geosteering and the Value of Look-Ahead Information: A Case-Based Study. SPE Journal 22, 767–782. doi:10.2118/184392-PA. Liu, H., Zhu, D., Liu, Y., Du, A., Chen, D., Ye, Z., 2018. A reinforcement learning based 3d guided drilling method: Beyond ground control, in: Pro- ceedings of the 2018 VII International Conference on Network, Communi- cation and Computing, Association for Computing Machinery, New York, NY, USA. p. 44–48. doi:10.1145/3301326.3301374. 32 Mnih, V., Kavukcuoglu, K., Silver, D., Rusu, A.A., Veness, J., Bellemare, M.G., Graves, A., Riedmiller, M., Fidjeland, A.K., Ostrovski, G., Pe- tersen, S., Beattie, C., Sadik, A., Antonoglou, I., King, H., Kumaran, D., Wierstra, D., Legg, S., Hassabis, D., 2015. Human-level control through deep reinforcement learning. Nature 518, 529–533. doi:https: //doi.org/10.1038/nature14236. Nasir, Y., Durlofsky, L.J., 2022. Deep reinforcement learning for optimal well control in subsurface systems with uncertain geology. arXiv preprint doi:10.48550/ARXIV.2203.13375. Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., Desmaison, A., Kopf, A., Yang, E., DeVito, Z., Raison, M., Tejani, A., Chilamkurthy, S., Steiner, B., Fang, L., Bai, J., Chintala, S., 2019. Pytorch: An imperative style, high- performance deep learning library, in: Advances in Neural Information Processing Systems 32. Curran Associates, Inc., pp. 8024–8035. Powell, W.B., 2009. What you should know about approximate dynamic programming. Nav. Res. Logist. 56, 239–249. doi:https://doi.org/10. 1002/nav.20347. Puterman, M.L., 1990. Chapter 8 markov decision processes, in: Stochas- tic Models. Elsevier. volume 2 of Handbooks in Operations Research and Management Science, pp. 331–434. doi:https://doi.org/10.1016/ S0927-0507(05)80172-0. Sutton, R.S., Barto, A.G., 2018. Reinforcement Learning: An Introduction. A Bradford Book, Cambridge, MA, USA. Tsitsiklis, J., Van Roy, B., 1997. An analysis of temporal-difference learning with function approximation. IEEE Transactions on Automatic Control 42, 674–690. doi:10.1109/9.580874. Wang, X., He, H., Sun, F., Zhang, J., 2015. Application study on the dynamic programming algorithm for energy management of plug-in hybrid electric vehicles. Energies 8, 3225–3244. doi:10.3390/en8043225. Zaccone, R., Ottaviani, E., Figari, M., Altosole, M., 2018. Ship voy- age optimization for safe and energy-efficient navigation: A dynamic 33 programming approach. Ocean Engineering 153, 215–224. doi:https: //doi.org/10.1016/j.oceaneng.2018.01.100. 34
http://arxiv.org/abs/2310.04768v2
"2023-10-10T01:55:28"
"2023-10-07T10:20:26"
Online Corrupted User Detection and Regret Minimization
In real-world online web systems, multiple users usually arrive sequentially into the system. For applications like click fraud and fake reviews, some users can maliciously perform corrupted (disrupted) behaviors to trick the system. Therefore, it is crucial to design efficient online learning algorithms to robustly learn from potentially corrupted user behaviors and accurately identify the corrupted users in an online manner. Existing works propose bandit algorithms robust to adversarial corruption. However, these algorithms are designed for a single user, and cannot leverage the implicit social relations among multiple users for more efficient learning. Moreover, none of them consider how to detect corrupted users online in the multiple-user scenario. In this paper, we present an important online learning problem named LOCUD to learn and utilize unknown user relations from disrupted behaviors to speed up learning, and identify the corrupted users in an online setting. To robustly learn and utilize the unknown relations among potentially corrupted users, we propose a novel bandit algorithm RCLUB-WCU. To detect the corrupted users, we devise a novel online detection algorithm OCCUD based on RCLUB-WCU's inferred user relations. We prove a regret upper bound for RCLUB-WCU, which asymptotically matches the lower bound with respect to $T$ up to logarithmic factors, and matches the state-of-the-art results in degenerate cases. We also give a theoretical guarantee for the detection accuracy of OCCUD. With extensive experiments, our methods achieve superior performance over previous bandit algorithms and high corrupted user detection accuracy.
[ "Zhiyong Wang", "Jize Xie", "Tong Yu", "Shuai Li", "John C. S. Lui" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04768v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04768v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 t c O 0 1 ] G L . s c [ 2 v 8 6 7 4 0 . 0 1 3 2 : v i X r a Online Corrupted User Detection and Regret Minimization Zhiyong Wang The Chinese University of Hong Kong zywang21@cse.cuhk.edu.hk Jize Xie Shanghai Jiao Tong University xjzzjl@sjtu.edu.cn Tong Yu Adobe Research worktongyu@gmail.com Shuai Li∗ Shanghai Jiao Tong University shuaili8@sjtu.edu.cn John C.S. Lui The Chinese University of Hong Kong cslui@cse.cuhk.edu.hk Abstract In real-world online web systems, multiple users usually arrive sequentially into the system. For applications like click fraud and fake reviews, some users can maliciously perform corrupted (disrupted) behaviors to trick the system. There- fore, it is crucial to design efficient online learning algorithms to robustly learn from potentially corrupted user behaviors and accurately identify the corrupted users in an online manner. Existing works propose bandit algorithms robust to adversarial corruption. However, these algorithms are designed for a single user, and cannot leverage the implicit social relations among multiple users for more efficient learning. Moreover, none of them consider how to detect corrupted users online in the multiple-user scenario. In this paper, we present an important on- line learning problem named LOCUD to learn and utilize unknown user relations from disrupted behaviors to speed up learning, and identify the corrupted users in an online setting. To robustly learn and utilize the unknown relations among po- tentially corrupted users, we propose a novel bandit algorithm RCLUB-WCU. To detect the corrupted users, we devise a novel online detection algorithm OCCUD based on RCLUB-WCU's inferred user relations. We prove a regret upper bound for RCLUB-WCU, which asymptotically matches the lower bound with respect to T up to logarithmic factors, and matches the state-of-the-art results in degen- erate cases. We also give a theoretical guarantee for the detection accuracy of OCCUD. With extensive experiments, our methods achieve superior performance over previous bandit algorithms and high corrupted user detection accuracy. 1 Introduction In real-world online recommender systems, data from many users arrive in a streaming fashion [4, 15, 2, 7, 35, 27, 26]. There may exist some corrupted (malicious) users, whose behaviors (e.g., click, rating) can be adversarially corrupted (disrupted) over time to fool the system [29, 30, 12, 10, 9]. These corrupted behaviors could disrupt the user preference estimations of the algorithm. As a result, the system would easily be misled and make sub-optimal recommendations [14, 23, 7, 41], ∗Corresponding author. 37th Conference on Neural Information Processing Systems (NeurIPS 2023). which would hurt the user experience. Therefore, it is essential to design efficient online learning algorithms to robustly learn from potentially disrupted behaviors and detect corrupted users in an online manner. There exist some works on bandits with adversarial corruption [29, 9, 22, 5, 12, 16]. However, they have the following limitations. First, existing algorithms are initially designed for robust online preference learning of a single user. In real-world scenarios with multiple users, they cannot robustly infer and utilize the implicit user relations for more efficient learning. Second, none of them consider how to identify corrupted users online in the multiple-user scenario. Though there also exist some works on corrupted user detection [34, 6, 39, 28, 13], they all focus on detection with known user information in an offline setting, thus can not be applied to do online detection from bandit feedback. To address these limitations, we propose a novel bandit problem "Learning and Online Corrupted Users Detection from bandit feedback" (LOCUD). To model and utilize the relations among users, we assume there is an unknown clustering structure over users, where users with similar preferences lie in the same cluster [8, 19, 21]. The agent can infer the clustering structure to leverage the information of similar users for better recommendations. Among these users, there exists a small fraction of corrupted users. They can occasionally perform corrupted behaviors to fool the agent [12, 29, 30, 9] while mimicking the behaviors of normal users most of the time to make themselves hard to discover. The agent not only needs to learn the unknown user preferences and relations robustly from potentially disrupted feedback, balance the exploration-exploitation trade-off to maximize the cumulative reward, but also needs to detect the corrupted users online from bandit feedback. The LOCUD problem is very challenging. First, the corrupted behaviors would cause inaccurate user preference estimations, which could lead to erroneous user relation inference and sub-optimal recommendations. Second, it is nontrivial to detect corrupted users online since their behaviors are dynamic over time (sometimes regular while sometimes corrupted), whereas, in the offline set- ting, corrupted users' information can be fully represented by static embeddings and the existing approaches [18, 32] can typically do binary classifications offline, which are not adaptive over time. We propose a novel learning framework composed of two algorithms to address these challenges. RCLUB-WCU. To robustly estimate user preferences, learn the unknown relations from potentially corrupted behaviors, and perform high-quality recommendations, we propose a novel bandit algo- rithm "Robust CLUstering of Bandits With Corrupted Users" (RCLUB-WCU), which maintains a dynamic graph over users to represent the learned clustering structure, where users linked by edges are inferred to be in the same cluster. RCLUB-WCU adaptively deletes edges and recommends arms based on aggregated interactive information in clusters. We do the following to ensure robust clustering structure learning. (i) To relieve the estimation inaccuracy caused by disrupted behaviors, we use weighted ridge regressions for robust user preference estimations. Specifically, we use the inverse of the confidence radius to weigh each sample. If the confidence radius associated with user it and arm at is large at t, the learner is quite uncertain about the estimation of it's preference on at, indicating the sample at t is likely to be corrupted. Therefore, we use the inverse of the confi- dence radius to assign minor importance to the possibly disrupted samples when doing estimations. (ii) We design a robust edge deletion rule to divide the clusters by considering the potential effect of corruptions, which, together with (i), can ensure that after some interactions, users in the same connected component of the graph are in the same underlying cluster with high probability. OCCUD. To detect corrupted users online, based on the learned clustering structure of RCLUB- WCU, we devise a novel algorithm named "Online Cluster-based Corrupted User Detection" (OC- CUD). At each round, we compare each user's non-robustly estimated preference vector (by ridge regression) and the robust estimation (by weighted regression) of the user's inferred cluster. If the gap exceeds a carefully-designed threshold, we detect this user as corrupted. The intuitions are as follows. With misleading behaviors, the non-robust preference estimations of corrupted users would be far from ground truths. On the other hand, with the accurate clustering of RCLUB-WCU, the ro- bust estimations of users' inferred clusters should be close to ground truths. Therefore, for corrupted users, their non-robust estimates should be far from the robust estimates of their inferred clusters. We summarize our contributions as follows. • We present a novel online learning problem LOCUD, where the agent needs to (i) robustly learn and leverage the unknown user relations to improve online recommendation qualities under the disruption of corrupted user behaviors; (ii) detect the corrupted users online from bandit feedback. 2 • We propose a novel online learning framework composed of two algorithms, RCLUB-WCU and OCCUD, to tackle the challenging LOCUD problem. RCLUB-WCU robustly learns and utilizes the unknown social relations among potentially corrupted users to efficiently minimize regret. Based on RCLUB-WCU's inferred user relations, OCCUD accurately detects corrupted users online. • We prove a regret upper bound for RCLUB-WCU, which matches the lower bound asymptotically in T up to logarithmic factors and matches the state-of-the-art results in several degenerate cases. We also give a theoretical performance guarantee for the online detection algorithm OCCUD. • Experiments on both synthetic and real-world data clearly show the advantages of our methods. 2 Related Work Our work is related to bandits with adversarial corruption and bandits leveraging user relations. The work [29] first studies stochastic bandits with adversarial corruption, where the rewards are corrupted with the sum of corruption magnitudes in all rounds constrained by the corruption level C. They propose a robust elimination-based algorithm. The paper [9] proposes an improved algorithm with a tighter regret bound. The paper [22] first studies stochastic linear bandits with adversarial corruptions. To tackle the contextual linear bandit setting where the arm set changes over time, the work [5] proposes a variant of the OFUL [1] that achieves a sub-linear regret. A recent work [12] proposes the CW-OFUL algorithm that achieves a nearly optimal regret bound. All these works focus on designing robust bandit algorithms for a single user; none consider how to robustly learn and leverage the implicit relations among potentially corrupted users for more efficient learning. Moreover, none of them consider how to online detect corrupted users in the multiple-user case. Some works study how to leverage user relations to accelerate the bandit learning process in the multiple-user case. The work [38] utilizes a known user adjacency graph to share context and payoffs among neighbors. To adaptively learn and utilize unknown user relations, the paper [8] proposes the clustering of bandits (CB) problem where there is an unknown user clustering structure to be learned by the agent. The work [20] uses collaborative effects on items to guide the clustering of users. The paper [19] studies the CB problem in the cascading bandit setting. The work [21] considers the setting where users in the same cluster share both the same preference and the same arrival rate. The paper [25] studies the federated CB problem, considering privacy and communication issues. All these works only consider utilizing the relations among normal users; none of them consider how to robustly learn the user relations from potentially disrupted behaviors, thus would easily be misled by corrupted users. Also, none of them consider how to detect corrupted users from bandit feedback. To the best of our knowledge, this is the first work to study the problem to (i) learn the unknown user relations and preferences from potentially corrupted feedback, and leverage the learned relations to speed up learning; (ii) adaptively detect the corrupted users online from bandit feedback. 3 Problem Setup This section formulates the problem of "Learning and Online Corrupted Users Detection from ban- x⊤M x, [m] = {1, . . . , m}, dit feedback" (LOCUD) (illustrated in Fig.1). We denote ∥x∥M = number of elements in set A as |A|. √ In LOCUD, there are u users, which we denote by set U = {1, 2, . . . , u}. Some of them are corrupted users, denoted by set ̃U ⊆ U. These corrupted users, on the one hand, try to mimic normal users to make themselves hard to detect; on the other hand, they can occasionally perform corrupted behaviors to fool the agent into making sub-optimal decisions. Each user i ∈ U, no matter a normal one or corrupted one, is associated with a (possibly mimicked for corrupted users) preference feature vector θi ∈ Rd that is unknown and ∥θi∥2 ≤ 1. There is an underlying clustering structure among all the users representing the similarity of their preferences, but it is unknown to the agent and needs to be learned via interactions. Specifically, the set of users U can be partitioned into m (m ≪ u) clusters, V1, V2, . . . Vm, where ∪j∈[m]Vj = U, and Vj ∩ Vj′ = ∅, for j ̸= j′. Users in the same cluster have the same preference feature vector, while users in different clusters have different preference vectors. We use θj to denote the common preference vector shared by users in the j-th cluster Vj, and use j(i) to denote the index of cluster user i belongs to (i.e., i ∈ Vj(i)). For 3 any two users k, i ∈ U, if k ∈ Vj(i), then θk = θj(i) = θi; otherwise θk ̸= θi. We assume the arm set A ⊆ Rd is finite. Each arm a ∈ A is associated with a feature vector xa ∈ Rd with ∥xa∥2 ≤ 1. The learning process of the agent is as fol- lows. At each round t ∈ [T ], a user it ∈ U comes to be served, and the learn- ing agent receives a set of arms At ⊆ A to choose from. The agent infers the cluster Vt that user it belongs to based on the in- teraction history, and recommends an arm at ∈ At according to the aggregated in- formation gathered in the cluster Vt. After receiving the recommended arm at, a nor- mal user it will give a random reward with expectation x⊤ at θit to the agent. To model the behaviors of corrupted users, following [29, 9, 5, 12], we assume that they can occasionally corrupt the rewards to mislead the agent into recommending sub-optimal arms. Specifically, at each round t, if the current served user is a cor- rupted user (i.e., it ∈ ̃U), the user can cor- rupt the reward by ct. In summary, we model the reward received by the agent at round t as Figure 1: Illustration of LOCUD. The unknown user relations are represented by dotted circles, e.g., user 3, 7 have similar preferences and thus can be in the same user segment (i.e., cluster). Users 6 and 8 are corrupted users with dynamic behaviors over time (e.g., for user 8, the behaviors are normal at t1 and t3 (blue), but are adversarially corrupted at t2 and t4 (red)[29, 12]), making them hard to be detected online. The agent needs to learn user relations to utilize information among similar users to speed up learning, and detect corrupted users 6, 8 online from bandit feedback. θit + ηt + ct , rt = x⊤ at where ct = 0 if it is a normal user, (i.e., it /∈ ̃U), and ηt is 1-sub-Gaussian random noise. As the number of corrupted users is usually small, and they only corrupt the rewards occasionally with small magnitudes to make themselves hard to detect, we assume the sum of corruption magni- tudes in all rounds is upper bounded by the corruption level C, i.e., (cid:80)T We assume the clusters, users, and items satisfy the following assumptions. Note that all these assumptions basically follow the settings from classical works on clustering of bandits [8, 19, 25, 36]. Assumption 1 (Gap between different clusters). The gap between any two preference vectors for different clusters is at least an unknown positive constant γ t=1 |ct| ≤ C [29, 9, 5, 12]. (cid:13) (cid:13) (cid:13)θj − θj′(cid:13) (cid:13) (cid:13)2 ≥ γ > 0 , ∀j, j′ ∈ [m] , j ̸= j′ . Assumption 2 (Uniform arrival of users). At each round t, a user it comes uniformly at random from U with probability 1/u, independent of the past rounds. Assumption 3 (Item regularity). At each round t, the feature vector xa of each arm a ∈ At is drawn independently from a fixed unknown distribution ρ over {x ∈ Rd : ∥x∥2 ≤ 1}, where Ex∼ρ[xx⊤]'s minimal eigenvalue λx > 0. At ∀t, for any fixed unit vector z ∈ Rd, (θ⊤z)2 has sub-Gaussian tail with variance no greater than σ2. t ∈ arg maxa∈Atx⊤ Let a∗ One objective of the learning agent is to minimize the expected cumulative regret a θit denote an optimal arm with the highest expected reward at round t. R(T ) = E[(cid:80)T t=1(x⊤ a∗ t Another objective is to detect corrupted users online accurately. Specifically, at round t, the agent will give a set of users ̃Ut as the detected corrupted users, and we want ̃Ut to be as close to the ground-truth set of corrupted users ̃U as possible. θit − x⊤ at θit)] . (1) 4 Algorithms This section introduces our algorithms RCLUB-WCU (Algo.1) and OCCUD (Algo.2). RCLUB- WCU robustly learns the unknown user clustering structure and preferences from corrupted feed- 4 18765432187654321876543218765432 back, and leverages the cluster-based information to accelerate learning. Based on the clustering structure learned by RCLUB-WCU, OCCUD can accurately detect corrupted users online. Algorithm 1 RCLUB-WCU 1: Input: Regularization parameter λ, confidence radius parameter β, threshold parameter α, edge deletion parameter α1, f (T ) = (cid:112)(1 + ln(1 + T ))/(1 + T ). 2: Initialization: M i,0 = 0d×d, bi,0 = 0d×1, ̃M i,0 = 0d×d, ̃bi,0 = 0d×1, Ti,0 = 0 , ∀i ∈ U; A complete graph G0 = (U, E0) over U. 3: for all t = 1, 2, . . . , T do 4: 5: i∈Vt M i,t−1 , bVt,t−1 = (cid:80) Receive the index of the current served user it ∈ U, get the feasible arm set at this round At. Determine the connected components Vt in the current maintained graph Gt−1 = (U, Et−1) such that it ∈ Vt. Calculate the robustly estimated statistics for the cluster Vt: M Vt,t−1 = λI + (cid:80) Select an arm at with largest UCB index in Eq.(3) and receive the corresponding reward rt; Update the statistics for robust estimation of user it: M it,t = M it,t−1 + wit,t−1xatx⊤ at it,t = λI + M it,t, ˆθit,t = M ′−1 M ′ it,t bit,t , wit,t = min{1, α/∥xat∥M ′−1 Keep robust estimation statistics of other users unchanged: M l,t = M l,t−1, bl,t = bl,t−1, Tl,t = Tl,t−1 , ˆθl,t = ˆθl,t−1, for all l ∈ U, l ̸= it; Delete the edge (it, l) ∈ Et−1, if , bit,t = bit,t−1 + wit,t−1rtxat , Tit,t = Tit,t−1 + 1 , bi,t−1 , ˆθVt,t−1 = M −1 Vt,t−1bVt,t−1 ; i∈Vt } ; it,t 6: 7: 8: 9: 10: (cid:13) ˆθit,t − ˆθl,t (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 ≥ α1 (cid:0)f (Tit,t) + f (Tl,t) + αC(cid:1) , and get an updated graph Gt = (U, Et); Use the OCCUD Algorithm (Algo.2) to detect the corrupted users. 11: 12: end for 4.1 RCLUB-WCU The corrupted behaviors may cause inaccurate preference estimations, leading to erroneous relation inference and sub-optimal decisions. In this case, how to learn and utilize unknown user relations to accelerate learning becomes non-trivial. Motivated by this, we design RCLUB-WCU as follows. Assign the inferred cluster Vt for user it. RCLUB-WCU maintains a dynamic undirected graph Gt = (U, Et) over users, which is initialized to be a complete graph (Algo.1 Line 2). Users with similar learned preferences will be connected with edges in Et. The connected components in the graph represent the inferred clusters by the algorithm. At round t, user it comes to be served with a feasible arm set At for the agent to choose from (Line 4). In Line 5, RCLUB-WCU detects the connected component Vt in the graph containing user it to be the current inferred cluster for it. Robust preference estimation of cluster Vt. After determining the cluster Vt, RCLUB-WCU esti- mates the common preferences for users in Vt using the historical feedback of all users in Vt and rec- ommends an arm accordingly. The corrupted behaviors could cause inaccurate preference estimates, which can easily mislead the agent. To address this, inspired by [40, 12], we use weighted ridge re- gression to make corruption-robust estimations. Specifically, RCLUB-WCU robustly estimates the common preference vector of cluster Vt by solving the following weighted ridge regression ˆθVt,t−1 = arg min θ∈Rd (cid:80) s∈[t−1] is∈Vt wis,s(rs − x⊤ as θ)2 + λ ∥θ∥2 2 , (2) where λ > 0 is a regularization coefficient. Its closed-form solution is ˆθVt,t−1 = M −1 where M Vt,t−1 = λI + (cid:80) as, bVt,t−1 = (cid:80) wis,sxasx⊤ wis,srasxas . Vt,t−1bVt,t−1 , s∈[t−1] is∈Vt s∈[t−1] is ∈Vt }, where We set the weight of sample for user is in Vt at round s as wis,s = min{1, α/ ∥xas∥M ′−1 α is a coefficient to be determined later. The intuitions of designing these weights are as follows. is the confidence radius of arm as for user is at s, reflecting how confident The term ∥xas∥M ′−1 the algorithm is about the estimation of is's preference on as at s. If ∥xas ∥M ′−1 is large, it means the agent is uncertain of user is's preference on as, indicating this sample is probably corrupted. is,s is ,s is,s 5 Therefore, we use the inverse of confidence radius to assign a small weight to this round's sample if it is potentially corrupted. In this way, uncertain information for users in cluster Vt is assigned with less importance when estimating the Vt's preference vector, which could help relieve the estimation inaccuracy caused by corruption. For technical details, please refer to Section 5.1 and Appendix. Recommend at with estimated preference of cluster Vt. Based on the corruption-robust pref- erence estimation ˆθVt,t−1 of cluster Vt, in Line 7, the agent recommends an arm using the upper confidence bound (UCB) strategy to balance exploration and exploitation at = argmaxa∈Atx⊤ a ˆθVt,t−1 + β ∥xa∥M −1 Vt,t−1 ≜ ˆRa,t + Ca,t , (3) √ (cid:113) λ+ λd )+αC is the confidence radius parameter, ˆRa,t denotes where β = the estimated reward of arm a at t, Ca,t denotes the confidence radius of arm a at t. The design of Ca,t theoretically relies on Lemma 2 that will be given in Section 5. δ ) + d log(1 + T 2 log( 1 Update the robust estimation of user it. After receiving rt, the algorithm updates the estimation statistics of user it, while keeping the statistics of others unchanged (Line 8 and Line 9). Specifically, RCLUB-WCU estimates the preference vector of user it by solving a weighted ridge regression ˆθit,t = arg min θ∈Rd (cid:80) s∈[t] is=it wis,s(rs − x⊤ as θ)2 + λ ∥θ∥2 2 (4) with closed-form solution ˆθit,t = (λI + M it,t)−1bit,t , where M it,t = (cid:80) wis,sxas x⊤ as, bit,t = (cid:80) wis,sras xas , and we design the weights in the same way by the same reasoning. Update the dynamic graph. Finally, with the updated statistics of user it, RCLUB-WCU checks s∈[t] is=it s∈[t] is=it Algorithm 2 OCCUD (At round t, used in Line 11 in Algo.1) 1: Initialize ̃Ut = ∅; input probability parameter δ. 2: Update the statistics for non-robust estimation of user it ̃M it,t = ̃M it,t−1 + xatx⊤ at , ̃bit,t = ̃bit,t−1 + rtxat , ̃θit,t = (λI + ̃M it,t)−1 ̃bit,t , 3: Keep non-robust estimation statistics of other users unchanged ̃M l,t = ̃M l,t−1, ̃bl,t = ̃bl,t−1, ̃θl,t = ̃θl,t−1, for all l ∈ U, l ̸= it . 4: for all connected component Vj,t ∈ Gt do 5: Calculate the robust estimation statistics for the cluster Vj,t: M Vj,t,t = λI + (cid:80) bVj,t,t = (cid:80) for all user i ∈ Vj,t do bl,t , ˆθVj,t,t = M −1 M l,t , TVj,t,t = (cid:80) Vj,t,tbVj,t,t ; Tl,t , l∈Vj,t l∈Vj,t l∈Vj,t 6: 7: Detect user i to be a corrupted user and add user i to the set ̃Ut if the following holds: (cid:113) (cid:13) (cid:13) (cid:13) ̃θi,t − ˆθVi,t,t (cid:13) (cid:13) (cid:13)2 > d log(1 + Ti,t (cid:113) λd ) + 2 log( 1 λmin( ̃M i,t) + λ δ ) + (cid:113) √ λ + d log(1 + TVi,t,t λd (cid:113) ) + 2 log( 1 δ ) + √ λ + αC , λmin(M Vi,t,t) where λmin(*) denotes the minimum eigenvalue of the matrix argument. end for 8: 9: end for (5) whether the inferred it's preference similarities with other users are still true, and updates the graph accordingly. Precisely, if gap between the updated estimation ˆθit,t of it and the estimation ˆθl,t of user l exceeds a threshold in Line 10, RCLUB-WCU will delete the edge (it, l) in Gt−1 to split them apart. The threshold is carefully designed to handle the estimation uncertainty from both stochastic noises and potential corruptions. The updated graph Gt = (U, Et) will be used in the next round. 4.2 OCCUD Based on the inferred clustering structure of RCLUB-WCU, we devise a novel online detection algorithm OCCUD (Algo.2). The design ideas and process of OCCUD are as follows. 6 Besides the robust preference estimations (with weighted regression) of users and clusters kept by RCLUB-WCU, OCCUD also maintains the non-robust estimations for each user by online ridge regression without weights (Line 2 and Line 3). Specifically, at round t, OCCUD updates the non- robust estimation of user it by solving the following online ridge regression: with solution ̃θit,t = (λI + ̃M it,t) (cid:80) ̃θit,t = arg min θ∈Rd −1 ̃bit,t , where ̃M it,t = (cid:80) (rs − x⊤ as s∈[t] is=it θ)2 + λ ∥θ∥2 2 , xas x⊤ as , ̃bit,t = (cid:80) ras xas . s∈[t] is=it s∈[t] is=it (6) With the robust and non-robust preference estimations, OCCUD does the following to detect cor- rupted users based on the clustering structure inferred by RCLUB-WCU. First, OCCUD finds the connected components in the graph kept by RCLUB-WCU, which represent the inferred clusters. Then, for each inferred cluster Vj,t ∈ Gt: (1) OCCUD computes its robustly estimated preferences vector ˆθVi,t,t (Line 5). (2) For each user i whose inferred cluster is Vj,t (i.e.,i ∈ Vj,t), OCCUD computes the gap between user i's non-robustly estimated preference vector ̃θi,t and the robust es- timation ˆθVi,t,t for user i's inferred cluster Vj,t. If the gap exceeds a carefully-designed threshold, OCCUD will detect user i as corrupted and add i to the detected corrupted user set ̃Ut (Line 7). (a) RCLUB-WCU (b) OCCUD Figure 2: Algorithm illustrations. Users 6 and 8 are corrupted users (orange), and the others are normal (green). (a) illustrates RCLUB-WCU, which starts with a complete user graph, and adap- tively deletes edges between users (dashed lines) with dissimilar robustly learned preferences. The corrupted behaviors of users 6 and 8 may cause inaccurate preference estimations, leading to erro- neous relation inference. In this case, how to delete edges correctly is non-trivial, and RCLUB-WCU addresses this challenge (detailed in Section 4.1). (b) illustrates OCCUD at some round t, where per- son icons with triangle hats represent the non-robust user preference estimations. The gap between the non-robust estimation of user 6 and the robust estimation of user 6's inferred cluster (circle C1) exceeds the threshold r6 at this round (Line 7 in Algo.2), so OCCUD detects user 6 to be corrupted. The intuitions of OCCUD are as follows. On the one hand, after some interactions, RCLUB-WCU will infer the user clustering structure accurately. Thus, at round t, the robust estimation ˆθVi,t,t for user i's inferred cluster should be pretty close to user i's ground-truth preference vector θi. On the other hand, since the feedback of normal users are always regular, at round t, if user i is a normal user, the non-robust estimation ̃θi,t should also be close to the ground-truth θi. However, the non- robust estimation of a corrupted user should be quite far from the ground truth due to corruptions. Based on this reasoning, OCCUD compares each user's non-robust estimation and the robust esti- mation of the user's inferred cluster to detect the corrupted users. For technical details, please refer to Section 5.2 and Appendix. Simple illustrations of our proposed algorithms can be found in Fig.2. 5 Theoretical Analysis In this section, we theoretically analyze the performances of our proposed algorithms, RCLUB- WCU and OCCUD. Due to the page limit, we put the proofs in the Appendix. 5.1 Regret Analysis of RCLUB-WCU This section gives an upper bound of the expected regret (defined in Eq.(1)) for RCLUB-WCU. The following lemma provides a sufficient time T0(δ), after which RCLUB-WCU can cluster all the users correctly with high probability. 7 18765432187654321876543237156842 Lemma 1. With probability at least 1 − 3δ, RCLUB-WCU will cluster all the users correctly after T0(δ) ≜ 16u log( u δ ) + 4u max{ 288d √ log( γ2α λ ̃λx 0 (1 − e− (λx−x)2 2σ2 for some δ ∈ (0, 1 3 ), where ̃λx ≜ (cid:82) λx )Kdx, |At| ≤ K, ∀t ∈ [T ]. √ u δ ), 16 ̃λ2 x log( 8d ̃λ2 xδ ), λ 72 αγ2 ̃λx , 72αC 2 √ λ ̃λx γ2 } After T0(δ), the following lemma gives a bound of the gap between ˆθVt,t−1 and the ground-truth θit in direction of action vector xa for RCLUB-WCU, which supports the design in Eq.(3). Lemma 2. With probability at least 1 − 4δ for some δ ∈ (0, 1 4 ), ∀t ≥ T0(δ), we have: (cid:12) (cid:12)xT (cid:12) (cid:12) a (ˆθVt,t−1 − θit) (cid:12) (cid:12) ≤ β ∥xa∥M −1 Vt,t−1 ≜ Ca,t . With Lemma 1 and 2, we prove the following theorem on the regret upper bound of RCLUB-WCU. Theorem 3 (Regret Upper Bound of RCLUB-WCU). With the assumptions in Section 3, and picking α = , the expected regret of the RCLUB-WCU algorithm for T rounds satisfies √ √ λ d+ C R(T ) ≤ O(cid:0)( √ C d γ2 ̃λx + 1 ̃λ2 x )u log(T )(cid:1) + O(cid:0)d √ mT log(T )(cid:1) + O(cid:0)mCd log1.5(T )(cid:1) . (7) Discussion and Comparison. The regret bound in Eq.(7) has three terms. The first term is the time needed to get enough information for accurate robust estimations such that RCLUB-WCU could cluster all users correctly afterward with high probability. This term is related to the corruption level C, which is inevitable since, if there are more corrupted user feedback, it will be harder for the algorithm to learn the clustering structure correctly. The last two terms correspond to the regret after T0 with the correct clustering. Specifically, the second term is caused by stochastic noises when leveraging the aggregated information within clusters to make recommendations; the third term associated with the corruption level C is the regret caused by the disruption of corrupted behaviors. When the corruption level C is unknown, we can use its estimated upper bound ˆC ≜ T to replace C in the algorithm. In this way, if C ≤ ˆC, the bound will be replacing C with ˆC in Eq.(7); when T , R(T ) = O(T ), which is already optimal for a large class of bandit algorithms [12]. C > √ √ The following theorem gives a regret lower bound of the LOCUD problem. Theorem 4 (Regret lower bound for LOCUD). There exists a problem instance for the LOCUD problem such that for any algorithm √ R(T ) ≥ Ω(d mT + dC) . Its proof and discussions can be found in Appendix D. The upper bound in Theorem 3 asymptotically matches this lower bound in T up to logarithmic factors, showing our regret bound is nearly optimal. We then compare our regret upper bound with several degenerated cases. First, when C = 0, i.e., all users are normal, our setting degenerates to the classic CB problem [8]. In this case the bound in Theorem 3 becomes O(1/ ̃λ2 mT log(T )), perfectly matching the state-of- the-art results in CB [8, 19, 21]. Second, when m = 1 and u = 1, i.e., there is only one user, our setting degenerates to linear bandits with adversarial corruptions [22, 12], and the bound in Theorem T log(T )) + O(Cd log1.5(T )), it also perfectly matches the nearly optimal result 3 becomes O(d in [12]. The above comparisons also show the tightness of the regret bound of RCLUB-WCU. x * u log(T )) + O(d √ √ 5.2 Theoretical Performance Guarantee for OCCUD The following theorem gives a performance guarantee of the online detection algorithm OCCUD. Theorem 5 (Theoretical Guarantee for OCCUD). With assumptions in Section 3, at ∀t ≥ T0(δ), for any detected corrupted user i ∈ ̃Ut, with probability at least 1 − 5δ, i is indeed a corrupted user. This theorem guarantees that after RCLUB-WCU learns the clustering structure accurately, with high probability, the corrupted users detected by OCCUD are indeed corrupted, showing the high detection accuracy of OCCUD. The proof of Theorem 5 can be found in Appendix D. 8 6 Experiments This section shows experimental results on synthetic and real data to evaluate RCLUB-WCU's rec- ommendation quality and OCCUD's detection accuracy. We compare RCLUB-WCU to LinUCB [1] with a single non-robust estimated vector for all users, LinUCB-Ind with separate non-robust estimated vectors for each user, CW-OFUL [12] with a single robust estimated vector for all users, CW-OFUL-Ind with separate robust estimated vectors for each user, CLUB[8], and SCLUB[21]. More description of these baselines are in Appendix F. To show that the design of OCCUD is non- trivial, we develop a straightforward detection algorithm GCUD, which leverages the same cluster (cid:13) (cid:13) structure as OCCUD but detects corrupted users by selecting users with highest (cid:13)2 in each inferred cluster. GCUD selects users according to the underlying percentage of corrupted users, which is unrealistic in practice, but OCCUD still performs better in this unfair condition. (cid:13) ˆθi,t − ˆθVi,t,t−1 (cid:13) (cid:13) Remark. The offline detection methods [39, 6, 18, 32] need to know all the user information in advance to derive the user embedding for classification, so they cannot be directly applied in online detection with bandit feedback thus cannot be directly compared to OCCUD. However, we observe the AUC achieved by OCCUD on Amazon and Yelp (in Tab.1) is similar to recent offline methods [18, 32]. Additionally, OCCUD has rigorous theoretical performance guarantee (Section 5.2). 6.1 Experiments on Synthetic Dataset We use u = 1, 000 users and m = 10 clusters, where each cluster contains 100 users. We randomly select 100 users as the corrupted users. The preference and arm (item) vectors are drawn in d − 1 (d = 50) dimensions with each entry a standard Gaussian variable and then normalized, added one √ 2 [21]. We fix an arm set with |A| = 1000 items, more dimension with constant 1, and divided by at each round, 20 items are randomly selected to form a set At to choose from. Following [40, 3], in the first k rounds, we always flip the reward of corrupted users by setting rt = −xT θit,t + ηt. at And we leave the remaining T − k rounds intact. Here we set T = 1, 000, 000 and k = 20, 000. (a) Synthetic (b) Movielens (c) Amazon (d) Yelp Figure 3: Recommendation results on the synthetic and real-world datasets Fig.3(a) shows the recommendation results. RCLUB-WCU outperforms all baselines and achieves a sub-linear regret. LinUCB and CW-OFUL perform worst as they ignore the preference differences among users. CW-OFUL-Ind outperforms LinUCB-Ind because it considers the corruption, but worse than RCLUB-WCU since it does not consider leveraging user relations to speed up learning. The detection results are shown in Tab.1. We test the AUC of OCCUD and GCUD in every 200, 000 rounds. OCCUD's performance improves over time with more interactions, while GCUD's perfor- mance is much worse as it detects corrupted users only relying on the robust estimations. OCCUD finally achieves an AUC of 0.855, indicating it can identify most of the corrupted users. 6.2 Experiments on Real-world Datasets We use three real-world data Movielens [11], Amazon[31], and Yelp [33]. The Movielens data does not have the corrupted users' labels, so following [24], we manually select the corrupted users. On Amazon data, following [39], we label the users with more than 80% helpful votes as normal users, and label users with less than 20% helpful votes as corrupted users. The Yelp data contains users and their comments on restaurants with true labels of the normal users and corrupted users. We select 1,000 users and 1,000 items for Movielens; 1,400 users and 800 items for Amazon; 2,000 users and 2,000 items for Yelp. The ratios of corrupted users on these data are 10%, 3.5%, and 9 0.00.20.40.60.81.05RXQG1e602468&XPXODWLYH5HJUHW1e45&/8%:&8 RXUV &/8%6&/8%/LQ8&%/LQ8&%LQG&:2)8/&:2)8/LQG0.00.20.40.60.81.05RXQG1e6012345&XPXODWLYH5HJUHW1e45&/8%:&8 RXUV &/8%6&/8%/LQ8&%/LQ8&%LQG&:2)8/&:2)8/LQG0.00.20.40.60.81.05RXQG1e601234567&XPXODWLYH5HJUHW1e45&/8%:&8 RXUV &/8%6&/8%/LQ8&%/LQ8&%LQG&:2)8/&:2)8/LQG0.00.20.40.60.81.05RXQG1e60.00.20.40.60.81.01.2&XPXODWLYH5HJUHW1e55&/8%:&8 RXUV &/8%6&/8%/LQ8&%/LQ8&%LQG&:2)8/&:2)8/LQG 30.9%, respectively. We generate the preference and item vectors following [37, 21]. We first construct the binary feedback matrix through the users' ratings: if the rating is greater than 3, the feedback is 1; otherwise, the feedback is 0. Then we use SVD to decompose the extracted binary feedback matrix Ru×m = θSX T, where θ = (θi), i ∈ [u] and X = (xj), j ∈ [m], and select d = 50 dimensions. We have 10 clusters on Movielens and Amazon, and 20 clusters on Yelp. We use the same corruption mechanism as the synthetic data with T = 1, 000, 000 and k = 20, 000. We conduct more experiments in different environments to show our algorithms' robustness in Appendix.G. The recommendation results are shown in Fig.3(b)-(d). RCLUB-WCU outperforms all baselines. On the Amazon dataset, the percentage of corrupted users is lowest, RCLUB-WCU's advantages over base- lines decrease because of the weakened corruption. The corrupted user detection results are provided in Tab.1. OCCUD's performance improves over time and is much better than GCUD. On the Movie- lens dataset, OCCUD achieves an AUC of 0.85; on the Amazon dataset, OCCUD achieves an AUC of 0.84; and on the Yelp dataset, OCCUD achieves an AUC of 0.628. According to recent works on offline settings [18, 32], our results are relatively high. Table 1: Detection results on synthetic and real datasets OCCUD GCUD OCCUD GCUD OCCUD GCUD OCCUD GCUD 0.855 0.502 0.85 0.492 0.840 0.518 0.628 0.510 0.599 0.477 0.65 0.450 0.639 0.480 0.452 0.473 0.777 0.483 0.785 0.485 0.761 0.486 0.502 0.496 0.651 0.478 0.750 0.474 0.735 0.480 0.489 0.481 0.812 0.484 0.83 0.489 0.802 0.500 0.578 0.500 0.2M 0.4M 0.6M 0.8M 1M Movielens Synthetic Amazon Dataset Time Yelp Alg 7 Conclusion In this paper, we are the first to propose the novel LOCUD problem, where there are many users with unknown preferences and unknown relations, and some corrupted users can occasionally perform disrupted actions to fool the agent. Hence, the agent not only needs to learn the unknown user pref- erences and relations robustly from potentially disrupted bandit feedback, balance the exploration- exploitation trade-off to minimize regret, but also needs to detect the corrupted users over time. To robustly learn and leverage the unknown user preferences and relations from corrupted behaviors, we propose a novel bandit algorithm RCLUB-WCU. To detect the corrupted users in the online bandit setting, based on the learned user relations of RCLUB-WCU, we propose a novel detection algo- rithm OCCUD. We prove a regret upper bound for RCLUB-WCU, which matches the lower bound asymptotically in T up to logarithmic factors and matches the state-of-the-art results in degener- ate cases. We also give a theoretical guarantee for the detection accuracy of OCCUD. Extensive experiments show that our proposed algorithms achieve superior performance over previous bandit algorithms and high corrupted user detection accuracy. 8 Acknowledgement The corresponding author Shuai Li is supported by National Key Research and Development Pro- gram of China (2022ZD0114804) and National Natural Science Foundation of China (62376154, 62006151, 62076161). The work of John C.S. Lui was supported in part by the RGC's SRFS2122- 4S02. 10 References [1] Yasin Abbasi-Yadkori, D ́avid P ́al, and Csaba Szepesv ́ari. Improved algorithms for linear stochastic bandits. Advances in neural information processing systems, 24, 2011. [2] Charu C Aggarwal et al. Recommender systems, volume 1. Springer, 2016. [3] Ilija Bogunovic, Arpan Losalka, Andreas Krause, and Jonathan Scarlett. Stochastic linear bandits robust to adversarial attacks. In International Conference on Artificial Intelligence and Statistics, pages 991–999. PMLR, 2021. [4] Wei Chu, Lihong Li, Lev Reyzin, and Robert Schapire. Contextual bandits with linear payoff functions. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pages 208–214. JMLR Workshop and Conference Proceedings, 2011. [5] Qin Ding, Cho-Jui Hsieh, and James Sharpnack. Robust stochastic linear contextual bandits under adversarial attacks. In International Conference on Artificial Intelligence and Statistics, pages 7111–7123. PMLR, 2022. [6] Yingtong Dou, Zhiwei Liu, Li Sun, Yutong Deng, Hao Peng, and Philip S Yu. Enhancing graph neural network-based fraud detectors against camouflaged fraudsters. In Proceedings of the 29th ACM International Conference on Information & Knowledge Management, pages 315–324, 2020. [7] Evrard Garcelon, Baptiste Roziere, Laurent Meunier, Jean Tarbouriech, Olivier Teytaud, Alessandro Lazaric, and Matteo Pirotta. Adversarial attacks on linear contextual bandits. Ad- vances in Neural Information Processing Systems, 33:14362–14373, 2020. [8] Claudio Gentile, Shuai Li, and Giovanni Zappella. Online clustering of bandits. In Interna- tional Conference on Machine Learning, pages 757–765. PMLR, 2014. [9] Anupam Gupta, Tomer Koren, and Kunal Talwar. Better algorithms for stochastic bandits with adversarial corruptions. In Conference on Learning Theory, pages 1562–1578. PMLR, 2019. [10] Mohammad Hajiesmaili, Mohammad Sadegh Talebi, John Lui, Wing Shing Wong, et al. Ad- versarial bandits with corruptions: Regret lower bound and no-regret algorithm. Advances in Neural Information Processing Systems, 33:19943–19952, 2020. [11] F Maxwell Harper and Joseph A Konstan. The movielens datasets: History and context. Acm transactions on interactive intelligent systems (tiis), 5(4):1–19, 2015. [12] Jiafan He, Dongruo Zhou, Tong Zhang, and Quanquan Gu. Nearly optimal algorithms for In Advances in Neural Information linear contextual bandits with adversarial corruptions. Processing Systems (2022), 2022. [13] Mengda Huang, Yang Liu, Xiang Ao, Kuan Li, Jianfeng Chi, Jinghua Feng, Hao Yang, and Qing He. Auc-oriented graph neural network for fraud detection. In Proceedings of the ACM Web Conference 2022, pages 1311–1321, 2022. [14] Kwang-Sung Jun, Lihong Li, Yuzhe Ma, and Jerry Zhu. Adversarial attacks on stochastic bandits. Advances in neural information processing systems, 31, 2018. [15] Pushmeet Kohli, Mahyar Salek, and Greg Stoddard. A fast bandit algorithm for recommen- dation to users with heterogenous tastes. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 27, pages 1135–1141, 2013. [16] Fang Kong, Canzhe Zhao, and Shuai Li. Best-of-three-worlds analysis for linear bandits with follow-the-regularized-leader algorithm. arXiv preprint arXiv:2303.06825, 2023. [17] Lihong Li, Wei Chu, John Langford, and Robert E Schapire. A contextual-bandit approach to personalized news article recommendation. In Proceedings of the 19th international confer- ence on World wide web, pages 661–670, 2010. 11 [18] Qiutong Li, Yanshen He, Cong Xu, Feng Wu, Jianliang Gao, and Zhao Li. Dual-augment graph neural network for fraud detection. In Proceedings of the 31st ACM International Conference on Information & Knowledge Management, pages 4188–4192, 2022. [19] Shuai Li and Shengyu Zhang. Online clustering of contextual cascading bandits. In Proceed- ings of the AAAI Conference on Artificial Intelligence, volume 32, 2018. [20] Shuai Li, Alexandros Karatzoglou, and Claudio Gentile. Collaborative filtering bandits. In Proceedings of the 39th International ACM SIGIR conference on Research and Development in Information Retrieval, pages 539–548, 2016. [21] Shuai Li, Wei Chen, and Kwong-Sak Leung. Improved algorithm on online clustering of bandits. arXiv preprint arXiv:1902.09162, 2019. [22] Yingkai Li, Edmund Y Lou, and Liren Shan. Stochastic linear optimization with adversarial corruption. arXiv preprint arXiv:1909.02109, 2019. [23] Fang Liu and Ness Shroff. Data poisoning attacks on stochastic bandits. In International Conference on Machine Learning, pages 4042–4050. PMLR, 2019. [24] Shenghua Liu, Bryan Hooi, and Christos Faloutsos. Holoscope: Topology-and-spike aware fraud detection. In Proceedings of the 2017 ACM on Conference on Information and Knowl- edge Management, pages 1539–1548, 2017. [25] Xutong Liu, Haoru Zhao, Tong Yu, Shuai Li, and John CS Lui. Federated online clustering of bandits. In Uncertainty in Artificial Intelligence, pages 1221–1231. PMLR, 2022. [26] Xutong Liu, Jinhang Zuo, Siwei Wang, Carlee Joe-Wong, John Lui, and Wei Chen. Batch-size independent regret bounds for combinatorial semi-bandits with probabilistically triggered arms or independent arms. Advances in Neural Information Processing Systems, 35:14904–14916, 2022. [27] Xutong Liu, Jinhang Zuo, Siwei Wang, John CS Lui, Mohammad Hajiesmaili, Adam Wier- man, and Wei Chen. Contextual combinatorial bandits with probabilistically triggered arms. In International Conference on Machine Learning, pages 22559–22593. PMLR, 2023. [28] Yang Liu, Xiang Ao, Zidi Qin, Jianfeng Chi, Jinghua Feng, Hao Yang, and Qing He. Pick and choose: a gnn-based imbalanced learning approach for fraud detection. In Proceedings of the Web Conference 2021, pages 3168–3177, 2021. [29] Thodoris Lykouris, Vahab Mirrokni, and Renato Paes Leme. Stochastic bandits robust to ad- versarial corruptions. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, pages 114–122, 2018. [30] Yuzhe Ma, Kwang-Sung Jun, Lihong Li, and Xiaojin Zhu. Data poisoning attacks in contextual bandits. In International Conference on Decision and Game Theory for Security, pages 186– 204. Springer, 2018. [31] Julian John McAuley and Jure Leskovec. From amateurs to connoisseurs: modeling the evo- In Proceedings of the 22nd international lution of user expertise through online reviews. conference on World Wide Web, pages 897–908, 2013. [32] Zidi Qin, Yang Liu, Qing He, and Xiang Ao. Explainable graph-based fraud detection via neural meta-graph search. In Proceedings of the 31st ACM International Conference on Infor- mation & Knowledge Management, pages 4414–4418, 2022. [33] Shebuti Rayana and Leman Akoglu. Collective opinion spam detection: Bridging review net- works and metadata. In Proceedings of the 21th acm sigkdd international conference on knowl- edge discovery and data mining, pages 985–994, 2015. [34] Daixin Wang, Jianbin Lin, Peng Cui, Quanhui Jia, Zhen Wang, Yanming Fang, Quan Yu, Jun Zhou, Shuang Yang, and Yuan Qi. A semi-supervised graph attentive network for financial fraud detection. In 2019 IEEE International Conference on Data Mining (ICDM), pages 598– 607. IEEE, 2019. 12 [35] Zhiyong Wang, Xutong Liu, Shuai Li, and John CS Lui. Efficient explorative key-term selec- tion strategies for conversational contextual bandits. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pages 10288–10295, 2023. [36] Zhiyong Wang, Jize Xie, Xutong Liu, Shuai Li, and John Lui. Online clustering of bandits with misspecified user models. arXiv preprint arXiv:2310.02717, 2023. [37] Junda Wu, Canzhe Zhao, Tong Yu, Jingyang Li, and Shuai Li. Clustering of conversational bandits for user preference learning and elicitation. In Proceedings of the 30th ACM Interna- tional Conference on Information & Knowledge Management, pages 2129–2139, 2021. [38] Qingyun Wu, Huazheng Wang, Quanquan Gu, and Hongning Wang. Contextual bandits in a collaborative environment. In Proceedings of the 39th International ACM SIGIR conference on Research and Development in Information Retrieval, pages 529–538, 2016. [39] Ge Zhang, Jia Wu, Jian Yang, Amin Beheshti, Shan Xue, Chuan Zhou, and Quan Z Sheng. Fraudre: fraud detection dual-resistant to graph inconsistency and imbalance. In 2021 IEEE International Conference on Data Mining (ICDM), pages 867–876. IEEE, 2021. [40] Heyang Zhao, Dongruo Zhou, and Quanquan Gu. Linear contextual bandits with adversarial corruptions. arXiv preprint arXiv:2110.12615, 2021. [41] Jinhang Zuo, Zhiyao Zhang, Zhiyong Wang, Shuai Li, Mohammad Hajiesmaili, and Adam Wierman. Adversarial attacks on online learning to rank with click feedback. arXiv preprint arXiv:2305.17071, 2023. 13 Appendix A Proof of Lemma 1 We first prove the following result: With probability at least 1 − δ for some δ ∈ (0, 1), at any t ∈ [T ]: ˆθi,t − θj(i)(cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 (cid:13) ≤ β(Ti,t, δ u ) (cid:112)λ + λmin(M i,t) √ λ + αC. where β(Ti,t, δ u ) ≜ (cid:113) 2 log( u δ ) + d log(1 + Ti,t λd ) + , ∀i ∈ U , (8) ˆθi,t − θj(i) = (λI + M i,t)−1bi,t − θj(i) = (λI + = (λI + = (λI + (cid:88) s∈[t] is=i (cid:88) s∈[t] is=i (cid:88) s∈[t] is=i wis,sxas x⊤ as )−1 (cid:88) wis,sxas rs − θj(i) wis,sxas x⊤ as )−1 wis,sxas x⊤ as )−1 s∈[t] is=i (cid:18) (cid:88) wis,sxas(x⊤ as θis + ηs + cs) (cid:19) − θj(i) s∈[t] is=i (cid:20) (λI + (cid:88) s∈[t] is=i wis,sxas x⊤ as )θj(i) − λθj(i) + wis,sxasηs (cid:88) s∈[t] is=i (cid:88) + wis,sxas cs (cid:21) − θj(i) s∈[t] is=i = −λM ′−1 i,t θj(i) + M ′−1 i,t wis,sxasηs + M ′−1 i,t (cid:88) s∈[t] is=i wis,sxascs , (cid:88) s∈[t] is=i where we denote M ′ i,t = M i,t + λI, and the above equations hold by definition. Therefore, we have ˆθi,t − θj(i)(cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 (cid:13) ≤ λ (cid:13) (cid:13)M ′−1 (cid:13) i,t θj(i)(cid:13) (cid:13) (cid:13)2 + (cid:13) (cid:13) (cid:13) M ′−1 (cid:13) (cid:13) i,t (cid:13) (cid:13) (cid:88) s∈[t] is=i wis,sxas ηs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 + (cid:13) (cid:13) (cid:13) M ′−1 (cid:13) (cid:13) i,t (cid:13) (cid:13) (cid:88) s∈[t] is=i wis,sxas cs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 . (9) We then bound the three terms in Eq.(9) one by one. For the first term: λ (cid:13) (cid:13)M ′−1 (cid:13) i,t θj(i)(cid:13) (cid:13) (cid:13)2 ≤ λ (cid:13) (cid:13)M ′− 1 (cid:13) i,t 2 (cid:13) 2 (cid:13) (cid:13) 2 (cid:13) (cid:13) (cid:13)θj(i)(cid:13) (cid:13) (cid:13)2 ≤ (cid:113) √ λ λmin(M ′ i,t) , (10) where we use the Cauchy–Schwarz inequality, the inequality for the operator norm of matrices, and the fact that λmin(M ′ For the second term in Eq.(9), we have i,t) ≥ λ. (cid:13) (cid:13) (cid:13) M ′−1 (cid:13) (cid:13) i,t (cid:13) (cid:13) (cid:88) s∈[t] is=i wis,sxasηs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 ≤ = 2 i,t (cid:13) (cid:13) (cid:13) M ′− 1 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:80) s∈[t] is=i (cid:113) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 wis,sxas ηs (cid:88) s∈[t] is=i (cid:13) (cid:13) (cid:13)M ′−1 i,t wis,sxas ηs λmin(M ′ i,t) (cid:13) (cid:13)M ′− 1 (cid:13) i,t 2 , (cid:13) (cid:13) (cid:13)2 (11) (12) where Eq.(11) follows by the Cauchy–Schwarz inequality and the inequality for the operator norm of matrices, and Eq.(12) follows by the Courant-Fischer theorem. 14 wis,sxas, ̃ηs ≜ √ Let ̃xs ≜ √ 1-sub-gaussian (since ηs is 1-sub-gaussian and (cid:13) (cid:13) (cid:13)M ′−1 nominator in Eq.(12) becomes ̃xs ̃ηs s∈[t] is=i (cid:13) (cid:13) (cid:13) (cid:80) i,t √ wis,sηs, then we have: ∥ ̃xs∥2 ≤ (cid:13) (cid:13) wis,s (cid:13) (cid:13)2 √ i,t = λI + (cid:80) wis,s ≤ 1), M ′ ∥xas ∥2 ≤ 1, ̃ηs is still ̃xs ̃x⊤ s , and the s∈[t] is=i . Then, following Theorem 1 in [1] and by union bound, with probability at least 1 − δ for some δ ∈ (0, 1), for any i ∈ U, we have: (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:88) s∈[t] is=i wis,sxas ηs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)M ′−1 i,t = (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:115) (cid:88) s∈[t] is=i ̃xs ̃ηs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)M ′−1 i,t ≤ 2 log( (cid:114) ≤ 2 log( ) + log( det(M ′ i,t) det(λI) ) ) + d log(1 + Ti,t λd ) , u δ u δ (13) where det(*) denotes the determinant of matrix arguement, Eq.(13) is because det(M ′ (cid:32) trace(λI+(cid:80) (cid:33)d ) i,t) ≤ wis ,sxas x⊤ as s∈[t] is=i d ≤ (cid:0) λd+Ti,t (cid:1)d d , and det(λI) = λd. For the third term in Eq.(9), we have (cid:13) (cid:13) (cid:13) M ′−1 (cid:13) (cid:13) i,t (cid:13) (cid:13) (cid:88) s∈[t] is=i wis,sxascs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 ≤ = ≤ 2 i,t (cid:13) (cid:13) (cid:13) M ′− 1 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:80) s∈[t] is=i (cid:113) (cid:80) s∈[t] is=i (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 wis,sxas cs (cid:88) s∈[t] is=i wis,sxas cs (cid:13) (cid:13) (cid:13)M ′−1 i,t λmin(M ′ i,t) |cs| wi,s ∥xas∥M ′−1 (cid:113) i,t λmin(M ′ i,t) (cid:13) (cid:13)M ′− 1 (cid:13) i,t 2 ≤ (cid:113) αC λmin(M ′ i,t) (cid:13) (cid:13) (cid:13)2 (14) (15) (16) where Eq.(14) follows by the Cauchy–Schwarz inequality and the inequality for the operator norm of matrices, Eq.(15) follows by the Courant-Fischer theorem, and Eq.(16) is because by defini- tion wi,s ≤ ≥ (since M ′ i,s ⪰ M ′−1 i,t , ∥xas ∥M ′−1 i,t ⪰ M ′ i,s, M ′−1 ≤ i,s α ∥xas ∥ ), (cid:80)T M ′−1 i,s t=1 |ct| ≤ C. α ∥xas ∥ M ′−1 i,t ∥xas ∥M ′−1 i,t Combining the above bounds of these three terms, we can get that Eq.(8) holds. We then prove the following technical lemma. Lemma 6. Under Assumption 3, at any time t, for any fixed unit vector θ ∈ Rd Et[(θ⊤xat)2| |At|] ≥ ̃λx ≜ (cid:90) λx 0 (1 − e− (λx−x)2 2σ2 )Kdx , (17) where K is the upper bound of |At| for any t. Proof. The proof of this lemma mainly follows the proof of Claim 1 in [8], but with more careful analysis, since their assumption on the arm generation distribution is more stringent than our As- sumption 3 by putting more restrictions on the variance upper bound σ2 (specifically, they require σ2 ≤ λ2 8 log(4K) ). 15 Denote the feasible arms at round t by At = {xt,1, xt,2, . . . , xt,|At|}. Consider the corresponding i.i.d. random variables θi = (θ⊤xt,i)2 − Et[(θ⊤xt,i)2| |At|], i = 1, 2, . . . , |At|. By Assumption 3, θi s are sub-Gaussian random variables with variance bounded by σ2. Therefore, for any α > 0 and any i ∈ [|At|], we have: Pt(θi < −α| |At|) ≤ e− α2 2σ2 , for be shorthand the conditional probability where we the P(*|(i1, A1, r1), . . . , (it−1, At−1, rt−1), it). use to Pt(*) By Assumption 3, we can also get λmin(Ex∼ρ[xx⊤]) ≥ λx. With these inequalities above, we can get that Et[(θ⊤xt,i)2| |At| = Et[θ⊤xt,ix⊤ t,iθ| |At|] ≥ Pt( min i=1,...,|At| (θ⊤xt,i)2 ≥ λx − α| |At|) ≥ (1 − e− α2 2σ2 )K . Therefore, we can get Et[(θ⊤xat)2| |At|] ≥ Et[ min (θ⊤xt,i)2| |At|] i=1,...,|At| ≥ ≥ (cid:90) ∞ 0 (cid:90) λx 0 Pt( min (θ⊤xt,i)2 ≥ x| |At|)dx i=1,...,|At| (1 − e− (λx−x)2 2σ2 )Kdx ≜ ̃λx Note that wi,s = min{1, }, and we have α ∥xas ∥ M α ∥xas ∥M ′−1 i,t = (cid:113) x⊤ as ′−1 i,t α M ′−1 i,t xas ≥ (cid:113) α λmin(M ′−1 i,t ) = α (cid:113) λmin(M ′ i,t) ≥ α √ λ. √ Since α λ < 1 typically holds, we have wi,s ≥ α √ λ. Then, with the item regularity assumption stated in Assumption 3, the technical Lemma 6, together with Lemma 7 in [19], with probability at least 1 − δ, for a particular user i, at any t such that Ti,t ≥ 16 ̃λ2 x log( 8d ̃λ2 xδ ), we have: λmin(M ′ i,t) ≥ 2α λ ̃λxTi,t + λ . (18) √ With this result, together with Eq.(8), we can get that for any t such that Ti,t ≥ 16 ̃λ2 x probability at least 1 − δ for some δ ∈ (0, 1), ∀i ∈ U, we have: log( 8d ̃λ2 xδ ), with ˆθi,t − θj(i)(cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 (cid:13) ≤ ≤ ≤ = β(Ti,t, δ u ) λmin(M ′ i,t) β(Ti,t, δ u ) √ λ ̃λxTi,t + λ 2α (cid:113) (cid:113) β(Ti,t, δ u ) √ λ ̃λxTi,t 2α (cid:113) (cid:113) 2 log( u δ ) + d log(1 + Ti,t √ λ ̃λxTi,t 2α (cid:113) λd ) + Then, we want to find a sufficient time Ti,t for a fixed user i such that ˆθi,t − θj(i)(cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 (cid:13) < γ 4 . 16 √ λ + αC . (19) (20) To do this, with Eq.(19), we can get it by letting (cid:113) 2α (cid:113) 2α √ √ λ λ ̃λxTi,t αC √ λ ̃λxTi,t (cid:113) δ ) + d log(1 + Ti,t 2 log( u λd ) (cid:113) λ ̃λxTi,t 2α √ < < < γ 12 γ 12 γ 12 , , . For Eq.(21), we can get For Eq.(22), we can get For Eq.(23), we have Ti,t > √ λ 72 αγ2 ̃λx . Ti,t > 72αC 2 √ λ ̃λx γ2 . 2 log( u δ ) + d log(1 + Ti,t λd ) λ ̃λxTi,t 2α √ < γ2 144 . Then it is sufficient to get Eq.(26) if the following holds 2α 2 log( u δ ) √ λ ̃λxTi,t d log(1 + Ti,t λd ) λ ̃λxTi,t 2α √ < < γ2 288 γ2 288 , . For Eq.(27), we can get For Eq.(28), we can get Ti,t > 288 log( u δ ) √ λ ̃λx γ2α γ2α Following Lemma 9 in [19], we can get the following sufficient condition for Eq.(30): Ti,t > 144d √ λ ̃λx log(1 + Ti,t λd ) . Ti,t > 288d √ γ2α λ ̃λx log( 288 √ γ2α λ ̃λx ) . (21) (22) (23) (24) (25) (26) (27) (28) (29) (30) (31) Then, since typically u Eq.(31) δ > 288 √ γ2α λ ̃λx , we can get the following sufficient condition for Eq.(29) and Ti,t > 288d √ γ2α λ ̃λx log( u δ ) . (32) Together with Eq.(24), Eq.(25), and the condition for Eq.(18) we can get the following sufficient condition for Eq.(20) to hold Ti,t > max{ 288d √ γ2α λ ̃λx log( u δ ), 16 ̃λ2 x log( 8d ̃λ2 xδ ), √ 72 λ αγ2 ̃λx , 72αC 2 √ λ ̃λx γ2 } . (33) Then, with Assumption 2 on the uniform arrival of users, following Lemma 8 in [19], and by union bound, we can get that with probability at least 1 − δ, for all t ≥ T0 ≜ 16u log( u δ ) + 4u max{ 288d √ γ2α λ ̃λx log( u δ ), 16 ̃λ2 x log( 8d ̃λ2 xδ ), √ 72 λ αγ2 ̃λx , 72αC 2 √ λ ̃λx γ2 } , (34) 17 Eq.(32) holds for all i ∈ U, and therefore Eq.(20) holds for all i ∈ U. With this, we can show that RCLUB-WCU will cluster all the users correctly after T0. First, if RCLUB-WCU deletes the edge (i, l), then user i and user j belong to different ground-truth clusters, i.e., ∥θi − θl∥2 > 0. This is because by the deletion rule of the algorithm, the concentration bound, and triangle inequality, (cid:13) (cid:13) > 0. Sec- ∥θi − θl∥2 = (cid:13)2 ond, we show that if ∥θi − θl∥ ≥ γ, RCLUB-WCU will delete the edge (i, l). This is because < γ if ∥θi − θl∥ ≥ γ, then by the triangle inequality, and 4 , (cid:13)θj(i) − θj(l)(cid:13) (cid:13) (cid:13)2 (cid:13) (cid:13)θj(i) − θi,t (cid:13) (cid:13) (cid:13)θj(l) − θl,t (cid:13) (cid:13) ˆθi,t − ˆθl,t (cid:13) (cid:13) (cid:13) (cid:13) − − ≥ (cid:13) (cid:13) (cid:13)2 ˆθi,t − θj(i)(cid:13) (cid:13) < γ (cid:13) (cid:13) 4 , (cid:13) (cid:13)2 ˆθi,t − θj(i)(cid:13) (cid:13) (cid:13) (cid:13) ≥ ∥θi − θl∥ − (cid:13)2 (cid:13) (cid:113) √ (cid:13) (cid:13) (cid:13)2 ˆθl,t − θj(l)(cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 (cid:13) ˆθl,t − θj(l)(cid:13) (cid:13) (cid:13) (cid:13) − (cid:13)2 (cid:13) θi = θj(i), θl = θj(l), we have (cid:13) ˆθi,t − ˆθl,t (cid:13) (cid:13) > (cid:13) (cid:13) (cid:13)2 Ti,t λd ) λ+ + 2 log( u √ δ )+d log(1+ λ+2 ̃λxTl,t Tl,t λd ) , which will trigger the √ (cid:113) λ+ γ − γ 4 − γ 4 = γ 2 > λ+2 ̃λxTi,t deletion condition Line 10 in Algo.1. 2 log( u √ δ )+d log(1+ B Proof of Lemma 2 After T0, if the clustering structure is correct, i.e., Vt = Vj(it), then we have ˆθVt,t−1 − θit = M −1 Vt,t−1bVt,t−1 − θit = (λI + = (λI + = (λI + (cid:88) s∈[t−1] is∈Vt (cid:88) s∈[t−1] is∈Vt (cid:88) s∈[t−1] is∈Vt wis,sxas x⊤ as )−1( (cid:88) s∈[t−1] is ∈Vt wis,sxasrs) − θit wis,sxas x⊤ as )−1(cid:0) (cid:88) wis,sxas(x⊤ as θit + ηs + cs)(cid:1) − θit (35) wis,sxas x⊤ as )−1 s∈[t−1] is∈Vt (cid:18) (cid:88) s∈[t−1] is∈Vt (wis,sxasx⊤ as + λI)θit − λθit (cid:88) + wis,sxas ηs + (cid:88) (cid:19) wis,sxascs) − θit s∈[t−1] is∈Vt = −λM ′−1 Vt,t−1θit − M ′−1 Vt,t−1 s∈[t−1] is ∈Vt (cid:88) s∈[t−1] is ∈Vt wis,sxasηs + M ′−1 Vt,t−1 wis,sxas cs , (cid:88) s∈[t−1] is∈Vt where we denote M ′ θit, ∀is ∈ Vt. Therefore, we have Vt,t−1 = M Vt,t−1 + λI, and Eq.(35) is because Vt = Vj(it) thus θis = (cid:12) (cid:12)x⊤ (cid:12) (cid:12) a (ˆθVt,t−1 − θit) (cid:12) (cid:12) ≤ λ (cid:12) (cid:12)x⊤ (cid:12) a M ′−1 Vt,t−1θit (cid:12) (cid:12) (cid:12) + ≤ ∥xa∥M ′−1 Vt,t−1 (cid:18)√ λ + (cid:12) (cid:12) (cid:12) a M ′−1 x⊤ (cid:12) (cid:12) (cid:12) (cid:12) Vt,t−1 (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) a M ′−1 x⊤ Vt,t−1 wis,sxasηs (cid:88) s∈[t−1] is ∈Vt + wis,sxas ηs (cid:88) s∈[t−1] is∈Vt (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)M ′−1 Vt,t−1 + (cid:88) s∈[t−1] is∈Vt (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) wis,sxascs (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:88) wis,sxascs s∈[t−1] is ∈Vt (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)M ′−1 Vt,t−1 (36) (cid:19) , is by Cauchy–Schwarz (cid:12) (cid:12) (cid:12) ≤ λ where Eq.(36) (cid:13) (cid:12) (cid:13)M ′− 1 a M ′−1 (cid:13) (cid:12) (cid:12)x⊤ Vt,t−1θit 2 Vt,t−1 λmin(M Vt,t−1) ≥ λ and ∥θit∥2 ≤ 1. Let ̃xs ≜ √ still 1-sub-gaussian (since ηs is 1-sub-gaussian and wis,sxas , ̃ηs ≜ √ (cid:13) (cid:13) (cid:13)2 inequality, matrix √ 1 λmin(M Vt,t−1) ∥θit∥2 = λ operator inequality, ∥θit∥2 ≤ √ and λ since √ wis,sηs, then we have: ∥ ̃xs∥2 ≤ (cid:13) (cid:13) √ wis,s ≤ 1), M ′ (cid:13) (cid:13)2 wis,s i,t = λI + (cid:80) ∥xas∥2 ≤ 1, ̃ηs is ̃xs ̃x⊤ s , s∈[t] is=i 18 (cid:80) (cid:13) (cid:13) (cid:13) and (cid:13) (cid:13) (cid:13)M ′−1 Vt,t−1 in [1], with probability at least 1 − δ for some δ ∈ (0, 1), we have: (cid:13) (cid:13) (cid:13)M ′−1 wis,sxas ηs becomes s∈[t−1] is∈Vt ̃xs ̃ηs s∈[t] is=i (cid:13) (cid:13) (cid:13) (cid:80) Vt,t−1 . Then, following Theorem 1 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:88) s∈[t−1] is ∈Vt wis,sxasηs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)M ′−1 Vt,t−1 = (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:88) s∈[t] is=i (cid:115) ̃xs ̃ηs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)M ′−1 Vt,t−1 ) + log( det(M ′ Vt,t−1) det(λI) ) ) + d log(1 + T λd ) , u δ u δ (37) ≤ 2 log( (cid:114) ≤ 2 log( , we have wis,s |cs| ∥xas ∥M ′−1 Vt,t−1 ≤ αC , (38) And for (cid:80) (cid:13) (cid:13) (cid:13) s∈[t−1] is∈Vt wis,sxascs (cid:13) (cid:13) (cid:13)M ′−1 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:88) s∈[t−1] is∈Vt wis,sxas cs Vt,t−1 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)M ′−1 Vt,t−1 (cid:88) ≤ s∈[t−1] is ∈Vt α where we use (cid:80)T t=1 |ct| ≤ C, wis,s ≤ ∥xas ∥ ≤ ∥xas ∥ α . ′−1 is,t−1 Plugging Eq.(38) and Eq.(37) into Eq.(36), together with Lemma 1, we can complete the proof of Lemma 2. ′−1 Vt,t−1 M M C Proof of Theorem 3 After T0, we define event E = {the algorithm clusters all the users correctly for all t ≥ T0} . (39) Then, with Lemma 1 and picking δ = 1 T , we have R(T ) = P(E)I{E}R(T ) + P(E)I{E}R(T ) ≤ I{E}R(T ) + 4 × = I{E}R(T ) + 4 . 1 T × T (40) Then it remains to bound I{E}R(T ). For the first T0 rounds, we can upper bound the regret in the first T0 rounds by T0. After T0, under event E and by Lemma 2, we have that with probability at least 1 − δ, for any xa: (cid:12) (cid:12)xT (cid:12) (cid:12) a (ˆθVt,t−1 − θit ) (cid:12) (cid:12) ≤ β ∥xa∥M −1 Vt,t−1 ≜ Ca,t . (41) Therefore, for the instantaneous regret Rt at round t, with E, with probability at least 1 − δ, at ∀t ≥ T0: θit − x⊤ θit at (θit − ˆθVt,t−1) + (x⊤ a∗ t Rt = x⊤ a∗ t = x⊤ a∗ t + x⊤ at (ˆθV t,t−1 − θit) + Cat,t − Ca∗ t ,t ˆθVt,t−1 + Ca∗ t ,t) − (x⊤ at ˆθVt,t−1 + Cat,t) (42) ≤ 2Cat,t , where the last inequality holds by the UCB arm selection strategy in Eq.(3) and Eq.(41). 19 Therefore, for I{E}R(T ): I{E}R(T ) ≤ R(T0) + E[I{E} T (cid:88) Rt] t=T0+1 ≤ T0 + 2E[I{E} T (cid:88) t=T0+1 Cat,t] . (43) Then it remains to bound E[I{E} (cid:80)T two cases: t=T0+1 Cat,t]. For (cid:80)T t=T0+1 Cat,t, we can distinguish it into T (cid:88) t=T0+1 Cat,t ≤ β T (cid:88) t=1 ∥xat∥M −1 Vt,t−1 = β (cid:88) t∈[T ]:wit,t=1 ∥xat ∥M −1 Vt,t−1 + β (cid:88) t∈[T ]:wit,t<1 ∥xat∥M −1 Vt,t−1 . (44) Then, we prove the following technical lemma. Lemma 7. T (cid:88) t=T0+1 min{I{it ∈ Vj} ∥xat∥2 M −1 Vj ,t−1 , 1} ≤ 2d log(1 + T λd ), ∀j ∈ [m] . (45) Proof. det(M Vj ,T ) = det (cid:18) M Vj ,T −1 + I{iT ∈ Vj}xaT x⊤ aT (cid:18) (cid:19) = det(M Vj ,T −1)det I + I{iT ∈ Vj}M − 1 2 Vj ,T −1xaT x⊤ aT (cid:19) M − 1 2 Vj ,T −1 = det(M Vj ,T −1) (cid:18) 1 + I{iT ∈ Vj} ∥xaT ∥2 M −1 Vj ,T −1 (cid:19) (cid:19) 1 + I{it ∈ Vj} ∥xat∥2 M −1 Vj ,t−1 = det(M Vj ,T0) T (cid:89) (cid:18) ≥ det(λI) T (cid:89) t=T0+1 (cid:18) 1 + I{it ∈ Vj} ∥xat∥2 M −1 Vj ,t−1 (cid:19) . (46) t=T0+1 ∀x ∈ [0, 1], we have x ≤ 2 log(1 + x). Therefore T (cid:88) t=T0+1 min{I{it ∈ Vj} ∥xat∥2 M −1 Vj ,t−1 , 1} ≤ 2 T (cid:88) (cid:18) log 1 + I{it ∈ Vj} ∥xat∥2 M −1 Vj ,t−1 (cid:19) (cid:19) (cid:1) t=T0+1 (cid:18) T (cid:89) = 2 log t=T0+1 (cid:0)1 + I{it ∈ Vj} ∥xat∥2 M −1 Vj ,t−1 ≤ 2[log(det(M Vj ,T )) − log(det(λI))] ≤ 2 log (cid:18) trace(λI + (cid:80)T t=1 I{it ∈ Vj}xatx⊤ at λd ≤ 2d log(1 + T λd ) . 20 (cid:19)d ) (47) Denote the rounds with wit,t = 1 as { ̃t1, . . . , ̃tl1 }, and gram matrix ̃GV ̃tτ (cid:80) ; denote the rounds with wit,t < 1 as {t′ , ̃tτ −1 }, gram matrix G′ 1, . . . , t′ l2 xa ̃ts ≜ λI + ≜ ,t′ τ −1 Vt′ τ x⊤ a ̃ts wit′ s∈[τ ] is∈V ̃tτ λI + (cid:80) is ∈V s∈[τ ] t′ τ Then we have ,t′ s xat′ s x⊤ at′ s . s (cid:88) t∈[T ]:wit,t=1 ∥xat∥M −1 Vt,t−1 = m (cid:88) l1(cid:88) j=1 τ =1 I{i ̃tτ ∈ Vj} (cid:13) (cid:13) (cid:13)xa ̃tτ (cid:13) (cid:13) (cid:13)M −1 V ̃tτ , ̃tτ −1 ≤ m (cid:88) l1(cid:88) j=1 τ =1 I{i ̃tτ ∈ Vj} (cid:13) (cid:13) (cid:13)xa ̃tτ (cid:13) (cid:13) (cid:13) ̃G−1 V ̃tτ (48) , ̃tτ −1 m (cid:88) ≤ (cid:118) (cid:117) (cid:117) (cid:116) l1(cid:88) j=1 τ =1 I{i ̃tτ ∈ Vj} l1(cid:88) τ =1 min{1, I{i ̃tτ ∈ Vj} (cid:13) (cid:13) (cid:13)xa ̃tτ (cid:13) 2 (cid:13) (cid:13) ̃G−1 V ̃tτ } , ̃tτ −1 (cid:114) m (cid:88) TVj ,T × 2d log(1 + T λd ) ≤ ≤ j=1 (cid:118) (cid:117) (cid:117) (cid:116)2m m (cid:88) j=1 TVj ,T d log(1 + T λd (cid:114) ) = 2mdT log(1 + T λd ) , (49) (50) (51) where Eq.(48) is because ̃G in Eq.(50) we use Lemma 7 and (cid:80)l1 inequality and (cid:80)m j=1 TVj ,T = T . , ̃tτ −1 ⪰ M −1 V ̃tτ I{i ̃tτ τ =1 −1 V ̃tτ , ̃tτ −1 in Eq.(49) we use Cauchy–Schwarz inequality, ∈ Vj} ≤ TVj ,T , in Eq.(51) we use Cauchy–Schwarz For the second part in Eq.(44), Let x′ at′ τ ≜ (cid:112)wit′ τ ,t′ τ xat′ τ , then (cid:88) t:wit,t<1 ∥xat∥M −1 Vt,t−1 = = ≤ ≤ m (cid:88) j=1 m (cid:88) j=1 ∥xat∥2 M −1 ∥xat∥M −1 I{it′ τ ∈ Vj} Vt,t−1 (cid:88) = Vt,t−1 wit′ τ α t:wit,t<1 ,t′ τ (cid:13) (cid:13) (cid:13)xat′ τ (cid:13) 2 (cid:13) (cid:13) (cid:88) t:wit,t<1 l2(cid:88) m (cid:88) j=1 τ =1 (cid:80)l2 τ =1 min{1, I{it′ τ ∈ Vj} α wit,t ∥xat∥2 M −1 Vt,t−1 α ,t′ τ −1 M −1 V t′ τ (cid:13) 2 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)x′ at′ τ } ,t′ τ −1 G′−1 V t′ τ 2d log(1 + T α λd ) = 2md log(1 + T α λd ) where in Eq.(52) we use the definition of the weights, in Eq.(53) we use G′−1 Vt′ τ and Eq.(54) uses Lemma 7. τ −1 ⪰ M −1 Vt′ τ ,t′ 21 (52) (53) (54) τ −1, ,t′ Then, with Eq.(54), Eq.(51), Eq.(44), Eq.(40), Eq.(43), δ = 1 (cid:113) T , and β = 2 log(T ) + d log(1 + T λd ) + αC, we can get √ λ + R(T ) ≤ 4 + T0 + (cid:0)2 √ (cid:114) λ + 2 log(T ) + d log(1 + (cid:18)(cid:114) ) + αC(cid:1) × T λd 2mdT log(1 + T λd ) + 2md log(1 + T α λd ) (cid:19) = 4 + 16u log(uT ) + 4u max{ √ + (cid:0)2 λ + (cid:114) 2 log(T ) + d log(1 + ) + αC(cid:1) × 2mdT log(1 + T λd ) log(uT ), 16 ̃λ2 x log( (cid:18)(cid:114) 288d √ γ2α λ ̃λx T λd √ λ 72 αγ2 ̃λx 8dT ̃λ2 x ), , 72αC 2 √ λ ̃λx γ2 } + 2md log(1 + T α λd ) (cid:19) . Picking α = √ √ λ+ C d , we can get R(T ) ≤ O(cid:0)( √ C d γ2 ̃λx + 1 ̃λ2 x )u log(T )(cid:1) + O(cid:0)d √ mT log(T )(cid:1) + O(cid:0)mCd log1.5(T )(cid:1) . (55) Thus we complete the proof of Theorem 3. D Proof and Discussions of Theorem 4 Table 1 of the work [12] gives a lower bound for linear bandits with adversarial corruption for a T + dC). Therefore, suppose single user. The lower bound of R(T ) is given by: R(T ) ≥ Ω(d our problem with multiple users and m underlying clusters where the arrival times are Ti for each cluster, then for any algorithms, even if they know the underlying clustering structure and keep m independent linear bandit algorithms to leverage the common information of clusters, the best they can get is R(T ) ≥ dC + (cid:80) m , ∀i ∈ [m], we can get (cid:113) T R(T ) ≥ dC + (cid:80) mT + dC) for the LOCUD problem. mT + dC, which gives a lower bound of Ω(d Ti. For a special case where Ti = T i∈[m] d √ m = d i∈[m] d √ √ √ Recall that the regret upper bound of RCLUB-WCU shown in Theorem 3 is of O (cid:18) √ d ( C γ2 ̃λx + (cid:19) √ )u log(T ) + O(cid:0)d mT log(T )(cid:1) + O(cid:0)mCd log1.5(T )(cid:1), asymptotically matching this lower 1 ̃λ2 x bound with respect to T up to logarithmic factors and with respect to C up to O( m) factors, showing the tightness of our theoretical results (where m are typically very small for real applica- tions). √ We conjecture that the gap for the m factor in the mC term of the lower bound is due to the strong assumption that cluster structures are known to prove our lower bound, and whether there exists a tighter lower bound will be left for future work. E Proof of Theorem 5 We prove the theorem using the proof by contrapositive. Specifically, in Theorem 5, we need to prove that for any t ≥ T0, if the detection condition in Line 7 of Algo.2 for user i, then with probability at least 1 − 5δ, user i is indeed a corrupted user. By the proof by contrapositive, we can prove Theorem 5 by showing that: for any t ≥ T0, if user i is a normal user, then with probability at least 1 − 5δ, the detection condition in Line 7 of Algo.2 will not be satisfied for user i. If the clustering structure is correct at t, then for any normal user i ̃θi,t − ˆθVi,t,t = ̃θi,t − θi + θi − ˆθVi,t,t , (56) 22 where ̃θi,t is the non-robust estimation of the ground-truth θi, and ˆθVi,t,t−1 is the robust estimation of the inferred cluster Vi,t for user i at round t. Since the clustering structure is correct at t, ˆθVi,t,t−1 is the robust estimation of user i's ground-truth cluster's preference vector θj(i) = θi at round t. We have ̃θi,t − θi = (λI + ̃M i,t)−1 ̃bi,t − θi )−1( = (λI + (cid:88) xasx⊤ as (cid:88) xas rs) − θi s∈[t] is=i xasx⊤ as )−1(cid:0) (cid:88) xas(x⊤ as θi + ηs)(cid:1) − θi (57) s∈[t] is=i (cid:88) s∈[t] is=i (cid:88) = (λI + = (λI + s∈[t] is=i xas x⊤ as )−1(cid:0)(λI + s∈[t] is=i ′−1 i,t θi + ̃M = −λ ̃M ′−1 i,t (cid:88) s∈[t] is=i xas ηs , xas x⊤ as )θi − λθi + (cid:88) s∈[t] is=i xasηs)(cid:1) − θi (cid:88) s∈[t] is=i where we denote ̃M have cs = 0, ∀s : is = i. ′ i,t ≜ λI + (cid:80) xas x⊤ as, and Eq.(57) is because since user i is normal, we s∈[t] is=i Then, we have (cid:13) ̃θi,t − θi (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 ≤ (cid:13) (cid:13)λ ̃M (cid:13) ′−1 i,t θi (cid:13) (cid:13) (cid:13)2 + (cid:13) (cid:13) (cid:13) ̃M (cid:13) (cid:13) (cid:13) (cid:13) ′−1 i,t (cid:88) s∈[t] is=i xasηs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 xasηs (cid:88) s∈[t] is=i (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 (cid:13) (cid:13) ̃M (cid:13) (cid:13) ′− 1 2 i,t (cid:13) (cid:13) (cid:13) (cid:13)2 (58) (59) ≤ λ (cid:13) (cid:13) ̃M (cid:13) (cid:13) ′− 1 2 i,t (cid:13) 2 (cid:13) (cid:13) (cid:13) 2 ∥θi∥2 + √ λ + ≤ (cid:80) (cid:13) (cid:13) (cid:13) (cid:113) xas ηs s∈[t] is=i λmin( ̃M ′ i,t) ′− 1 2 i,t (cid:13) (cid:13) (cid:13) ̃M (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) ̃M ′−1 i,t , , where Eq.(58) follows by the Cauchy–Schwarz inequality and the inequality for the operator norm ′ of matrices, and Eq.(59) follows by the Courant-Fischer theorem and the fact that λmin( ̃M i,t) ≥ λ. Following Theorem 1 in [1], for a fixed normal user i, with probability at least 1 − δ for some δ ∈ (0, 1) we have: (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:88) s∈[t] is=i xas ηs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) ̃M ′−1 i,t (cid:115) ≤ 2 log( (cid:114) ≤ 2 log( 1 δ 1 δ ) + log( ′ det( ̃M i,t) det(λI) ) ) + d log(1 + Ti,t λd ) , (60) where Eq.(60) is because det( ̃M ′ i,t) ≤ (cid:32) trace(λI+(cid:80) xas x⊤ as ) (cid:33)d s∈[t] is=i d ≤ (cid:0) λd+Ti,t d (cid:1)d , and det(λI) = λd. Plugging this into Eq.(59), we can get √ λ + (cid:113) (cid:13) ̃θi,t − θi (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 ≤ δ ) + d log(1 + Ti,t λd ) 2 log( 1 (cid:113) λmin( ̃M ′ i,t) . (61) 23 Then we need to bound (cid:13) (cid:13)θi − ˆθVi,t,t (cid:13) (cid:13) (cid:13) (cid:13)2 . With the correct clustering, Vi,t = Vj(i), we have ˆθVi,t,t − θi = M −1 Vi,t,tbVj,t,t (cid:88) = (λI + = (λI + = (λI + s∈[t] is∈Vj(i) (cid:88) s∈[t] is∈Vj(i) (cid:88) s∈[t] is∈Vj(i) wis,sxasx⊤ as )−1( wis,sxasx⊤ as )−1( (cid:88) s∈[t] is∈Vj(i) (cid:88) s∈[t] is∈Vj(i) )−1(cid:0)(λI + wis,sxasx⊤ as wis,sxas rs) − θi wis,sxas(x⊤ as θi + ηs + cs))) − θi (62) wis,sxasx⊤ as )θi − λθi (cid:88) s∈[t] is∈Vj(i) (cid:88) + wis,sxasηs + (cid:88) wis,sxas cs))(cid:1) − θi s∈[t] is ∈Vj(i) = −λM −1 Vi,t,tθi + M −1 Vi,t,t s∈[t] is ∈Vj(i) (cid:88) s∈[t] is∈Vj(i) wis,sxas ηs + M −1 Vi,t,t (cid:88) s∈[t] is∈Vj(i) wis,sxascs . (63) Therefore, we have (cid:13) (cid:13)θi − ˆθVi,t,t (cid:13) (cid:13) (cid:13) (cid:13)2 ≤ λ (cid:13) (cid:13)M −1 (cid:13) Vi,t,tθi (cid:13) (cid:13) (cid:13)2 + (cid:13) (cid:13) (cid:13) (cid:13) M −1 (cid:13) (cid:13) (cid:13) (cid:13) Vi,t,t (cid:88) s∈[t] is ∈Vj(i) wis,sxasηs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 + (cid:13) (cid:13) (cid:13) (cid:13) M −1 (cid:13) (cid:13) (cid:13) (cid:13) Vi,t,t (cid:88) s∈[t] is∈Vj(i) wis,sxas cs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 ≤ λ (cid:13) (cid:13)M − 1 (cid:13) 2 Vi,t,t (cid:13) 2 (cid:13) (cid:13) 2 ∥θi∥2 + (cid:13) (cid:13) (cid:13) M − 1 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) 2 Vi,t,t (cid:88) wis,sxas ηs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 (cid:13) (cid:13)M − 1 (cid:13) 2 Vi,t,t (cid:13) (cid:13) (cid:13)2 + (cid:13) (cid:13) (cid:13) M − 1 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) 2 Vi,t,t (cid:88) s∈[t] is ∈Vj(i) s∈[t] is∈Vj(i) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)2 wis,sxasηs (cid:13) (cid:13)M − 1 (cid:13) 2 Vi,t,t (cid:13) (cid:13) (cid:13)2 (64) (65) (cid:13) (cid:13) (cid:13) (cid:13)M −1 Vi,t,t (cid:80) (cid:13) (cid:13) (cid:13) (cid:13) √ λ + ≤ + (cid:80) (cid:13) (cid:13) (cid:13) (cid:13) s∈[t] is∈Vj(i) wis,sxas ηs (cid:13) (cid:13) (cid:13) (cid:13)M −1 (cid:112)λmin(M Vi,t,t) √ wis,sηs, then we have: ∥ ̃xs∥2 ≤ (cid:13) (cid:13) √ wis,s ≤ 1), M Vi,t,t = λI + (cid:80) s∈[t] is ∈Vj(i) wis,s (cid:13) (cid:13)2 Vi,t,t wis,sxas cs wis,sxas, ̃ηs ≜ √ Let ̃xs ≜ √ 1-sub-gaussian (since ηs is 1-sub-gaussian and (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)M −1 wis,sxas ηs becomes s∈[t] is ∈Vj(i) (cid:13) (cid:13) (cid:13) (cid:13) (cid:80) (cid:80) Vi,t,t s∈[t] is∈Vj(i) ̃xs ̃ηs (cid:13) (cid:13) (cid:13) (cid:13)M −1 Vi,t,t ∥xas ∥2 ≤ 1, ̃ηs is still s , and ̃xs ̃x⊤ s∈[t] is∈Vj(i) . Then, following Theorem 1 in [1], with probability at least 1 − δ for some δ ∈ (0, 1), for a fixed normal user i, we have (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:88) s∈[t] is∈Vj(i) wis,sxas ηs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)M −1 Vi,t,t (cid:115) ≤ 2 log( (cid:114) ≤ 2 log( 1 δ 1 δ ) + log( det(M Vi,t,t) det(λI) ) ) + d log(1 + TVi,t,t λd ) , (66) where Eq.(60) is because det(M Vi,t,t) ≤ (cid:32) trace(λI+(cid:80) xas x⊤ as (cid:33)d ) s∈[t] is ∈Vj(i) d ≤ (cid:0) λd+TVi,t,t d (cid:1)d , and det(λI) = λd. 24 For (cid:80) (cid:13) (cid:13) (cid:13) (cid:13) s∈[t] is∈Vj(i) wis,sxas cs (cid:13) (cid:13) (cid:13) (cid:13)M −1 Vi,t,t , we have (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:88) s∈[t] is ∈Vj(i) wis,sxas cs (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)M −1 Vi,t,t (cid:88) ≤ s∈[t] is∈Vj(i) ≤ αC , |cs| wis,s ∥xas ∥M −1 Vi,t,t (67) where Eq.(67) is because wis,s ≤ is,s, M ′−1 is,s ⪰ M ′−1 α ∥xas ∥ is,t ⪰ M −1 M ′−1 is ,s ≤ α ∥xas ∥ M ′−1 is,t ≤ α ∥xas ∥ M −1 Vi,t,t (since M Vi,t,t ⪰ Vi,t,t, ∥xas∥M ′−1 is,s ≥ ∥xas∥M ′−1 is ,t ≥ ∥xas∥M −1 Vi,t,t ), and M ′ (cid:80) is,t ⪰ M ′ s∈[t] |cs| ≤ C. Therefore, we have (cid:13) (cid:13)θi − ˆθVi,t,t (cid:13) (cid:13) (cid:13) (cid:13)2 ≤ √ λ + (cid:113) 2 log( 1 δ ) + d log(1 + (cid:112)λmin(M Vi,t,t) TVi,t,t λd ) + αC . (68) With Eq.(68), Eq.(61) and Eq.(56), together with Lemma 1, we have that for a normal user i, for any t ≥ T0, with probability at least 1 − 5δ for some δ ∈ (0, 1 5 ) (cid:13) (cid:13) ̃θi,t − ˆθVi,t,t (cid:13) (cid:13) (cid:13)2 (cid:13) (cid:13) (cid:13) (cid:13) ≤ (cid:13) (cid:13) (cid:13)2 + (cid:13) ̃θi,t − θi (cid:13) (cid:13) √ (cid:113) λ + ≤ (cid:13) (cid:13)θi − ˆθVi,t,t (cid:13) δ ) + d log(1 + Ti,t λd ) 2 log( 1 (cid:113) λmin( ̃M ′ i,t) √ (cid:113) λ + + 2 log( 1 δ ) + d log(1 + (cid:112)λmin(M Vi,t,t) TVi,t,t λd ) + αC , (69) which is exactly the detection condition in Line 7 of Algo.2. Therefore, by the proof by contrapositive, we complete the proof of Theorem 5. F Description of Baselines We compare RCLUB-WCU to the following five baselines for recommendations. • LinUCB[17]: A state-of-the-art bandit approach for a single user without corruption. • LinUCB-Ind: Use a separate LinUCB for each user. • CW-OFUL[12]: A state-of-the-art bandit approach for single user with corruption. • CW-OFUL-Ind: Use a separate CW-OFUL for each user. • CLUB[8]: A graph-based clustering of bandits approach for multiple users without corrup- tion. • SCLUB[21]: A set-based clustering of bandits approach for multiple users without corrup- tion. G More Experiments G.1 Different Corruption Levels To see our algorithm's performance under different corruption levels, we conduct the experiments under different corruption levels for RCLUB-WCU, CLUB, and SCLUB on Amazon and Yelp datasets. Recall the corruption mechanism in Section 6.1, we set k as 1,000; 10,000; 100,000. The results are shown in Fig.4. All the algorithms' performance becomes worse when the corruption level increases. But RCLUB-WCU is much robust than the baselines. 25 (a) Amazon Corruption Level (b) Yelp Corruption Level Figure 4: Cumulative regret in different corruption levels (a) Amazon Cluster Number (b) Yelp Cluster Number Figure 5: Cumulative regret with different cluster numbers G.2 Different Cluster numbers Following [19], we test the performances of the cluster-based algorithms (RCLUB-WCU, CLUB, SCLUB) when the underlying cluster number changes. We set m as 5, 10, 20, and 50. The results are shown in Fig.5. All these algorithms' performances decrease when the cluster numbers increase, matching our theoretical results. The performances of CLUB and SCLUB decrease much faster than RCLUB-WCU, indicating that RCLUB-WCU is more robust when the underlying user cluster number changes. 26 1k10k100k&RUUXSWLRQ/HYHO0123456&XPXODWLYH5HJUHW1e4RCLUB-WCUCLUBSCLUB1k10k100k&RUUXSWLRQ/HYHO02468&XPXODWLYH5HJUHW1e4RCLUB-WCUCLUBSCLUB5102050&OXVWHU1XPEHU01234567&XPXODWLYH5HJUHW1e4RCLUB-WCUCLUBSCLUB5102050&OXVWHU1XPEHU0.00.20.40.60.81.0&XPXODWLYH5HJUHW1e5RCLUB-WCUCLUBSCLUB
http://arxiv.org/abs/2310.04762v1
"2023-10-07T09:47:55"
"2023-10-07T09:47:55"
Robust Low-Rank Matrix Completion via a New Sparsity-Inducing Regularizer
This paper presents a novel loss function referred to as hybrid ordinary-Welsch (HOW) and a new sparsity-inducing regularizer associated with HOW. We theoretically show that the regularizer is quasiconvex and that the corresponding Moreau envelope is convex. Moreover, the closed-form solution to its Moreau envelope, namely, the proximity operator, is derived. Compared with nonconvex regularizers like the lp-norm with 0<p<1 that requires iterations to find the corresponding proximity operator, the developed regularizer has a closed-form proximity operator. We apply our regularizer to the robust matrix completion problem, and develop an efficient algorithm based on the alternating direction method of multipliers. The convergence of the suggested method is analyzed and we prove that any generated accumulation point is a stationary point. Finally, experimental results based on synthetic and real-world datasets demonstrate that our algorithm is superior to the state-of-the-art methods in terms of restoration performance.
[ "Zhi-Yong Wang", "Hing Cheung So", "Abdelhak M. Zoubir" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04762v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04762v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "eess.IV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "eess.IV", "cs.LG", "eess.SP" ]
Robust Low-Rank Matrix Completion via a New Sparsity-Inducing Regularizer Zhi-Yong Wang, Hing Cheung So, Fellow, IEEE and Abdelhak M. Zoubir, Fellow, IEEE 1 3 2 0 2 t c O 7 ] V I . s s e e [ 1 v 2 6 7 4 0 . 0 1 3 2 : v i X r a Abstract-This paper presents a novel loss function referred to as hybrid ordinary-Welsch (HOW) and a new sparsity-inducing regularizer associated with HOW. We theoretically show that the regularizer is quasiconvex and that the corresponding Moreau envelope is convex. Moreover, the closed-form solution to its Moreau envelope, namely, the proximity operator, is derived. Compared with nonconvex regularizers like the lp-norm with 0 < p < 1 that requires iterations to find the corresponding proximity operator, the developed regularizer has a closed-form proximity operator. We apply our regularizer to the robust matrix completion problem, and develop an efficient algorithm based on the alternating direction method of multipliers. The convergence of the suggested method is analyzed and we prove that any generated accumulation point is a stationary point. Finally, experimental results based on synthetic and real-world datasets demonstrate that our algorithm is superior to the state- of-the-art methods in terms of restoration performance. Index Terms-Low-rank, concave, sparsity, proximity operator, robust matrix completion. I. INTRODUCTION L OW-RANK matrix completion (LRMC) aims to find the missing entries of an incomplete matrix using the low- rank property [1]–[3]. The observed data in many real-life applications such as image inpainting [4], [5], hyperspectral image restoration [6], [7] and collaborative filtering [8], [9], may be incomplete. Thus LRMC is widely used as an effi- cient tool to deal with the above issues because their main information lies in a low-dimensional subspace [10]. Roughly speaking, LRMC can be achieved in two ways, namely, matrix factorization [11], [12] and rank minimiza- tion [13], [14]. The former exploits LRMC via considering the estimated matrix as a product of two much smaller matrices. Much success has been reported in collaborative filtering and hyperspectral imaging with the development of efficient algorithms, including low-rank matrix fitting [15] and alternat- ing minimization for matrix completion [16]. Furthermore, to resist outliers, techniques such as robust matrix factorization by majorization minimization [17], practical low-rank matrix approximation via robust l1-norm (RegL1) [18] and half- quadratic alternating steepest descent (HQ-ASD) [19] are proposed. Nevertheless, this approach requires knowledge of the matrix rank, which is not easy to be determined in real- world applications. Z.-Y. Wang and H. C. So are with the Department of Electrical Engineering, City University of Hong Kong, Hong Kong, China. A. M. Zoubir is with the Signal Processing Group at Technische Universit ̈at Darmstadt, 64283 Darm- stadt, Germany. (E-mail: z.y.wang@my.cityu.edu.hk, hcso@ee.cityu.edu.hk, zoubir@spg.tu-darmstadt.de). Unlike matrix factorization, the rank minimization approach does not need the rank of the observed matrix. The correspond- ing algorithms perform LRMC via imposing a rank constraint on the estimated matrix. Because direct rank minimization is an NP-hard problem [13], [14], nuclear norm minimization (NNM) as the tightest convex relaxation of rank minimization is exploited in [13]. Other techniques such as singular value thresholding (SVT) [20] and accelerated proximal gradient with linesearch [21] are developed. However, NNM based algorithms shrink all singular values equally and underestimate the larger singular values [22], [23]. There are two schemes to cope with such an issue. The first one is to weigh the singular values per iteration differently, which is analogous to reweighting the l1-norm for compressive sensing [24]. For example, Gu et al. [25] propose a weighted nuclear norm minimization (WNNM) for matrix completion. They obtain good experimental results in image inpainting, although their approach is not robust against outliers. Besides, Pokala et al. [26] unfold the minimax-concave penalty (MCP) [27] and develop a weighted MCP (WMCP) to find the low-rank matrix. On the other hand, nonconvex sparsity-inducing regularizers have been suggested since they have less estimation bias than the l1-norm [22]. Various algorithms [28]–[33] try to replace the nuclear norm with nonconvex relaxation, and have shown their superiority over NNM. As a generalization of the nuclear norm, the Schatten p-norm defined as the lp-norm of the singu- lar values, is exploited to find the low-rank component in [28] and [29], and the estimation bias decreases with the p value. Lu et al. [30]–[32] exploit nonconvex regularizers, including the exponential-type penalty [34] and the Laplace function [35] via iteratively reweighted nuclear norm. They attain low- rank matrix recovery, and propose generalized singular value thresholding (GSVT), which provides theoretical analysis of the low-rank optimization problem using nonconvex sparsity- promoting regularizers. In addition, the nonconvex logarithm penalty is applied to LRMC in [23]. However, the above methods are sensitive to gross errors, and impulsive noise occurs in many real-world scenarios [36], [37]. To achieve outlier resistance, Nie et al. [38], [39] employ joint Schatten p-norm and lp-norm to model the rank minimization problem and combat gross errors, respectively. Nevertheless, there are two main issues when the lp-norm with 0 < p < 1 is used: (i) It is not easy to choose a proper value of p which is sensitive to the intensity of noise; (ii) The lp-norm does not have a closed-form expression for its proximity operator, except for p = { 1 3 } [40], that is, their algorithm needs iterations to find the solution to the proximity operator. To avoid iterations, two efficient lp-norm based algorithms with 2 , 2 2 and p = 2 p = 1 respectively, are designed in [41]. 3 , referred to as (SSS+LLL)1/2 and (SSS+LLL)2/3, In fact, nonconvex loss functions such as Welsch and Cauchy, are widely utilized to achieve robust perfor- mance [42]–[44], because the convex l1-norm and Huber func- tion are still sensitive to outliers with large magnitude. Among these nonconvex functions, Welsch function as an error mea- sure has attained big success in robust principal component analysis (RPCA) [45], robust matrix completion (RMC) [19] and subspace clustering [46]. Nevertheless, Welsch function has two limitations: (i) The first issue is stated by comparing the Welsch function with its Huber counterpart. Huber function attains robustness via dividing the data into two categories, namely, normal data and outlier-contaminated data. Here, normal data refer to observations without outliers but possibly contain Gaussian noise. The Huber function assigns equal weights for all normal data via the quadratic function, while assigning smaller weights to outlier-corrupted data using the l1-norm. The advantage of the Huber function is that it only changes the weights of outlier-contaminated data, whereas the Welsch function down-weighs all observed data, including the normal data [37]; (ii) The implicit regularizer (IR) generated by Welsch function using half-quadratic optimization [42], [45] cannot make the solution sparse, limiting its applicability. In this paper, a novel loss function named hybrid ordinary- Welsch (HOW) is devised, where 'ordinary' means the quadratic function or the l2-norm. The new function only changes the weights of outlier-corrupted data and the IR generated by HOW is able to make the solution sparse. To the best of our knowledge, we are the first to propose a sparsity- inducing regularizer associated with the Welsch function, and a closed-form expression of its proximity operator, which avoids iterations to finding the corresponding solution. In addition, it the generated IR is quasiconvex and its M oreau envelope is convex. We apply the generated IR to the RMC problem, and develop an algorithm based on the alternating direction method of multipliers (ADMM). Our main contributions are summarized as follows: is proved that (i) We devise the HOW function, which alleviates the two limitations of Welsch function, whereby Welsch function is a special case of HOW. (ii) The IR generated by HOW can achieve sparseness, and the closed-form solution to its M oreau envelope is derived. Besides, the properties of the IR are theoretically analyzed. (iii) The proposed sparsity-inducing regularizer is utilized to solve the RMC problem, and an ADMM based algorithm is suggested. All subproblems have closed-form solutions and we prove that any accumulation point is a stationary point that satisfies Karush-Kuhn-Tucker (KKT) condi- tions. (iv) Extensive experiments are conducted to compare the pro- posed algorithm with competing methods using synthetic and real-life data. It is demonstrated that our approach achieves better recovery performance. The remainder of this paper is organized as follows. In Section II, we introduce notations and related works. The 2 devised loss function and its IR are presented in Section III. In Section IV, we apply HOW to RMC, and develop the ADMM based solver with convergence analysis. Numerical experiments using synthetic data as well as real-world images are provided in Section V. Finally, conclusions are drawn in Section VI. II. PRELIMINARIES In this section, notations are provided and related works are reviewed. A. Notations Scalars, vectors and matrices are represented by italic, bold lower-case and bold upper-case letters, respectively. AAAij stands for the (i, j) entry of a matrix AAA ∈ Rm×n, and (*)T signifies the transpose operator. We denote Ω ⊂ {1, * * * , m}× {1, * * * , n} and Ωc as the index set of the observed entries of a m × n matrix and the complement of Ω, respectively. (*)Ω is defined as a projection operator: [AAAΩ]ij = (cid:40) Aij, 0, if (i, j) ∈ Ω if (i, j) ∈ Ωc. (cid:113)(cid:80)m i=1 (cid:80)n j=1 A2 In addition, ∥AAA∥F = ij is its Frobenius norm. Given BBB ∈ Rm×n, ⟨AAA, BBB⟩ = trace(AAAT BBB) represents the Frobenius inner product of AAA and BBB. Moreover, |a| represents the absolute value of the scalar a. Finally, the first and second derivatives of a differentiable function f (x) are denoted by f ′(x) and f ′′(x), respectively, and ∂f stands for the set of subgradients, which reduces to the derivative for differentiable functions. B. Related Works 1) Low-Rank Matrix Completion: Given the observed ma- trix XXX Ω, matrix completion can be written as a rank mini- mization problem: min MMM rank(MMM ), s.t. MMM Ω = XXX Ω (1) where MMM is the recovered/estimated matrix. However, (1) is an NP-hard problem. To solve it, many studies exploit nuclear norm as the tightest convex relaxation of the rank function [14], leading to min MMM ∥MMM ∥∗, s.t. MMM Ω = XXX Ω (2) where ∥MMM ∥∗ denotes the nuclear norm, which is the sum of singular values of MMM . Nevertheless, nuclear norm is equal to applying the l1-norm to the singular value of a matrix, which underestimates all nonzero singular values and results in a biased solution. To alleviate such an issue, WNNM is suggested [25]: ∥MMM ∥www,∗, s.t. MMM + SSS = XXX, SSSΩ = 000 min MMM where ∥MMM ∥www,∗ = (cid:80)r i=1 wwwiσσσi is the weighted nuclear norm, σσσi is the ith singular value of MMM and wwwi ≥ 0 is a weight assigned to σσσi. However, the above algorithms are vulnerable (3) to outliers. Then, an RMC approach based on the lp-norm with 0 < p < 1 is developed [38]: ∥XXX Ω − MMM Ω∥p p + γ∥MMM ∥q Sq (4) min MMM p = (cid:80) i,j∈Ω(XXX ij − MMM ij)p and ∥MMM ∥q Sq where ∥XXX Ω − MMM Ω∥p = (cid:80)min{m,n} i . Nevertheless, the proximity operator for the lp-norm does not have a closed-form expression, except for some special cases. σσσq i=1 2) Proximity Operator: The M oreau envelope of a regu- larizer φ(*) multiplied by a scalar λ > 0 is defined as [47], [48]: min x 1 2 (x − y)2 + λφ(x) whose solution is solved by the proximity operator: Pφ(y) := arg min x 1 2 (x − y)2 + λφ(x) In particular, the M oreau envelope of | * |1 is defined as: min y 1 2 (x − y)2 + λ|y|1 whose solution is: y∗ := Pl1,λ(x) = max{0, |x| − λ}sign(x) (5) (6) (7) (8) which is called the proximity operator of | * |1, and also known as the soft-thresholding operator. However, the l1-norm makes the solution have a constant bias λ, which can be calculated by the difference between the identity function and the solution. While Welsch function is suggested and its minimization is equivalent to maximizing the correntropy criterion [49] when the Gaussian kernel is adopted, He et al. [45] give its implicit regularizers (IRs) via half-quadratic optimization, and extend (5) to: lφw (x) := min y 1 2 (x − y)2 + φw(y) (9) where lφw (x) is the Welsch function, φw(y) is the associated IR, and its expression is in general unknown. The solution for (9) is: y∗ := Pφw (x) = x − x * e−x2/σ2 (10) Nevertheless, compared with the sparsity-promoting regu- larizer, such as the lp-norm (0 < p ≤ 1), the IR of Welsch cannot produce a sparse solution for (9) sparse. Fig. 1 shows the curves of proximity operator for different regularizers. It is observed that when |y| ≤ 1, P (y) = 0, that is, the regularizers l1-norm, the IR of HOW, the lp-norm (0 < p < 1) and the l0-'norm' can make the solution for their corresponding optimization problem (5) sparse. While the solution to (9) regularized by the IR of Welsch is not sparse, it is seen from (10) and Fig. 1 that it is zero if and only if x = 0. Moreover, the l1-norm as a regularizer leads to a biased solution, and although the lp-norm can alleviate this issue, the proximity operator for the lp-norm with 0 < p < 1 has no closed- form expression, except for two special cases p = 1 2 and p = 2 3 [40], implying that iterations are needed to find its proximity operator. 3 Fig. 1: Proximity operator for different regularizers with λ = 1. III. HYBRID ORDINARY-WELSCH FUNCTION AND ITS IMPLICIT REGULARIZER In this section, we first devise a novel loss function, and propose a new regularizer. We prove that the regularizer is a quasiconvex function and its M oreau envelope is convex. In addition, a closed-form expression for its proximity operator is derived. The expression of our designed HOW is: lσ,λ(x) =    x2/2, (cid:18) σ2 2 1 − e (cid:19) λ2−x2 σ2 |x| ≤ λ + λ2 2 , |x|>λ (11) where λ ≥ 0 is a constant, and σ is the kernel size. It is seen that the Welsch function is a special case of (11) when λ = 0. Besides, the Legendre-Fenchel transform is utilized to study the nonconvex HOW function. Given a function f (x), its conjugate f ∗(y) is [50]: f ∗(y) = sup x xy − f (x) (12) If f (x) is a convex function, we have: f (x) = (f ∗(x))∗ = max y xy − f ∗(y) (13) where the sup amounts to the max when f (x) is a convex function. Moreover, we define a new convex function f (x): − lσ,λ(x) f (x) = = x2 2    0, 2 − σ2 x2 2 (cid:18) 1 − e λ2−x2 σ2 (cid:19) |x| ≤ λ (14) − λ2 2 , |x|>λ whose convexity property is proved in Appendix A. By (12), it is easy to obtain: f ∗(y) = max x xy − + lσ,λ(x) x2 2 (y − x)2 2 y2 2 = max x − = λφσ,λ(y) + + lσ,λ(x) + y2 2 (15) where φσ,λ(y) = max x − (y − x)2 2λ + lσ,λ(x) λ (16) -4-3-2-101234-4-3-2-101234 Since f (x) is convex, applying (13) yields: z1 = |yyy1|1 z2 = φσ,λ(yyy1) z3 = g(yyy1) 4 f (x) = max y y * x − f ∗(y) = max y y * x − λφσ,λ(y) − y2 2 = max y − (y − x)2 2 − λφσ,λ(y) + x2 2 (17) Combining (14) and (17), we have: lσ,λ(x) = min y (y − x)2 2 + λφσ,λ(y) (18) where φσ,λ(y) is named as the IR of HOW. Similar to the IR of the Welsch function, the exact expression of φσ,λ(y) is unknown. The solution to (18) is the same as that to (17), and it can be determined by the following lemma. Lemma 1. (Inversion rule for subgradient relations [51]) For any proper, lower semicontinuous and convex function f (x), we have: (a) z1 = |yyy1|1 + |yyy2|1 (b) z2 = φσ,λ(yyy1) + φσ,λ(yyy2) (c) z3 = g(yyy1) + g(yyy2) (d) (e) (f) Contours of (d) Contours of (e) Contours of (f) arg max y arg max x yx − f ∗(y) = ∂f (x) xy − f (x) = ∂f ∗(y) Thus, the solution to (18) is: (cid:110) 0, |x| − |x| * e(λ2−x2)/σ2 (cid:111) Pφσ,λ (x) = f ′(x) = max sign(x) (20) Furthermore, the properties of φσ,λ(y) are summarized in Proposition 1, whose proof is provided in Appendix B. Proposition 1. φσ,λ(y) has the following three important properties: (i) φσ,λ(y) is concave for y > 0 when σ ≤ 2λ, and φσ,λ(y) is symmetric, i.e., φσ,λ(y) = φσ,λ(−y). That is, φσ,λ(y) is a quasiconvex function when σ ≤ 2λ. √ √ (ii) Defining g(y) = y2 2 + λφσ,λ(y), g(y) is convex with respect to (w.r.t.) y for any λ and σ. (iii) Pφσ,λ(x) is monotonically non-decreasing, namely, for any x1 < x2, Pφσ,λ (x1) ≤ Pφσ,λ (x2). √ It is worth pointing that although φσ,λ(y) is nonconvex, problem (18) is convex due to Proposition 1. Fig. 1 plots the 2. It is seen that curve of Pφσ,λ(x) with λ = 1 and σ = compared with the l1-norm, the IR of HOW has a smaller bias (the bias is given by the difference between the identity function and the proximity operator for x > λ). Compared to other nonconvex regularizers such as the lp-norm (0 < p < 1), whose corresponding optimization problems in (5) may be not convex, our regularizer makes (18) convex and its closed-form solution is derived. Moreover, the IR φσ,λ(*) is separable, that is, φσ,λ(yyy) = (cid:80)n i=1 φσ,λ(yyyi) where yyy = [yyy1, * * * , yyyn]T . Similarly, g(yyy) = (cid:80)i=n i=1 g(yyyi). To verify Proposition 1, Figs. 2 (d)-(f) show the curves of |yyy|1, φσ,λ(yyy) and g(yyy) with n = 2, respectively, with |yyy|1 being the baseline. Figs. 2 (a)-(c) correspond to the sectional views (yyy2 = 0) of (d)-(f), respectively. It is easy to see that φσ,λ(yyy1) is concave when yyy1 > 0 and g(yyy1) is convex. Figs. 2 (g)-(i) plot the contours of (d)-(f), respectively. We observe that the level sets (g) and (i) are (19) (g) (h) (i) Fig. 2: Illustration of Proposition 1. (a)-(c) show the curves of |y|1, φσ,λ(y) and g(y), where y is a scalar, which are the respective sectional views of (d)-(f). (d)-(f) plot the respective curves of |yyy|1, φσ,λ(yyy) and g(yyy), where yyy is a 2 × 1 vector. (g)-(i) are the respective contours of (d)-(f). convex because (d) and (f) are convex, while the level set (h) is not convex. Nevertheless, (h) can be converted into (i) via adding a quadratic term into (e). IV. ALGORITHM FOR ROBUST MATRIX COMPLETION A. Mathematical Preliminaries The key definitions and lemma used in our developed algorithm are stated in this section. Definition 1. Let xxx ∈ Rm and XXX ∈ Rm×n. Since the regularizer φσ,λ(*) is separable, the solution to the following problems: 1 2 ∥xxx − yyy∥2 2 + λφσ,λ(yyy) ∥XXX − YYY ∥2 2 + λφσ,λ(YYY ) min yyy min YYY 1 2 (21a) (21b) are YYY ij = Pφσ,λ(XXX ij), i = 1, * * * , m, j = 1, * * * , n yyyi = Pφσ,λ (xxxi), i = 1, * * * , m (22a) (22b) respectively. Defining Pφσ,λ (*) is an element-wise operator, (22a) and (22b) are denoted as: yyy = Pφσ,λ (xxx) YYY = Pφσ,λ (XXX) Definition 2. Let XXX = UUU diag(sss) VVV T be the singular value decomposition (SVD) of a rank-r matrix XXX ∈ Rm×n, where sss = [s1, s2, * * * , sr]T is the vector of singular values. The nuclear norm ∥XXX∥∗ is defined as: (23b) (23a) ∥XXX∥∗ = ∥sss∥1 = r (cid:88) i=1 si (24) -5-4-3-2-1012345012345-5-4-3-2-101234500.511.5-5-4-3-2-1012345051015-4-2024-4-2024-4-2024-4-2024 which is the l1-norm of sss. U pdate of MMM : Given SSSk, ΛΛΛk and ρk, the low-rank matrix 5 Using the nuclear norm to find the low-rank components will underestimate all nonzero singular values because the nuclear norm is equivalent to applying the l1-norm to the singular values. To address this issue, we replace the l1-norm with our sparsity-promoting regularizer. Definition 3. Let XXX = UUU diag(sss) VVV T be the SVD of a rank-r matrix XXX ∈ Rm×n, where sss = [s1, s2, * * * , sr]T is the vector of singular values. The matrix φσ,λ-norm of XXX, denoted as ∥XXX∥φσ,λ , is defined as: ∥XXX∥φσ,λ = φσ,λ(sss) = r (cid:88) i=1 φσ,λ(si) (25) [32] Let XXX = UUU Diag(sss) VVV T be the SVD of a Lemma 2. rank-r matrix XXX ∈ Rm×n, where sss = [s1, s2, * * * , sr]T is the vector of singular values, and define: P∥*∥φσ,λ (XXX) = arg min MMM λ∥MMM ∥φσ,λ + 1 2 ∥XXX − MMM ∥2 F (26) If the proximity operator Pφσ,λ decreasing, then the solution to (26) is: is monotonically non- MMM = UUU Diag(sss⋆)VVV T where sss⋆ satisfies s⋆ determined for i = 1, 2, * * * , r, as: 1 ≥ * * * ≥ s⋆ i ≥ * * * ≥ s⋆ r, which is s⋆ i := Pφσ,λ (si) = arg min s>0 λφσ,λ(s) + 1 2 (s − si)2 B. Algorithm Development In this section, we apply the proposed sparsity-inducing regularizer to RMC. The corresponding optimization problem is written as: ∥MMM ∥φσ,1/ρ + λφσ,λ/ρ(SSSΩ) min MMM ,SSS s.t. XXX Ω = MMM Ω + SSSΩ which is equal to: ∥MMM ∥φσ,1/ρ + λφσ,λ/ρ(SSSΩ) min MMM ,SSS s.t. XXX = MMM + SSS (27) (28) where SSSΩc ̸= 0 if MMM Ωc ̸= 0. Problem (28) can be efficiently solved by ADMM, and its augmented Lagrangian function is: L′ ρ(MMM , SSS, ΛΛΛ) := ∥MMM ∥φσ,1/ρ + λφσ,λ/ρ(SSSΩ) + ⟨ΛΛΛ, XXX − MMM − SSS⟩ + which amounts to: ∥XXX − MMM − SSS∥2 F (29) ρ 2 Lρ(MMM , SSS, ΛΛΛ) := 1/ρ * ∥MMM ∥φσ,1/ρ + λ/ρ * φσ,λ/ρ(SSSΩ) + ⟨ΛΛΛ, XXX − MMM − SSS⟩ /ρ + 1 2 ∥XXX − MMM − SSS∥2 F (30) where ΛΛΛ is the Lagrange multiplier vector, the last term is the augmented term and ρ > 0 is the penalty parameter. The details of the parameter updates at the (k + 1)th iteration, i.e., (cid:0)MMM k+1, SSSk+1, ΛΛΛk+1(cid:1), are derived as follows. MMM is updated by: MMM k+1 = arg min MMM 1/ρk*∥MMM ∥φσ,1/ρk + Invoking Lemma 2, we have: (cid:13) (cid:13) XXX − SSSk + (cid:13) (cid:13) 1 2 (cid:13) 2 ΛΛΛk (cid:13) ρk − MMM (cid:13) (cid:13) (31) F MMM k+1 = P∥*∥φ σ,1/ρk (cid:18) XXX − SSSk + (cid:19) ΛΛΛk ρk (32) U pdate of SSS: Given MMM k+1, ΛΛΛk and ρk, SSSk+1 is updated is by two steps, i.e., the updates of SSSk+1 obtained from: Ωc . SSSk+1 and SSSk+1 Ω Ω arg min SSSΩ λ/ρk *φσ,λ/ρk (SSSΩ)+ (cid:13) (cid:13) XXX Ω − MMM k+1 (cid:13) (cid:13) Ω + 1 2 ΛΛΛk Ω ρk − SSSΩ (cid:13) 2 (cid:13) (cid:13) (cid:13) F (33) whose closed-form solution is: (cid:18) SSSk+1 Ω = Pφσ,λ/ρk XXX Ω − MMM k+1 Ω + (cid:19) ΛΛΛk Ω ρk While SSSk+1 Ωc is updated by: arg min SSSΩc (cid:13) (cid:13) XXX Ωc − MMM k+1 (cid:13) (cid:13) Ωc + 1 2 ΛΛΛk Ωc ρk − SSSΩc (cid:13) 2 (cid:13) (cid:13) (cid:13) F with the optimal solution: SSSk+1 Ωc = ΛΛΛk Ωc ρk − MMM k+1 Ωc Combining (34) and (36) yields: (34) (35) (36) SSSk+1 ij =   Pφσ,λ/ρk  ΛΛΛk ij ρk − MMM k+1 ij (cid:32) XXX ij − MMM k+1 ij + (cid:33) ΛΛΛk ij ρk , if (i, j) ∈ Ω , if (i, j) ∈ Ωc. (37) U pdate of ΛΛΛ: Given MMM k+1, SSSk+1 and ρk, ΛΛΛk+1 is updated according to ΛΛΛk+1 = ΛΛΛk + ρk (cid:0)XXX − MMM k+1 − SSSk+1(cid:1) (38) The penalty parameter ρk is determined by ρk+1 = μρk, where μ > 1 is a constant. The steps of the proposed algorithm are summarized in Algorithm 1. Algorithm 1 Robust matrix completion via nonconvex and nonsmooth sparse regularizer (NNSR) Input: Incomplete matrix XXX Ω, index set Ω, ρ0 > 0, μ > 1, ξ > 0 and Im Initialize: SSS0 = 000, ΛΛΛ0 = 000, and k = 0. while relk E > ξ and k ≤ Im do Update MMM k via (32) Update SSSk via (37) Update ΛΛΛk via (38) Update ρk+1 = μρk k ← k + 1 end while Output: MMM = MMM k. C. Convergence Analysis The convergence of the proposed algorithm is analyzed in this section and we show that any generated accumulation point satisfies the KKT conditions. Theorem 1. Let {(MMM k, SSSk, ΛΛΛk)} be the sequence generated by Algorithm 1. Given a bounded initialization (SSS0, ΛΛΛ0), {(MMM k, SSSk, ΛΛΛk)} has the following properties: (i) The sequence {(MMM k, SSSk)} satisfies: (cid:13) (cid:13)MMM k+1 − MMM k(cid:13) 2 F = 0 (cid:13) (cid:13)SSSk+1 − SSSk(cid:13) (cid:13) 2 F = 0 (cid:13) (cid:13)XXX − MMM k+1 − SSSk+1(cid:13) (cid:13) 2 F = 0 (cid:13) 1) limk→∞ 2) limk→∞ 3) limk→∞ (ii) The sequences {(MMM k, SSSk, ΛΛΛk)} generated are all bounded. (iii) Any accumulation point of the iteration sequence is a stationary point that satisfies the KKT conditions for (28). whose proof can be found in Appendix C. D. Stopping Criteria and Computational Complexity The algorithm is terminated when it converges or the iteration number reaches the maximum allowable number Im. E = ∥XXX − MMM k − SSSk∥F /∥XXX∥F , Defining the relative error relk if relk E ≤ ξ, where ξ is a constant, we assert that the solution satisfies the convergence condition. the Similar to principal component pursuit (PCP) [13], proposed algorithm involves the SVD computation per itera- tion, whose complexity is O(min(m, n)mn) [41], where m and n are the row and column lengths of the incomplete matrix, respectively. Thus, the total complexity of Algorithm 1 is O(K min(m, n)mn), where K is the required iteration number. V. EXPERIMENTAL RESULTS In this section, we evaluate the proposed algorithm on synthetic data, real-world images and multispectral images. All simulations are conducted using a computer with 3.0 GHz CPU and 16 GB memory. The algorithms based on factorization, i.e., HQ-ASD [19], RegL1 [18], and the rank minimization algorithms including (SSS+LLL)1/2, (SSS+LLL)2/3 [41] and LpSq [38] with p = 1/2, are realized as competitors. The recommended setting of the parameters for the competing 2λ, μ = 1.05, algorithms is adopted, and we suggest σ = Im = 1000 and ξ = 10−7 for our method. √ A. Synthetic Data We first generate the low-rank matrix MMM t = UUUVVV T , where the entries of UUU ∈ Rm×r and VVV ∈ Rn×r with r being the rank are standard Gaussian distributed. Then MMM t is corrupted by the sparse outlier matrix SSS, which includes αmn nonzero outliers with values uniformly distributed in [−β/2, β/2]. Besides, MMM t is masked by ΩΩΩ, whose entries are drawn independently from a Bernoulli distribution with |ΩΩΩ|1 = γmn where γ is the observation ratio. The relative reconstruction error (RRE) of F / ∥MMM t∥2 the low-rank matrix defined as REE = ∥MMM t −MMM ∥2 F , where MMM is the estimated low-rank matrix, is employed 6 (a) γ = 0.9 (b) γ = 0.7 (c) γ = 0.5 (d) α = 0.1 (e) α = 0.3 (f) α = 0.5 (g) β = 100 (h) β = 300 (i) β = 500 (j) r = 40 (k) r = 60 (l) r = 80 Fig. 3: Log-scale RRE versus c where λ = c/(cid:112)max(m, n). (a)-(c) plot the RRE versus c for different percentage observation ratios γ at r = 20, α = 0.2 and β = 100. (d)-(f) show the RRE versus c for different outlier ratios α at r = 20, γ = 0.8 and β = 100. (g)-(i) plot the RRE versus c for different outlier maximum values β at r = 20, γ = 0.8 and α = 0.2. (j)-(l) plot the RRE versus c for different matrix ranks r at β = 100, γ = 0.8 and α = 0.2. (a) (b) Fig. 4: Convergence curves of the proposed algorithm. as the evaluation metric. Moreover, the performance of all approaches is evaluated using the average results of 100 independent runs. We first conduct a series of experiments on the choice of the hyper-parameter λ where λ = c/(cid:112)max(m, n). We set m = n = 400 for convenience. Fig. 3 plots the RRE versus λ for various parameters settings, including different observations, outlier levels and matrix ranks. Figs. 3 (a)-(c) show the influence of the observation ratio γ on the recovery error, and it is seen that there is a wide range for the choice of λ even when γ decreases. Figs. (d)-(f) and (g)-(i) show the impact of the outlier ratio α and the outlier maximum magnitude β on λ, respectively. We observe that the outlier 01234-15-10-50501234-15-10-50501234-15-10-50501234-15-10-50501234-15-10-50501234-15-10-50501234-15-10-50501234-15-10-50501234-15-10-50501234-15-10-50501234-15-10-50501234-15-10-50505010015020000.20.40.60.8X 176Y 2.29589e-0805010015020000.20.40.60.8X 177Y 1.13651e-07 Image-1 Image-2 Image-3 Image-4 Image-5 Image-6 Image-7 Image-8 7 Fig. 6: Test images (a) (c) (b) (d) Fig. 5: Recovery performance for all algorithms under different scenarios. (a) RRE versus percentage of missing elements for different methods. (b) RRE versus percentage of outliers for different methods.(c) RRE versus outlier magnitude for different methods. (d) RRE versus matrix rank for different methods. (a) Image restoration results for the random mask magnitude has little influence on the choice of λ because the proposed loss function is bounded from above, while the proper range of λ becomes smaller when α increases. Figs. (j)-(l) show the impact of the rank on λ, and it is observed that the admissible range of λ decreases as the rank increases. We set λ = 1/(cid:112)max(m, n) for convenience, because it attains comparable recovery results although λ is not the optimal value for the current settings. In addition, the convergence of the developed algorithm is investigated. To this end, two evaluation metrics are adopted: (cid:13) (cid:13)MMM k − MMM k−1(cid:13) (cid:13) (cid:13) REMMM k = (cid:13)F (cid:13)XXX − MMM k − SSSk(cid:13) REXXX k = (cid:13) where XXX is the observed matrix. Fig. 4 shows the convergence curves of 100 independent runs. It is seen that REMMM k and REXXX k approach zero when the algorithm converges. (cid:13)MMM k−1(cid:13) / (cid:13) (cid:13)F (cid:13)F / ∥XXX∥F (39) After choosing a proper value of λ, we compare our algo- rithm with the competitors for different cases. Fig. 5 (a) plots the log(RRE) curves versus the percentage of missing entries for different methods. We observe that compared with HQ- ASD, (SSS+LLL)1/2, (SSS+LLL)2/3 and LpSq, RegL1 and our method have a better recovery performance when the percentage of missing entries is less than 30%. It is seen that the proposed algorithm outperforms all competing techniques for a higher missing ratio. Fig. 5 (b) compares the recovery results under a varying percentage of outliers. Similarly, the NNSR is superior to the remaining approaches when the percentage of outliers is larger than 30%. Figs. 5 (c) and (d) plot the log(RRE) versus the magnitude of outliers and the matrix rank, respectively. Compared with the competitors, the proposed method has a stable recovery result for different outlier magnitudes and matrix ranks. (b) Image restoration results for the stripe mask Fig. 7: Image restoration results for Image-8 B. Image Inpainting Numerous real-world natural images can be approximated by low-rank matrices since their main information lies in a low-dimensional subspace [17], [41]. Fig. 6 shows several images in [4] and [53], which are used to test the algorithms. These images may be incomplete due to a photosensitive device or shadow cast, and be contaminated by outliers during a wireless transmission or the acquisition stage. In this section, the images are first converted into grayscale images and 20% entries are corrupted by outliers with magnitudes in the range of [−2, 2]. Besides, two different masks, that is, a random mask and a fixed mask, are utilized to cover the original images. A random mask selects the missing pixels randomly, while a fixed mask is the deterministic stripe in this study. In Fig. 6, the first row contains the true images, while the second and the third rows are degraded images covered by the random and stripe masks, respectively. Moreover, to measure the recovery performance, the peak signal-to-noise ratio (PSNR) index similarity (SSIM), are adopted, and the structural 1020304050-20-15-10-501020304050-20-15-10-50550100150200250-20-15-10-50520406080100-20-15-10-50 TABLE I: Image restoration results from different algorithms in terms of PSNR and SSIM. The best and the second best results are highlighted in bold and underlined. The results are the average value of 20 trials. 8 PSNR HQ-ASD RegL1 (S+L)1/2 Image-1 25.135 Image-2 26.868 Image-3 34.792 Image-4 20.848 Image-5 25.791 Image-6 26.530 Image-7 19.857 Image-8 26.123 26.589 26.908 35.060 23.702 23.311 27.978 22.538 27.192 Average 25.743 26.660 Image-1 25.256 Image-2 26.858 Image-3 34.779 Image-4 20.827 Image-5 26.469 Image-6 26.307 Image-7 19.825 25.758 26.392 35.049 22.793 25.924 26.621 22.657 Random mask Fixed mask (S+L)2/3 LpSq NNSR HQ-ASD RegL1 31.300 0.8179 28.682 29.217 0.8207 SSIM (S+L)1/2 0.9000 (S+L)2/3 LpSq NNSR 0.9295 0.9016 0.8938 31.366 32.739 34.990 40.235 39.458 40.541 24.515 26.779 26.955 28.709 28.966 28.975 32.285 31.871 33.341 24.254 22.964 29.139 29.718 32.497 33.596 0.7479 0.9396 0.8902 0.8508 0.8004 0.6617 0.8529 0.7347 0.8528 0.8559 0.8908 0.9305 0.9544 0.9771 0.9836 0.9763 0.9887 0.9109 0.9406 0.9375 0.9572 0.9531 0.8271 0.8945 0.8965 0.9093 0.8977 0.7987 0.9370 0.9365 0.9242 0.9557 0.6963 0.8088 0.8055 0.7752 0.8146 0.8467 0.8974 0.9005 0.9387 0.9422 30.037 30.495 32.355 0.8202 0.8237 0.9010 0.9022 0.9082 0.9265 29.226 28.794 31.183 30.979 31.986 33.568 40.222 39.498 40.382 24.578 26.650 26.227 28.584 28.812 28.717 0.8185 0.7420 0.9416 0.8858 0.8492 0.8135 0.8950 0.8973 0.8882 0.9179 0.7385 0.8445 0.8482 0.8760 0.9140 0.9548 0.9774 0.9831 0.9767 0.9869 0.9017 0.9389 0.9363 0.9548 0.9488 0.8397 0.8926 0.8944 0.9066 0.8973 29.540 31.356 39.608 25.056 28.697 33.252 25.623 29.784 30.365 29.663 30.925 39.653 25.025 28.577 33.137 32.452 31.797 33.033 0.7907 0.7817 0.9352 0.9351 0.9221 0.9514 Image-8 25.647 26.970 29.929 29.705 32.086 32.528 24.822 24.159 22.945 27.532 0.6651 0.8494 0.6949 0.7962 0.7965 0.7685 0.8034 0.8382 0.8933 0.8964 0.9303 0.9330 Average 25.746 26.521 30.216 29.988 30.321 31.646 0.8178 0.8204 0.8966 0.8984 0.9029 0.9191 and the built-in commands 'psnr(recovered, original)' and 'ssim(recovered, original)' in MATLAB are employed to calculate them. Note that the competitors, such as HQ-ASD and RegL1, which are based on matrix factorization, require the matrix rank. Similar to [38], the rank r is varied in the set {1, 2, * * * , 30}, and its value is determined based on the highest PSNR value. Table I shows the restoration results for different algorithms. It is seen that when images are covered by a random mask, the proposed algorithm has the best recovery performance in terms of PSNR and has the highest average SSIM value, although its SSIM is inferior to LpSq for two images. Again, for the fixed mask, compared with HQ-ASD, RegL1, (SSS+LLL)1/2, (SSS+LLL)2/3 and LpSq, NNSR achieves the best average restoration in terms of PSNR and SSIM. In addition, Fig. 7 shows the recovery results of Image-8 for different algorithms. We easily observe that NNSR gives a clearer visual result compared to the remaining methods. C. Multispectral Imaging Restoration Multispectral imaging (MSI) acquires images of the same scene using different wavelengths, and has numerous ap- plications such as documents and artworks. However, these images may be contaminated by impulsive noise and suffer data loss due to photon effects and calibration errors. Thus, there is a need to improve the MSI quality. Two datasets from CAVE [54], namely, feathers and flowers, are employed to evaluate the algorithms. Each dataset contains 31 spectral bands with dimensions 512 × 512. The data matrix XXX ∈ R262144×31 is constructed by vectorizing each band. Besides, TABLE II: MSI restoration results from different algorithms in terms of PSNR, SSIM and runtime. The best and second best results for each row are highlighted in bold and underlined. The results are the average value of 20 independent runs. HQ-ASD RegL1 (S+L)1/2 (S+L)2/3 LpSq NNSR 40.134 43.495 32.304 24.978 41.124 33.751 PSNR feathers SSIM 0.4931 0.8656 0.9539 0.9521 0.9489 0.9675 Runtime 264.96 37.007 162.23 144.44 1145.4 103.10 PSNR 26.169 34.228 43.625 32.264 42.490 46.437 flowers SSIM 0.4678 0.8532 0.9685 0.9546 0.9603 0.9759 Runtime 252.30 34.481 150.67 135.97 1121.7 91.676 20% of pixels in XXX are randomly removed, and 10 dB salt- and-pepper noise produced by the built-in MATLAB function 'imnoise(III, salt & pepper, ρ)' is added to the incomplete matrix. The relationship between ρ and the signal-to-noise ratio (SNR) is ρ = 1/SNR. Table II tabulates the recovery results in terms of PSNR, SSIM and runtime (in seconds). NNSR attains the highest PSNR and SSIM values for both datasets. RegL1 involves less running time than our method, but it requires knowing the matrix rank. On the other hand, LpSq and NNSR do not need the prior rank information, and compared with LpSq, NNSR has less computational time because LpSq involves iterations to find the proximal operator of the lp-norm, while NNSR has a closed-form expression for its proximal operator. Figs. 8 and 9 show the recovered results for each band of 'feathers' and 'flowers', respectively. We observe that compared with the competing methods, NNSR has the highest 9 (a) (b) Fig. 8: Recovery performance for each band of 'feathers' data in terms of PSNR and SSIM. Fig. 9: Recovery performance for each band of 'flowers' data in terms of PSNR and SSIM. PSNR and SSIM values for most of the bands in both datasets. Note that all techniques have a bad performance for the first few bands, because there exists a blur in these bands [55]. To provide visual comparison, three bands of MSI are chosen to construct a pseudo-color image. Figs. 10 and 11 display the restoration results. It is seen that NNSR has the best recovery performance since the images generated by the remaining algorithms still contain apparent noise. VI. CONCLUSION In this paper, we devise a novel loss function, referred to as HOW, and propose a new sparsity-promoting regularizer, Fig. 11: Recovered images of 'flowers' with bands 25-15-5 as R-G-B. (a) is the degraded image corrupted by impulsive noise and random mask, (h) is the original noise-free image, and the remaining images are the restoration results using different algorithms, with a demarcated area zoomed-in 6 times. which is able to make the solution sparse. Besides, the solution generated by our regularizer has less bias than that by the l1-norm. Compared with the lp norm with 0 < p < 1, the closed-form expression for the proximity operator of the developed regularizer is derived. Moreover, the properties of our regularizer are theoretically analyzed. We apply it to RMC, and an ADMM based algorithm with convergence guarantees is suggested. We prove that any generated accumulation point satisfies the KKT conditions. Extensive numerical examples using synthetic and real-world datasets show that our algorithm is superior to the state-of-the-art robust methods in terms of recovery performance. APPENDIX A Proof: It is easy to find that f (x) is a convex function if and only if f (x) is convex when x>λ. Thus, we only need to verify that f ′′(x) > 0 for x>λ. Then, we have: ′ f (x) = x − x * e λ2−x2 σ2 (40) and (cid:18) (x) = 1 − 1 − ′′ f λ2−x2 σ2 = e (cid:18) e λ2−x2 σ2 e (cid:19) 2x2 σ2 x2−λ2 σ2 + (cid:19) 2x2 σ2 − 1 2x2 σ2 − 1 (cid:19) (41) (cid:18) x2 − λ2 σ2 + 1 + (cid:19) (cid:18) 3x2 − λ2 σ2 λ2−x2 σ2 ≥ e λ2−x2 σ2 = e > 0 Fig. 10: Recovered images of 'feathers' with bands 23-13-4 as R-G-B. (a) is the degraded image corrupted by impulsive noise and random mask, (h) is the original noise-free image, and the remaining images are the restoration results using different algorithms, with a demarcated area zoomed-in 6 times. where the first inequality is obtained because ex>x + 1 for any x ∈ R, and the last inequality is due to x>λ. Thus, f (x) is a convex function. 05101520253010203040500510152025300.20.40.60.8105101520253010203040500510152025300.20.40.60.81 APPENDIX B PROOF OF PROPOSITION 1 Proof: (i). When y>0, the solution to arg max x is unique, denoted as x⋆, and it satisfies via (20): y*x−f (x) y = x⋆ − x⋆e λ2−(x⋆ )2 σ2 (42) implying that y increases with x⋆ because the right hand side is monotonically increasing w.r.t. x⋆ via (40) and (41). Besides, using Lemma 1 yields: arg max x xy − f (x) = ∂f ∗(y) = y + λ∂φσ,λ(y) (43) that is, x⋆ = y + λ∂φσ,λ(y). By (42), it is easy to get: ∂φσ,λ(y) = λ2−(x⋆ )2 σ2 e x⋆ λ (44) We define r(x) = x λ e λ2−x2 σ2 < 0 because 2x2 λ2−x2 σ2 and r′(x) = 1 λ (cid:16) (cid:17) 1 − 2x2 σ2 √ × σ2 > 1 when x > λ, namely, σ ≤ 2λ. e Combining (42), that is, y increases with x⋆, we know that ∂φσ,λ(y) is a decreasing function of y. Thus, φσ,λ(y) is concave for y > 0. Besides, according to (16), we have: φσ,λ(−y) = max x∈R − t=−x= max t∈R − = max t∈R = φσ,λ(y) lσ,λ(x) λ lc,σ(−t) λ + (45) + (−y − x)2 2λ (−y + t)2 2λ (y − t)2 2λ + − lc,σ(t) λ where the penultimate equation is obtained because lσ,λ(x) is an even function. Therefore, φ(y) is symmetric. (ii). Due to the fact that the conjugate of f (x) is a convex function, we know that f ∗(y) = λφσ,λ(y) + y2 in (15) is convex w.r.t. y. Thus, g(y) is convex w.r.t. y for any λ and σ. (iii). Since Pφσ,λ (x) is an odd function, and Pφσ,λ (x) = 0 when |x| ≤ λ, we only need to verify that Pφσ,λ (x) = x − x * e(λ2−x2)/σ2 is monotonic when x > λ. It is easy to conclude that Pφσ,λ (x) is monotonically increasing when x > λ via (40) as well as (41), thus Pφσ,λ(x) is monotonically non-decreasing. 2 10 It is easy to check that ∆(x) increases with x when σ ≤ √ 2λ, and ∆(x) ≥ ∆(λ) = 0. Thus, Pl1,λ(x) ≤ Pφσ,λ (x), x−Pφσ,λ (x) ≤ x−Pl1,λ(x) = λ for x ≥ λ and x−Pφσ,λ (x) = x−Pl1,λ(x) ≤ λ for 0 < x < λ. Therefore, |x−Pφσ,λ (x)| ≤ λ for any x ∈ R. Proposition 3. Defining h(σ, λ) = λφσ,λ(y), then when y > 0, h(σ, λ) increases with λ and σ. Proof: According to (16), we have h(σ, λ) = − (y−x⋆)2 2 + lσ,λ(x⋆). By (20), we know x > λ for y > 0, thus we only need to verify that h(σ, λ) increases with λ and σ when x⋆ > λ. We can check that ∂h ∂σ = ∂λ = λ(1 − e λ2−(x⋆ )2 + 1) − )e σ2 > (σ( (x⋆)2−λ2 ) > 0 and ∂h (x⋆ )2−λ2 σ2 λ2−(x⋆ )2 σ2 σ2 (σe σ + λ2−(x⋆)2 σ − σ + λ2−(x⋆)2 λ2−(x⋆ )2 )e σ2 σ = 0. This completes the proof. Proof of Theorem 1: Proof: (i). We first prove the boundness of ΛΛΛk+1 via: (cid:13)ΛΛΛk + ρk (cid:0)XXX − MMM k+1 − SSSk+1(cid:1)(cid:13) F = (cid:13) (cid:13)ΛΛΛk+1(cid:13) (cid:13) 2 2 (cid:13) (cid:13) = (cid:0)ρk(cid:1)2 (cid:13) a= (cid:0)ρk(cid:1)2 (cid:13) (cid:13) XXX Ω − MMM k+1 (cid:13) (cid:13) =(cid:0)ρk(cid:1)2 (cid:13) (cid:13)DDDk+1 (cid:13) ΛΛΛk ρk − SSSk+1 ΛΛΛk ρk − SSSk+1 Ω (cid:1)(cid:13) 2 (cid:0)DDDk+1 (cid:13) (cid:13) F (cid:13) XXX − MMM k+1 + (cid:13) (cid:13) Ω − Pφ*,λ/ρk F (cid:13) 2 (cid:13) (cid:13) (cid:13) F (cid:13) 2 (cid:13) (cid:13) (cid:13) Ω + Ω Ω F (47) b ≤ (cid:0)ρk(cid:1)2 |Ω|1 (cid:88) i=1 = |Ω|1λ2 (λ/ρk)2 Ω = XXX Ω − MMM k+1 where DDDk+1 and Proposition 2, respectively. Thus, (cid:13) from above. Ω + ΛΛΛk Ω ρk , a and b are owing to (36) (cid:13)F is bounded (cid:13)ΛΛΛk+1(cid:13) lim k→∞ Besides, by (32) and (38), we obtain: (cid:13)MMM k+1 − MMM k(cid:13) (cid:13) 2 F = lim (cid:13) k→∞ − (cid:0)XXX − SSSk − (ΛΛΛk − ΛΛΛk−1)/ρk−1(cid:1) ∥2 (YYY k) − YYY k + ΛΛΛk/ρk + (ΛΛΛk − ΛΛΛk−1)/ρk−1∥2 F (cid:0)XXX − SSSk + ΛΛΛk/ρk(cid:1) ∥P∥*∥φ ∥P∥*∥φ σ,1/ρk F σ,1/ρk = lim k→∞ ≤ lim k→∞ = lim k→∞ (YYY k) − YYY k∥2 σ,1/ρk ∥P∥*∥φ ∥Pφσ,1/ρk (sss) − sss∥2 F + lim k→∞ ∥ZZZ k∥2 F F + lim k→∞ ∥ZZZ k∥2 F APPENDIX C PROOF OF THEOREM 1 The following two propositions are first provided. √ Proposition 2. When σ ≤ 2λ, namely, φσ,λ(y) is concave for y > 0, |Pl1,λ(x)| ≤ |Pφσ,λ (x)| and |x − Pφσ,λ (x)| ≤ λ for any x ∈ R, implying that the bias generated by our regularizer is no more than that by the l1-norm. Proof: Both Pl1,λ(x) and Pφσ,λ (x) are odd functions, and according to (8) and (20), we only need to verify Pl1,λ(x) ≤ Pφσ,λ (x) when x ≥ λ. Thus, when x ≥ λ, we have: ∆(x) = Pφσ,λ (x) − Pl1,λ(x) = −x * e(λ2−x2)/σ2 + λ (46) c ≤ lim k→∞ |sss|0/ρk + lim k→∞ ∥ZZZ k∥2 F = 0 (48) where YYY k = XXX − SSSk + ΛΛΛk/ρk = UUU diag(Pφσ,1/ρk (sss)) VVV T with sss being the singular value vector of YYY k, |sss|0 represents the number of nonzero elements of sss, ZZZ k = ΛΛΛk/ρk + (ΛΛΛk − ΛΛΛk−1)/ρk−1 and (c) is owing to Proposition 2. Similar to (48), we have: lim k→∞ (cid:13)SSSk+1 − SSSk(cid:13) (cid:13) 2 F = 0 (cid:13) (49) Moreover, by (38), we get: (cid:13)XXX − MMM k+1 − SSSk+1(cid:13) (cid:13) 2 F = lim (cid:13) k→∞ lim k→∞ ∥ΛΛΛk+1 − ΛΛΛk∥2 F /ρk = 0 (50) (55a) (55b) (55c) (56a) (56b) (56c) which means that the generated sequence {(MMM k, SSSk)} is a feasible solution to the objective function. is, there exists a convergent subsequence {(MMM kj , SSSkj , ΛΛΛkj )} such that 11 (ii). Since MMM k and SSSk are the minimizers of their cor- responding optimization problems, we have the following inequalities: Lρk (MMM k+1, SSSk, ΛΛΛk) ≤ Lρk (MMM k, SSSk, ΛΛΛk) Lρk (MMM k+1, SSSk+1, ΛΛΛk) ≤ Lρk (MMM k+1, SSSk, ΛΛΛk) (51) lim kj→∞ lim kj→∞ lim kj→∞ SSSkj = SSS∗ MMM kj = MMM ∗ ΛΛΛkj = ΛΛΛ∗ Besides, we have: Lρk+1(MMM k+1, SSSk+1, ΛΛΛk+1) + (cid:28)ΛΛΛk+1 ρk+1 − ΛΛΛk ρk , XXX − MMM k+1 − SSSk+1 (cid:28)ΛΛΛk+1 = Lρk (MMM k+1, SSSk+1, ΛΛΛk) + d ≤ Lρk (MMM k+1, SSSk+1, ΛΛΛk) (cid:29) ρk+1 − ΛΛΛk ρk , ΛΛΛk+1 − ΛΛΛk ρk (cid:29) where d is due to Proposition 3, and (cid:28)ΛΛΛk+1 ρk+1 − ΛΛΛk ρk , ΛΛΛk+1 − ΛΛΛk ρk (cid:29) =1/(ρk)2 (cid:10)ΛΛΛk+1/μ − ΛΛΛk, ΛΛΛk+1 − ΛΛΛk(cid:11) =1/(ρk)2 (cid:0)∥ΛΛΛk+1∥2 ≤1/(ρk)2 (cid:0)∥ΛΛΛk+1∥2 F /μ + ∥ΛΛΛk∥2 F /μ + ∥ΛΛΛk∥2 F F + ∥ΛΛΛk∥2 +(1 + 1/μ)/2(∥ΛΛΛk+1∥2 ≤1/(ρk)2(2 + 2/μ)|Ω|1λ2 F )(cid:1) F − (1 + 1/μ) (cid:10)ΛΛΛk+1 − ΛΛΛk(cid:11)(cid:1) Hence, Lρk+1(MMM k+1, SSSk+1, ΛΛΛk+1) ≤ Lρk (MMM k+1, SSSk+1, ΛΛΛk) + 1/(ρk)2(2 + 2/μ)|Ω|1λ2 (52) Combining (51) and (52) yields: Lρk+1(MMM k+1, SSSk+1, ΛΛΛk+1) ≤ Lρk (MMM k, SSSk, ΛΛΛk) + 1/(ρk)2(2 + 2/μ)|Ω|1λ2 (53) Thus, we get: Lρk (MMM k, SSSk, ΛΛΛk) ≤Lρ0 (MMM 0, SSS0, ΛΛΛ0) + (2 + 2/μ)|Ω|1λ2 1/(ρi)2 (54) k−1 (cid:88) i=0 μ2 bounded initialization, a (cid:80)k−1 i=0 1/(ρi)2 = since Given limk→∞ (ρ0)2(μ2−1) < ∞, we conclude that Lρk (MMM k, SSSk, ΛΛΛk) is bounded from above. We then know that Lρk (MMM k, SSSk+1, ΛΛΛk) and Lρk (MMM k+1, SSSk+1, ΛΛΛk) the are bounded from above via (51), is sequences because if ∥SSSk+1∥2 the then Lρk (MMM k, SSSk+1, ΛΛΛk) → ∞ or (k + 1)th iteration, Lρk (MMM k+1, SSSk+1, ΛΛΛk) → ∞. implying that This F → ∞ at F → ∞ or ∥MMM k+1∥2 {(SSSk+1, MMM k+1)} bounded. are Therefore, combining (47), we conclude that the sequences {(MMM k, SSSk, ΛΛΛk)} are all bounded. (iii). By Bolzano-Weierstrass theorem [52], the boundedness of {(MMM k, SSSk, ΛΛΛk)} guarantees that there exists at least one accumulation point (MMM ∗, SSS∗, ΛΛΛ∗) for {(MMM k, SSSk, ΛΛΛk)}. That In addition, the KKT conditions for (28) are: XXX = MMM ∗ + SSS∗ ΛΛΛ∗ ∈ ∂∥MMM ∗∥φσ,1/ρ∗ Ω ∈ λ∂φσ,λ/ρ∗ (SSS∗ ΛΛΛ∗ Ω) As {ΛΛΛk} is bounded, (56a) is satisfied due to: ∥XXX − MMM ∗ − SSS∗∥2 F = lim kj→∞ = lim kj→∞ = 0 (cid:13)XXX − MMM kj +1 − SSSkj +1(cid:13) (cid:13) 2 (cid:13) (cid:13)ΛΛΛkj +1 − ΛΛΛkj (cid:13) (cid:13) 2 F /ρkj (cid:13) F (57) Besides, MMM k+1 and SSSk+1 calculated by (32) and (37) are the minimizers for their corresponding optimization problems, thus we have: 000 ∈ ∂L(MMM k+1, SSSk, ΛΛΛk) ∂MMM ∂L(MMM k+1, SSSk+1, ΛΛΛk) ∂SSS 000 ∈ Moreover, 000 ∈ ∂L(MMM k+1, SSSk, ΛΛΛk) ∂MMM = ∂∥MMM k+1∥φσ,1/ρk − ΛΛΛk − ρk(XXX − MMM k+1 − SSSk) = ∂∥MMM k+1∥φσ,1/ρk − ΛΛΛk+1 − ρk(SSSk+1 − SSSk) (58a) (58b) (59) Hence, we have: 000 ∈ lim kj→∞ ∂∥MMM kj +1∥φ σ,1/ρ kj = ∂∥MMM ∗∥φσ,1/ρ∗ − ΛΛΛ∗ − ΛΛΛkj +1 − ρkj (SSSkj +1 − SSSkj ) (60) and (56b) is proved. Furthermore, 000 ∈ ∂L(MMM k+1, SSSk+1, ΛΛΛk) ∂SSSΩ = λ∂φσ,λ/ρk (SSSk+1 Ω ) − ΛΛΛk = ∂∥MMM k+1∥φσ,1/ρk − ΛΛΛk+1 Ω Ω − ρk(XXX Ω − MMM k+1 Ω − SSSk+1 Ω ) thus, we get: 000 ∈ lim kj→∞ ∂∥MMM kj +1∥φ σ,1/ρ − ΛΛΛkj +1 Ω kj = ∂∥MMM ∗∥φσ,1/ρ∗ − ΛΛΛ∗ Ω (61) (62) and (56c) is satisfied. Therefore, any accumulation point {MMM ∗, SSS∗, ΛΛΛ∗} satisfies the KKT conditions and is a stationary point. 12 REFERENCES [1] Y. Chi, Y. M. Lu, and Y. Chen, "Nonconvex optimization meets low- rank matrix factorization: An overview," IEEE Trans. Signal Process., vol. 67, no. 20, pp. 5239–5269, Oct. 2019. [2] F. Nie, Z. Li, Z. Hu, R. Wang, and X. Li, "Robust matrix completion with column outliers," IEEE Trans. Cybern., vol. 52, no. 11, pp. 12042- 12055, Nov. 2022. [3] M. Muma, W.-J. Zeng, and A. M. Zoubir, "Robust M-estimation based matrix completion," in 2019 IEEE Int. Conf. on Acoust., Speech and Signal Process., Brighton, UK, May 2019, pp. 5476–5480. [4] Y. Hu, D. Zhang, J. Ye, X. Li, and X. He, "Fast and accurate matrix completion via truncated nuclear norm regularization," IEEE Trans. Pattern Anal. Mach. Intell., vol. 35, no. 9, pp. 2117–2130, Sep. 2013. [5] W.-J. Zeng and H. C. So, "Outlier-robust matrix completion via lp-minimization," IEEE Trans. Signal Process., vol. 66, no. 5, pp. 1125–1140, Mar. 2018. [6] X. P. Li, Z.-L. Shi, Q. Liu, and H. C. So, "Fast robust matrix completion via entry-wise l0-norm minimization," IEEE Trans. Cybern., early access, Dec. 6, 2022, doi: 10.1109/TCYB.2022.3224070. [7] Z. -Y. Wang, X. P. Li and H. C. So, "Robust matrix completion based on factorization and truncated-quadratic loss function," in IEEE Trans. Circuits Syst. Video Technol., vol. 33, no. 9, pp. 1521-1534, Apr. 2023. [8] L. Zhao, P. Babu, and D. P. Palomar, "Efficient algorithms on robust low- rank matrix completion against outliers," IEEE Trans. Signal Process., vol. 64, no. 18, pp. 4767–4780, Sep. 2016. [9] A. Ramlatchan, M. Yang, Q. Liu, M. Li, J. Wang, and Y. Li, "A survey of matrix completion methods for recommendation systems," Big Data Mining Anal., vol. 1, no. 4, pp. 308–323, Jul. 2018. [10] M. A. Davenport and J. Romberg, "An overview of low-rank matrix recovery from incomplete observations," IEEE J. Sel. Topics Signal Process., vol. 10, no. 4, pp. 608–622, Jun. 2016. [11] T. Zhou and D. Tao, "Greedy bilateral sketch, completion & smoothing," in Proc. Int. Conf. Artif. Intell. Statist., Scottsdale, USA, Apr. 2013, pp. 650–658. [12] Y. Shen, Z. Wen, and Y. Zhang, "Augmented Lagrangian alternating direction method for matrix separation based on low-rank factorization," Optimization Methods Softw., vol. 29, no. 2, pp. 239–263, 2014. [13] E. J. Cand`es, X. Li, Y. Ma, and J. Wright, "Robust principal component analysis?" J. ACM, vol. 58, no. 3, 2011, Art. no. 11. [14] E. J. Cand`es, and B. Recht, "Exact matrix completion via convex optimization," Found. Comut. Math., vol. 9, no. 6, pp. 717-772, Dec. 2009. [15] Z. Wen, W. Yin, and Y. Zhang, "Solving a low-rank factorization model for matrix completion by a nonlinear successive over-relaxation algorithm," Math. Program. Comput, vol. 4, no. 4, pp. 333–361, Dec. 2012. [16] P. Jain, P. Netrapalli, and S. Sanghavi, "Low-rank matrix completion using alternating minimization," in Proc. 45th Annu. ACM Symp. Theory Comput., Palo Alto, USA, Jun. 2013, pp. 665–674. [17] Z. Lin, C. Xu, and H. Zha, "Robust matrix factorization by majorization minimization," IEEE Trans. Pattern Anal. Mach. Intell., vol. 40, no. 1, pp. 208–220, Jan. 2018. [18] Y. Zheng, G. Liu, S. Sugimoto, S. Yan, and M. Okutomi, "Practical low-rank matrix approximation under robust l1-norm," in Proc. IEEE Conf. Comput. Vis. Pattern Recognit., Providence, USA, Jun. 2012, pp. 1410–1417. [19] Y. He, F. Wang, Y. Li, J. Qin, and B. Chen, "Robust matrix completion via maximum correntropy criterion and half-quadratic optimization," IEEE Trans. Signal Process., vol. 68, pp. 181–195, Nov. 2019. [20] J.-F. Cai, E. J. Cand`es, and Z. Shen, "A singular value thresholding algorithm for matrix completion," SIAM J. Opt., vol. 20, no. 4, pp. 1956–1982, Mar. 2010. [21] K. C. Toh and S. W. Yun, "An accelerated proximal gradient algorithm for nuclear norm regularized least squares problems," Pacific. J. Optim., vol. 6, no. 15, pp. 615–640, Sep. 2010. [22] F. Wen, R. Ying, P. Liu, and R. C. Qiu, "Robust PCA using generalized nonconvex regularization," IEEE Trans. Circuits Syst. Video Technol., vol. 30, no. 6, pp. 1497–1510, Jun. 2020. [25] S. Gu, Q. Xie, D. Meng, W. Zuo, X. Feng, and L. Zhang, "Weighted nuclear norm minimization and its applications to low level vision," Int. J. Comput. Vis., vol. 121, no. 2, pp. 183–208, Jan. 2017. [26] P. K. Pokala, R. V. Hemadri, and C. S. Seelamantula, "Iteratively reweighted minimax-concave penalty minimization for accurate low rank plus sparse matrix decomposition," IEEE Trans. Pattern Anal. Mach. Intell., vol. 44, no. 12, pp. 8992–9010, Dec. 2022. [27] C. Zhang, "Nearly unbiased variable selection under minimax concave penalty," Ann. Statist., vol. 38, no. 2, pp. 894–942, Apr. 2010. [28] F. Nie, H. Huang, and C. Ding, "Low-rank matrix recovery via efficient Schatten p-norm minimization," in Proc. AAAI Conf. Artif. Intell., 2012, pp. 655–661. [29] L. Liu, W. Huang, and D. Chen, "Exact minimum rank approximation via Schatten p-norm minimization," J. Comput. Appl. Math., vol. 267, no. 1, pp. 218–227, 2014. [30] C. Lu, J. Tang, S. Yan, and Z. Lin, "Nonconvex nonsmooth low rank minimization via iteratively reweighted nuclear norm," IEEE Trans. Image Process., vol. 25, no. 2, pp. 829–839, Feb. 2016. [31] C. Lu, J. Tang, S. Yan, and Z. Lin, "Generalized nonconvex nonsmooth low-rank minimization," in Proc. IEEE Conf. Comput. Vis. Pattern Recog., Silver Spring, MD, USA, Jun. 2014, pp. 4130–4137. [32] C. Lu, C. Zhu, C. Xu, S. Yan, and Z. Lin, "Generalized singular value thresholding," in Proc. AAAI Conf. Artif. Intell., Texas, USA, Jan. 2015, pp. 1805–1811. [33] P. Gong, C. Zhang, Z. Lu, J. Huang, and J. Ye, "A general iterative shrinkage and thresholding algorithm for non-convex regularized op- timization problems," in Proc. 30th Int. Conf. Mach. Learn., Atlanta, Georgia, USA, 2013, pp. 37–45. [34] C. Gao, N. Wang, Q. Yu, and Z. Zhang, "A feasible nonconvex relaxation approach to feature selection," in Proc. 25th AAAI Conf. Artif. Intell., San Francisco, California USA, Aug. 2011, pp. 356–361. [35] J. Trzasko and A. Manduca, "Highly undersampled magnetic resonance image reconstruction via homotopic l0-minimization," IEEE Trans. Med. Imag., vol. 28, no. 1, pp. 106–121, Jan. 2009. [36] A. M. Zoubir, V. Koivunen, Y. Chakhchoukh, and M. Muma, "Robust estimation in signal processing: A tutorial-style treatment of fundamental concepts," IEEE Signal Process. Mag., vol. 29, no. 4, pp. 61–80, Jul. 2012. [37] A. M. Zoubir, V. Koivunen, E. Ollila, and M. Muma, Robust Statistics for Signal Processing. Cambridge, MA, USA: Cambridge Univ. Press, 2018. [38] F. Nie, H. Wang, H. Huang, and C. Ding, "Joint Schatten p-norm and lp-norm robust matrix completion for missing value recovery," Knowl. Inf. Syst., vol. 42, no. 3, pp. 525–544, 2013. [39] F. Nie, H. Wang, X. Cai, H. Huang, and C. Ding, "Robust matrix completion via joint Schatten p-norm and Lp-norm minimization," in Proc. IEEE Int. Conf. Data Mining, 2012, pp. 566–574 [40] D. Krishnan and R. Fergus, "Fast image deconvolution using hyper- Laplacian priors," in Proc. Adv. Neural Inf. Process. Syst., 2009, pp. 1033–1041. [41] F. Shang, J. Cheng, Y. Liu, Z. Luo, and Z. Lin, "Bilinear factor matrix norm minimization for robust PCA: Algorithms and applications," IEEE Trans. Pattern Anal. Mach. Intell., vol. 40, no. 9, pp. 2066–2080, Sep. 2018. [42] R. He, W.-S. Zheng, T. Tan, and Z. Sun, "Half-quadratic based iterative minimization for robust sparse representation," IEEE Trans. Pattern Anal. Mach. Intell., vol. 36, no. 2, pp. 261–275, Feb. 2014. [43] X. Li, Q. Lu, Y. Dong, and D. Tao, "Robust subspace clustering by Cauchy loss function," IEEE Trans. Neural Netw. Learn. Syst., vol. 30, no. 7, pp. 2067–2078, Jul. 2019. [44] Y. He and G. K. Atia, "Coarse to fine two-stage approach to ro- bust tensor completion of visual data," IEEE Trans. Cybern., 2022, doi:10.1109/TCYB.2022.3198932. [45] R. He, T. Tan, and L. Wang, "Robust recovery of corrupted low-rank matrix by implicit regularizers," IEEE Trans. Pattern Anal. Mach. Intell., vol. 36, no. 4, pp. 770–783, Apr. 2014. [46] R. He, Y. Zhang, Z. Sun, and Q. Yin, "Robust subspace clustering with complex noise," IEEE Trans. Image Process., vol. 24, no. 11, pp. 4001–4013, Nov. 2015. [23] F. Nie, Z. Hu, and X. Li, "Matrix completion based on non-convex low- rank approximation," IEEE Trans. Image Process., vol. 28, no. 5, pp. 2378–2388, May 2019. [47] P. Combettes and V. Wajs, "Signal recovery by proximal forward- backward splitting," SIAM J. Multiscale Model. Simul., vol. 4, pp. 1168–1200, 2005. [24] E. Cand`es, M. B. Wakin, and S. P. Boyd, "Enhancing sparsity by reweighted l1 minimization," J. Fourier Anal. Appl., vol. 14, nos. 5–6, pp. 877–905, 2008. [48] H. H. Bauschke and P. L. Combettes, Convex Analysis and Monotone Operator Theory in Hilbert Spaces. New York, NY, USA: Springer, 2011. 13 [49] W. Liu, P. P. Pokharel, and J. C. Principe, "Correntropy: Properties and applications in non-Gaussian signal processing," IEEE Trans. Signal Process., vol. 55, no. 11, pp. 5286–5298, Nov. 2007. [50] S. Boyd and L. Vandenberghe, Convex Optimization. Cambridge Univ. Press, 2004. [51] R. T. Rockafellar and R. J. B. Wets, Variational Analysis, 2nd ed. Berlin, Germany: Springer, 2004. [52] R. G. Bartle and D. R. Sherbert, Introduction to Real Analysis, 4th ed. Hoboken, NJ, USA: Wiley, 2011. [53] X. P. Li, Z.-Y. Wang, Z.-L. Shi, H. C. So and N. D. Sidiropoulos, "Robust tensor completion via capped Frobenius norm," in IEEE Trans. Neural Netw. Learn. Syst., doi: 10.1109/TNNLS.2023.3236415. [54] F. Yasuma, T. Mitsunaga, D. Iso, and S. K. Nayar, "Generalized assorted pixel camera: Postcapture control of resolution, dynamic range, and spectrum," IEEE Trans. Image Process., vol. 19, no. 9, pp. 2241–2253, Sep. 2010. [55] R. Dian, S. Li, A. Guo, and L. Fang, "Deep hyperspectral image sharpening," IEEE Trans. Neural Netw. Learn. Syst., vol. 29, no. 11, pp. 5345–5355, Nov. 2018.
http://arxiv.org/abs/2310.08601v1
"2023-10-07T09:35:59"
"2023-10-07T09:35:59"
Unit Commitment Predictor With a Performance Guarantee: A Support Vector Machine Classifier
The system operators usually need to solve large-scale unit commitment problems within limited time frame for computation. This paper provides a pragmatic solution, showing how by learning and predicting the on/off commitment decisions of conventional units, there is a potential for system operators to warm start their solver and speed up their computation significantly. For the prediction, we train linear and kernelized support vector machine classifiers, providing an out-of-sample performance guarantee if properly regularized, converting to distributionally robust classifiers. For the unit commitment problem, we solve a mixed-integer second-order cone problem. Our results based on the IEEE 6-bus and 118-bus test systems show that the kernelized SVM with proper regularization outperforms other classifiers, reducing the computational time by a factor of 1.7. In addition, if there is a tight computational limit, while the unit commitment problem without warm start is far away from the optimal solution, its warmly started version can be solved to optimality within the time limit.
[ "Farzaneh Pourahmadi", "Jalal Kazempour" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.08601v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.08601v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "math.OC", "@scheme": "http://arxiv.org/schemas/atom" }
[ "math.OC", "cs.LG", "stat.AP" ]
1 Unit Commitment Predictor With a Performance Guarantee: A Support Vector Machine Classifier Farzaneh Pourahmadi, Member, IEEE and Jalal Kazempour, Senior Member, IEEE 3 2 0 2 t c O 7 ] C O . h t a m [ 1 v 1 0 6 8 0 . 0 1 3 2 : v i X r a Abstract-The system operators usually need to solve large- scale unit commitment problems within limited time frame for computation. This paper provides a pragmatic solution, showing how by learning and predicting the on/off commitment decisions of conventional units, there is a potential for system operators to warm start their solver and speed up their computation significantly. For the prediction, we train linear and kernelized support vector machine classifiers, providing an out-of-sample performance guarantee if properly regularized, converting to dis- tributionally robust classifiers. For the unit commitment problem, we solve a mixed-integer second-order cone problem. Our results based on the IEEE 6-bus and 118-bus test systems show that the kernelized SVM with proper regularization outperforms other classifiers, reducing the computational time by a factor of 1.7. In addition, if there is a tight computational limit, while the unit commitment problem without warm start is far away from the optimal solution, its warmly started version can be solved to optimality within the time limit. Index Terms-Unit commitment, support vector machine, Gaussian kernel function, conic programming, warm start. I. INTRODUCTION Power system operators solve the unit commitment (UC) problem on a daily basis in a forward stage, usually a day in advance, to determine the on/off commitment of conventional generating units [1]. They may also update the solution whenever new information, e.g., updated demand or renew- able production forecasts, is available [2]. Despite all recent progress in developing advanced mixed-integer optimization solvers, solving the UC problem for large systems in practice can still be a computationally difficult task. It is even getting more complex with more stochastic renewable units integrated into the system, as the operator may need to reschedule the commitment of conventional units more often than before, requiring to (re-)solve the UC problem at faster paces, likely resulting in a solution with an unsatisfactory optimality gap due to limited time window available for computation tasks. For example, the Nord Pool collects bids every day until noon and should disseminate market outcomes not later than 2pm, giving a maximum time window of two hours for computation tasks. Although the European markets such as Nord Pool do not solve a UC problem as it is common in the U.S. market, they still solve a mixed-integer optimization problem due to the presence of block orders. Here, we focus on the UC problem, although our discussion on the computational complexity is also valid to the European markets. The system and market operators usually implement various simplifications and approximations for grid modeling, whose The work of F. Pourahmadi was supported in part by the Independent Research Fund Denmark (DFF) under Grant 2102-00122B. F. Pourahmadi and J. Kazempour are with the Department of Wind and Energy Systems, Technical University of Denmark, Kgs. Lyngby 2800, Denmark (e- mails: {farpour, jalal}@dtu.dk). implications have been extensively studied over the past 50 years [3]–[11]. However, existing approaches could still be computationally challenging for real large-scale systems. A. Machine learning as a solution: Literature review A key that may give the system and market operators an advantage is that they solve the UC problem every day, and therefore they usually have access to an extensive historical database of UC solutions under various operational circum- stances. This may enable the operators to speed up the com- putation process by learning from previous solutions. With the recent advances in the field of machine learning, it is promising to learn from previous data to ease the computational burden. Exploiting machine learning techniques to accelerate the rate at which mixed-integer convex optimization problems are solved is a relatively new research field [12], particularly in the context of power systems. We have identified three strands in literature that use machine learning techniques for power system optimization. The first strand aims to develop so-called surrogate or optimization proxies, for which an estimator function is used to learn a direct mapping between contextual information, i.e., features such as the forecast of demand and renewable production, and the optimal operational schedules [13], [14]. The second strand develops so-called indirect models, in which an estimator function maps features to some information to reduce the optimization problem dimension. This informa- tion could be the prediction of binding (active) constraints and/or the value of some decision variables such as binary vari- ables. This reduces the complexity of the original optimization problem in terms of the number of constraints and/or binary variables by eliminating inactive constraints and/or setting binary variables to predicted values [15]–[18]. The main drawback of the first two strands is that they may fail to correctly predict the optimal solution. One of the main causes of this shortcoming is that they are unable to use pre-existing mathematical form of the optimization problem as they completely replace existing optimization models by machine learning proxies. Although in the second strand, a (reduced) optimization problem is solved to find a solution, a feasibility and optimality guarantee might be still missing. The third strand develops an estimator function, predicting the value of some variables as a starting point called a warm start to speed up the solution process of non-linear or mixed-integer problems [19]–[21]. The main advantage of this technique is that, depending on the type of the underlying optimization problem, the feasibility and likely optimality of the solution can still be guaranteed, while the problem is being solved faster. Nevertheless, the disadvantage is that there might be cases under which a warm start not only brings no significant computational benefit but may also lead to an increase in computational time. Among others, this may happen if the warm start suggests an initial solution which is infeasible or far from the optimal point. Therefore, reducing the solution time depends on the accuracy of warm start. B. Our contributions and outline This paper falls into the third strand which is based on warm starting. Our goal is to predict the value of binary variables, i.e., the commitment of conventional units (on/off), and use them for warm starting the integer program. We answer the following three questions: How can a training dataset be built from historical UC solutions to effectively improve the warm start performance, while providing a performance guarantee? How to enhance the generalization and adaptability of learning in the case of unseen data? Lastly, we answer what the potential cost saving is through improving the computational efficiency. To address these questions, we develop a UC predictor, which is a tool, comprising of data collection, learning for classification, prediction and eventually decision making with a reduced computational time. To the best of our knowledge, this is the first UC predictor in the literature that efficiently generates a training dataset and is equipped with a regularized non-linear classification approach, resulting in a distribution- ally robust classifier. This predictor provides an out-of-sample performance guarantee in terms of prediction error. The rest of this paper is structured as follows: Section II provides an overview for the proposed three-step framework. Section III describes the data collection step. Section IV presents the learning by the classification step. Section V explains the prediction and decision making step. Section VI provides numerical results based on two case studies, including the IEEE 6-bus and 118-bus test systems. Section VII concludes the paper. Finally, an appendix provides the UC formulation. II. OVERVIEW OF THE PROPOSED UC PREDICTOR The proposed UC predictor is a tool with a three-step process, including (i) data collection, (ii) learning by classifi- cation, and (iii) prediction and decision making. The overall structure of the proposed predictor is illustrated in Fig. 1. Each of these three steps will be explained in detail in the next three sections. However, we provide an overview in the following: The first step efficiently collects data. By data, we mean the pair of features x including hourly demand and wind power forecasts over a day, and their corresponding UC solutions y, the so-called strategies. Each vector of features x results in a vector of strategies y. Each pair (x,y) provides a sample. To accommodate the variability of demand and wind profiles, we solve the UC problem offline multiple times, each time with different values for x. Aiming to include the AC power flow equations while keeping the convexity (needed for keeping the problem tractable with binaries), we use a UC formulation with the conic relaxation of power flow [22], resulting in a mixed-integer second-order cone programming (MISOCP) problem. In order to get a sufficient number of samples (x,y) required for the performance guarantee, we introduce 2 Fig. 1. The overall structure of the proposed UC predictor. an iterative sampling technique to construct a training dataset, ensuring an upper-bound guarantee on the probability of observing a new strategy. i.e., The second step exploits samples (x,y) to train a model for prediction. This model is in fact a set of binary classifiers that provides us with a map function in the form of y " Φpxq. The goal is to learn what the function Φp ̈q is. By such a classifier, when developed, one can predict y, the commitment of every conventional generator, when observing a new x, without solving the UC problem. As mentioned earlier, we will use the predicted y to warm start the UC problem. One can hypothesize that efficient warm starting improves the branch- and-bound process and eventually accelerates the solution of an MISOCP solver. To develop each binary classifier, we use a support vector machine (SVM) technique. The reason for our choice is its convexity and having a continuous Liptchiz loss function, enabling us to tractably reformulate the more advanced versions of the classifier. We start with a linear SVM, and then generalize the classifier by adding a regularization term, ending up modeling the classifier as a distributionally ro- bust optimization, providing us with a rigorous out-of-sample guarantee. We further improve the classifier by developing a kernelized SVM, aiming to avoid underfitting and being capable of learning in high-dimensional feature spaces. The third step uses predicted strategies y. If the underlying strategy is desirable, it is used as a decision for the commit- ment of conventional units - therefore, no need to solve the UC problem. Otherwise, it is used as a warm start to solve the UC problem. By desirability, we refer to the solution feasibility and prediction loss guarantee. If the prediction is not desirable due to infeasibility, we first recover a feasible solution from the sampled strategies to the infeasible one using the K-nearest neighbor approach, and then use it as a warm start to the original UC problem. To evaluate the performance of the proposed predictor, we solve the original and warm-started UC problem while assuming there is a computational time limit, e.g., 15 minutes. If the computational time reaches to the limit, we stop the solver and report the results obtained by then, which might be a sub-optimal solution with a high optimality gap. Our thorough out-of-sample simulations show how crucial it is to improve the accuracy of warm starting. By doing so, there is potential to reduce the system cost by solving the UC problem to (near) optimality within a limited computational time frame. Keep sampling until providing an upper bound guarantee on probability of new strategyData collection (Step I)SVM with an upper bound guarantee on the loss function in expectation∀g,t෥ug,tto be usedfor UCug,t∗to be usedfor UCNoYesUse ෝugtas warm-startNew observation ofload and wind profiles Learning by classification (Step II)Prediction and decision making (Step III)Desirable?Binary feasibility restorationStrategy PredictionOfflineDatabase XStrategies Y(X,Y)At the scheduling time (day-ahead)load and wind profilesug,t∗∈0,1,∀g,t෥ug,t∈0,1,∀g,tClassifiersClassifierUC computation (MISOCP)Warm-started UC computation (MISOCP) III. STEP 1: DATA COLLECTION 1 , qD 1 , pD T , pD 1 , qW T , qW 1 , ..., pW This section explains Step 1 of Fig. 1 (blue part). Suppose we have access to historical forecasts of wind and demand for T =24 hours of a day, so we can build a feature vector in the T s P R4N T , form of x " rpW where N is the number of buses. Vectors pW, qW, pD, and qD refer to active and reactive power production (consumption) of wind farms (demands), respectively. For a given hour t, we define the active power vector pW t " tpW N tu P RN . Vectors qW t are defined similarly. Having access to historical data of H days provides us with H number of vectors x, collected within the set of vectors X " tx1, ..., xh, ..., xH u. t , and qD 1t , ..., pW t , pD T , qD Given every vector x, we solve the UC problem as a MISOCP problem, whose formulation is given in the ap- pendix. This gives us the set of strategy vectors Y " ty1,...,yh,...,yH u. Every strategy vector y is defined as M T s P t0, 1uM T , where M is the number of y " ru ̊ conventional units, and superscript ̊ refers to the optimal value obtained by the state-of-the-art solvers, e.g., Gurobi. By this, we eventually collect the set of samples pX, Yq " tpx1, y1q, ..., pxh, yhq, ..., pxH , yH qu. 11,...,u ̊ To determine the minimum required number of samples H to be used later for classification, we calculate the probability of encountering a novel strategy yH`1, as in the following theorem outlined in [15]: Theorem 1. Given the set of feature vectors X drawn from an unknown discrete distribution and its corresponding set of strategy vectors Y, the probability of coming across a feature vector xH`1 that corresponds to an unobserved strategy vector yH`1 is c PpyH`1 R Yq ď H1 H where H1 is the number of unique strategies that have been 3, and 1 ́ε is the confidence observed only once, τ " 2 2` level of holding (1). 1 H ` τ lnp 3 ε (1) ? ? q, The proof can be directly derived from Theorem 9 of [23]. Considering this theorem, we keep sampling until the bound on the right-hand side of (1) falls below a desired probability guarantee of δ with a given confidence interval of 1 ́ ε. This strategy sampling is detailed in Algorithm 1. Remark: Hereafter, in order to train the classifiers, we convert y " 0 in our samples to y " ́1. Therefore, ygt " ́1 implies that unit g in hour t is off. In contrast, ygt " 1 still means the unit is on. IV. STEP 2: LEARNING BY BINARY CLASSIFICATION i.e., This section describes Step 2 of Fig. 1 (red part). Given the set of samples, pX, Yq " the training dataset, tpx1, y1q, ..., pxh, yhq, ..., pxH , yH qu, this step designs a set of binary classifiers to construct the function Φ : R4N T Ñ t ́1, 1uM T mapping X to Y. As the number of strategies required to satisfy (1) can increase quickly for some problems, the implementation of a multi-class classification method may impose a heavy computational burden. To overcome it, we make a simplification assumption and develop one binary 3 1 H ` τ H lnp 3 Algorithm 1 Strategy sampling Given δ and ε Initialize H " 1 and H1 " 1 b While H1 ε q ą δ a) Sample xh and compute yh b) Update the set of features X Ð X Y txhu c) Update the set of corresponding strategies Y Ð Y Y tyhu d) if yh R Y then H1 " H1 ` 1 e) H " H ` 1 end Return X and Y classifier per each entry of y. This means that for each conventional unit g and time period t, we identify a distinct map function φgt : R4N T Ñ t ́1, 1u. We then gather all of these map functions as Φ " tφ11, ..., φgt, ..., φM T u to predict the on/off commitment status of conventional units g " t1, ..., M u at time periods t " t1, ..., T u. As already discussed in Section II, we use a SVM technique to develop our binary classifier, providing us with the map functions Φ. We start with a linear SVM, generalize it by adding a regularizer to avoid over-fitting, and finally extend it to a high-dimensional feature space as a non-linear classifier, resulting in a kernelized SVM. A. Linear SVM Recall we develop one classifier per conventional unit g per hour t. Hereafter, we focus on developing a linear SVM for unit g in hour t. For notational simplicity, we drop indices g and t. For every sample h " t1, ..., Hu, the vector xh P R4N and the binary value yh P t ́1, 1u are input data for the linear SVM classifier. The goal is to divide H samples into two classes by a hyperplane, maximizing the distance between the hyperplane and the nearest point [24], [25]. For that, we solve a linear problem as min ζhě0,w,b 1 H Hÿ h"1 ζh (2a) s.t. yhpwJxh ` bq ě 1 ́ ζh, @h, where w P R4N and b P R constitute the hyperplane, and ζh P R` is a slack variable. (2b) Once the optimal values for w ̊ and b ̊ are obtained by solving (2), any new feature vector ̃x is classified using the map function φp ̃xq " signpw ̊J ̃x ` b ̊q, (3) where sign(a) =1 if a ą 0, and ́1 if a ă 0. In other words, φp ̃xq predicts ̃y, such that ̃y " 1 means the classifier predicts the unit will be on, and ̃y " ́1 otherwise. B. Reformulating Linear SVM We reformulate (2) to build up the next section accordingly. The optimal solution to the linear problem (2) would be in one of the corner points, such that in the optimal solution it holds ζh " max ́ 0, 1 ́ yhpwJxh ` bq ̄ , @h. (4) Defining the hinge loss function Lpz, z1q " max ̆ 0, 1 ́ , and replacing ζh in (2) with the right hand side of (4), ` zz1 we get min w,b 1 H Hÿ h"1 ` L ̆ yh, pwJxh `bq , (5) which is an unconstrained linear optimization problem, equiv- alent to (2). If we assume the feature vector xh follows a probability distribution ˆPH , (5) can be written as „ ȷ EˆPH min w,b ` L ̆ y, pwJx ` bq . (6) Optimization (6) is an alternative derivation of the linear SVM minimizing the expected risk, where EˆPH r ̈s is the ex- pectation operator with respect to the empirical distribution ˆPH of training dataset with H samples. In the following section, we use (6) to develop a distributionally robust classifier. C. Distributionally robust SVM An assumption is often made in the current literature that the training data follows a certain distribution, which is also the underlying distribution of the test data. This assumption is often violated in practice. When the underlying probability distribution of the training dataset is unknown, it is desirable to develop a distributionally robust classifier, which is robust to the distributional ambiguity. One approach to develop a distributionally robust classifier is based on Wasserstein distributionally robust optimization. Built upon (6), the dis- tributionally robust SVM writes as min w,b max QPBρpˆPH q EQ „ ` L ̆ y, pwJx ` bq ȷ , (7) where BρpˆPH q denotes the set of distributions whose distance to the empirical distribution ˆPH is lower than or equal to the pre-defined value ρ P R. Optimization (7) obtains the worst distribution Q within BρpˆPH q, and optimally classifies samples against it. This distributional robustification helps reduce the risk of misclassification and over-fitting in real- world applications. It has been proven in [26] and [27] that, under certain circumstances, (7) is equivalent to a regularized version of the linear SVM (6). Accordingly, for every ρ ě 0, there exists a value λ P R such that the distributionally robust SVM is analogous to the regularized SVM. As a result, (7) is equivalently rewritten as min w,b 1 H Hÿ h"1 ` L ̆ yh, pwJxh ` bq ` λ∥w∥2 2, (8) where ∥ ̈∥2 is the norm 2 operator. The first term in (8) is the expected hinge loss, whereas the second term is the regularization term to avoid over-fitting. Note that (8) is an unconstrained quadratic programming (QP) problem. The resulting distributionally robust SVM offers an upper- bound guarantee on the expected prediction loss function, commonly referred to as an out-of-sample guarantee. Let us consider a test dataset tp ̃x1, ̃y1q, ..., p ̃xh, ̃yhq, ..., p ̃x ̃H , ̃y ̃H qu of 4 ̃H samples. Assuming the distribution of the test dataset lies in BρpˆPH q, it holds that 1 ̃H ̃Hÿ ` L h"1 ̃yh, pw ̊J ̃xh ` b ̊q ̆ ď Jpλq, (9) where Jpλq is the optimal value of (8). The takeaway is that the distributionally robust SVM (8) is equivalent to the regularized form of the linear SVM (2), i.e., min ζhě0,w,b 1 H Hÿ h"1 ζh ` λ∥w∥2 2 s.t. yhpwJxh ` bq ě 1 ́ ζh, @h. (10a) (10b) The QP problem (10) can be efficiently solved by replacing λ∥w∥2 2 in the objective function by an auxiliary variable ρ and then adding the constraint ρ ě λ∥w∥2 2. By doing so, (10) becomes a second-order cone programming (SOCP) problem with a linear objective function. D. Kernelized SVM By solving either the linear SVM (2) or the distributionally robust SVM (8) or its equivalent regularized SVM (10), we end up in a linear map function φpxq " signpw ̊Jx ` b ̊q. Aiming to a more efficient classification with a higher degree of freedom, it is desirable to obtain a non-linear map function while preserving the convexity of optimization problems. For this purpose, we use the kernel trick to transform data into a higher dimensional space. The rationale is to transform the regularized SVM (10) from the Euclidean space to an infinite-dimensional Hilbert space H, obtaining a linear map function there, and transforming it back to the Euclidean space as a non-linear function [25], [28]. It has been discussed in the literature that it is computationally desirable to transform the dual optimization of (10). This dual optimization in the Euclidean space is ÿ ÿ αh ́ max αh h ÿ 1 2 αkαhykyhxkxh k,h s.t. yhαh " 0 h 0 ď αh ď λ, @h, (11a) (11b) (11c) where h " t1, ..., Hu and k " t1, ..., Hu are indices for samples. In addition, αh is the dual variable corresponding to (10b). This dual SVM is the Hilbert space [29] is written as ÿ ÿ 1 2 max αh αh ́ h k,h s.t. (11b) ́ (11c), αkαhykyhΨpxkqΨpxhq (12a) (12b) where the map Ψ : R4N Ñ H transforms the vectors from the Euclidean to the Hilbert space. The kernel trick states that there are functions f pxk, xhq in the Euclidean space which are equivalent to the dot product ΨpxkqΨpxhq in the Hilbert space. One popular function satisfying such a property is the Gaussian kernel function [30], [31], defined as f pxk, xhq " e ́γ∥xk ́xh∥2 2 , where the parameter γ controls the flexibility degree of the hyperplane (tuned by cross-validation). Now, the kernelized SVM (dual form) in the Euclidean space is written as 5 ÿ αh ́ ÿ αkαhykyhf pxk, xhq (13a) 1 2 max αh h k,h s.t. (11b) ́ (11c). (13b) (14a) Now, we convert (13) back to its primal form: min ζhě0,β Hÿ h"1 1 H Hÿ ζh ` λ∥f 1 2 β∥2 2 s.t. ykf pxk, xhqβk ě 1 ́ ζh, @h, (14b) k"1 where β P RH and f P RHˆH . Similar to (10), optimization (14) is a QP problem, however one can convert to a SOCP problem by moving the quadratic regularizer from the objective function to constraints. it Once (14) is solved and the optimal value for β ̊ is obtained, any new feature vector ̃x is classified using the map function ́ Hÿ φp ̃xq " sign f p ̃x, xhqβ ̊ h h"1 ̄ , (15) where the interpretation is the same as that of (3). E. Distributionally Robust Kernelized SVM The kernelized SVM (14) is equivalent to min β 1 H Hÿ ́ Hÿ ̄ L yh, f pxk, xhqβk ` λ∥f 1 2 β∥2 2. (16) h"1 k"1 Similar to the discussion for (7), it has been proven in [26] and [27] that the kernelized SVM (16) with the regularization term λ∥f 2, under certain conditions, is equivalent to a distributionally robust kernelized classifier as 2 β∥2 1 min β max QPBρpˆPH q EQ Hÿ ́ " L y, f px, xhqβh h"1 ̄ı . (17) Similar to (9), it holds that 1 ̃H ̃Hÿ ́ Hÿ ̄ L ̃yk, f p ̃xk, xhqβ ̊ h ď J 1pλq, (18) k"1 h"1 where J 1pλq is the optimal value of (16). A summary of various binary classifications is given in Table I. TABLE I SUMMARY OF VARIOUS BINARY CLASSIFICATIONS Type of Classification Linear SVM Kernelized SVM Without regularization (2) or (10) with λ " 0 (14) with λ " 0 With regularization (distributionally robust) (10) (14) Fig. 2. The IEEE 6-bus test system with three conventional units G1-G3, two wind farms W1-W2, and three loads L1-L3. V. STEP 3: PREDICTION AND DECISION MAKING This section explains Step 3 of Fig. 1 (green part). The map functions (3) for the linear SVM and (15) for the kernelized SVM enable us to predict the commitment decision ̃y of conventional units, having features ̃x as the input data. To guarantee the prediction performance, we present a confidence level for inaccuracy of predicted ̃y based on the concept of distributionally robust classification. This guarantee provides an upper bound on the prediction loss in expectation, which is already mentioned in (9) and (18). Note that we here consider the hinge loss function to measure the accuracy of prediction. Once ̃y predicted, we check the feasibility and the upper bound guarantee. If the prediction is feasible and the guar- antee is desirable, the prediction is directly adopted as the commitment decision for conventional units. Otherwise, we use ̃y as a warm start to the MISOCP solver built upon a branch-and-bound algorithm. Note that for this, we convert back ̃ygt " ́1 to ̃ygt " 0, indicating the corresponding unit is off. The branch-and-bound algorithm uses the warm start as an initial solution. By that, it uses the warm start as a bound to eliminate parts of the search space that cannot produce a better solution and therefore focus on the rest of search space. This is particularly useful when the MISOCP problem has a large number of variables, and the solution space is vast. We find a trade-off between prediction quality and computational time to determine how much mixed-integer solvers can benefit from utilizing the predicted ̃y as a warm start. As mentioned earlier, predicted ̃y to be used as a warm start might be infeasible for the MISOCP problem. If it is the case, we find a close feasible solution among the sampled strategies to the infeasible one by using the K-nearest neighbor algorithm [32] to recover a feasible solution. Furthermore, in order to guarantee that there is always a feasible solution to the UC problem, we also take corrective measures like load shedding and renewable power curtailment into consideration. VI. EXPERIMENTAL RESULTS We provide two case studies based on the IEEE 6-bus and 118-bus test systems. We solve the optimization problems in Python using scikit-learn API and in Matlab using the YALMIP toolbox with Gurobi solver 8.1.1 on a 16 GB RAM personal computer clocking at 3.1 GHZ. All source codes are publicly available in [33]. 6 Training Linear SVM Training Kernelized SVM Testing Linear SVM Testing Kernelized SVM (1) (5) (2) (6) (3) (7) (4) (8) (9) (10) (11) (12) Fig. 3. The number of missclassified samples and CPU time for SVM classifiers using 50, 500, and 5, 000 training samples and 1, 000 test samples. A. IEEE 6-bus test system This stylized system includes 3 conventional units, 2 wind farms, and 3 loads, as shown in Fig. 2. The technical data for conventional units and transmission lines is given in [33]. For simplicity in this stylized case, we assume that loads are deterministic and that two wind farms only have stochastic generation. Additionally, we assume an identical shape for daily wind power generation profile across different samples - the only varying factor is their generation level. As such, we end up in two features only, i.e., the production level of two wind farms. Wind and load data is provided in [33]. Training data: We utilize three distinct sets of training data for our analysis, which contain 50, 500, and 5, 000 samples, respectively. Recall for generating each sample px, yq, we solve the MISOCP problem given in the appendix with the feature vector x as the input data, and compute commitments y. Based on Algorithm 1 in Section III, given ε " 0.10, these number of training samples provide a desired probability guarantee of δ " 1, δ " 0.40, and δ " 0.18, respectively. This means that, if one provides further samples beyond 50, 500, and 5, 000 training samples, the maximum probability of observing a new strategy with the confidence level of 90% is 100%, 40%, and 18%, respectively. Having samples px, yq as inputs data, we solve the linear or conic optimization problems for SVM classifiers (see Table I), and obtain map functions (3) for the linear SVM and (15) for the kernelized SVM. Testing data: We use a dataset containing 1, 000 samples in the form of p ̃x, ̃yq, which are different than training samples. We use the map functions (3) and (15) to predict ̃y, to be used either as a commitment decision or to serve for warm starting. Cross-validation for kernel function and regularizer: We have used a cross-validation approach to tune the parameter γ in the Gaussian kernel function. To so do, we split 1, 000 testing samples into 4 equally sized subsets and then training the model on 3 subsets, while validating its performance on the remaining subset. This process is repeated 4 times, with each subset being used as the validation set once, and the other 3 subsets being used for training. The performance metric used is the expected hinge loss of validation instances. Similarly, we regularize both linear and kernelized SVM classifiers by determining a value for λ, obtained by cross-validation too. Classification results: Let us first explore how successful the map functions (3) and (15) are in the prediction of the correct commitments. Fig. 3 shows classification boundaries for the commitment of arbitrarily selected conventional unit G3 in a certain hour. For every plot, the two axes are wind production of two farms (two available features). Based on classification results, it is predicted G3 to be off in the blue area and to be on in the brown area. The blue and brown circles indicate the true commitment, obtained by solving the MISOCP problem in the appendix. If a blue (brown) circle is located in the blue (brown) area, it shows that the prediction is correct, otherwise it is a misclassification. This figure includes 12 plots, where those in the first, second, and third rows correspond to cases where the number of training samples is 50, 500, and 5, 000, respectively. The plots in the first two columns pertain to the training stage, where those plots in the third and fourth columns show the testing results with 1, 000 samples. Under each plot, the number of misclassified samples and the corresponding computational time (in the training stage) are reported. One main observation is that the kernelized SVM outper- forms the linear one in terms of the number of misclassified samples in both training and testing stages. For example, in the case with 500 training samples, the kernelized SVM in the training stage (plot 6) has only 3 out of 500 samples is 41 for the linear SVM wrongly classified, whereas it (plot 5). Similarly, in the testing stage, the kernelized SVM misclassified 28 out of 1, 000 samples (plot 8), while it is 96 samples for the linear SVM (plot 7). There is a similar observation in the case with 5, 000 training samples, i.e., plots 9-12. This has been expected as the kernelized SVM offers a higher degree of freedom when determining a map function, resulting in nonlinear boundaries between blue and brown areas. The interesting point is that the computational time for training the kernelized SVM is lower than the linear one, making it even a more appealing choice. Another interesting observation is that by increasing the number of training samples from 500 to 5, 000, the kernelized SVM exhibits a more successful performance in the testing stage (reduced misclassified samples from 28 in plot 8 to 14 in plot 12). However, it is not the case for the linear SVM (see plots 7 and 11). Bias analysis and performance guarantee: We first start with a bias analysis in terms of the similarity of training and test datasets. We keep the previous training dataset with 5, 000 samples. However, we generate two different test datasets, each with 1, 000 samples, one is more similar to the training dataset, while the other one is less similar. We use the 2- Wasserstein metric to measure the distance of training and test datasets. The similar test dataset, so called biased test dataset, has a distance of 0.05 to the training samples. In contrast, the other one, so called unbiased test dataset, has a comparatively higher distance of 0.20. We then exploit the kernelized SVM classifier (14) including a regularization term. For all three conventional units over 24 hours, Fig. 4 reports the optimal value of the expected hinge loss of the kernelized SVM classifier in both training and testing stages. For the training dataset, recall that the expected hinge loss is equal to (16) in the optimal point, whereas for the test datasets, it is computed as the left-hand side of (18). Owed to the regularization weight λ carefully tuned by cross validation, the expected hinge loss in the unbiased test dataset is lower than that in the biased one, which is desirable. In addition, the expected hinge loss in both biased and unbiased test datasets is lower than that of the training dataset, validating the performance guarantee (18) is obtained. B. IEEE 118-bus test system We apply the proposed UC predictor to the IEEE 118-bus test system, including 19 conventional units, 2 wind farms, 7 Fig. 4. The expected hinge loss of the kernelized SVM classifier, for every unit and hour, in the training and testing stages (with biased and unbiased test data). 91 loads, and 186 transmission lines. Our main focus is on the potential improvement in the computational performance. Furthermore, we investigate the potential cost saving by im- proving the optimality gap. Data preparation: We use a dataset comprising of 5, 000 samples for training and 1, 000 samples for testing. The features that we consider here include the power generation of wind farms as well as the load in all buses over 24 hours. Therefore, each classifier for unit g and hour t has access to 93 features. Note that we assume all loads and wind farms adhere to a fixed power factor. Additionally, we assume an identical daily load and wind power generation profile across various samples. Times series for daily load and wind power generation are given in [33]. For each sample, we solve the including 2, 592 binary MISOCP problem (see appendix), variables, 13, 920 continuous variables, and 55, 464 linear and conic constraints. With a confidence level of 1 ́ ε " 0.90, Algorithm 1 in Section III validates a probability guarantee of δ " 0.12 to observe a new strategy. This means, with the confidence level of 90%, there is a maximum probability of 12% to observe a new strategy if further training samples are provided. Similar to the previous case study, we tune the parameters for regularization and Gaussian kernel function using a cross-validation approach with 4 equally sized subsets. Implementation: We train a classifier for every unit and hour. If the predicted strategy ̃y is desirable, we can directly use it to determine the commitment of conventional units, but we must still verify that the minimum up- and down-time requirements are satisfied. Otherwise, if the predicted strategy ̃y is not desirable, we leverage it as a warm start for the Gurobi solver and explore whether it speeds up the computational time to solve the UC problem, i.e., the MISOCP problem in the appendix. If ̃y is not binary feasible, we use the K- nearest neighbor technique to find a feasible strategy that is as close as possible to the predicted strategy. The K-nearest 123456789101112131415161718192021222324Time periodG1G2G30.10.20.30.4123456789101112131415161718192021222324Time periodG1G2G30.10.20.30.4123456789101112131415161718192021222324Time periodG1G2G30.10.20.30.4Training datasetUnbiased test datasetBiased test dataset 8 Fig. 5. Out-of-sample performance: Average system cost and average computational time for solving the UC problem, solved by the MISOCP solver without (bar 1) or with warm start (bars 2-5). If warmly started, it is initiated by the prediction of classifiers. The right plot enforces a computational time limit of 700 seconds, and shows the system cost obtained in such a limited period. The left plot shows the computational time when no limit is enforced. we train four different classifiers, namely the linear SVM (with and without regularization) and the kernelized SVM (with and without regularization). We then compare the UC results with and without using warm starts - in the case of warm start, the classifiers provide the initial solution. In the following, with or without warm start, we solve the UC problem 1, 000 times (each time with a different test dataset), and report the average out-of-sample system cost and the average computational time. By the out-of-sample system cost, we refer to the total generation and start-up cost of the system, as formulated in the objective function (19a) of the UC problem in the appendix. The right plot of Fig. 5 answers the first question under scenario I, where the computational time limit of 700 seconds has been enforced. This implies when the computational time has reached to this limit, we stopped the solver, and reported the system cost. One can expect that this cost is significantly high if the solver has not managed to find a solution with a low optimality gap in the limited computational period. The right plot of Fig. 5 shows that the warmly started MISOCP problem initiated by the predictions of the kernelized SVM with regularization (last bar) has been solved effectively, resulting in the lowest system cost on average. On the contrary, the MISOCP solver without warm start (first bar) is very slow, such that it could not solve the UC problem effectively in 700 seconds, yielding a high optimality gap, and thereby a significant system cost. The MISOCP solver warmly started by the predictions of other classifiers exhibits a performance in between. In general, this plot concludes that the kernelized SVM provides more effective warm starts than the linear one. The left plot of Fig. 5 answers the second question, under scenario II where there is no computational time limit. The MISOCP solver has obtained the same UC solution irrespec- tive of warm or cold start. However, the computational time is significantly higher without warm start. The kernelized SVM with regularization is again the best choice for predicting an effective warm start, reducing the computational time by an average factor of 1.7, compared to a case with no warm start. We now evaluate the out-of-sample system cost if we trust in predicted strategies ̃y and directly use them as commitment decisions of conventional units. We fix the binary variables in Fig. 6. The median and the 25th and 75th percentiles of the out-of-sample system cost obtained by solving the UC problem. First bar: UC problem with fixed predictions (binary variables) resulting in a second-order cone programming (SOCP) problem. Second and third bars: UC problem as a MISOCP problem with and without warm start. neighbor technique searches among the strategies sampled for the training dataset. The distance between strategies can be measured as ∥py ́ ̃y∥, where ̃y is the predicted strategy and py is the closest feasible strategy, respectively. Evaluation: In the setting that we use the prediction as a warm start to the MISOCP problem, it is likely to end up in a sub-optimal prediction, but it may still help reduce the computational time. Hereafter, we acknowledge a UC prediction to be effective if it enhances the computational performance of the UC solver. Therefore, our measurement for the prediction effectiveness is to what extent it reduces the computational time. In the following, we examine two scenarios: in Scenario I, the system operator has a limit for the computational time which cannot be exceeded. This implies that the UC problem may not be solved to optimality if the computational time reaches to its limit. In Scenario II, there is not such a limit, and therefore the UC problem can be solved to optimality. Now, we answer two questions: (i) What is the least possible difference between the optimal strategies y ̊ and the predicted ones ̃y under Scenario I (with time limit)? (ii) How quickly can we obtain the optimal strategies y ̊ under Scenario II (no time limit) with warm starting? To answer these two questions, MISOCPLinear SVMLinear SVM+RegularizationKernelized SVMKernelized SVM+Regularization10410510610710810910101011Cost ($)050010001500200025003000Time (s)050010001500200025003000Time (s)MISOCPLinear SVMLinear SVM +RegularizationKernelized SVMKernelized SVM +Regularization10410510610710810910101011Cost ($)SOCPWarm-started MISOCPMISOCP0123456Cost ($)105 the UC problem to those predictions, resulting in a SOCP problem. Fig. 6 shows the median and the 25th and 75th percentiles of the out-of-sample system cost when we solve the SOCP problem with fixed binary variables, and compares it to those results of MISOCP without or with warm start (by the kernelized SVM with regularization). It has been observed that the system cost when fixing binary variables is 5% higher than that of the MISOCP problem, but it is 4.5 times faster in terms of computational time than the MISOCP problem without warm start, and 2.4 times faster than the same problem with warm start. VII. CONCLUSION This paper showed that, if the system operators have re- stricted by computational time limits to solve the UC problem, there is a high potential to use SVM-based classification meth- ods to predict commitment decisions of conventional units. As a pragmatic solution, these predictions can be used as a warm start to considerably speed up the mixed-integer optimization solvers, without compromising the optimality. We showed that it is possible to properly regularize the SVM classifiers in a way that it provides an out-of-sample performance guarantee. In addition, this paper discussed how many training samples are needed to get an insight into the probability of having unseen strategies. This paper concluded that the kernelized SVM with a proper regularization (tuned by cross validation) outperforms the linear SVM, and can help the system operators to ease their computational burden. This paper has developed one classifier per conventional unit per hour. This overlooks the potential spatio-temporal corre- lations, which could be very useful information when training the classifiers. It is of interest to develop such correlation- aware classifiers, exploring to what extent it may provide more effective predictions (e.g., for warm start) and helps to further reduce the computational time. Another future direction is to explore the performance of classifiers in non-stationary environments, where one may not learn much for old data. APPENDIX: MISOCP FORMULATION FOR UC PROBLEM Notation: We consider a power grid consisting of N buses, L transmission lines, and M conventional units. For every hour t, the set of continuous variables contains active power gt, ..., pG generation of conventional units pG M tu P RM , reactive power generation of conventional units qG t " M tu P RM , nodal voltage magnitudes νt " tqG tν1t, ..., νit, ..., νN tu P RN , nodal voltage angles θt " tθ1t, ..., θit, ..., θN tu P RN , and apparent power flow of transmission lines st " ts1t, ..., slt, ..., sLtu P RL. In addition, the set of binary variables includes on/off commitment of conventional units ut " tu1t, ..., ugt, ..., uM tu P t0, 1uM and their start-up status vt " tv1t, ..., vgt, ..., vM tu P t0, 1uM . 1t, ..., pG gt, ..., qG 1t, ..., qG t " tpG g and qg{q We now define parameters. For each conventional unit g, parameters pg{p indicate the maximum/minimum g active and reactive power generation limits, respectively. Pa- rameters rg{rg denote the maximum ramp-up and ramp- down capabilities, whereas ̃rg gives the ramp-rate capability in start-up and shut-down hours. Parameter vg gives the minimum up- and down-time, respectively. In addition, cP " 9 g , ..., cS 1 , ..., cS g , ..., cP 1 , ..., cP M u P RM and cS " tcS tcP M u P RM give the production and start-up costs of conventional units, respectively. For each transmission line l connecting bus i to bus j, Gij and Bij denote the real and imag- inary parts of the bus admittance matrix, respectively. In addition, Bsh represents the reactive shunt element, con- ij sidering a π-model transmission lines. The apparent power capacity of line l is given by sl. For each bus i, νi{νi gives the maximum/minimum voltage magnitude. Pa- rameters pW t " N tu P RN denote active and reactive 1t , ..., qW tqW power generation of wind farms, respectively. Finally, pD t " tpD it , ..., qD N tu P RN represent nodal active and reactive power consumptions, respectively. N tu P RN and qW N tu P RN and qD t " tpW it , ..., qW it , ..., pW 1t , ..., pW t " tqD 1t, ..., pD 1t, ..., qD it, ..., pD for The original AC unit commitment problem reads as t pcP qJ ` vtpcSqJ pG (19a) ÿ min p,q,u,v,ν,θ t ́ugpt ́1q `ugt ́ ugτ ď 0, @τ P tt, ...,vg ` t ́1u, @g, t (19b) ugpt ́1q ́ ugt ` ugτ ď 1, @τ P tt, ...,vg ` t ́1u, @g, t (19c) ́ ugpt ́1q ` ugt ́ vgt ď 0, @g, t ugtp (19d) (19e) g ď pG g ď qG gt ď pgugt, @g, t gt ď qgugt, @g, t gpt ́1q ď rgugpt ́1q ` ̃rgp1 ́ ugpt ́1qq, @g, t (19f) (19g) (19h) gt ď rgugt ` ̃rgp1 ́ ugtq, @g, t it ́ pD νitνjt it " Giiν2 it ` ÿ Gij cospθit ́θjtq`Bij sinpθit ́θjtq , @i, t (19i) it ́ qD it " ́Biiν2 it ` jPΛpiq ̄ ÿ νitνjt jPΛpiq ̄ Gij sinpθit ́θjtq ́Bij cospθit ́θjtq , @i, t (19j) ugtq pG gt ́ pG gpt ́1q ́ pG pG ÿ gt ` pW pG ́ gPΓpiq ÿ gt ` qW qG ́ gPΓpiq ́ s2 lt " ́ Gijν2 it `Gijνitνjt cospθit ́θjtq ̄ 2 ` ́ pBij ́ Bsh ij qν2 it `Bijνitνjt sinpθit ́θjtq ̄ 2 , ́Bijνitνjt cospθit ́θjtq`Gijνitνjt sinpθit ́θjtq l , @l P pi, jq, t lt ď s2 s2 νi ď νit ď νi, @i, t θref,t " 0, @t ut, vt P t0, 1u, @t. @l P pi, jq, t (19k) (19l) (19m) (19n) (19o) The objective function (19a) minimizes the total production and start-up costs of conventional units. Constraints (19b)- (19c) restrict the minimum up- and down-time, whereas (19d) determines the state transition of conventional units. Capacity and ramping limits of conventional units are enforced by (19e)-(19h). Constraints (19i)-(19j) represent the nodal active and reactive power balance, where Γpiq and Λpiq denote the set of conventional units connected to bus i and the set of adjacent buses to i, respectively. Constraint (19k) determines the apparent power flow in line pi, jq, constrained by (19l). Constraint (19m) limits the voltage magnitudes. Constraint (19n) sets voltage angle of the reference bus to zero. Finally, (19o) declares the binary variables. This AC unit commitment includes non-convex constraints (19i)-(19k), as they are quadratic equality constraints. For the convexification of those constraints, the current literature [34] suggests defining new variables for each bus i as wit " ν2 it and for each line pi, jq as eijt " νitνjt cospθit ́ θjtq and fijt " ́νitνjt sinpθit ́ θjtq. This lets replace (19i)-(19l) by ÿ gt `pW pG it ́pD it " gPΓpiq ÿ Giiνit ` pGijeijt ́Bijfijtq, @i,t (20a) ́ Biiνit ́ pBijeijt`Gijfijtq, @i,t (20b) ̄ 2 ̄ ́ pBij ́Bsh ` ij qνit 2 ď s2 l , @l P pi, jq,t ÿ gt `qW qG it ́qD it " gPΓpiq ́ jPΛpiq ÿ jPΛpiq ́ Gijνit `Gijeijt ́Bijfijt ́Bijeijt ́Gijfijt 0 " e2 ijt ` f 2 ijt ́ νitνjt, @i, j, t 0 " θjt ́ θit ́ atanp fijt eijt q, @i, j, t v2 i ď νit ď v2 ́ vivj ď eijt, fijt ď vivj, @i, j, t. i , @i, t (20c) (20d) (20e) (20f) (20g) Now, the original formulation converts to (19a)-(19h), (19m)-(19o), (20a)-(20g), which is still non-convex. However, it can be relaxed to a mixed-integer second-order cone opti- mization by omitting (20e) and relaxing (20d) as ijt ` f 2 e2 ijt ď νitνjt, @i, j, t. (21) The resulting MISOCP problem is (19a)-(19h), (19m)- (19o), (20a)-(20c), (20f)-(20g) and (21), which is used to solve the UC problem in this paper. ACKNOWLEDGMENT We would like to thank Thomas Falconer (DTU) for reading the manuscript and providing constructive feedback. REFERENCES [1] M. F. Anjos and A. J. Conejo, "Unit commitment in electric energy systems," Foundations and Trends® in Electric Energy Systems, vol. 1, no. 4, pp. 220–310, 2017. [2] B. F. Hobbs, M. H. Rothkopf, R. P. O'Neill, and H.-p. Chao, The next generation of electric power unit commitment models. Springer Science & Business Media, 2006, vol. 36. [3] A. Castillo, C. Laird, C. A. Silva-Monroy, J.-P. Watson, and R. P. O'Neill, "The unit commitment problem with AC optimal power flow constraints," IEEE Trans. Power Syst., vol. 31, no. 6, pp. 4853–4866, 2016. [4] D. A. Tejada-Arango, P. Sánchez-Martın, and A. Ramos, "Security constrained unit commitment using line outage distribution factors," IEEE Trans. Power Syst., vol. 33, no. 1, pp. 329–337, 2017. [5] C. Coffrin and P. Van Hentenryck, "A linear-programming approxima- tion of AC power flows," INFORMS J. Comput., vol. 26, no. 4, pp. 718–734, 2014. [6] R. Madani, M. Ashraphijuo, and J. Lavaei, "Promises of conic relaxation for contingency-constrained optimal power flow problem," IEEE Trans. Power Syst., vol. 31, no. 2, pp. 1297–1307, 2015. 10 [7] C. Coffrin, H. L. Hijazi, and P. Van Hentenryck, "Strengthening the SDP relaxation of AC power flows with convex envelopes, bound tightening, and valid inequalities," IEEE Trans. Power Syst., vol. 32, no. 5, pp. 3549–3558, 2016. [8] S. Atakan, G. Lulli, and S. Sen, "A state transition MIP formulation for the unit commitment problem," IEEE Trans. Power Syst., vol. 33, no. 1, pp. 736–748, 2017. [9] G. Morales-España, J. M. Latorre, and A. Ramos, "Tight and compact milp formulation for the thermal unit commitment problem," IEEE Trans. Power Syst., vol. 28, no. 4, pp. 4897–4908, 2013. [10] J. Ostrowski, M. F. Anjos, and A. Vannelli, "Tight mixed integer linear programming formulations for the unit commitment problem," IEEE Trans. Power Syst., vol. 27, no. 1, pp. 39–46, 2011. [11] D. Rajan and S. Takriti, "Minimum up/down polytopes of the unit commitment problem with start-up costs," IBM Res. Rep, vol. 23628, pp. 1–14, 2005. [12] D. Bertsimas and C. W. Kim, "A prescriptive machine learning approach to mixed-integer convex optimization," INFORMS J. Comput., 2023, to be published. [13] F. Fioretto, T. W. Mak, and P. Van Hentenryck, "Predicting AC optimal power flows: Combining deep learning and Lagrangian dual methods," in Proceedings of the AAAI Conference on Artificial Intelligence, vol. 34, 2020, pp. 630–637. [14] W. Chen, S. Park, M. Tanneau, and P. Van Hentenryck, "Learning optimization proxies for large-scale security-constrained economic dis- patch," Electr. Power Syst. Res., vol. 213, p. 108566, 2022. [15] D. Bertsimas and B. Stellato, "Online mixed-integer optimization in milliseconds," INFORMS J. Comput., vol. 34, no. 4, p. 2229–2248, 2022. [16] L. Roald and D. Molzahn, "Implied constraint satisfaction in power system optimization: The impacts of load variations," in Annual Allerton Conference on Communication, Control, and Computing (Allerton). IEEE, 2019, pp. 308–315. [17] D. Deka and S. Misra, "Learning for DC-OPF: Classifying active sets using neural nets," in IEEE Milan PowerTech, 2019, pp. 1–6. [18] S. Misra, L. Roald, and Y. Ng, "Learning for constrained optimiza- tion: Identifying optimal active constraint sets," INFORMS J. Comput., vol. 34, no. 1, pp. 463–480, 2022. [19] Á. S. Xavier, F. Qiu, and S. Ahmed, "Learning to solve large-scale security-constrained unit commitment problems," INFORMS J. Comput., vol. 33, no. 2, pp. 739–756, 2021. [20] K. Baker, "Learning warm-start points for AC optimal power flow," in IEEE 29th International Workshop on Machine Learning for Signal Processing (MLSP). IEEE, 2019, pp. 1–6. [21] T. Falconer and L. Mones, "Leveraging power grid topology in machine learning assisted optimal power flow," IEEE Trans. Power Syst., vol. 38, no. 3, pp. 2234–2246, 2023. [22] F. Zohrizadeh, C. Josz, M. Jin, R. Madani, J. Lavaei, and S. Sojoudi, "A survey on conic relaxations of optimal power flow problem," Eur. J. Oper. Res., vol. 287, no. 2, pp. 391–409, 2020. [23] D. A. McAllester and R. E. Schapire, "On the convergence rate of good- turing estimators." in COLT, 2000, pp. 1–6. [24] E. Alpaydin, Introduction to machine learning. MIT press, 2020. [25] T. Hastie, R. Tibshirani, J. H. Friedman, and J. H. Friedman, The elements of statistical learning: data mining, inference, and prediction. Springer, 2009, vol. 2. [26] S. Shafieezadeh-Abadeh, D. Kuhn, and P. M. Esfahani, "Regularization via mass transportation," Journal of Machine Learning Research, vol. 20, no. 103, pp. 1–68, 2019. [27] D. Kuhn, P. M. Esfahani, V. A. Nguyen, and S. Shafieezadeh-Abadeh, "Wasserstein distributionally robust optimization: Theory and applica- tions in machine learning," in Operations Research & Management Science in the Age of Analytics, 2019, pp. 130–166. [28] C. M. Bishop and N. M. Nasrabadi, Pattern recognition and machine learning. Springer, 2006, vol. 4, no. 4. [29] V. N. Vapnik, The nature of statistical learning theory. Springer, 1999. [30] K.-R. Muller, S. Mika, G. Ratsch, K. Tsuda, and B. Scholkopf, "An introduction to kernel-based learning algorithms," IEEE Transactions on Neural Networks, vol. 12, no. 2, pp. 181–201, 2001. [31] S. S. Keerthi and C.-J. Lin, "Asymptotic behaviors of support vector machines with Gaussian kernel," Neural Computation, vol. 15, no. 7, pp. 1667–1689, 2003. [32] T. Cover and P. Hart, "Nearest neighbor pattern classification," IEEE Transactions on Information Theory, vol. 13, no. 1, pp. 21–27, 1967. [33] [Online]. Available: https://github.com/farzanehpourahmadi/UCP.git [34] R. A. Jabr, "A conic quadratic format for the load flow equations of meshed networks," IEEE Trans. Power Syst., vol. 22, no. 4, pp. 2285– 2286, 2007.
http://arxiv.org/abs/2310.04753v1
"2023-10-07T09:18:33"
"2023-10-07T09:18:33"
A New Dataset for End-to-End Sign Language Translation: The Greek Elementary School Dataset
Automatic Sign Language Translation (SLT) is a research avenue of great societal impact. End-to-End SLT facilitates the interaction of Hard-of-Hearing (HoH) with hearing people, thus improving their social life and opportunities for participation in social life. However, research within this frame of reference is still in its infancy, and current resources are particularly limited. Existing SLT methods are either of low translation ability or are trained and evaluated on datasets of restricted vocabulary and questionable real-world value. A characteristic example is Phoenix2014T benchmark dataset, which only covers weather forecasts in German Sign Language. To address this shortage of resources, we introduce a newly constructed collection of 29653 Greek Sign Language video-translation pairs which is based on the official syllabus of Greek Elementary School. Our dataset covers a wide range of subjects. We use this novel dataset to train recent state-of-the-art Transformer-based methods widely used in SLT research. Our results demonstrate the potential of our introduced dataset to advance SLT research by offering a favourable balance between usability and real-world value.
[ "Andreas Voskou", "Konstantinos P. Panousis", "Harris Partaourides", "Kyriakos Tolias", "Sotirios Chatzis" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04753v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04753v1", "@rel": "related", "@type": "application/pdf" } ]
[ "Proceedings of the IEEE/CVF International Conference on Computer\n Vision. 2023. p. 1966-1975" ]
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CL", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CL", "cs.CV", "cs.LG" ]
3 2 0 2 t c O 7 ] L C . s c [ 1 v 3 5 7 4 0 . 0 1 3 2 : v i X r a A New Dataset for End-to-End Sign Language Translation: The Greek Elementary School Dataset Andreas Voskou* 1, Konstantinos P. Panousis1, Harris Partaourides2, Kyriakos Tolias1, and Sotirios Chatzis1 1Cyprus University of Technology, 2AI Cyprus Ethical Novelties Ltd Abstract Automatic Sign Language Translation (SLT) is a re- search avenue of great societal impact. End-to-End SLT facilitates the interaction of Hard-of-Hearing (HoH) with hearing people, thus improving their social life and op- portunities for participation in social life. However, re- search within this frame of reference is still in its infancy, and current resources are particularly limited. Existing SLT methods are either of low translation ability or are trained and evaluated on datasets of restricted vocabulary and questionable real-world value. A characteristic exam- ple is Phoenix2014T benchmark dataset, which only cov- ers weather forecasts in German Sign Language. To ad- dress this shortage of resources, we introduce a newly con- structed collection of 29653 Greek Sign Language video- translation pairs which is based on the official syllabus of Greek Elementary School. Our dataset covers a wide range of subjects. We use this novel dataset to train recent state- of-the-art Transformer-based methods widely used in SLT research. Our results demonstrate the potential of our in- troduced dataset to advance SLT research by offering a favourable balance between usability and real-world value. 1. Introduction Sign Language (SL) is a medium of communication that primarily uses hand gestures, facial expressions, and body movement to convey a speaker's thoughts, forming a com- plete and formal language. It is the primary means of com- munication for deaf individuals. National Sign Languages, being the native languages of deaf SL users, are a vital as- pect of cultural diversity in Europe and the world. Access to SL communication is essential for HoH as it enables access to equal education, employment, and healthcare services. *ai.voskou@edu.cut.ac.cy In Europe, there are 30 official Sign Languages and over 750,000 SL users, but only 12,000 interpreters. This short- age undermines the right to equal education and health and often endangers the lives of deaf people. In contrast to the common misconception, Sign Lan- guages are completely independent natural languages. Each national SL is unique with its own grammar, syntax, and vocabulary. Additionally, there is no direct connection be- tween a spoken language and its corresponding Sign Lan- guage, for example, Greek and Greek Sign Language. A true Sign Language Translation (SLT) system needs to cap- ture the visual patterns in the signed signal, decompose their linguistic meanings, and reconstruct them into spoken lan- guage text. These facts make the SLT task particularly chal- lenging from a technical point of view. Despite the importance of SLT systems, progress in this field has been limited. The current research has almost ex- clusively focused on simpler tasks, such as the recognition of static or dynamic gestures. Furthermore, the vast major- ity of successful SLT models currently available are trained on the Phoenix2014T [8], which is a single-topic dataset with a limited vocabulary, or similarly restricted datasets such as CSL-Daily [43]. While models trained on more meaningful datasets do exist, usually they either yield out- comes of significantly low quality or suffer from other types of limitations. These facts make it clear that there is a need for better machine learning techniques and, consequently, a need for more and better training datasets. This work addresses this problem by introducing a new SLT-suitable dataset, the Greek Elementary School Dataset (Elementary23). This dataset comprises more than 28,000 videos of Greek SL, totaling over 70 hours, each paired with its corresponding spoken Greek translation in text. Priori- tizing optimal technical quality, the data was captured us- ing high-definition cameras and featured expert signers. All examples are derived from the teaching materials of Greek elementary schools, covering a broad spectrum of subjects. 2. Related Work Datasets. Sign Language Processing involves a variety of tasks; the most common and well-studied is Sign Language Recognition (SLR) [3, 44, 6]. SLR is technically a special case of video classification, where a (short) video sequence is assigned a single label. Datasets designed for the par- ticular task include SL videos annotated with the so-called Glosses; these are text-like labels that express discrete SL expressions. Glosses should not be mistaken for text, since they do not form a proper or complete language format and often lack expressive power. Representative SLR dataset are the DGS Kinect 40 dataset [29, 18] in German Sign Language, the GSL dataset [1] in Greek SL and many more [36, 28, 2, 15, 5, 14, 26, 40, 30, 9]. The availability of SL-related datasets is clearly consid- erable. However, only a select few are suitable for the most critical application of SL processing, namely end-to-end SLT. A dataset is suitable for SLT model training if it pos- sesses two crucial characteristics: i) it includes SL videos paired with corresponding translations in a formal spoken language, and ii) the video-text pairs comprise complete and syntactically correct sentences/phrases of adequate length. In this context, Phoenix2014T [8] dataset has become one of the most extensively studied datasets for this pur- It features weather news performed in German pose. Sign Language, and includes both Gloss annotation and text translations. The inclusion of Gloss annotation, com- bined with its dense single-topic vocabulary, renders the Phoenix2014T dataset more conducive to deep learning and has thus attracted significant attention. Other notable datasets in this domain include SWISSTXT-NEWS [12] and VRT-NEWS [12], which cover a broader range of topics. These datasets are com- posed of TV-news data in German and Flemish Spoken and Sign Languages. However, the results of any end-to-end SLT attempts on these datasets have been disappointingly low, as they have failed to achieve even remotely acceptable translation quality. A recent important addition to this field was a project published by the BBC [4], consisting of a particularly large number of phrases in British Sign Language and English spoken language. The potential of this new dataset is especially high, mainly due to its extensive size. Nonetheless, end-to-end SLT results of deep learning models trained on this dataset have yet to appear in the related literature. Further examples are the CSL-Daily on Chinese SL with properties similar to Phoenix2014T and the American-SL dataset How2Sign [17] with good size and quality but lower reported results. A very recent and important addition is the OpenASL dataset [37], published in late 2022, covering 300h of American SL videos collected from online videos and demonstrating respectable results. Sign Language Translation. Given the societal impor- tance SLT, the field can be considered clearly underex- plored. However, in recent years, a noteworthy increase of effort has taken place. The 2018 paper [8] has been the seminal work on the Phoenix2014T dataset. It implemented recurrent seq-to-seq architectures for modelling, which re- sulted in promising BLEU-4 scores; these ranged from 10 up to 19 for different SLT variants. In 2020, the authors of [11] utilized the power of Transformer networks in the form of the Sign Language Transformer and achieved major im- provements in the translations. The approach used an S2T architecture and a feature-extracting element pre-trained as part of an SLR engine. Using the mentioned setups and ad- ditional Gloss-level supervision, they achieved clearly supe- rior results. The 2021 paper [39] proposed a breakthrough variant of Transformers, which uses a novel form of acti- vation functions which yield sparse and stochastic repre- sentations. This is achieved via a local stochastic compe- tition mechanism that gives rise to stochastic local winner- takes-all (LWTA) units. The method managed to improve the translation quality even more without auxiliary Gloss In addition, they showed that the proposed supervision. method can be tuned to reduce the post-training memory footprint by properly exploiting model uncertainty. Other similar works include [10], based on a multistream Trans- former, and approaches like [22] and [41] that leverage sup- plemental data through transfer learning and augmentation techniques to gain some additional improvement. 3. The Elementary23 Dataset 3.1. Core Elements The introduced Greek Elementary School dataset 1, dubbed Elementary23, constitutes a noteworthy contribu- tion to the existing body of literature due to its excep- tional quality and the substantial number of examples in- cluded. Table 1 presents a comparative analysis of Elemen- tary23 and the widely utilized Phoenix2014T dataset. As we show, Elementary23 exhibits superior technical and lin- guistic characteristics. Table 1. Elementary23 statistics vs Phoenix2014T. Phoenix2014T Elementary23 Signers Total Hours Total Frames Sentences Vocabulary Singletons Resolution FPS 9 25 ≈ 1.1M 8257 2887 1077 210 × 260 25 9 71 ≈ 6, 3M 29653 23204 10126 1280 × 720 25 1https://zenodo.org/record/7847052 3.2. Collection Procedure The Elementary23 dataset stands in contrast to many rel- evant datasets as it was not built by annotating preexisting sign language (SL) videos from online or other sources. In- stead, it was assembled through the recording of sign lan- guage interpretations of authentic elementary school con- tent. Furthermore the final content was rigorously curated and selected by expert staff, ensuring its high impact and practical value to the deaf community and students. The recordings for the Elementary23 dataset were made in an environment optimally suited for the task. This in- cluded a fixed single-color background and ideal lighting conditions (see Fig. 1). Professional-grade cameras and equipment were used to record videos at 720p resolution and a frame rate of 25fps. Figure 1. Example of Elementary23 Sign Language Video Frames The material was organised into sentences/phrases and then assigned to nine signers, all proficient users of Greek Sign Language with extensive knowledge and experience. As a result, the dataset is of exceptional quality, with mini- mum kinesthesiological and technical errors. The distribu- tion per signer is illustrated in Figure 2. Figure 2. Distribution of video-translation pairs per signer 3.3. Content and Vocabulary A Notable aspect of Elementary23 is its broad thematic spectrum. As previously mentioned the dataset is based on the official syllabus of Greek elementary schools, includ- ing the subjects of Greek Language, Mathematics, Religion Study, Environmental Study, History, and Anthology. The combination of those subjects ensures a sizeable lexicon of 23,204 words; yet, it is important to note that each indi- vidual subject contributes broad content and an extensive vocabulary. The statistics for each subject are presented in Table 2. The largest in terms of video-translation pairs quantity is the subject of the "Greek Language", which con- tains 9499 examples; the smallest one is "Religion Study", with 1,825 entries. Vocabulary-wise, the most comprehen- sive subject is Anthology which includes a total of 14,741 different words; on the other end, "Mathematics" have the smallest vocabulary with 6,457 words. Table 2. Number of examples per Subject and vocabulary metrics Vocabulary Examples Anthology Greek Language Mathematics History Envir. Study Relig. Study 14741 14345 6457 7716 9489 8087 4158 9499 6583 2067 5521 1825 3.4. SLT Subset The main motivation of Elementary23 is to contribute one of the largest Sign Language datasets paying particu- lar emphasis to technical and linguistic excellence. How- ever, the dataset is not necessarily an ideal candidate for training end-to-end SLT deep networks. Specifically, there are aspects of Elementary23 that present significant mod- elling challenges for deep networks. These include the dataset's high word sparsity; the high number of single- tons (words appearing only once in the corpus); the inclu- sion of particularly small phrases; and the limited number of frequently-appearing words. To be fair, this is not a prob- lem with the dataset itself but rather a limitation of modern deep networks, which typically require multiple examples to learn from data. To overcome this issue, in this work we also present an appropriate representative subsample of the dataset, which we dub Elementary23-SLT 2. This is more suitable for training end-to-end SLT deep networks, and has a size similar to Phoenix2014T and other recently published benchmark datasets. The selection process was guided by three primary prin- ciples: (i) decrease the absolute number of singletons; (ii) increase the density of frequent words and bigrams; and (iii) keep content diverse. To achieve these targets, we first went through preliminary cleaning, whereby we eliminated singleton-only sentences. Afterwards, we ran a simple dy- namic multi-round elimination process: At each round, we 2https://figshare.com/articles/dataset/Elementary23 SLT/22262953 Table 3. Elementary23-SLT vs key Benchmarks Elementary23-SLT Phoenix2014T [8] SWISSTXT-NEWS [12] VRT-NEWS [12] Sentences Total Words Vocabulary Mean Word Freq. Sigletons Rare words (<5) 8372 83327 8202 10.16 3327 (41%) 6155 (75%) 8257 99081 2887 34.3 1077 (37%) 1758 (60%) 6031 72892 10561 6.9 5969 (57%) 8779 (83%) 7174 79833 6875 11.6 3405 (50%) 5334 (78%) listed all sentences containing singletons but no frequent el- ements, and we eliminated approximately a quarter of them. We then recalculated word frequencies and redefined sin- gletons and frequent words based on the surviving subset. At the end of each round, we confirmed that all six subjects were represented with a sufficient number of remaining ex- amples, at least 10% of the original. We repeated this pro- cedure several times, until we ended up with a sample size comparable to the standard benchmarks. The aforementioned process left us with a sample of 7168 sentences. Subsequently, we split the data into the typ- ical train, validation and test subsets. During the selection of the validation and test sets, we tried to avoid sentences shorter than four words long, and made sure to exclude all the sentences appearing twice by the same speaker. As an extra processing step, we augmented the training set with an additional 1,204 non-singleton single-word videos. Finally, for comparison reasons, we additionally performed a train- validation-test split on the entire dataset following similar principles regarding duplicated entries. We will be refer- ring to this split as Elementary23-Raw. In both cases, all speakers may participate in all the subsets. The final SLT set contains 8372 video-sentence pairs, or- ganized as 7348 pairs for the training set, 512 for the valida- tion set, and 512 for the test set. Through this operation, we produced an effective subset in the typical size spectrum, that retains the desired qualitative elements of the complete collection while exhibiting some improved quantitative fac- tors. Key statistics regarding the subset and benchmarks are stated in Table 3 and will be analysed later in this Section. To enable the examination and exploitation of the data by the research community, we have ensured that Elementary23-SLT complies with established standards re- garding size and structure. Additionally, the data will be available in a file format that is practical and consistent with prior works [11, 39]. Specifically, we have created a JSON file comprising a list of dictionaries, each corresponding to a particular video-sentence pair. These dictionaries encom- pass all auxiliary elements, such as numbering and signer ID, as well as the principal input-output data; the latter con- sists of the frame-wise feature sequence and the correspond- ing translation in modern Greek. While feature extraction is technically a component of deep network development, we have adopted conventional practice by embedding the extracted features within the in- troduced SLT dataset. This approach does not affect the deep network training process or the final product, yet it considerably reduces the costs and effort of model develop- ment. The complete videos will also be made available. 3.5. Landmarks and Trajectories State-of-the-art SLT networks often utilize convolutional subparts as feature extractors; these are pre-trained on sign language recognition datasets. Such subparts can extract spatial information from video frames by leveraging their prior knowledge of core sign language elements. However, this preprocessing phase requires laborious dataset annota- tion in terms of auxiliary Glosses. Therefore, this process is of reduced applicability: developed models can only gen- eralize on other datasets of similar Gloss structure. In ad- dition, it is incompatible with the Greek Elementary School dataset: its immense size renders provision of Glosses com- pletely out of scope. To address this issue, we follow an alternative, yet es- tablished approach that involves using the OpenPose en- gine [13]. The OpenPose engine is a convolutional neural network that has been trained to track and extract the tra- jectories of key human body parts. We use OpenPose to track landmarks related to the 2D positioning of upper body movements, facial expressions, and hand shapes; one can use these as input to a developed end-to-end SLT model. We further scrutinize the extracted features, by excluding com- ponents that appear not to contribute enough or exhibit per- sistently low volatility, such as lower body landmarks. The resulting vector effectively summarizes the video frames and serves as a sufficient source of information for subse- quent network layers. Figure 3 illustrates a representative example of this approach. 3.6. Lexical Statistics and Benchmarks While Phoenix2014T has gained popularity as a standard benchmark for SLT due to its ease of modelling, its appro- priateness as a benchmark for comparing to the newly in- troduced dataset remains questionable. This is due to the following facts: i) it covers only a single topic, in contrast to the multi-subject nature of Elementary23; ii) vocabulary 4. Translation Methodology In order to tackle the challenging task of end-to-end SLT, we adhere to the guidance of recent developments in the field that advocate for the use of Transformer-based archi- tectures [11, 39, 42]. Specifically, we employ the seminal SLT model of [11], and the later sLWTA-Transformer [39] variant; we focus more on the latter method, due to its many advantages. These techniques have been demonstrated to be effective on the well-known PHOENIX-14T dataset, and achieve state-of-the-art results with BLEU-4 scores in the area of 22 and 24, respectively. Figure 4. The suggested Sign to Text Transformer Network Transformers are modern deep architectures that rely purely on the Attention mechanism to process temporal dy- namics in sequential observations. A standard Transformer layer includes a self-attention layer, paired with an imme- diately succeeding Relu-activated Feed-Forward Network (FFN). Sign language Transformers comprise encoder and decoder parts similar to [38]. The encoder is presented with frame-wise feature vectors obtained from a spatial feature extractor; it learns to process their interactions over the tem- poral axis and yields action-aware representations. The de- coder uses the latter and re-expresses the meaning into for- mal spoken language. The sLWTA SL-Tranformer reapproaches the standard architecture by introducing two forms of stochasticity: (i) Gaussian weights with posterior distributions estimated through variational inference, instead of standard point esti- mators on the weights; and (ii) the stochastic local-winner- takes-all layer as a more sophisticated FFN. In more detail, we consider a Bayesian treatment of the Figure 3. Body Landmarks - Trajectories coverage is very limited; iii) it includes many sentences of similar structure and content, due to the weather forecast- ing's strict format; and iv) Phoenix2014T includes auxiliary Gloss annotation. To address these challenges, we're supplementing our benchmark schema with two more datasets: SWISSTXT- NEWS and VRT-NEWS. Containing 6031 and 7174 videos/sentences respectively, they're based on HD TV news videos. We chose them due to their similar size to Phoenix2014T and Elementary23-SLT, good video quality and their basis in European sign languages, ensuring di- rectly comparable grammatical structures. In Table 3, we present a detailed comparison of Elementary23-SLT and the three selected benchmark datasets on the grounds of various vocabulary-oriented met- rics. These metrics were critical in determining the suitabil- ity of SWISSTXT-NEWS and VRT-NEWS as the primary benchmarks, since their statistics closely resemble those of Elementary23-SLT. Specifically, both SWISSTXT-NEWS and VRT-NEWS contain similarly sized vocabularies, with 10561 and 6875 sentences, respectively. Thus, they devi- ate no more than 25 % from our proposed subset of 8202 sentences. Furthermore, the percentage of rare words, de- fined as words that appear less than five times, ranges from 75 % to 83% for all three datasets. Finally, the mean word frequencies are comparable across these datasets, with the words in SWISSTXT-NEWS appearing an average of 11.6 times, 6.9 for VRT-NEWS, and 10.1 for Elementary23-SLT. Notably, Phoenix2014T has a vastly reduced vocabu- lary size compared to the rest of the considered datasets, which constitutes a central constraint. Additionally, Phoenix2014T is characterized by a considerably higher mean word frequency equal to 34.3. This number is rooted in the limited vocabulary and allows for easier train- ing since it narrows down verbal varieties. Furthermore, Phoenix2014T has the lowest percentage of rare words and singletons. In terms of singletons, Elementary23-SLT is a close second, with an increase of only 4%. weights by training a Gaussian variational posterior; this en- closes an uncertainty estimation of each weight, formed as q(w) = N (μ, σ2) where μ, σ2 are the posterior mean and variance. For inference, weight values are sampled from the Gaussian posteriors in a Monte Carlo fashion. The reparam- eterization trick of [24] is employed to allow for gradient descent-based training. The stochastic local-winner-takes-all layer [31], reported as LWTA or sLWTA, is a sophisticated non-linear layer that replaces the usual relu-activated dense layers with notable success [34, 32, 23, 33]. Let x ∈ RJ be the input of a typical dense layer, and y ∈ RH the corresponding output vector gained through multiplication with a weight matrix W ∈ RJ×H and activation via a nonlinear function such as ReLU y = ReLU (W x) . LWTA works by organising the output y into K blocks of U members/competitors each, and the weight matrix W into K respective submatrices. For any block indicated by k ∈ {1, 2, ..K}, we denote as yk ∈ RU and Wk ∈ RJ×U the corresponding subparts of y and W . The members of each block compete with each other, and only one of them, the winner, gets activated given an input, while the rest are set to 0. The so-called competition is an inter-block stochastic procedure based on sampling the winner from a discrete posterior with logits proportional to the linear computation in each unit: (cid:18) q(ξk) = D ξk (cid:19) softmax(cid:0)Wkx) (cid:12) (cid:12) (cid:12) (cid:12) , ∀k ∈ {1, 2, ..K} (1) where ξk ∈ onehot(U ) are discrete latent one-hot vectors indicating the winner of each block. The sampling process is effectively approximated using the Gumbel-Softmax relaxation trick [21] . Controlled by a temperature hyper-parameter T , this technique can offer low-variance gradients during the training phase (high T ), and hard discrete samples, almost identical to Eq. (1), dur- ing inference (low T ). Finaly, using the postulated ξ latent variables, layer out- put y can be expressed as follows: yk = ξk ⊙ (Wkxk), ∀k ∈ {1, 2, ..K} (2) where ⊙ stands for element-wise multiplication. 4.1. Training and Inference In the following, we will be referring to the standard Transformer-based SLT model of [11] as the deterministic model. On the other hand, the variant of [39] will be dubbed as the stochastic model. The training objective of the deterministic SLT model will be to minimise the cross-entropy error between each predicted word and the corresponding label, under a stan- dard seq-to-seq rationale. When it comes to inference us- ing the trained model, we again follow the usual practice and run autoregressive decoding, where words of each pro- duced sentence are predicted one by one, and the decoder is presented the encoded representations and the previous pre- dictions. Additionally, we use the beam search algorithm, the parameters of which are optimised on the validation set. Training of the stochastic variant is slightly more com- plex. The optimization objective is the negative evidence lower bound (ELBO) of the model, computation of which requires prior assumptions regarding the distributions of the winner indicator latent variables, ξ on each LWTA layer, as well as the trainable weights, w, throughout the network. For convenience, we postulate a priori spherical Gaussian weights of the form p(w) = N (0, I), and a symmetric Dis- crete prior over the winners: p(ξ) = Discrete(1/U ). Then, the training objective comprises: (i) the stan- dard cross-entropy of the network, with the expressions of the latent variables, ξ, expressed via the Gumbel-softmax reparameterization trick, and the Gaussian weights, w ∼ q(w), expressed via the standard reparameterization trick for Gaussians; (ii) the Kullback-Leibler divergences be- tween the posterior and the prior of the latent variables, ξ, and the Gaussian weights, w [39]. For inference, we directly draw weight samples w from the trained Gaussian posteriors. Similarly, we directly draw samples of the winner-indicating latent vectors, ξ, from the related discrete posteriors. The final prediction is obtained through Bayesian averaging; we sample the weights and ξ parameters from the posteriors four times, calculate the fi- nal logits, and average the results. This way we obtain the final logits that we use to drive beam search, similar to the deterministic model. 5. Experimental Results 5.1. Experimental setup This section presents our experimental results, primar- ily focusing on the LWTA-Transformer's application on the SLT subset of the Elementary dataset. The suggested LWTA-Transformer version is a three-layer architecture with an embedding size of 256 and U=2 competing units. Following the recommendations of [11], and [35] we ini- tialised the trainable parameters using Kaiming uniform for stochastic models [20], and Xavier normal for determinis- tic models [19]. The Gumbel-Softmax temperature was set following the related theory in [21]; we use a high temper- ature of T = 1.00 during training and a low T = 0.01 during inference. The rest of the training hyperparameters were either chosen based on the exact suggestions from the original papers of the models or optimised during our ex- perimental investigation. The BLEU-4 score was used as the main evaluation metric to assess the quality of sign-to- text translation. Core parts of the model's implementation are modified versions of [25, 11, 39]. Table 4. Results using deterministic and stochastic Transformers for both the entire dataset and SLT subset Data Model Dev Test BLEU-1 BLEU-2 BLEU-3 BLEU-4 BLEU-1 BLEU-2 BLEU-3 BLEU-4 Raw SLT Stochastic Deterministic Stochastic Deterministic 10.4 6.23 21.30 18.79 2.14 1.23 12.26 9.69 0.95 0.54 8.74 6.68 0.33 0.36 6.67 5.08 11.50 7.68 19.99 17.37 2.85 1.83 11.10 8.50 1.05 0.5 7.68 5.35 0 0 5.69 3.85 5.2. Quantitative Results Two central inquiries targeted in our experiments are (i) the identification of the network architecture that produces the best outcomes; and (ii) quantifying the impact of our decision to use an SLT-suitable subset rather than working with the entire Elementary23 dataset. Table 4 presents the best results that were achieved for all the subcases. Table 4 clearly demonstrates that using the Raw dataset resulted in very low BLEU scores for both the deterministic and stochastic models. Conversely, the usage of the SLT- subset resulted in significantly improved outcomes. The ex- clusion of problematic or unsuitable sentences and an ap- propriate data split apparently play a crucial role, making training less noisy and more focused on effective examples. In terms of architecture, we compare two of the best ap- proaches available, that is, the original S2T deterministic Transformer and its stochastic counterpart, i.e. the sLWTA Transformer. The results are summarised in Table 4. The stochastic LWTA Transformer appears to be superior to the deterministic, achieving a BLEU-4 score of more than 1.5 units higher than the latter. The superiority holds for all ranks of BLEU scores in both the training and validation set. 5.2.1 Ablation study Model size Contemporary NLP Transformer networks have a tendency towards large size [27, 7, 16], reaching depths that can approach 100 layers. Conversely, SL Trans- formers are commonly much smaller, often no more than 2 to 3 layers deep. Our experiments, conducted on the Elementary23-SLT dataset, aimed to determine the opti- mal depth for the proposed stochastic Transformer. The results, depicted in Table 5, demonstrate that a depth of 2 proves to be the optimal choice, as indicated by the highest BLEU-4 scores on both the test and validation(dev) sets. A depth of 1 delivered results that were lower but still close, while increasing the depth beyond 2 resulted in a decline in performance of around 1 to 1.5 units. The embedding size is another size-related hyperparameter crucial in Deep NLP models. Table 6 presents a study of the effect of dif- ferent embedding sizes on the performance of the LWTA- Transformer on the Elementary23 dataset. The results indi- Table 5. BLEU-4 Scores per model depth Depth Dev 6.35 6.67 5.09 1 2 3 Test 5.57 5.69 4.63 cate that an embedding size of 256 provides optimal perfor- mance. Smaller sizes appear insufficient to handle the com- plexity of the task, as they yielding the much lower scores of 4.39/4.07 for size=128. On the other hand, larger sizes, such as 512, do not improve the results. Table 6. BLEU-4 Comparison between embedding sizes Embedding Size Dev 4.39 6.67 5.32 128 256 512 Test 4.07 5.69 5.27 The effect of Competing Units per Block As previously discussed, the results of our experiments on the sLWTA Sign Language Transformer (Table 4) render it a superior solution for the Greek SL translation task compared to the deterministic model. A central aspect of this network is the use of the sophisticated LWTA layer, as opposed to a typical activation function such as Relu. The size of the competi- tion blocks U is the main tunable hyperparameter of this technique. Through an examination of the commonly used sizes, presented in Table 7, we concluded that the most suit- able choice for our case is U = 2, as suggested in [31]. Larger sizes of U = 4 and U = 8 resulted in decreases of 0.22 and 0.76 BLEU-4 units, respectively; this is likely due to the high sparsity of the representations obtained from the LWTA blocks. Table 7. The effect of LWTA block size U Competing Units (U) Dev 6.67 5.41 5.23 Test 5.69 5.47 4.93 2 4 8 5.2.2 Discussion and Benchmarking We now proceed with a direct evaluation of the translation accuracy attained on the Elementary23 dataset, and com- pare it to the results reported on other benchmark datasets. Table 8 summarises the achieved BLEU-4 scores for each case, covering both the main benchmarks and a curated se- lection of significant yet less directly comparable supple- mentary non-European datasets. Table 8. Benchmarking BLEU-4 scores Dataset Elementary23-SLT Phoenix2014T [39] SWISSTXT-NEWS [12] VRT-NEWS [12] OpenASL [37] CSL-Daily [43] Dev 6.67 23.23 0.46 0.45 6.57 20.80 Test 5.69 23.65 0.41 0.36 6.72 21.34 As indicated in this table, researchers have reported BLEU-4 scores reaching as high as 23.23/23.65 for the vali- dation and test sets of Phoenix2014T, validating its standing as the highest-performing dataset. However, as previously noted, this dataset does come with limitations such as a re- stricted vocabulary, a narrowly focused topic, and a strin- gent structure. Analogous results emerge from applications on the CSL-Daily dataset. More specifically, researchers report impressive scores of 20.80/21.34 on this popular Chinese-SL dataset, which also bears similar constraints on vocabulary and content to Phoenix2014T. While these at- tributes enhance BLEU-4 performance, they diminish the applicability of the developed SLT models for real-world users. In contrast, the objective of our work is to amplify the effectiveness of end-to-end SLT systems in genuine usage scenarios. These considerations make Phoenix2014T an imperfect comparison to the Elementary23 dataset, which boasts a more realistic design. Conversely, models trained on SWISSTXT-NEWS and VRT-NEWS exhibit weak performance, with BLEU-4 scores < 1. The authors report scores of 0.46/0.41 and 0.45/0.36, respectively, which are considerably lower than the 6.67/5.69 achieved in our proposed subset. Unfortu- nately, with such poor scores, these datasets cannot provide any practical value, nor can they be regarded as a reliable benchmark for future SLT models; these facts are despite their extensive topic coverage and vast vocabulary size. These contrasting outcomes underscore the value of the new Elementary23 dataset. Although the attained BLEU-4 scores, around 6 units, are low compared to state-of-the-art NLP models trained on extensive text corpora, they demon- strate tangible translation capabilities. Therefore, unlike the previously mentioned SL datasets, our data combine mea- surable results with a comprehensive and realistic thematic spectrum. These qualities give our proposed dataset par- ticular importance as a benchmark dataset for future SLT research. Finally, the more modern OpenASL is the only case that seems to align with Elementary23, combining re- spectable results with high-quality content. 5.3. Qualitative Results The quality of the automatic translations produced by our models varies; this is shown in Table 9, where three rep- resentative examples are presented. In some cases, such as the first example, the results are impressively accurate, with only minor numerical or grammatical errors. The next case belongs to a second category in which the context is par- tially captured, but the syntax deviates from the target. The final example represents the third group, where the model completely fails to detect any of the signed signals. Table 9. Reference (R), Prediction (P), Translated Reference (Rt), Translated Prediction (Pt) # 1 2 3 Translation Reference and Prediction R: έχει 10 νομίσματα πόσα είναι τα χρήματά του συνολικά P: έχει 4 νομίσματα πόσα είναι τα χρήματά του συνολικά Rt: he has 10 coins how much is his money in total Pt: he has 4 coins how much is his money in total R: συμπληρώνω τους αριθμούς που λείπουν στους πίνακες P: υπολογίζω και γράφω τους αριθμούς που λείπουν Rt: I fill in the missing numbers in the tables Pt: I calculate and write the missing numbers R: στο σχολείο μαθαίνουμε καινούρια πράγματα P: το περιβάλλον μου Rt: at school we learn new things Pt: my environment 6. Conclusions This paper presents a novel dataset of Greek Sign Lan- guage, characterized by high technical quality and diverse vocabulary. Using a simple yet effective selection proce- dure, we selected an SLT-suitable subset that adheres to es- tablished formatting standards and retains the desired fea- tures. By utilizing variants of the state-of-the-art LWTA Transformer, we achieved BLEU-4 scores ten times higher than those reported on directly comparable datasets. As such, our proposed Elementary23 dataset offers a bal- ance of quality and feasibility. Elementary23 can serve as a viable alternative to popular yet monotonous dataset like Phoenix2014T and similar, and the verbally rich but unattainable such as SWISSTXT-NEWS and VRT-NEWS options. Future work could involve applying even more so- phisticated SLT models, exploring data-oriented techniques such as active or meta-learning, and further investigating the use of the Elementary23 dataset for tasks such as text- to-sign SL production. Acknowledgement This research was supported by the European Union's Horizon 2020 research and innovation program, under grant agreement No 872139, project aiD. References [1] Nikolas Adaloglou, Theocharis Chatzis, Ilias Papastratis, Andreas Stergioulas, Georgios Th Papadopoulos, Vassia Zacharopoulou, George J Xydopoulos, Klimnis Atzakas, Dimitris Papazachariou, and Petros Daras. A comprehensive study on sign language recognition methods. arXiv preprint arXiv:2007.12530, 2(2), 2020. [2] Ulrich von Agris and Karl-Friedrich Kraiss. SIGNUM database: Video corpus for signer-independent continu- ous sign language recognition. In Philippe Dreuw, Eleni Efthimiou, Thomas Hanke, Trevor Johnston, Gregorio Mart ́ınez Ruiz, and Adam Schembri, editors, Proceedings of the LREC2010 4th Workshop on the Representation and Processing of Sign Languages: Corpora and Sign Language Technologies, pages 243–246, Valletta, Malta, May 2010. European Language Resources Association (ELRA). [3] Mohammed S Al-Samarraay, Mahmood M Salih, Mo- hamed A Ahmed, AA Zaidan, Osamah Shihab Albahri, Dra- gan Pamucar, HA AlSattar, Abdullah Hussein Alamoodi, BB Zaidan, Kareem Dawood, et al. A new extension of fdosm based on pythagorean fuzzy environment for evaluating and benchmarking sign language recognition systems. Neural Computing and Applications, pages 1–19, 2022. [4] Samuel Albanie, G ̈ul Varol, Liliane Momeni, Hannah Bull, Triantafyllos Afouras, Himel Chowdhury, Neil Fox, Ben- cie Woll, Rob Cooper, Andrew McParland, et al. Bbc- arXiv preprint oxford british sign language dataset. arXiv:2111.03635, 2021. [5] Vassilis Athitsos, Carol Neidle, Stan Sclaroff, Joan Nash, Alexandra Stefan, Quan Yuan, and Ashwin Thangali. The american sign language lexicon video dataset. In 2008 IEEE Computer Society Conference on Computer Vision and Pat- tern Recognition Workshops, pages 1–8, 2008. [6] Maty ́aˇs Boh ́aˇcek and Marek Hr ́uz. Sign pose-based trans- former for word-level sign language recognition. In Proceed- ings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 182–191, 2022. [7] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Sub- biah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakan- tan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Lan- guage models are few-shot learners. Advances in neural in- formation processing systems, 33:1877–1901, 2020. [8] N. C. Camgoz, S. Hadfield, O. Koller, H. Ney, and R. Bow- den. Neural sign language translation. In 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 7784–7793, 2018. [9] Necati Cihan Camg ̈oz, Ahmet Alp Kındıro ̆glu, Serpil Karab ̈ukl ̈u, Meltem Kelepir, Ays ̧e Sumru ̈Ozsoy, and Lale Akarun. BosphorusSign: a Turkish sign language recogni- tion corpus in health and finance domains. In Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC'16), pages 1383–1388, 2016. [10] Necati Cihan Camgoz, Oscar Koller, Simon Hadfield, and Richard Bowden. Multi-channel transformers for multi- articulatory sign language translation. In Computer Vision– ECCV 2020 Workshops: Glasgow, UK, August 23–28, 2020, Proceedings, Part IV 16, pages 301–319. Springer, 2020. [11] Necati Cihan Camg ̈oz, Oscar Koller, Simon Hadfield, and Richard Bowden. Sign language transformers: Joint end- In 2020 to-end sign language recognition and translation. IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, Seattle, WA, USA, June 13-19, 2020, pages 10020–10030. IEEE, 2020. [12] Necati Cihan Camg ̈oz, Ben Saunders, Guillaume Ro- chette, Marco Giovanelli, Giacomo Inches, Robin Nachtrab- Ribback, and Richard Bowden. Content4all open research sign language translation datasets. In 2021 16th IEEE Inter- national Conference on Automatic Face and Gesture Recog- nition (FG 2021), pages 1–5. IEEE, 2021. [13] Zhe Cao, Tomas Simon, Shih-En Wei, and Yaser Sheikh. Realtime multi-person 2d pose estimation using part affinity fields. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7291–7299, 2017. [14] X Chai, H Wanga, M Zhoub, G Wub, H Lic, and X Chena. Devisign: dataset and evaluation for 3d sign language recog- nition. Technical report, Beijing, Tech. Rep, 2015. [15] Helen Cooper, Eng-Jon Ong, Nicolas Pugeault, and Richard Bowden. Sign Language Recognition Using Sub-units, pages 89–118. Springer International Publishing, Cham, 2017. [16] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Pre-training of deep bidirectional arXiv preprint Toutanova. transformers for language understanding. arXiv:1810.04805, 2018. Bert: [17] Amanda Duarte, Shruti Palaskar, Lucas Ventura, Deepti Ghadiyaram, Kenneth DeHaan, Florian Metze, Jordi Torres, and Xavier Giro-i Nieto. How2sign: a large-scale multi- In modal dataset for continuous american sign language. Proceedings of the IEEE/CVF conference on computer vi- sion and pattern recognition, pages 2735–2744, 2021. [18] Ralph Elliott, Helen Cooper, John Glauert, Richard Bowden, and Franc ̧ois Lefebvre-Albaret. Search-by-example in mul- tilingual sign language databases. In Proceedings of the Sec- ond International Workshop on Sign Language Translation and Avatar Technology (SLTAT), Dundee, Scotland, Oct. 23 2011. [19] Xavier Glorot and Yoshua Bengio. Understanding the diffi- culty of training deep feedforward neural networks. In Pro- ceedings of the thirteenth international conference on artifi- cial intelligence and statistics, pages 249–256. JMLR Work- shop and Conference Proceedings, 2010. [20] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level perfor- In Proceedings of the mance on imagenet classification. IEEE international conference on computer vision, pages 1026–1034, 2015. [21] Eric Jang, Shixiang Gu, and Ben Poole. Categorical repa- rameterization with gumbel-softmax, 2017. [22] Tao Jin, Zhou Zhao, Meng Zhang, and Xingshan Zeng. Prior knowledge and memory enriched transformer for sign lan- guage translation. In Findings of the Association for Compu- tational Linguistics: ACL 2022, pages 3766–3775, 2022. [23] Konstantinos Kalais and Sotirios Chatzis. Stochastic deep networks with linear competing units for model-agnostic In International Conference on Machine meta-learning. Learning, pages 10586–10597. PMLR, 2022. [24] Diederik P Kingma and Max Welling. Auto-encoding varia- tional bayes. arXiv preprint arXiv:1312.6114, 2013. [25] Julia Kreutzer, Jasmijn Bastings, and Stefan Riezler. Joey In Pro- NMT: A minimalist NMT toolkit for novices. ceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP- IJCNLP): System Demonstrations, pages 109–114, Hong Kong, China, Nov. 2019. Association for Computational Lin- guistics. [26] A. Kurakin, Z. Zhang, and Z. Liu. A real time system for dynamic hand gesture recognition with a depth sensor. In 2012 Proceedings of the 20th European Signal Processing Conference (EUSIPCO), pages 1975–1979, 2012. [27] Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. Albert: A lite bert for self-supervised learning of language representations. arXiv preprint arXiv:1909.11942, 2019. [28] Dongxu Li, Cristian Rodriguez, Xin Yu, and Hongdong Li. Word-level deep sign language recognition from video: A In The new large-scale dataset and methods comparison. IEEE Winter Conference on Applications of Computer Vi- sion, pages 1459–1469, 2020. [29] Eng-Jon Ong, Helen Cooper, Nicolas Pugeault, and Richard Bowden. Sign language recognition using sequential pattern In Proceedings of the IEEE Computer Society Con- trees. ference on Computer Vision and Pattern Recognition, Provi- dence, Rhode Island, USA, June 16 – 21 2012. [30] O ̆gulcan ̈Ozdemir, Ahmet Alp Kındıro ̆glu, Necati Ci- han Camgoz, and Lale Akarun. BosphorusSign22k Sign the Language Recognition Dataset. LREC2020 9th Workshop on the Representation and Pro- cessing of Sign Languages: Sign Language Resources in the Service of the Language Community, Technological Chal- lenges and Application Perspectives, 2020. In Proceedings of [31] Konstantinos Panousis, Sotirios Chatzis, and Sergios Theodoridis. Nonparametric bayesian deep networks with local competition. In International Conference on Machine Learning, pages 4980–4988. PMLR, 2019. [32] Konstantinos Panousis, Sotirios Chatzis, and Sergios Theodoridis. Stochastic local winner-takes-all networks en- In Bayesian Deep able profound adversarial robustness. Learning NeurIPS workshop, 2021. [33] Konstantinos P Panousis, Anastasios Antoniadis, and Sotirios Chatzis. Competing mutual information constraints with stochastic competition-based activations for learning di- versified representations. In Proceedings of the AAAI Con- ference on Artificial Intelligence, volume 36, pages 7931– 7940, 2022. [34] Konstantinos P. Panousis, Sotirios Chatzis, Antonios Alexos, and Sergios Theodoridis. Local competition and stochastic- tity for adversarial robustness in deep learning. In Proc. AIS- TATS, 2021. [35] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Rai- son, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An im- perative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alch ́e-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Informa- tion Processing Systems 32, pages 8024–8035. Curran Asso- ciates, Inc., 2019. [36] Franco Ronchetti, Facundo Quiroga, Cesar Estrebou, Laura Lanzarini, and Alejandro Rosete. Lsa64: A dataset of argen- tinian sign language. XX II Congreso Argentino de Ciencias de la Computaci ́on (CACIC), 2016. [37] Bowen Shi, Diane Brentari, Greg Shakhnarovich, and Karen Livescu. Open-domain sign language translation learned from online video. arXiv preprint arXiv:2205.12870, 2022. [38] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszko- reit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Il- lia Polosukhin. Attention is all you need. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vish- wanathan, and R. Garnett, editors, Advances in Neural Infor- mation Processing Systems, volume 30, pages 5998–6008. Curran Associates, Inc., 2017. [39] Andreas Voskou, Konstantinos P. Panousis, Dimitrios Kos- mopoulos, Dimitris N. Metaxas, and Sotirios Chatzis. Stochastic transformer networks with linear competing units: In Proc. ICCV, Application to end-to-end sl translation. 2021. [40] Jiang Wang, Zicheng Liu, Jan Chorowski, Zhuoyuan Chen, and Ying Wu. Robust 3d action recognition with random occupancy patterns. In Andrew Fitzgibbon, Svetlana Lazeb- nik, Pietro Perona, Yoichi Sato, and Cordelia Schmid, edi- tors, Computer Vision – ECCV 2012, pages 872–885, Berlin, Heidelberg, 2012. Springer Berlin Heidelberg. [41] Pan Xie, Mengyi Zhao, and Xiaohui Hu. Pisltrc: Position- informed sign language transformer with content-aware con- volution. IEEE Transactions on Multimedia, 24:3908–3919, 2021. [42] Kayo Yin and Jesse Read. Better sign language transla- tion with STMC-transformer. In Proceedings of the 28th In- ternational Conference on Computational Linguistics, pages 5975–5989, Barcelona, Spain (Online), Dec. 2020. Interna- tional Committee on Computational Linguistics. [43] Hao Zhou, Wengang Zhou, Weizhen Qi, Junfu Pu, and Improving sign language translation with Houqiang Li. monolingual data by sign back-translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pat- tern Recognition, pages 1316–1325, 2021. [44] Ronglai Zuo and Brian Mak. C2slr: Consistency-enhanced In Proceedings of continuous sign language recognition. the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5131–5140, 2022.
http://arxiv.org/abs/2310.04752v1
"2023-10-07T09:15:08"
"2023-10-07T09:15:08"
A Unified Generalization Analysis of Re-Weighting and Logit-Adjustment for Imbalanced Learning
Real-world datasets are typically imbalanced in the sense that only a few classes have numerous samples, while many classes are associated with only a few samples. As a result, a na\"ive ERM learning process will be biased towards the majority classes, making it difficult to generalize to the minority classes. To address this issue, one simple but effective approach is to modify the loss function to emphasize the learning on minority classes, such as re-weighting the losses or adjusting the logits via class-dependent terms. However, existing generalization analysis of such losses is still coarse-grained and fragmented, failing to explain some empirical results. To bridge this gap, we propose a novel technique named data-dependent contraction to capture how these modified losses handle different classes. On top of this technique, a fine-grained generalization bound is established for imbalanced learning, which helps reveal the mystery of re-weighting and logit-adjustment in a unified manner. Furthermore, a principled learning algorithm is developed based on the theoretical insights. Finally, the empirical results on benchmark datasets not only validate the theoretical results but also demonstrate the effectiveness of the proposed method.
[ "Zitai Wang", "Qianqian Xu", "Zhiyong Yang", "Yuan He", "Xiaochun Cao", "Qingming Huang" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04752v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04752v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.CV" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 2 5 7 4 0 . 0 1 3 2 : v i X r a A Unified Generalization Analysis of Re-Weighting and Logit-Adjustment for Imbalanced Learning Zitai Wang1,2 Qianqian Xu3∗ Yuan He5 Xiaochun Cao6,1 Zhiyong Yang4 Qingming Huang4,3,7∗ 1 SKLOIS, Institute of Information Engineering, CAS 2 School of Cyber Security, University of Chinese Academy of Sciences 3 Key Lab. of Intelligent Information Processing, Institute of Computing Tech., CAS 4 School of Computer Science and Tech., University of Chinese Academy of Sciences 5 Alibaba Group 6 School of Cyber Science and Tech., Shenzhen Campus, Sun Yat-sen University 7 BDKM, University of Chinese Academy of Sciences wangzitai@iie.ac.cn yangzhiyong21@ucas.ac.cn xuqianqian@ict.ac.cn heyuan.hy@alibaba-inc.com caoxiaochun@mail.sysu.edu.cn qmhuang@ucas.ac.cn Abstract Real-world datasets are typically imbalanced in the sense that only a few classes have numerous samples, while many classes are associated with only a few samples. As a result, a naïve ERM learning process will be biased towards the majority classes, making it difficult to generalize to the minority classes. To address this issue, one simple but effective approach is to modify the loss function to emphasize the learning on minority classes, such as re-weighting the losses or adjusting the logits via class-dependent terms. However, existing generalization analysis of such losses is still coarse-grained and fragmented, failing to explain some empirical results. To bridge this gap, we propose a novel technique named data-dependent contraction to capture how these modified losses handle different classes. On top of this technique, a fine-grained generalization bound is established for imbalanced learning, which helps reveal the mystery of re-weighting and logit-adjustment in a unified manner. Furthermore, a principled learning algorithm is developed based on the theoretical insights. Finally, the empirical results on benchmark datasets not only validate the theoretical results but also demonstrate the effectiveness of the proposed method. 1 Introduction In recent years, machine learning has achieved great success with the help of well-collected datasets, where the number of samples is artificially balanced among classes [1, 2]. However, the real-world datasets are generally imbalanced in the sense that only a few classes have numerous samples (i.e., the majority ones), while the others are associated with only a few samples (i.e., the minority ones) [3–5]. Owing to this issue, a naïve Empirical Risk Minimization (ERM) learning process will be biased towards the majority classes, and the generalization on the minority ones becomes challenging. Hence, the imbalanced learning problem has attracted increasing attention in recent years [6–9]. One simple yet effective approach for imbalanced learning is to modify the naïve loss function, such that the learning process can pay more attention to the minority classes (Please refer to Appendix A for more orthogonal approaches). In this direction, existing approaches generally fall into two categories: re-weighting [10, 11] and logit-adjustment [12–16]. The former category assigns larger weights to ∗Corresponding authors. 37th Conference on Neural Information Processing Systems (NeurIPS 2023). the losses of the minority classes. Although intuitive, this approach might lead to difficulties and instability in optimization [11, 12, 17]. To tackle this issue, Cao et al. [12] propose an effective scheme named Deferred Re-Weighting (DRW), where the re-weighting approach is applied only during the terminal phase of training. The latter category adjusts the logits by class-dependent terms. For example, the Label Distribution Aware Margin (LDAM) loss enforces larger margins for minority classes to achieve strong regularization [12]. The Logit-Adjustment (LA) loss [13] and the Class-Dependent Temperatures (CDT) loss [14] utilize additive and multiplicative terms to adjust the logits, respectively. Most recently, Kini et al. [16] combine the two types of terms and proposes a unified loss named Vector-Scaling (VS) for imbalanced learning. Although existing loss-modification methods have achieved promising performance, the theoretical insights are still fragmented and coarse-grained. To be specific, Cao et al. [12] and Ren et al. [18] utilize the classic margin theory to explain the necessity of the additive terms in the LDAM loss. However, the theory fails to explain the significant improvement induced by the DRW scheme. Menon et al. [13] analyzes the Fisher consistency property [19] of the additive terms in the LA loss, while providing no further generalization analysis. Kini et al. [16] provides a generalization analysis of the VS loss, but the results can only explain the role of the multiplicative terms under the assumption that a linear model is trained on linearly separable data. Besides, we find that the VS loss is rather incompatible with the DRW scheme, which is also out of the scope of existing theory. Hence, a gap still exists between the theory and the practice of the loss-modification approaches. To bridge this gap, this paper provides a systematical and fine-grained analysis of loss-modification approaches. After revisiting prior arts, we find that the only property of the loss function utilized in existing proofs is the classic Lipschitz continuity [19, 20]. However, this property is global in nature such that the whole analysis provides no insight into how the losses handle different classes. Inspired by this observation, we extend the classic Lipschitz continuity with a local technique. In this way, the local Lipschitz constants on different classes exactly correspond to the class-dependent terms of the modified loss functions. And a fine-grained generalization bound is established by a novel technique named data-dependent contraction. By applying this bound to the VS loss, the mystery of re-weighting and logit-adjustment is finally uncovered. Last but not least, a principled learning algorithm is proposed based on our theoretical insights. To sum up, the main contributions of this paper are listed as follows: • New technique. We extend the classic Lipschitz continuity and propose a novel technique named data-dependent contraction to obtain a fine-grained generalization bound for imbalanced learning. • Theoretical insights. Based on the fine-grained bound, a systematical analysis succeeds in explaining the role of re-weighting and logit-adjustment in a unified manner, as well as some empirical results that are out of the scope of existing theories. • Principled Algorithm. A principled algorithm is proposed based on the insights, where the re-weighting term is aligned with the generalization bound, and the multiplicative logit-adjustment term is removed during the DRW phase to avoid the incompatibility between terms. • Empirical Validation. The empirical results on multiple benchmark datasets not only validate the theoretical results, but also demonstrate the superiority of the proposed method. 2 Preliminary We first introduce the basic notations and the imbalanced learning problem in Sec.2.1. Then, we briefly review existing generalization analysis for imbalanced learning in Sec.2.2. 2.1 Notations and Problem Definition We assume that the samples are drawn i.i.d. from a product space Z = X × Y, where X is the input space and Y = {1, * * * , C} is the label space. Let S = {(x(n), y(n))}N n=1 be the imbalanced training set sampled from the imbalanced distribution D defined on Z, Sy = {x | (x, y) ∈ S} be the set of samples from the class y, Ny := |Sy| denote the size of Sy, and πy := Ny/N . Without loss of generality, we assume that N1 ≥ N2 ≥ * * * ≥ NC. Let Dbal be the balanced distribution defined on Z. Specifically, a class y is first uniformly sampled from Y, and then the input x is sampled from the class-conditional distribution Dy := P [x | y]. 2 Then, our task is to learn a score function f : X → RC to minimize the risk defined on the balanced distribution: Rbal(f ) := 1 C C (cid:88) y=1 Ry(f ) = 1 C C (cid:88) y=1 E x∼Dy [M (f (x), y)] , (1) where Ry is the risk defined on the class y, and M : RC × Y → R+ is the measure that evaluates the model performance at z ∈ Z. For example, one of the most popular choices is to check whether the top-1 prediction is right: M (f (x), y) = 1 [y /∈ arg maxy′∈Y f (x)y′], where 1 [*] is the indicator function. Since M is generally non-differential and thus hard to optimize, one has to select a differential surrogate loss L : RC × Y → R+, which induces the following surrogate risk: RL bal(f ) := 1 C C (cid:88) y=1 RL y (f ) = 1 C C (cid:88) y=1 E x∼Dy [L(f (x), y)] . (2) Let G := {L ◦ f : f ∈ F} denote the hypothesis set. Next, we consider a family of loss functions named Vector-Scaling (VS) [16]: LVS(f (x), y) = −αy log (cid:32) eβyf (x)y+∆y y′ eβy′ f (x)y′ +∆y′ (cid:80) (cid:33) . (3) The advantage behind this loss family is two-fold. On one hand, the VS loss generalizes popular re-weighting and logit-adjustment methods. For example, when αy = 1, βy = 1, ∆y = 0, it becomes the traditional CE loss [19]. When βy = 1, ∆y = 0, re-weighting terms αy = π−1 and αy = (1 − p)/(1 − pNy ), p ∈ (0, 1) recover the classic balanced loss [10] and Class-Balanced (CB) loss [11], respectively. αy = 1, βy = 1, ∆y = τ log πy, τ > 0 yield the LA loss [13]. When α1 = 1, βy = (Ny/N1)γ, ∆y = 0, γ > 0, we can deduce the CDT loss [14]. On the other hand, an ideal surrogate loss should be Fisher consistent such that minimizing RL bal(f ) not only can put more emphasis on minority classes, but also helps bound Rbal(f ) [19, 21]. Fortunately, prior arts [13] have shown that a subset of the VS loss family satisfies such a property: y LFisher(f (x), y) := δy πy log[1 + (cid:88) y′̸=y δy′ δy ef (x)y′ −f (x)y ], (4) where δy is an arbitrary positive constant. 2.2 Existing Generalization Analysis for Imbalanced Learning In balanced learning, we can directly minimize the empirical balanced risk defined on the balanced datasets Sbal sampled from Dbal: (cid:98)RL bal(f ) := 1 N (cid:88) L(f (x), y). (x,y)∈Sbal (5) Then, the generalization guarantee is available by traditional concentration techniques [19]. However, in imbalanced learning, we can only minimize the empirical risk on the imbalanced dataset S: (cid:98)RL(f ) := 1 N (cid:88) L(f (x), y). (6) (x,y)∈S To handle this issue, Cao et al. [12] and Ren et al. [18] aggregate the class-wise generalization bound directly with a union bound over class-wise results [19]: Proposition 1 (Union bound for Imbalanced Learning [12]). Given the function set F and a loss function L : RC × Y → [0, M ], then for any δ ∈ (0, 1), with probability at least 1 − δ over the training set S, the following generalization bound holds for all g ∈ G: y (f ) ≾ 1 RL C y (f ) + ˆCSy (G) + 3M log 2C/δ 2Ny bal(f ) = C (cid:88) C (cid:88) ˆRL 1 C RL (cid:115) (cid:33) (cid:32) (7) , y=1 y=1 y (f ) is the empirical risk on Sy; ˆCS (G) := Eξ[supg∈G where ˆRL n=1 ξ(n)g(z(n))] denotes the empirical complexity of the function set G, and ξ := (ξ(1), ξ(2), * * * , ξ(N )) are sampled from independent distributions such as the uniform distribution with {1, −1}; ≾ denotes the asymptotic notation that omits undominated terms, that is, f (t) ≾ g(t) ⇐⇒ ∃ a constant C > 0, f (t) ≤ C *g(t). 1 N (cid:80)N 3 To further bound the complexity term ˆCSy (G), Cao et al. [12] assume that the loss function L satisfies the Lipschitz continuity and applies the traditional contraction lemma [20]: Definition 1 (Lipschitz Continuity). Let ∥ * ∥ denote the 2-norm. Then, we say the loss function L(f, y) is Lipschitz continuous with constant μ if for any f, f ′ ∈ F, x ∈ S, |L(f, y) − L(f ′, y)| ≤ μ * ∥f (x) − f ′(x)∥. (8) Lemma 1 (Contraction Lemma). Assume that the loss function L(f, x) is Lipschitz continuous with a constant μ. Then, the following inequality holds: ˆCS (G) ≤ μ * ˆCS (F). (9) Finally, the standard margin-based generalization bound [22] is directly applied to obtain the upper bound of ˆCSy (F). However, this union bound has the following limitations: • Theoretically, this generalization bound is coarse-grained and not sharp enough. To be specific, the differences among different loss functions lie in the choice of αy, βy, ∆y. However, the Lipschitz continuity, which is the only property of L utilized in the proof, is global in nature and thus obscures these differences. Although the margin theory can provide some theoretical insights into the role of ∆y, the roles of αy, βy are still a mystery. Besides, since Bound(RL bal(f )) = 1 C (cid:88) Bound( RL y (f )) ≤ y 1 C (cid:88) y Bound(RL y (f )), (10) a sharper bound might be available if we can bound RL bal(f ) directly. • Empirically, although the induced LDAM loss outperforms the CE loss, the improvement is not so significant. Fortunately, when combining the Deferred Re-Weighting (DRW) technique [12], where αy = (1 − p)/(1 − pNy ), p ∈ (0, 1) [11] during the terminal phase of training, the improvement becomes much more impressive. However, Eq.(7) fails to explain this phenomenon. Recently, Kini et al. [16] provide a generalization analysis for the VS loss. However, the results, which only hold for linear models with linearly separable data, can only explain the roles of βy. For the role of ∆y, they resort to analyzing the gradient of the VS loss and provide a coarse-grained analysis. To sum up, existing generalization analysis for imbalanced learning is coarse-grained and fragmented. Next, we aim to build a more fine-grained and systematical generalization bound that can unify the roles of both re-weighting and logit-adjustment. 3 Fine-Grained Generalization Analysis for Imbalanced Learning In Sec.3.1, we first establish a sharp generalization bound based on a novel technique named data- dependent contraction. Then, in Sec.3.2, we apply this generalization bound to the VS loss to provide a series of theoretical insights. Finally, in Sec.3.3, a principled algorithm is proposed based on the theoretical insights. 3.1 Generalization Bound Induced By Data-Dependent Contraction Different from Eq.(7), we hope to build a direct bound between RL analysis is based on the following lemma, whose proof can be found in Appendix B: Lemma 2. Given the function set F and a loss function L : RC × Y → [0, M ], then for any δ ∈ (0, 1), with probability at least 1 − δ over the training set S, the following generalization bound holds for all g ∈ G: bal(f ) and (cid:98)RL(f ). To this end, our RL bal(f ) ≾ Φ(L, δ) + (cid:113) log 2/δ 1 CπC * ˆCS (G), (11) where Φ(L, δ) := 1 CπC [ (cid:98)RL(f ) + 3M 2N ] contains the empirical risk on S and the δ term. Remark 1. Recall that πC := NC/N, N1 ≥ N2 ≥ * * * ≥ NC. Hence, this lemma reveals how the model performance depends on the imbalance degree of the data. 4 As shown in Sec.2.2, the fine-grained analysis is unavailable due to the global nature of the classic Lipschitz continuous property. In view of this, we extend this traditional definition with a local technique [23]: Definition 2 (Local Lipschitz Continuity). We say the loss function L(f, y) is local Lipschitz contin- uous with constants {μy}C y=1 if for any f, f ′ ∈ F, y ∈ Y, x ∈ Sy, |L(f, y) − L(f ′, y)| ≤ μy * ∥f (x) − f ′(x)∥. (12) Then, the following data-dependent contraction inequality helps us obtain a sharper bound, whose proof is given in Appendix C. Assumption 1. Next, we assume that ˆCS (F) ∼ O(1/ N ). Note that this result holds for kernel- based models with traditional techniques [19] and neural networks with the latest techniques [24, 25]. And the prior arts also adopt this assumption [12]. √ Lemma 3 (Data-Dependent Contraction). Assume that the loss function L(f, x) is local Lipschitz continuous with constants {μy}C y=1. Then, the following inequality holds under Asm.1: ˆCS (G) ≾ ˆCS (F) √ μy πy, C (cid:88) y=1 (13) Combining Lem.2 and Lem.3, we have the following theorem: Theorem 1 (Data-Dependent Bound for Imbalanced Learning). Given the function set F and a loss function L : RC × Y → [0, M ], for any δ ∈ (0, 1), with probability at least 1 − δ over the training set S, the following generalization bound holds for all f ∈ F: RL bal(f ) ≾ Φ(L, δ) + ˆCS (F) CπC C (cid:88) y=1 √ μy πy. (14) At the first glance, Eq.(14) seems a little loose since (cid:80)C πy > 1. In fact, this intuition holds when local Lipschitz continuity degenerates to Def.1. However, when μy is decreasing w.r.t. πy, a shaper bound might be available. To build an intuitive understanding, we present the following proposition, whose proof can be found in Appendix D. Proposition 2. Assume that μy ∝ N −κ presented in Thm.1 is sharper than the union bound defined in Prop.1. , κ > 0. Then, when κ > 1, the data-dependent bound y=1 y √ 3.2 Application to the VS Loss Next, we apply Thm.1 to the VS loss to reveal the role of both re-weighting and logit-adjustment. To this end, it is necessary to analyze the local Lipschitz property of the VS loss, whose proof is presented in Appendix E. Lemma 4. Assume that the score function is bounded. Then, the VS loss is local Lipschitz continuous with constants {μy}C y=1, where μy = αy ̃βy [1 − softmax (βyBy(f ) + ∆y)] , (15) (cid:114) (cid:16)(cid:80) (cid:17)2 β2 y + y′̸=y βy′ ; softmax (*) denotes the softmax function; By(f ) denotes the minimal ̃βy := prediction on the ground-truth class y, i.e., By(f ) := minx∈Sy f (x)y. Remark 2. By(f ) is closely related to the minimal margin defined by margin↓ y := minx∈Sy (f (x)y − maxj̸=y f (x)j). It is not difficult to check that By(f ) − margin↓ y ≤ maxx∈Sy,j̸=y f (x)j. Hence, as we improve the model performance on class y, the RHS of the above inequality, i.e., the gap between By(f ) and margin↓ y will decrease, and both the minimal margin and By(f ) will increase. Then, combining Thm.1 and Lem.4, we have the following proposition, which reveals how the existing loss-oriented methods improve generalization performance by exploiting the data priors. 5 Proposition 3 (Data-Dependent Bound for the VS Loss). Given the function set F and the VS loss LVS, for any δ ∈ (0, 1), with probability at least 1 − δ over the training set S, the following generalization bound holds for all f ∈ F: RL bal(f ) ≾ Φ(LVS, δ) + ˆCS (F) CπC C (cid:88) y=1 √ αy ̃βy πy [1 − softmax (βyBy(f ) + ∆y)] . (16) From Eq.(16), we have the following insights, whose empirical validation can be found in Sec.4.2. πy and By(f ), the (In1) Why re-weighting and logit-adjustment are necessary? Due to the term generalization bound is also imbalanced among classes. Both re-weighting and logit-adjustment can πy obtain a sharper generalization bound by assigning different weights to the classes with different and By(f ). In this process, αy mainly rebalances the generalization performance among classes, i.e., √ πy, while βy and ∆y focus on adjusting the imbalance of the terms By(f ) among classes. √ √ (In2) Why the deferred scheme is necessary? As pointed out in [11, 17], weighting up the minority classes will cause difficulties and instability in optimization, especially when the distribution is extremely imbalanced. To fix this issue, Cao et al. [12] develops a deferred scheme, where αy = 1 and (1 − p)/(1 − pNy ), p ∈ (0, 1) during the initial and terminal phase of training, respectively. Although this scheme shows significant improvement, there is still a lack of theoretical explanation. Fortunately, Prop.3 can give us some inspiration. Specifically, although a weighted loss can boost the optimization on the minority classes, it is harmful to the further improvement on the majority classes, as shown in Fig.3. Hence, the majority/minority classes will have relatively small/large By(f ) respectively, and the generalization bound becomes even looser. By contrast, in the DRW scheme, we have αy = 1 during the initial phase of training. Such a warm-up phase will encourage the model to focus on the majority classes and induce a small By(f ) for both majority and minority classes after weighting up the minority classes. On top of this, the generalization bound can become sharper, which explains the effectiveness of the deferred scheme. (In3) How does our result explain the design of existing losses? On one hand, for re-weighting losses, αy should decrease as πy increases, which is consistent with the balanced loss with αy = π−1 [10] and αy = (1−p)/(1−pNy ), p ∈ (0, 1) [11]. On the other hand, from the insight (In2), we know that when αy = 1, By(f ) will be increasing w.r.t. πy. Hence, for logit-adjustment losses, both βy and ∆y should increase as πy increases. This insight is consistent with the LDAM loss (∆y ∝ −N −1/4 ) [12], the logit-adjusted loss (∆y = τ log πy) [13], and the CDT loss (βy = (Ny/N1)γ) [14]. (In4) Are re-weigting and logit-adjustment fully compatible? (a) Unfortunately, the answer is negative. To be specific, the re-weighting term αy is decreasing w.r.t. πy, whereas the multiplicative logit-adjustment term βy is increasing w.r.t. πy. As a result, ̃βy will weaken the effect of αy. (b) Fortunately, αy is compatible with the additive logit-adjustment term ∆y since both terms can induce a sharper generalization bound. y y 3.3 Principled Learning Algorithm induced by the Theoretical Insights In this part, we present a principled learning algorithm induced by the theoretical insights in Sec.3.2. First, according to (In1)-(In3), it is crucial to comprehensively utilize re-weighting, logit-adjustment, and the DRW scheme, as they all contribute to improving the generalization bound. Second, according to (In4), we propose a Truncated Logit-Adjustment (TLA) scheme to avoid the conflict between αy and βy. In this scheme, βy still increases w.r.t. πy during the initial phase of training but is truncated to 1 during the terminal phase of training. Third, we set αy ∝ π−ν πy, which we name Aligned DRW (ADRW). Note that such a re-weighting scheme also follows the Fisher consistency property presented in [13]. Finally, the overall algorithm is summarized in Alg.1, where the logit-adjustment methods mentioned in Sec.2.1 are all reasonable options for βy, ∆y in the line 5 and ∆y in the line 7. y , ν > 0 to align αy with √ 6 Algorithm 1: Principled Learning Algorithm induced by the Theoretical Insights Require: Training set S = {(xi, yi)}N 1: Initialize the model parameters Θ randomly. 2: for t = 1, 2, * * * , T do i=1 and a model f parameterized by Θ. 3: 4: 5: 6: 7: 8: B ← SampleMiniBatch(S, m) if t < T0 then Set α = 1, βy, ∆y else Set αy ∝ π−ν y , βy = 1, ∆y, ν > 0 end if L(f, B) ← 1 m (cid:80) 9: 10: Θ ← Θ − η∇ΘL(f, B) 11: 12: end for Optional: anneal the learning rate η. (x,y)∈B LVS(f (x), y) ▷ A mini-batch of m samples ▷ Adjust logits during the initial phase ▷ TLA and ADRW ▷ Calculate the loss ▷ One SGD step ▷ Required when t = T0 (a) CIFAR-10 LT (b) CIFAR-10 Step (c) CIFAR-100 LT (d) CIFAR-100 Step Figure 1: The balanced accuracy of the CE loss and the LDAM loss w.r.t. αy ∝ π−ν y on the CIFAR datasets, where the imbalance ratio ρ = 100. Both re-weighting and logit-adjustment boost the model performance, which is consistent with the theoretical insight (In1) and (In4-b). (a) CIFAR-10 LT (b) CIFAR-10 Step Figure 2: Sensitivity analysis of VS+ADRW w.r.t. αy ∝ π−ν and ∆y = τ log πy on the CIFAR-10 dataset, where the imbalance ratio ρ = 100. Both re-weighting and logit-adjustment boost the model performance, which is consistent with the theoretical insights (In1) and (In4-b). y 4 Experiments 4.1 Experiment Protocols Here, we briefly introduce the experiment protocols, and more details can be found in Appendix F. Datasets. We conduct the experiments on four popular benchmark datasets for imbalanced learning. (a) CIFAR-10 and CIFAR-100: Following the protocol in [26, 11, 12], we consider two types of imbalance: long-tailed imbalance (LT) and step imbalance (Step). For both imbalance types, we 7 (a) CIFAR-100 LT (ρ = 100) (b) CIFAR-100 LT (ρ = 100) (c) CIFAR-100 LT (ρ = 100) Figure 3: (a) Training accuracy of CE+DRW (T0 = 160) and the CB loss w.r.t. training epoch. (b) (cid:100)Accmin/(cid:100)Accmaj w.r.t. the DRW epoch T0, where (cid:100)Accmin and (cid:100)Accmaj denote the training accuracy of the best model on the minority/majority classes, respectively. (c) The test accuracy of the best model w.r.t. the DRW epoch T0. We can find that the DRW scheme balances the training accuracy between the majority classes and the minority classes and thus improves the model performance on the test set, which is consistent with the theoretical insight (In2). (a) CIFAR-10 LT (b) CIFAR-10 Step (c) CIFAR-100 LT (d) CIFAR-100 Step Figure 4: The balanced accuracy of the VS loss w.r.t. βy = (Ny/N1)γ on the CIFAR datasets, where the imbalance ratio ρ = 10. We can find that VS+DRW performs inferior to VS+None, especially when γ is large, which is consistent with the theoretical insight (In4-a). report the balanced accuracy averaged over 5 random seeds with an imbalance ratio ρ := N1/NC ∈ {10, 100}. (b) ImageNet-LT and iNaturalist: We use the long-tailed version of the ImageNet dataset2 [2] proposed by [27], and iNaturalist3 [5] is a real-world long-tailed dataset. Baselines and Competitors. For the CIFAR datasets, we aim to validate the theoretical results and the performance gain induced by the proposed method. Hence, we select the following baselines: the CE loss (CE) [19], the LDAM loss (LDAM) [12], LDAM+DRW [12], and the VS loss (VS) [16] that generalizes the LA loss [13] and the CDT loss [14]. We tune all the hyperparameters according to the suggestions in the original papers. For the ImageNet-LT and iNaturalist datasets, we select state-of-the-art methods, listed in Tab.2, as the competitors to validate the effectiveness of the method. Implementation Details. We implement three instances of the proposed learning algorithm: the CE loss equipped with the ADRW scheme (CE+ADRW), the LDAM loss equipped with the ADRW scheme (LDAM+ADRW), and the VS loss equipped with the TLA and the ADRW scheme (VS+TLA+ADRW). We tune the hyperparameter ν, and the other hyperparameters follow those used in the baselines. In addition, we incorporate the Sharpness-Aware Minimization (SAM) technique [28] to facilitate the optimization of the minority classes, allowing them to escape saddle points and converge to flat minima [29]. 4.2 Theory Validation In this part, we aim to validate our theoretical insights presented in Sec.3.2 on the CIFAR datasets. Some more empirical results can be found in Appendix G. 1https://www.cs.toronto.edu/~kriz/cifar.html. Licensed MIT. 2https://image-net.org/index.php. Licensed MIT. 3https://github.com/visipedia/inat_comp/tree/master/2017. Licensed MIT. 8 Table 1: The balanced accuracy averaged over 5 random seeds on the CIFAR datasets. The best and the runner-up method for each protocol are marked with red and blue, respectively. The best baseline model is marked with underline. Dataset CIFAR-10 CIFAR-100 Imbalance Type LT Step LT Step Imbalance Ratio 100 10 100 10 100 10 100 10 CE LDAM VS CE+DRW LDAM+DRW VS+DRW 71.5±0.4 73.8±0.4 78.8±0.2 75.8±0.3 77.7±0.4 80.1±0.1 CE+ADRW 78.6±0.5 LDAM+ADRW 79.1±0.2 VS+TLA+DRW 80.8±0.2 VS+TLA+ADRW 81.1±0.2 CE+DRW LDAM+DRW VS 80.5±0.2 81.6±0.2 82.6±0.2 CE+ADRW 82.6±0.2 83.0±0.1 LDAM+ADRW VS+TLA+ADRW 83.6±0.2 87.0±0.2 86.4±0.4 88.7±0.1 87.9±0.3 87.5±0.2 88.6±0.1 88.2±0.3 87.6±0.2 88.8±0.1 89.0±0.2 89.8±0.2 89.4±0.2 90.0±0.1 90.1±0.1 89.7±0.1 90.3±0.2 w/o SAM 64.8±0.9 65.8±0.6 76.1±0.7 72.2±0.8 77.8±0.5 78.2±0.2 75.5±0.6 78.5±0.4 80.0±0.1 80.9±0.2 85.1±0.3 85.0±0.3 88.3±0.1 88.0±0.3 87.8±0.3 88.1±0.1 88.5±0.2 88.1±0.2 89.2±0.1 89.3±0.1 w/ SAM 79.5±0.3 81.2±0.7 83.2±0.4 82.8±0.9 82.4±0.3 83.8±0.1 90.2±0.2 89.4±0.1 90.5±0.1 90.2±0.3 90.0±0.2 90.8±0.1 38.3±0.4 39.9±0.7 41.8±0.7 40.8±0.6 42.7±0.5 41.3±0.4 41.8±0.6 43.0±0.2 43.0±0.4 43.4±0.6 44.7±0.6 45.2±0.3 45.9±0.3 44.9±0.6 46.3±0.4 46.4±0.6 56.7±0.4 55.7±0.5 58.4±0.2 58.1±0.3 57.5±0.3 57.6±0.3 58.3±0.4 58.0±0.1 58.9±0.1 59.2±0.2 60.7±0.4 59.9±0.2 61.0±0.3 61.0±0.4 60.3±0.3 61.9±0.3 38.6±0.2 39.2±0.0 46.2±0.3 45.4±0.4 45.3±0.6 44.0±0.3 46.5±0.3 45.8±0.2 46.8±0.1 47.8±0.1 48.5±0.3 49.1±0.2 47.4±0.3 48.9±0.2 49.3±0.4 49.1±0.2 54.4±0.3 50.5±0.2 59.9±0.2 59.1±0.3 56.9±0.2 58.0±0.3 59.2±0.3 57.6±0.3 60.0±0.3 60.5±0.3 61.7±0.2 59.3±0.2 61.6±0.3 62.1±0.2 60.3±0.2 62.3±0.3 Validation of (In1) and (In4-b). We report the model performance of the baselines w.r.t. the hyperparameters in Fig.1 and Fig.2. From these results, we can find that (1) Both CE+ADRW and LDAM perform better than CE. In other words, either re-weighting or logit-adjustment can boost the model performance. (2) LDAM+ADRW outperforms both CE+ADRW and LDAM, and for VS+ADRW, increasing the hyperparameters ν and τ appropriately can also bring performance gains. All these results validate the compatibility between re-weighting and the additive logit-adjustment. Validation of (In2). We present a series of results in Fig.3, where the training accuracy of different classes represents the corresponding Bf (y). To be specific, Fig.3(a) demonstrates the trend of training accuracy on the majority classes and the minority classes. For the CB loss, the learning process only focuses on the minority classes and hinders the performance improvement on the majority classes (CB Major v.s. CB Minor). Hence, an extremely imbalanced By(f ) induces a poor generalization performance. By contrast, the DRW scheme first focuses on the majority classes (CE+DRW Major v.s. CE+DRW Minor with the training epoch t ≤ T0 = 160) and then pays more attention to the minority classes during the terminal phase of training (CE+DRW Major v.s. CE+DRW Minor with the training epoch t > T0 = 160). Benefiting from the DRW scheme, both the majority classes and the minority classes are well-trained and thus have a balanced term By(f ) (Fig.3(b)), leading to a corresponding improvement on the test accuracy (Fig.3(c)). Even if we remove the re-weighting term (CE+None), the imbalance degree of By(f ) is still consistent with the test performance. Note that the learning rate of CE+None is also decreased at the corresponding epoch T0, making the line in Figure 3(b) and 3(c) not constant. Validation of (In4-a). the hyperparameter of the multiplicative logit-adjustment γ. We can find that VS+DRW performs inferior to VS, especially when γ is large. This phenomenon validates the incompatibility between re-weighting and multiplicative logit-adjustment. In Fig.4, we present the model performance of the VS loss w.r.t. 4.3 Performance Comparison We report the empirical results on the CIFAR datasets in Tab.1, where the imbalance ratio ρ ∈ {10, 100}. From these results, we have the following observations: (1) The proposed learning algorithm consistently outperforms the baselines, especially when the dataset is more imbalanced. 9 Table 2: The balanced accuracy on the ImageNet-LT and iNaturalist datasets. Method One stage ImageNet-LT Few Many Med. iNaturalist All Many Med. OLTR [27] LFMR [30] BBN [31] cRT [32] τ -norm [32] DiVE [33] DisAlign [34] WB [35] CE [32] CE+CB [11] Focal [11] De-confound [36] DRO-LT [37] SAM [29] Ours × × × × × × × × ✓ ✓ ✓ ✓ ✓ ✓ ✓ 43.2 47.1 - 61.8 59.1 64.1 61.3 62.5 65.9 39.6 36.4 62.7 64.0 62.0 62.9 35.1 35.0 - 46.2 46.9 50.4 52.2 50.4 37.5 32.7 29.9 48.8 49.8 52.1 52.6 18.5 17.5 - 27.3 30.7 31.5 31.4 41.5 7.7 16.8 16.0 31.6 33.1 34.8 37.1 35.6 37.2 - 49.6 49.4 53.1 52.9 53.9 44.4 33.2 30.5 51.8 53.5 53.1 54.1 59.0 - 49.4 69.0 65.6 70.6 69.0 71.2 72.2 53.4 - - - 64.1 64.7 64.1 - 70.8 66.0 65.3 70.0 71.1 70.4 63.0 54.8 - - - 70.5 70.7 Few 64.9 - 65.3 63.2 65.5 67.6 70.2 69.7 57.2 53.2 - - - 71.2 72.1 All 63.9 - 66.3 65.2 65.6 69.1 70.6 70.2 61.7 54.0 61.1 - 69.7 70.1 70.7 Such performance gains validate the effectiveness of the proposed methods (2) Both re-weighting and logit-adjustment can improve the model performance, which is consistent with the theoretical insight (In1) and (In4-b). (3) When ρ = 10 or on the CIFAR-100 dataset, VS+DRW performs inferior to VS. Fortunately, when equipped with the proposed TLA scheme, VS+TLA+DRW outperforms both VS and VS+DRW. These results again validate our theoretical insight (In4-a). (4) When ρ = 10, CE+ADRW outperforms LDAM+ADRW, and similar counter-intuitive phenomena are also observed in [29]. We conjecture that in this case, re-weighting is enough to rebalance the generalization bound, and the additional LDAM loss might induce other issues such as inconsistency. We present the overall balanced accuracy on the ImageNet-LT and iNaturalist datasets in Tab.2, where SAM and Ours denotes LDAM+DRW+SAM and VS+TLA+ADRW+SAM, respectively. These results demonstrate that the proposed learning algorithm outperforms the competitors, especially the one-stage ones, which again confirms the effectiveness of the proposed learning algorithm. 5 Conclusion and Future Work In this work, with the proposed local Lipschitz property and the data-dependent contraction technique, we present a unified generalization analysis of the loss-modification approaches for imbalanced learning. Benefiting from this fine-grained analysis, we not only reveal the role of both re-weighting and logit-adjustment approaches but also explain some empirical phenomena that are out of the scope of existing theories. Moreover, a principled learning algorithm is proposed based on the theoretical insights. Finally, extensive experimental results on benchmark datasets validate our theoretical analysis and the effectiveness of the proposed method. Theoretically, one important future work is to provide a systematical Fisher consistency analysis for the VS loss, providing more insights to design re-weighting and logit-adjustment terms. Method- ologically, it might be a promising direction to design an adaptive scheme that can automatically determine the hyperparameters of the learning algorithm. Acknowledgments This work was supported in part by the National Key R&D Program of China under Grant 2018AAA0102000, in part by National Natural Science Foundation of China: 62236008, U21B2038, U2001202, 61931008, 6212200758 and 61976202, in part by the Fundamental Research Funds for the Central Universities, in part by Youth Innovation Promotion Association CAS, in part by the Strategic Priority Research Program of Chinese Academy of Sciences (Grant No. XDB28000000) and in part by the Innovation Funding of ICT, CAS under Grant No. E000000. 10 References [1] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. pages 1–60, 2009. [2] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael S. Bernstein, Alexander C. Berg, and Li Fei- Fei. Imagenet large scale visual recognition challenge. Int. J. Comput. Vis., 115:211–252, 2015. [3] Mark Everingham, Luc Van Gool, Christopher K. I. Williams, John M. Winn, and Andrew Zisserman. The pascal visual object classes (VOC) challenge. Int. J. Comput. Vis., 88:303–338, 2010. [4] Tsung-Yi Lin, Michael Maire, Serge J. Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C. Lawrence Zitnick. Microsoft COCO: common objects in context. In European Conference on Computer Vision, pages 740–755, 2014. [5] Grant Van Horn, Oisin Mac Aodha, Yang Song, Yin Cui, Chen Sun, Alexander Shepard, Hartwig Adam, Pietro Perona, and Serge J. Belongie. The inaturalist species classification and detection dataset. In IEEE Conference on Computer Vision and Pattern Recognition, pages 8769–8778, 2018. [6] Haibo He and Edwardo A. Garcia. Learning from imbalanced data. IEEE Trans. Knowl. Data Eng., 21:1263–1284, 2009. [7] Grant Van Horn and Pietro Perona. The devil is in the tails: Fine-grained classification in the wild. CoRR, abs/1709.01450, 2017. [8] Kemal Oksuz, Baris Can Cam, Sinan Kalkan, and Emre Akbas. Imbalance problems in object detection: A review. IEEE Trans. Pattern Anal. Mach. Intell., 43:3388–3415, 2021. [9] Yifan Zhang, Bingyi Kang, Bryan Hooi, Shuicheng Yan, and Jiashi Feng. Deep long-tailed learning: A survey. CoRR, abs/2110.04596, 2021. [10] Katharina Morik, Peter Brockhausen, and Thorsten Joachims. Combining statistical learning with a knowledge-based approach - A case study in intensive care monitoring. In International Conference on Machine Learning, pages 268–277, 1999. [11] Yin Cui, Menglin Jia, Tsung-Yi Lin, Yang Song, and Serge J. Belongie. Class-balanced loss based on effective number of samples. In IEEE Conference on Computer Vision and Pattern Recognition, pages 9268–9277, 2019. [12] Kaidi Cao, Colin Wei, Adrien Gaidon, Nikos Aréchiga, and Tengyu Ma. Learning imbalanced datasets with label-distribution-aware margin loss. In Annual Conference on Neural Information Processing Systems, pages 1565–1576, 2019. [13] Aditya Krishna Menon, Sadeep Jayasumana, Ankit Singh Rawat, Himanshu Jain, Andreas Veit, and Sanjiv Kumar. Long-tail learning via logit adjustment. In International Conference on Learning Representations, 2021. [14] Han-Jia Ye, Hong-You Chen, De-Chuan Zhan, and Wei-Lun Chao. Identifying and compensat- ing for feature deviation in imbalanced deep learning. CoRR, abs/2001.01385, 2020. [15] Jingru Tan, Changbao Wang, Buyu Li, Quanquan Li, Wanli Ouyang, Changqing Yin, and Junjie Yan. Equalization loss for long-tailed object recognition. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11659–11668, 2020. [16] Ganesh Ramachandra Kini, Orestis Paraskevas, Samet Oymak, and Christos Thrampoulidis. Label-imbalanced and group-sensitive classification under overparameterization. In Annual Conference on Neural Information Processing Systems, pages 18970–18983, 2021. [17] Chen Huang, Yining Li, Chen Change Loy, and Xiaoou Tang. Learning deep representation for imbalanced classification. In IEEE Conference on Computer Vision and Pattern Recognition, pages 5375–5384, 2016. 11 [18] Jiawei Ren, Cunjun Yu, Shunan Sheng, Xiao Ma, Haiyu Zhao, Shuai Yi, and Hongsheng Li. Balanced meta-softmax for long-tailed visual recognition. In Annual Conference on Neural Information Processing Systems, 2020. [19] Mehryar Mohri, Afshin Rostamizadeh, and Ameet Talwalkar. Foundations of Machine Learning. The MIT Press, 2012. [20] Michel Ledoux and Michel Talagrand. Probability in Banach Spaces: isoperimetry and processes, volume 23. Springer Science & Business Media, 1991. [21] Aditya Krishna Menon, Harikrishna Narasimhan, Shivani Agarwal, and Sanjay Chawla. On the statistical consistency of algorithms for binary classification under class imbalance. In International Conference on Machine Learning, pages 603–611, 2013. [22] Sham M. Kakade, Karthik Sridharan, and Ambuj Tewari. On the complexity of linear prediction: Risk bounds, margin bounds, and regularization. In Annual Conference on Neural Information Processing Systems, pages 793–800, 2008. [23] Peter L. Bartlett, Olivier Bousquet, and Shahar Mendelson. Localized rademacher complexities. In Annual Conference on Computational Learning Theory, pages 44–58, 2002. [24] Noah Golowich, Alexander Rakhlin, and Ohad Shamir. Size-independent sample complexity of neural networks. In Conference On Learning Theory, pages 297–299, 2018. [25] Philip M. Long and Hanie Sedghi. Generalization bounds for deep convolutional neural networks. In International Conference on Learning Representations, 2020. [26] Mateusz Buda, Atsuto Maki, and Maciej A. Mazurowski. A systematic study of the class imbalance problem in convolutional neural networks. Neural Networks, 106:249–259, 2018. [27] Ziwei Liu, Zhongqi Miao, Xiaohang Zhan, Jiayun Wang, Boqing Gong, and Stella X. Yu. Large-scale long-tailed recognition in an open world. In IEEE Conference on Computer Vision and Pattern Recognition, pages 2537–2546, 2019. [28] Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware min- imization for efficiently improving generalization. In International Conference on Learning Representations, 2021. [29] Harsh Rangwani, Sumukh K. Aithal, Mayank Mishra, and R. Venkatesh Babu. Escaping saddle points for effective generalization on class-imbalanced data. In Advances in Neural Information Processing Systems, pages 22791–22805, 2022. [30] Liuyu Xiang, Guiguang Ding, and Jungong Han. Learning from multiple experts: Self-paced knowledge distillation for long-tailed classification. In European Conference on Computer Vision, pages 247–263, 2020. [31] Boyan Zhou, Quan Cui, Xiu-Shen Wei, and Zhao-Min Chen. BBN: bilateral-branch network In IEEE/CVF Conference on with cumulative learning for long-tailed visual recognition. Computer Vision and Pattern Recognition, pages 9716–9725, 2020. [32] Bingyi Kang, Saining Xie, Marcus Rohrbach, Zhicheng Yan, Albert Gordo, Jiashi Feng, and Yannis Kalantidis. Decoupling representation and classifier for long-tailed recognition. In International Conference on Learning Representations, 2020. [33] Yin-Yin He, Jianxin Wu, and Xiu-Shen Wei. Distilling virtual examples for long-tailed recogni- tion. In IEEE/CVF International Conference on Computer Vision, pages 235–244, 2021. [34] Songyang Zhang, Zeming Li, Shipeng Yan, Xuming He, and Jian Sun. Distribution alignment: A unified framework for long-tail visual recognition. In IEEE Conference on Computer Vision and Pattern Recognition, pages 2361–2370, 2021. [35] Shaden Alshammari, Yu-Xiong Wang, Deva Ramanan, and Shu Kong. Long-tailed recognition via weight balancing. In IEEE/CVF Conference on Computer Vision and Pattern Recognition,, pages 6887–6897, 2022. 12 [36] Kaihua Tang, Jianqiang Huang, and Hanwang Zhang. Long-tailed classification by keeping the good and removing the bad momentum causal effect. In Annual Conference on Neural Information Processing Systems, 2020. [37] Dvir Samuel and Gal Chechik. Distributional robustness loss for long-tail learning. In IEEE/CVF International Conference on Computer Vision, pages 9475–9484, 2021. [38] Lu Yang, He Jiang, Qing Song, and Jun Guo. A survey on long-tailed visual recognition. Int. J. Comput. Vis., 130:1837–1872, 2022. [39] Miroslav Kubat and Stan Matwin. Addressing the curse of imbalanced training sets: One-sided selection. In International Conference on Machine Learning, pages 179–186, 1997. [40] Nitesh V Chawla, Kevin W Bowyer, Lawrence O Hall, and W Philip Kegelmeyer. Smote: synthetic minority over-sampling technique. Journal of artificial intelligence research, 16: 321–357, 2002. [41] Inderjeet Mani and I Zhang. knn approach to unbalanced data distributions: a case study involv- ing information extraction. In Workshop on Learning from Imbalanced Datasets, International Conference on Machine Learning, pages 1–7, 2003. [42] Chris Drummond, Robert C Holte, et al. C4. 5, class imbalance, and cost sensitivity: why under-sampling beats over-sampling. In Workshop on Learning from Imbalanced Datasets II, International Conference on Machine Learning, pages 1–8, 2003. [43] Justin M. Johnson and Taghi M. Khoshgoftaar. Survey on deep learning with class imbalance. J. Big Data, 6:27, 2019. [44] Guillem Collell, Drazen Prelec, and Kaustubh R. Patil. Reviving threshold-moving: a simple plug-in bagging ensemble for binary and multiclass imbalanced data. CoRR, abs/1606.08698, 2016. [45] Jiarui Cai, Yizhou Wang, and Jenq-Neng Hwang. ACE: ally complementary experts for solving long-tailed recognition in one-shot. In IEEE/CVF International Conference on Computer Vision, pages 112–121, 2021. [46] Xudong Wang, Long Lian, Zhongqi Miao, Ziwei Liu, and Stella X. Yu. Long-tailed recogni- tion by routing diverse distribution-aware experts. In International Conference on Learning Representations, 2021. [47] Jiequan Cui, Zhisheng Zhong, Shu Liu, Bei Yu, and Jiaya Jia. Parametric contrastive learning. In IEEE/CVF International Conference on Computer Vision, pages 695–704, 2021. [48] Zhisheng Zhong, Jiequan Cui, Shu Liu, and Jiaya Jia. Improving calibration for long-tailed recognition. In IEEE Conference on Computer Vision and Pattern Recognition, pages 16489– 16498, 2021. [49] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition, pages 770–778, 2016. [50] Ilya Sutskever, James Martens, George E. Dahl, and Geoffrey E. Hinton. On the importance of initialization and momentum in deep learning. In International Conference on Machine Learning, pages 1139–1147, 2013. [51] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Köpf, Edward Z. Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems, pages 8024–8035, 2019. 13 [52] Charles R. Harris, K. Jarrod Millman, Stéfan van der Walt, Ralf Gommers, Pauli Virtanen, David Cournapeau, Eric Wieser, Julian Taylor, Sebastian Berg, Nathaniel J. Smith, Robert Kern, Matti Picus, Stephan Hoyer, Marten H. van Kerkwijk, Matthew Brett, Allan Haldane, Jaime Fer- nández del Río, Mark Wiebe, Pearu Peterson, Pierre Gérard-Marchant, Kevin Sheppard, Tyler Reddy, Warren Weckesser, Hameer Abbasi, Christoph Gohlke, and Travis E. Oliphant. Array programming with numpy. Nat., 585:357–362, 2020. [53] Fabian Pedregosa, Gaël Varoquaux, Alexandre Gramfort, Vincent Michel, Bertrand Thirion, Olivier Grisel, Mathieu Blondel, Peter Prettenhofer, Ron Weiss, Vincent Dubourg, Jake Vander- Plas, Alexandre Passos, David Cournapeau, Matthieu Brucher, Matthieu Perrot, and Edouard Duchesnay. Scikit-learn: Machine learning in python. J. Mach. Learn. Res., 12:2825–2830, 2011. [54] Sébastien Marcel and Yann Rodriguez. Torchvision the machine-vision package of torch. In Proceedings of the 18th International Conference on Multimedia 2010, Firenze, Italy, October 25-29, 2010, pages 1485–1488, 2010. 14 Appendix A Related Work In the main text, we have discussed loss-oriented methods for imbalanced learning. Next, we will briefly review the other orthogonal directions in this field, and more details can be found in the latest survey [38]. Data-oriented methods aim to resample the training set to achieve a more balanced data distribution. For example, Kubat and Matwin [39] and Chawla et al. [40] over-sample the minority classes, and Mani and Zhang [41] and Drummond et al. [42] under-sample the majority classes. Although being intuitive, over-sampling might suffer from over-fiiting, and under-sampling reduces the total amount of information that the model can learn from [43]. Post-hoc methods follow a naïve training process but make adjustments during the test phase. For example, Collell et al. [44] calibrate the decision-making condition via data priors. Kang et al. [32] propose to balance the the classifier weights via τ -normalization. Menon et al. [13] adjust the logits such that the predictions can align with the balanced accuracy. Decoupling methods follow a two-stage learning paradigm. The first stage aims to learning features based on a naïve learning process. At the second stage, Kang et al. [32] retrain the classifier under a balanced label distribution; Alshammari et al. [35] exploit L2-normalization, weight decay, and maxNorm constraint to achieve balanced classifier weights. Ensemble methods aggregate multiple expert models trained on different data regimes. For example, Cai et al. [45] distribute diverse but overlapping class splits for experts and encourage each expert to learn complementary knowledge. Wang et al. [46] propose a dynamic routing framework that reduces model variance and model bias to mitigate the performance degeneration on majority classes. Besides, Zhou et al. [31] propose a cumulative learning strategy that first learns the universal patterns and then pays attention to the minority classes gradually. Besides, Tang et al. [36] propose a causal inference framework to remove unfavorable GSD momen- tum. Cui et al. [47] exploit contrastive learning to make full use of aggressive data augmentation techniques. Rangwani et al. [29] utilize Sharpness-Aware Minimization (SAM) technique to boost the optimization of the minority classes, allowing them to escape saddle points and converge to flat minima. B Proof of the Basic Lemma (Lem.2) Lemma 2. Given the function set F and a loss function L : RC × Y → [0, M ], then for any δ ∈ (0, 1), with probability at least 1 − δ over the training set S, the following generalization bound holds for all g ∈ G: RL bal(f ) ≾ Φ(L, δ) + 1 CπC * ˆCS (G), (11) where Φ(L, δ) := 1 CπC [ (cid:98)RL(f ) + 3M (cid:113) log 2/δ 2N ] contains the empirical risk on S and the δ term. Proof. On one hand, RL(f ) = E [L(f (x), y)] = (x,y)∼D C (cid:88) y=1 πy E x∼Dy [L(f (x), y)] = C (cid:88) j=1 πyRL y (f ). (17) On the other hand, RL bal(f ) = 1 C C (cid:88) j=1 RL y (f ) = 1 C C (cid:88) j=1 1 πy * πyRL y (f ) ≤ 1 CπC C (cid:88) j=1 πyRL y (f ) = 1 CπC RL(f ), (18) where the inequality comes from the fact that ∀a, b ∈ RC, | ⟨a, b⟩ | ≤ ∥a∥∞∥b∥1. Then, combining the traditional results in [19], for any δ ∈ (0, 1), with probability at least 1 − δ over the training set 15 S, the following generalization bound holds for all the g ∈ G: bal(f ) ≾ 1 RL CπC (cid:34) (cid:98)RL(f ) + ˆCS (G) + 3M (cid:114) (cid:35) . log 2/δ 2N (19) C Proof of the Data-Dependent Contraction Lemma (Lem.3) Lemma 3 (Data-Dependent Contraction). Assume that the loss function L(f, x) is local Lipschitz continuous with constants {μy}C y=1. Then, the following inequality holds under Asm.1: ˆCS (G) ≾ ˆCS (F) √ μy πy, C (cid:88) y=1 (13) Proof. According to the definition of complexity, we have (cid:34) ˆCS (G) = E ξ sup g∈G 1 N N (cid:88) n=1 (cid:35) ξ(n)g(z(n))  = E ξ sup g∈G 1 N C (cid:88) Ny (cid:88)  y g(z(n) ξ(n) y )  y=1 n=1  1 Ny  E ξy  y g(z(n) ξ(n) y )  (20) Ny (cid:88) n=1 sup g∈G ≤ = C (cid:88) y=1 C (cid:88) y=1   1 N E ξy Ny (cid:88) n=1 sup g∈G  y g(z(n) ξ(n) y )  = C (cid:88) y=1 Ny N πy ˆCSy (G) ≾ C (cid:88) √ y=1 πyμy ˆCS (F), where the last inequality comes from Asm.1. D Proof of Prop.2 Proposition 2. Assume that μy ∝ N −κ presented in Thm.1 is sharper than the union bound defined in Prop.1. y , κ > 0. Then, when κ > 1, the data-dependent bound Proof. According to Def.1, it is not difficult to obtain μ = maxy μy ∝ N −κ bound, we have C . Then, for the union μ C C (cid:88) y=1 ˆCSy (F) ∝ μ * ˆCS (F) C C (cid:88) y=1 π−0.5 y ∝ ˆCS (F) CN κ C C (cid:88) y=1 π−0.5 y = ˆCS (F) CN κπκ C C (cid:88) y=1 π−0.5 y , (21) where the first equality comes from Asm.1. For the data-dependent bound, we have ˆCS (F) CπC C (cid:88) y=1 √ μy πy ∝ ˆCS (F) CπC C (cid:88) y=1 √ N −κ y πy = ˆCS (F) CN κπC C (cid:88) y=1 π0.5−κ y . Let Then, we have h1(κ) := 1 πκ C C (cid:88) y=1 π−0.5 y − 1 πC C (cid:88) y=1 π0.5−κ y . h′ 1(κ) = − ln πC * = − ln πC * 1 πκ C 1 πκ C C (cid:88) y=1 C (cid:88) y=1 π−0.5 y + π−0.5 y + 1 πC 1 πC C (cid:88) y=1 C (cid:88) y=1 π0.5−κ y ln πy π−0.5 y . π1−κ y (cid:123)(cid:122) (cid:124) h2(πy) ln πy (cid:125) 16 (22) (23) (24) Then, let h2(t) = t1−κ ln t, t ∈ (0, 1). When κ > 1, we have 2(t) = (1 − κ)t−κ ln t + t1−κ * h′ 1 t = [(1 − κ) ln t + 1] t−κ > 0. (25) Thus, ∀y ∈ Y, h2(πy) ≥ h2(πC). Then, we have h′ 1(κ) ≥ − ln πC * 1 πκ C C (cid:88) y=1 π−0.5 y + 1 πC C (cid:88) y=1 π−0.5 y h2(πC) = 0. (26) Finally, the proof ends by the fact that h1(1) = 0. E Proof of the Local Lipschitz Property of the VS Loss (Prop.4) Lemma 5. Given {ai}C i=1, {bi}C i=1, if ai, bi ≥ 0, we have (cid:80)C i=1 a2 i b2 i ≤ (cid:16)(cid:80)C i=1 ai (cid:17)2 (cid:16)(cid:80)C i=1 bi (cid:17)2 . Proof. According to the definition, we have (cid:32) C (cid:88) (cid:33)2 (cid:32) C (cid:88) (cid:33)2 bi = ai   C (cid:88) i=1 i=1 i=1 a2 i + 2 (cid:88) i̸=j   aiaj   C (cid:88) i=1 b2 i + 2 (cid:88) i̸=j  bibj  C (cid:88) ≥ a2 i * C (cid:88) b2 i = i=1 i=1 C (cid:88) i=1 i b2 a2 i + j b2 a2 j ≥ (cid:88) i̸=j C (cid:88) i=1 i b2 a2 i . (27) Lemma 4. Assume that the score function is bounded. Then, the VS loss is local Lipschitz continuous with constants {μy}C y=1, where μy = αy ̃βy [1 − softmax (βyBy(f ) + ∆y)] , (15) (cid:114) (cid:16)(cid:80) (cid:17)2 β2 y + ̃βy := prediction on the ground-truth class y, i.e., By(f ) := minx∈Sy f (x)y. y′̸=y βy′ ; softmax (*) denotes the softmax function; By(f ) denotes the minimal Proof. According to the definition of the VS loss, we have LVS(f (x), y) = −αy log (cid:32) eβyf (x)y+∆y y′ eβy′ f (x)y′ +∆y′ (cid:80) (cid:33) = αy log[1 + (cid:88) y′̸=y eβy′ f (x)y′ −βyf (x)y+∆y′ −∆y ], Let s := f (x), and define ly(s) := (cid:88) y′̸=y eβy′ sy′ +∆y′ . In other words, LVS(f, y) = αy log (cid:2)1 + e−(βysy+∆y)ly(s)(cid:3). Then, ∂LVS(f, y) ∂sy ∂LVS(f, y) ∂sy′ = −αyβy = αyβy′ e−(βysy+∆y)ly(s) 1 + e−(βysy+∆y)ly(s) e−(βysy+∆y) 1 + e−(βysy+∆y)ly(s) , * eβy′ sy′ +∆y′ , y′ ̸= y. 17 (28) (29) (30) Hence, ∥∇sLVS(f, y)∥2 =  β2 yly(s)2 + (cid:88) y′̸=y (cid:0)βy′eβy′ sy′ +∆y′ (cid:1)2 (cid:20)   * αye−(βysy+∆y) 1 + e−(βysy+∆y)ly(s) (cid:21)2   (cid:88)  2  βy′   eβy′ sy′ +∆y′ (cid:88) y′̸=y 2     * (cid:20) αye−(βysy+∆y) 1 + e−(βysy+∆y)ly(s) (cid:21)2 (31)  β2  yly(s)2 +  β2  y +   (cid:88) y′̸=y ≤ = y′̸=y 2  βy′    * (cid:20) αye−(βysy+∆y)ly(s) 1 + e−(βysy+∆y)ly(s) (cid:21)2 , where the inequality comes from Lem.5. Thus, ∥∇sLVS(f, y)∥ ≤ αy (cid:118) (cid:117) (cid:117) (cid:117) (cid:116)β2 y +    2 (cid:88) βy′  y′̸=y e−(βysy+∆y)ly(s) 1 + e−(βysy+∆y)ly(s) (cid:118) (cid:117) (cid:117) (cid:117) (cid:116)β2 y +    2 (cid:88) βy′  = αy ly(s) eβysy+∆y + ly(s) y′̸=y (cid:118) (cid:117) (cid:117) (cid:117) (cid:116)β2 y +   (cid:88) y′̸=y (cid:118) (cid:117) (cid:117) (cid:117) (cid:116)β2 y +   (cid:88) y′̸=y = αy = αy (32)  2 (cid:34) βy′  1 − (cid:35) eβysy+∆y y′ eβy′ sy′ +∆y′ (cid:80)  2 βy′  [1 − softmax (βysy + ∆y)] Since the score function is bounded, for any y ∈ Y, there exists a constant By(f ) such that By(f ) = inf x∈Sy sy, which completes the proof. F More Experiment Protocols Datasets. We conduct experiments on four popular benchmark datasets for imbalanced learning. (a) CIFAR-10 LT and CIFAR-100 LT: The original version of CIFAR-101 and CIFAR-1001 [1] consists of 50,000 training images and 10,000 validation images, uniformly sampled from 10 and 100 classes, respectively. Following the protocol in [26, 11, 12], we consider two types of imbalance: long-tailed imbalance, where the number of training samples for each class decreases exponentially, and step imbalance, which reduces the sample size of half of the classes to a fixed ratio. Then, let ρ := N1/NC denote the imbalance ratio. For both imbalance types, we report the balanced accuracy averaged over 5 random seeds with ρ ∈ {10, 100}. (b) ImageNet-LT and iNaturalist: We use the long-tailed version of the ImageNet dataset2 [2] proposed by [27], which contains 115.8K images from 1K classes with N1 = 1280, NC = 5. iNaturalist3 [5] is a real-world long-tailed dataset with 437.5K images from 8,142 classes. Following the protocol in [48], the classes are split into three subsets under long-tailed imbalance: Head, Medium, and Tail. We report the balanced accuracy on all the classes and each subset. Backbones and Optimization Methods. For the CIFAR datasets, we follow the implementation in [12]. Specifically, we train the ResNet-32 model [49] for 200 epochs by SGD with a momentum of 0.9, a weight decay of 2e-4, and a bath size of 128 [50]. A multistep learning rate schedule is used with an initial learning rate of 0.1, divided by 10 at the 160th and 180th epoch by default. For the 1https://www.cs.toronto.edu/~kriz/cifar.html. Licensed MIT. 2https://image-net.org/index.php. Licensed MIT. 3https://github.com/visipedia/inat_comp/tree/master/2017. Licensed MIT. 18 (a) CIFAR-100 LT (b) CIFAR-100 Step Figure 5: Sensitivity analysis of VS+ADRW w.r.t. αy ∝ π−ν and ∆y = τ log πy on the CIFAR datasets, where the imbalance ratio ρ = 100. Both re-weighting and logit-adjustment boost the model performance, which is consistent with the theoretical insights (In1) and (In4-b). y (a) CIFAR-10 LT (ρ = 100) (b) CIFAR-10 LT (ρ = 100) (c) CIFAR-10 LT (ρ = 100) Figure 6: (a) Training accuracy of CE+DRW (T0 = 160) and the CB loss (αy = (1 − p)/(1 − pNy )). (b) The ratio of the training accuracy between the minority classes and the majority classes of the best model w.r.t. the DRW epoch T0. (c) The test accuracy of the best model w.r.t. the DRW epoch T0. We can find that the DRW scheme balances the training accuracy between the majority classes and the minority classes and thus improves the model performance on the test set, which is consistent with the theoretical insight (In2). ImageNet-LT and iNaturalist datasets, we follow the implementation in [48, 29], where the ResNet-50 model [49] is trained for 90 epochs by SGD with a momentum of 0.9, a weight decay of 2e-4, and a batch size of 256. A cosine learning rate schedule is used with an initial learning rate of 0.1 and 0.2 for ImageNet-LT and iNaturalist, respectively. In addition, we incorporate the Sharpness-Aware Minimization (SAM) technique [28, 29] to facilitate the optimization of the minority classes, allowing them to escape saddle points and converge to flat minima. And the hyperparameter of SAM is tuned as suggested in [29]. Infrastructure. The experiments on the CIFAR datasets are carried out on an Ubuntu server equipped with Nvidia(R) RTX 3090 GPUs, whereas the experiments on ImageNet-LT and iNaturalist are conducted on NVIDIA(R) A100 GPUs. We implement the codes via python (v-3.8.10), and the main third-party packages include pytorch (v-1.8.0) [51], numpy (v-1.20.2) [52], scikit-learn (v-1.0.2) [53] and torchvision (v-0.9.0) [54]. Parameter search. We first tune the parameters via grid search according to the results in prior arts [13, 16]. To be specific, αy ∝ π−ν y , and ν is searched in {0.15, 0.25, 0.75, 1.0, 2.0, 3.0}; ∆y = τ log πy, and τ is searched in {0.5, 0.75, 1.0, 1.25, 2.0}; βy = (Ny/N1)γ, and γ is searched in {0.05, 0.1, 0.15, 0.2, 0.25}. At first glance, the search space is relatively large. However, benefiting from the theoretical validation presented in Sec.4.2, the time complexity can be significantly decreased later. For example, according to Fig.4, we will choose a small γ when ν is large to avoid the incompatibility issue. 19 G More Empirical Results G.1 More Empirical Results for Theory Validation We present the sensitivity analysis of VS+ADRW on the CIFAR-100 dataset in Fig.5, where the imbalance ratio ρ = 100. Similar to the results on the CIFAR-10 dataset, appropriately increasing ν and τ can improve the model performance, which again validates the theoretical insights (In1) and (In4-b). Similar to Fig.3, Fig.6 provides a series of results on the CIFAR-10 dataset to validate the theoretical insight (In2). Once again, the imbalance of By(f ) is highly correlated with the model performance on the test set, not only for CE+DRW but also for CE+None. It is worth mentioning that the optimal DRW epoch T0 is 60, which is different from the commonly chosen value of 160. This might be because the CIFAR-10 dataset only has 10 classes, and a small DRW epoch T0 may lead to overfitting on the majority classes. In Fig.7-Fig.9, we provide the results under the imbalance ratio ρ = 10. The results are similar to those with ρ = 100, which again validates our theoretical results. (a) CIFAR-10 LT (b) CIFAR-10 Step (c) CIFAR-100 LT (d) CIFAR-100 Step Figure 7: The balanced accuracy of the CE loss and the LDAM loss w.r.t. αy ∝ π−ν y on the CIFAR datasets, where the imbalance ratio ρ = 10. Both re-weighting and logit-adjustment boost the model performance, which is consistent with the theoretical insight (In1) and (In4-b). (a) CIFAR-100 LT (b) CIFAR-10 LT Figure 8: Sensitivity analysis of VS+ADRW w.r.t. αy ∝ π−ν and ∆y = τ log πy on the CIFAR datasets, where the imbalance ratio ρ = 10. Both re-weighting and logit-adjustment boost the model performance, which is consistent with the theoretical insights (In1) and (In4-b). y 20 (a) CIFAR-100 LT (ρ = 10) (b) CIFAR-100 LT (ρ = 10) (c) CIFAR-100 LT (ρ = 10) (d) CIFAR-10 LT (ρ = 10) (e) CIFAR-10 LT (ρ = 10) (f) CIFAR-10 LT (ρ = 10) Figure 9: (a, d) Training accuracy of CE+DRW (T0 = 160) and the CB loss w.r.t. training epoch. (b, e) (cid:100)Accmin/(cid:100)Accmaj w.r.t. the DRW epoch T0, where (cid:100)Accmin and (cid:100)Accmaj denote the training accuracy of the best model on the minority/majority classes, respectively. (c, f) The test accuracy of the best model w.r.t. the DRW epoch T0. We can find that the DRW scheme balances the training accuracy between the majority classes and the minority classes and thus improves the model performance on the test set, which is consistent with the theoretical insight (In2). 21
http://arxiv.org/abs/2310.04750v2
"2023-10-10T03:22:31"
"2023-10-07T09:10:28"
DiffNAS: Bootstrapping Diffusion Models by Prompting for Better Architectures
Diffusion models have recently exhibited remarkable performance on synthetic data. After a diffusion path is selected, a base model, such as UNet, operates as a denoising autoencoder, primarily predicting noises that need to be eliminated step by step. Consequently, it is crucial to employ a model that aligns with the expected budgets to facilitate superior synthetic performance. In this paper, we meticulously analyze the diffusion model and engineer a base model search approach, denoted "DiffNAS". Specifically, we leverage GPT-4 as a supernet to expedite the search, supplemented with a search memory to enhance the results. Moreover, we employ RFID as a proxy to promptly rank the experimental outcomes produced by GPT-4. We also adopt a rapid-convergence training strategy to boost search efficiency. Rigorous experimentation corroborates that our algorithm can augment the search efficiency by 2 times under GPT-based scenarios, while also attaining a performance of 2.82 with 0.37 improvement in FID on CIFAR10 relative to the benchmark IDDPM algorithm.
[ "Wenhao Li", "Xiu Su", "Shan You", "Fei Wang", "Chen Qian", "Chang Xu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04750v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04750v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.AI", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.AI", "cs.CV", "cs.LG" ]
DiffNAS: Bootstrapping Diffusion Models by Prompting for Better Architectures Wenhao Li1, Xiu Su2*, Shan You1, Fei Wang1, Chen Qian1, Chang Xu2 1Sensetime Research 2The University of Sydney 3 2 0 2 t c O 0 1 ] I A . s c [ 2 v 0 5 7 4 0 . 0 1 3 2 : v i X r a Abstract-Diffusion models have recently exhibited remarkable performance on synthetic data. After a diffusion path is selected, a base model, such as UNet, operates as a denoising autoencoder, primarily predicting noises that need to be eliminated step by step. Consequently, it is crucial to employ a model that aligns with the expected budgets to facilitate superior synthetic performance. In this paper, we meticulously analyze the diffusion model and engineer a base model search approach, denoted "DiffNAS". Specifically, we leverage GPT-4 as a supernet to expedite the search, supplemented with a search memory to enhance the results. Moreover, we employ RFID as a proxy to promptly rank the experimental outcomes produced by GPT-4. We also adopt a rapid-convergence training strategy to boost search efficiency. Rigorous experimentation corroborates that our algorithm can augment the search efficiency by 2× under GPT-based scenarios, while also attaining a performance of 2.82 with 0.37 improvement in FID on CIFAR10 relative to the benchmark IDDPM algorithm. Index Terms-generative model, diffusion model, NAS I. INTRODUCTION Image synthesis, a critical application within the field of deep learning, has seen extensive experimentation within generative adversarial networks (GANs) [1], autoregressive models [2], and variational autoencoders (VAEs) [3]. Lately, Diffusion Probabilistic Models (DDPM) [4], parameterized via Markov Chain Training and reversed with a diffusion process, have demonstrated impressive outcomes in image synthesis and beyond. The state-of-the-art results and the significant variability generated by these autoencoders have sparked interest among researchers to enhance and study related frameworks. However, when the DDPM framework is fixed, the foundational model, such as Unet [5], assumes a pivotal role in the reversed diffusion process. In this paper, we delve into the profound and consequential implications of enhancing the foundational model on the diffusion process. Diffusion models, which are extensively used in a variety of generative tasks including image generation [6], editing [7], and video generation [8], hinge on two processes: for- ward diffusion and reverse denoising. Models such as the text-to-image Stable Diffusion [9] have gained considerable interest due to their superior generative capabilities and user- friendly applications. In the forward diffusion process, the data distribution is progressively transformed into Gaussian noise through systematic noise additions. Conversely, the reverse denoising process, often facilitated by a base model such as Unet , approximates the inverse of the forward process, thereby enabling the conversion from Gaussian noise back to the target *corresponding author distribution. Given this established diffusion framework, the quality and performance of image synthesis largely hinge on the feature learning capabilities of the base model. Given the widespread application of diffusion models, the optimization and training of these models have gradually become hot research topics. Existing strategies for diffusion model optimization include the use of learnable variance, refinement of the noise-adding strategy [10], transfer of dif- fusion from pixel space to latent space, and enhancement of the variational evidence lower bound (ELBO) to approx- imate log-likelihood with greater confidence [11]. However, current improvements rarely focus on the optimization of the denoising autoencoder within these models. A considerable majority of existing diffusion models employ Unet as the denoising autoencoder, but these Unet models lack a rigorous design specifically tailored to diffusion models. The Unet models in current use rely primarily on empirical and heuristic manual design, significantly impeding the potential for higher generative capacities within diffusion models. To optimize the Unet architecture, an intuitive approach is to employ Neural Architecture Search (NAS) [12, 13], exploring an Unet-based architecture that is optimally suited for diffusion models. The primary objective of NAS is to identify the most effec- tive model architecture tailored to a specific task, constrained within a pre-defined search space. NAS can autonomously unearth the optimal architecture through the application of specific rules, thus eliminating the necessity for expert inter- vention and comprehensive manual experimentation. Presently, the majority of efficient NAS algorithms [14–16] predomi- nantly adopt weight sharing strategies. These methods have a lower upper limit on their effectiveness and require training a super-network, which is a particularly challenging task for diffusion models. GPT-4 [17] currently represents the pinnacle of general- purpose large language models, demonstrating exceptional proficiency in natural language processing and generation. It has been trained on a diverse corpus of general and domain- specific data, thus achieving mastery over a broad spectrum of professional tasks. In light of GPT-4's extensive training data, which encompasses profound knowledge of deep model architectures and NAS, we posit that it could supersede the supernet as a proxy for NAS. In this paper, we undertake a comprehensive investigation of the diffusion model within the context of the UNet framework, resulting in our proposed solution, DiffNAS. Specifically, we elaborate on our strategy that combines the NAS algorithm to pinpoint the optimal foundation for the diffusion model. We employ GPT-4 as a supernet to accelerate the architecture search and maintain a search memory repository to enhance the diversity of our search outcomes. In addition, we introduce the use of Rethinking FID (RFID) as a proxy to expedite the ranking of candidate architectures, thereby circumventing the need for exhaustive training of each individual candidate. This technique is further enriched by a rapid-convergence training strategy, specifically designed to augment the efficiency of the search process. Experimental validation shows that this training strategy can achieve higher accuracy in performance ranking with only half of the training cost. II. RELATED WORK A. Improvement of Diffusion Models Primarily, improvements of diffusion models target towards two aspects: accelerating the sampling speed and boosting the quality of samples. The methods for acceleration primarily fall into two cate- gories. The first one involves refining the sampling algorithm by eliminating the Markov chain in the DDPM (Denoising Diffusion Probabilistic Models), thus enabling fewer sampling steps than the diffusion steps used during training [18]. The second one utilizes a knowledge distillation method, in which a 'student' diffusion model learns to mimic the multiple-step denoising of a 'teacher' diffusion model in a single step, thereby allowing a diffusion model with fewer steps to achieve performance typically requiring thousands of diffusion steps. Regarding the improvement of generation quality, the first strategy is to use learnable variance. In DDPM, the variance in the denoising process is determined by the variance in the forward diffusion process, which restricts the optimization space of the denoising autoencoder. Consequently, diffusion models such as Improved Denoising Diffusion Probabilistic Models (IDDPM) [10] employ learnable variance to enhance the target distribution. the diffusion model's ability to fit Another strategy involves employing an enhanced optimiza- tion objective. Given the difficulty of directly optimizing the actual target of diffusion model optimization-log likelihood, DDPM optimizes the variational lower bound, which has a variational gap with log likelyhood. Therefore, models like IDDPM optimize the learning objective to approximate the log likelihood more closely. B. Neural Architecture Search Designing a well-performing network architecture requires professional expertise and is also very time-consuming. The purpose of NAS algorithms is to automate this process, thereby reducing the workload of humans. The workflow of NAS algo- rithms is to search for an architecture within predefined search space and then evaluate its performance. The performance of this architecture is used as a reference to search for a new architecture, until obtaining a network architecture that meets the requirements. Traditional search algorithms mainly include those based on reinforcement learning [13], Bayesian optimization methods [19], and gradient-based methods [20]. Compared to these algorithms, the algorithm we propose based on GPT-4 [17] is less training-intensive and faster in search speed. III. REVISITING DIFFUSION MODEL WITH FOUNDATION MODELS Diffusion probability model is a kind of latent variable model, with the workflow composed of a forward diffusion process and a reverse denoising process. A. Forward Process The original data distribution can be defined as q(x0). In the forward diffusion process, given an original data x0 ∼ q(x0), a total of T diffusion steps are undertaken, getting T noisy latent variables,x1, x2, x3...xT , each possessing the same dimension as x0. The diffusion step t is achieved by adding Gaussian noise to xt−1: q(xt|xt−1) := N (xt; (cid:112)1 − βtxt−1, βtI) (1) where βt representing the variance of each diffusion step. is a small positive constant between 0 and 1, B. Reverse Denoising Process It can be easily observed that when T is large enough, the final xT completely transforms from the original data into random Gaussian noise. Consequently, in the reverse denoising process, an xT ∼ N (0, 1) is sampled from the standard Gaussian distribution as the initial noise. If a neural network can fit the reverse process of the forward diffusion, this random noise xT can be transformed into a target sample. The reverse distribution from xt to xt−1 is defined as follows: pθ(xt−1|xt) := N (xt−1; μθ(xt, t), σ2 t I) (2) where μθ(xt, t) is the mean of reverse distribution obtained from a neural network, and σt is the variance of the reverse distribution obtained from βt: (cid:118) (cid:117) (cid:117) (cid:116)1 − ( σt = t (cid:89) i=1 (cid:112)1 − βi)2 (3) C. Training and Sampling In the practical application of diffusion models, researchers use denoising autoencoders to directly predict the noise that needs to be eliminated at each step, which yields better results than predicting the mean of distribution. In the k-th iteration of training, parameters of denoising autoencoder are updated as follows: √ √ αtx0 + θk = θk−1 − λ∇θ||ε − Uθ( where αt = 1 − βt, αt = (cid:81)t i=1 αi, λ is the learning rate, θ represents parameters of denoising autoencoder U, t is the diffusion step and ε is a random noise sampled from Standard Gaussian Distribution N (0, 1). 1 − αtε, t)||2 (4) Fig. 1. Framework of proposed GPT-4-Driven search for optimal Unet architecture of diffusion models Once we have a well-trained denoising autoencoder, we can use it to gradually transform the noise xT into the sample x0. xt−1 = 1 √ αt (xt − 1 − αt √ 1 − αt Uθ(xt, t)) + σtε (5) IV. DIFFNAS According to the information provided by Eq. (2) and Eq. (5), the performance of the diffusion model primarily depends on the capacity of the foundation model Uθ, given other configurations of the diffusion model algorithm are held constant. Currently, almost all mainstream diffusion models such as Guided Diffusion[21] and Imagen[22] leverage Unet as their foundation model to carry out denoising in the reverse process. However, it should be noted that Unet was originally proposed for medical image segmentation tasks[5] and was not specifically designed to function as a denoising autoencoder. With this in mind, we are exploring the possibility of design- ing a highly effective, low-latency Unet architecture that is specifically optimized for the diffusion model's needs. A. Problem Formulation Given a dataset D, diffusion model M is determined by a denoising autoencoder Unet U and other settings S, where S includes elements like the diffusion steps and noise schedule. With the fixed settings S, our task is to obtain an optimal foundation model within pre-defined search space A. Exhausted search is as follows: U ∗ = arg min F ID(U, θ∗, D, S) nel mult 3, attn 0, attn 1, attn 2, attn 3] is vast, it is un- feasible to perform an exhaustive search. Hence, it becomes imperative for us to navigate this vast landscape with the aid of a proxy N to discover an optimal architecture of foundation model. One example of such proxies is the supernet employed by the weight-sharing NAS methods, such as the Single Path One Shot[23] and DARTS[24]. By training a supernet, we can rank the performance of various architectures within the search space and thereby identify the most optimal foundation model. Thus, Eq. (6) could be updated as follows: U ∗ = arg min F ID(N ∗(U, D, S)) U ∈A s.t. N ∗ = arg min θ FLOPs(U) ≤ B0 Ltrain(Nθ, D, A, S) (7) where θ represents all the parameters of the supernet N , and N ∗is the well-trained supernet. However, as illustrated in Eq. (7), it's necessary to train a supernet, which poses considerable challenges for diffusion models. In diffusion models, one denoising autoencoder is expected to simulate thousands of steps of reverse transfor- mation concurrently. As it can be inferred from Fig. 2, the training of a diffusion model requires a significant number of iterations for convergence. During the training of a supernet on the diffusion model, employing different sub-nets at each iteration leads to the supernet's inability to converge, thereby affecting the accuracy of the ranking. Ltrain(θ, U, D, S) (6) B. Unet Architeture Search with GPT-4 U ∈A s.t. θ∗ = arg min θ FLOPs(U) ≤ B0 where θ represents the parameters of the denoising autoen- coder U, θ∗ denotes the parameters after complete training, B0 is the predefined FLOPs budget, FID is an evaluation metric for the diffusion model, and U ∗ is the searched optimal foundation model. Given that the search space [base channel, num blocks, chan- channel mult 1, channel mult 2, channel mult 0, Given that GPT-4 has been trained on a vast quantity of data encompassing expertise from various fields, it can be directly deployed to execute numerous specialized tasks without necessitating fine-tuning. We can employ GPT as a proxy, denoted as FG, for ranking the performance of foundation models. Thus, Eq. (6) can be updated as: U ∗ = arg min U ∈A F ID(FG(U, D, S)) FLOPs(U) ≤ B0 (8) However, merely using GPT-4's zero-shot ability for archi- tecture search has significant limitations. Although GPT-4 possesses some fundamental knowledge of diffusion models and NAS, this knowledge is overly generalized for specific diffusion models and datasets, and is insufficient for precise reference. Hence, we propose an iterative search approach that conducts multiple rounds of searches. In each new round, the prior architectures, the FLOPs of the architectures, and the evaluation results are provided to GPT-4 as reference. This helps GPT-4 acquire enough prior knowledge to propose better architecture. This process can be defined as: U ∗ = arg min U ∈A FID(FG(U, D, S, Pi)) (9) FLOPs(U) ≤ B0 where Pi is a list storing the Unet architectures found in the first i searches and their corresponding performance, assisting GPT-4 in understanding the effectiveness of the architectures it has proposed. The update method for this variable in the iterative search process is as follows: Pi+1 = Pi.append(Ui+1, F ID(M(Ui+1, S), D)) (10) Our ultimate architecture is the one selected from P, which exhibits the highest performance. U ∗ = arg min Ui F ID(Ui), < Ui, F ID(Ui) > ∈ P (11) C. Rapid-convergence Training Strategy(Ract) Although the GPT-4 based method has significantly reduced computational overhead compared to traditional NAS algo- rithms, we still have to conduct several searches according to Eq. (8). Each search entails a highly time-consuming training process. Our task is to discover the most effective architecture through GPT search, rather than exhaustively training a slew of decent architectures. In fact, we can use RFID (Ranking FID) to characterize the relative performance of architecture U, while Y represents the training strategy, and E signifies the training cost. U ∗ = arg min U ∈A RFID(FG(U, D, S, Y, E)) (12) FLOPs(U) ≤ B0 By improving strategy Y , we can achieve the objective of accurately ranking RFID with less cost E. Meanwhile, in Eq. (10), it is not necessary to store the performance of each architecture in Pi; instead, we store RFID. Therefore, Eq. (10) can be updated as follows: Pi+1 = Pi.append(Ui+1, RF ID(M(Ui+1, S), D, Y, E)) (13) To enhance training strategy Y and accelerate the search process, we introduce GPT-4 Boost Augmentation to optimize the ranking accuracy of RFID. This approach enables us to achieve optimal results with the minimal training cost. To accommodate both Y and E, we can employ GPT-4 to search for Y based on the provision of less costly E, aiming to TABLE I PERFORMANCE OF VARIOUS MODELS ON CIFAR10 model WaveDiff[25] DiffuseVAE[26] DDGAN[27] PNDM[28] SB-FBSDE[29] IDDPM[10] DDPM[4] IDDPM+NAS DDPM+NAS FID 4.01 3.77 3.75 3.26 3.01 3.19 3.17 2.82 2.90 FLOPs 6.0G 6.06G 5.72G 6.06G 6.06G 8.14G 6.06G 7.13G 5.36G achieve the goal of rapidly generating accurate RFID. Y ∗ = arg max Y∈AY Cost(Y) ≤ E Ranking Accuracy(Y, D, S) (14) where AY represents the search space for training strategies, encompassing searchable parameters such as learning rate, dropout, and diffusion steps. Given the relatively small search space, the search task is comparatively simple. Consequently, there is no necessity to provide GPT-4 with additional refer- ences. Merely utilizing GPT-4's zero-shot capabilities allows us to search for a training strategy that meets our requirements. The experimental results have also substantiated this assertion. Compared to standard training strategies, the training strategies discovered by GPT-4 require only half the training cost to achieve a higher ranking accuracy. V. EXPERIMENTS To verify the effectiveness of the algorithm we proposed, we conducted search experiments on two representative diffusion probabilistic models, DDPM and IDDPM. Due to limited resources, we chose to use a small dataset CIFAR10 [30] as the training dataset in the NAS experiment. represented Search Space: The Unet used in the diffusion model has some optimizations compared to the original Unet, such as the addition of attention layers. In order to maximize the freedom of search, we have included all architecture parameters strongly related to the Unet model's capability in the search space for simultaneous search. The search space can as[base_channel, num_blocks, be channel_mult_0, channel_mult_1, channel_mult_2, channel_mult_3, attn_0, attn_1, attn_2, attn_3], which has ten parameters that can be searched. base channel represents the basic channel number of Unet, and the product of channel mult i and base channel is the channel number of the stage i. num blocks represent the number of residual blocks at each stage, while attn 0 to attn 3 represent whether to add attention layers at each stage. A. Rapid-convergence Ablation Study To validate superiority of our proposed rapid- convergence training strategy, we performed ablation exper- the TABLE II TABLE OF ABLATION STUDY Spearman Pearson Kendall standard(3W) standard(5W) standard(10W) rapid(3W) rapid(5W) 0.533 0.816 0.95 0.892 0.964 0.533 0.816 0.95 0.892 0.964 0.444 0.667 0.833 0.714 0.904 learning rate set iments on IDDPM using the CIFAR10 dataset. The standard training strategy for IDDPM sets the noise schedule to cosine, with dropout configured to 0.3, to 1e-4, diffusion steps set to 4000, batch size configured to 128, while using learnable variance. Under this configuration, a complete training of IDDPM on CIFAR10 requires a total of 0.5 million steps. We employ GPT-4 to search among the learning rate, diffusion steps, and dropout, in an attempt to discover a weak augmented training strategy to accelerate the search process. Following a single search, the training strategy proposed by GPT-4 sets the learning rate to 2e-4, dropout to 0.1, and diffusion steps to 400 steps. Our ablation study initially selected ten architectures of Unet. Subsequently, we trained ten IDDPMs each using the standard training strategy and our rapid-convergence training strategy, for 200k steps respectively. We evaluated the perfor- mance of these IDDPMs as well as their correlation with the model performance under complete training. To evaluate the correlation between the model's perfor- mance after a small number of training steps and the per- formance of the fully trained model, we selected three eval- uation metrics: Pearson's correlation coefficient, Spearman's rank correlation coefficient, and Kendall's tau rank correlation coefficient. The range of values for these three metrics is from -1 to 1. A value closer to 1 indicates a stronger positive correlation, a value closer to -1 indicates a stronger negative correlation, and a value around 0 indicates no correlation. After ten IDDPMs are fully trained using the standard train- ing strategy, a FID performance ranking S1 can be obtained. Given a training strategy and the number of training steps, a performance ranking S2 can be obtained after the training. When three metrics between S1 and S2 are close to 1, this training strategy and number of training steps offer significant guidance for architecture search. During the calculation of the FID scores, we chose to generate 50,000 samples with 100 steps each time. The three metrics for different strategies and training steps are shown in TABLE II. From the experimental result, it can be observed that under the same training steps, our rapid- convergence training algorithm can achieve a higher corre- lation metrics compared to the standard training algorithm. It only requires 50k training steps to surpass the performance of 100k steps in standard training, which proves that this strategy can effectively accelerate the process of architecture search. Fig. 2. Trend of FID of two training strategies B. Experiments on DDPM We first conducted search experiments on the most classic algorithm in diffusion probabilistic models, DDPM. The orig- inal DDPM uses a linear noise schedule, dropout is set to 0.1, the number of diffusion steps is 1000, and the learning rate is 1e-4. In the original configuration of Unet, the base channel is 128, the number of blocks in each stage is 2, the channel mult of the four stages are 1, 2, 2, 2, and the attention layer is only added in the second stage. Under this configuration, DDPM needs to be trained for 0.8M steps. In our experiments, we first calculated the FLOPs of the original DDPM, which was 6.06G. In the search process, we constrainted the upper limit of FLOPs to 6.06G and conducted ten rounds of searches. In order to accelerate the search process, we trained each DDPM 160k steps using rapid- convergence algorithm. The optimal UNet configuration identified through search has the following settings: the base channel is 96, the number of blocks in each stage is 3, the channel mult of the four stages are 1, 2, 3, 3, and the attention layer is added in the second and fourth stage. After fully trained, it achieves an FID of 2.90 with 5.36G FLOPs, surpassing the original architecture's FID of 3.17 with 6.06G FLOPs. C. Experiments on IDDPM Further, we conducted experiments on IDDPM to demon- strate that DiffNAS algorithm can be effective on a broader range of diffusion probabilistic models. We conducted a search experiment on IDDPM using the CIFAR10 dataset. The original Unet configuration of IDDPM on CIFAR10 is: the base channel is 128, the number of blocks is 3, and the channel mult of the four stages are 1, 2, 2, 2, with attention layers added in the second and third stages. During training, we chose the cosine noise schedule, used the rapid-convergence training strategy, which need to trained for 50k steps, while original IDDPM needed 500k steps of training. Similarly, during the ten iterative search processes, we constrainted the upper limit of FLOPs to the FLOPs of the original Unet: 8.14. The best UNet configuration discovered through search has the following settings: the base channel is 96, the number of blocks in each stage is 4, the channel mult of the four stages are 1, 2, 3, 3, and the attention layer is added in the first, second and third stage. It achieves an FID of 2.82 under 7.13G FLOPs, which represent significant improvements compared to the original IDDPM's FID of 3.19 under 8.137G FLOPs. CONCLUSION In this paper, we propose DiffNAS, a novel architecture search framework for diffusion models. Using GPT-4 as a proxy, DiffNAS efficiently discovers optimal Unet architec- tures through just a few dialogue rounds. With our Ract train- ing strategy, we accelerate the search process by a factor of two and achieve superior performance. Our approach improves the FID scores on CIFAR-10 for IDDPM and DDPM by 0.37 and 0.27 respectively. In summary, our algorithm can significantly enhance the generative performance of diffusion models. Additionally, it is compatible with other optimization strategies aimed at enhancing diffusion models, showcasing its high practical value. REFERENCES [1] I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde- Farley, S. Ozair, A. Courville, and Y. Bengio, "Generative adversarial networks," Communications of the ACM, vol. 63, no. 11, pp. 139–144, 2020. [2] C. S. Wong and W. K. Li, "On a mixture autoregressive model," Journal of the Royal Statistical Society Series B: Statistical Methodology, vol. 62, no. 1, pp. 95–115, 2000. [3] A. R. Kosiorek, H. Strathmann, D. Zoran, P. Moreno, R. Schnei- der, S. Mokr ́a, and D. J. Rezende, "Nerf-vae: A geometry aware 3d scene generative model," in International Conference on Machine Learning. PMLR, 2021, pp. 5742–5752. [4] J. Ho, A. Jain, and P. Abbeel, "Denoising diffusion probabilistic models," Advances in neural information processing systems, vol. 33, pp. 6840–6851, 2020. [5] O. Ronneberger, P. Fischer, and T. Brox, "U-net: Convolutional networks for biomedical image segmentation," in Medical Im- age Computing and Computer-Assisted Intervention–MICCAI 2015: 18th International Conference, Munich, Germany, Octo- ber 5-9, 2015, Proceedings, Part III 18. Springer, 2015, pp. 234–241. [6] Y. Song and S. Ermon, "Improved techniques for training score-based generative models," Advances in neural information processing systems, vol. 33, pp. 12 438–12 448, 2020. [7] O. Avrahami, D. Lischinski, and O. Fried, "Blended diffusion for text-driven editing of natural images," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022, pp. 18 208–18 218. [8] J. Ho, W. Chan, C. Saharia, J. Whang, R. Gao, A. Gritsenko, D. P. Kingma, B. Poole, M. Norouzi, D. J. Fleet et al., "Imagen video: High definition video generation with diffusion models," arXiv preprint arXiv:2210.02303, 2022. [9] R. Rombach, A. Blattmann, D. Lorenz, P. Esser, and B. Ommer, "High-resolution image synthesis with latent diffusion models," in Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, 2022, pp. 10 684–10 695. [10] A. Q. Nichol and P. Dhariwal, "Improved denoising diffusion probabilistic models," in International Conference on Machine Learning. PMLR, 2021, pp. 8162–8171. [11] C.-W. Huang, J. H. Lim, and A. C. Courville, "A variational perspective on diffusion-based generative models and score matching," Advances in Neural Information Processing Systems, vol. 34, pp. 22 863–22 876, 2021. [12] X. Su, T. Huang, Y. Li, S. You, F. Wang, C. Qian, C. Zhang, and C. Xu, "Prioritized architecture sampling with monto-carlo tree search," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021, pp. 10 968– 10 977. [13] Y. Jaafra, J. L. Laurent, A. Deruyver, and M. S. Naceur, "Re- inforcement learning for neural architecture search: A review," Image and Vision Computing, vol. 89, pp. 57–66, 2019. [14] X. Su, S. You, J. Xie, M. Zheng, F. Wang, C. Qian, C. Zhang, X. Wang, and C. Xu, "Vitas: Vision transformer architec- ture search," in European Conference on Computer Vision. Springer, 2022, pp. 139–157. [15] X. Su, S. You, F. Wang, C. Qian, C. Zhang, and C. Xu, "Bcnet: Searching for network width with bilaterally coupled network," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021, pp. 2175–2184. [16] Y. Cao, Q. Tang, F. Yang, X. Su, S. You, X. Lu, and C. Xu, "Re-mine, learn and reason: Exploring the cross-modal semantic correlations for language-guided hoi detection," in Proceedings of the IEEE/CVF International Conference on Computer Vision, 2023, pp. 23 492–23 503. [17] A. Koubaa, "Gpt-4 vs. gpt-3.5: A concise showdown," 2023. [18] C. Lu, Y. Zhou, F. Bao, J. Chen, C. Li, and J. Zhu, "Dpm-solver: A fast ode solver for diffusion probabilistic model sampling in around 10 steps," Advances in Neural Information Processing Systems, vol. 35, pp. 5775–5787, 2022. [19] C. White, W. Neiswanger, and Y. Savani, "Bananas: Bayesian optimization with neural architectures for neural architecture search," in Proceedings of the AAAI Conference on Artificial Intelligence, vol. 35, no. 12, 2021, pp. 10 293–10 301. [20] E. Goceri, "Diagnosis of alzheimer's disease with sobolev gradient-based optimization and 3d convolutional neural net- work," International journal for numerical methods in biomed- ical engineering, vol. 35, no. 7, p. e3225, 2019. [21] J. Ho and T. Salimans, "Classifier-free diffusion guidance," arXiv preprint arXiv:2207.12598, 2022. [22] C. Saharia, W. Chan, S. Saxena, L. Li, J. Whang, E. L. Denton, K. Ghasemipour, R. Gontijo Lopes, B. Karagol Ayan, T. Sali- mans et al., "Photorealistic text-to-image diffusion models with deep language understanding," Advances in Neural Information Processing Systems, vol. 35, pp. 36 479–36 494, 2022. [23] Z. Guo, X. Zhang, H. Mu, W. Heng, Z. Liu, Y. Wei, and J. Sun, "Single path one-shot neural architecture search with uniform sampling," in Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XVI 16. Springer, 2020, pp. 544–560. [24] H. Liu, K. Simonyan, and Y. Yang, "Darts: Differentiable architecture search," arXiv preprint arXiv:1806.09055, 2018. [25] H. Phung, Q. Dao, and A. Tran, "Wavelet diffusion models are fast and scalable image generators," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2023, pp. 10 199–10 208. [26] K. Pandey, A. Mukherjee, P. Rai, and A. Kumar, "Diffusevae: Efficient, controllable and high-fidelity generation from low- dimensional latents," arXiv preprint arXiv:2201.00308, 2022. [27] Z. Xiao, K. Kreis, and A. Vahdat, "Tackling the generative learning trilemma with denoising diffusion gans," arXiv preprint arXiv:2112.07804, 2021. [28] L. Liu, Y. Ren, Z. Lin, and Z. Zhao, "Pseudo numerical methods for diffusion models on manifolds," arXiv preprint arXiv:2202.09778, 2022. [29] T. Chen, G.-H. Liu, and E. A. Theodorou, "Likelihood training of schr\" odinger bridge using forward-backward sdes theory," arXiv preprint arXiv:2110.11291, 2021. [30] A. Krizhevsky, G. Hinton et al., "Learning multiple layers of features from tiny images," 2009.
http://arxiv.org/abs/2310.09299v1
"2023-10-07T09:09:19"
"2023-10-07T09:09:19"
Digital Twin Assisted Deep Reinforcement Learning for Online Optimization of Network Slicing Admission Control
The proliferation of diverse network services in 5G and beyond networks has led to the emergence of network slicing technologies. Among these, admission control plays a crucial role in achieving specific optimization goals through the selective acceptance of service requests. Although Deep Reinforcement Learning (DRL) forms the foundation in many admission control approaches for its effectiveness and flexibility, the initial instability of DRL models hinders their practical deployment in real-world networks. In this work, we propose a digital twin (DT) assisted DRL solution to address this issue. Specifically, we first formulate the admission decision-making process as a semi-Markov decision process, which is subsequently simplified into an equivalent discrete-time Markov decision process to facilitate the implementation of DRL methods. The DT is established through supervised learning and employed to assist the training phase of the DRL model. Extensive simulations show that the DT-assisted DRL model increased resource utilization by over 40\% compared to the directly trained state-of-the-art Dueling-DQN and over 20\% compared to our directly trained DRL model during initial training. This improvement is achieved while preserving the model's capacity to optimize the long-term rewards.
[ "Zhenyu Tao", "Wei Xu", "Xiaohu You" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.09299v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.09299v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.SY", "eess.SP", "eess.SY" ]
IEEE TRANSACTIONS ON , VOL. 14, NO. 8, AUGUST 2021 1 Digital Twin Assisted Deep Reinforcement Learning for Online Optimization of Network Slicing Admission Control Zhenyu Tao, Wei Xu, Senior Member, IEEE, Xiaohu You*, Fellow, IEEE 3 2 0 2 t c O 7 ] G L . s c [ 1 v 9 9 2 9 0 . 0 1 3 2 : v i X r a Abstract-The proliferation of diverse network services in 5G and beyond networks has led to the emergence of network slicing technologies. Among these, admission control plays a crucial role in achieving specific optimization goals through the selective acceptance of service requests. Although Deep Reinforcement Learning (DRL) forms the foundation in many admission con- trol approaches for its effectiveness and flexibility, the initial instability of DRL models hinders their practical deployment in real-world networks. In this work, we propose a digital twin (DT) assisted DRL solution to address this issue. Specifically, we first formulate the admission decision-making process as a semi- Markov decision process, which is subsequently simplified into an equivalent discrete-time Markov decision process to facilitate the implementation of DRL methods. The DT is established through supervised learning and employed to assist the training phase of the DRL model. Extensive simulations show that the DT-assisted DRL model increased resource utilization by over 40% compared to the directly trained state-of-the-art Dueling-DQN and over 20% compared to our directly trained DRL model during initial training. This improvement is achieved while preserving the model's capacity to optimize the long-term rewards. Index Terms-Network slicing, admission control, digital twin (DT), deep reinforcement learning (DRL) I. INTRODUCTION Theorem 1. I N the past decades, the rapid development of communi- cation technologies has led to the continual expansion of network scale and the proliferation of diverse forms of network services, such as high-definition streaming videos, internet of vehicles, smart manufacturing facilities. As defined by the 3rd Generation Partnership Project (3GPP), 5G typical use cases including enhanced mobile broadband (eMBB), ultrareliable low-latency communication (URLLC), and massive machine- type communications (mMTC), each with distinct quality of service (QoS) requirements [1]. To satisfy the varying demands of these heterogeneous services, network slicing technology has been introduced. Net- work slicing offers flexibility by managing tailored, logically isolated networks that share physical network resources. In a sliced network, multiple network slices coexist, while the total resources are limited. Therefore, when conflicting or imminent conflicting service requests within different slices Z.Tao is with the Southeast University, Nanjing, 210096, China (email: zhenyu tao@seu.edu.cn). W.Xu and X.You are with the Southeast University, Nanjing, 210096, China, and the Purple Mountain Laboratories, Nanjing, 211111, China (email: {wxu, xhyu}@seu.edu.cn). X.You is the corresponding author of this paper. arrive, it is necessary to make choices among these requests to achieve specific objectives, such as maximizing long-term revenue for the infrastructure provider (InP) or realizing the fairness between different slices. This decision-making process is denoted as admission control. Conventional admission control approaches, such as search- ing methods or heuristic schemes, will become ineffective or fail to achieve the optimal solution due to the overcomplexity of contemporary mobile networks [2]. Nevertheless, with the significant advancement of high-performance computing devices, researchers resort to learning-based methodologies, particularly deep reinforcement learning (DRL). In DRL, deep neural networks are leveraged to handle systems with numer- ous states, and the rewards within DRL make it adaptable to various optimization targets. While DRL-based admission control methods offer numer- ous advantages, challenges arise when deploying them in real networks. The initial application scenario of the RL is found in games, such as board games, exemplified by AlphaGo for the game of Go [3] and electronic games, as seen in OpenAI Five for Dota 2 [4]. These tasks share a crucial similarity: the training environment is exactly the same as the environment in which they will be deployed, ensuring effective training and implementation. However, creating a precise virtual environment for network systems is extremely challenging due to the complexity of the contemporary mobile network and the diversity of network services, and an insuffi- ciently accurate training environment will inevitably result in DRL models malfunctioning or ineffective when transferred to real networks. On the other hand, directly training DRL models on real networks, i.e., online optimization, will disrupt normal operations of the network and reduce system resource utilization due to the highly stochastic actions of the initial models. Therefore, there is an urgent need to investigate methodologies for deploying DRL models in real networks with minimal disruption to network functionality. The concept of digital twin (DT) provides a feasible solution for the implementation of emerging technologies within 5G and beyond networks. The DT can replicate real networks from different dimensions through programming, modeling, learning, and other approaches [5]. In this paper, we employ DT to replicate the admission policy of an existing network and leverage the DT to assist in training the DRL model on the real network. This approach aims to mitigate the adverse thus enabling impact associated with early-stage training, feasible online optimization of admission control for network IEEE TRANSACTIONS ON , VOL. 14, NO. 8, AUGUST 2021 2 slicing. The main contributions of this paper are summarized as follows. • To the best of our knowledge, this work is the first to address the instability issues encountered during the ini- tial training stage of DRL and offers practical solutions to mitigate these challenges, thereby enhancing the viability of DRL implementation within real network systems. • We formulate the admission decision-making process within a network system featuring request queues and combinatorial resources as a semi-Markov decision pro- cess. Subsequently, we simplify it into an equivalent discrete-time Markov decision process to facilitate the implementation of DRL methods. • We introduce a neural networks-based DT with a cus- tomized output layer for handling queued requests, and leverage supervised learning to replicate network admis- sion policies. Then we present an online optimization solution for admission control using DT-assisted DRL, which exhibits enhanced stability compared to traditional DRL training methods. • Extensive simulations are conducted to validate and an- alyze the effectiveness of the proposed solution. The results demonstrate that our approach significantly im- proves resource utilization within the network, particu- larly during the initial training phase, while also maintain- ing the DRL model's performance in achieving specific objectives. The remainder of this paper is organized as follows. The relevant works about the admission control for network slicing and the digital twin for mobile networks are briefly reviewed in Section II. Then we describe the system model and formulate the problem in Section III. Section IV elaborates on the proposed solution through two parts: the DNN-based DT and the DT-assisted DRL algorithm. Simulation results are presented and discussed in Section V. Finally, conclusions and future works are given in Section VI. II. RELATED WORK A. Admission Control for Network Slicing Numerous studies have investigated the admission control problems in the sliced network. Admission control for net- work slicing can be seen as an extension of call admission control [6], where the admission policy of network services in different slices is designed to achieve specific targets like revenue maximization, priority assurance, fairness guarantee, etc. Distinct admission policies for incoming service requests from different slices will result in varied resource usage among slices. Consequently, the admission control for network slicing is also regarded as a resource allocation method with service requests as the finest granularity, as found in certain literature [2]. The conventional admission control mechanisms, such as first-come-first-served and random strategies, rely solely on the sequence of service requests and thus cannot achieve the designated goals. To realize the aforementioned targets, several approaches have been introduced. Jiang et al. [7] proposed an extensive searching method to improve user experiences within slices and increase network resource utilization. Soliman and Leon-Garcia [8] designed a three-step heuristic scheme to achieve a trade-off between quality of service and resource utilization. Dai et al. [9] propose a heuristic algorithm to amend priority violations and then promote fairness. Bega et al. [10] designed an adaptive algorithm based on Q-learning to maximize the InP revenue. Haque and Kirova [11] adopted integer linear programming in admission control to achieve the maximum revenue. However, Van Huynh et al. [2] pointed out that approaches like searching methods and heuristic algorithms may become inapplicable or cannot ensure optimality in complex network systems with a wide range of resource demands and services. They also noticed that most of the previous methods only con- sidered radio resources. Hence, they provide a DRL solution based on the deep dueling network to maximize long-term revenue in network systems considering radio, computing, and storage resources. Similarly, several other DRL methods have been explored for the admission control task. Villota- Jacome et al. [12] utilized deep Q networks to improve the service provider's profit and resource utilization. Troia et al. [13] performed both admission control and virtual network embedding based on an advanced DRL algorithm called advantage actor critic (A2C). Sulaiman et al. [14] adopted proximal policy optimization (PPO), another well-known DRL method, in both slicing and admission control to improve long- term InP revenue. Although DRL-based methods show significant potential in handling the admission control task, the instability of DRL at the initial training stage hinders the implementation of DRL methods in real network systems. B. Digital Twin for Mobile Networks DT is a key technology in simulation for various complex systems, such as aviation, manufacturing, and architecture. For mobile networks, DT enables the replication of real networks at different levels through various methods. Mozo et al. [15] leveraged virtual machines to realize a DT of the 5G core network with two-way communication capability between real and virtual networks. In [16], the authors adopted a deep learning method to construct a signaling-level DT of the core network control plane in a data-driven paradigm. Naeem et al. [17] used a DT of network topology to improve the performance of deep distributional Q-networks in determining the optimal network slicing policy. [18] realized the DT of both network element and network topology and utilized it for network slicing resource allocation. In [19], a graph neural network-based DT was developed to mirror the network behavior and predict end-to-end latency. In this study, we design a DT to replicate the admission policy of the real network and use it to enhance the training process of the DRL model for network slicing admission control. To the best of our knowledge, there is no precedent work that has employed DT to address the instability issues training phase of the DRL encountered during the initial model. IEEE TRANSACTIONS ON , VOL. 14, NO. 8, AUGUST 2021 3 k, rc ponential distribution with the mean 1/μk. The maximum waiting time is set by a hold time th k. If a request's waiting time surpasses the hold time, it will leave the queue. Otherwise, if admitted, the service will continue running until it reaches service time. In terms of resources, we define a vector as rk = [rr k, rs k] to characterize the resources utilization k, rc of active service, where rr the proportions of total radio, computing, and storage resources occupied. The occupied resource proportions across various services correspond to their distinct characteristics. For in- stance, services in eMBB slices utilize more radio resources to achieve broadband, while those in URLLC slices require ample computing resources to ensure low latency. k ∈ (0, 1) represent k, rs In order to employ the DRL to handle the admission control task, we need to model the decision-making process in the network. The aforementioned network system operates continuously and makes decisions at any point in time. Thus, we adopt the semi-Markov decision process (SMDP) [21] to depict the network system's behavior. Different from the discrete-time MDP where decisions are made at fixed time slots, the decision points in SMDP are triggered by events, with the time intervals between events following a specific probability distribution. The SMDP can be represented by a 5- tuple ⟨S, A, T , P, R⟩, where S and A denotes the state space and action space, T describes the distribution of the sojourn time, i.e., the duration between decision epochs, P represents the transition probability function, and R indicates the reward function. T , P, and R possess the following Markovian property: if at a decision epoch the action a is chosen in state s, then the sojourn time, the transition probability and the reward until the next decision epoch depend only on the present state and the action chosen in this state. A. State Space The state s for each decision epoch can be defined by the number of requests nreq waiting in queues and the number of services nsvc running in the systems. Specifically, we define the state as: s = [nreq, nsvc] , where nreq = (cid:2)nreq nsvc = [nsvc 1 , . . . , nreq 1 , . . . , nsvc (cid:3) , k , . . . , nreq K k , . . . , nsvc K ] . (1) (2) (3) Resource constraints are introduced to ensure the occupied resources do not exceed the accessible resources from the InP. Thus, the state space S is formulated as follows: (cid:40) S = s = [nreq, nsvc] : K (cid:88) k=1 rr knsvc k ≤ 1; K (cid:88) k=1 rc knsvc k ≤ 1; K (cid:88) k=1 (4) (cid:41) rs knsvc k ≤ 1 . B. Action Space Due to the queue mechanism within the network system, the possible actions in this study are not simply acceptance Fig. 1. System architecture III. SYSTEM MODEL AND PROBLEM FORMULATION We consider a network comprising three parties: end users, tenants, and InP [20]. The InP is responsible for establishing separate logic networks (slices) on the physical network infras- tructure, which are tailored to satisfy the tenant requirements. Tenants lease these slices from InP to serve the demands of their subscribers (end users). The services requested by end users are executed on slices provided by tenants, and charged based on the resources they utilize, including radio, computational power, and storage. We use the variable K to denote the number of slices, which corresponds to the number of tenants within the network. In this study, we consider K = 4 to represent a set of typical 5G services including eMBB, URLLC, mMTC, and other services. tenants will Fig. 1 illustrated the system architecture of the above- mentioned network. Heterogenous service requests such as utilities, manufacturing, and online videos, can be raised by end users. These requests are subsequently sent to tenants possessing the capacity to provide relevant slices. With suf- ficient resources, then transfer these requests to InP, thereby initiating the services on respective slices. However, scenarios may arise in which excessive services are in operation, making remaining resources inadequate or inappropriate for accommodating particular services. In such in instances, queues where it awaits its turn for admission. The admission control policy is responsible for assessing the feasibility and priority of admitting these requests. When a running service is complete, the occupied resources become released and available for reassignment. On the other hand, if a queued request experiences a waiting time that exceeds its patience threshold, it will withdraw from the queue. the corresponding service request will wait Considering distinct application scenarios of these services, service requests and running services across different slices will exhibit distinctions in terms of arrival patterns, service duration, waiting periods, etc. Specifically, the arrival process of service requests with slice type k ∈ {1, 2, . . . , K} follows the Poisson distribution with the rate λk and the service's resources occupation time, or service time, follows the ex- End usersTenantsInPRunning servicesRequest queuesService requestsLeaving requestsCompletedservicesRadioStorageComputing IEEE TRANSACTIONS ON , VOL. 14, NO. 8, AUGUST 2021 4 or rejection. Instead, the action is defined by a vector a, specifying the number of admitted requests for each slice: s follows the exponential distribution with an expectation of τs, defined as: rre (k | π) = [rr re (k | π) , rc re (k | π) , rs re (k | π)] (6) τs(a) = a = (cid:2)nact 1 , . . . , nact k , . . . , nact K (cid:3) , nact k ∈ {0, 1, . . . , nmax} . (5) When resources are sufficient, service requests are admitted immediately upon arrival, yielding actions in one-hot vectors like [1, 0, . . . , 0] and [0, 1, . . . , 0], which could never reach the limit nmax. The limit can only be reached in the following case: When faced with insufficient resources, the admission policy, denoted as π, accepts service requests selectively, leading to the accumulation of particular requests in queues. Under policy π, we define the maximum remaining resources when slice k requests accumulate as follows: At this moment, if an ongoing service with high resource utilization is complete, the admission policy may admit mul- tiple requests of the same type in one decision epoch. The maximum number of requests admitted simultaneously in the same slice can be defined as: nmax = max j,k min (cid:18) ⌊ re (k | π) + rr rr i rr k re (k | π) + rc rc i rc k ⌋, ⌊ ⌊ ⌋, re (k | π) + rs rs i rs k (7) (cid:19) ⌋ where j and k refer to slice types. The nmax is related to the admission policy π as well as the resource utilization characteristics rk of services in each slice. Finally, we can define the action space A as: A = {a = [nact 1 , . . ., nact 0 ≤nact k , . . . , nact k ≤ nmax, ∀k ∈ {1, 2, . . . , K}}. K ] : (8) C. Sojourn Time Distribution The sojourn time represents the interval between adjacent decision epochs. Decisions are typically made when the system the state s may change due state changes. In this study, to 3 events: request arrival, request departure, and service completion. When a request arrives, it is necessary to decide whether it should be admitted. Also, when a service finishes, newly available resources need to be checked whether they should be allocated to the waiting service requests. However, request departure does not necessitate a decision. With suffi- cient resources, there will be no queuing requests and thus no leaving requests. When resources are inadequate or reserved for potential services with more rewards, the departure of queuing requests will neither provide additional resources nor bring more valuable new requests. Therefore, only request arrival and service completion are considered to be the trigger events in our model. For a queuing system, the sojourn time until the next trigger event depends on the arrival rate λk, the service rate μk, and the number of ongoing services in each slice. Since the arrival process follows a Poisson distribution and the services process follows an exponential distribution, the sojourn time in state τs = 1/ (cid:33) λk + nsvc k μk . (cid:32) K (cid:88) k=1 (9) That is, the arrival of the subsequent trigger event constitutes a Poisson process with the rate 1/τs. In SMDP, the decision a made at state s may change the number of ongoing services. This implies that the sojourn time depends not only on the state but also on the action in the current decision epoch. Moreover, only valid actions that do not exceed resource capacity will alter the number of ongoing services. Thus, τs needs to be modified to τs(a) as follows:   1/  1/ (cid:16)(cid:80)K (cid:16)(cid:80)K k=1 λk + nsvc k=1 λk + nsvc k μk + nact (cid:17) , k μk k μk (cid:17) , a is valid; otherwise. (10) D. Transition Probability The SMDP in this model comprises an embedded Poisson process to describe the arrival process of trigger events, and an embedded discrete-time Markov chain to describe state transitions when an event occurs. The transition probability of the embedded Markov chain can be denoted by ps,s′(a), indicating the probability that at the next decision epoch the system will be in state s′ if action a is chosen in the present state s. Although the transition probabilities are explicitly defined, the uncertain sojourn time engenders highly variable rewards even with a fixed state and action, posing considerable challenges in finding an optimal policy. Fortunately, a data- transformation method [21] can be utilized to convert the SMDP into an equivalent discrete-time MDP such that for each stationary policy the average reward per time unit in the discrete-time MDP is the same as that in the SMDP. First of all, we use rs(a) to stand for the expected rewards until the next decision epoch if action a is chosen in the present state s, R(t) to represent the total rewards up to time t, and πs ∈ A to denote the action chosen under policy π for state s. In the following theorem, we will prove that if the embedded Markov chain associated with policy π has no two disjoint closed sets, then the long-term average reward g(π) for the SMDP is a constant and does not depend on the initial state s0. Theorem 2. Suppose that the embedded Markov chain asso- ciated with policy π has no two disjoint closed sets. Then the long-term average reward for the SMDP lim t→∞ R(t) t = g(π), (11) for each initial state s0, where the constant g(π) is given by g(π) = (cid:80) (cid:80) s∈S rs (πs) ωs(π) s∈S τs (πs) ωs(π) (12) with ωs(π) referring to the equilibrium probability of the Markov chain in state s. Proof. The proof of Theorem 1 is given in Appendix A. IEEE TRANSACTIONS ON , VOL. 14, NO. 8, AUGUST 2021 5 Subsequently, we define the equivalent discrete-time MDP (cid:10) ̄S, ̄A, ̄P, ̄R(cid:11) as:  ̄S = S; ̄A = A; ̄rs(a) = rs(a)/τs(a),    ̄ps,s′(a) =   a ∈ ̄A and s ∈ ̄S; (τ /τs(a))ps,s′(a), s ̸= s′, a ∈ ̄A and s, s′ ∈ ̄S; (τ /τs(a))ps,s′(a) + (1 − (τ /τs(a))) , s = s′, a ∈ ̄A and s, s′ ∈ ̄S; (13) (14) (15) (16) where τ is a constant with 0 < τ ≤ maxs,a τs(a). If we can prove that under an arbitrary stationary policy π, the long-term average reward is identical in discrete-time MDP and SMDP, we can leverage the equivalent discrete-time MDP to devise the optimal policy. Theorem 3. Given the embedded Markov chain associated with policy π in SMDP has no two disjoint closed sets, we have: g(π) = ̄g(π), (17) where g(π) is the long-term average reward for SMDP and ̄g(π) is the long-term average reward for its equivalent discrete MDP. Proof. The proof is given in Appendix B. Note that the embedded Markov chain in the SMDP model of this study is a unichain for all stationary policy π, satisfying the requirement of the aforementioned data-transformation method. Hence, we can utilize the equivalent discrete-time MDP defined in Equation (13-16) to ascertain the optimal policy in SMDP. E. Reward Function The reward function is defined to reflect not only the positive effects of valid actions but also the penalties of invalid actions. Thus, it can be provisionally formulated as: (cid:40) rs(a) = Reward, a is valid; Penalty, otherwise. (18) Specifically, consider a system aimed at maximizing the InP revenue. Let c = [cr, cs, cc] signify the per-unit charges of radio, computing, and storage resources per unit of time. Given a valid action a executed at state s, the reward denoting total revenue accrued until the next trigger event is defined as: Reward = K (cid:88) k=1 nact k ⟨rk, c⟩τs(a), (19) and the penalty reflecting the missed opportunities for resource optimization until the next trigger event is defined as: Penalty = −δτs(a), (20) where cr, cs, cc, δ are all non-negative constants. According to Equation (15), the reward function within the equivalent discrete-time MDP, as employed in DRL, can be expressed as follows: ̄rs(a) = rs(a)/τs(a) = (cid:40) (cid:80)K k=1 nact −δ, k ⟨rk, c⟩, a is valid; otherwise. (21) The long-term average reward maximization problem is formulated as: max π s.t. g(π) = ̄g(π) = (cid:88) s∈S ̄rs (πs) ̄ωs(π) (cid:88) s∈S ̄ωs(π) = 1 (22) Although the data-transformation method remarkably de- creases the complexity of the problem, obtaining precise tran- sition probabilities remains challenging. The enormous state and action spaces also impede the solution of the problem. Therefore, we utilize the DRL method to find the optimal policy, leveraging neural networks to process extensive high- dimensional data while relying solely on states ̄S, actions ̄A, and rewards ̄R. IV. DT-ASSISTED ONLINE DRL SOLUTION A. DRL Algorithm for Admission Control In DRL, A standard reinforcement learning framework comprises an agent and an environment. When a trigger event indicating the need for a decision occurs, the agent determines an action based on the state information from the environment, following a policy π. Subsequently, the environment performs the action and provides the agent with a reward, which the agent can utilize to refine the policy. This process will be circulated until policy convergence or stabilization. is implemented via a well-designed the agent typically combining neural networks deep learning model, with diverse functions. State-of-the-art methods can be broadly categorized into three groups by their architecture. The first is the value-based (critic-only) methods, specifically, Deep Q- Network (DQN) [22] and its variants such as double DQN [23] and dueling DQN [24]. As Fig. 2 shows, DQN-based methods employ a deep neural network to represent the Q- function (action value function) rather than the numerical table used in conventional Q-learning methods. The DQN rates each action by a Q-value denoting its value for the current state s. After executing an action, the loss will be computed based on the reward and Q-value, and then the model parameters are updated through gradient descent. In the initial stage, actions are chosen stochastically to conduct an extensive exploration. As the model converges, the policy gradually becomes greedy, selecting the highest Q-value action to maximize long-term rewards. The other group is policy-based (actor-only) methods, which learn a policy from cumulative rewards directly, such as REINFORCE [25] and G(PO)MDP [26] in RL. These methods rely on the Monte-Carlo estimate rather than the critic network, resulting in high variance and large sampling costs. Thus, contemporary DRL rarely uses purely policy-based methods. IEEE TRANSACTIONS ON , VOL. 14, NO. 8, AUGUST 2021 6 Fig. 2. Value-based DRL methods Fig. 4. Schematic diagram of training DT network Fig. 3. Actor-critic DRL models The last group is actor-critic methods, which combine value- based and policy-based methods. Examples include Asyn- chronous Advantage Actor Critic (A3C) [27], Proximal Policy Optimization (PPO) [28], and Deep Deterministic Policy Gra- dient (DDPG) [29]. In such methods, the agent consists of an actor network and a critic network. The actor network param- eterizes the policy π(a|s; θ) with neural network parameters θ, signifying the probability of each action a at state s, while the critic network evaluates the action for the present state through an action value function Q(s, a) or alternatively assesses the current state using a state value function V (s). Once an action is taken, the reward first enhances the evaluative capacity of the critic network. Subsequently, the reward and the value estimated by the critic network are synthesized to refine the policy within the actor network. The actions are drawn from the policy probability distribution, thus they are initially stochastic due to the random initialization of the neural network. Typically, the selection of a method depends on factors such as the optimization goal, data format (continuous or discrete), and application scenario. However, all these DRL methods share a consistent characteristic of taking stochastic actions in the initial stage, posing challenges for their deployment in real networks. Therefore, in this study, we introduce DT to settle this problem. B. Supervised Learning-based DT for Admission Policy As we mentioned in Section II-B, DT can be implemented at various levels within the mobile network. In this study, our objective is to leverage DT to enhance the DRL model's understanding of the admission policy in the real network Fig. 5. DT network structure before training. This will help the model converge faster or fine-tune within a relatively stable range compared to direct training. To achieve this, we implement the DT of admission policy by training a neural network using supervised learning. The use of similar neural network structures aids in knowledge transferring and parameter sharing with the DL model employed in DRL methods. Fig. 4 demonstrates the training process of the DT net- work. We refer to the admission policy existing in the real network before employing the DRL method as the default admission policy π0. Once a network admission decision is made, training data, including the input data and the label, can be collected in the form of state-action pair [s, a], where s ∈ S and a ∈ A according to the definition in section III. It is noteworthy that the state information utilized by default policy may not exactly be the same as the collected state s. For example, the greedy algorithm only depends on the queuing requests nreq and the available resources that are not selected in the state space. Nevertheless, these resources can be derived from the ongoing services nsvc and the constant resource utilization vectors rk. Thus, we let the neural network learn such relations through training. As depicted in Fig. 5, the DT network mainly consists of a standard multilayer feed-forward network (FFN), with targeted modifications to the output layer for this task. According to conventional approaches, the output layer should output values representing all actions in action space A, which are subsequently transformed into predicted probabilities via the softmax activation function. This structure proves concise and effective for systems without request queues, where the ac- tion space comprises solely acceptance and rejection options. However, when dealing with tasks involving request queues, the number of potential actions escalates to (nmax + 1)K, StateActionRewardEnvironmentDQNDQNStateActionEnvironmentActor networkCritic networkRewardValueCriticnetworkActor networkDefault Admission Policy 。State for default policyDTNetworkLabelActionStateSoftmaxSoftmax IEEE TRANSACTIONS ON , VOL. 14, NO. 8, AUGUST 2021 7 Algorithm 1: Supervised Learning for DT Network Collect s and a each time the network makes an admission decision, construct dataset and divide it into a training set [Strain, Atrain] and a validation set [Sval, Aval]. Divide the training set into multiple batches [Sbatch, Abatch], and denote the length of each batch as nbatch. Initial the DT network πDT with random parameters θDT. for episode ← 1 to T1 do for [Sbatch, Abatch] in [Strain, Atrain] do Calculate cross-entropy loss LθDT = − 1 nbatch (cid:88) log πDT(a|s; θDT). [s,a]∈[Sbatch,Abatch] (25) Update θDT by performing a gradient descent step on LθDT . end Check the average cross entropy loss and predictive accuracy of πDT in [sval, aval]. end posing challenges in training an effective network. In addition, the conventional structure ignores the inherent relationships among the predicted probabilities of different values for a single variable within the action vector, a formulation for which follows: nmax(cid:88) ∀k ∈ {1, 2, . . . , K}, (23) P(ˆnact k = n|s) = 1, n=0 where ˆnact k denotes the k-th predicted value in the action vector. To settle this problem, we have the output layer separately compute the predicted probability of different values for each variable, rather than for each action, as illustrated in the central part of Fig. 5. In this new structure, the predicted probability for the label action a is derived from the product of the probability for each variable, as expressed by: πDT(a|s) = K (cid:89) P(ˆnact k = nact k |s), a = (cid:2)nact 1 , . . . , nact K (cid:3) , k=1 (24) which can be used in backpropagation and parameter updating in the training phase. During the prediction phase, variables are determined through a greedy algorithm or probability-based sampling, then concatenated to construct the predicted action vector ˆa. This modification decreases the number of nodes in the output layer from (nmax+1)K to K(nmax+1), substantially reducing computational complexity and training challenges. We consider the admission control as a multilabel classi- fication task, where s and a serve as the input and label, respectively. Therefore, we employ cross-entropy loss to train the DT network for approximating the default network policy. The detailed training process is presented in Algorithm 1. Note that training data is collected through monitoring of state and behavior in the real network, while the training process is isolated from the real network, thereby guaranteeing uninterrupted network operations during the implementation of DT. C. DT-assisted Online DRL Algorithm for Admission Control To achieve the DT-assisted Online DRL solution, we need to determine an appropriate DRL algorithm. Notice that the input and output distributions of the DT network are consistent with those of the actor network in actor-critic models (Fig. 3 and Fig. 5). And the actions and states in this task are all discrete vectors. Hence, we choose advantage actor-critic (A2C), a synchronous version of the A3C method, as the base model in this solution. To introduce the A2C algorithm, we begin by defining the state and action value functions: V (s) = E (cid:34) ∞ (cid:88) (cid:35) γtrst (at) | s0 = s , Q(s, a) = E t=0 (cid:34) ∞ (cid:88) t=0 (cid:35) γtrst (at) | s0 = s, a0 = a , (26) (27) where γ is the discount factor that represents how far future rewards are taken into account at this moment. The state value function describes the cumulative rewards initiated from the current state s, while the action value function additionally considers the impact of the current action a on the cumulative rewards. Then the advantage function can be defined as: A(s, a) = Q(s, a) − V (s). (28) This function describes the degree to which the action a performs better or worse than the average action in state s. When the next state is identified as s′, we can express the action value function using the one-step reward and the state value function as follows: Q(s, a) = rs (a) + E (cid:34) ∞ (cid:88) γtrst (at) | s1 = s′ (cid:35) t=1 = rs (a) + γV (s′), (29) by which the advantage function can be rewritten as: A(s, a) = rs (a) + γV (s′) − V (s). (30) Also, the state value function satisfies the Bellman equation and can be recursively defined as: V (s) = E [rs (a) + γV (s′)] . (31) As a result, we can use a single critic network to estimate V (s) and calculate the advantage function for the current action. Due to the consistent functionality between the DT network and the actor network, both of which are responsible for parameterizing the policy π(a|s; θ) through neural networks, we employ the DT network structure directly as the actor network within our the DRL model. For the critic network, we adopt a similar multilayer feed-forward network (FFN) with a one-node output layer to parameterize the state value function V (s; θV ). The loss function for the critic network takes the following form: LθV = (rs (a) + γV (s′; θV ) − V (s; θV ))2 (32) IEEE TRANSACTIONS ON , VOL. 14, NO. 8, AUGUST 2021 8 Algorithm 2: DT-assisted Online DRL solution // Step 1: Train DT network Implement the DT network πDT through Algorithm 1 // Step 2: Train critic network Initial the actor network π as a copy of the DT network with parameter θ = θDT Initial the critic network V with random parameter θV for episode ← 1 to T2 do get state s from environment. perform action a according to policy π(a|s; θ). get next state s′, reward rs(a) from environment. θV ← θV + ∇θV (rs(a) + γV (s′; θV ) − V (s; θV ))2 end // Step 3: Train both actor and critic networks for episode ← 1 to T3 do get state s from environment. perform action a according to policy π(a|s; θ). get next state s′, reward rs(a) from environment. θ ← θ+∇θ log π(a|s; θ)(rs(a)+γV (s′; θV )−V (s; θV )) θV ← θV + ∇θV (rs(a) + γV (s′; θV ) − V (s; θV ))2 end TABLE I ENVIRONMENT SETTINGS Symbol Value Symbol Value K λ1 λ3 1/μ1 1/μ3 th 1 th 3 r1 r3 4 4 3.2 3.2 1.6 0.8 0.2 [0.02, 0.03, 0.04] [0.016, 0.04, 0.016] nmax λ2 λ4 1/μ2 1/μ4 th 2 th 4 r2 r4 3 3.6 2.8 4 2.4 1 0.6 [0.04, 0.02, 0.016] [0.024, 0.024, 0.024] TABLE II TRAINING SETTINGS Symbol Value Dimension of models Number of layers Batch size for DT Learning rate for DT Learning rate for critic Learning rate for actor γ in calculation of A(s, a) 64 3 64 1e-4 1e-4 4e-4 0.99 according to the definition in Equation (31). Meanwhile, the loss function for the actor network is defined as: Lθ = log π(a|s; θ)A(s, a) (33) to optimize the policy by favoring actions with higher advan- tage, thereby maximizing long-term rewards. The training of both networks is realized through continuous admission decisions in the real network. Specifically, given the current state s, the actor network makes an action decision a under its policy π. Then the network implements this chosen action, providing feedback in the form of the reward rs(a) and next state s′. s, rs(a), and s′ are all used to calculate loss functions in Equation (32) and (33) and adjust parameters via gradient descent. In order to stabilize the DRL model, we perform the initialization with θ = θDT to transfer the parameter in DT network πDT to actor network π before training. However, the parameters within the critic network are still randomly initialized. Thus we adopt a two-step training approach to prevent the stable policy from returning stochastic. Firstly, we freeze the actor network and individually train the critic network. In case the DT network faithfully replicates the default admission policy, the training of the critic network will not disrupt the normal operation of the real network, as the policy within the actor network remains unchanged. This training stage persists until the critic network achieves a relatively accurate approximation of the state value function γV (s′; θV ). After that, we unfreeze the actor network and simultaneously train both networks to adjust the policy π to maximize long-term rewards. A detailed description of this process is provided in Algorithm 2. V. PERFORMANCE EVALUATION A. Experiment Setting The simulation of the network system, DT network, and DRL model in this study are implemented based on Python 3.9, Pytorch 1.10, CUDA 11.3, and Numpy. The experimen- tation is performed on a commercial PC (i7-12700KF CPU, Windows 11 64-bit operating system, and 32 GB RAM) with a dedicated GPU (NVIDIA GeForce RTX 3080). The parameter setting of the network environment is out- lined in Table I. As previously discussed in Section III, the slices encompass mMTC, eMBB, URLLC, and other services, which correspond to 1, 2, 3, and 4 in the table. Parameters for each slice are determined based on their respective features. For example, the URLLC service shows the shortest mean service time 1/μ3 = 1.6 and hold time th 3 = 0.2, as well as the maximum computing resource utilization rc 3 = 0.04. In contrast, the services in mMTC and eMBB slices exhibit the highest utilization of storage resources rs 1 = 0.04 and radio resource rr 2 = 0.04 respectively. In terms of the models, we choose the FFN with 3 layers and 64 nodes within each layer. The dimension of FFN is identical in all three networks: DT network, actor network, and critic network. In the supervised learning phase for the DT network, we first collect data to construct a dataset and then train the network, thus we can employ batch training with a batch size of 64 to reduce the fluctuations. On the contrary, during the training of actor and critic networks, only one set of data can be obtained per decision epoch, so we use a batch size of 1 in this scenario. The additional training configurations can be found in Table II. The pre-trained actor network necessitates a relatively higher learning rate to deviate from the original IEEE TRANSACTIONS ON , VOL. 14, NO. 8, AUGUST 2021 9 (a) PRIO (b) PRIO (c) ILP (d) ILP (e) Greedy (f) Greedy Fig. 7. Resource utilization and acceptance ratio in default admission policies set size reaches 100,000 samples, the predictive accuracy of the DT network exceeds 99% for all three policies, indicating a faithful replication of the default admission policies. As discussed in Section IV-B, the process of collecting training samples does not disrupt the normal operation of network systems. Consequently, we employ the DT network trained on a 100,000-sample dataset for subsequent experiments. 2) DT-assisted DRL Performance Evaluation: The perfor- mance of an admission policy can be analyzed across three dimensions: cumulative rewards, resource utilization, and the acceptance ratio of requests within different slices [2], [12], [30]. In this study, during the training phase, we compare resource utilization and acceptance ratio among different methods to assess their impact on the network system. After training completion, cumulative rewards are used to check whether the optimization goal has been achieved. The number of training epochs for step 2 and step 3 in Algorithm 2 is set as T2 = 6000 and T3 = 50000, respectively. Step 2, which exclusively focuses on training the critic network, does not interfere with the network operation when the default policy is accurately replicated. Therefore, we focus on analyzing the performance in step 3. Firstly, we adopt three default policies for 50,000 decision epochs, with the resource utilization and acceptance ratio illustrated in Fig. 7. Because the stochastic arrival and service process will hinder Fig. 6. Predicive accuracy of DT network with different default policies policy, therefore the learning rate for the actor network exceeds that for the critic network in the configuration. Three distinct default admission policies are chosen in our experiment to comprehensively evaluate the performance of our solution. The first policy employs a heuristic algorithm considering priority (defined as URLLC > eMBB > mMTC > other in our experiment) and fairness among different slices, as detailed in [9]. We shall abbreviate this policy as PRIO throughout the remainder of this paper. The second one uses integer linear programming (ILP) to maximize the radio resource utilization at each decision epoch [11]. The third one employs a straightforward greedy algorithm that accepts requests based on the decreasing order of radio resource occupation. Furthermore, we employ the state-of-the-art Dueling-DQN method for comparative analysis alongside our proposed DRL approach. The Dueling-DQN model is configured with a con- sistent architecture comprising three layers, each containing 64 nodes. In the output layer, we retain its conventional structure, aligning the number of nodes with the count of potential actions, calculated as (nmax + 1)K = 256, as opposed to the modified structure we proposed in Section IV-B. To fully demonstrate the effectiveness of our proposed approach, we select a different optimization goal - maxi- mizing revenue from storage resource charges. The reward is calculated as in Equation (21), with the charge vector c = [0, 0, 100]. B. Simulation Results 1) Supervised Learning-based DT Performance Evaluation: We configured the training epochs for our DT network as T1 = 400. To prevent overfitting, we employed the early-stopping technique with a patience of 20 epochs. Figure 6 illustrates the predictive accuracy of the DT network on the test set under different default admission policies and varying training set sizes. The results reveal a positive correlation between predic- tive accuracy and training set size, with accuracy stabilizing as the training sample size increases. Notably, when the training 7UDLQLQJVHWVL]H î $FFXUDF\35,2,/3*UHHG\,WHUDWLRQV î 5HVRXUFHXWLOL]DWLRQ5DGLR&RPSXWLQJ6WRUDJH,WHUDWLRQV î $FFHSWDQFHUDWLRP07&85//&H0%%2WKHU,WHUDWLRQV î 5HVRXUFHXWLOL]DWLRQ5DGLR&RPSXWLQJ6WRUDJH,WHUDWLRQV î $FFHSWDQFHUDWLRP07&85//&H0%%2WKHU,WHUDWLRQV î 5HVRXUFHXWLOL]DWLRQ5DGLR&RPSXWLQJ6WRUDJH,WHUDWLRQV î $FFHSWDQFHUDWLRP07&85//&H0%%2WKHU IEEE TRANSACTIONS ON , VOL. 14, NO. 8, AUGUST 2021 10 (a) Dueling-DQN (b) Dueling-DQN (a) DT-assisted DRL (PRIO) (b) DT-assisted DRL (PRIO) (c) Modified A2C (d) Modified A2C (c) DT-assisted DRL (ILP) (d) DT-assisted DRL (ILP) Fig. 8. Resource utilization and acceptance ratio in directly trained DRL the performance comparison of different policies, we record data every 200 epochs and conduct four experiments using different random seeds. The solid lines in the figures represent the average values across multiple experiments, while the shaded areas denote standard deviations. The curves highlight the characteristics of various policies. In the PRIO policy, the acceptance ratio of services in different slices follows the pre-defined priority order, as shown in Fig. 7b. Apart from that, the ILP and Greedy policies achieve relatively higher radio resource utilization by accepting more eMBB and Other requests. We subsequently conducted direct training for two DRL models: the state-of-the-art Dueling-DQN, and our proposed DRL method within the network environment, as illustrated in Figure 8. During the initial training phases, the directly trained DRL models exhibited stochastic behavior, resulting in com- paratively low resource utilization and an unstable acceptance ratio. Furthermore, the Dueling-DQN, lacking a customized output layer for handling queued requests, encountered chal- lenges in achieving convergence and maintaining stability, as indicated by the substantial standard deviation observed in the wider shaded areas. After approximately 20,000 decision epochs, as our DRL model gradually converges, we observe a plateau in resource utilization as well as the stabilization of the acceptance ratio. According to the acceptance ratio curves, our DRL model exhibits a tendency to accept more mMTC and Other requests to increase storage resource occupation. Next, we implement the DT-assisted DRL solution based on different default policies. In contrast to directly trained models, all DT-assisted DRL models maintain high resource utilization throughout the entire training phase. At the beginning of train- ing, the acceptance ratio pattern in DT-assisted DRL shows consistency with that in default policy, as illustrated on the left side of Figures 9b and 7b. When the training progresses, the acceptance ratio gradually evolves and eventually aligns (e) DT-assisted DRL (Greedy) (f) DT-assisted DRL (Greedy) Fig. 9. Resource utilization and acceptance ratio in DT-assisted DRL with that in the directly trained DRL, as depicted on the right side of Figures 9b and 8d. To quantitatively analyze resource utilization performance between directly trained DRL and DT-assisted DRL methods, we evaluate results from the first 20,000 decision epochs, aggregate data in 4,000-epoch intervals, and present line charts for each resource type. As depicted in Fig. 10, all three DT- assisted DRL methods demonstrate a notable advantage in resource utilization over the directly trained DRL method. Specifically, within the first 4,000 epochs, DT-assisted DRL outperforms the state-of-the-art Dueling-DQN by a substantial margin, with resource utilization improvements ranging from 28.98% to 41.75%. Moreover, to eliminate the influence of model differences, we also assess the performance of DT- assisted DRL against our DRL model. The results show that the DT assistance yields an augmentation in resource utilization of no less than 10.81% and up to 22.36%. These disparities in resource utilization tend to diminish as the models converge. Furthermore, we compare the cumulative rewards using different methods to examine whether the optimization goal has been achieved. Fig. 11 illustrates the cumulative rewards (total storage-based revenue) over 400 decision epochs, where all DRL models outperform the default admission policies in the preset target. Additionally, we observe that the default ,WHUDWLRQV î 5HVRXUFHXWLOL]DWLRQ5DGLR&RPSXWLQJ6WRUDJH,WHUDWLRQV î $FFHSWDQFHUDWLRP07&85//&H0%%2WKHU,WHUDWLRQV î 5HVRXUFHXWLOL]DWLRQ5DGLR&RPSXWLQJ6WRUDJH,WHUDWLRQV î $FFHSWDQFHUDWLRP07&85//&H0%%2WKHU,WHUDWLRQV î 5HVRXUFHXWLOL]DWLRQ5DGLR&RPSXWLQJ6WRUDJH,WHUDWLRQV î $FFHSWDQFHUDWLRP07&85//&H0%%2WKHU,WHUDWLRQV î 5HVRXUFHXWLOL]DWLRQ5DGLR&RPSXWLQJ6WRUDJH,WHUDWLRQV î $FFHSWDQFHUDWLRP07&85//&H0%%2WKHU,WHUDWLRQV î 5HVRXUFHXWLOL]DWLRQ5DGLR&RPSXWLQJ6WRUDJH,WHUDWLRQV î $FFHSWDQFHUDWLRP07&85//&H0%%2WKHU IEEE TRANSACTIONS ON , VOL. 14, NO. 8, AUGUST 2021 11 Fig. 10. Comparison of resource utilization in different methods during the early training stage training. Notably, this performance enhancement initial is accomplished while preserving the capacity to maximize long- term rewards, thus enhancing the feasibility of deploying DRL in real-world network scenarios. Furthermore, the robust performance using a straightforward greedy policy implies that in case the default admission policy is too complex to replicate through DT, like policies incorporating request prediction, a simple substitute policy could still be utilized to implement the proposed solution. APPENDIX A PROOF OF THEOREM 1 Proof. An embedded Markov chain without two disjoint closed sets implies the system will definitely revisit a particular state after certain events, thus exhibiting the properties of a renewal process. Fix the initial state s0 and define the cycle as the time between two consecutive transitions into state s0. According to the renewal-reward theorem [31], lim t→∞ R(t) t = E [R1] E [T1] , (34) where R1 represents the total rewards earned in the first renewal cycle, and T1 represents the length of the first renewal cycle. Also, by the expected-value version of the renewal- reward theorem, lim m→∞ lim m→∞ E [(cid:80)m i=1 ri] m E [(cid:80)m i=1 τi] m = = E [R1] E [N1] E [T1] E [N1] , , (35) (36) where ri and τi denote the reward and the sojourn time over the i-th epoch, and N1 represents the number of epochs in the first renewal cycle. From the above three equations, we have lim t→∞ R(t) t = lim m→∞ E [(cid:80)m E [(cid:80)m i=1 ri] i=1 τi] . (37) Due to the Markovian property of reward and sojourn time, we have (cid:34) m (cid:88) i=1 (cid:34) m (cid:88) E E (cid:35) ri = (cid:35) τi = m (cid:88) (cid:88) n=1 m (cid:88) s∈S (cid:88) rs(πs)p(n) s0,s(π), τs(πs)p(n) s0,s(π). (38) (39) i=1 n=1 s∈S Fig. 11. Average reward in 400 iterations after training admission policy can influence the performance of DT-assisted DRL to a certain extent. When default policies achieved rela- tively high storage revenues (PRIO and Greedy), DT-assisted DRL performed similarly or better than directly trained DRL. In contrast, the ILP policy's deficiency in storage revenue leads the ILP-based DT-assisted DRL to underperform compared to directly trained DRL. Nevertheless, this phenomenon primarily stems from the limited number of training samples, and we anticipate that it will diminish as the models converge further after a substantial number of decision epochs. VI. CONCLUSION In this paper, we have investigated the instability of conven- tional DRL methods for admission control in a sliced network system with request queues and combinatorial radio, comput- ing, and storage resources. We have formulated the admission decision-making process as a semi-Markov decision process and subsequently simplified it into an equivalent discrete-time Markov decision process. To deal with the stochasticity of DRL, we have constructed a DT network using supervised learning and proposed a DT-assisted online DRL solution. Extensive simulations demonstrated that the DT-assisted DRL model increased resource utilization by over 40% compared to directly trained state-of-the-art Dueling-DQN and over 20% compared to our directly trained DRL model during ,WHUDWLRQV î 5DGLRUHVRXUFHXWLOL]DWLRQ,WHUDWLRQV î &RPSXWLQJUHVRXUFHXWLOL]DWLRQ,WHUDWLRQV î 6WRUDJHUHVRXUFHXWLOL]DWLRQ'XHOLQJ'410RGLILHG$&'7DVVLVWHG'5/ 35,2 '7DVVLVWHG'5/ ,/3 '7DVVLVWHG'5/ *UHHG\ &XPXODWLYHUHZDUGV0RGLILHG$&35,2'7DVVLVWHG'5/ 35,2 ,/3'7DVVLVWHG'5/ ,/3 *UHHG\'7DVVLVWHG'5/ *UHHG\ IEEE TRANSACTIONS ON , VOL. 14, NO. 8, AUGUST 2021 12 Then leveraging the relationship between transition probability and equilibrium probability we obtain: lim m→∞ 1 m m (cid:88) n=1 p(n) s0,s(π) = ωs(π), lim t→∞ R(t) t = (cid:80) (cid:80) s∈S rs (πs) ωs(π) s∈S τs (πs) ωs(π) (40) (41) APPENDIX B PROOF OF THEOREM 2 Proof. The equilibrium probabilities ̄ωs(π) in discrete-time MDP satisfy the following equilibrium equation: ̄ωs(π) = = (cid:88) s0∈S (cid:88) s0∈S ̄ωs0 (π) ̄ps0,s(πs0 ) ̄ωs0 (π) τ τs0(πs0) ps0,s(πs0) + ̄ωs(π) 1 − (cid:18) (cid:19) τ τs(πs) (42) By eliminating ̄ωs(π) on both sides of the equation and dividing through by τ , we can reformulate the equation as: ̄ωs(π) τs(πs) (cid:88) = s0∈S ̄ωs0 (π) τs0 (πs0) ps0,s(πs0 ). (43) Notice that the embedded Markov chain in SMDP also satisfies an equilibrium equation by: (cid:88) ωs(π) = ωs0 (π)ps0,s(πs0 ). (44) Thus, for a certain constant γ > 0, s0∈S ωs(π) = γ ̄ωs(π) τs(πs) . (45) Since (cid:80) s∈S ̄ωs = 1, we can determine the value of the constant as γ = (cid:80) s∈S τs(πs)ωs(π). Finally, using Equation (12), (15), and (45), the long-term average reward of the equivalent discrete-time MDP can be derived as follows: (cid:88) ̄g(π) = ̄rs (πs) ̄ωs(π) s∈S (cid:88) s∈S (cid:80) (cid:80) = = (cid:80) rs (πs) τs (πs) s∈S rs (πs) ωs(π) s∈S τs (πs) ωs(π) = g(π) ωs(π)τs(πs) s∈S τs(πs)ωs(π) (46) REFERENCES [1] 3GPP, "Digital cellular system (Phase 2) (GSM); Universal Mobile Telecommunications System (UMTS); LTE; 5G; 3rd Generation Partnership Project (3GPP)," Technical Report 21.915, 2019. telecommunications [2] N. Van Huynh, D. T. Hoang, D. N. Nguyen, and E. Dutkiewicz, "Optimal and fast real-time resource slicing with deep dueling neural networks," IEEE J. Sel. Areas Commun., vol. 37, no. 6, pp. 1455–1470, 2019. [3] D. Silver, A. Huang, C. J. Maddison, A. Guez, L. Sifre, G. Van Den Driessche, J. Schrittwieser, I. Antonoglou, V. Panneershelvam, M. Lanctot et al., "Mastering the game of Go with deep neural networks and tree search," nature, vol. 529, no. 7587, pp. 484–489, 2016. [4] C. Berner, G. Brockman, B. Chan, V. Cheung, P. Debiak, C. Dennison, D. Farhi, Q. Fischer, S. Hashme, C. Hesse et al., "Dota 2 with large scale deep reinforcement learning," arXiv preprint arXiv:1912.06680, 2019. [5] S. Mihai, M. Yaqoob, D. V. Hung, W. Davis, P. Towakel, M. Raza, M. Karamanoglu, B. Barn, D. Shetve, R. V. Prasad et al., "Digital twins: A survey on enabling technologies, challenges, trends and future prospects," IEEE Commun. Surveys Tuts., 2022. [6] W. Jiang, Y. Zhan, G. Zeng, and J. Lu, "Probabilistic- forecasting-based admission control for network slicing in software-defined networks," IEEE Internet Things J., vol. 9, no. 15, pp. 14 030–14 047, 2022. [7] M. Jiang, M. Condoluci, and T. Mahmoodi, "Network slicing management & prioritization in 5g mobile sys- tems," in European wireless 2016; 22th european wire- less conference. VDE, 2016, pp. 1–6. [8] H. M. Soliman and A. Leon-Garcia, "Qos-aware frequency-space network slicing and admission control for virtual wireless networks," in 2016 IEEE Global Communications Conference (GLOBECOM). IEEE, 2016, pp. 1–6. [9] M. Dai, L. Luo, J. Ren, H. Yu, and G. Sun, "Psaccf: Prioritized online slice admission control considering fairness in 5G/B5G networks," IEEE Trans. Netw. Sci. Eng., vol. 9, no. 6, pp. 4101–4114, 2022. [10] D. Bega, M. Gramaglia, A. Banchs, V. Sciancalepore, K. Samdanis, and X. Costa-Perez, "Optimising 5g in- frastructure markets: The business of network slicing," in IEEE INFOCOM 2017-IEEE conference on computer communications. IEEE, 2017, pp. 1–9. [11] M. A. Haque and V. Kirova, "5g network slice admission control using optimization and reinforcement learning," in 2022 IEEE Wireless Communications and Networking Conference (WCNC). IEEE, 2022, pp. 854–859. [12] W. F. Villota-Jacome, O. M. C. Rendon, and N. L. da Fonseca, "Admission control for 5g core network slicing based on deep reinforcement learning," IEEE Syst. J., vol. 16, no. 3, pp. 4686–4697, 2022. [13] S. Troia, A. F. R. Vanegas, L. M. M. Zorello, and G. Maier, "Admission control and virtual network em- bedding in 5g networks: A deep reinforcement-learning approach," IEEE Access, vol. 10, pp. 15 860–15 875, 2022. [14] M. Sulaiman, A. Moayyedi, M. Ahmadi, M. A. Salahud- din, R. Boutaba, and A. Saleh, "Coordinated slicing and admission control using multi-agent deep reinforcement learning," IEEE Trans. Netw. Service Manag., 2022. [15] A. Mozo, A. Karamchandani, S. G ́omez-Canaval, M. Sanz, J. I. Moreno, and A. Pastor, "B5gemini: Ai- driven network digital twin," Sensors, vol. 22, no. 11, p. IEEE TRANSACTIONS ON , VOL. 14, NO. 8, AUGUST 2021 13 4106, 2022. 401, 1963. [16] Z. Tao, Y. Guo, G. He, Y. Huang, and X. You, "Deep learning-based modeling of 5G core control plane for 5G network digital twin," arXiv preprint arXiv:2302.06980, 2023. [17] F. Naeem, G. Kaddoum, and M. Tariq, "Digital twin-empowered network slicing in B5G networks: Experience-driven approach," in 2021 IEEE Globecom Workshops (GC Wkshps). IEEE, 2021, pp. 1–5. [18] L. Tang, Y. Du, Q. Liu, J. Li, S. Li, and Q. Chen, "Digital twin assisted resource allocation for network slicing in industry 4.0 and beyond using distributed deep reinforcement learning," IEEE Internet Things J., 2023. [19] H. Wang, Y. Wu, G. Min, and W. Miao, "A graph neural network-based digital twin for network slicing management," IEEE Trans. Ind. Informat., vol. 18, no. 2, pp. 1367–1376, 2020. [20] X. Foukas, G. Patounas, A. Elmokashfi, and M. K. Marina, "Network slicing in 5g: Survey and challenges," IEEE Commun. Mag., vol. 55, no. 5, pp. 94–100, 2017. John [21] H. C. Tijms, A first course in stochastic models. Wiley and sons, 2003. [22] V. Mnih, K. Kavukcuoglu, D. Silver, A. Graves, I. Antonoglou, D. Wierstra, and M. Riedmiller, "Playing atari with deep reinforcement learning," arXiv preprint arXiv:1312.5602, 2013. [23] H. Van Hasselt, A. Guez, and D. Silver, "Deep reinforce- ment learning with double q-learning," in Proceedings of the AAAI conference on artificial intelligence, vol. 30, no. 1, 2016. [24] Z. Wang, T. Schaul, M. Hessel, H. Hasselt, M. Lanctot, and N. Freitas, "Dueling network architectures for deep reinforcement learning," in International conference on machine learning. PMLR, 2016, pp. 1995–2003. [25] R. J. Williams, "Simple statistical gradient-following al- gorithms for connectionist reinforcement learning," Ma- chine learning, vol. 8, pp. 229–256, 1992. [26] J. Baxter and P. L. Bartlett, "Infinite-horizon policy- intelligence gradient estimation," journal of artificial research, vol. 15, pp. 319–350, 2001. [27] V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu, "Asynchronous methods for deep reinforcement learning," in Interna- tional conference on machine learning. PMLR, 2016, pp. 1928–1937. [28] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov, "Proximal policy optimization algorithms," arXiv preprint arXiv:1707.06347, 2017. [29] T. P. Lillicrap, J. J. Hunt, A. Pritzel, N. Heess, T. Erez, Y. Tassa, D. Silver, and D. Wierstra, "Continuous con- trol with deep reinforcement learning," arXiv preprint arXiv:1509.02971, 2015. [30] D. Bega, M. Gramaglia, A. Banchs, V. Sciancalepore, and X. Costa-Perez, "A machine learning approach to 5g infrastructure market optimization," IEEE Trans. Mobile Comput., vol. 19, no. 3, pp. 498–512, 2019. [31] M. Johns Jr and R. G. Miller Jr, "Average renewal loss rates," The Annals of Mathematical Statistics, pp. 396–
http://arxiv.org/abs/2310.04742v2
"2023-10-10T03:48:52"
"2023-10-07T08:55:54"
Parameter Efficient Multi-task Model Fusion with Partial Linearization
Large pre-trained models have enabled significant advances in machine learning and served as foundation components. Model fusion methods, such as task arithmetic, have been proven to be powerful and scalable to incorporate fine-tuned weights from different tasks into a multi-task model. However, efficiently fine-tuning large pre-trained models on multiple downstream tasks remains challenging, leading to inefficient multi-task model fusion. In this work, we propose a novel method to improve multi-task fusion for parameter-efficient fine-tuning techniques like LoRA fine-tuning. Specifically, our approach partially linearizes only the adapter modules and applies task arithmetic over the linearized adapters. This allows us to leverage the the advantages of model fusion over linearized fine-tuning, while still performing fine-tuning and inference efficiently. We demonstrate that our partial linearization technique enables a more effective fusion of multiple tasks into a single model, outperforming standard adapter tuning and task arithmetic alone. Experimental results demonstrate the capabilities of our proposed partial linearization technique to effectively construct unified multi-task models via the fusion of fine-tuned task vectors. We evaluate performance over an increasing number of tasks and find that our approach outperforms standard parameter-efficient fine-tuning techniques. The results highlight the benefits of partial linearization for scalable and efficient multi-task model fusion.
[ "Anke Tang", "Li Shen", "Yong Luo", "Yibing Zhan", "Han Hu", "Bo Du", "Yixin Chen", "Dacheng Tao" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04742v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04742v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 t c O 0 1 ] G L . s c [ 2 v 2 4 7 4 0 . 0 1 3 2 : v i X r a PARAMETER EFFICIENT MULTI-TASK MODEL FUSION WITH PARTIAL LINEARIZATION A PREPRINT Anke Tang School of Computer Science Wuhan University, China anketang@whu.edu.cn Li Shen JD Explore Academy, China mathshenli@gmail.com Yong Luo School of Computer Science Wuhan University, China luoyong@whu.edu.cn Yibing Zhan JD Explore Academy, China zybjy@mail.ustc.edu.cn Han Hu School of Information and Electronics Beijing Institute of Technology, China hhu@bit.edu.cn Bo Du School of Computer Science Wuhan University, China dubo@whu.edu.cn Yixin Chen Department of CSE Washington University in St. Louis, USA. chen@cse.wustl.edu Dacheng Tao The University of Sydney, Australia dacheng.tao@gmail.com ABSTRACT Large pre-trained models have enabled significant advances in machine learning and served as foundation components. Model fusion methods, such as task arithmetic, have been proven to be powerful and scalable to incorporate fine-tuned weights from different tasks into a multi-task model. However, efficiently fine-tuning large pre-trained models on multiple downstream tasks remains challenging, leading to inefficient multi-task model fusion. In this work, we propose a novel method to improve multi-task fusion for parameter-efficient fine-tuning techniques like LoRA fine-tuning. Specifically, our approach partially linearizes only the adapter modules and applies task arithmetic over the linearized adapters. This allows us to leverage the the advantages of model fusion over linearized fine-tuning, while still performing fine-tuning and inference efficiently. We demonstrate that our partial linearization technique enables a more effective fusion of multiple tasks into a single model, outperforming standard adapter tuning and task arithmetic alone. Experimental results demonstrate the capabilities of our proposed partial linearization technique to effectively construct unified multi-task models via the fusion of fine-tuned task vectors. We evaluate performance over an increasing number of tasks and find that our approach outperforms standard parameter-efficient fine-tuning techniques. The results highlight the benefits of partial linearization for scalable and efficient multi-task model fusion. 1 Introduction Pre-trained models play a crucial role in machine learning systems, serving as foundational components. In order to optimize their performance for specific downstream tasks [Ilharco et al., 2022, Wortsman et al., 2022a, Matena and Raffel, 2022], address biases or undesired behavior [Santurkar et al., 2021, Ribeiro and Lundberg, 2022, Murty et al., 2022, Ilharco et al., 2023], align them with human preferences [Glaese et al., 2022, Lu et al., 2022, Ouyang et al., 2022, Ribeiro and Lundberg, 2022], or incorporate new information [Zhu et al., 2020, De Cao et al., 2021, Mitchell et al., 2022a,b], it is often necessary to further customize or edit these models after pre-training. Multi-task model fusion is a powerful approach to extracting knowledge from models fine-tuned on different downstream tasks, allowing us to create a unified model that performs well across multiple tasks. This approach proves to be helpful arXiv Template A PREPRINT when only the fine-tuned model can be obtained but the data remains private and inaccessible [Wu et al., 2019, Lou et al., 2020, Tang et al., 2023]; besides, it can expedite the fine-tuning of the multi-task model since compared to the pre-trained model, we have a better starting point from which to fine-tune [Kaddour, 2022, Sanyal et al., 2023]. In recent studies, researchers have introduced many powerful methods for editing pre-trained models and merging task-specific fine-tuned models. These techniques focus on manipulating models' weights using approaches like task arithmetic or weight interpolation [Ainsworth et al., 2023, Ilharco et al., 2023, Wortsman et al., 2022b, Frankle et al., 2020, Ilharco et al., 2022, Izmailov et al., 2019, Matena and Raffel, 2022, Singh and Jaggi, 2023]. In multi-task model fusion, task arithmetic [Ilharco et al., 2023] offers significant advantages. By adding together the fine-tuned task vectors of different tasks, we can achieve a collaborative effect where the strengths of individual task-specific models are combined, leading to improved performance across the tasks. The vast parameter size of pre-trained models poses challenges in terms of computational efficiency and memory usage during the fine-tuning process; these difficulties further lead to inefficient multi-task model fusion. Fine-tuning large-scale models requires significant computational resources and memory, making the process inefficient. To address this concern, many parameter-efficient fine-tuning (PEFT) techniques are proposed, these approaches significantly reduce the number of parameters that need to be fine-tuned, meanwhile achieving comparable performance to full parameter fine-tuning. However, naively combining models that were fine-tuned in a parameter-efficient manner can more readily result in representational interference between tasks, which makes model fusion algorithms to be suboptimal. While some research has explored fusing parameter-efficient fine-tuned models for multi-task model fusion [Chronopoulou et al., 2023, Zhang et al., 2023, Huang et al., 2023], performance still lags considerably behind fusing fully fine-tuned models. Therefore, the key challenge is performing PEFT while also preventing negative interference between task-specific representations. Motivated by these concerns, we aim to enhance the multi-task model fusion capabilities of parameter-efficient fine-tuned models. In this work, we present a novel approach to improve the multi-task fusion capability of parameter-efficient fine- tuning models. Recent advances in understanding task arithmetic and weight disentanglement have demonstrated that linearizing the entire model and fine-tuning the corresponding tangent model in tangent space can enable more effective task arithmetic [Guillermo Ortiz-Jimenez et al., 2023]. While promising, completely linearizing a large pre-trained model can be computationally expensive. Typically, this approach requires two to three times the computational resources needed for fine-tuning and inference. Our key insight is that we can perform efficient fine-tuning and disentangle task representations by only linearizing a subset of parameters appended to a fixed pre-trained backbone. In essence, we are proposing a hybrid approach that leverages parameter-efficient fine-tuning for efficiency, while locally linearizing the adaptable modules to attain enhanced disentanglement and improved multi-task fusion capabilities. Our experiments on image classification and natural language processing tasks demonstrate that our partial linearization technique enables more effective model fusion, achieving superior performance across tasks compared to conventional PEFT methods and model fusion algorithms alone. In some cases, our proposed method is even comparable to full fine-tuning. In addition to the direct comparison of multi-task model fusion performance, we also visualize the weight disentanglement gain of our method on different downstream task pairs. The results show that our method can effectively improve the weight disentanglement of parameter-efficient fine-tuning models, which is the key to improving the multi-task fusion capability of parameter-efficient fine-tuning models. To summarize, our contributions are as follows: • We propose a novel partial linearization method for parameter-efficient fine-tuning models in order to improve the multi-task fusion capability of fine-tuned task-specific models with a low computational cost overhead. • We apply our method to the LoRA modules to construct Linearized LoRA (L-LoRA) modules and conduct extensive experiments on seven tasks from the GLUE benchmark to demonstrate that our method is effective in improving the multi-task fusion capability of fine-tuned task-specific models. • We present an extension of weight disentanglement property and weight disentanglement error for parameter- efficient fine-tuning models to analyze the impact of the linearization process on parameter-efficient modules. We evaluate fine-tuned models to visualize and analyze the weight disentanglement gain of L-LoRA on downstream tasks. 2 Related Work Model Fusion. In practical training scenarios, it is common practice to train multiple models with various hyper- parameter configurations. Subsequently, the top-performing individual model is selected, or an ensemble of models is constructed to attain optimal performance [Dietterich, 2000]. However, deploying an ensemble of models incurs 2 arXiv Template A PREPRINT additional computing expenses during inference. Meanwhile, selecting a single top-performing model typically entails discarding the remaining trained models, resulting in neglecting their encoded knowledge. Model fusion integrates the knowledge from multiple models into a single unified model [Li et al., 2023]. There are two mainstream of work for model fusion. The first line of work focuses on the fusion of entire models. Weight interpolation is a simple yet effective method for model fusion. Interpolating the entire weight space of multiple models by taking their average or weighted combination can be effective for model fusion as demonstrated in prior works [Garipov et al., 2018, Ilharco et al., 2022, Matena and Raffel, 2022, Wortsman et al., 2022b, Ilharco et al., 2023, Liu and Soatto, 2023]. When the models are not be well-aligned or lie in different loss basins, techniques have proposed to align the feature representation before fusion [Ainsworth et al., 2023, Jin et al., 2023]. This feature alignment helps matching the models to similar behaviors or transforming to a same loss basin. Fusing the full model can leverage knowledge from all layers but can be computationally expensive. The second line of work focuses on fusing parts of the model. For example, [George Stoica et al., 2023] aligns and fuses a large portion of the models to combine models trained on disjoint tasks and supports partial zipping up to a specified layer to create a multi-head model. [Yadav et al., 2023] removes redundant and potentially interfering values and resolves sign conflicts before doing weight interpolation. Other researches explore merging parameter-efficient modules as a more lightweight approach [Chronopoulou et al., 2023, Huang et al., 2023, Zhang et al., 2023, Wu et al., 2023]. Parameter-efficient fine-tuning (PEFT). The use of transfer learning from pre-trained models has become a widely accepted practice, resulting in impressive performance across various domains [Devlin et al., 2019, Radford et al., 2019]. In addition to fine-tuning all the model parameters, parameter-efficient fine-tuning techniques have been proposed to reduce the number of parameters that need to be fine-tuned, such as adapter tuning [Houlsby et al., 2019], prefix tuning [Li and Liang, 2021], prompt tuning [Lester et al., 2021], LoRA [Hu et al., 2021] and (IA)3 Liu et al. [2022] et al. These methods only update a small subset of (extra) parameters, lowering computational costs and memory requirements compared to full fine-tuning, while retaining comparable performance. 3 Rethinking Model Fusion in PEFT Setting In this section, we first introduce the preliminary formulas of parameter-efficient fine-tuning and define task vectors for parameter-efficient fine-tuning models. Then, we introduce the weight disentanglement property and weight disentanglement error in PEFT setting. 3.1 Preliminary τi )}si τi , y(j) j=1, where si is dataset size of Dτi, {x(j) Under the framework of supervised learning, assume we have a set of tasks T = {τ1, τ2, * * * , τn} and a pre-trained language model fθ0 parameterized by θ0 which is trained on a massive dataset. Each task τi is associated with a dataset Dτi = {(x(j) j=1 is the output data. Given a specific task τi, the pre-trained model fθ0 is fine-tuned on the task-specific dataset Dτi to obtain a task-specific model. We consider full parameter fine-tuning and parameter-efficient fine-tuning methods. If the model fθ0 is fully fine-tuned on task τi, the parameters θ0 are updated to θi by minimizing the loss function θi = arg minθ L(τi; θ) on the task-specific dataset Dτi. Otherwise, if the model fθ0 is parameter-efficiently fine-tuned on task τi, the original parameters θ0 are fixed and some extra added parameters φ (the number of parameters of φ is much less than θ0, i.e., |φ|/|θ0| ≪ 1) are updated to φi by minimizing the loss function φi = arg minφ L(τi; θ0, φ) on the task-specific dataset Dτi. Where L is typically the Cross-Entropy loss function to maximize conditional posterior probability p(y|x), more specifically j=1 is the input data, and {y(j) τi }si τi }si L(τi; θ0, φ) = 1 si si(cid:88) j=1 (cid:16) (cid:16) fθ0 LCE x(j) τi ; φ (cid:17) (cid:17) , y(j) τi ∈ R+. (1) Task vector. We define the task vector as the difference between the fine-tuned trainable parameters and their initial state. The task vector is denoted as νi = θi − θ0 for full fine-tuning or νi = φi − φ0 for parameter-efficient fine-tuning. 3.2 Weight Disentanglement for Parameter-Efficient Fine-Tuning In this subsection, we discuss and present an extension of the weight disentanglement property and weight disentangle- ment error to parameter-efficient fine-tuning models, which are original introduced in [Guillermo Ortiz-Jimenez et al., 2023]. 3 arXiv Template A PREPRINT (a) (b) (c) Figure 1: Loss landscape visualization. Here, we visualize the loss landscape L(τ1; θ) + L(τ2; θ) for CLIP model on combinations of three downstream image classification tasks by interpolating on the 2D plane. θ = θ0 + (cid:80)2 i=1 λi(θi − θ0), where θ0 are the pre-trained weights, θi are the task-specific full fine-tuned weights for task τi. From these heatmaps, we observe that task-specific models reside in the same loss basin when evaluated on the joint task. Weight disentanglement for parameter-efficient fine-tuning. The weight disentanglement is defined by the function outputs of the merged model. Consider a PEFT model denoted as fθ0(x; φ0) whose tunable weights are initialized as φ0. We define this model to possess weight disentanglement characteristics in relation to a specific set of task vectors {νi|νi = φi − φ0}i∈[n] and their corresponding support datasets {Dτi}i∈[n] if the following condition is satisfied: fθ(x; φ + n (cid:88) i=1 λiνi) = n (cid:88) i=1 gi(x; λiνi) + g0(x), (2) where gi(x; λiνi) = 0 for x /∈ Dνi and i = 1, 2, ..., n and g0(x) = 0 for x ∈ (cid:83) i∈[n] Dτi. This condition ensures that the model fθ(x; φ) can be expressed as a linear combination of individual terms gi(x; λiνi), incorporating the respective task vectors and an additional term g0(x). Through adhering to this disentanglement condition, the model demonstrates the desired capability of effectively separating and disentangling the weights associated with the function outputs, enhancing its capacity to capture task-specific information. However, it is important to highlight that weight disentanglement is a characteristic specific to the function outputs and is not directly linked to their performance. In other words, a model may exhibit weight disentanglement property yet still perform weakly. Since weight disentanglement of function outputs does not guarantee task success in itself, as other factors, such as the evaluation metrics, can be non-linear to determine the overall performance. Therefore, it is crucial to consider weight disentanglement alongside other performance metrics when analyzing model behavior and effectiveness across different tasks. Weight disentanglement error in PEFT setting. Given two task vectors {νi}i=1,2, we define the extension of disentanglement error for model fθ0(x; φ0) as follows: ξ(λ1, λ2) = 2 (cid:88) i=1 Ex∼P (Dτi ) [dist(fθ0(x; φ0 + λiνi), fθ0(x; φ0 + λ1ν1 + λ2ν2))] . (3) Where dist(*, *) represents any chosen distance metric between two vector outputs. Taking classification tasks as an example, dist can be chosen as the prediction error, i.e., dist(y1, y2) = 1(y1 ̸= y2). Intuitively, this measures how much the prediction changes when adding each task vector individually versus adding both together. If task knowledge is well-disentangled, adding the specialized vectors independently or together should yield similar predictions, minimizing ξ. The disentanglement error quantifies the degree of interference between task vectors. Lower values indicate task knowledge that can be combined with less destructive interaction during model merging. 3.3 Geometric Intuition for Model Fusion In previous work, it is generally believed that the closer the orthogonal between task vectors, the less interference between tasks and the better the effect of weight disentanglement [Ilharco et al., 2023, Chen et al., 2023, Guillermo Ortiz-Jimenez et al., 2023]. The intuition is that orthogonal task vectors indicate that the specialized knowledge captured for each task lies in distinct subspaces with minimal overlap or redundancy. This enables better preservation of specialized knowledge and avoids destructive interference during model merging. We visualize the loss landscape of the joint tasks in Figure 1 [Li et al., 2018], where we interpolate between the pre-trained weights θ0 and two task-specific fine-tuned weights θ1, θ2 for CLIP models [Radford et al., 2021]. The 4 1012 (DTD)1011 (Cars)012Cars - DTD24681012 (GTSRB)1011 (Cars)012Cars - GTSRB2468101012 (GTSRB)1011 (DTD)012DTD - GTSRB246810 arXiv Template A PREPRINT (a) full fine-tuning (b) LoRA fine-tuning (c) L-LoRA fine-tuning Figure 2: Similarity heatmaps. These figures show heatmaps of the cosine similarity between task vectors from task-specific CLIP models [Radford et al., 2021] fine-tuned on different tasks. (a) Cos similarity matrix of task vectors when using full fine-tuning of the entire model. (b) Task vector similarities when using LoRA. (c) Cos similarity of task vectors when using L-LoRA, our proposed partial linearization approach that linearizes PEFT modules and fine-tunes in tangent space. 2D heatmaps show the loss values L(τ1, θ) + L(τ2, θ) evaluated on the joint tasks. Notably, we observe that the task-specific models reside at the edge of the same low-loss basin, with no significant barriers or discontinuities in between. It provides geometric intuition for why a simple linear arithmetic operation of task-specific parameters θ1 and θ2 can produce effective merging for multitask learning, as empirically observed. The results in Figures 2(a-b) and 8(a-b) show the cosine similarity between task vectors from CLIP and Flan-T5 [Chung et al., 2022], which are fully fine-tuned or LoRA fine-tuned on image classification tasks and natural language processing (NLP) tasks respectively. We observe that vectors from full fine-tuning are closer to orthogonal than those from LoRA, which indicates that models fine-tuned with full fine-tuning are more independent than those in LoRA. This finding is consistent with the discussion about task addition in [Ilharco et al., 2023], the experimental results from Figures 4 and 5 also support our statement. The experimental details are described in Appendix B. Remark 3.1 At first glance, it may seem unfair to compare the task vectors from full fine-tuning to those from parameter- efficient fine-tuning methods, since full fine-tuning has access to much more trainable parameters. In fact for full fine-tuning we have fθ(x) = fθ(x; φ0) so that ⟨νi, νj⟩ ∥νi∥2∥νj∥2 = ⟨[θi − θ0, 0], [θj − θ0, 0]⟩ ∥[θi − θ0, 0]∥2∥[θj − θ0, 0]∥2 = ⟨[θi − θ0, φ0 − φ0], [θj − θ0, φ0 − φ0]⟩ ∥[θi − θ0, φ0 − φ0]∥2∥[θj − θ0, φ0 − φ0]∥2 ; on the other hand, for parameter-efficient fine-tuning we have ⟨νi, νj⟩ ∥νi∥2∥νj∥2 = ⟨[0, φi − φ0], [0, φj − φ0]⟩ ∥[0, φi − φ0]∥2, ∥[0, φj − φ0]∥2 = ⟨[θ0 − θ0, φi − φ0], [θ0 − θ0, φj − φ0] ∥[θ0 − θ0, φi − φ0]∥2∥[θ0 − θ0, φj − φ0]∥2 . Therefore, the comparison between full fine-tuning and parameter-efficient fine-tuning methods can be made fair by viewing them as updating different subsets of the joint parameter space (θ, φ). 4 Methodology Based on the above observations, we propose a novel partial linearization method for parameter-efficient fine-tuning models in order to enhance the weight disentanglement and improve the multi-task fusion capability of fine-tuned task-specific models with a low computational cost overhead. 4.1 Linearized Parameter-Efficient Fine-Tuning To monitor the progressive of trainable parameters φ throughout the training trajectory, we treat φ as a function of the training time t, denoted as φ(t). Where t ranges from 0 to T . By employing a first-order Taylor expansion, we can streamline the dynamics of network learning as [Weng, 2022]: fθ0(x; φ(t)) ≈ f lin θ0 (x; φ(t)) = fθ0 (x; φ(0)) + ∇φfθ0(x; φ(0))⊤(φ(t) − φ(0)). (4) 5 CarsDTDEuroSATGTSRBRESISC45SUN397SVHNCarsDTDEuroSATGTSRBRESISC45SUN397SVHN1.000.240.200.260.190.190.170.241.000.220.260.210.200.180.200.221.000.250.210.170.190.260.260.251.000.220.210.230.190.210.210.221.000.170.150.190.200.170.210.171.000.140.170.180.190.230.150.141.00CarsDTDEuroSATGTSRBRESISC45SUN397SVHNCarsDTDEuroSATGTSRBRESISC45SUN397SVHN1.000.200.120.120.190.350.090.201.000.230.190.350.340.140.120.231.000.320.370.210.280.120.190.321.000.220.180.320.190.350.370.221.000.350.170.350.340.210.180.351.000.140.090.140.280.320.170.141.00CarsDTDEuroSATGTSRBRESISC45SUN397SVHNCarsDTDEuroSATGTSRBRESISC45SUN397SVHN1.000.110.060.050.160.310.030.111.000.050.050.140.180.020.060.051.000.080.200.090.040.050.050.081.000.060.050.100.160.140.200.061.000.260.050.310.180.090.050.261.000.050.030.020.040.100.050.051.000.00.20.40.60.81.0 arXiv Template A PREPRINT Figure 3: Four types of fine-tuning paradigms. (a) Full parameter fine-tuning. (b) Full-model linearization. (c) Parameter-efficient fine-tuning. (c) Linearized parameter-efficient fine-tuning. In this paper, we explore LoRA fine- tuning and linearized LoRA (L-LoRA) fine-tuning. The linearized model, described by Eq.(4) also referred to as a tangent model, approximates the behavior of the neural network fθ0(x, φ(t)) at a specific time t, where θ0, fθ0 (x; φ(0)), ∇φfθ0(x; φ(0)) are all constants. Consequently, the linearized function f lin θ0 (φ(t); x) is a linear function of φ(t). Based on the derivation from a neural tangent kernel theory perspective in Appendix A, we hypothesize that partial linearization of a subset of model parameters during fine-tuning can also improve weight disentanglement compared to full non-linear fine-tuning. Figure 3 illustrates four different types of fine-tuning paradigms. The first three are existing methods, while the fourth is our proposed partial linearization fine-tuning method. (a) The full fine-tuning paradigm, all parameters θ are updated during fine-tuning. (b) The full-model linearization paradigm, all parameters θ are also updated, but instead we fine-tune the tangent model in the tangent space. It is worth noting that although the Jacobian vector products can be computed in a single forward pass [Pearlmutter, 1994], training and inference in this paradigm are usually twice or three times as expensive as full fine-tuning a non-linear model, a quantitative comparison is shown in Tables 2 and 3. (c) The PEFT paradigm, only a small number of parameters φ are updated while θ is fixed at θ0. (d) the linearized PEFT (L-PEFT) paradigm, L-PEFT fine-tuning is similar to PEFT fine-tuning, where φ is updated while θ0 is fixed. However, in L-PEFT, only the linearized PEFT modules are fine-tuned in the tangent space. This approach incurs only a fraction of the training and inference costs compared to standard PEFT fine-tuning. In this paper, we explore LoRA fine-tuning and linearized LoRA (L-LoRA) fine-tuning. From Figures 2 and 8, we observe that task vectors from L-LoRA fine-tuning are closer to orthogonal than those from LoRA, which indicates that models fine-tuned with L-LoRA are more task-independent than those in LoRA. This is because the trainable parameters φ with L-LoRA are fine-tuned in the tangent space, which is a linear space, while φ in LoRA are fine-tuned in the original ambient space, which is a non-linear space. Besides, in some cases, the cosine similarity of task vectors from full fine-tuning are more orthogonal than those from L-LoRA. This may due to the larger space of trainable parameters available to full fine-tuning, providing an extremely high-dimensional space to encode specialized task knowledge. So even though L-LoRA tunes parameters in a linear subspace, the total capacity is restricted compared to full fine-tuning. 4.2 The Parameter-Scaling Law for Weight Disentanglement Previous findings in [Ilharco et al., 2023, Guillermo Ortiz-Jimenez et al., 2023] also suggest an empirical parameter- scaling law wherein weight disentanglement improves with increased number of trainable model parameters. Intuitively, (1) The larger the number of parameters, the stronger the expressive ability of the model, which can better learn the correlation between different tasks, thus facilitating weight disentanglement. (2) The over-parameterization brought about by a large number of parameters can provide more degrees of freedom to learn the feature representation required for each task and reduce parameter competition or interference between different tasks. Figure 5(a) shows that even though L-LoRA fine-tuning has far fewer trainable parameters compared to full fine-tuning (<1%), it achieves comparable average normalized scores to full fine-tuning. 6 AttentionAdd & Layer NormFeed ForwardAdd & Layer NormAttentionAdd & Layer NormFeed ForwardAdd & Layer NormAttentionAdd & Layer NormFeed ForwardAdd & Layer NormAttentionAdd & Layer NormFeed ForwardAdd & Layer NormTrainableParametersFixedParametersLinearizedPart(a)(b)(c)(d) arXiv Template A PREPRINT (a) CLIP-ViT-B-16 model on image classification tasks. (b) Flan-T5-Base model on NLP tasks. Figure 4: Pairs of model fusion. These figures show scatter plots demonstrating the performance of different model fusion techniques on pairs of tasks. Each plot corresponds to a different fusion method. The x and y axes in each plot denote the normalized scores on the two tasks. Points indicate the performance of specific instances. Dashed lines represent the average performance per task for each method. (a) Image classification tasks. (b) NLP tasks. 5 Experiments In this section, we conduct experiments on diverse tasks spanning both vision and natural language domains. We employ CLIP and Flan-T5 models on vision and language domains respectively. For detailed descriptions, please refer to Appendix B. Throughout the following experiments, we compare the performance when models are fine-tuned using full fine-tuning, LoRA [Hu et al., 2021], and our proposed L-LoRA fine-tuning. A more detailed experimental description about model fine-tuning is provided in Appendix B. Baseline methods. We compare our fine-tuning method combined with four baseline multi-task model fusion methods: simple average, task arithmetic [Ilharco et al., 2023, Zhang et al., 2023], ties-merging [Yadav et al., 2023], and LoraHub [Huang et al., 2023]. Please refer to Appendix D.1 for a more detailed description of these methods and hyper-parameter settings in our experiments. 5.1 Multi-task Model Fusion on Vision and Language domains We extensively investigate the multi-task model fusion by considering all possible subsets of the tasks, amounting to a total of 2n − (n + 1) subsets (excluding subsets with a single task and an empty set). To be precise, for every subset T ′ ∈ P({τi}7 i=1), we aim to construct a multi-task model that achieves optimal performance on the validation task τ val associated with a validation dataset Dτ val = (cid:83) τ ∈T ′ Dτ . We employ various model fusion algorithms to accomplish this. Subsequently, we assess the performance of the final model across the downstream tasks in both the vision and language domains. Detailed experimental settings are provided in Appendix D. i=1)\(∅ ∪ {{τi}}7 Figure 4 It shows scatter plots demonstrating the performance of four fusion methods: simple averaging, task arithmetic, ties-merging, and LoraHub. Each plot corresponds to one fusion approach applied to two tasks. This analysis of pairs of tasks highlights distinctions between fusion techniques. For image classification tasks, we observe that L-LoRA fine-tuning surpasses LoRA fine-tuning with all four model fusion algorithms, with task arithmetic and LoraHub even exceeds full fine-tuning. As for NLP tasks, we observe comparable results between LoRA fine-tuning and L-LoRA fine-tuning, although not as strong as full fine-tuning in some cases. Figures 5, 10 and 11 show the performance of multi-task models constructed using different fine-tuning methods and fusion algorithms over an increasing number of task vectors. In line with [Ilharco et al., 2023], we compare the 7 0.00.51.0Task 10.000.250.500.751.00Task 2Simple Average0.00.51.0Task 10.000.250.500.751.00Task Arithemtic0.00.51.0Task 10.000.250.500.751.00Ties-Mergingfull-finetuneFFT meanLoRALoRA meanL-LoRAL-LoRA mean0.00.51.0Task 10.000.250.500.751.00LoraHub0.00.51.0Task 10.000.250.500.751.00Task 2Simple Average0.00.51.0Task 10.000.250.500.751.00Task Arithemtic0.00.51.0Task 10.000.250.500.751.00Ties-Mergingfull-finetuneFFT meanLoRALoRA meanL-LoRAL-LoRA mean0.00.51.0Task 10.000.250.500.751.00LoraHub arXiv Template A PREPRINT (a) CLIP-ViT-B-16 model on image classification tasks. (b) Flan-T5-Base model on NLP tasks. Figure 5: Multi-task model fusion. we construct multi-task models by utilizing task vectors specific to individual tasks, employing various model fusion algorithms. In the evaluation, the x-axis represents the number of task vectors used in building the multi-task model, while the y-axis represents the average normalized scores of the resulting models across all seven downstream tasks. The lines on the plot represent the average normalized scores of all multi-task models when considering a fixed number of tasks, and the shaded area corresponds to the standard deviation. normalized scores of merged multi-task models. The normalized score is defined as the absolute score divided by the score of the corresponding single-task model. These results highlight the capability of model fusion methods to effectively leverage knowledge from multiple task-specific models into a single unified model. In Figure 5, we also notice that for full fine-tuning, the ties-merging performs better than LoraHub on visual tasks, while this is not the case on NLP tasks. Ties-meriging introduces several innovations to address the challenges of parameter interference. This indicates that the degree of interference between visual tasks is higher than that between NLP tasks. Compare the cosine similarities matrix between Figure 2(a) and Figure 8(a), indeed, the task vectors on vision domain have higher cosine similarity, which is consistent with this model fusion phenomenon. Since the higher cosine similarity between task vectors implies greater redundancy and overlap in the knowledge captured. This results in more destructive task interference when naively merging the specialized models. For both image classification tasks and NLP tasks, we observe that the normalized scores of L-LoRA surpass LoRA fine-tuning in most cases, and L-LoRA even exceeds full fine-tuning with task arithmetic and ties-merging. In addition, LoRA is more effective than L-LoRA for a smaller number of tasks in some cases, but as the number of task vectors increases, L-LoRA surpasses LoRA. This phenomenon also suggests the effectiveness of L-LoRA fine-tuning for multi-task model fusion, we further discuss it in Appendix D.2. A more in-depth analysis comparing between LoRA and L-LoRA is provided in Figures 10 and 11. For further elaboration and supplementary details, please refer to Appendix D. 5.2 Weight Disentanglement Visualization To analyze the impact of the partial linearization process of PEFT modules on weight disentanglement, we evaluate LoRA fine-tuned models and their L-LoRA counterparts to visualize in Figure 6. The heatmaps allow us to compare the error landscapes in the interpolation space. There is clear differences between the LoRA and L-LoRA heatmaps. The results indicate that the LoRA models exhibit a negligible disentanglement error confined to a narrow region in proximity to their pre-trained model. Conversely, the L-LoRA models showcase a low-error distribution across a wider area. These findings strongly suggest that the linearization process employed in 8 246Number of Tasks0.60.70.8Average Normalized ScoreSimple Average246Number of TasksTask Arithmetic246Number of TasksTies Mergingfull-finetuneLoRAL-LoRA246Number of TasksLoraHub246Number of Tasks0.00.10.20.30.4Average Normalized ScoreSimple Average246Number of TasksTask Arithmetic246Number of TasksTies Mergingfull-finetuneLoRAL-LoRA246Number of TasksLoraHub arXiv Template A PREPRINT Figure 6: Weight disentanglement error visualization (LoRA vs L-LoRA): The heatmaps demonstrate the disentan- glement error, denoted as ξ(λ1, λ2), for both a LoRA fine-tuned flan-t5-base models and their L-LoRA counterparts across various NLP task pairs. In these heatmaps, lighter regions indicate lower weight disentanglement error, indicating stronger weight disentanglement. Within the heatmaps, the red box outlines the specific search space utilized to calculate the optimal λ hyperparameters for our multi-model fusion experiments (refer to Section 5.1 and Appendix D). L-LoRA fine-tuning offers notable advantages in effectively disentangling the weights learned for each specific task, thereby enhancing its ability to capture task-specific information and improve performance across diverse tasks. 6 Conclusion In this work, we propose a novel partial linearization method to improve multi-task fusion for parameter-efficient fine-tuning techniques. Specifically, our approach partially linearizes only the adapter modules and applies model fusion algorithms over the linearized adapters. This allows us to leverage the the advantages of model fusion over linearized fine-tuning, while still performing fine-tuning and inference efficiently. Our experiments are conduct on both vision and language domains extensively. The results demonstrate that partially linearized LoRA models enable a more effective fusion of multiple tasks into a unified multi-task model, outperforming standard LoRA fine-tuning and model fusion algorithms alone. Future work could further explore partial linearization, where some parameters are fine-tuned in a linear space while others remain nonlinear. This hybrid approach could trade-off between specialized single-task performance and weight disentanglement capability. References Gabriel Ilharco, Mitchell Wortsman, Samir Yitzhak Gadre, Shuran Song, Hannaneh Hajishirzi, Simon Kornblith, Ali Farhadi, and Ludwig Schmidt. Patching open-vocabulary models by interpolating weights, October 2022. URL http://arxiv.org/abs/2208.05592. arXiv:2208.05592 [cs]. Mitchell Wortsman, Gabriel Ilharco, Jong Wook Kim, Mike Li, Simon Kornblith, Rebecca Roelofs, Raphael Gontijo- Lopes, Hannaneh Hajishirzi, Ali Farhadi, Hongseok Namkoong, and Ludwig Schmidt. Robust fine-tuning of zero-shot models, June 2022a. URL http://arxiv.org/abs/2109.01903. arXiv:2109.01903 [cs]. Michael Matena and Colin Raffel. Merging Models with Fisher-Weighted Averaging, August 2022. URL http: //arxiv.org/abs/2111.09832. arXiv:2111.09832 [cs]. Shibani Santurkar, Dimitris Tsipras, Mahalaxmi Elango, David Bau, Antonio Torralba, and Aleksander Madry. Editing a classifier by rewriting its prediction rules. In Advances in Neural Information Processing Systems, volume 34, pages 23359–23373. Curran Associates, Inc., 2021. URL https://proceedings.neurips.cc/paper/2021/ hash/c46489a2d5a9a9ecfc53b17610926ddd-Abstract.html. Marco Tulio Ribeiro and Scott Lundberg. Adaptive Testing and Debugging of NLP Models. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 3253–3267, 9 2101221012LoRA2COLA-MRPC2101221012COLA-RTE2101221012MRPC-RTE2101221012MRPC-SST221012121012L-LoRA2COLA-MRPC21012121012COLA-RTE21012121012MRPC-RTE21012121012MRPC-SST20.00.51.01.52.00.00.51.01.52.0 arXiv Template A PREPRINT Dublin, Ireland, May 2022. Association for Computational Linguistics. doi:10.18653/v1/2022.acl-long.230. URL https://aclanthology.org/2022.acl-long.230. Shikhar Murty, Christopher Manning, Scott Lundberg, and Marco Tulio Ribeiro. Fixing Model Bugs with Natural Language Patches. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pages 11600–11613, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. doi:10.18653/v1/2022.emnlp-main.797. URL https://aclanthology.org/2022.emnlp-main.797. Gabriel Ilharco, Marco Tulio Ribeiro, Mitchell Wortsman, Suchin Gururangan, Ludwig Schmidt, Hannaneh Hajishirzi, and Ali Farhadi. Editing Models with Task Arithmetic, March 2023. URL http://arxiv.org/abs/2212.04089. arXiv:2212.04089 [cs]. Amelia Glaese, Nat McAleese, Maja Tr ̨ebacz, John Aslanides, Vlad Firoiu, Timo Ewalds, Maribeth Rauh, Laura Weidinger, Martin Chadwick, Phoebe Thacker, Lucy Campbell-Gillingham, Jonathan Uesato, Po-Sen Huang, Ramona Comanescu, Fan Yang, Abigail See, Sumanth Dathathri, Rory Greig, Charlie Chen, Doug Fritz, Jaume Sanchez Elias, Richard Green, Soˇna Mokrá, Nicholas Fernando, Boxi Wu, Rachel Foley, Susannah Young, Iason Gabriel, William Isaac, John Mellor, Demis Hassabis, Koray Kavukcuoglu, Lisa Anne Hendricks, and Geoffrey Irving. Improving alignment of dialogue agents via targeted human judgements, September 2022. URL http://arxiv.org/abs/ 2209.14375. arXiv:2209.14375 [cs]. Ximing Lu, Sean Welleck, Jack Hessel, Liwei Jiang, Lianhui Qin, Peter West, Prithviraj Ammanabrolu, and Yejin Choi. QUARK: Controllable Text Generation with Reinforced Unlearning. Advances in Neural Information Processing Systems, 35:27591–27609, December 2022. URL https://papers.nips.cc/paper_files/paper/ 2022/hash/b125999bde7e80910cbdbd323087df8f-Abstract-Conference.html. Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback, March 2022. URL http://arxiv.org/abs/2203.02155. arXiv:2203.02155 [cs]. Chen Zhu, Ankit Singh Rawat, Manzil Zaheer, Srinadh Bhojanapalli, Daliang Li, Felix Yu, and Sanjiv Kumar. Modifying Memories in Transformer Models, December 2020. URL http://arxiv.org/abs/2012.00363. arXiv:2012.00363 [cs]. Nicola De Cao, Wilker Aziz, and Ivan Titov. Editing Factual Knowledge in Language Models, September 2021. URL http://arxiv.org/abs/2104.08164. arXiv:2104.08164 [cs]. Eric Mitchell, Charles Lin, Antoine Bosselut, Chelsea Finn, and Christopher D. Manning. Fast Model Editing at Scale, June 2022a. URL http://arxiv.org/abs/2110.11309. arXiv:2110.11309 [cs]. Eric Mitchell, Charles Lin, Antoine Bosselut, Christopher D. Manning, and Chelsea Finn. Memory-Based Model Editing at Scale. In Proceedings of the 39th International Conference on Machine Learning, pages 15817–15831. PMLR, June 2022b. URL https://proceedings.mlr.press/v162/mitchell22a.html. ISSN: 2640-3498. Xi Zhu Wu, Song Liu, and Zhi Hua Zhou. Heterogeneous model reuse via optimizing multiparty multiclass margin. 36th International Conference on Machine Learning, ICML 2019, 2019-June:11862–11871, 2019. ISBN: 9781510886988 rate: 0. Yihang Lou, Ling Yu Duan, Yong Luo, Ziqian Chen, Tongliang Liu, Shiqi Wang, and Wen Gao. Towards Efficient Front-End Visual Sensing for Digital Retina: A Model-Centric Paradigm. IEEE Transactions on Multimedia, 22(11): 3002–3013, 2020. ISSN 19410077. doi:10.1109/TMM.2020.2966885. ISBN: 1901014738. Anke Tang, Yong Luo, Han Hu, Fengxiang He, Kehua Su, Bo Du, Yixin Chen, and Dacheng Tao. Improving Heteroge- neous Model Reuse by Density Estimation. volume 4, pages 4244–4252, August 2023. doi:10.24963/ijcai.2023/472. URL https://www.ijcai.org/proceedings/2023/472. ISSN: 1045-0823. Jean Kaddour. Stop Wasting My Time! Saving Days of ImageNet and BERT Training with Latest Weight Averaging, October 2022. URL http://arxiv.org/abs/2209.14981. arXiv:2209.14981 [cs, stat]. Sunny Sanyal, Jean Kaddour, Abhishek Kumar, and Sujay Sanghavi. Understanding the Effectiveness of Early Weight Averaging for Training Large Language Models, June 2023. URL http://arxiv.org/abs/2306.03241. arXiv:2306.03241 [cs]. Samuel K. Ainsworth, Jonathan Hayase, and Siddhartha Srinivasa. Git Re-Basin: Merging Models modulo Permutation Symmetries, March 2023. URL http://arxiv.org/abs/2209.04836. arXiv:2209.04836 [cs] Read_Status: Read Read_Status_Date: 2023-08-31T10:29:51.597Z. 10 arXiv Template A PREPRINT Mitchell Wortsman, Gabriel Ilharco, Samir Yitzhak Gadre, Rebecca Roelofs, Raphael Gontijo-Lopes, Ari S. Morcos, Hongseok Namkoong, Ali Farhadi, Yair Carmon, Simon Kornblith, and Ludwig Schmidt. Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time, July 2022b. URL http: //arxiv.org/abs/2203.05482. rate: 4 Read_Status: Read Read_Status_Date: 2023-08-31T10:29:57.393Z. Jonathan Frankle, Gintare Karolina Dziugaite, Daniel M. Roy, and Michael Carbin. Linear Mode Connectivity and the Lottery Ticket Hypothesis, July 2020. URL http://arxiv.org/abs/1912.05671. arXiv:1912.05671 [cs, stat]. Pavel Izmailov, Dmitrii Podoprikhin, Timur Garipov, Dmitry Vetrov, and Andrew Gordon Wilson. Averaging Weights Leads to Wider Optima and Better Generalization, February 2019. URL http://arxiv.org/abs/1803.05407. arXiv:1803.05407 [cs, stat]. Sidak Pal Singh and Martin Jaggi. Model Fusion via Optimal Transport, May 2023. URL http://arxiv.org/abs/ 1910.05653. arXiv:1910.05653 [cs, stat]. Alexandra Chronopoulou, Matthew E. Peters, Alexander Fraser, and Jesse Dodge. AdapterSoup: Weight Averaging to Improve Generalization of Pretrained Language Models, March 2023. URL http://arxiv.org/abs/2302.07027. arXiv:2302.07027 [cs] Read_Status: Read Read_Status_Date: 2023-08-31T09:57:45.371Z. Jinghan Zhang, Shiqi Chen, Junteng Liu, and Junxian He. Composing Parameter-Efficient Modules with Arithmetic Operations, June 2023. URL http://arxiv.org/abs/2306.14870. arXiv:2306.14870 [cs]. Chengsong Huang, Qian Liu, Bill Yuchen Lin, Tianyu Pang, Chao Du, and Min Lin. LoraHub: Efficient Cross- Task Generalization via Dynamic LoRA Composition, July 2023. URL http://arxiv.org/abs/2307.13269. arXiv:2307.13269 [cs] Read_Status: Read Read_Status_Date: 2023-08-31T09:57:31.585Z. Guillermo Ortiz-Jimenez, Alessandro Favero, and Pascal Frossard. Task Arithmetic in the Tangent Space: Improved Editing of Pre-Trained Models, May 2023. URL http://arxiv.org/abs/2305.12827. arXiv:2305.12827 [cs] Read_Status: Read Read_Status_Date: 2023-08-31T08:15:40.043Z. Thomas G. Dietterich. Ensemble methods in machine learning. In Multiple classifier systems, pages 1–15, Berlin, Heidelberg, 2000. Springer Berlin Heidelberg. ISBN 978-3-540-45014-6. Read_Status: Read Read_Status_Date: 2023-08-31T09:58:47.346Z. Weishi Li, Yong Peng, Miao Zhang, Liang Ding, Han Hu, and Li Shen. Deep Model Fusion: A Survey, September 2023. URL http://arxiv.org/abs/2309.15698. arXiv:2309.15698 [cs]. Timur Garipov, Pavel Izmailov, Dmitrii Podoprikhin, Dmitry Vetrov, and Andrew Gordon Wilson. Loss Surfaces, Mode Connectivity, and Fast Ensembling of DNNs, October 2018. URL http://arxiv.org/abs/1802.10026. arXiv:1802.10026 [cs, stat]. Tian Yu Liu and Stefano Soatto. Tangent Model Composition for Ensembling and Continual Fine-tuning, July 2023. URL http://arxiv.org/abs/2307.08114. arXiv:2307.08114 [cs] Read_Status: Read Read_Status_Date: 2023-08-31T09:58:40.830Z. Xisen Jin, Xiang Ren, Daniel Preotiuc-Pietro, and Pengxiang Cheng. Dataless Knowledge Fusion by Merging Weights of Language Models, April 2023. URL http://arxiv.org/abs/2212.09849. arXiv:2212.09849 [cs]. George Stoica, Daniel Bolya, Jakob Bjorner, Taylor Hearn, and Judy Hoffman. ZipIt! Merging Models from Different Tasks without Training, May 2023. URL http://arxiv.org/abs/2305.03053. arXiv:2305.03053 [cs]. Prateek Yadav, Derek Tam, Leshem Choshen, Colin Raffel, and Mohit Bansal. Resolving Interference When Merging Models, June 2023. URL http://arxiv.org/abs/2306.01708. arXiv:2306.01708 [cs] Read_Status: Read Read_Status_Date: 2023-08-31T08:12:34.747Z. Chengyue Wu, Teng Wang, Yixiao Ge, Zeyu Lu, Ruisong Zhou, Ying Shan, and Ping Luo. π-Tuning: Transferring Multimodal Foundation Models with Optimal Multi-task Interpolation, May 2023. URL http://arxiv.org/abs/ 2304.14381. arXiv:2304.14381 [cs]. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Trans- formers for Language Understanding, May 2019. URL http://arxiv.org/abs/1810.04805. arXiv:1810.04805 [cs]. Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language Models are Unsupervised Multitask Learners. 1:9, 2019. Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin de Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-Efficient Transfer Learning for NLP, June 2019. URL http: //arxiv.org/abs/1902.00751. arXiv:1902.00751 [cs, stat]. Xiang Lisa Li and Percy Liang. Prefix-Tuning: Optimizing Continuous Prompts for Generation, January 2021. URL http://arxiv.org/abs/2101.00190. arXiv:2101.00190 [cs]. 11 arXiv Template A PREPRINT Brian Lester, Rami Al-Rfou, and Noah Constant. The Power of Scale for Parameter-Efficient Prompt Tuning, September 2021. URL http://arxiv.org/abs/2104.08691. arXiv:2104.08691 [cs]. Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-Rank Adaptation of Large Language Models, October 2021. URL http://arxiv.org/abs/2106. 09685. arXiv:2106.09685 [cs]. Haokun Liu, Derek Tam, Mohammed Muqeeth, Jay Mohta, Tenghao Huang, Mohit Bansal, and Colin Raffel. Few- Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context Learning, August 2022. URL http: //arxiv.org/abs/2205.05638. arXiv:2205.05638 [cs]. Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning Transferable Visual Models From Natural Language Supervision, February 2021. URL http://arxiv.org/abs/2103.00020. arXiv:2103.00020 [cs]. Hong-You Chen, Jike Zhong, Mingda Zhang, Xuhui Jia, Hang Qi, Boqing Gong, Wei-Lun Chao, and Li Zhang. Federated Learning of Shareable Bases for Personalization-Friendly Image Classification, April 2023. URL http: //arxiv.org/abs/2304.07882. arXiv:2304.07882 [cs]. Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. Visualizing the Loss Landscape of Neural Nets, November 2018. URL http://arxiv.org/abs/1712.09913. arXiv:1712.09913 [cs, stat]. Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Yunxuan Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Alex Castro-Ros, Marie Pellat, Kevin Robinson, Dasha Valter, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent Zhao, Yanping Huang, Andrew Dai, Hongkun Yu, Slav Petrov, Ed H. Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V. Le, and Jason Wei. Scaling Instruction-Finetuned Language Models, December 2022. URL http://arxiv.org/abs/2210.11416. arXiv:2210.11416 [cs]. Lilian Weng. Some math behind neural tangent kernel. Lil'Log, Sep 2022. URL https://lilianweng.github.io/ posts/2022-09-08-ntk/. Barak A. Pearlmutter. Fast Exact Multiplication by the Hessian. Neural Computation, 6(1):147–160, January 1994. ISSN 0899-7667, 1530-888X. doi:10.1162/neco.1994.6.1.147. URL https://direct.mit.edu/neco/article/ 6/1/147-160/5766. Arthur Jacot, Franck Gabriel, and Hongler Clement. Neural Tangent Kernel: Convergence and Generalization in Neural Networks. In Advances in Neural Information Processing Systems 31 (NeurIPS 2018), 2018. Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3D Object Representations for Fine-Grained Categoriza- tion. In 2013 IEEE International Conference on Computer Vision Workshops, pages 554–561, December 2013. doi:10.1109/ICCVW.2013.77. URL https://ieeexplore.ieee.org/document/6755945. Mircea Cimpoi, Subhransu Maji, Iasonas Kokkinos, Sammy Mohamed, and Andrea Vedaldi. Describing Textures in the Wild. In 2014 IEEE Conference on Computer Vision and Pattern Recognition, pages 3606–3613, Columbus, OH, USA, June 2014. IEEE. ISBN 978-1-4799-5118-5. doi:10.1109/CVPR.2014.461. URL https://ieeexplore. ieee.org/document/6909856. Patrick Helber, Benjamin Bischke, Andreas Dengel, and Damian Borth. Introducing eurosat: A novel dataset and deep learning benchmark for land use and land cover classification. In IGARSS 2018-2018 IEEE International Geoscience and Remote Sensing Symposium, pages 204–207. IEEE, 2018. J. Stallkamp, M. Schlipsing, J. Salmen, and C. Igel. Man vs. computer: Benchmarking machine learn- ing algorithms for traffic sign recognition. Neural Networks, 32:323–332, August 2012. ISSN 0893- 6080. doi:10.1016/j.neunet.2012.02.016. URL https://www.sciencedirect.com/science/article/pii/ S0893608012000457. Gong Cheng, Junwei Han, and Xiaoqiang Lu. Remote Sensing Image Scene Classification: Benchmark and ISSN 0018-9219, 1558-2256. State of the Art. Proceedings of the IEEE, 105(10):1865–1883, October 2017. doi:10.1109/JPROC.2017.2675998. URL http://arxiv.org/abs/1703.00121. arXiv:1703.00121 [cs]. Jianxiong Xiao, James Hays, Krista A. Ehinger, Aude Oliva, and Antonio Torralba. SUN database: Large-scale In 2010 IEEE Computer Society Conference on Computer Vision and scene recognition from abbey to zoo. Pattern Recognition, pages 3485–3492, San Francisco, CA, USA, June 2010. IEEE. ISBN 978-1-4244-6984-0. doi:10.1109/CVPR.2010.5539970. URL http://ieeexplore.ieee.org/document/5539970/. Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading Digits in Natural Images with Unsupervised Feature Learning. 2021. 12 arXiv Template A PREPRINT Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. GLUE: A Multi- In Proceedings of the 2018 Task Benchmark and Analysis Platform for Natural Language Understanding. EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 353–355, Brus- sels, Belgium, 2018. Association for Computational Linguistics. doi:10.18653/v1/W18-5446. URL http: //aclweb.org/anthology/W18-5446. Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer, July 2020. URL http://arxiv.org/abs/1910.10683. arXiv:1910.10683 [cs, stat]. Jialin Liu, Antoine Moreau, Mike Preuss, Baptiste Roziere, Jeremy Rapin, Fabien Teytaud, and Olivier Teytaud. Versatile Black-Box Optimization, April 2020. URL http://arxiv.org/abs/2004.14014. arXiv:2004.14014 [cs]. Tianxiang Sun, Yunfan Shao, Hong Qian, Xuanjing Huang, and Xipeng Qiu. Black-Box Tuning for Language-Model- as-a-Service, June 2022. URL http://arxiv.org/abs/2201.03514. arXiv:2201.03514 [cs]. 13 arXiv Template A PREPRINT A Model Linearization from a NTK Perspective In this section, we show that a linearized model is more capable to separate the function outputs in different directions in weight space, thus leading to a enhancement of weight disentanglement and offering advantages over non-linear models for model fusion. The linearized model, described by Eq.(4) approximates the behavior of the neural network fθ0 (x, φ(t)) at a specific time t, where θ0, fθ0 (x; φ(0)), ∇φfθ0 (x; φ(0)) are all constants. Consequently, the linearized function f lin (φ(t); x) is θ0 a linear function of φ(t). Assuming the trainable parameters are updated by gradient descent on task τi, hence ∇φL(τi; θ0, φ) = E(xτi ,yτi )∼Dτi φ(∆t) − φ(0) = −η∇φL (τi; θ0, φ(0)) [∇φfθ0(xτi; φ)∇f LCE(fθ0(xτi; φ), yτi)] = −ηE(xτi ,yτi )∼Dτi [∇φfθ0(xτi; φ(0))∇f LCE(fθ0(xτi; φ(0)), yτi)]. Consequently, (x; φ(∆t)) − fθ0(x; φ(0)) f lin θ0 = ∇φfθ0(x; φ(0))⊤(φ(∆t) − φ(0)) = −ηE(xτi ,yτi )∼Dτi = −ηE(xτi ,yτi )∼Dτi [∇φfθ0(x; φ(0))⊤∇φfθ0(xτi; φ(0))∇f LCE(fθ0(xτi; φ(0)), yτi)] [K(x, xτi; φ(0))∇f LCE(fθ0 (xτi; φ(0)), yτi)], (5) (6) (7) (8) (9) (10) (11) tangent kernel [Jacot et al., 2018], which is defined as K(x, x′; φ) = where K is known as neural ⟨∇φfθ0(x; φ), ∇φfθ0 (x′; φ)⟩ ∈ R|x| ×R|x| → R|f |×|f |. Since the NTK term is fixed throughout the training, the change in the model output ∆f lin (x; φ(∆t)) is solely determined by the gradient of the loss ∇f LCE(fθ0(xτi ; φ(0)), yτi). This θ0 establishes the connection between the neural network dynamics and kernel methods, allowing us to analyze the model through the lens of NTK. B Model Fine-tuning Details All of our experiments were performed using the same hardware consisting of eight NVIDIA GTX 3090 GPUs with 24GB memory. We used PyTorch 2.0 and Python 3 throughout all experiments. Model, Evaluation Tasks, and Metrics. We conduct experiments on diverse tasks spanning both vision and natural language domains. The model, evaluation datasets and metrics settings are as follows: • For vision tasks, we utilize CLIP [Radford et al., 2021] as our pre-trained model. For fine-tuning, we employ the CLIP-ViT-B-16 models on seven image classification tasks derived with the same random seed 42 to initialize the parameter-efficient models. These tasks are Stanford Cars [Krause et al., 2013], DTD [Cimpoi et al., 2014], EuroSAT [Helber et al., 2018], GTSRB [Stallkamp et al., 2012], RESISC45 [Cheng et al., 2017], SUN397 [Xiao et al., 2010], and SVHN [Netzer et al., 2021]. We report top-1 accuracy as a performance metric. • For NLP tasks, we utilize Flan-T5 [Chung et al., 2022] as our pre-trained language model. For fine-tuning, we employ the Flan-T5-base models on seven tasks derived from the GLUE benchmark [Wang et al., 2018] with the same random seed 42 to initialize the parameter-efficient models. These tasks are CoLA, MNLI, MRPC, QQP, RTE, SST2, and STSB. We report Spearman's ρ for STSB and accuracy for others. Vision domain. All the fine-tuning experiments on image classification tasks using AdamW optimizer. We fine-tune pre-trained CLIP-ViT-B-16 [Radford et al., 2021] downloaded from HuggingFace 1. For image classification tasks we use the text prompt template 'a photo of {label}' to compute the text embeddings. We initialize all parameter-efficient modules (LoRA and L-LoRA) with the same random seed 42. We use a batch size of 64 and a learning rate of 1e-5 and a weight decay of 0.1 with a warm-up cosine scheduler for 6000 steps for all downstream tasks. Language domain. The fine-tuning experiments on NLP tasks in our study follow the same experimental setup as described in [Raffel et al., 2020] using Adam optimizer. We fine-tune pre-trained Flan-T5-base model [Chung et al., 2022] download from HuggingFace 2. In line with the previous setup, we convert all the downstream NLP tasks 1https://huggingface.co/openai/clip-vit-base-patch16 2https://huggingface.co/google/flan-t5-base 14 arXiv Template A PREPRINT into a text-to-text format. For specific examples, please refer to E.1. This standardized format facilitates the training process and ensures consistency across different tasks, enabling effective fine-tuning of the models. We initialize all the parameter-efficient modules (LoRA and L-LoRA) with the same random seed 42. For standard full fine-tuning, a constant learning rate of 1e-5 or 2e-5 was used for 2000 steps with a batch size of 16 and no weight decay. For LoRA and L-LoRA fine-tuning, a sweep of learning rates from 1e-5 to 4e-5 was conducted, while keeping the other hyperparameters the same. The hyperparameter LoRA r is set to 16 for both LoRA and L-LoRA but is not applicable for full parameter fine-tuning. The learning rate sweep aims to find optimal values for different methods. Each fine-tuning run is conducted on four GPUs, utilizing the power of distributed data parallelism (DDP). This approach allows for efficient training of the model by dividing the batch across multiple GPUs and processing it simultaneously. Table 1 summarizes the key hyperparameters used during the fine-tuning of CLIP-ViT-B-16 and Flan-T5-base model under three different scenarios: standard full fine-tuning (FFT), fine-tuning with LoRA, and fine-tuning with L-LoRA. Scenario Learning rate Steps Batch size Weight decay LoRA r Table 1: Hyperparameters for model fine-tuning. full fine-tuning LoRA L-LoRA full fine-tuning LoRA L-LoRA 1e-5 (warm-up cos) 1e-5 (warm-up cos) 1e-5 (warm-up cos) CLIP-ViT-B-16 on vision tasks 6000 6000 6000 64 64 64 1e-5,2e-5 1e-5,2e-5,3e-5,4e-5 1e-5,2e-5,3e-5,4e-5 Flan-T5-Base on NLP tasks 2000 2000 2000 16 16 16 0.1 0.1 0.1 0 0 0 - 16 16 - 16 16 Table 2: Summary of fine-tuning statistics. Fine-tune diagram Trainable params. Total params. Trainable% VRAM Checkpoint size CLIP-ViT-B-16 on vision tasks (batch size=64) full fine-tuning LoRA (r=16) L-LoRA (r=16) 85M 294K 294K 85M 86M 93M 100% 0.34% 0.32% ≈ 12.4GB ≈ 9.2GB ≈ 9.3GB 328MB 1.2MB 1.2MB Flan-T5-Base on NLP tasks (batch size=16) full fine-tuning LoRA (r=8) LoRA (r=16) L-LoRA (r=8) L-LoRA (r=16) 247M 885K 1,769K 885K 1,769K 247M 100% 248.5M 0.36% 249.3M 0.71% 291.8M 0.30% 293.5M 0.60% ≈ 16.3GB × 4 ≈ 11.3GB × 4 ≈ 11.4GB × 4 ≈ 11.3GB × 4 ≈ 11.4GB × 4 945MB 3.5MB 6.9MB 3.5MB 6.9MB Table 2 presents a summary of the fine-tuning statistics for several different fine-tune diagrams. The table provides information on the trainable parameters, total parameters, trainable parameter percentage, VRAM utilization (with a batch size of 16) and checkpoint sizes. Taking the Flan-T5-Base model as an example, full parameter fine-tuning updates all parameters, while leading to very high VRAM usage of around 16.3GB per GPU and a large 945MB checkpoint size. On the contrary, the Low-Rank adaptation (LoRA) models have significantly fewer trainable parameters, ranging from 885K to 1.7M. This corresponds to only 0.3-0.7% of the total parameters being trainable. Consequently, the VRAM usage is much lower at 11.3-11.4GB per GPU. The checkpoint sizes are also smaller, from 3.5-6.9MB. The linearized LoRA fine-tuning has VRAM usage similar to LoRA. They have more total parameters at 291.8-293.5M because we need to cache the initiation values of LoRA modules to compute the Jacobian vector products. The checkpoint sizes match LoRA as well. In summary of Table 2, full parameter fine-tuning has the most parameters but is costly to fine-tune. LoRA reduces the trainable subset of weights, enabling more efficient adaptation. L-LoRA increases the total parameters while 15 arXiv Template A PREPRINT Table 3: Summary of training and inference cost Scenerio Training (Adam) VRAM Time Inference Time VRAM CLIP-ViT-B-32 (batch size=64) full fine-tuning (Figure 3(a)) full linearization (Figure 3(b)) LoRA (r=16) (Figure 3(c)) L-LoRA (r=16) (Figure 3(d)) 8.25 it/s ≈ 4.2GB 4.94 it/s ≈ 6.3GB 8.43 it/s ≈ 2.6GB 7.55 it/s ≈ 2.7GB 13.28 it/s ≈ 0.9GB ≈ 2.0GB 8.52 it/s 13.01 it/s ≈ 0.9GB 10.65 it/s ≈ 1.0GB full fine-tuning full linearization LoRA (r=16) L-LoRA (r=16) full fine-tuning full linearization LoRA (r=16) L-LoRA (r=16) CLIP-ViT-B-16 (batch size=64) 2.97 it/s ≈ 12.4GB 8.92 it/s 1.49 it/s ≈ 20.1GB 2.50 it/s 3.83 it/s ≈ 9.1GB 8.60 it/s 3.24 it/s ≈ 9.2GB 7.23 it/s ≈ 1.6GB ≈ 3.7GB ≈ 1.6GB ≈ 1.8GB CLIP-ViT-L-14 (batch size=16) 2.55 it/s ≈ 13.9GB 8.23 it/s 1.32 it/s ≈ 21.8GB 2.26 it/s 3.49 it/s ≈ 9.1GB 7.99 it/s 2.99 it/s ≈ 9.3GB 6.55 it/s ≈ 1.8GB ≈ 4.8GB ≈ 1.8GB ≈ 2.9GB maintaining a small trainable subset. Our partial linearization approach incurs minimal additional cost compared to standard LoRA fine-tuning. The training and inference costs increase only marginally and are negligible over LoRA. Table 3 summarizes the training and inference cost for different fine-tuning methods applied to CLIP vision models of varying sizes. The costs are broken down in terms of training/inference time (iterations/sec) and video RAM (VRAM) usage. Several key trends can be observed from Table 3. Full linearization is the slowest for both training and inference due to the increased computational cost. It also requires the most VRAM. LoRA is faster than full tuning for training and on par for inference, while using less VRAM for training due to the parameter-efficient fine-tuning. L-LoRA is slightly slower than LoRA. Its resource usage is comparable to LoRA. In Figure 7, we report the single task performance of different fine-tuning methods: full parameter fine-tuning, LoRA fine-tuning and L-LoRA fine-tuning. These results demonstrate that nonlinear fine-tuning consistently achieves higher single-task performance compared to linearized fine-tuning. Among the non-linear methods, full fine-tuning gives the highest task-specific accuracy, while LoRA tuning performs slightly worse, but is more parameter efficient. L- LoRA fine-tuning exhibits the lowest individual task performance. However, it provides improved multitask fusion capabilities. Although L-LoRA underperforms on single tasks, when evaluated on joint tasks, it can surpass LoRA fine-tuning due to enhanced representation disentanglement. The trade-off between specialized single-task accuracy and generalizable multi-task performance is evident when comparing full fine-tuning to LoRA and L-LoRA in Section 5.1 and Appendix D. Future work could further explore partial linearization, where some parameters are fine-tuned in a linear space while others remain nonlinear. This hybrid approach could trade-off between specialized single-task performance and weight disentanglement. Specifically, partitioning the parameters into fixed and linearly tuned subsets may combine the representation benefits of linearization with the expressiveness of nonlinear tuning. The non-linear parameters could capture task-specific adaptations, maximizing per-task accuracy. Meanwhile, the linearized parameters could encourage independence in different directions of weight space between tasks. C Loss Landscape and Cos Similarity Between Task Vectors Figures 2 and 8 visualize the similarity between task-specific models fine-tuned on different tasks using full fine-tuning, LoRA, and linearized LoRA (L-LoRA). Full fine-tuning results in a low similarity between task vectors, indicating greater independence between task-specific representations. In contrast, LoRA tuning induces higher similarity and entanglement between tasks. L-LoRA improves over LoRA by further reducing the cosine similarity, demonstrating that linearized tuning of parameter-efficient modules enhances disentanglement compared to standard LoRA. The results are consistent across both a vision model (CLIP) fine-tuned on image datasets, and a language model (Flan-T5) fine-tuned 16 arXiv Template A PREPRINT (a) Performance of task-specific CLIP-ViT-B-16 models on downstream image classification tasks. (b) Performance of task-specific Flan-T5-Base models on downstream NLP task. Figure 7: Performance of full fine-tuning, LoRA, and L-LoRA on downstream tasks. Full fine-tuning achieves the best individual task performance, followed by LoRA and then L-LoRA which trades off some task-specific accuracy for improved parameter efficiency. on NLP datasets. This supports the hypothesis that constrained optimization techniques like L-LoRA can improve representational disentanglement compared to unstructured tuning approaches. D Multi-Task Model Fusion D.1 Further Details about Baselines This section provides further implementation and configuration details for the baseline methods been compared in our experiments. An overview of the four baseline methods is provided as following. In Appendixes D.1.1, D.1.2, D.1.3 and D.1.4, the parameter settings used for each method in the experiments are explained. • Simple Weight Average: We average the trainable weights of the models fine-tuned on different tasks with different fine-tune methods, this method is also referred to as ModelSoup [Wortsman et al., 2022b] and Adapter- Soup [Chronopoulou et al., 2023] in the literature. The averaged model is then evaluated on the validation set of each task. For full fine-tuned models, the weights of the models are averaged directly (i.e., let θ = 1/n (cid:80)n i=1 θi). For parameter-efficient fine-tuning, we average the added weights and then apply to the parameter-efficient modules, i.e., let φ = 1 n i=1 φi and f (x) = fθ0 (x; φ). (cid:80)n • Task Arithmetic [Ilharco et al., 2023, Zhang et al., 2023]: As defined in Section 3.1, the task vector is computed on the set of trainable parameters. We compute the task vector for each task and then add them to construct a multi-task vector. The multi-task vector is then multiplied by a scaling factor λ element-wisely and added to the initial parameters of the pre-trained model to obtain a multi-task model, i.e. θ = θ0 + λ (cid:80) i(θi − θ0) for 17 CarsDTDEuroSATGTSRBRESISC45SUN397SVHNTask0.00.20.40.60.81.0Score0.860.810.990.990.960.780.980.700.640.950.800.860.680.890.660.500.850.540.710.650.78full-finetunedLoRAL-LoRACoLAMNLIMRPCQQPRTESST2STSBTask0.00.20.40.60.81.0Score0.750.820.860.840.850.930.900.690.760.800.820.830.920.870.690.460.680.800.750.910.59full-finetunedLoRAL-LoRA arXiv Template A PREPRINT (a) full fine-tuning (b) LoRA fine-tuning (c) L-LoRA Figure 8: Similarity heatmap of task vectors. These figures show heatmaps of the cosine similarity between task vectors from task-specific Flan-T5 model [Chung et al., 2022] fine-tuned on different NLP tasks from GLUE benchmark [Wang et al., 2018]. The task vector represents the parameter differences between the fine-tuned models and the original pre-trained model. (a) Cos similarity matrix of task vectors when using full fine-tuning of the entire model. (b) Task vector similarities when using LoRA, a parameter-efficient fine-tuning method. (c) Cos similarity of task vectors from L-LoRA, our proposed linearized tuning approach that fine-tunes parameter-efficient modules in tangent space. full fine-tuning and φ = φ0 + λ (cid:80) hyperparameter that the best-performing model is chosen on validation set. i(φi − φ0), f (x) = fθ0 (x; φ) for parameter-efficient fine-tuning, where λ is a • Ties-Merging [Yadav et al., 2023]: Ties-merging is a method for merging multiple task-specific models into a single multi-task model. This algorithm follows three steps (trim, elect sign of parameters, and disjoint merge) to obtain a merged task vector ν. Given the final merged task vector ν, the final model is chosen in a similar way as task arithmetic, i.e. θ = θ0 + λν for full fine-tuning and φ = φ0 + λν, f (x) = fθ0(x; φ) for parameter-efficient fine-tuning, where λ is a hyperparameter that the best-performing model is chosen on validation set. • LoraHub [Huang et al., 2023]: Lorahub is a method to apply arithmetic operations to parameter-efficient modules. With the help of a few examples from a novel task, LoraHub estimates the optimal weights {wi}i for the parameter-efficient modules by utilizing a black-box optimization technique [Liu et al., 2020, Sun et al., 2022] to minimize L + α (cid:80) i |wi|, where α is a hyperparameter. The final model is f (x) = fθ0 (x; φ), where φ = (cid:80) i wiφi s.t. (cid:80) i αi = 1. In practical implementation, we construct the final model with task vector arithmetic because we have ν = φ − φ0 = ((cid:80) i wiνi, so φ = φ0 + (cid:80) i wiνi. We evaluate LoraHub with both LoRA fine-tuning and L-LoRA fine-tuning. i wiφi) − φ0 = (cid:80) D.1.1 Simple Weight Average In our comparison, we employ the method known as ModelSoup [Wortsman et al., 2022b] or AdapterSoup [Chronopoulou et al., 2023] in the literature, which involves averaging the trainable weights of models. We adapt simple averaging to models that have been fine-tuned on different tasks using different fine-tuning methods. By averaging the weights in this manner, we create a combined model that incorporates the knowledge and expertise gained from multiple tasks and training methods. This averaged model is subsequently evaluated on the validation set of each respective task to assess its performance. For full fine-tuned models, we directly average the weights by computing the mean, represented as θ = 1 n where n is the total number of models being averaged. i=1 θi, (cid:80)n When it comes to parameter-efficient fine-tuning, we compute the average of the added weights and then apply them to the parameter-efficient modules. This is accomplished by calculating the mean of the added weights as φ = 1 i=1 φi, n and utilizing this average weight configuration in the parameter-efficient modules. Consequently, the function f (x) is defined as f (x) = fθ0(x; φ), taking into account the updated averaged weights. We create a total of 27 − 8 = 120 multi-task models for each fine-tuning method. (cid:80)n 18 CoLAMNLIMRPCQQPRTESST2STSBCoLAMNLIMRPCQQPRTESST2STSB1.000.120.120.080.080.100.060.121.000.110.110.180.100.150.120.111.000.270.270.060.110.080.110.271.000.230.060.080.080.180.270.231.000.040.120.100.100.060.060.041.000.060.060.150.110.080.120.061.00CoLAMNLIMRPCQQPRTESST2STSBCoLAMNLIMRPCQQPRTESST2STSB1.000.280.300.210.250.430.270.281.000.240.230.300.260.250.300.241.000.310.510.290.350.210.230.311.000.320.190.220.250.300.510.321.000.250.390.430.260.290.190.251.000.280.270.250.350.220.390.281.00CoLAMNLIMRPCQQPRTESST2STSBCoLAMNLIMRPCQQPRTESST2STSB1.000.140.210.100.090.290.090.141.000.080.090.300.170.060.210.081.000.230.290.110.130.100.090.231.000.250.070.030.090.300.290.251.000.040.090.290.170.110.070.041.000.100.090.060.130.030.090.101.000.00.20.40.60.81.0 arXiv Template A PREPRINT D.1.2 Task Arithmetic As defined in Section 3.1, the task vector is computed on the set of trainable parameters. We compute the task vector for each task and then add them to construct a multi-task vector. The multi-task vector is then multiplied by a scaling factor λ element-wisely and added to the initial parameters of the pre-trained model to obtain a multi-task model, i.e. θ = θ0 + λ (cid:80) i(φi − φ0), f (x) = fθ0(x; φ) for parameter-efficient fine-tuning [Zhang et al., 2023], where λ is a hyperparameter that the best-performing model is chosen on validation set. i(θi − θ0) for full fine-tuning [Ilharco et al., 2023] and φ = φ0 + λ (cid:80) Following the practice from [Ilharco et al., 2023], we add task vectors together and use a single scaling coefficient for the sum of vectors, λ ∈ {0, 0.05, 0.1, . . . , 1.0}. That is, for each set of tasks from the power set of {τi}7 i=1, we construct 21 candidate models with different λ values. We then evaluate the performance of each model on the validation set of each combination of tasks, and choose the best-performing model for each combination of tasks. Finally, we evaluate the performance of the best-performing model on the test set of each task. Here we have created a total of 21 × (27 − 8) = 2520 multi-task models for each fine-tuning method. D.1.3 Ties-Merging The Ties-Merging method, proposed in the paper by Yadav et al. [Yadav et al., 2023], is employed for merging multiple task-specific models into a unified multi-task model. This merging process involves three key steps: trim, elect sign of parameters, and disjoint merge, ultimately resulting in a merged task vector denoted as ν. Once the final merged task vector ν is obtained, the selection of the final model parallels the approach used in task arithmetic. For full fine-tuning, the updated parameters are computed as θ = θ0 + λν, while for parameter-efficient fine-tuning, the updated parameters are computed as φ = φ0 + λν, and the function f (x) is defined as fθ0(x; φ). As previously mentioned, the hyperparameter λ is chosen based on the performance of the model on the validation set. We sweep the hyperparameters k from the parameter trim step and scaling factor over a range of values {0.25, 0.50, 0.75, 1.00}. This results in a total of 16 combinations, whereby each combination is evaluated to de- termine the best-performing model. Here we have created a total of 42 × (27 − 8) = 1920 multi-task models for each fine-tune method. D.1.4 LoraHub LoraHub, as introduced by Huang et al. [Huang et al., 2023], is a method specifically designed for applying arithmetic operations to parameter-efficient modules. This technique leverages a set of example inputs from a novel task to estimate the optimal weights {wi}i for the parameter-efficient modules. To achieve this, LoraHub utilizes a black-box optimization technique, such as the one described in the works of Liu et al. [Liu et al., 2020] and Sun et al. [Sun et al., 2022]. The optimization process aims to minimize the objective function L + α (cid:80) i |wi|, where α is a hyperparameter. The final model obtained through LoraHub is defined as f (x) = fθ0(x; φ), where φ = (cid:80) i wiφi subject to the constraint (cid:80) i αi = 1. In practical implementations, the final model is constructed using task vector arithmetic. This is possible due to the relationship ν = φ − φ0 = ((cid:80) i wiνi. We adapt the original implementation form [Huang et al., 2023] and fix the hyperparameter α at 0.05. The maximum inference step for the gradient-free optimization algorithm Shiwa is 40, which results in up to 40 × (27 − 8) = 4800 multi-task models for each fine-tune method. i wiνi, which allows us to express φ as φ = φ0 + (cid:80) i wiφi) − φ0 = (cid:80) D.2 Experimental Results Visualization and Discussions We fine-tune all models with hyperparameter settings as shown in Table 1. We construct multi-task models by utilizing task vectors specific to individual tasks, employing various model fusion algorithms. Due to the extensive volume of data and multitude of models in the validation set of downstream NLP tasks, feasibility constraints led us to run only the first 50 batches for each NLP task. This approach allowed us to manage computational resources while still obtaining a representative evaluation within practical limits. In Figures 10 and 11, we examine four different model fusion techniques - simple averaging, task arithmetic, ties merging, and LoraHub - for constructing multi-task models using an increasing number of task vectors on both vision and language domains. Simple averaging doesn't account for the relationships or interactions between different tasks. As more tasks are combined, destructive interference may occur between incompatible task vectors. This indicates that simply averaging task vectors is insufficient for effectively combining knowledge across many NLP tasks. In contrast, the other three 19 arXiv Template A PREPRINT (a) CLIP-ViT-B-16 model on image classification tasks. (b) Flan-T5-Base model on NLP tasks. Figure 9: Multi-task model fusion: we construct multi-task models by utilizing task vectors specific to individual tasks, employing various model fusion algorithms. In the evaluation, the x-axis represents the number of task vectors used in building the multi-task model, while the y-axis represents the average (normalized) scores of the multi-task models across all seven downstream tasks. The line on the plot represents the average (normalized) scores of all multi-task models when considering a fixed number of tasks, while the shaded area corresponds to the standard deviation. The y-axis ticks are shared across these plots. A more detailed comparison between LoRA and L-LoRA is shown in Figures 10 and 11. 20 246Number of Tasks0.40.50.60.7Average ScoreSimple Average246Number of TasksTask Arithmetic246Number of TasksTies Mergingfull-finetuneLoRAL-LoRA246Number of TasksLoraHub246Number of Tasks0.60.70.8Average Normalized ScoreSimple Average246Number of TasksTask Arithmetic246Number of TasksTies Mergingfull-finetuneLoRAL-LoRA246Number of TasksLoraHub246Number of Tasks0.00.10.20.3Average ScoreSimple Average246Number of TasksTask Arithmetic246Number of TasksTies Mergingfull-finetuneLoRAL-LoRA246Number of TasksLoraHub246Number of Tasks0.00.10.20.30.4Average Normalized ScoreSimple Average246Number of TasksTask Arithmetic246Number of TasksTies Mergingfull-finetuneLoRAL-LoRA246Number of TasksLoraHub arXiv Template A PREPRINT (a) Simple Average (b) Task Arithmetic (c) Ties-Merging (d) LoraHub Figure 10: LoRA vs L-LoRA (CLIP-ViT-B-16 model on vision tasks). We construct multi-task models by utilizing task vectors specific to individual tasks, employing various model fusion algorithms. In the evaluation, the x-axis represents the number of task vectors used in building the multi-task model, while the y-axis represents the average score of the multi-task model across the seven GLUE tasks. Each point on the plot corresponds to the average score of a specific multi-task model, and the line represents the average score of all multi-task models considering a fixed number of tasks. 21 246Number of Tasks0.60.7Average Normailized ScoreLoRA246Number of TasksL-LoRA246Number of TasksLoRA vs L-LoRALoRAL-LoRA246Number of Tasks0.60.70.8Average Normalized ScoreLoRA246Number of TasksL-LoRA246Number of TasksLoRA vs L-LoRALoRAL-LoRA246Number of Tasks0.60.70.8Average Normalized ScoreLoRA246Number of TasksL-LoRA246Number of TasksLoRA vs L-LoRALoRAL-LoRA246Number of Tasks0.60.70.8Average Normalized ScoreLoRA246Number of TasksL-LoRA246Number of TasksLoRA vs L-LoRALoRAL-LoRA arXiv Template A PREPRINT (a) Simple Average (b) Task Arithmetic (c) Ties-Merging (d) LoraHub Figure 11: LoRA vs L-LoRA (Flan-T5-Base model on NLP tasks). We construct multi-task models by utilizing task vectors specific to individual tasks, employing various model fusion algorithms. In the evaluation, the x-axis represents the number of task vectors used in building the multi-task model, while the y-axis represents the average score of the multi-task model across the seven GLUE tasks. Each point on the plot corresponds to the average score of a specific multi-task model, and the line represents the average score of all multi-task models considering a fixed number of tasks. 22 246Number of Tasks0.00.10.2Average Normailized ScoreLoRA246Number of TasksL-LoRA246Number of TasksLoRA vs L-LoRALoRAL-LoRA246Number of Tasks0.10.20.3Average Normalized ScoreLoRA246Number of TasksL-LoRA246Number of TasksLoRA vs L-LoRALoRAL-LoRA246Number of Tasks0.10.20.30.4Average Normalized ScoreLoRA246Number of TasksL-LoRA246Number of TasksLoRA vs L-LoRALoRAL-LoRA246Number of Tasks0.20.4Average Normalized ScoreLoRA246Number of TasksL-LoRA246Number of TasksLoRA vs L-LoRALoRAL-LoRA arXiv Template A PREPRINT fusion methods demonstrate steady gains or maintain average multi-task model performance as the number of task vectors increases. For image classification tasks, ties-merging exhibits the strongest overall performance, with the highest average normalized scores across different numbers of task vectors. This may be because ties-merging introduces several innovations to address the challenges of parameter interference during model merging. The higher degree of interference between vision tasks, evident in the cosine similarity matrix in Figures 2 and 8, increases the importance of these techniques. In contrast, for NLP tasks, LoraHub demonstrates the strongest performance with the highest average normalized scores. The learned routing between shared fixed parameters and task-specific adapters enables more effective fusion for language tasks. Another key observation from Figures 11 is that LoRA performs better than L-LoRA when the number of task vectors being fused is small. As the number of task vectors increases, the average performance of L-LoRA becomes better than that of LoRA. It becomes evident that LoRA excels in fusing a smaller number of tasks or leveraging its effectiveness through simple averaging. On the other hand, L-LoRA shows an enhanced ability to exploit interactions within a larger set of tasks. This is because the linearization of PEFT modules in L-LoRA is fine-tuned in tangent space, which is a linear space, while the PEFT modules in LoRA are fine-tuned in the original non-linear ambient space. The non-linear space fine-tuning results in a superior performance of the single-task model, which is also known as the non-linear advantage [Guillermo Ortiz-Jimenez et al., 2023]. However, as the number of tasks increases, L-LoRA becomes more effective than LoRA. This suggests that the learned linear combination of task vectors used in L-LoRA is able to leverage interactions between a larger number of tasks more effectively, and L-LoRA is better able to scale to handle multi-task model fusion across a large number of tasks. E Implementation Details Here, we provide more details about the implementation of our method, including some basic code. E.1 Preprocessed Examples In this subsection, we provide some examples of the preprocessed data for the downstream tasks. We use the same preprocessing steps as described in [Raffel et al., 2020]. E.1.1 CoLA We assign label 0 as "unacceptable" and label 1 as "acceptable". Original inputs: • sentence: Our friends won't buy this analysis, let alone the next one we propose. • label: 1 Preprocessed: • input: cola sentence: Our friends won't buy this analysis, let alone the next one we propose. • target: acceptable E.1.2 MNLI We assign label 0 as "entailment", label 1 as "neutral" and label 2 as "contradiction". Original inputs: • hypothesis: Product and geography are what make cream skimming work. • premise: Conceptually cream skimming has two basic dimensions - product and geography. • label: 1 Preprocessed: • input: mnli hypothesis: Product and geography are what make cream skimming work. premise: Conceptually cream skimming has two basic dimensions - product and geography. 23 arXiv Template A PREPRINT • target: neutral E.1.3 MRPC We assign label 0 as "not_quivalent" and label 1 as "equivalent". Original inputs: • sentence1: Amrozi accused his brother , whom he called "the witness" , of deliberately distorting his evidence . • sentence2: Referring to him as only "the witness" , Amrozi accused his brother of deliberately distorting his evidence . • label: 1 Preprocessed: • input: mrpc sentence1: Amrozi accused his brother , whom he called "the witness" , of deliberately distorting his evidence . sentence2: Referring to him as only "the witness" , Amrozi accused his brother of deliberately distorting his evidence . • output: equivalent E.1.4 QQP We assign label 0 as "not_duplicate" and label 1 as "duplicate". Original inputs: • question1: How is the life of a math student? Could you describe your own experiences? • question2: Which level of prepration is enough for the exam jlpt5? • label: 0 Preprocessed: • input: qqp question1: How is the life of a math student? Could you describe your own experiences? question2: Which level of prepration is enough for the exam jlpt5? • output: not_duplicate E.1.5 RTE We assign label 0 as "entailment" and label 1 as "not_entailment". Original inputs: • sentence1: No Weapons of Mass Destruction Found in Iraq Yet. • sentence2: Weapons of Mass Destruction Found in Iraq. • label: 1 Preprocessed: • input: rte sentence1: No Weapons of Mass Destruction Found in Iraq Yet. sentence2: Weapons of Mass Destruction Found in Iraq. • output: not_entailment E.1.6 SST2 We assign label 0 as "negative" and label 1 as "positive". Original inputs: • sentence: hide new secretions from the parental units 24 arXiv Template A PREPRINT • label: 0 Preprocessed: • input: sst2 sentence: hide new secretions from the parental units • output: negative E.1.7 STSB We format x'"{:.1f}".format(label)'. the 'label' argument as a string with one decimal place, the corresponding Python code is Original inputs: • sentence1: A plane is taking off. • sentence2: An air plane is taking off. • label: 5 Preprocessed: • input: stsb sentence1: A plane is taking off. sentence2: An air plane is taking off. • output: 5.0 E.2 Model Linearization class L inear i ze dM o de lW ra per ( nn . Module ) : def __init__ ( self , model : nn . Module , init_model : nn . Module = None ) : """ Initializes a linearized model . Args : model ( nn . Module ) : The underlying PyTorch model to be linearized . init_model ( nn . Module ) : The initial PyTorch model used to compute the linearization parameters ( default : None ) . """ super () . __init__ () self . model = model if init_model is None : init_model = model assert not hasattr ( self , " params0 " ) params0 = deepcopy ([( k , v . detach () ) for k , v in init_model . named_parameters () ]) self . params0_keys = [ k for k , v in params0 ] self . params0_values = nn . ParameterList ([ v for k , v in params0 ]) for p in self . params0_values : p . requires_grad_ ( False ) def tupl e_p ar am s_ to _d ic t ( self , tuple_params ) : """ Converts a tuple of parameters to a dictionary with keys corresponding to the parameter names . Args : tuple_params ( Tuple [ Tensor , ...]) : A tuple of parameters . Returns : Dict [ str , Tensor ]: A dictionary with keys corresponding to the parameter names and values corresponding to the parameter values . """ assert len ( tuple_params ) == len ( self . params0_keys ) state_dict = {} 25 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 arXiv Template A PREPRINT for k , p in zip ( self . params0_keys , tuple_params ) : state_dict [ k ] = p return state_dict def forward ( self , * args , ** kwargs ) : """ Computes the linearized model output using a first - order Taylor decomposition . Args : * args : Positional arguments to be passed to the model . ** kwargs : Keyword arguments to be passed to the model . Returns : torch . Tensor : The output of the linearized model , computed using a first - order Taylor decomposition . """ params0 = tuple ( self . params0_values ) params = di ct_ pa ra ms _t o_tupl e ( OrderedDict ( self . named_parameters () ) ) dparams = tuple ( p - p0 for p , p0 in zip ( params , params0 ) ) out , dp = jvp ( lambda * param : functional_call ( self . model , self . tup l e_params_to_dict ( param ) , args , kwargs ) , params0 , dparams , ) return out + dp Listing 1: Pytorch code to linearize a model. The LinearizedModelWraper class linearizes a given PyTorch model using a first-order Taylor expansion. The linearized model is computed using the forward method, which takes positional and keyword arguments and returns the output of the linearized model. The tuple_params_to_dict method converts a tuple of parameters to a dictionary with keys corresponding to the parameter names. With the help of LinearizedModelWraper class, we can linearize the LoRA modules in a pre-trained language model, as the following code snippet shows: def _get_submodules ( model : nn . Module , key ) : """ Retrieves the parent module , target module , and target module name for a given key in a PyTorch model . Args : model ( nn . Module ) : The PyTorch model to retrieve submodules from . key ( str ) : The key representing the submodule to retrieve . Returns : Tuple [ nn . Module , nn . Module , str ]: A tuple containing the parent module , target module , and target module name . """ parent = model . get_submodule ( " . " . join ( key . split ( " . " ) [: -1]) ) target_name = key . split ( " . " ) [ -1] target = model . get_submodule ( key ) return parent , target , target_name def linear ize _lo ra _m od el ( model : nn . Module ) : """ Linearizes the LoraLayer modules in a PyTorch model . Args : model ( nn . Module ) : The PyTorch model to be linearized . 26 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 arXiv Template A PREPRINT 25 26 27 28 29 30 31 32 33 Returns : nn . Module : The linearized PyTorch model . """ for key , module in model . named_modules () : if isinstance ( module , LoraLayer ) and isinstance ( module , nn . Linear ) : log . debug ( f " convert { key } to linearized lora layer " ) parent , target , target_name = _get_submodules ( model , key ) setattr ( parent , target_name , Linea rizedM odelW raper ( target ) ) return model Listing 2: Linearize all the LoRA modules in a LLM Where the _get_submodules function takes a PyTorch model and a key representing a submodule in the model and returns a tuple containing the parent module, the target module, and the target module name. The parent module is the module that contains the target module. The linearize_lora_model function takes a PyTorch model and linearizes all LoraLayer modules in the model. If a LoraLayer module is also an instance of nn.Linear, it is converted to a LinearizedModelWraper object. The function returns the linearized PyTorch model. 27
http://arxiv.org/abs/2310.04741v2
"2023-10-10T06:22:45"
"2023-10-07T08:54:43"
Balancing stability and plasticity in continual learning: the readout-decomposition of activation change (RDAC) framework
Continual learning (CL) algorithms strive to acquire new knowledge while preserving prior information. However, this stability-plasticity trade-off remains a central challenge. This paper introduces a framework that dissects this trade-off, offering valuable insights into CL algorithms. The Readout-Decomposition of Activation Change (RDAC) framework first addresses the stability-plasticity dilemma and its relation to catastrophic forgetting. It relates learning-induced activation changes in the range of prior readouts to the degree of stability and changes in the null space to the degree of plasticity. In deep non-linear networks tackling split-CIFAR-110 tasks, the framework clarifies the stability-plasticity trade-offs of the popular regularization algorithms Synaptic intelligence (SI), Elastic-weight consolidation (EWC), and learning without Forgetting (LwF), and replay-based algorithms Gradient episodic memory (GEM), and data replay. GEM and data replay preserved stability and plasticity, while SI, EWC, and LwF traded off plasticity for stability. The inability of the regularization algorithms to maintain plasticity was linked to them restricting the change of activations in the null space of the prior readout. Additionally, for one-hidden-layer linear neural networks, we derived a gradient decomposition algorithm to restrict activation change only in the range of the prior readouts, to maintain high stability while not further sacrificing plasticity. Results demonstrate that the algorithm maintained stability without significant plasticity loss. The RDAC framework informs the behavior of existing CL algorithms and paves the way for novel CL approaches. Finally, it sheds light on the connection between learning-induced activation/representation changes and the stability-plasticity dilemma, also offering insights into representational drift in biological systems.
[ "Daniel Anthes", "Sushrut Thorat", "Peter König", "Tim C. Kietzmann" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04741v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04741v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CV", "q-bio.NC" ]
3 2 0 2 t c O 0 1 ] G L . s c [ 2 v 1 4 7 4 0 . 0 1 3 2 : v i X r a BALANCING STABILITY AND PLASTICITY IN CONTINUAL LEARNING: THE READOUT-DECOMPOSITION OF ACTIVATION CHANGE (RDAC) FRAMEWORK Daniel Anthes∗, Sushrut Thorat∗, Peter K ̈onig, & Tim C. Kietzmann Institute of Cognitive Science Osnabruck University Osnabruck, 49090, Germany {danthes,sthorat,pkonig,tkietzma}@uos.de ABSTRACT Continual learning (CL) algorithms strive to acquire new knowledge while pre- serving prior information. However, this stability-plasticity trade-off remains a central challenge. This paper introduces a framework that dissects this trade- off, offering valuable insights into CL algorithms. The Readout-Decomposition of Activation Change (RDAC) framework first addresses the stability-plasticity dilemma and its relation to catastrophic forgetting. It relates learning-induced acti- vation changes in the range of prior readouts to the degree of stability, and changes in the null space to the degree of plasticity. In deep non-linear networks tackling split-CIFAR-110 tasks, the framework clarifies the stability-plasticity trade-offs of the popular regularization algorithms Synaptic intelligence (SI), Elastic-weight consolidation (EWC), and learning without Forgetting (LwF), and replay based algorithms Gradient episodic memory (GEM), and data replay. GEM and data replay preserved both stability and plasticity, while SI, EWC, and LwF traded off plasticity for stability. The inability of the regularization algorithms to maintain plasticity was linked to them restricting the change of activations in the null space of the prior readout. Additionally, for one-hidden-layer linear neural networks, we derived a gradient decomposition algorithm to restrict activation change only in the range of the prior readouts, to maintain high stability while not further sacrific- ing plasticity. Results demonstrate that the algorithm maintained stability without significant plasticity loss. The RDAC framework not only informs the behavior of existing CL algorithms but also paves the way for novel CL approaches. Finally, it sheds light on the connection between learning-induced activation/representation changes and the stability-plasticity dilemma, also offering insights into represen- tational drift in biological systems. 1 INTRODUCTION Continual learning (CL) is a fundamental challenge in the field of neural networks, aiming to equip these learning systems with the ability to acquire new knowledge while not forgetting previously learned information, which is termed the stability-plasticity dilemma (Carpenter & Grossberg, 1987; Mermillod et al., 2013). In the common setting of gradient-based learning in neural networks, performance on prior tasks reduces as new tasks are learned i.e. stability is traded off for plasticity. This phenomenon is termed catastrophic forgetting (McCloskey & Cohen, 1989; French, 1999). Much of the catastrophic forgetting has been linked to learning-induced changes that occur in the later layers of neural networks (Ramasesh et al., 2020; Kalb & Beyerer, 2022). Moreover, recent work revealed that, during task-incremental learning (van de Ven et al., 2022), a large portion of the loss in task performance is not about the information relevant to the previous tasks being forgotten. ∗indicates equal contribution. 1 Figure 1: Conceptualization of the readout-decomposition of activity change. The readout for a task reads from a subspace of the pre-readout activation space. In the case of a two dimensional activation space, and a binary readout, the hyperplane defines a line through the 2D space. (Left) Any gradient affecting this space in a way that changes activation patterns perpendicular to the hyperplane (the range of the readout) affects the mapping between hidden and readout activations, (Right) Any gradient affecting this space in a way that changes and is detrimental to stability. activation patterns parallel to the hyperplane (the null space of the readout) does not affect the mapping between hidden and readout activations. However, this change is useful for learning new tasks i.e. being plastic, while not disrupting stability. Instead due to learning the activations change, and the prior readout hyperplanes no longer align with the discriminative directions in the activations (Davari & Belilovsky, 2021; Anthes et al., 2023). Seeking to generalize these results, we introduce a framework to study what aspects of the learning- induced activation changes, from the perspective of the prior readouts, are related to the performance on prior tasks and to the performance on future tasks. We present the Readout-Decomposition of Activation Change (RDAC) framework. The central principle is as follows: Learning-induced activation changes within the range of prior readouts (the subspace of pre-readout activation space spanned by the readout vectors) can lead to the task-relevant activations being misaligned with the readouts, thereby reducing the degree of stability. If thereby changes in the range are minimal, changes in the null space are critical as they reflect the network learning new tasks. If the changes to the null space are also restricted, the network won't be able to learn new tasks, thereby reducing the degree of plasticity. This principle is depicted in Figure 1. The RDAC framework serves as a diagnostic tool to assess the stability-plasticity trade-offs of CL algorithms. Moving beyond performance-based comparisons, we can compare the learning-induced activation changes in the range and null space of the prior readouts to reveal the causes of the observed performance trade-offs. In this work, we assessed the stability-plasticity trade-offs of popular CL algorithms - three regularization algorithms: Synaptic intelligence (SI; Zenke et al. (2017)), Elastic-weight consolidation (EWC; Kirkpatrick et al. (2017)), and Learning without for- getting (LwF; Li & Hoiem (2017)), and two replay algorithms: Gradient episodic memory (GEM; Lopez-Paz & Ranzato (2017)), and data replay (Rebuffi et al., 2017). Our results revealed that dur- ing learning the split-CIFAR-110 tasks, SI, EWC, and LwF restricted the activation changes in both the range and null space of prior readouts, thereby trading off plasticity for the sake of stability. Meanwhile, GEM and data replay did not restrict activation change in the null space, maintaining high plasticity. Intriguingly, the activation change in the range was also not restricted completely, while the stability was still observed to be high in the task performance. We reasoned that this is due to the non-linear, many-to-one mapping allowed by the loss functions used by GEM and data replay. In sum, we demonstrate the usefulness of RDAC in furthering our understanding of how continual learning algorithms function at the level of the activations and the weights in the networks. 2 The RDAC framework can also be used to develop new continual learning algorithms. We demon- strate how we can translate the core principle of RDAC into a gradient decomposition algorithm in simple one-hidden-layer linear networks. We tested that algorithm in a network learning the split- MNIST tasks. We found that the stability-plasticity trade-offs are linked to the activation changes in the range and null space of the prior readout, and we can exert full control over them with two parameters. Additionally, in the best setting, the algorithm maintains stability and plasticity close to the upper bounds set by the task. In sum, we demonstrate the usefulness of RDAC taking the first steps in building new CL algorithms. The RDAC framework primarily helps in assessing the stability-plasticity trade-offs in existing CL algorithms. Additionally, the principles of the framework pave the way for the development of novel CL approaches. Furthermore, the relationship between learning-induced activation/representation changes and the stability-plasticity dilemma offers insights into representational drift in biological systems. By shedding light on these critical aspects of CL, this paper contributes to the ongoing efforts to characterize the complexities of continual learning in order to solve it. 2 RELATED WORK In the landscape of research addressing the challenges of continual learning (CL), several noteworthy contributions have emerged that offer valuable insights into the stability-plasticity trade-off and related concepts (Parisi et al., 2019; De Lange et al., 2021; Mundt et al., 2023; Wang et al., 2023; Kim & Han, 2023). Most of these approaches compare the different CL algorithms in terms of their performance on previously-learned tasks as a function of learning new tasks and ablations on the various components of those algorithms. We seek to characterize the stability-plasticity trade- offs of the algorithms in terms of the changes in weights and prior tasks' activations. In addition to investigating how well algorithms solve the catastrophic forgetting problem, we place special emphasis on the algorithms' continued ability to learn new tasks i.e. their plasticity. Recently, many groups have sought to understand the influence of learning-induced activation changes on stability and plasticity (Wang et al., 2021; Kong et al., 2022; Zhao et al., 2023; Yang et al., 2023). All these approaches analyze the gradient updates in the range of the space spanned by the activations for previous tasks, for each layer of the network. However, it is unclear whether the range of the readouts, which determines the outputs of the network, is equivalent to the range of the activations for the previous tasks. The range of the activations is most probably larger than the range of the readouts, and the pre-readout activation space is usually very high-dimensional compared to the readout. Also, prior work has shown that the activation space contains classification-orthogonal information (e.g. size and location of the object; Hong et al. (2016); Thorat et al. (2021)), which implies the activation space has more information than required by the readout. If the range of the activations is indeed larger, the space in which activations could change, while maintaining the pre- vious tasks' performance, would seem smaller. This would suggest a reduced capacity for learning future tasks. To circumvent this potential issue, in the RDAC framework, we provide a different view on the link between the activation change and the stability-plasticity trade-off, by directly focusing on the range of the readouts. 3 THE READOUT-DECOMPOSITION OF ACTIVATION CHANGE FRAMEWORK In the RDAC framework, we link the performance-based stability-plasticity trade-offs of continual learning algorithms to how they constrain learning. First, we study how learning-based changes in prior task activations, in the range and null space of the prior readout, is linked to stability and plasticity. Second, in one-hidden-layer linear neural networks, we show how the activation changes are linked to the weight updates, and derive a gradient-decomposition-based algorithm to ensure maximal stability without further throttling plasticity. 3.1 READOUT-DECOMPOSITION OF ACTIVATION CHANGE TO DIAGNOSE THE STABILITY-PLASTICITY TRADE-OFF In task-incremental continual learning, a network has to sequentially learn a set of n task map- pings {xk → ok}k≤n. The network's weights are shared across tasks, except for the readouts, 3 Rk + b⊤ {WRk}k≤n, which are task specific. For a given task k < m, consider the pre-readout activations hk such that ok = σ(hkW⊤ Rk ), σ is a non-linear activation function and b is the readout bias. While learning on the new task m, we posit that the change in activations, ∆hk, can be de- composed as ∆hkCC⊤ + ∆hkNN⊤, where C and N are the range and null-space matrices of WRk, and CC⊤ and NN⊤ are the corresponding projection matrices. These two components can provide us insights into the stability-plasticity trade-offs of a given learning algorithm. First, changes in the activations in the range of the readout (∆hkCC⊤) could disrupt stability as ∆hkCCTWRk = ∆hkWRk. Second, changes in the activations in the null space of the readout (∆hkNN⊤) would have no effect on stability, as ∆hkNNTW⊤ Rk = 0. Monitoring these com- ponents of the activation changes can provide us with valuable insights into the inner workings of continual learning algorithms, which is what we present in Section 4. However, it is important to note that if the non-linearity σ performs a many-to-one mapping, it can effectively negate the influence of those "degenerate" activation changes on the output. Thus, certain learning algorithms could lead to a change of activations in the range of the readout, even though their performance on previous tasks, i.e. stability, would be unchanged. Under this framework, assuming no knowledge about the non-linearities involved, a "conservative" continual learning algorithm would clamp the pre-readout activations for the previously learned tasks in the range of the corresponding readouts to ensure stability. The activations would not be clamped in the null space of those readouts to ensure plasticity. 3.2 DERIVING A GRADIENT DECOMPOSITION ALGORITHM TO CONTROL THE STABILITY-PLASTICITY TRADE-OFF HW⊤ H is the mapping from input to the hidden layer with h neurons, and Wo×h The input-output mapping of a one-hidden-layer linear network, with no bias terms, can be written R, where o1×o is the output with o neurons, x1×x is the input with x features, as o = xW⊤ Wh×x R is the mapping from the hidden layer to the output. After training on task 1: x1 → o1, we get the trained readout WR1. While training on task 2: x2 → o2, we get the gradient ∆WH. In order to maintain stability, we want the learned task 1: x1 → o1 mapping to stay preserved. Given a projection matrix Ah×h applied to the gradient, we want: o1 = x1(WH + A∆WH)⊤W⊤ R1 =⇒ x1(A∆WH)⊤W⊤ R1 = 0 =⇒ WR1A = 0 (1) One solution is A = NN⊤, where N is the null space matrix of WR1 . Projecting the gradient for the WH into the null space of WR1 will ensure stability. Meanwhile, the hidden layer activations h1 are free to change in the null space of WR1 which allows plasticity. To allow full control over the stability-plasticity trade-off, we can consider A = αCC⊤ + βNN⊤, where α (termed "range weight") and β (termed "null space weight") are scalars that weigh the projections into range and null space of WR1 . WR1 A = 0 only if α = 0, which ensures stability. Stability does not rely on β but plasticity does as, if β is reduced while α = 0, the gradient becomes smaller and learning the new task becomes slower. In Section 5, we empirically test this relationship between α, β, and the stability-plasticity trade-off. In learning multiple tasks sequentially, N can be computed from the null space of the stacked readout matrices of the n previous tasks, Wt×h k=1nok, and ok are the number of classes in task k. With A = NN⊤, none of the previously learned task mappings would be affected. It is interesting to note that if the tasks are not all fully orthogonal and rely on shared features, the range of the stacked readout matrices would grows sub-linearly with the addition of new output units. R , where t = Σn The introduction of non-linearities and multiple hidden layers makes the procedure seen in Equa- tion 1 non-trivially complex and beyond the purvey of this paper. We leave the search for approxi- mate solutions that might guide a generic gradient-decomposition-based algorithm as a quest for the future. Although we do not present a continual learning algorithm for deep non-linear networks, we hope that the intuitions garnered through the derivation in this simple case pave the way. 4 4 CONTINUAL LEARNING IN DEEP NON-LINEAR NEURAL NETWORKS Using the RDAC framework, we present an assessment of how a variety of continual learning algo- rithms allow changes in the activations and how those changes relate to the observed performance- based stability-plasticity trade-offs. First, we outline the network architecture and task setting. Then, we present the results comparing the different learning algorithms: three regularization methods - Synaptic Intelligence (SI; Zenke et al. (2017)), EWC, and Learning without Forgetting (LwF; Li & Hoiem (2017)) - and two replay-based methods - Gradient Episodic Memory (GEM; Lopez-Paz & Ranzato (2017)) and data replay1(Rebuffi et al., 2017). In addition to them being popular, these algorithms were chosen due to the availability of their implementations through the Avalanche li- brary (Carta et al., 2023). 4.1 NETWORK AND TASK We considered a VGG-like neural network, similar to the one used in Zenke et al. (2017), which maps CIFAR images (Krizhevsky et al., 2009) to their classes (The exact architecture and optimiza- tion procedure is described in Appendix A.1.1). We considered the split-CIFAR-110 setting, where the network is first trained on CIFAR-10, and then sequentially trained on ten equal task splits from CIFAR-100 (we ran the analysis 3 times with randomly chosen assignments of classes to splits, and show the results averaged across those seeds). Images were subjected to augmentations. Separate readouts were trained for each of the tasks, with softmax activation and cross-entropy loss. Af- ter training on task 1 (CIFAR-10), we computed the projection matrices CC⊤ and NN⊤, using singular value decomposition (SVD). 4.2 RESULTS In terms of performance, how do the different learning algorithms manage the stability-plasticity trade-off? We considered the performance on task 1 (a measure of stability) and on task 11 (a measure of plasticity) after training on all 11 tasks. As seen in Figure 2A, as the regularization strength was increased, EWC, SI, and LwF traded off plasticity for stability. On the other hand, with increasing replay buffer size (and memory strength in the case of GEM), GEM and data replay managed to increase stability without trading off plasticity. We now assess these stability-plasticity trade-offs from the perspective of the RDAC framework. First, the RDAC framework associates restricting the change in prior tasks' activations in the null space of the prior readouts with a loss in plasticity. Were SI, EWC, and LwF unable to maintain plas- ticity, compared to GEM and data replay, because they imposed higher restrictions on the change in the activations for task 1 in the range of the task 1 readout? Yes, as seen in Figure 2B, increasing the regularization strength for SI, EWC, and LwF, substantially reduced the learning-induced changes in the task 1 activations in the null space of task 1 readout. Meanwhile, increasing the replay buffer size (and memory strength in the case of GEM), for GEM and data replay, did not lead to a similarly drastic reduction in the activation changes in the null space. Restricting change in range is desirable, but these regularization algorithms restricted change in null space too, which was detrimental to plasticity. In contrast, GEM and data replay maintained higher activation changes in the null space, corresponding to higher observed plasticity. Interestingly, with increasing replay buffer size and memory strength in GEM, the activation change in the null space increased. This can be explained by understanding how GEM computes its gradient projection. GEM solves a constrained optimization problem to project the current gradient such that its dot product with gradients estimated for the previous tasks (estimated with the replay buffer) is positive. The replay buffer size determines how well the mappings for the old task are preserved. The insistence on a positive dot product ensures that the gradient update is aligned with the gradient directions expected by the previous tasks, which maintains stability. Additionally, the gradient is further biased towards the gradients for the previous tasks with a "memory strength" parameter γ. As γ increases, the gradients from all the previous tasks get weighted up in the gradient used by 1In data replay and LwF, contrary to the usual setting, we fixed readouts after training on a task and allowed the rest of the network to train further. This was done because in all the other methods, the prior readouts are frozen. 5 Figure 2: Continual learning in deep non-linear neural networks learning to classify CIFAR images. (A) With increasing regularization strength, replay buffer size, and memory strength (indicated with darkening hues), the stability of all the algorithms increases. However, the replay algorithms, GEM and data replay maintain high plasticity, whereas the regularizaton algorithms do not do so. (B) In the pre-readout activation space, the activation change is quantified as the difference between task 1 activations after training on task 1 and after training on all 11 tasks (displacement). With increasing regularizaton strength, the regularization algorithms reduce the activation change in both the range and null space of task 1 readout, which corresponds to the observed maintenance of stability and loss of plasticity. With increasing replay buffer size (and memory strength in the case of GEM), the replay algorithms maintain high activation change in both the range and null space of the task 1 readout, which ensures plasticity. The use of non-linear, many-to-one mapping loss functions by these algorithms allow for changes in the range that are not detrimental to stability. These results illustrate the utility of the RDAC framework as a diagnostic tool to understand the stability-plasticity trade-offs of continual learning algorithms. The diagonal dotted line in panel B and the two insets indicates the expected ratio of displacement in null space and range of a readout if activations were to move uniformly in all dimensions of the pre-readout layer. GEM. From the standpoint of readout 1 this would mean more projections into its null space which would result in an increased change of its activations in its null space after training on multiple tasks. Second, the RDAC framework associates activation changes in the range of the readout with a loss in stability. With increasing regularization strength, SI, EWC, and LwF, indeed substantially reduced the activations changes in the range of the readout, corresponding to an increase in stability. In the case of data replay, although increasing the replay buffer size led to an increase in stability, the reduction in the activations changes in the range of the readout was not substantial. Relatedly, in the case of GEM, with increasing replay buffer size and memory strength, the activation changes in the range of the readout increased. How do we reconcile these observations with the RDAC framework? The critical element is the nature of the gradient constraints imposed by GEM and data replay. Both GEM and data replay compute the gradients for the prior tasks to optimize the mapping between images and the "true" labels, as opposed to the probability distribution over labels previously learned by the network. The mapping between probability distributions and the 1-hot probability distribution given by the true label, under cross-entropy loss, is degenerate. As expressed in the RDAC framework, activation changes in the range can be negated by such a non-linearity. Thus, GEM and data replay are allowed gradient projections that lead to changes in activations in the range of the prior readouts. This ability is specific to replay-based methods as they have access to the expected mappings for the prior tasks which help them in knowing what parts of the range of the prior readouts can be changed without affecting those prior mappings. 6 Additionally, in the case of GEM, increasing the memory strength increases the contributions of the gradients of the prior tasks to the estimated gradient. Gradients for the prior tasks are meant to reduce the loss for those tasks, which implies they would project into the corresponding ranges of the prior readouts. This explains the increased activation change in the range of the prior readout. The function of these changes in the range of the readout potentially is to supplement performance on the previous tasks, a phenomenon termed "backward transfer" (Lopez-Paz & Ranzato, 2017). In sum, our results show that the principles laid out in the RDAC framework relating readout- decomposed activation changes to the stability-plasticity trade-offs provide useful insights into the inner workings of continual learning algorithms for deep, non-linear neural networks. 5 CONTINUAL LEARNING IN ONE HIDDEN-LAYER LINEAR NEURAL NETWORKS Using the RDAC framework, we present an assessment of the stability-plasticity trade-offs of the gradient decomposition algorithm derived in Section 3.2. First, we outline the network architecture and task setting. Second, we present the results assessing our control over the stability-plasticity trade-off given our algorithm. Third, to understand the complexity of the network and task setting, we assess the stability-plasticity trade-offs of EWC. We chose EWC due to its popularity, the relative ease of its implementation outside the Avalanche library, and because it has only one regularization parameter. 5.1 NETWORK AND TASK We considered a neural network with one hidden layer with 11 neurons with no bias terms, which maps MNIST images (LeCun et al., 1998) to their classes (The exact architecture and optimization procedure is described in Appendix A.1.2). We considered the split-MNIST setting where the first task is to classify the first five digits (0-4), and the second task is to classify the last five digits (5-9). Images were subjected to augmentations. Separate readouts were trained for the two tasks, with softmax activation and cross-entropy loss. After training on task 1, we computed the projection matrices CC⊤ and NN⊤, using SVD. 5.2 RESULTS First, we assessed if the gradient decomposition algorithm managed to maintain stability without trading off plasticity, and whether varying the range and null space weights (α and β) led to the control over the stability-plasticity trade-off outlined in the RDAC framework. As seen in Figure 3A, when α = 0 and β = 1, the performance on both task 1 (stability) and on task 2 (plasticity) was high. We also observed no task 1 activation change in the readout 1 range, but observed substantial change in the null space which corresponds to the network learning task 2 (Figure 3B). Increasing α to 1 increased the activation change in the readout range, thereby reducing the stability. On the other hand, lowering β to 0 decreased the activation change in the readout null space, thereby reducing the plasticity. These simulations both show the efficacy of the gradient decomposition algorithm and confirm the control over the stability-plasticity trade-off outlined in the RDAC framework. Next, to assess the complexity of the split-MNIST task in a one-hidden-layer linear network, we assessed the stability-plasticity trade-offs of EWC. If it is trivial to jointly maintain stability and plasticity, we reasoned that EWC can fare well on this task as compared to the task in the previous section. As seen in Figure 3A, increasing the regularization strength of EWC increased the stability at the expense of plasticity. Analyzing the activation change in the readout range and null space revealed that EWC ended up restricting change not only in the range (which is useful for stability) but also in the null space which was detrimental to plasticity (Figure 3B). This indicates that the network and task settings in use constitute a non-trivial continual learning problem. These results confirm that the principles of the RDAC framework can be fruitfully put into practice. 7 Figure 3: Continual learning in one hidden-layer linear neural networks learning to classify MNIST digits. (A) The gradient decomposition algorithm can maintain both stability and plasticity when the gradients are projected into the null space of the previous readout (α = 0, β = 1). Allow- ing the gradients to be projected into the range of the readouts (α > 0) is detrimental to stability, whereas restricting the gradients from being projected into the null space of the readouts (β < 1) is detrimental to plasticity. Additionally, Elastic weight consolidation (EWC) trades off plasticity for stability, indicating that this problem is non-trivial from a continual learning standpoint. Darker hues correspond to higher values of α, β, and the EWC regularization strength λ. (B) In the hidden-layer activation space, the gradient decomposition algorithm effectively restricts changes in the activations for task 1 to the null space of the task 1 readout. Restricting the change in the null space is detri- mental to plasticity, as seen in the case of EWC and when we set β < 1. These results illustrate the utility of the RDAC framework in informing the construction of new continual learning algorithms. 6 DISCUSSION In this study, we introduced the Readout-Decomposition of Activation Change (RDAC) framework which provides a unique perspective on the stability-plasticity dilemma in continual learning, by viewing the continual learning problem from the standpoint of the readout layer. The core insight is as follows. Readouts span a subspace (the range) in activation space. Restricting learning from making changes to the projections of the activations of prior tasks to that subspace is sufficient to ensure stability. Further restricting any change to the activations in the subspace other than that spanned by the readout (the null space) is detrimental to plasticity. We analyzed popular continual learning algorithms and provided insights into the trade-offs these algorithms make in terms of stability and plasticity, and how they relate to changes in the activations for prior tasks from the perspective of the prior readouts. Additionally, given the insights from the framework, for one- hidden-layer linear networks, we derived a gradient decomposition algorithm that restricts learning- induced activation changes to only the null space of prior readouts to maintain plasticity while ensuring stability. The regularization-based algorithms, SI, EWC, and LwF, traded off plasticity substantially for sta- bility. In contrast, the gradient decomposition algorithm and the replay-based algorithms managed to maintain high plasticity and stability. We suspect that reliance on Sherringtonian notions of in- formation processing (Barack & Krakauer, 2021), in the case of SI and EWC, is the cause of this discrepancy. Usually the hyperplanes are not axis-aligned (Morcos et al., 2018), as schematized in Figure 1). If the importance scores are computed at the level of the individual weights (correspond- ing to the two hidden neurons) in the setting in Figure 1, both the weights/axes would have high importance scores. The regularization algorithms would weigh down learning in both the weights. However, a regularization algorithm relying on the principal dimensions of the learning in weight space (a Hopfieldian approach) could identify the subspace in which both the weights are allowed to 8 change, thereby increasing the capacity to learn new tasks while preserving stability. The theoretical analysis and empirical testing of this idea are interesting avenues for future work. The replay-based algorithms, GEM and data replay, maintained higher plasticity than the regularization-based algorithms, given the same amount of stability. Crucially, we observed that the activation changes in the range of the readout were higher than expected and proposed that it could be traced back to a degenerate solution space imposed by the non-linearity in the loss func- tion. The regularization-based algorithm, LwF, also enjoyed such degeneracy provided by the loss function. However, there are two points of divergence between LwF and the replay-based algo- rithms. One, the estimates of the gradients for prior tasks were computed using the data seen during ongoing learning, which were potentially bad approximations. Two, the loss was computed using the probability distribution over prior readouts, termed "pseudo-labels", which potentially provided a lower degree of degeneracy than a 1-hot true-label distribution provided. These two aspects might have contributed to LwF being unable to change activations in the range as much as GEM and data replay did. Moving forward, extensions of the RDAC framework analytically to non-linear settings would be crucial to shed light on the learning dynamics in such algorithms. An intriguing facet of our framework lies in its demonstration that activation changes within the null space of the readout are essential for learning. Consider the following situation: an observer unaware of the continual learning algorithm observes the network activations for a fixed set of stimuli over learning. The activations would keep changing across time which could make the observer wonder how the network reads out of such a dynamic code. Moreover, in the case where the loss functions used by the algorithm are non-linear, the resultant degeneracy might make any readout trained by the observer at a time point harder to generalize to other time points. These signatures of activation change and the optimal-readout changing over time have been observed in mammalian brains, and the activation change is termed "representational drift" (Driscoll et al., 2017). Recently it has been suggested that the reason drift exists is because animals are engaged in learning (Aitken et al., 2022; Masset et al., 2022; Driscoll et al., 2022; Micou & O'Leary, 2023). This suggestion dovetails with the RDAC framework under which, drift, especially in the null space of the readout, is indispensable to continual learning. The RDAC framework is designed with a focus on task-incremental learning, where new readouts are trained for each task encountered during the continual learning process, and the prior readouts are frozen. There exist other continual learning scenarios van de Ven et al. (2022), some in which the readout layer can always be learnable (Rebuffi et al., 2017) and can be shared across multiple tasks with the addition of a context signal (Cheung et al., 2019). By allowing the readout to adapt to new tasks, or by including context-signals, enabling the network to distinguish between different tasks and appropriately adjust its responses, the effective capacity that a learning algorithm can leverage could be higher, facilitating more plasticity and stability (Thorat et al., 2019; Hummos, 2022). How- ever, it is not immediately clear how the RDAC framework could be extended to these scenarios, but accommodating them is essential for building a more versatile and adaptable framework for studying continual learning. In closing, the RDAC framework not only provides a diagnostic tool to shed light on the intricate dynamics of stability and plasticity but also provides practical insights for the development of more robust continual learning algorithms. The journey of continual learning research continues, with our work offering a valuable contribution towards achieving the delicate balance between preserving past knowledge and adapting to new challenges in an ever-evolving world of information. REPRODUCIBILITY STATEMENT Details about the implementation of the continual learning algorithms are mentioned both in the Sections 4 and 5, and in the Appendix A.1. The gradient decomposition algorithm is derived and fully explained in Section 3.2. ACKNOWLEDGMENTS The project was funded by the European Union (ERC, TIME, Project 101039524), and by the research training group "Computational Cognition" (GRK2340) who are funded by the Deutsche Forschungsgemeinschaft (DFG; German Research Foundation). Compute resources were funded by the DFG (Project number 456666331). 9 REFERENCES Kyle Aitken, Marina Garrett, Shawn Olsen, and Stefan Mihalas. The geometry of representational drift in natural and artificial neural networks. PLOS Computational Biology, 18(11):e1010716, 2022. Daniel Anthes, Sushrut Thorat, Peter K ̈onig, and Tim C Kietzmann. Diagnosing catastrophe: Large parts of accuracy loss in continual learning can be accounted for by readout misalignment. In Conference on Cognitive Computational Neuroscience, pp. 748–751, 2023. David L Barack and John W Krakauer. Two views on the cognitive brain. Nature Reviews Neuro- science, 22(6):359–371, 2021. Gail A Carpenter and Stephen Grossberg. A massively parallel architecture for a self-organizing neural pattern recognition machine. Computer vision, graphics, and image processing, 37(1): 54–115, 1987. Antonio Carta, Lorenzo Pellegrini, Andrea Cossu, Hamed Hemati, and Vincenzo Lomonaco. Avalanche: A pytorch library for deep continual learning. arXiv preprint arXiv:2302.01766, 2023. Brian Cheung, Alexander Terekhov, Yubei Chen, Pulkit Agrawal, and Bruno Olshausen. Superpo- sition of many models into one. Advances in neural information processing systems, 32, 2019. MohammadReza Davari and Eugene Belilovsky. Probing representation forgetting in continual In NeurIPS 2021 Workshop on Distribution Shifts: Connecting Methods and Appli- learning. cations, 2021. Matthias De Lange, Rahaf Aljundi, Marc Masana, Sarah Parisot, Xu Jia, Aleˇs Leonardis, Gregory Slabaugh, and Tinne Tuytelaars. A continual learning survey: Defying forgetting in classification tasks. IEEE transactions on pattern analysis and machine intelligence, 44(7):3366–3385, 2021. Laura N Driscoll, Noah L Pettit, Matthias Minderer, Selmaan N Chettih, and Christopher D Harvey. Dynamic reorganization of neuronal activity patterns in parietal cortex. Cell, 170(5):986–999, 2017. Laura N Driscoll, Lea Duncker, and Christopher D Harvey. Representational drift: Emerging theo- ries for continual learning and experimental future directions. Current Opinion in Neurobiology, 76:102609, 2022. Robert M French. Catastrophic forgetting in connectionist networks. Trends in cognitive sciences, 3(4):128–135, 1999. Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pp. 1026–1034, 2015. Ha Hong, Daniel LK Yamins, Najib J Majaj, and James J DiCarlo. Explicit information for category- orthogonal object properties increases along the ventral stream. Nature neuroscience, 19(4):613– 622, 2016. Ali Hummos. Thalamus: a brain-inspired algorithm for biologically-plausible continual learning and disentangled representations. arXiv preprint arXiv:2205.11713, 2022. Tobias Kalb and J ̈urgen Beyerer. Causes of catastrophic forgetting in class-incremental semantic segmentation. In Proceedings of the Asian Conference on Computer Vision, pp. 56–73, 2022. Dongwan Kim and Bohyung Han. On the stability-plasticity dilemma of class-incremental learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 20196–20204, 2023. James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcom- ing catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521–3526, 2017. 10 Yajing Kong, Liu Liu, Zhen Wang, and Dacheng Tao. Balancing stability and plasticity through In European Conference on Computer Vision, pp. advanced null space in continual learning. 219–236. Springer, 2022. Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. Yann LeCun, L ́eon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. Zhizhong Li and Derek Hoiem. Learning without forgetting. IEEE transactions on pattern analysis and machine intelligence, 40(12):2935–2947, 2017. David Lopez-Paz and Marc'Aurelio Ranzato. Gradient episodic memory for continual learning. Advances in neural information processing systems, 30, 2017. Paul Masset, Shanshan Qin, and Jacob A Zavatone-Veth. Drifting neuronal representations: Bug or feature? Biological cybernetics, 116(3):253–266, 2022. Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation, volume 24, pp. 109–165. Elsevier, 1989. Martial Mermillod, Aur ́elia Bugaiska, and Patrick Bonin. The stability-plasticity dilemma: Investi- gating the continuum from catastrophic forgetting to age-limited learning effects, 2013. Charles Micou and Timothy O'Leary. Representational drift as a window into neural and behavioural plasticity. Current Opinion in Neurobiology, 81:102746, 2023. Ari S Morcos, David GT Barrett, Neil C Rabinowitz, and Matthew Botvinick. On the importance of single directions for generalization. arXiv preprint arXiv:1803.06959, 2018. Martin Mundt, Yongwon Hong, Iuliia Pliushch, and Visvanathan Ramesh. A wholistic view of continual learning with deep neural networks: Forgotten lessons and the bridge to active and open world learning. Neural Networks, 160:306–336, 2023. German I Parisi, Ronald Kemker, Jose L Part, Christopher Kanan, and Stefan Wermter. Continual lifelong learning with neural networks: A review. Neural networks, 113:54–71, 2019. Vinay V Ramasesh, Ethan Dyer, and Maithra Raghu. Anatomy of catastrophic forgetting: Hidden representations and task semantics. arXiv preprint arXiv:2007.07400, 2020. Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, Georg Sperl, and Christoph H Lampert. icarl: In Proceedings of the IEEE conference on Incremental classifier and representation learning. Computer Vision and Pattern Recognition, pp. 2001–2010, 2017. Sushrut Thorat, Giacomo Aldegheri, Marcel AJ Van Gerven, and Marius V Peelen. Modulation of early visual processing alleviates capacity limits in solving multiple tasks. arXiv preprint arXiv:1907.12309, 2019. Sushrut Thorat, Giacomo Aldegheri, and Tim C Kietzmann. Category-orthogonal object features guide information processing in recurrent neural networks trained for object categorization. In SVRHM 2021 Workshop @ NeurIPS, 2021. Gido M van de Ven, Tinne Tuytelaars, and Andreas S Tolias. Three types of incremental learning. Nature Machine Intelligence, 4(12):1185–1197, 2022. Liyuan Wang, Xingxing Zhang, Hang Su, and Jun Zhu. A comprehensive survey of continual learning: Theory, method and application. arXiv preprint arXiv:2302.00487, 2023. Shipeng Wang, Xiaorong Li, Jian Sun, and Zongben Xu. Training networks in null space of feature In Proceedings of the IEEE/CVF conference on Computer covariance for continual learning. Vision and Pattern Recognition, pp. 184–193, 2021. 11 Zeyuan Yang, Zonghan Yang, Yichen Liu, Peng Li, and Yang Liu. Restricted orthogonal gradient projection for continual learning. AI Open, 2023. Friedemann Zenke, Ben Poole, and Surya Ganguli. Continual learning through synaptic intelligence. In International conference on machine learning, pp. 3987–3995. PMLR, 2017. Zhen Zhao, Zhizhong Zhang, Xin Tan, Jun Liu, Yanyun Qu, Yuan Xie, and Lizhuang Ma. Rethinking gradient projection continual learning: Stability/plasticity feature space decoupling. In Proceed- ings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3718–3727, 2023. A APPENDIX A.1 METHODS A.1.1 DEEP NON-LINEAR NETWORK EXPERIMENTS For the experiments on the Cifar110 task we construct 11 datasets (one for each task). The first task, on which we perform the bulk of our analyses consists of the full Cifar10 dataset (with usual training and validation splits). For each subsequent task, we sample 10 unique classes from Cifar100. Experiments are repeated with three different repeats of this procedure, providing some control for varying difficulty of the different task splits. Data for all tasks was augmented with random cropping (padding = 4) and horizontal flipping throughout training. All data was normalized with means (0.5071, 0.4865, 0.4409) and standard deviations (0.2673, 0.2564, 0.2762) for the RGB channels. All networks were trained with Adam (lr = 0.001, β1 = 0.9, β2 = 0.999) for 60 epochs per task. Following the findings in Li & Hoiem (2017), we warm up the new readout at the start of each new task (excluding training on the first task). This has been reported to stabilize representations at the start of training on a new task (where the randomly initialized new readout is not aligned with the features of the remainder of the network, causing large gradients). We freeze the weights of all layers except the new readout for the first 10 epochs of training. Additionally, since our analyses investigate activation changes relative to the range of previously learned readouts, we freeze all parameters in old readouts for methods that would otherwise allow changing readout weights for old tasks (this is the case for LwF and data replay). The network architecture for these experiments is adopted from Zenke et al. (2017) and has been slightly altered. It consists of two VGG blocks (32 channels in the first, 64 channels in the second block each, kernel size 3). Each block of two convolutional layers is followed by a max pool layer with kernel size and stride 2. The pre-readout dense layer was scaled to have 128 output units and no dropout was used throughout the network. All layers in the backbone were initialized with Kaiming-He He et al. (2015) initialisation as implemented in PyTorch. After performing initial sweeps for the hyperparameters in the tested algorithms to determine the rough effective ranges, we performed additional sweeps for each algorithm in order to generate the datapoints in figure 2. Each datapoint visualised is the average over three experiments with the same hyperparameter settings, but different seeds (and therefore task splits as described above). Hyperparameters were swept as follows: • For EWC, λ was varied between 1e − 1 - 1e5. • For SI, ε was fixed to 1 and λ was varied between 1e − 2 and 1e5. • For LwF, we fixed the temperature to 1 and varied alpha between 0.01 and 10. • For data replay, we used replay buffer sizes between 0 and 60000 samples, with the default replay buffer style as implemented in Avalanche (as of version 0.3.1). • For GEM, we varied the memory strength parameter (γ in the original publication) between 0 and 1 and varied the number of patterns stored per experience to estimate the gradient projection between 0 and 20000. 12 Figure 4: Movement in range and null space for gradient decomposition (surface) and EWC (scatter points). Points and contours are coloured by plasticity, stability and "capacity" computed as plastic- ity + stability. A.1.2 ONE-HIDDEN LAYER LINEAR NETWORK EXPERIMENTS The linear system described in section 5 is a one hidden layer network without biases and 11 units in its hidden layer. The network has two separate linear readouts with 5 units each, to accommodate the split MNIST task. For all experiments, the network was trained for 30 epochs per task, with plain stochastic gradient descent and a learning rate 5.10−4 and batch size 16. Since the Split MNIST task is very easy, even for a small linear network we increase the difficulty of the dataset slightly by applying a number of transformations to the dataset once at the time of constructing the dataset. This increases the effect of catastrophic forgetting while keeping a fixed dataset, allowing for easy experimentation. The transformations were implemented using the torchvision transforms package. Images of digits were augmented with random rotations (±10 degrees), translations (±10 percent of image size in both axes), scaled between 90-110% of the original size and randomly cropped with padding = 4. Finally, we applied the 'ColorJitter' transformation with parameters brightness = 0.1, contrast = 0.1, saturation = 0.1 and hue = 0.1. Transformations are only applied to training data for both tasks. For EWC, we approximate the diagonal of the Fisher information matrix for the hidden layer pa- rameters as the square of the gradients for the first task over the whole dataset for task 1. Fw = (cid:80) N (∆w)2 N For N batches of data. We sweep 1000 values for the scalar multiplier λ governing regularization strength on a log scale between 0 and 105. To illustrate our gradient decomposition result, we swept the space of possible decompositions in a grid with 33 linear spaced values between 0 and 1 for α and β. In Figure 3 we visualized the extremes of this search, and the results of the full space are included in Figure 4 for completeness. 13
http://arxiv.org/abs/2310.04727v1
"2023-10-07T07:55:22"
"2023-10-07T07:55:22"
Task Aware Modulation using Representation Learning: An Approach for Few Shot Learning in Heterogeneous Systems
We present a Task-aware modulation using Representation Learning (TAM-RL) framework that enhances personalized predictions in few-shot settings for heterogeneous systems when individual task characteristics are not known. TAM-RL extracts embeddings representing the actual inherent characteristics of these entities and uses these characteristics to personalize the predictions for each entity/task. Using real-world hydrological and flux tower benchmark data sets, we show that TAM-RL can significantly outperform existing baseline approaches such as MAML and multi-modal MAML (MMAML) while being much faster and simpler to train due to less complexity. Specifically, TAM-RL eliminates the need for sensitive hyper-parameters like inner loop steps and inner loop learning rate, which are crucial for model convergence in MAML, MMAML. We further present an empirical evaluation via synthetic data to explore the impact of heterogeneity amongst the entities on the relative performance of MAML, MMAML, and TAM-RL. We show that TAM-RL significantly improves predictive performance for cases where it is possible to learn distinct representations for different tasks.
[ "Arvind Renganathan", "Rahul Ghosh", "Ankush Khandelwal", "Vipin Kumar" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04727v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04727v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI" ]
Task Aware Modulation using Representation Learning: An Approach for Few Shot Learning in Heterogeneous Systems Arvind Renganathan∗ Rahul Ghosh∗ Ankush Khandelwal∗ Vipin Kumar∗ 3 2 0 2 t c O 7 ] G L . s c [ 1 v 7 2 7 4 0 . 0 1 3 2 : v i X r a Abstract We present a Task-aware modulation using Representation Learning (TAM-RL) framework that enhances personalized predictions in few-shot settings for heterogeneous systems when individual task characteristics are not known. TAM- RL extracts embeddings representing the actual inherent characteristics of these entities and uses these characteristics to personalize the predictions for each entity/task. Using real-world hydrological and flux tower benchmark data sets, we show that TAM-RL can significantly outperform existing baseline approaches such as MAML and multi-modal MAML (MMAML) while being much faster and simpler to train due to less complexity. Specifically, TAM-RL eliminates the need for sensitive hyper-parameters like inner loop steps and inner loop learning rate, which are crucial for model convergence in MAML, MMAML. We further present an empirical evaluation via synthetic data to explore the impact of heterogeneity amongst the entities on the relative performance of MAML, MMAML, and TAM-RL. We show that TAM-RL significantly improves predictive performance for cases where it is possible to learn distinct representations for different tasks. 1 Introduction In many real-world scenarios, we are interested in pre- dicting the response of an entity/task given its drivers. For instance, consider the task of predicting Gross pri- mary product (GPP) across the globe, where each grid cell is an entity. GPP measures the amount of carbon dioxide plants absorb through photosynthesis, which is driven by factors such as weather (e.g., temperature, rainfall) and Leaf Area Index (LAI). The relationship between drivers and response is often heterogeneous, as it is determined by entity characteristics. For example, different grid cells, defined by their ecoregions and cli- mate zones, can have vastly different GPP responses to the same weather conditions and LAI values [18]. Such a scenario is quite common in environmental applica- tions but can also be seen in other applications (e.g., people (entity) can have different heart rates (response) ∗University of Minnesota. {renga016, ghosh128, khand035, kumar001}@umn.edu Figure 1: An abstract representation of a physical system, where xi t represent the input drivers, response, and zi represents the entity characteristics of an entity i. t, yi for the same physical activity (driver) depending on the physical fitness of the person (entity characteristic)). Figure 1 reflects this as an abstract scenario. While such problems are often solved using process- based models [16], there is an increasing interest in using ML to address their well-known limitations [11, 32]. In particular, several works have already demonstrated the advantages of constructing an ML model that utilizes driver and response data from a set of well-observed entities (training set) and uses them to make predictions on entities that are not present in the training set in domains such as engineering [13], healthcare [19], and environmental sciences [16]. Typically, these "zero- shot" approaches require entity characteristics (also referred to as auxiliary characteristics) [31] to transfer information from the entities in the training set to those in the test set [15]. However, there are many situations where such auxiliary characteristics are either not available or highly uncertain [3]. This paper focuses on learning methods that can personalize predictions for each entity without any knowledge of the entity/task characteristics as long as it has a small amount of (driver, response) data (see Figure 2). This few-shot setting is in contrast to a traditional ML model that requires an ample amount of labeled (i.e., driver, response) data for each entity. Meta-learning [10] is a framework that enables models to quickly learn new tasks in a few-shot setting by leveraging task similarities. Model such approach that agnostic meta-learning (MAML) [5] is one enables quick fine- tuning(adaptation) on new tasks with limited training data using a small number of gradient updates Fig 3a. The term "model-agnostic" in this context implies that these techniques are compatible with any base Figure 2: Experimental setting followed in this paper for testing. Modulation and adaptation are performed using few-shots of data when availble network trained via gradient descent. However, a single meta initialization for a base network does not work well when task distribution is multi-modal. Here, a commonly used approach is to train another network to generate entity-specific embeddings and use them to modulate a shared prediction network [2, 22, 28]. Multi-modal MAML(MMAML) is a prominent few-shot learning technique in this category. Instead of learning a single meta-initialization point in the parameter space, MMAML first computes task- specific modulation parameters using its task modula- tion network, which includes a task encoder and a mod- ulation parameter generator. Given this modulation pa- rameter, MMAML then uses these parameters to mod- ulate the meta-initialization of the base network. This meta-initialized base network is then meta-trained us- ing a few steps of gradient-based adaptation towards the target case like MAML (see Figure 3b). However, there are several challenges; First, the adaptation step used during meta-training of the base network makes it less critical for MMAML to learn a high-quality mod- ulation network. Second, backpropagating the gradi- ents through the inner loop (with multiple updates) in MAML is difficult, and this problem worsens when using MAML in a multimodal meta-learning framework like MMAML because the gradient has to flow through not just the inner loop but also the modulation network. Together with the first challenge, this makes it even harder to learn a high-quality modulation. Finally, Ad- ditional issues affect MAML-like approaches, including instability depending on architectural and hyperparam- eter choices, lengthy training times, and the challenge of selecting the right hyperparameters. This paper proposes a new multimodal meta- learning framework, Task Aware Modulation using Rep- resentation Learning (TAM-RL) to address these chal- lenges. TAM-RL differs from MMAML in one key as- pect: The modulated meta initializations are directly used for forward passes through the base network/model instead of another optimization procedures. This way of meta-learning is also termed amortized meta-learning, as the base and modulation networks are both trained in a unified fashion. This design choice in TAM-RL addresses several issues in MMAML effectively. Firstly, TAM-RL's modulation network is forced to learn mean- ingful representations, thereby generating improved meta-initializations for the base network. Secondly, by replacing inner-loop adaptation with a forward pass of the base network, TAM-RL achieves enhanced gradient propagation, resulting in a better-quality modulation network. Additionally, this design decision helps TAM- RL avoid problems commonly associated with MAML- like approaches, such as instability problems depending on the architecture and hyper-parameter choices, signif- icant training times, and a cumbersome hyperparame- ter selection process, and relieves the need for second derivatives during training. Our main contributions can be summarized as follows: • We introduce T AM -RL as a novel multimodal Meta Learning framework for learning ML mod- els for a diverse set of entities for a few-shot setting when explicit entity-specific characteristics are un- known. • We perform an extensive evaluation of T AM -RL and existing relevant meta-modeling methods (e.g., MAML, MMAML) in predicting two important en- vironmental problems of predicting Gross Primary Product (GPP) and forecasting streamflow in real- world datasets (section 3.1), demonstrating signif- icantly better performance while beings faster and much simpler to train due to reduced complexity. • We present an empirical evaluation via syn- thetic data to explore the impact of heterogeneity amongst the entities on the relative performance of MAML, MMAML, and T AM -RL. 2 RELATED WORK Few-shot Learning: In a Few-shot context, models are trained to accurately predict with very little labeled data per class or task. Recent successful methods use meta-learning to enable models to quickly learn from limited examples and effectively adapt to new tasks. One well-known method is MAML [5], which aims to find an initialization that allows a model to perform well on validation data after only a few inner adapta- tion steps. To handle multimodal task distributions, some studies [1,28,30] have proposed extending MAML to multiple initializations. They [2, 28] train another network to generate entity-specific embeddings and use them to modulate a shared meta-trained prediction net- work. However, although some studies have focused on applying these methods to time series regression, they do not address the core challenges of MMAML. (a) (b) (c) Figure 3: Comparing of MAML, MMAML and TAM-RL methods. a) MAML: Model computes shared initialization (red dot), which is adapted(curved arrows) to tasks(blue dots), it may fail to adapt to dissimilar tasks (outer blue dots) using few shots of data b) MMAML: Model uses task-specific modulation parameters to modulate (straight arrow) shared initialization (red dot) and get task specific initialization (orange dot) which are then adapted to tasks(blue dots). c) TAM-RL: Model uses task-specific modulation parameters to modulate(straight arrow) shared initialization (red dot) to directly compute meta initialization (orange dots) for given tasks(blue dots). To solve its gradient, computation, and stability is- sues, one study [1] extended MMAML by switching the MAML trained base network to a simpler meta- learner, ProtoNet [25]. However, this restricts the meta- learner to only classification tasks and adopting them for regression-based tasks is nontrivial. Neural processes (NP), another group of methods for the few-shot setting, combine Deep Neural Net- works with Bayesian techniques like Gaussian Processes (GPs) to predict new functions while incorporating prior knowledge [6]. NPs use an inferred entity embed- ding to condition the prediction function on observed data. The model consists of an encoder for generating representations, an aggregator for merging representa- tions, and a conditional decoder for creating target pre- dictions [6]. This approach does not require the instanti- ation and maintenance of a unique set of model param- eters, unlike computationally expensive MAML-based techniques that are sensitive to hyperparameter choices. However, to improve predictive performance, it is ben- eficial to jointly infer correlated tasks from multiple sources and leverage their underlying correlation [7,12]. Ghosh et al. [7] introduced a specialized case of NP called KGSSL, which jointly infers time-invariant en- tity attributes from driver-response behavior and uti- lizes them to train a prediction model. Multi-Task learning: The objective is to learn across multiple related tasks collectively. Collective learning across multiple tasks is achieved using sharing of some or all of their model parameters. This sharing of infor- mation allows the model to transfer knowledge between [4]. Some examples of multi-task learning ap- tasks proaches are age group classification [10], mood predic- tion [26], human mobility prediction [29], streamflow prediction [17]. However, the goal of MTL is to solve a fixed number of known tasks, unlike meta-learning, where the goal is often to solve unseen future tasks. 3 Problem Formulation This study focuses on using ML models to learn driver- response behavior for various sparsely observed multi- modal entities. These entities can be physical sys- tems like flux towers, river basins, tasks, people, or do- mains/distributions. We have access to a collection of driver/response pairs of time series sequences for each entity i in the train set. For each entity i in the Train- ing set, we can access a set of multivariate time se- ries instances of corresponding inputs and output pairs, DT rain i , y2 )], i where The daily drivers Xi are a multivariate time se- i ∈ RDx ries, where Xi = [x1 represents the input vector at time t ∈ T with Dx di- mensions, and Yi = [y1 i ] represents the cor- responding output. Additionally, set, a few-shot data of inputs and outputs, DF ew j ), (X 2 j , y1 [(X 1 each entity j. for the set of entities in the test = )] is provided for i ), . . . , (X TT rain j ), . . . , (X TF ew i ]. where, xt i , . . . , xT i , . . . , yT i ), (X 2 , yTT rain , yTF ew j = [(X 1 i , x2 i , y1 j , y2 i , y2 j j i i The goal is to learn a regression function F : X → Y that maps the input drivers to the output response for each entity in the test set. Individual ML models can be trained for each entity with sufficient training data. However, this is not feasible for many entities which lack sufficient training data. The behavior of entities is of- ten governed by their inherent characteristics (zi). Thus the forward model is represented as Fθ(xt i, zi), where θ denotes the function class shared by the target systems and zi denotes entity-specific inherent characteristics. The major challenge lies in handling the heterogene- ity across different entities to achieve good performance over all entities, particularly in scenarios where the mea- surement of entity characteristics is unavailable. In this paper, we propose an entity-aware modeling approach to overcome the challenge of building a global model that can accurately predict the response of a new en- tity with limited observations, despite the heterogeneity across different entities. i ). Following the Meta-learning literature, we split a support the data for each entity into two sets: set (Dsupport ) and a query set (Dquery For the i entities used in training, both sets are taken from the training data (DT rain ). Whereas, for the entities i in the test set, the few shot data (DF ew ) is used as the support set. During training, meta-learning approaches use the support set (Dsupport ) to understand the temporal correlations, multivariate relationships, and task characteristics associated with each entity (i). This information is then used for prediction in the query set (Dquery ). The objective is to train the model on i DT rain i by minimizing the prediction error: j i (3.1) arg min θ (cid:88) i ||yt i − F (xt i; Dsupport)||2 where (xt i, yt i ) ∈ Dquery i Figure 4: Model Architecture - The modulation network generates task-specific modulation parameters τ , which are subsequently utilized to adapt the base network for the target task. This diagram illustrates the architecture when the base network is an LSTM erate modulated meta-parameters for the base network. The base network uses these Modulated meta parame- ters and input sequences to generate output sequences. During Inference, T AM -RL further uses an adaptation method that adjusts the base network to the specific task during inference. The following sections will pro- vide more details on the neural network architectures used for T AM -RL and its training process. 3.1 Motivating Problems We apply our proposed framework to two important environmental problems: predicting Gross Primary Product (GPP) for flux tow- ers with limited observations and forecasting streamflow in basins with sparse data. Both problems are impor- tant to address for practical reasons. Detailed high- resolution data is often lacking in regions such as the tropics and semi-arid areas, which are critical for the global carbon cycle. This data gap hampers our compre- hensive understanding of the global carbon cycle, par- ticularly in the context of climate change [21]. Addi- tionally, enhancing streamflow predictions in areas with limited access to accurate streamflow measurements, es- pecially in developing countries, can have substantial real-world impacts. 4 Method The T AM -RL architecture has two major components, each serving a crucial purpose in the meta-learning process: 1) A Modulation network that consists of a BiLSTM-based task encoder E, and a modulation pa- rameter generator G 2) A Base Network fθ which is the prediction network. The Modulation network learns task-specific features representing the entity's charac- teristics, which are then used to predict modulation pa- rameters using a modulation parameter generator. The base network is modulated by these parameters to gen- 4.1 Modulation Network 4.1.1 Task Encoder We use a Long Short-Term Memory (LSTM) network as a sequence encoder to cap- ture the temporal information and relationship between the driver and response in sequences. LSTMs are ideal for tasks that involve long-range temporal dependencies and can solve problems with exploding and vanishing gradients. However, LSTMs only process sequences in the forward direction and do not provide insights into future data. To address this, we utilize a Bidirectional LSTM [8] based sequence encoder, which consists of two LSTMs (forward and backward) that generate embed- dings for a sequence using the equations: (4.2) it = σ(Wi ft = σ(Wf gt = σ(Wg (cid:2)[xt; yt]; ht−1(cid:3) + bi) (cid:2)[xt; yt]; ht−1(cid:3) + bf ) (cid:2)[xt; yt]; ht−1(cid:3) + bg) (cid:2)[xt; yt]; ht−1(cid:3) + bo) ot = σ(Wo ct = ft ⊙ ct−1 + i ⊙ gt ht = ot ⊙ tanh (ct) To obtain the final embeddings (z), we add the last hidden states from both the forward (hf ) and backward LSTMs (hb) in the Task encoder E, as depicted in Fig 4. These task embeddings capture the temporal information and interaction between the driver and the response for a given task. (4.3) z = E([xt; yt]1:T ; φh) where, E is BilSTM with parameters φh. 4.1.2 Modulation Parameter Generator Modu- lation Parameter Generator is used to generate task- specific modulation parameters predict modulation pa- rameters τ using the embedding vector of the task through an MLP layer Afterward, we pass the learned embeddings through a multi-layer perceptron (MLP) layer to obtain the latent entity characteristics. (4.4) τ = G(z; φτ ) where, G is an MLP with patameters φτ . 4.2 Modulation For few-shot learning, it is essen- tial to modulate the base network in a way that is parameter-efficient. Unconstrained modulation, while being flexible, can also be slow and prone to overfit- ting. Instead, we propose using Film modulation [24] of the LSTM gate outputs for LSTM-based base networks, and which requires only a small number of task-specific parameters for both real-world problems. We similarly also perform Film modulation at each layer for the fully connected neural network-based base network. 4.3 Base Network (Decoder) The Base Network can be any model trained with gradient descent and is customized architectural choices, unique to each domain and dataset, and analogous to forward models in the context of environmental modeling, thereby making TAM-RL model agnostic. We use an LSTM-based Base Network F with modulated meta initialization to predict the response based on input drivers, as shown in the Base Network block of Fig 4, for our two real- life datasets for prediction of streamflow and GPP. The response is generated by a sequence-to-sequence LSTM network. Synthetic dataset uses a 4-layer fully connected neural network with ReLU non-linearity for each layer, as the base network. During Inference with T AM -RL, the modulation network is used to infer task- specific meta initialization of F. The modulated base network is then optimized for the target task through gradient-based optimization, similar to MMAML [28]. 4.4 Adaptation During Inference and not during training, the modulated base network is further opti- mized for the target task through gradient-based opti- mization, similar to MMAML [28]. We use an ADAM- based optimizer for the Adaptation step. It should be noted that the modulation network remains unaltered during the inference phase, preventing any negative im- pact from adaptation. 4.5 Training and Inference Algorithms To over- come the challenge of feeding a long time series into a model, we divide the training data (DT rain) into T sliding windows (W T rT ) during the training phase. These windows are further split into support windows (W supportT ) and query windows (W queryT ) for training the model. For each task in the support set, we select a support window (W supportT ) from the Train(W T rT ) sliding windows and extract the corresponding response and driver data for the given entity. The query set is constructed similarly, with the remaining data that was not used to create the support set. This ensures that the model is trained on a diverse set of support tasks and can generalize to unseen tasks during inference. The entire framework is trained end to end using a forward loss, which can be any supervised loss, depending on the problem. In our experiments, we use mean squared er- ror (MSE) as the supervised loss, as shown in equation 4.5. (4.5) L = 1 N N (cid:88) i=1 1 T T (cid:88) (yt i − ˆyt i )2 t=1 The final objective of TAM-RL during training can be formally expressed as: (4.6) arg min θ,φh,φτ (cid:88) i ||yt i − F (xt i; θ ′ i)||2 where ′ i = θi θ (cid:79) τ, τ = G(z; φt), z = E(W supportτ , φh), i i ) ∈ W queryτ i, yt s.t.(xt i The pseudocode for the training process can be found in Algorithm 1 in supplementary section. j j In the inference phase, we receive a small amount of data (Df ew ) for a new entity j, which we use to create T support sliding windows (W supportT ). These windows, along with the input data (xqueryT ), are used to make predictions. To do this, we first run a modulation network on a small amount of data to learn task-specific modulation parameters that modulate the base network. The modulated base network is then adapted using a few shots of Data. Finally, we use the task-specific characteristics, the input data, and the adjusted model parameters to make predictions. The detailed procedure is outlined in Algortihm 2 in the supplementary section. j 5 Dataset & Baselines 5.1 Datasets 5.1.1 Flux Tower Dataset: FLUXNET2015 [23] dataset is a global network of 206 eddy-covariance sta- tions that record carbon, water, and energy exchanges between the atmosphere and the biosphere, offering valuable global-scale observations across various cli- mate and ecosystem types. We aim to estimate Gross Primary Productivity (GPP) on a daily timescale for FLUXNET2015 sites using meteorological and remote sensing inputs (such as precipitation, air temperature, and vapor pressure.). In our study, we selected 150 tow- ers with more than three years of data and divided them into training (145 sites) and test sets (15 sites), follow- ing guidelines outlined in [21]. We held out a year of data for the test sites to serve as the evaluation dataset. To evaluate our machine learning models on the held- out test year on test sites, we utilized limited years of data (ranging from one month to 24 months) for model adaptation from the "few-shot" data, as illustrated in Figure 2. For additional details on data preparation, please refer to the Appendix in supplementary section. 5.1.2 CARAVAN GB: CARAVAN is a global benchmark dataset comprising 6,830 basins from var- ious open datasets worldwide, including regions such as the US, UK, GB, Australia, Brazil, and Chile. This dataset provides meteorological forcing data (e.g., pre- cipitation, potential evaporation, temperature), stream- flow observations, and basin characteristics. In this dataset, we aimed to estimate streamflow on a daily timescale for the CARAVAN GB Basins. We focused on a subset consisting of basins from the UK within CARAVAN, referred to as CARAVAN-GB, in our sub- sequent discussions. We selected a subset of 255 basins for our experiment, for which we had all streamflow ob- servations between 1989 and 1999. The selection of train and test basins was based on mean streamflow, with a 4:1 ratio resulting in 204 basins for training and 51 basins for testing (test sites). We employed a k-fold approach (k=5) to evaluate all models' perfor- mance across all basins. The ML models were trained on train basins during train years and evaluated on out-of- sample basins during test years, which are not encoun- tered during training, as shown in Fig 2. We assume we have access to a few-shot years of data for model performance evaluation. 5.1.3 Synthetic Dataset: We follow the synthetic data generation setup used by Vuorio et al. [28]. Specifically, we create a set of task distributions for regression with different modes. Modes are a collection linear of functions that include sinusoidal functions, functions, quadratic functions, l1 norm functions, and hyperbolic tangent functions. Each task/function from these modes is created by changing as shown: Sinusoidal: A * sin w * x + b + ε, with A ∈ [0.1, 5.0], w ∈ [0.5, 2.0] and b ∈ [0, 2π] Linear: A * x + b, with A ∈ [−3, 3] A * (x − c)2 + b, with A ∈ c ∈ [−3.0, 3.0] and Quadratic: [−0.15, −0.02] ∪ [0.02, 0.15], b ∈ [−3.0, 3.0] ) l1 norm: A * |x − c| + b, with A ∈ [−0.15, −0.02] ∪ [0.02, 0.15], c ∈ [−3.0, 3.0] and b ∈ [−3.0, 3.0] Hyperbolic tangent: A * tanh(x − c) + b, with A ∈ [−3.0, 3.0], c ∈ [−3.0, 3.0] and b ∈ [−3.0, 3.0] We add Gaussian noise (μ = 0 and standard de- viation = 0.3) to each data point obtained from the individual task. 5.2 Baselines & Implementation Details • M AM L: We train a global model using MAML [5] as the baseline to compare with existing methods. For our real-world dataset, MAML uses LSTM as the base network. It uses a 4-layer fully connected neural network for synthetic datasets with ReLU non-linearity for each layer. The architecture of MAML on each individual dataset is designed to be the same as base network in TAM-RL • M M AM L: We train a global model using M M AM L [28] as the baseline to compare with existing methods. For our real-world dataset, M M AM L uses BiLSTM and MLP for the task en- coder and Modulation Parameter Generator in the modulation network and LSTM as the base net- work. For the synthetic dataset, M M AM L uses BiLSTM and MLP as the modulation network and a 4-layer fully connected neural network with ReLU non-linearity for each layer as the base network. M M AM L(w/o)adapt is the version of M M AM L obtain pre-adaptation step in inference. The archi- tecture of MMAML on each individual dataset is designed to be the same as base network and mod- ulation network in TAM-RL 6 Experimental and Results 6.1 Real World Datasets This section presents the results of two experiments conducted on real-world datasets: the Flux Tower Dataset and the CARAVAN GB Dataset. For the Flux Tower Dataset, we preprocess time series data by creating sliding windows of 30 days, strided by half the sequence length (15 days). The LSTM base network takes 30-length sequences as input and generates output at a stride of 15 days. Similarly, we create sliding windows of 365 days for the streamflow dataset, strided by half the sequence length (183 days). Here, LSTM takes 365-length sequences as input and generates output at a stride of 183 days. We compare the performance of our proposed method, TAM-RL, with two baseline methods, MAML and MMAML, in a few-shot learning setting. Both datasets utilize LSTM designed as a sequence-to- Architecture MAML MMAML TAM-RL (ours) 3 Flux Tower (in Months) 1 PM PA PM PA PM PA PM PA 2.12 1.95 1.73 - 7.09 2.38 - 6.39 2.35 2.54 2.65 2.31 2.71 2.77 2.39 2.13 2.07 1.79 - 6.03 2.19 - 6.22 2.20 12 24 2 Caravan-GB (in Years) 1 PM PA PM PA PM PA 1.38 - 1.29 1.72 1.19 1.45 1.40 1.35 1.29 - 1.72 1.25 1.39 1.34 1.23 - 1.72 1.29 5 Table 1: Mean Ensemble Root Mean Square Error (RMSE) for GPP prediction flux tower dataset and streamflow modeling on CARAVAN-GB Benchmark dataset, comparing TAM-RL and the baselines Post Modulation (PM) and Post Adaptation(PA). The amount of data used as few-shots are denoted as column names. sequence prediction as base networks, chosen for their ability to handle sequential inputs and generate pre- dictive outputs. For both datasets, we employ BiL- STM and an MLP layer for the modulation network, representing the task encoder and Modulation Param- eter Generator, respectively. The best training hyper- parameters differ by domain of application and baseline method. Please refer to the supplementary materials for concrete specifications of the best hyperparameters. To mitigate the impact of randomness due to network initializations, we report results of the ensemble predic- tion obtained by averaging the predictions of five models with different weight initializations for all architectures (ours and baselines). Table 1 presents the mean ensemble RMSE val- ues for GPP prediction in the Flux Tower Dataset and streamflow prediction in the CARAVAN-GB Bench- mark datasets. The columns in the table represent the available few-shot observation data for modulation and adaptation (see Figure 2 for experimental setting). For All architectures, we report performance evaluation post Adaptation; for models with a modulation network (MMAML and TAM-RL), we also provide performance evaluation Post Modulation(i.e., Pre-Adaption) to eval- uate the modulation network. From Table 1, we observe that MAML's overall performance remains relatively weak, showing that a single initialization is challenging to adapt for all tar- get tasks. For GPP prediction in flux tower, we ob- serve that MMAML post-modulation struggles without the adaptation step but is able to improve its perfor- mance significantly (by a margin of 155-209 %) under different few-shot situations) post adaptation. Similar behavior is observed in streamflow prediction, where MMAML is able to improve its performance signifi- cantly once adapted(21.6 to 25% ). This behavior aligns with MMAML's expected behavior, as it is designed to exhibit enhanced performance when adapted using a few-shots of data during testing. In contrast, TAM- RL performs comparable to or better than MAML and MMAML even without adaptation. Furthermore, in streamflow modeling, TAM-RL, without adaptation but modulated using two years of few-shot data, outper- forms both baselines post-modulation and adaptations. For GPP prediction, TAM-RL, without adaptation, demonstrates a remarkable trend of performance im- provement as the number of few-shot years of data increases. This illustrates TAM-RL's capacity to ef- fectively leverage additional data points, resulting in improved modulation parameters. Furthermore, when TAM-RL performs both modulation and adaptation with limited observations, it demonstrates performance improvements compared to TAM-RL without adapta- tion. While part of this improvement can be attributed to a better base network, most of the enhancements are driven by the modulation of task-specific parameters. In contrast, for GPP prediction MMAML's performance gains with increasing few-shot data are primarily influ- enced by the adaptation process using the available few- shot data for adjusting the base network. These obser- vations hold true for the streamflow prediction dataset as well. TAM-RL outperforms our primary baseline, Multi- modal MAML (M M AM L), by a substantial margin for GPP flux prediction. It achieves a 13.7% improvement with 1 month of few-shot data, 12.8% with three months of few-shot data, 13.5% with 12 months of few-shot data, and 11.3% improvement with 24 months of few- shot data. Similar improvements can be observed for streamflow prediction where TAM-RL outperforms our primary baseline, Multi-Model MAML (M M AM L), by a substantial margin. It achieves an 8.21% improvement with two years of data and a 7.8% improvement with five years of data. Additionally, TAM-RL is 10 times faster in terms of training time. This is because MMAML has NxA backpropagation operations to the forward model (An adaptation for each task individually) per batch. In comparison, T AM -RL performs only one backprop- agation operation, significantly reducing training time while being easy to optimize because it has two less crucial hyperparameters than MMAML. 6.2 Experiment: Synthetic Dataset with Mul- tiple Modes (sinusoidal, tanh, linear, quadratic, l1 norm) We further evaluate T AM -RL using a syn- thetic dataset to understand in what situation T AM - RL outperforms M M AM L and vice-versa. We create three sets of multimodal task distribution with varying Architecture MAML MMAML T AM -RL (ours) SET 1 {Sin, Linear, Quadratic} SET 2 {Linear, Tanh,l1 norm} SET 3 {Quadratic, Tanh, l1 norm} 3.684 (0.176) 0.601 (0.074) 0.494 (0.040) 3.446 (0.115) 1.085 (0.121) 1.049 (0.69) 1.454 (0.040) 0.757 (0.05) 0.805 (0.023) Table 2: Mean square error (MSE) on the multimodal 5-shot regression with different combinations of 3 modes for different architectures across different sets. Gaussian noise is applied to each function with μ = 0 and σ = 0.3. Values in brackets represent the standard deviation across tasks in the set five meta-train examples for these new tasks. As the evaluation criterion, we report the mean squared error (MSE) of five meta-validation examples of these new tasks. Fig 5 show the tSNE plots [27] of the task embed- dings produced by T AM -RL and M M AM L, respec- tively, from randomly sampled tasks for each set. From the tSNE plot, we observe that as we move from SET1 to SET3, the class of functions becomes more and more homogeneous. For example, a quadratic function can resemble a sinusoidal or linear function, but generally, a sinusoidal function is dissimilar from a linear func- tion. SET3 is homogenous because quadratic, l1, and hyperbolic tangent functions are very similar, particu- larly with Gaussian noise in the output space. Further, we can observe from the tSNE plots that T AM -RL and M M AM L task embeddings generate similar tSNE plots and clusters. The quantitative results for all three sets are shown in Table 2. For each architecture, we report the mean MSE for the set. We can observe that SET1 has a reasonably heterogeneous split, as shown in Fig 5. For SET1, the performance of T AM -RL is 21.6% bet- ter than M M AM L . As the set becomes more ho- mogenous, like in SET2, the performance gap between T AM -RL and M M AM L narrows and, in this sce- nario, T AM -RL only holds a slight edge of 3.5% over M M AM L, and they operate at a similar performance level. When the dataset reaches complete homogene- ity, as in SET3, T AM -RL achieves similar performance to M M AM LAdapt. From Table 2, we can also ob- serve that MAML has the highest error in all settings and that incorporating task identity through task em- beddings matters significantly in multimodal task dis- tributions. This shows that T AM -RL outperforms M M AM L as the set becomes more heterogeneous. MMAML's task encoder is not able to capture the het- erogenous task structure and thus provides suboptimal results. The design choice of T AM -RL, which leverages meta-initializations directly without needing an adapta- tion phase, proves highly effective when tasks have dis- tinct characteristics, allowing the modulation network to learn meaningful representations for generating su- perior meta-initializations. Figure 5: tSNE plots of the task embeddings produced by M M AM L (top row) and T AM -RL (bottom row) for the three sets of multimodal tasks (shown in columns). levels of mode similarity. Each set consists of three dif- ferent families of functions (modes), as shown below: • SET1: {Sine, Linear, Quadratic} • SET2: {Linear, T anh, l1norm} • SET3: {Quadratic, T anh, l1norm} SET1 has the most distinct tasks (hence, it would be possible to learn distinct representations for each task), and SET3 has the least separable tasks (making it harder to learn distinct representations for each task). We select 375,000 tasks for each family of functions (task modes), and each task has five meta-train and five meta-validation examples for training. For batching, we sample them uniformly by selecting 25 tasks from each task mode in a batch, leading to a total of 3*25=75 tasks for each batch and a total of 15000 batches for each set. To evaluate each set, we sample 12,500 new tasks for each family of functions (task mode), which equals 37,500 new tasks for the whole set. We train a M AM L, M M AM L, and T AM -RL for each of the above three sets of multimodal distributions. Following [28], we use an MLP-based base network for all three models M AM L, M M AM L, T AM -RL. For M M AM L and T AM -RL, Bidirectional LSTM is used as the task encoder. Please refer to the appendix for details of the architecture. We use ADAM as the meta- optimizer and use the same hyperparameter settings as the regression experiments in [28]. We evaluate all models with five gradient steps during adaptation using 7 Conclusion This paper presented TAM-RL a novel task-aware mod- ulation framework using representation learning learn- ing, for use in a few shot setting. We performed ex- tensive experiments on two real-world environmental datasets, a GPP predictions task for flux towers and hydrological benchmark dataset CARAVAN GB, show- ing that this framework T AM -RL outperforms baseline models for less-observed entities. We further showed that T AM -RL outperforms MMAML when multimodal task distribution is more heterogeneous. To summa- rize, T AM -RL's approach of doing a forward pass in- stead of an adaptation phase in training shows non- trivial improvements in multiple aspects and has the potential to impact many personalized prediction ap- plications. Our proposed method is general and can add value in other applications where global models are to be learned in a setting with a diverse set of enti- ties, where only a few shots of information are avail- able for a new entity. As presented, our framework can- not handle missing driver or response data observations. However, this methodology can be further extended to handle missing observations. KGSSL [7] showed that incorporating Knowledge-guided Self-Supervised Learn- ing into their task encoder improved their prediction performance as now the task embeddings had semantic meaning. One potential research direction is incorpo- rating similar knowledge guidance into our methodol- ogy. The code used in this paper is available at Google Drive 1. References [1] Milad Abdollahzadeh et al. Revisit multimodal meta-learning through the lens of multi-task learning. NeurIPS, 2021. [2] Sebastian Pineda Arango et al. Multimodal meta- In International learning for time series regression. Workshop on Advanced Analytics and Learning on Temporal Data, 2021. [3] Keith Beven. Deep learning, hydrological processes and the uniqueness of place. Hydrological Processes, 2020. [8] Alex Graves et al. Framewise phoneme classification with bidirectional lstm networks. In IJCNN, 2005. [9] Hans Hersbach et al. The era5 global reanalysis. Quarterly Journal of the Royal Meteorological Society, 146(730):1999–2049, 2020. [10] Timothy Hospedales et al. Meta-learning in neural networks: A survey. TPAMI, 2021. [11] Xiaowei Jia et al. Physics guided rnns for modeling dynamical systems: A case study in simulating lake temperature profiles. SDM, 2019. [12] Donggyun Kim et al. Multi-task neural processes. arXiv:2110.14953, 2021. [13] Young-Min Kim et al. Predictive modeling for ma- chining power based on multi-source transfer learning in metal cutting. IJPEM - Green Tech, 2022. [14] Diederik P Kingma et al. Adam: A method for stochastic optimization. ICLR, 2015. [15] Frederik Kratzert et al. Toward improved predictions in ungauged basins: Exploiting the power of machine learning. Water Resources Research, 2019. [16] Frederik Kratzert et al. Towards learning universal, regional, and local hydrological behaviors via machine learning applied to large-sample datasets. HESS, 2019. [17] Xiang Li et al. Regionalization in a global hydrologic deep learning model: From physical descriptors to random vectors. Water Resources Research, 2022. [18] Shangrong Lin et al. Improved global estimations of gross primary productivity of natural vegetation types by incorporating plant functional type. Int. J. Appl. Earth Obs. Geoinf., 2021. [19] Yash-yee Logan et al. Patient aware active learning for fine-grained oct classification. ICIP, 2022. [20] R. Myneni et al. Mod15a2h modis/terra leaf area index/fpar 4-day l4 global 500m sin grid v006 [data set]. NASA EOSDIS Land Processes Distributed Active Archive Center, 23:2023–09, 2015. [21] Juan Nathaniel et al. Metaflux: Meta-learning global carbon fluxes from sparse spatiotemporal observations. Scientific Data, 2023. [22] Boris Oreshkin et al. Tadam: Task dependent adaptive metric for improved few-shot learning. NeurIPS, 2018. [23] Gilberto Pastorello et al. The fluxnet2015 dataset and the oneflux processing pipeline for eddy covariance data. Scientific data, 2020. [24] Ethan Perez et al. Film: Visual reasoning with a general conditioning layer. In AAAI, 2018. [25] Jake Snell et al. Prototypical networks for few-shot [4] Rich Caruana. Multitask learning. Machine learning, learning. NeurIPS, 30, 2017. 1997. [5] Chelsea Finn et al. Model-agnostic meta-learning for fast adaptation of deep networks. In ICML, 2017. [6] Marta Garnelo et al. Neural processes. arXiv, 2018. [7] Rahul Ghosh et al. Robust inverse framework using knowledge-guided self-supervised learning: An appli- cation to hydrology. KDD '22, 2022. 1https://drive.google.com/drive/folders/1Z_ Uuq6qEzCkaiPYAtPapgEiIZzZZnXxy [26] Sara Taylor et al. Personalized multitask learning for predicting tomorrow's mood, stress, and health. IEEE Transactions on Affective Computing, 2017. [27] Laurens Van der Maaten et al. Visualizing data using t-sne. JMLR, 2008. [28] Risto Vuorio et al. Multimodal model-agnostic meta- learning via task-aware modulation. NeurIPS, 2019. [29] Haoxiang Wang et al. Bridging multi-task learning and meta-learning: Towards efficient training and effective adaptation. In ICML, 2021. [30] Ruohan Wang et al. Structured prediction for condi- tional meta-learning. NeurIPS, 2020. [31] Wei Wang et al. A survey of zero-shot learning: Set- tings, methods, and applications. ACM Transactions on Intelligent Systems and Technology (TIST), 2019. [32] Jared Willard et al. Integrating scientific knowledge with machine learning for engineering and environmen- tal systems. ACM Computing Surveys, 2022. Appendix 7.1 Dataset Details 7.1.1 Fluxtower Dataset The FLUXNET2015 [23] dataset is a global network of eddy-covariance stations that record carbon, water, and energy exchanges be- tween the atmosphere and the biosphere. It offers valu- able ecosystem-scale observations across various climate and ecosystem types. In this dataset, our goal is to es- timate Gross Primary Productivity (GPP) on a daily timescale for FLUXNET2015 sites. We achieve this by using a combination of meteorological and remote sens- ing inputs, including precipitation, 2-meter air tempera- ture (Ta), vapor pressure deficit (VPD), incoming short- wave radiation from ERA5 reanalysis data [9], and Leaf Area Index (LAI) data from MODIS [20]. We extract the time series data closest to each tower site, following a similar approach to [21]. Out of the 206 flux towers in the FLUXNET2015 dataset, we selected 150 towers with data spanning more than three years. We considered the most recent three years of data for each selected flux tower for analysis. These towers were divided into training and test sets, following guidelines outlined in [21]. This process involved selecting half of the towers from tropical and semi-arid regions, which are typically sparse, and one tower from each plant functional type (PFT), including those within cropland and boreal areas, for testing (15 sites). The remaining towers constituted the training set (145 sites). Additionally, we further divided the test site data into two blocks: a two-year block representing different scenarios of "few-shot" data availability for testing purposes and one one-year block held out set for testing. To evaluate our machine learning models on the held-out test year on test sites, we utilized limited years of data (ranging from one month to 24 months) for model adaptation from the "few-shot" data, as illustrated in Figure 2. a 7.1.2 CARAVAN-GB CARAVAN is recent global benchmark dataset comprising 6,830 basins from various open datasets worldwide, including regions such as the US, UK, GB, Australia, Brazil, and Chile. This dataset provides meteorological forcing data (e.g., temperature), precipitation, potential streamflow observations, and basin characteristics. For our study, we focused on a subset consisting of 408 basins from the UK within CARAVAN, referred to In as CARAVAN-GB in our subsequent discussions. this dataset, In this dataset, our goal was to estimate streamflow on a daily timescale for CARAVAN GB 3 shows the meteorological forcing Basisn. Table evaporation, data used in our real-world hydrology experiment with CaravanGB. Our study analyzed data spanning from October 1st, 1989, to September 30th, 2009. The model training phase employed data from 1989 to 1999, while the testing phase encompassed the years 1999 to 2009. The training period from 1989 to 1999 was further divided into training years (1989-1997) and validation years (1997-1999). Out of the 408 available Basins in CARAVAN-GB, we selected 255 basins for our experiment based on the absence of missing streamflow observations between 1989 and 1999. The experimental setting, depicted in Fig 2, involved dividing the basins into train and test sets. The ML models were trained on train basins during train years. The selection of train and test basins was based on mean streamflow, with a 4:1 ratio resulting in 204 basins for training and 51 basins for testing (test sites). We employed a k-fold approach (k=5) to evaluate all models' performance across all basins. For model performance evaluation, the test set employed limited years of data (one year, two years, five years) from the training period, as depicted in Fig 2, for fine-tuning and inferring charac- teristics as needed within the model. We evaluate on out-of-sample testing blocks as shown in experimental setting Fig 2. Unit Meteorological forcing data mm/day Daily Precipitation sum(total precipitation sum) mm/day Daily Potential evaporation sum(potential evaporation sum) ◦C Mean Air temperature (temperature 2m mean) ◦C Mean Dew point temperature (dewpoint temperature 2m mean) W m−2 Mean Shortwave radiation (surface net solar radiation mean) Mean Net thermal radiation at the surface (surface net thermal radiation mean) W m−2 Mean Surface pressure (surface pressure mean) Mean Eastward wind component (u component of wind 10m mean) Mean Northward wind component (v component of wind 10m mean) kP a ms−1 ms−1 Table 3: A table of meteorological forcing data used in this experiment. 7.2 Hyperparameter Tuning Hyperparameter Dimension of Encoder Dimension of hidden state for Forward Model Batch size Learning rate Value 16, 32, 64 128, 256, 350, 500 32, 64, 128 0.005, 0.001, 0.0005, 0.01 Table 4: Range of parameter values tried for hyperparame- ter tuning, with the final selected value shown in bold. 7.2.1 Experiment: Flux Tower Dataset To find the best hyperparameters, we performed a grid search across a range of parameter values. The possible values considered are listed in Table 5. We trained our model, T AM -RL, using data from training sites. including batch size and The final hyperparameters, learning rates, are determined after performing a k-fold cross-validation (k=5) on the training set. Finally, we evaluated the model's performance on the testing sites during the hold out test period, as shown in Figure 2. connected neural network-based base network. Hyperparameter Latent dimension of Encoder Dimension of hidden state for Forward Model Batch size Learning rate Value 16, 32, 64 64, 128, 256 32, 64, 128 0.005, 0.001, 0.0005, 0.01 Table 5: Range of parameter values tried for hyperparame- ter tuning, with the final selected value shown in bold. 7.2.2 Experiment: CARAVAN GB To find the best hyperparameters, we performed a grid search across a range of parameter values. The possible values considered are listed in Table 5. We trained our model, T AM -RL, using data from the training basins during the training period. The final hyperparameter configuration was chosen based on the set with the lowest average RMSE in the validation period for the training basins. Finally, we evaluated the model's performance on the testing basins during the test period, as shown in Figure 2. 7.2.3 Experiment: Synthetic Dataset We use the same hyperparameter settings as the regression experiments presented in [28] and used Adam [14] as the meta-optimizer. 7.3 Network Architectures 7.3.1 Base Network For the Flux Tower Dataset, we use an LSTM as the base network with hidden dimension of 350; for the Caravan-GB dataset, we use an LSTM as the base network with a hidden dimension of 128. For the synthetic dataset, Like in the case of [28], we use a 4-layer fully connected neural network with a hidden dimension of 100 and ReLU non-linearity for each layer as a base network. 7.4 Task Encoder We use a BiLSTM as the base network for all three datasets, where Flux towers BiL- STM uses 64 hidden dimensions, Caravan-GB uses a BiLSTM of 32 hidden dimensions and the synthetic dataset uses BiLSTM of hidden dimension 40. 7.5 Modulation For few-shot learning, it is essen- tial to modulate the base network in a way that is parameter-efficient. Unconstrained modulation, while being flexible, can also be slow and prone to overfit- ting. Instead, we propose using Film modulation [24] of the LSTM gate outputs for LSTM-based base networks, and which requires only a small number of task-specific parameters for both real-world problems. We similarly also perform Film modulation at each layer for the fully 7.6 Parameter Generator All models have an MLP layer as a parameter generator. Since the task network of Flux tower dataset is an LSTM. LSTM has four gates, so according to our modulation strategy, we employ four linear fully-connected layers to convert the task embedding vector z to a vector of hidden dimension 700 ie 4*(64,700), as the hidden dimension of the LSTM base network was 350 and for film modulation we need twice of hidden dimension as in our implementation we use half the dimension of the vector as two components for FILM modulation. Similarly, the Hydrology dataset also uses an LSTM as a base network. So we use four lin- ear fully connected layers of dim (32,256). The synthetic dataset has four convolutional layers with channel sizes 32, 64, 128, and 256 so to modulate them we create four linear layers with output dimensions of 64,128,256,512 respectively. 7.7 Ablation: CARAVAN GB The T AM -RL architecture consists of three major components: a BiLSTM-based task encoder, an LSTM decoder-based forward model, and an adaptation method. The task encoder is responsible for learning the task-specific features of the input data. The forward model generates the output sequence given the input sequence and task- specific features. The adaptation method, along with the task embeddings from the task encoder, adapts the forward model to the specific task during inference. There are several possible ablations of the T AM -RL architecture. One ablation would be to remove the task encoder and adaptation method resulting in a simple LSTM-based global model. Another ablation would be to add an LSTM encoder to the previous ablation without the adaptation step resulting in a model with two LSTM layers, one for the task encoder and one for the forward model. A third ablation would be to switch the task encoder from LSTM to BiLSTM (this is the same as T AM -RL in Table 1). The next three possible ablations would be adding adaptation steps to the above-described models. All six possible ablations are shown in Table 6. There are several key observations to be made. Firstly, models equipped with an encoder consistently exhibit superior performance compared to those lacking an encoder block. Secondly, among the encoder block options, Bi-LSTM outperforms LSTM, thus proving to be a more effective choice. Lastly, a crucial observation is that adaptation consistently contributes to improved results. 7.8 Pseudocode only two years of data. From the plot, we observe that all models' prediction improves in general. However, T AM -RL gives a prediction closer to the ground truth. 7.10 Reproducibility CARAVAN dataset is freely available at zenodo at 2. The code used in this paper is available at Google Drive 3. Ablation No Encoder No Adapt LSTM Encoder no Adapt BiLSTM Encoder no Adapt No Encoder with Adapt LSTM Encoder with Adapt BiLSTM Encoder with Adapt Method in Table1 LSTM Not in Table 1 T AM -RL LSTMAdapt Not in Table 1 T AM -RLAdapt 0 Years 0.18 N/A N/A 0.18 N/A N/A 2 Years 0.18 0.55 0.57 0.32 0.59 0.63 5 Years 0.18 0.55 0.57 0.41 0.62 0.63 Table 6: Ablation study for the Caravan-GB out of sample testing. Numbers in the table show NSE values(Higher is better). 7.8.1 Training Algorithm Algorithm 1 shows the training procedure followed in TAM-RL. Algorithm 1 T AM -RL Training Algorithm Require: W T rT = [W supportT , W queryT ] generated from DT rain, α: step size hyper-parameter; We abbreviate support as s and query as q 1: Randomly Initialize the pipeline with weights θ, φtau and φh Sample batches of entities W T rT for all k do k 2: for epoch = 1 to N do while not Done do 3: 4: 5: 6: 7: 8: Infer z = E(W sT Infer τ = G(z; φτ ) Update k ; φh) θ, φtau k ; θ, τ ); W qT k ) (F(xqt α∇θ,ωL T rT W k end for end while 9: 10: 11: end for ∼ W T rainT and φh with Inference Algorithm Algorithm 2 shows the 7.8.2 inference procedure followed in TAM-RL. i j , xqueryt j Algorithm 2 T AM -RL Inference Algorithm Require: W supportT generated from DF ew , β: step size hyper-parameter, num inner steps: no. of gradient steps for the inner loop; We abbreviate support as s and query as q Ensure: Output yqt j 1: load θ, φtau and φh from trained model 2: Infer z = E(W sT ; φh) 3: Infer τ = G(z; φtau) 4: for epoch = 1 to num inner steps do 5: for input driver xqt j of an entity j Update θ with β∇θLW j ; θ, τ ); W sT (F(xst ) j j sT j 6: end for 7: return yqt j = (F(xqt j ; θ, τ ) 7.9 Streamflow Prediction Plot Figure 6a shows the prediction from the models without adaptation. We can observe that the T AM -RL predictions match the observed streamflow better than M M AM L. Figure 6b shows the prediction from the models on adapting with 2https://doi.org/10.5281/zenodo.7540792 3https://drive.google.com/drive/folders/1Z_ Uuq6qEzCkaiPYAtPapgEiIZzZZnXxy (a) (b) Figure 6: Observed Streamflow and predicting streamflow by different model architectures a) Models w/o adaptations b)Models with adaptations (Best seen in color)
http://arxiv.org/abs/2310.04724v1
"2023-10-07T07:53:12"
"2023-10-07T07:53:12"
Activate and Reject: Towards Safe Domain Generalization under Category Shift
Albeit the notable performance on in-domain test points, it is non-trivial for deep neural networks to attain satisfactory accuracy when deploying in the open world, where novel domains and object classes often occur. In this paper, we study a practical problem of Domain Generalization under Category Shift (DGCS), which aims to simultaneously detect unknown-class samples and classify known-class samples in the target domains. Compared to prior DG works, we face two new challenges: 1) how to learn the concept of ``unknown'' during training with only source known-class samples, and 2) how to adapt the source-trained model to unseen environments for safe model deployment. To this end, we propose a novel Activate and Reject (ART) framework to reshape the model's decision boundary to accommodate unknown classes and conduct post hoc modification to further discriminate known and unknown classes using unlabeled test data. Specifically, during training, we promote the response to the unknown by optimizing the unknown probability and then smoothing the overall output to mitigate the overconfidence issue. At test time, we introduce a step-wise online adaptation method that predicts the label by virtue of the cross-domain nearest neighbor and class prototype information without updating the network's parameters or using threshold-based mechanisms. Experiments reveal that ART consistently improves the generalization capability of deep networks on different vision tasks. For image classification, ART improves the H-score by 6.1% on average compared to the previous best method. For object detection and semantic segmentation, we establish new benchmarks and achieve competitive performance.
[ "Chaoqi Chen", "Luyao Tang", "Leitian Tao", "Hong-Yu Zhou", "Yue Huang", "Xiaoguang Han", "Yizhou Yu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04724v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04724v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.LG" ]
Activate and Reject: Towards Safe Domain Generalization under Category Shift Chaoqi Chen1*, Luyao Tang2*, Leitian Tao3, Hong-Yu Zhou1, Yue Huang2, Xiaoguang Han4†, Yizhou Yu1† 1 The University of Hong Kong 2 Xiamen University 3 University of Wisconsin - Madison 4 The Chinese University of Hong Kong (Shenzhen) cqchen1994@gmail.com, lytang@stu.xmu.edu.cn, taoleitian@gmail.com, whuzhouhongyu@gmail.com yhuang2010@xmu.edu.cn, hanxiaoguang@cuhk.edu.cn, yizhouy@acm.org 3 2 0 2 t c O 7 ] V C . s c [ 1 v 4 2 7 4 0 . 0 1 3 2 : v i X r a Abstract Albeit the notable performance on in-domain test points, it is non-trivial for deep neural networks to attain satis- factory accuracy when deploying in the open world, where novel domains and object classes often occur. In this pa- per, we study a practical problem of Domain Generaliza- tion under Category Shift (DGCS), which aims to simulta- neously detect unknown-class samples and classify known- class samples in the target domains. Compared to prior DG works, we face two new challenges: 1) how to learn the con- cept of "unknown" during training with only source known- class samples, and 2) how to adapt the source-trained model to unseen environments for safe model deployment. To this end, we propose a novel Activate and Reject (ART) framework to reshape the model's decision boundary to ac- commodate unknown classes and conduct post hoc modifi- cation to further discriminate known and unknown classes using unlabeled test data. Specifically, during training, we promote the response to the unknown by optimizing the un- known probability and then smoothing the overall output to mitigate the overconfidence issue. At test time, we in- troduce a step-wise online adaptation method that predicts the label by virtue of the cross-domain nearest neighbor and class prototype information without updating the net- work's parameters or using threshold-based mechanisms. Experiments reveal that ART consistently improves the gen- eralization capability of deep networks on different vision tasks. For image classification, ART improves the H-score by 6.1% on average compared to the previous best method. For object detection and semantic segmentation, we estab- lish new benchmarks and achieve competitive performance. 1. Introduction Deep neural networks have achieved unprecedented suc- cess in a myriad of vision tasks over the past decade. De- spite the promise, a well-trained model deployed in the open *First two authors contributed equally. †Corresponding authors. Figure 1. DGCS in image classification and object detection tasks. and ever-changing world often struggles to deal with the domain shifts-the training and testing data do not follow the independent and identically distributed (i.i.d) assump- tion, and therefore deteriorates its safety and reliability in many safety-critical applications, such as autonomous driv- ing and computer-aided disease diagnosis. This gives rise to the importance of Domain Generalization (DG) [102, 84], a.k.a. out-of-distribution (OOD) generalization, which aims at generalizing predictive models trained on multiple (or a single) source domains to unseen target distributions. In order to unearth domain-agnostic knowledge and al- leviate domain-specific components, a plethora of DG al- gorithms have been proposed, spanning invariant risk min- imization [2, 1], augmentation [82, 88, 106, 9], feature dis- entanglement [63, 49, 94], meta-learning [43, 44, 21], to name a few. Among them, a common assumption is that the label spaces of source and target domains are identi- cal, which may not always hold in practice. Suppose that we wished to deploy modern vision systems to recognize objects in an autonomous vehicle. When only the environ- ment (e.g., weather and illumination) and appearance (e.g., size and viewpoint) of previously seen objects can change, principled approaches are capable of correcting for the po- KnownUnknownSource Domain (Train)Target Domain (Test)Known tential shifts on the fly. But what if the sudden arrival of new objects in an ever-changing world? Most existing DG methods will break and may even result in catastrophe, rais- ing strong concerns about model reliability. Although sev- eral prior arts [71, 107] have explored the open DG sce- narios, the "adaptivity gap" [22] between training and test distributions still hinders safe deployment of source-learned models [30]. To this premise, we challenge the status quo by raising an open question: can deep models learn what they don't know during training and subsequently adapt to novel envi- ronments at test-time for safe model deployment? Thus, we consider a more realistic scenario namely Domain General- ization under Category Shift (DGCS) (see Fig. 1), wherein the source-trained model is expected to simultaneously de- tect unknown-class samples and categorize known-class samples under the presence of domain shifts. The core chal- lenges are: (i) no unknown-class data is available in train- ing and (ii) the mixture of domain and label shifts during test time. In this paper, we present a simple yet effective framework-Activate and RejecT (dubbed ART), which re- shapes the model's decision boundary to accommodate un- known classes and adjusts the final prediction to reconcile the intrinsic tension between domain and label shifts. ART encapsulates two key components: (i) Unknown-aware Gra- dient Diffusion (UGD) to make the classifier give response to unknown dimension and smooth the decision boundary to mitigate overconfidence; (ii) Test-time Unknown Rejec- tion (TUR) to conduct post hoc modification to the learned classifier's final predictions, making the decision bound- aries of different classes closer to the well-behaved case. Specifically, the logit of unknown class is activated by minimizing the negative log-likelihood regarding unknown probability. However, we find that the learned probability will be suppressed due to the overconfidence w.r.t. known classes. Thus, we introduce a smoothed cross-entropy loss to promote the response to the unknown by adding the penalty on the L2 norm of the logits and using a temperature scaling parameter, where the former mitigates the excessive increase of the logit norm while the latter magnifies the ef- fect of logit penalty. Due to the unavailability of real target data in training, the source-trained decision boundaries be- tween known and unknown classes may still be ambiguous. Therefore, TUR refines the source-trained classifier using unlabeled test data in an online adaptation manner. To be specific, TUR first determines if the input belongs to known classes or not via a cross-domain nearest neighbor search, based on prototype information and cyclic consistent con- straint; otherwise, the prediction will be made by a paral- lel module that measures the input's similarity with a set of dynamically-updated target prototypes. TUR is training- free (no backward passes) and does not rely on threshold- based criteria nor impose any distributional assumptions. Our key contributions are summarized as follows: • We study a challenging DG problem (DGCS) and pro- pose a principled framework (ART) to jointly consider domain shift, label shift, and adaptivity gap. • We propose an unknown-aware training objective to activate the unknown's logit and alleviate the overcon- fidence issue, and an online adaptation strategy to per- form post hoc modification to the learned classifier's prediction at test-time without additional tuning. • Extensive experiments show that ART achieves supe- rior performance on a wide range of tasks including image classification, object detection, and semantic segmentation. In particular, on four image classifica- tion benchmarks (PACS, Office-Home, Office-31, and Digits), ART improves the H-score by 6.1% on average compared to the previous best method. 2. Related Works Domain Generalization (DG). The objective of DG is to learn representations that are independent of domain- specific factors and thus can extrapolate well to unseen test distributions. This is typically achieved by invariant learn- ing and robust learning. Current approaches can be broadly categorized into feature matching [45, 54, 108, 12], de- composition [66, 63, 17, 53, 72, 49, 94, 101], augmenta- tion [81, 103, 104, 88, 56, 106, 87, 97, 13, 6], and meta- learning-based [43, 46, 44, 21, 15] approaches. To adapt to complex real-world applications, very recently, several works [71, 107, 92] consider the existence of both known and unknown classes in new DG settings, such as open DG [71] open-set DG (OSDG) [107]. Shu et al. [71] assume that both source and target domains have differ- ent label spaces and introduce novel augmentation strate- gies to augment domains on both feature- and label-level. Zhu et al. [107] generate auxiliary samples via an adversar- ial data augmentation strategy [82] and enhance unknown class identification with multi-binary classifiers. Yang et al. [92] introduce an additional CE loss based on the as- sumption that any non-ground-truth category can be viewed as unknown categories. However, these works rely on ad- ditional training modules and heuristic thresholding mech- anism [107] or impose a strong distributional assumption of the feature space regarding known and unknown data [92]. In addition, Dubey et al. [22] reveal that there will always be an "adaptivity gap" when applying the source-learn model to target domains without further adaptation. How to endow the source model with the capability of identifying unseen open classes and safely adapting the learned classifier to un- labeled test samples is yet to be thoroughly studied. Domain Adaptation (DA). DA [59, 52, 25, 10, 8] aims to improve the performance of the learned model on the tar- get domain using labeled source data and unlabeled target (a) (b) (c) (d) Figure 2. Toy example illustrating the decision boundaries learned by different methods. We generate isotropic Gaussian blobs with 4 classes. Red, green, and blue points indicate the known-class samples. Black points denote unknown-class samples, which are unavailable during training. (a) Train with standard CE loss, i.e., vanilla (|Cs|+1)-way classifier in DGCS. (b) Train with our unknown activation loss LUA. (c) Train with full UGD loss LUGD. (d) The result of ART (UGD + TUR). This figure is best seen in color. In addition to the close-set setting, many new and data. practical DA paradigms have been proposed, such as par- tial [95, 5], open-set [60, 69, 38, 4, 7, 50], universal [93, 68], and source-free [86, 90, 20, 98, 91]. In particular, open-set DA (OSDA) and source-free DA (SFDA) are closely related to the problem explored in this paper. Test-Time Adaptation (TTA). For DG, due to the inac- cessibility of target data during training, it is natural to solve the adaptivity gap [22] with TTA strategies. Adaptive meth- ods [47, 76, 83, 35, 61, 11, 96, 14] have been proposed to refine the matching process between target test data and source-trained models in an online manner, i.e., all test data can be accessed only once. Tent [83] proposes to reduce the entropy of model's predictions on test data via entropy minimization. T3A [35] introduces a training-free approach by classifying each test sample based on its distance to a dynamically-updated support set. Despite the promising re- sults on closed-set classes, these approaches fail to deal with open-set samples and thus lead to semantic mismatching. Out-of-Distribution Detection (OD). A separate line of work studies the problem of OD [89, 77], which aims to identify novel examples that the network has not been ex- posed to at the training phase. Mainstream OD meth- ods are devoted to design OOD scoring functions, e.g., confidence-based approaches [3, 31, 32], distance-based score [41, 70, 75], and energy-based score [51, 73]. The main difference between OD and our problem is that the former is a binary classification problem and does not ac- count for the domain and label shifts between training and test data at the same time. Discussion. We provide a comparison of the problem set- tings among different methods in Tab. 1. OSDA and SFDA optimize offline with target data and specific learning ob- Table 1. Comparison of different problem settings. (Xs, Ys) and Xt are the labeled source and unlabeled target data respectively. Fine-tune means to update the model's parameters. Adjustment means making post-hoc modifications to the model's predictions. Problem Setting Training Test-time Data Domain Shift Open Class Fine-tune Adjustment OD [31, 74] OSDA [69, 4] SFDA [93, 98] TTA [76, 83, 96] OSDG [107, 92] Ours Xs, Ys Xs, Ys, Xt Xs, Ys, Xt Xs, Ys Xs, Ys Xs, Ys × ✓ ✓ ✓ ✓ ✓ ✓ ✓ × × ✓ ✓ × × ✓ ✓ × × × × × ✓ × ✓ jectives, while ART only adjusts the classifier in an online manner. TTA usually needs to update the trained model's parameters (e.g. entropy minimization [83, 96]) and a batch of data, while our TUR is fully training-free and can be per- formed on single test samples. These promising properties make the proposed approach more suitable for DG. Com- pared to OSDG, our setting allows training-free test-time adjustment for adapting source-trained models to novel en- vironments, largely mitigating the potential adaptivity gap. 3. Methodology 3.1. Preliminary and Motivation t s, yi t , yj Notation. In DGCS, we have a single source domain s)}ns Ds = {(xi i=1 of ns labeled samples and multiple (or t , ..., DM a single) unseen target domains Dt = {D1 t }, where t )}nm t = {(xj M ≥ 1 and Dm j=1. Ds and Dt are sampled from probability distributions ps(x, y) and pt(x, y) respec- tively. DGCS jointly considers two distribution shifts: (i) class-conditional shift where ps(y|x) ̸= pt(y|x), and (ii) label shift where ps(y) ̸= pt(y). Specifically, assume that Cs and Ct are the source and target class sets, respectively. DGCS dictates Cs ⊂ Ct and Cu t = Ct \ Cs is called un- known classes. Note we take all unknown classes as a whole even though there can be multiple classes. The objective of Figure 3. The softmax outputs of different training methods regarding two input images on the PACS [42] benchmark. Source Domain: Cartoon, Target Domain: Art. Known: dog from Domain Cartoon, Unknown: horse from Domain Art. DGCS is to train a model on Ds to classify all target in- stances from Dt into |Cs| + 1 classes. Motivation. Before formally introducing technical de- tails, we discuss the motivation of our method using toy data. Since the decision boundaries are learned by known classes only, the unknown target samples tend to lie out of the support of source training data (i.e., low-density regions [27]) and are ambiguous for the decision bound- aries. On the other hand, as shown in Fig. 3(a), deep neural networks trained with the standard softmax Cross-Entropy (CE) loss tend to give overconfident predictions even when the test input differs from the training distribution [58]. Mo- tivate by this, our goal is to explicitly create a support region for unknown target samples. A native choice is the low- density regions with respect to the source-trained classifier. To empirically verify our intuitions, we use scikit- learn [62] to generate samples (3 known classes and 1 un- known class) and show the comparison in Fig. 2. From the figure, we have the following observations. (1) Simply training a (|Cs|+1)-way classifier cannot improve the dis- crimination of unknown class. (2) Forcefully increasing the softmax probability in the unknown dimension creates an additional support region. However, due to the overconfi- dence issue regarding known classes, the response to the unknown (reflected by the size of the region) is still limited. (3) To increase the response to unknown class, we penalize the prediction confidence w.r.t. known classes, i.e., making the known-class data closer to their decision boundaries. (4) Although the reshaped decision boundaries are able to accommodate unknown-class data, the boundaries between known and unknown classes are less discriminative as we do not have access to real unknown data, i.e., the unknown samples do not necessarily lie in the support of the created region since the above operations only encourage it far away from the support of known classes. Thus, we dynamically adjust the learned boundaries using unlabeled test data. Grounded on these insights, we propose a novel Activate and Reject (ART) approach. Specifically, ART encompasses two innovative components: 1) Unknown-aware Gradient Diffusion (UGD) to diffuse the gradient to the unknown's logit with smoothing regularization; 2) Test-time Unknown Rejection (TUR) to conduct post hoc modification to the learned classifier's final prediction. 3.2. Unknown-aware Gradient Diffusion As discussed in Sec. 3.1, deep classifiers trained with the standard softmax CE loss are susceptible to the notorious overconfidence issue. This problem becomes more sophis- ticated in the context of DGCS, wherein the learned deci- sion boundary is highly biased towards source known-class samples. On the other hand, given only access to known- class data during the training phase, how to optimize the |Cs|+1-way classifier is problematic (cf. Fig. 2(a)). With this premise, we propose the UGD to solve the above issues at training phase from two perspectives, i.e., unknown activation and output's smoothness. The former activates the unknown probability, while the latter mitigates the overconfidence issue. First of all, we need to train a (|Cs|+1)-way classifier, where an additional dimension is introduced to discriminate unknown classes from known ones. Given xs ∈ Ds and a neural network f (x; θ) pa- rameterized by θ, we define the standard CE loss as: LCE(f (xs), ys) = − log exp(fys(xs)) k∈|Cs|+1 exp(fk(xs)) (cid:80) , (1) where f (xs) ∈ R|Cs|+1 denotes the network's logit and fys(xs) is the ys-th element of f (xs) corresponding to the ground-truth label ys. Based on the (|Cs|+1)-way classifier, we aim to activate the unknown's logit in the absence of real unknown-class samples. The key idea is to increase the value of unknown probability without affecting the ground-truth classification. For notation shorthand, we use f k to represent the logit of k-th class and f u for the unknown's logit. Since we have no supervision over the unknown, the value of f u is negligible (cf. Fig. 3(a)). For a source sample (xs, ys) ∈ Ds, we forcefully increase the unknown probability by minimizing the negative log-likelihood, LUA = − log (cid:80) exp(f u) k∈|Cs|+1,k̸=ys exp(f k) , (2) Input Image(a) Vanilla Classifier(b) Unknown Activation(c) Full UGD Loss This objective ensures that the unknown probability can give a response to any input sample regardless of its class la- bel (cf. gray region in Fig. 2(b)). Since the learning process is always dominated by CE loss regarding the ground-truth category, Eq. (2) is tractable and will not hurt the known- class performance. However, the activated probability is relatively small (compared to the ground-truth category), which leads to an unsatisfactory accuracy for real unknown samples, especially for some hard samples (cf. Fig. 3(b)). Next, we aim to enhance the response to unknown classes by increasing the smoothness of the network's out- put (cf. Fig. 2(c)). Formally, we impose two constraints to the standard CE loss: a temperature scaling parameter τ (τ > 1) and a penalty on the L2 norm of the logits. Thus, the proposed smoothed CE (SCE) loss LSCE is defined as: LSCE = − log exp(fys(xs)/τ ) i∈|Cs|+1 exp(fi(xs)/τ ) (cid:80) where λ is set to 0.05 in all experiments. Finally, the UGD loss is formulated as: LUGD = LUA + LSCE. + λ∥f (xs)∥2, (3) (4) As shown in Fig. 3(c), the proposed LUGD not only re- duces the overconfidence issue (smaller max-probability for known sample) but also significantly increases the unknown probability. 3.3. Test-Time Unknown Rejection Although we have activated the network's logit about unknowns, there still exist two critical challenges that im- pede the safe and reliable deployment of our source-trained models on open-world data. First, a conservative (smaller max-probability) and smoothing (larger entropy) output on source data may not guarantee the category correspondence across domains and therefore may lead to semantic mis- alignment. Second, how to reject a sample as "unknown" lacks principled criterion considering that the unknown- class samples may distribute randomly in the embedding space. In this regard, previous open-set-oriented meth- ods [68, 107] that typically rely on thresholding mecha- nisms (e.g. entropy value [107]) are heuristic and will be sensitive to the variations of domain disparity. To solve the above issues, we introduce a simple and effective technique-TUR-to match unlabeled test data to the source-trained model in an online adaptation man- ner. Our key idea is to conduct post hoc modification to the learned classifier's final predictions, so as to bring the decision boundaries of different classes closer to the well-behaved case. TUR is training-free (i.e., no backward passes) and does not impose any distributional assumptions. Technically, we impose a cross-domain cycle-consistent constraint on the top of embedding space for identifying s, z2 s, ..., zns s is the L2-normalized penultimate feature zi whether a test sample corresponds to any known classes or not. The cross-domain relationships are based on K-nearest neighbor (KNN) [36] to perform non-parametric density es- timation, which is model-agnostic and easy to implement. Specifically, we decompose the source-trained model into a feature extractor g and a linear classifier f . Assume that the embedding of training data is Zs = {z1 s }, where zi s = g(xs)/∥g(xs)∥2. Here, we do not require access to the orig- inal training samples since the embedding will be extracted in advance, and no need to update. Then, we define two sets of known-class prototypes on the top of penultimate layer, s is computed from Zs i.e., {μk k=1, where μk (mean feature per class) and will be fixed at test time. μk t is empty at the beginning. For an test input xj zj t , we compute its KNN in Zs, denoted by Ns(zj feature centroid of Ns(zj the corresponding source class as, t with its normalized feature vector t ). The s. Next, we find t ) is denoted by ̄zj k=1 and {μk t }|Cs| s }|Cs| k′ = arg max k′∈{0,1,*** ,|Cs|} sim( ̄zj s, μk′ s ) (5) s, μk′ s ) = ( ̄zj ∥ ̄zj Here, we measure the cosine similarity between features as: s)T μk′ sim( ̄zj s s∥2∥μk′ s ∥2 the target class k′′ based on the similarity between ̄zj s and μk′′ . If k′ and k′′ belongs to the same category, the sample t t will be predicted as class k′′ and we further update μk′′ xj in the following manner, . In the same way, we search t μk′′ t(I) = φ zj t + (1 − φ) μk′′ t(I), (6) where μk′′ t(I) denote the k′′-th target prototype until time I and φ ∈ (0, 1) is a preset scalar and fixed to 0.3 in practice. If k′ and k′′ belong to different categories, the prediction will be given by using a follow-up strategy. Specifically, a memory bank MI = {M1 } is a set of target sample embedding until time I, which is initialized by the weight of linear classifier f . At time I, MI is updated as: I , * * * , M|Cs|+1 I Mk I = I−1 ∪ zj t (cid:40)Mk Mk I−1 if k′ ̸= k′′ and f (zj otherwise, t ) = k, (7) t }|Cs|+1 Similarly, we can build a new set of target class prototypes {ψk t will be constantly updated during test time. Then, we predict the class label ((|Cs|+1)-way) of xj based on samples from MI . Note that ψk t as follows, k=1 ˆk = arg max ˆk∈{0,1,*** ,|Cs|+1} sim( ̄zj s, ψ ˆk t ). (8) The decision boundaries between known and unknown classes are refined without backpropagation (cf. Fig. 2(d)). Regime Method OSDA (upper bound) OSBP [69] ROS [4] OD SFDA TTA OSDG MSP [31] LogitNorm [85] DICE [74] SHOT [47] AaD [91] TTT [76] Tent [83] MEMO [96] ERM [79] ADA [82] ADA+CM [107] MEADA [99] MEADA+CM [107] One Ring-S [92] ART w/o TUR Table 2. Accuracy (%) on four classification benchmarks (ResNet-18). PACS Office-Home Office-31 Digits Average acck accu hs acck accu hs acck accu hs acck accu hs acck accu hs 40.6 35.6 38.9 35.1 44.0 51.2 45.1 36.9 25.2 37.9 52.3 54.2 56.4 54.1 54.3 43.7 47.0 49.5 66.4 62.5 47.6 53.4 34.9 40.0 44.6 43.1 52.3 27.0 30.9 45.6 31.4 46.6 49.4 51.3 44.6 46.4 46.4 38.3 49.2 40.8 42.0 38.9 31.7 44.5 36.1 36.4 43.0 36.2 42.7 41.5 48.1 47.1 50.8 52.7 56.3 61.5 52.5 59.4 52.0 33.6 49.0 66.9 67.9 65.0 67.6 64.9 56.9 58.8 66.9 77.5 75.6 56.5 58.8 32.4 58.7 45.9 45.9 55.6 23.7 25.4 40.4 25.7 40.5 69.0 69.8 55.3 60.8 62.0 56.1 59.9 44.3 58.9 47.2 38.7 52.1 34.3 36.2 48.5 36.4 49.6 62.3 63.7 75.8 71.7 49.7 41.0 72.8 84.8 70.1 35.4 56.0 59.8 85.1 85.6 83.0 85.8 82.8 67.3 70.7 84.3 80.0 89.2 71.2 61.1 60.2 85.3 79.6 85.1 72.7 27.0 25.2 34.5 25.1 41.1 77.0 65.9 77.7 75.6 63.8 52.1 66.4 70.4 76.9 49.0 67.5 65.6 40.7 38.7 48.5 38.6 54.7 71.3 68.2 35.6 20.1 17.2 26.8 35.0 27.4 25.6 44.1 27.2 21.7 56.4 57.2 49.2 57.6 52.3 33.2 29.7 70.6 48.6 87.1 51.2 47.6 20.3 26.9 45.1 41.1 56.1 13.0 15.1 52.1 29.8 46.1 51.3 65.7 40.5 34.9 28.8 35.2 40.3 23.3 26.2 44.6 32.7 31.3 18.0 20.1 39.9 30.4 38.7 40.3 40.9 49.8 47.7 39.6 39.8 53.3 54.0 50.1 42.1 35.5 42.1 65.2 66.2 63.4 66.3 63.6 50.3 51.6 67.8 68.1 78.6 56.6 55.2 37.0 52.7 53.8 53.8 59.2 22.7 24.2 43.2 28.0 43.6 61.7 63.2 54.5 54.4 50.3 45.4 54.0 44.7 51.0 44.9 42.7 48.4 32.3 32.9 45.0 35.4 46.4 53.9 55.2 DGCS ART (full) 43.7 65.9 52.3 64.3 65.3 64.8 82.1 75.2 78.5 34.3 63.8 44.6 56.1 67.6 60.1 Table 3. Performance of ART on object detection benchmarks. Method Pascal VOC→Clipart Pascal VOC→Watercolor Pascal VOC→Comic WI↓ AOSE↓ mAPK↑ APU ↑ hs↑ WI↓ AOSE↓ mAPK↑ APU ↑ hs↑ WI↓ AOSE↓ mAPK↑ APU ↑ hs↑ ORE [37] OpenDet [28] ART (full) w/o LUA w/o LSCE w/o TUR 17.3 14.2 11.7 16.3 14.6 14.9 876 300 317 1363 426 444 37.7 32.7 35.8 35.4 34.7 34.5 3.0 6.7 10.2 6.0 3.2 4.9 5.6 11.1 15.9 10.3 5.9 8.6 28.4 14.9 19.7 29.4 24.8 23.3 3216 1944 944 3924 1104 1398 19.8 19.2 20.8 18.6 21.4 21.1 13.5 19.3 15.2 14.1 19.1 17.6 16.1 19.2 17.6 16.0 20.2 19.2 23.1 15.2 13.2 25.0 24.7 15.0 2242 744 596 2826 1372 784 7.3 7.5 7.2 6.4 6.3 7.3 3.0 3.1 9.1 2.2 3.5 4.6 4.3 4.4 8.0 3.3 4.5 5.6 Table 4. Performance of ART on semantic segmentation bench- mark, i.e., from GTA5 (synthetic) to Cityscapes (real). Method mAcc mIOU accu hs ERM [79] One Ring-S [92] ART (full) w/o UGD w/o TUR 64.9 55.7 57.1 64.2 54.7 48.2 41.0 43.3 46.6 42.6 27.6 72.5 73.2 41.6 78.5 39.4 61.9 63.1 50.2 62.6 4. Experiments 4.1. Generalization in Image Classification Dataset. We evaluate our ART on four standard DG bench- marks. PACS [42], which has dramatic differences in terms of image styles, contains 9,991 images of seven object classes from four domains, i.e., Photo, Art Painting, Car- toon, and Sketch. 4 classes (dog, elephant, giraffe, and guitar) are adopted as Cs and the remaining 3 classes are used as Ct u. Office-Home [80], which is collected from office and home environments, has 15,500 images of 65 classes from four domains, i.e., Artistic, Clipart, Product, and Real World. The domain shifts stem from the vari- ations of viewpoint and image style. In alphabetic order, the first 15 classes are selected as Cs and the remaining 50 classes are used as Ct u. Office-31 [67] has 31 classes col- lected from three domains: Amazon, DSLR, and Webcam. The 10 classes shared by Office-31 and Caltech-256 [26] are adopted as Cs. In alphabetical order, the last 11 classes along with Cs form Ct u. Digits, which differs in the back- ground, style, and color, contains four handwritten digit do- mains including MNIST [40], MNIST-M [25], SVHN [57], USPS [33], and SYN [25]. MNIST is used as the source do- main and the other datasets are viewed as target domains. Cs includes numbers from 0 to 4. Evaluation Protocols. Following [4, 107, 92], we adopt H-score (hs) [24] as the main evaluation metric. hs har- monizes the importance of known and unknown classes by requiring that known and unknown class accuracy should be both high and balanced. The known class accuracy (acck) and unknown class accuracy (accu) are also provided. Implementation Details. We conduct experiments based on Dassl [105], including data preparation, model training, and model selection. For PACS, Office-Home, and Office- 31, we use ResNet-18 [29] pre-trained on the ImageNet as the backbone network. We use the ConvNet [39] with archi- tecture conv-pool-conv-pool-fc-fc-softmax for Digits. The networks are trained using SGD with momentum of 0.9 for 100 epochs. The batch size is set to 16. Baselines. Given the contact points with other problem set- tings, we compare ART with five types of state-of-the-art (1) OSDG [107, 92] is the most related base- methods. line. When TUR is removed, the proposed ART becomes a standard OSDG method. (2) OSDA [69, 4] jointly uti- lizes source and target data for training and thus can be viewed as an upper bound of our problem. (3) OD [85, 74] usually identifies unknown-class samples via scoring func- (4) SFDA [47, 91] and TTA [47, 91] cannot deal tions. with unknown-class samples directly. Therefore, we fol- low [107] that uses the entropy of softmax output as the normality score. Results. The classification results on PACS and Office- Home, Office-31, and Digits benchmarks are reported in Tab. 2. ART substantially and consistently outperforms baseline methods on different benchmark datasets. For ex- ample, ART improves hs by 9.3% (PACS), 2.5% (Office- Home), 7.2% (Office-31), and 4.3% (Digits) compared to the previous best OSDG baselines. In particular, only using UGD could also substantially exceed state-of-the-art meth- ods, e.g. DICE [74] and One Ring-S [92]. The results also reveal several interesting observations. (1) The performance of [92] is unstable across different benchmarks. For exam- ple, they outperform CM [107] by +12.7% and +16.6% on Office-Home and Office-31 but show inferior performance (-1.5%) on PACS. By contrast, our method achieves more consistent improvements, indicating the efficacy and scal- ability of ART. (2) ART achieves even better performance than OSDA methods (upper bound) under much more chal- lenging settings. (3) LogitNorm [85] and Tent [83] achieve inferior performance due to the imbalance between acck and accu, showing the non-triviality of performing both unknown-aware training and test-time modification. 4.2. Generalization in Other Vision Tasks Setup. (1) Object Detection. We introduce four datasets to form three tasks, i.e., Pascal VOC [23], Clipart, Watercolor, and Comic [34] datasets. They share 6 classes, where per- son is selected as Ct u and the remaining 5 classes are viewed as Cs. The Pascal VOC2007-trainval and VOC2012-trainval datasets are combined to form the source domain, and Cli- part1k, Watercolor, and Comic as used as the target do- mains respectively. For evaluation, we introduce four met- rics: Wilderness Impact (WI) [19], Absolute Open-Set Er- ror (AOSE) [55], mean average precision of known classes (mAPK) and average precision of unknown class (APU ). (2) Semantic Segmentation. GTA5 [65] and Cityscapes [18] are used as the source and target domains respectively. GTA5 is a synthetic dataset generated from Grand Theft Auto 5 game engine, while Cityscapes is collected from the street scenarios of different cities. They share 19 classes in Table 5. Ablation of ART on four benchmarks. hs (%) is reported. - and + denote the removal or addition of a module respectively. Method ART - LUA - LSCE - UGD - TUR & LUA - TUR & LSCE UGD + TTT [76] + Tent [83] + T3A [35] + MEMO [96] + SHOT [47] + AaD [91] PACS Office-Home Office-31 Digits Avg. 52.3 39.9 43.4 45.5 44.4 41.0 48.1 48.5 37.8 49.2 49.9 46.6 50.2 64.8 62.5 60.0 57.0 61.4 58.9 63.7 60.8 45.3 62.7 61.4 50.3 62.5 78.5 69.0 71.5 66.6 65.8 63.0 68.2 72.8 64.9 72.0 75.4 71.5 74.7 44.6 20.0 41.3 32.0 7.9 40.3 40.9 41.3 33.2 41.7 41.0 33.5 41.8 60.1 47.9 54.1 50.3 44.9 50.8 55.2 55.9 45.3 56.4 56.9 50.5 57.3 all. According to the number of pixels per class, we use 10 classes as Cs and the remaining 9 classes as Cu t . We report the mean accuracy of all classes (mAcc), mean Intersection over Union (mIOU), accu and hs. Implementation Details. (1) Object Detection. We utilize Faster R-CNN [64] as the detection model and ResNet-50 with FPN [48] as the backbone network. To avoid the mu- tual influence between classification and regression heads, the original shared FC layer is replaced by two parallel FC layers. The networks are trained for 40 epochs. (2) Seman- tic Segmentation. We adopt DeepLab-v2 [16] segmenta- tion network with ResNet-101 backbone. We use SGD op- timizer with an initial learning rate of 5 × 10−4, momentum of 0.9, and weight decay of 10−4. Results. Tab. 3 shows the detection results compared to ORE [37], OpenDet [28], and several variants of ART. With respect to mAPK and APU , ART outperforms the previ- ous best method by 1.5% and 1.8% on average, revealing that ART strikes a better balance between identifications of known- and unknown-class objects. Fig. 4 provides the qualitative comparisons, where ART could precisely iden- tify unknown samples and exhibits better bounding box re- gression results. For semantic segmentation, Tab. 4 reveal that even in the dense prediction task, ART is capable of sig- nificantly improving the generalization ability of deep mod- els. The qualitative results are shown in Fig. 5, where the predictions given by ART are smoother and contain much fewer spurious areas than One Ring-S [92] and ART w/o TUR, especially on the unknown classes (rider and bike). 4.3. Discussion Ablation study. (1) In Tab. 5, we evaluate the contribu- tion of the different components of ART. It is evident that each of these components is reasonably designed, as the re- moval of any one of them leads to a commensurate reduc- tion in accuracy. Note that when LUA is removed, we will Figure 4. Qualitative comparisons between OpenDet (top) and ART (bottom). Figure 5. Visualization of segmentation results for the task GTA5 → Cityscapes. Gray regions indicate the unknown-class pixels. (a) ERM (b) One Ring-S (c) ART w/o LSCE (d) ART (e) One Ring-S vs. ART Figure 6. (a)-(d) t-SNE visualization [78] of the penultimate layer's feature on Office-31. (e) Varying the size of known classes on PACS. Table 6. The influence of the order of test data. hs is reported. ID PACS Office-Home Office-31 Digits Avg. 1 2 3 4 52.5 52.3 52.7 52.2 64.8 64.6 64.9 64.7 78.2 78.9 78.8 78.4 44.4 45.0 44.8 44.7 60.0 60.2 60.3 60.0 Figure 7. Top: w/o LSCE vs. Bottom: w/ LSCE make the prediction by following the thresholding mech- anism in [107]. To isolate the contribution of TUR, We additionally combine UGD with different TTA and SFDA methods. Notably, Tent and SHOT achieve inferior perfor- mance, and TTT and MEMO bring marginal improvements compared to the proposed TUR. (2) In fig. 7, we use Grad- CAM [100] to visualize the results trained w/ and w/o LSCE on both target known- and unknown-class samples. We can observe that LSCE makes the network focus on the entire object rather than a small or inaccurate local region, reveal- (a) Target Image(b) Ground Truth(c) One Ring-S(d) ART w/o TUR(e) ARTback_packbikecalculatorheadphoneskeyboardlaptop_computermonitormousemugpenunknown3456Size of known classes01020304050607080PercentO rs (Acc)One Ring-S (Acc)O rs (H-score)One Ring-S (H-score)Known ClassUnknown Class ing the importance of mitigating the overconfidence issue in DGCS tasks. The influence of known classes. With fixed |Cs ∪ Ct|, we investigate the influence of the number of known classes. As shown in Fig. 6, ART consistently outperforms the pre- vious best method in terms of hs especially when the size is small, indicating that ART can improve the generalization ability even with very limited known knowledge. The influence of test order. As TUR is performed online, we study the influence of the order of test data. The results in Tab. 6 reveal that TUR is insensitive to the variations of data order, showing its robustness to the open world. Feature visualization. We use t-SNE [78] to visualize the feature learned by ERM, One Ring-S, ART w/o LSCE, and ART, respectively. The results are displayed in Fig. 6, where different colors except for gray indicate different known classes. Points in gray represent all unknown classes. The features learned by ERM and One Ring-S cannot be reason- ably separated, where the boundaries between known and unknown classes are ambiguous to some extent. By con- trast, ART provides more meaningful embedding features to distinguish known and unknown samples. 5. Conclusion We investigate the problem of DGCS, which is realistic but has been largely overlooked in the literature. Specif- ically, we present a simple yet surprisingly effective ap- proach (ART) to regularize the model's decision boundary in training and adjust the source-trained classifier's predic- tion at test time, endowing the deep model with unknown- aware ability even without any access to real data in train- ing. Experiments show that ART consistently improves the generalization capability of deep networks in different tasks. We hope our work will motivate future research on open-world generalization in safety-critical applications. Acknowledgement This work was partially supported by Hong Kong Research Grants Council under Collaborative Re- search Fund (Project No. HKU C7004-22G). It was also partially supported by NSFC62172348, Outstand- ing Young Fund of Guangdong Province with No. 2023B1515020055, and Shenzhen General Project with No. JCYJ20220530143604010. References [1] Kartik Ahuja, Karthikeyan Shanmugam, Kush Varshney, and Amit Dhurandhar. Invariant risk minimization games. In ICML, pages 145–155, 2020. 1 [2] Martin Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Invariant risk minimization. arXiv preprint Lopez-Paz. arXiv:1907.02893, 2019. 1 [3] Abhijit Bendale and Terrance E Boult. Towards open set deep networks. In CVPR, pages 1563–1572, 2016. 3 [4] Silvia Bucci, Mohammad Reza Loghmani, and Tatiana Tommasi. On the effectiveness of image rotation for open set domain adaptation. In ECCV, 2020. 3, 6, 7 [5] Zhangjie Cao, Kaichao You, Mingsheng Long, Jianmin Wang, and Qiang Yang. Learning to transfer examples for partial domain adaptation. In CVPR, 2019. 3 [6] Chaoqi Chen, Jiongcheng Li, Xiaoguang Han, Xiaoqing Liu, and Yizhou Yu. Compound domain generalization via In CVPR, pages 7119–7129, meta-knowledge encoding. 2022. 2 [7] Chaoqi Chen, Jiongcheng Li, Zebiao Zheng, Yue Huang, Xinghao Ding, and Yizhou Yu. Dual bipartite graph learn- ing: A general approach for domain adaptive object detec- tion. In ICCV, pages 2703–2712, 2021. 3 [8] Chaoqi Chen, Jiongcheng Li, Hong-Yu Zhou, Xiaoguang Han, Yue Huang, Xinghao Ding, and Yizhou Yu. Relation matters: foreground-aware graph-based relational reason- IEEE TPAMI, ing for domain adaptive object detection. 45(3):3677–3694, 2022. 2 [9] Chaoqi Chen, Luyao Tang, Feng Liu, Gangming Zhao, Yue Huang, and Yizhou Yu. Mix and reason: Reasoning over semantic topology with data mixing for domain generaliza- tion. NeurIPS, 35:33302–33315, 2022. 1 [10] Chaoqi Chen, Weiping Xie, Wenbing Huang, Yu Rong, Xinghao Ding, Yue Huang, Tingyang Xu, and Junzhou Huang. Progressive feature alignment for unsupervised do- main adaptation. In CVPR, pages 627–636, 2019. 2 [11] Dian Chen, Dequan Wang, Trevor Darrell, and Sayna Ebrahimi. Contrastive test-time adaptation. In CVPR, pages 295–305, 2022. 3 [12] Liang Chen, Yong Zhang, Yibing Song, Anton van den Hengel, and Lingqiao Liu. Domain generalization via ra- tionale invariance. In ICCV, 2023. 2 [13] Liang Chen, Yong Zhang, Yibing Song, Lingqiao Liu, and Jue Wang. Self-supervised learning of adversarial example: Towards good generalizations for deepfake detection. In CVPR, pages 18710–18719, 2022. 2 [14] Liang Chen, Yong Zhang, Yibing Song, Ying Shan, and Improved test-time adaptation for domain Lingqiao Liu. generalization. In CVPR, pages 24172–24182, 2023. 3 [15] Liang Chen, Yong Zhang, Yibing Song, Jue Wang, and Lingqiao Liu. OST: Improving generalization of deepfake detection via one-shot test-time training. In NeurIPS, 2022. 2 [16] Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Deeplab: Semantic im- age segmentation with deep convolutional nets, atrous con- volution, and fully connected crfs. TPAMI, 40(4):834–848, 2017. 7 [17] Rune Christiansen, Niklas Pfister, Martin Emil Jakobsen, Nicola Gnecco, and Jonas Peters. A causal framework for distribution generalization. IEEE TPAMI, 2021. 2 [18] Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In CVPR, pages 3213–3223, 2016. 7 [19] Akshay Dhamija, Manuel Gunther, Jonathan Ventura, and Terrance Boult. The overlooked elephant of object detec- tion: Open set. In WACV, pages 1021–1030, 2020. 7 [20] Ning Ding, Yixing Xu, Yehui Tang, Chao Xu, Yunhe Wang, and Dacheng Tao. Source-free domain adaptation via dis- tribution estimation. In CVPR, 2022. 3 [21] Qi Dou, Daniel Coelho de Castro, Konstantinos Kamnit- sas, and Ben Glocker. Domain generalization via model- agnostic learning of semantic features. In NeurIPS, pages 6447–6458, 2019. 1, 2 [22] Abhimanyu Dubey, Vignesh Ramanathan, Alex Pentland, and Dhruv Mahajan. Adaptive methods for real-world do- main generalization. In CVPR, 2021. 2, 3 [23] Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. IJCV, 88(2):303–338, 2010. 7 [24] Bo Fu, Zhangjie Cao, Mingsheng Long, and Jianmin Wang. Learning to detect open classes for universal domain adap- tation. In ECCV, pages 567–583. Springer, 2020. 6 [25] Yaroslav Ganin and Victor Lempitsky. Unsupervised do- In ICML, pages main adaptation by backpropagation. 1180–1189, 2015. 2, 6 [26] Boqing Gong, Yuan Shi, Fei Sha, and Kristen Grauman. Geodesic flow kernel for unsupervised domain adaptation. In CVPR, pages 2066–2073. IEEE, 2012. 6 [27] Yves Grandvalet and Yoshua Bengio. Semi-supervised learning by entropy minimization. In NeurIPS, pages 529– 536, 2005. 4 [28] Jiaming Han, Yuqiang Ren, Jian Ding, Xingjia Pan, Ke Yan, and Gui-Song Xia. Expanding low-density latent regions for open-set object detection. In CVPR, pages 9591–9600, 2022. 6, 7 [29] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. In CVPR, Deep residual learning for image recognition. pages 770–778, 2016. 6 [30] Dan Hendrycks, Nicholas Carlini, John Schulman, and Ja- cob Steinhardt. Unsolved problems in ml safety. arXiv preprint arXiv:2109.13916, 2021. 2 [31] Dan Hendrycks and Kevin Gimpel. A baseline for detect- ing misclassified and out-of-distribution examples in neural networks. In ICLR, 2017. 3, 6 [32] Rui Huang and Yixuan Li. Towards scaling out-of- distribution detection for large semantic space. In CVPR, 2021. 3 [33] Jonathan J. Hull. A database for handwritten text recogni- tion research. TPAMI, 16(5):550–554, 1994. 6 [34] Naoto Inoue, Ryosuke Furuta, Toshihiko Yamasaki, and Kiyoharu Aizawa. Cross-domain weakly-supervised object detection through progressive domain adaptation. In CVPR, pages 5001–5009, 2018. 7 [35] Yusuke Iwasawa and Yutaka Matsuo. Test-time classifier adjustment module for model-agnostic domain generaliza- tion. NeurIPS, 34:2427–2440, 2021. 3, 7 [36] Jeff Johnson, Matthijs Douze, and Hervé Jégou. Billion- IEEE Transactions on scale similarity search with gpus. Big Data, 7(3):535–547, 2019. 5 [37] KJ Joseph, Salman Khan, Fahad Shahbaz Khan, and Vi- neeth N Balasubramanian. Towards open world object de- tection. In CVPR, pages 5830–5840, 2021. 6, 7 [38] Jogendra Nath Kundu, Naveen Venkat, Ambareesh Reva- nur, R Venkatesh Babu, et al. Towards inheritable models In CVPR, pages 12376– for open-set domain adaptation. 12385, 2020. 3 [39] Yann LeCun, Bernhard Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne Hubbard, and Lawrence D Jackel. Backpropagation applied to handwrit- ten zip code recognition. Neural computation, 1(4):541– 551, 1989. 6 [40] Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. 6 [41] Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. In NeurIPS, pages 7167– 7177, 2018. 3 [42] Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M Hospedales. Deeper, broader and artier domain general- ization. In ICCV, pages 5542–5550, 2017. 4, 6 [43] Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M Hospedales. Learning to generalize: Meta-learning for do- main generalization. In AAAI, 2018. 1, 2 [44] Da Li, Jianshu Zhang, Yongxin Yang, Cong Liu, Yi-Zhe Song, and Timothy M Hospedales. Episodic training for domain generalization. In ICCV, pages 1446–1455, 2019. 1, 2 [45] Ya Li, Xinmei Tian, Mingming Gong, Yajing Liu, Tongliang Liu, Kun Zhang, and Dacheng Tao. Deep do- main generalization via conditional invariant adversarial networks. In ECCV, pages 624–639, 2018. 2 [46] Yiying Li, Yongxin Yang, Wei Zhou, and Timothy Hospedales. Feature-critic networks for heterogeneous do- main generalization. In ICML, pages 3915–3924, 2019. 2 [47] Jian Liang, Dapeng Hu, and Jiashi Feng. Do we really need to access the source data? source hypothesis transfer for In ICML, pages 6028– unsupervised domain adaptation. 6039. PMLR, 2020. 3, 6, 7 [48] Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In CVPR, pages 2117–2125, 2017. 7 [49] Chang Liu, Xinwei Sun, Jindong Wang, Haoyue Tang, Tao Li, Tao Qin, Wei Chen, and Tie-Yan Liu. Learning causal semantic representation for out-of-distribution prediction. NeurIPS, 34, 2021. 1, 2 [50] Jie Liu, Xiaoqing Guo, and Yixuan Yuan. Unknown- oriented learning for open set domain adaptation. In ECCV, 2022. 3 [51] Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. In NeurIPS, Energy-based out-of-distribution detection. 2020. 3 [52] Mingsheng Long, Yue Cao, Jianmin Wang, and Michael Jordan. Learning transferable features with deep adaptation networks. In ICML, pages 97–105, 2015. 2 [53] Divyat Mahajan, Shruti Tople, and Amit Sharma. Do- main generalization using causal matching. In ICML, pages 7313–7324, 2021. 2 [54] Toshihiko Matsuura and Tatsuya Harada. Domain general- ization using a mixture of multiple latent domains. In AAAI, 2020. 2 [55] Dimity Miller, Lachlan Nicholson, Feras Dayoub, and Niko Sünderhauf. Dropout sampling for robust object detection in open-set conditions. In ICRA, pages 3243–3249. IEEE, 2018. 7 [56] Hyeonseob Nam, HyunJae Lee, Jongchan Park, Wonjun Yoon, and Donggeun Yoo. Reducing domain gap by re- ducing style bias. In CVPR, pages 8690–8699, 2021. 2 [57] Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bis- sacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. In NIPS work- shop on deep learning and unsupervised feature learning, volume 2011, page 5, 2011. 6 [58] Anh Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In CVPR, pages 427–436, 2015. 4 [59] Sinno Jialin Pan, Ivor W Tsang, James T Kwok, and Qiang Yang. Domain adaptation via transfer component analy- IEEE Transactions on Neural Networks, 22(2):199– sis. 210, 2011. 2 [60] Pau Panareda Busto and Juergen Gall. Open set domain adaptation. In ICCV, pages 754–763, 2017. 3 [61] Prashant Pandey, Mrigank Raman, Sumanth Varambally, and Prathosh Ap. Generalization on unseen domains In via inference-time label-preserving target projections. CVPR, pages 12924–12933, 2021. 3 [62] Fabian Pedregosa, Gaël Varoquaux, Alexandre Gramfort, Vincent Michel, Bertrand Thirion, Olivier Grisel, Mathieu Blondel, Peter Prettenhofer, Ron Weiss, Vincent Dubourg, et al. Scikit-learn: Machine learning in python. JMLR, 12:2825–2830, 2011. 4 [63] Vihari Piratla, Praneeth Netrapalli, and Sunita Sarawagi. Efficient domain generalization via common-specific low- rank decomposition. In ICML, pages 7728–7738, 2020. 1, 2 [64] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with re- gion proposal networks. NeurIPS, 28, 2015. 7 [65] Stephan R Richter, Vibhav Vineet, Stefan Roth, and Vladlen Koltun. Playing for data: Ground truth from com- puter games. In ECCV, pages 102–118. Springer, 2016. 7 [66] Mateo Rojas-Carulla, Bernhard Schölkopf, Richard Turner, and Jonas Peters. Invariant models for causal transfer learn- ing. JMLR, 19(1):1309–1342, 2018. 2 [67] Kate Saenko, Brian Kulis, Mario Fritz, and Trevor Dar- rell. Adapting visual category models to new domains. In ECCV, pages 213–226. Springer, 2010. 6 [68] Kuniaki Saito, Donghyun Kim, Stan Sclaroff, and Kate Saenko. Universal domain adaptation through self super- vision. NeurIPS, 33:16282–16292, 2020. 3, 5 [69] Kuniaki Saito, Shohei Yamamoto, Yoshitaka Ushiku, and Tatsuya Harada. Open set domain adaptation by backprop- agation. In ECCV, pages 153–168, 2018. 3, 6, 7 [70] Vikash Sehwag, Mung Chiang, and Prateek Mittal. Ssd: A unified framework for self-supervised outlier detection. In ICLR, 2021. 3 [71] Yang Shu, Zhangjie Cao, Chenyu Wang, Jianmin Wang, and Mingsheng Long. Open domain generalization with domain-augmented meta-learning. In CVPR, pages 9624– 9633, 2021. 2 [72] Xinwei Sun, Botong Wu, Xiangyu Zheng, Chang Liu, Wei Chen, Tao Qin, and Tie-Yan Liu. Recovering latent causal factor for generalization to distributional shifts. NeurIPS, 34, 2021. 2 [73] Yiyou Sun, Chuan Guo, and Yixuan Li. React: Out-of- distribution detection with rectified activations. In NeurIPS, 2021. 3 [74] Yiyou Sun and Yixuan Li. Dice: Leveraging sparsification for out-of-distribution detection. In ECCV, 2022. 3, 6, 7 [75] Yiyou Sun, Yifei Ming, Xiaojin Zhu, and Yixuan Li. Out- of-distribution detection with deep nearest neighbors. In ICML, 2022. 3 [76] Yu Sun, Xiaolong Wang, Zhuang Liu, John Miller, Alexei Efros, and Moritz Hardt. Test-time training with self- supervision for generalization under distribution shifts. In ICML, pages 9229–9248. PMLR, 2020. 3, 6, 7 [77] Leitian Tao, Xuefeng Du, Xiaojin Zhu, and Yixuan Li. Non-parametric outlier synthesis. In ICLR, 2023. 3 [78] Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. JMLR, 9(11), 2008. 8, 9 [79] Vladimir N Vapnik. An overview of statistical learning the- ory. IEEE transactions on neural networks, 10(5):988–999, 1999. 6 [80] Hemanth Venkateswara, Jose Eusebio, Chakraborty, and Sethuraman Panchanathan. hashing network for unsupervised domain adaptation. CVPR, pages 5018–5027, 2017. 6 Shayok Deep In [81] Riccardo Volpi and Vittorio Murino. Addressing model vul- nerability to distributional shifts over image transformation sets. In ICCV, pages 7980–7989, 2019. 2 [82] Riccardo Volpi, Hongseok Namkoong, Ozan Sener, John C Duchi, Vittorio Murino, and Silvio Savarese. Generalizing to unseen domains via adversarial data augmentation. In NeurIPS, pages 5334–5344, 2018. 1, 2, 6 [83] Dequan Wang, Evan Shelhamer, Shaoteng Liu, Bruno Ol- shausen, and Trevor Darrell. Tent: Fully test-time adapta- tion by entropy minimization. In ICLR, 2021. 3, 6, 7 [84] Jindong Wang, Cuiling Lan, Chang Liu, Yidong Ouyang, Tao Qin, Wang Lu, Yiqiang Chen, Wenjun Zeng, and Philip Yu. Generalizing to unseen domains: A survey on domain generalization. TKDE, 2022. 1 [85] Hongxin Wei, Renchunzi Xie, Hao Cheng, Lei Feng, Bo An, and Yixuan Li. Mitigating neural network overconfi- dence with logit normalization. In ICML, 2022. 6, 7 [86] Haifeng Xia, Handong Zhao, and Zhengming Ding. Adap- tive adversarial network for source-free domain adaptation. In ICCV, 2021. 3 [103] Kaiyang Zhou, Yongxin Yang, Timothy Hospedales, and Tao Xiang. Deep domain-adversarial image generation for domain generalisation. In AAAI, pages 13025–13032, 2020. 2 [104] Kaiyang Zhou, Yongxin Yang, Timothy Hospedales, and Tao Xiang. Learning to generate novel domains for domain generalization. In ECCV, pages 561–578, 2020. 2 [105] Kaiyang Zhou, Yongxin Yang, Yu Qiao, and Tao Xiang. Domain adaptive ensemble learning. TIP, 30:8008–8018, 2021. 6 [106] Kaiyang Zhou, Yongxin Yang, Yu Qiao, and Tao Xiang. Domain generalization with mixstyle. In ICLR, 2021. 1, 2 [107] Ronghang Zhu and Sheng Li. Crossmatch: Cross-classifier consistency regularization for open-set single domain gen- eralization. In ICLR, 2022. 2, 3, 5, 6, 7, 8 [108] Wei Zhu, Le Lu, Jing Xiao, Mei Han, Jiebo Luo, and Adam P Harrison. Localized adversarial domain general- ization. In CVPR, pages 7108–7118, 2022. 2 [87] Qinwei Xu, Ruipeng Zhang, Ya Zhang, Yanfeng Wang, and Qi Tian. A fourier-based framework for domain generaliza- tion. In CVPR, pages 14383–14392, 2021. 2 [88] Zhenlin Xu, Deyi Liu, Junlin Yang, Colin Raffel, and Marc Niethammer. Robust and generalizable visual representa- tion learning via random convolutions. In ICLR, 2021. 1, 2 [89] Jingkang Yang, Kaiyang Zhou, Yixuan Li, and Ziwei Liu. Generalized out-of-distribution detection: A survey. arXiv preprint arXiv:2110.11334, 2021. 3 [90] Shiqi Yang, Yaxing Wang, Joost van de Weijer, Luis Her- ranz, and Shangling Jui. Exploiting the intrinsic neigh- borhood structure for source-free domain adaptation. In NeurIPS, 2021. 3 [91] Shiqi Yang, Yaxing Wang, Kai Wang, Shangling Jui, et al. Attracting and dispersing: A simple approach for source- free domain adaptation. In NeurIPS, 2022. 3, 6, 7 [92] Shiqi Yang, Yaxing Wang, Kai Wang, Shangling Jui, and Joost van de Weijer. One ring to bring them all: Towards open-set recognition under domain shift. arXiv preprint arXiv:2206.03600, 2022. 2, 3, 6, 7 [93] Kaichao You, Mingsheng Long, Zhangjie Cao, Jianmin Wang, and Michael I Jordan. Universal domain adaptation. In CVPR, pages 2720–2729, 2019. 3 [94] Hanlin Zhang, Yi-Fan Zhang, Weiyang Liu, Adrian Weller, Bernhard Schölkopf, and Eric P Xing. Towards princi- pled disentanglement for domain generalization. In CVPR, pages 8024–8034, 2022. 1, 2 [95] Jing Zhang, Zewei Ding, Wanqing Li, and Philip Ogun- bona. Importance weighted adversarial nets for partial do- main adaptation. In CVPR, 2018. 3 [96] Marvin Mengxin Zhang, Sergey Levine, and Chelsea Finn. Memo: Test time robustness via adaptation and augmenta- tion. In NeurIPS, 2022. 3, 6, 7 [97] Yabin Zhang, Minghan Li, Ruihuang Li, Kui Jia, and Lei Zhang. Exact feature distribution matching for arbitrary style transfer and domain generalization. In CVPR, 2022. 2 [98] Ziyi Zhang, Weikai Chen, Hui Cheng, Zhen Li, Siyuan Li, Liang Lin, and Guanbin Li. Divide and contrast: Source- free domain adaptation via adaptive contrastive learning. In NeurIPS, 2022. 3 [99] Long Zhao, Ting Liu, Xi Peng, and Dimitris Metaxas. Maximum-entropy adversarial data augmentation for im- proved generalization and robustness. NeurIPS, 33:14435– 14447, 2020. 6 [100] Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discrimi- native localization. In CVPR, 2016. 8 Jia Pan, [101] Hong-Yu Zhou, Yizhou Yu, Chengdi Wang, Shu Zhang, Jun Shao, Guangming Lu, Yuanxu Gao, Kang Zhang, and Weimin Li. A transformer-based representation-learning model with unified processing of multimodal input for clinical diagnostics. Nature Biomedi- cal Engineering, pages 1–13, 2023. 2 [102] Kaiyang Zhou, Ziwei Liu, Yu Qiao, Tao Xiang, and Chen Change Loy. Domain generalization: A survey. TPAMI, 2022. 1
http://arxiv.org/abs/2310.04723v1
"2023-10-07T07:52:59"
"2023-10-07T07:52:59"
Subspace Identification for Multi-Source Domain Adaptation
Multi-source domain adaptation (MSDA) methods aim to transfer knowledge from multiple labeled source domains to an unlabeled target domain. Although current methods achieve target joint distribution identifiability by enforcing minimal changes across domains, they often necessitate stringent conditions, such as an adequate number of domains, monotonic transformation of latent variables, and invariant label distributions. These requirements are challenging to satisfy in real-world applications. To mitigate the need for these strict assumptions, we propose a subspace identification theory that guarantees the disentanglement of domain-invariant and domain-specific variables under less restrictive constraints regarding domain numbers and transformation properties, thereby facilitating domain adaptation by minimizing the impact of domain shifts on invariant variables. Based on this theory, we develop a Subspace Identification Guarantee (SIG) model that leverages variational inference. Furthermore, the SIG model incorporates class-aware conditional alignment to accommodate target shifts where label distributions change with the domains. Experimental results demonstrate that our SIG model outperforms existing MSDA techniques on various benchmark datasets, highlighting its effectiveness in real-world applications.
[ "Zijian Li", "Ruichu Cai", "Guangyi Chen", "Boyang Sun", "Zhifeng Hao", "Kun Zhang" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04723v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04723v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "stat.ML" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 3 2 7 4 0 . 0 1 3 2 : v i X r a Subspace Identification for Multi-Source Domain Adaptation Zijian Li2,3, Ruichu Cai2, Guangyi Chen3,1, Boyang Sun3, Zhifeng Hao4, Kun Zhang3,1 1 Carnegie Mellon University 2 School of Computer Science, Guangdong University of Technology 3 Mohamed bin Zayed University of Artificial Intelligence 4 Shantou University Abstract Multi-source domain adaptation (MSDA) methods aim to transfer knowledge from multiple labeled source domains to an unlabeled target domain. Although cur- rent methods achieve target joint distribution identifiability by enforcing minimal changes across domains, they often necessitate stringent conditions, such as an adequate number of domains, monotonic transformation of latent variables, and invariant label distributions. These requirements are challenging to satisfy in real-world applications. To mitigate the need for these strict assumptions, we propose a subspace identification theory that guarantees the disentanglement of domain-invariant and domain-specific variables under less restrictive constraints regarding domain numbers and transformation properties, thereby facilitating do- main adaptation by minimizing the impact of domain shifts on invariant variables. Based on this theory, we develop a Subspace Identification Guarantee (SIG) model that leverages variational inference. Furthermore, the SIG model incorporates class-aware conditional alignment to accommodate target shifts where label dis- tributions change with the domains. Experimental results demonstrate that our SIG model outperforms existing MSDA techniques on various benchmark datasets, highlighting its effectiveness in real-world applications. 1 Introduction Multi-Source Domain Adaptation (MSDA) is a method of transferring knowledge from multiple labeled source domains to an unlabeled target domain, to address the challenge of domain shift between the training data and the test environment. Mathematically, in the context of MSDA, we assume the existence of M source domains {S1, S2, ..., SM } and a single target domain T . For each source domain Si, data are drawn from a distinct distribution, represented as px,y|uSi , where the variables x, y, u correspond to features, labels, and domain indices, respectively. In a similar manner, the distribution within the target domain T is given by px,y|uT . In the source domains, we have access to mi annotated feature-label pairs of each domain, denoted by (xSi, ySi) = (xSi k=1, while in k )mT the target domain, only mT unannotated features are observed, represented as (x(T )) = (xT k=1. The primary goal of MSDA is to effectively leverage these labeled source data and unlabeled target data to identify the target joint distribution px,y|uT . However, identifying the target joint distribution of x, y|uT using only x|uT as observations present a significant challenge, since the possible mappings from px,y|uT to px|uT are infinite when no extra constraints are given. To solve this problem, some assumptions have been proposed to constrain the domain shift, such as covariate shift [44], target shift [58, 1], and conditional shift [3, 56]. For example, the most conventional covariate shift assumption posits that py|x is fixed across different domains while px varies. Under this assumption, researchers can employ techniques such as importance reweighting [52], invariant representation learning [11], or cycle consistency [17] for distribution 37th Conference on Neural Information Processing Systems (NeurIPS 2023). k , ySi k )mi alignment. Additionally, target shift assumes that px|y is fixed while the label distribution py changes, whereas conditional shift is represented by a fixed py and a varying px|y. More generally, the minimal change principle has been proposed, which not only unifies the aforementioned assumptions but also enables the theoretical guarantee of the identifiability of the target joint distribution. Specifically, it assumes that py|u and px|y,u change independently and the change of px|y,u is minimal. Please refer to Appendix 14 for further discussion of related works, including domain adaptation and identification. Although current methods demonstrate the identifiability of the target joint distribution through the minimal change principle, they often impose strict conditions on the data generation process and the number of domains, limiting their practical applicability. For instance, iMSDA [30] presents the component-wise identification of the domain-changed latent variables, subsequently identifying target joint distribution by modeling a data generation process with variational inference. However, this identification requires the following conditions. First, a sufficient number of auxiliary variables is employed for the component-wise theoretical guarantees, meaning that when the dimension of latent variables is n, a total of 2n + 1 domains are needed. Second, in order to identify high-level invariant latent variables, a component-wise monotonic function between latent variables must be assumed. Third, these methods implicitly assume that label distribution remains stable across domains, despite the prevalence of target shift in real-world scenarios. These conditions are often too restrictive to be met in practice, highlighting the need for a more general approach to identifying latent variables across a wider range of domain shifts. In an effort to alleviate the need for such strict assumptions, we present a subspace identification theory in this paper that guarantees the disentanglement of domain-invariant and domain-specific variables under more relaxed constraints concerning the number of domains and transformation properties. In contrast to component-wise identification, our subspace identification method demands fewer auxiliary variables (i.e., when the dimension of latent variables is n, only n + 1 domains are required). Additionally, we design a more general data generation process that accounts for target shift and does not necessitate monotonic transformation between latent variables. In this process, we categorize latent variables into four groups based on whether they are influenced by domain index or label. Building on the theory and causal generation process, we develop a Subspace Identification Guarantee (SIG) model that employs variational inference to identify latent variables. A class-aware condition alignment is incorporated to mitigate the impact of target shift, ensuring the update of the most confident cluster embedding. Our approach is validated through a simulation experiment for subspace identification evaluation and four widely-used public domain adaptation benchmarks for application evaluation. The impressive performance that outperforms state-of-the-art methods demonstrates the effectiveness of our method. 2 Identifying Target Joint Distribution with Data Generation Process 2.1 Data Generation Process We begin with introducing the data generation process. As shown in Figure 1, the observed data x ∈ X are generated by latent variables z ∈ Z ⊆ Rn. Sequentially, we divide the latent variables z into the four parts, i.e. z = {z1, z2, z3, z4} ∈ Z ⊆ Rn, which are shown as follows. • domain-specific and label-irrelevant variables z1 ∈ Rn1. • domain-specific but label-relevant variables z2 ∈ Rn2. • domain-invariant and label-relevant variables z3 ∈ Rn3 . • domain-invariant but label-irrelevant variables z4 ∈ Rn4 . To better understand these latent variables, we provide some examples in DomainNet datasets. First, z1 ∈ Rn1 denotes the styles of the images like "infograph" and "sketch", which are irrelevant to labels. z2 ∈ Rn2 denotes the latent variables that can be the texture information relevant to domains and labels. For example, the samples of "clock" and "telephone" contain some digits, and these digits in these samples are a special texture, which can be used for classification and be influenced by different styles, such as "infograph". z3 ∈ Rn3 denotes the latent variables that are only relevant to the labels. Figure 1: Data generation process, where the gray the white nodes de- note the observed and latent vari- ables, respectively. 2 (cid:2869)(cid:2870)(cid:2871)(cid:2872) For example, in the DomainNet dataset, it can be interpreted as the meaning of different classes like "Bicycle" or "Teapot". Finally, z4 ∈ Rn4 denotes the label-irrelevant latent variables. For example, z4 can be interpreted as the background that is invariant to domains and labels. Based on the definitions of these latent variables, we let the observed data be generated from z through an invertible and smooth mixing function g : Z → X . Due to the target shift, we further consider that the py is influenced by u, i.e. u → y. Compared with the existing data generation process like [30], the proposed data generation process is different in three folds. First, pu is independent of py in the iMSDA [30], so the target shift is not taken into account. Second, the data generation process of iMSDA requires an invertible and monotonic function between latent variables for component-wise identification, which is too strict to be met in practice. Third, to provide a more general way to depict the real-world data, our data generation process introduces the domain-specific but label-relevant latent variables zs2 and the domain-invariant but label-irrelevant variables z4. 2.2 Identifying the Target Joint Distribution In this part, we show how to identify the target joint distribution px,y|uT with the help of marginal distribution. By introducing the latent variables and combining the proposed data generation process, we can obtain the following derivation. px,y|uT = = = (cid:90) (cid:90) (cid:90) (cid:90) z1 (cid:90) z2 (cid:90) z3 (cid:90) z4 (cid:90) z1 (cid:90) z2 (cid:90) z3 (cid:90) z4 (cid:90) z1 z2 z3 z4 px,y,z1,z2,z3,z4|uT dz1dz2dz3dz4 px,z1,z2,z3,z4|y,uT * py|uT dz1dz2dz3dz4 (1) px|z1,z2,z3,z4 * pz1,z2,z3,z4|y,uT * py|uT dz1dz2dz3dz4. According to the derivation in Equation (1), we can identify the target joint distribution by modeling three distributions. First, we need to model px|z1,z2,z3,z4 , implying that we need to model the conditional distribution of observed data give latent variables, which coincides with a generative model for observed data. Second, we need to estimate the label pseudo distribution of target domain py|uT . Third, we need to model pz1,z2,z3,z4|y,uT meaning that the latent variables should be identified with auxiliary variables u, y under theoretical guarantees. In the next section, we will introduce how to identify these latent variables with subspace identification block-wise identification results. 3 Subspace Identifiability for Latent Variables In this section, we provide how to identify the latent variables in Figure 1. In detail, we first prove that z2 is subspace identifiable and z1, z3 can be reconstructed from the estimated ˆz1, ˆz2, ˆz3. Then we further prove that z4 is block-wise identifiable. To clearly introduce the subspace identification theory, we employ a sim- ple data generation process [3] as shown in Figure 2. In this data gen- eration process, zs ∈ Rns and zc ∈ Rnc denote the domain-specific and domain-invariant latent variables, respectively. For convenient, we let z = {zs, zc}, n = ns + nc. Moreover, we assume zs = (zi)ns i=1 and zc = (zi)n i=ns+1. And {u, y, x} denote the domain index, labels, and ob- served data, respectively. And we further let the observed data be generated from z through an invertible and smooth mixing function g : Z → X . The subspace identification of zs means that for each ground-truth zs,i, there exits ˆzs and an invertible function hi : Rn → R, such that zs,i = hi(ˆzs). Theorem 1. (Subspace Identification of zs.) We follow the data generation process in Figure 2 and make the following assumptions: Figure 2: A sim- ple data generaliza- tion process for intro- ducing subspace iden- tification. • A1 (Smooth and Positive Density): The probability density function of latent variables is smooth and positive, i.e., pz|u > 0 over Z and U. 3 (cid:3046)(cid:3030) • A2 (Conditional independent): Conditioned on u, each zi is independent of any other zj for i qi(zi, u) where qi(zi, u) is the log density of i, j ∈ {1, * * * , n}, i ̸= j, i.e. log pz|u(z|u) = (cid:80)n the conditional distribution, i.e., qi : log pzi|u. • A3 (Linear independence): For any zs ∈ Zs ⊆ Rns, there exist ns + 1 values of u, i.e., uj with j = 0, 1, * * * , ns, such that these ns vectors w(z, uj) − w(z, u0) with j = 1, * * * , ns are linearly independent, where vector w(z, uj) is defined as follows: w(z, u) = (cid:18) ∂q1(z1, u) ∂z1 , * * * , ∂qi(zi, u) ∂zi , * * * ∂qns (zns , u) ∂zns (cid:19) , (2) By modeling the aforementioned data generation process, zs is subspace identifiable. Proof sketch. First, we construct an invertible transformation h between the ground-truth z and estimated ˆz. Sequentially, we leverage the variance of different domains to construct a full-rank linear system, where the only solution of ∂zs is zero. Since the Jacobian of h is invertible, for each ∂ˆzc zs,i, i ∈ {1, * * * , ns}, there exists a hi such that zs,i = hi(ˆz) and zs is subspace identifiable. The proof can be found in Appendix 9.1. The first two assumptions are standard in the component- wise identification of existing nonlinear ICA [30, 27]. The third Assumption means that pz|u should vary sufficiently over n + 1 domains. Compared to component-wise identification, which necessitates 2n + 1 domains and is likely challenging to fulfill, subspace identification can yield equivalent results in terms of identifying the ground-truth latent variables with only n + 1 domains. Therefore, subspace identification benefits from a more relaxed assumption. Based on the theoretical results of subspace identification, we show that the ground-truth z1, z2 and z3 be reconstructed from the estimated ˆz1, ˆz2 and ˆz3. For ease of exposition, we assume that z1, z2, z3, and z4 correspond to components in z with indices {1, * * * , n1}, {n1 + 1, * * * , n1 + n2}, {n1 + n2 + 1, * * * , n1 + n2 + n3}, and {n1 + n2 + n3 + 1, * * * , n}, respectively. Corollary 1.1. We follow the data generation in Section 2.1, and make the following assumptions which are similar to A1-A3: A4 (Smooth and Positive Density): The probability density function of latent variables is smooth and positive, i.e., pz|u,y > 0 over Z, U, and Y. A5 (Conditional independent): Conditioned on u and y, each zi is independent of any other zj for i, j ∈ {1, * * * , n}, i ̸= j, i.e. log pz|u,y(z|u, y) = (cid:80)n i qi(zi, u, y) where qi(zi, u, y) is the log density of the conditional distribution, i.e., qi : log pzi|u,y. A6 (Linear independence): For any z ∈ Z ⊆ Rn, there exists n1 + n2 + n3 + 1 combination of (u, y), i.e. j = 1, * * * , U and c = 1, * * * , C and U × C − 1 = n1 + n2 + n3, where U and C denote the number of domains and the number of labels. such that these n1 + n2 + n3 vectors w(z, uj, yc) − w(z, u0, y0) are linearly independent, where w(z, uj, yc) is defined as follows: w(z, u, y) = (cid:18) ∂q1(z1, u, y) ∂z1 , * * * , ∂qi(zi, u, y) ∂zi , * * * ∂qn(zn, u, y) ∂zn (cid:19) . (3) By modeling the data generation process in Section 2.1, z2 is subspace identifiable, and z1, z3 can be reconstructed from ˆz1, ˆz2 and ˆz2, ˆz3, respectively. The detailed proof can be found in Appendix 9.2. Proof sketch. First, we construct an invertible transformation h to bridge the relation between the ground-truth z and the estimated ˆz. Then, we repeatedly use Theorem 1 three times by considering the chang- the values of some blocks of the Ja- ing of labels and domains. Hence, we find that cobian of h are zero. the Jacobian of h can be formalized as Equation (4). where Jh denotes the Jacobian of h and J ij h := ∂zi and i, j ∈ {1, 2, 3, 4}. Since ∂ˆzj h(*) is invertible, Jh is a full-rank ma- trix. Therefore, for each z2,i, i ∈ {n1 + 1, * * * , n1 + n2}, there exists a h2,i such that z2,i = hi(ˆz2). Moreover, for each z1,i, i ∈ {1, * * * , n1 + 1}, there exists a J 1,1 J 1,2 h h h = 0 J 2,2 J 2,1 h = 0 J 3,2 J 3,1 h J 4,2 J 4,1 h h J 1,3 h = 0 J 1,4 h = 0 J 2,4 J 2,3 J 3,3 J 3,4 h J 4,3 h h = 0 h = 0 h = 0 J 4,4 h Finally,             Jh = (4)   h , 4 Figure 3: The framework of the Subspace Identification Guarantee model. The pre-trained backbone networks are used to extract the feature f from observed data. The bottleneck and fμ, fσ are used to generate z with a reparameterization trick. Label predictor takes z2, z3, and u as input to model py|u,z2,z3. The decoder is used to model the marginal distribution. Finally, z2 is used for class-aware conditional alignment. h1,i such that z1,i = h1,i(ˆz1, ˆz2). And for each z3,i, i ∈ {n1 + n2 + 1, * * * , n1 + n2 + n3}, there exists a h3,i such that z3,i = h3,i(ˆz2, ˆz3). Then we prove that z4 is block-wise identifiable, which means that there exists an invertible function h4, s.t.z4 = h4(ˆz4). Lemma 2. [30] Following the data generation process in Section 2.1 and the assumptions A4-A6 in Theorem 3, we further make the following assumption: • A7 (Domain Variability: For any set Az ⊆ Z) with the following two properties: 1) Az has nonzero probability measure, i.e. P[z ∈ Az|{u = u′, y = y′}] > 0 for any u′ ∈ U and y′ ∈ Y. 2) Az cannot be expressed as Bz4 × Z1 × Z2 × Z3 for any Bz4 ⊂ Z4. ∃u1, u2 ∈ U and y1, y2 ∈ Y, such that (cid:82) z∈Az generation process in Section 2.1, the z4 is block-wise identifiable. pz|u1,y1dz ̸= (cid:82) z∈Az pz|u2,y2 dz. By modeling the data The proof can be found in Appendix 9.3. Lemma 4 shows that z4 can be block-wise identifiable when the pz|u changes sufficiently across domains. In summary, we can obtain the estimated latent variables ˆz with the help of subspace identification and block-wise identification. 4 Subspace Identification Guarantee Model Based on the theoretical results, we proposed the Subspace Identification Guaranteed model (SIG) as shown in Figure 3, which contains a variational-inference-based neural architecture to model the marginal distribution and a class-aware conditional alignment to mitigate the target shift. 4.1 Variational-Inference-based Neural Architecture According to the data generation process in Figure 1, we first derive the evidence lower bound (ELBO) in Equation (5). ELBO =Eqz|x(z|x) ln px|z(x|z) + Eqz|x(z|x) ln py|u,z2,z3 (y|u, z2, z3) + Eqz|x(z|x) ln pu|z(u|z) − DKL(qz|x(z|x)||pz(z)). (5) Since the reconstruction of u is not the optimization goal, we remove the reconstruction of u and we rewrite Equation (5) as the objective function in Equation (6). Lelbo = Lvae + Ly Lvae = −Eqz|x(z|x) ln px|z(x|z) + DKL(qz|x(z|x)||pz(z)) Ly = −Eqz|x(z|x) ln py|u,z2,z3 (y|u, z2, z3). (6) To minimize the pairwise class confusion, we further employ the minimum class confusion [25] into the classification loss Ly. According to the objective function in Equation (6), we illustrate how to 5 Pre-trained Backbone NetworksBottleneck Networksf�f�Decoderz�z�z�z�xSxTf�,f�f��,f��Label PredictorClass-aware Condition Alignmenty�Sq�|�p�|�,��,��q�|�u implement the SIG model in Figure 3. First, we take the observed data xSi and xT from the source domains and the target domain as the inputs of the pre-trained backbone networks like ResNet50 and extract the feature fSi and fT . Sequentially, we employ an MLP-based encoder, which contains bottleneck networks, fμ and fσ, to extract the latent variables z. Then, we take z to reconstruct the pre-trained features via an MLP-based decoder to estimate the marginal distribution px|u. Finally, we take the z2, z3, and the domain embedding to predict the source label to estimate py|u,z2,z3 . 4.2 Class-aware Conditional Alignment To estimate the target label distribution py|uT and mitigate the influence of target shift, we propose the class-aware conditional alignment to automatically adjust the conditional alignment loss for each sample. Formally, it can be written as La = 1 C C (cid:88) i=1 w(i) * pˆy(i) ||ˆz(i) 3,S − ˆz(i) 3,T ||2, w(i) = 1 + exp (−H(pˆy(i) )), (7) 3,S and ˆz(i) where C denotes the class number; ˆz(i) 3,T denote the latent variables of ith class from source and target domain, respectively; w(i) denotes the prediction uncertainty of each class in the target domain; pˆy(i) denotes the estimated label probability density of ith class; H denotes the entropy. The aforementioned class-aware conditional alignment is based on the existing conditional alignment loss, which can be formalized in Equation (8). La = 1 C C (cid:88) i=1 ||ˆz(i) 3,S − ˆz(i) 3,T ||2, (8) However, conventional conditional alignment usually suffers from two drawbacks including misesti- mated centroid and low-quality pseudo-labels. First, the conditional alignment method implicitly assumes that the feature centroids from different domains are the same. But it is hard to estimate the correct centroids of the target domain for the class with low probability density. Second, conditional alignment heavily relies on the quality of the pseudo label. But existing methods usually use pseudo labels without any discrimination, which might result in false alignment. To solve these problems, we consider two types of reweighting. Distribution-based Reweighting for Misestimated Centroid: Although the conditional alignment method implicitly assumes that the feature centroids from different domains are the same, it is hard to estimate the correct centroids of the target domain for the class with low probability density. To address this challenge, one straightforward solution is to consider the label distribution of the target domain. To achieve this, we employ the technique of black box shift estimation method (BBSE) [37] to estimate the label distribution from the target domain pˆy. So we use the estimated label distribution to reweight the conditional alignment loss in Equation (8). Entropy-based Reweighting for Low-quality Pseudo-labels: conditional alignment heavily relies on the quality of the pseudo label. However, existing methods usually use pseudo labels without any discrimination, which might result in false alignment. To address this challenge, we consider the prediction uncertainty of each class in the target domain. Technologically, for each sample in the target dataset, we calculate the entropy-based weights via the prediction results which are shown as w(i) in Equation (7). By combining the distribution-based weights and the entropy-based weight, we can obtain the class-aware conditional alignment as shown in Equation (7). Hence the total loss of the Subspace Identification Guarantee model can be formalized as follows: Ltotal = Ly + βLvae + αLa, (9) where α, β denote the hyper-parameters. 5 Experiments 5.1 Experiments on Simulation Data In this subsection, we illustrate the experiment results of simulation data to evaluate the theoretical results of subspace identification in practice. 6 5.1.1 Experimental Setup Data Generation. We generate the simulation data for binary classification with 8 domains. To better evaluate our theoretical results, we follow the data generation process in Figure 2, which includes two types of latent variables, i.e., domain-specific latent variables zs and domain-invariant latent variables zc. We let the dimensions of zs and zc be both 2. Moreover, zs are sampled from u different mixture of Gaussians, and zc are sampled from a factorized Gaussian distribution. We let the data generation process from latent variables to observed variables be MLPs with the Tanh activation function. We further split the simulation dataset into the training set, validation set, and test set. Evaluation Metrics. First, we employ the accuracy of the target domain data to measure the classification performance of the model. Second, we compute the Mean Correlation Coefficient (MCC) between the ground-truth zs and the estimated ˆzs on the test dataset to evaluate the component- wise identifiability of domain-specific latent variables. A higher MCC denotes the better identification performance the model can achieve. Third, to evaluate the performance of subspace identifiability of domain-specific latent variables, we first use the estimated ˆzs from the validation set to regress each dimension of the ground-truth zs from the validation set with the help of a MLPs. Sequentially, we take the ˆzs from the test set as input to estimate how well the MLPs can reconstruct the ground-truth zs from the test set, so we employ Root Mean Square Error (RMSE) to measure the extent of subspace identification. A low RMSE denotes that there exists a transformation hi between zs,i and ˆzs,1, ˆzs,2, i.e. zs,i = hi( ˆzs,1, ˆzs,2), i ∈ {1, 2}. For the scenario where the number of domains is less than 8, we first fix the target domain and then try all the combinations of the source domains. And we publish the average performance of all the combinations. We repeat each experiment over 3 random seeds. 5.1.2 Results and Discussion 2 U 4 3 8 6 5 State ACC MCC RMSE No Identification Subspace Identification 0.8484(0.1452) 0.8077(0.1709) 0.9233(0.2039) 0.8679(0.2610) Component-wise Identification Table 1: Experiments results on simulation data. 0.0433(0.0051) 0.0439(0.0073) 0.0441(0.0055) 0.9982(0.0004) 0.9982(0.0007) 0.9982(0.0007) 0.9037(0.0087) 0.8976(0.0162) 0.8973(0.0131) The experimen- tal results of the simulation dataset are shown in Table 1. According to the exper- results, iment we can obtain the following conclusions: 1) We can find that the values of MCC increase along with the number of domains. Moreover, the values of MCC are high (around 0.9) and stable when the number of domains is larger than 5. This result corresponds to the theoretical result of component-wise identification, where a certain number of domains (i.e. 2n + 1) are necessary for component-wise identification. 2) We can find that the values of RMSE decrease along with the number of domains. Furthermore, the values of RMSE are low and stable (less than 0.07) when the number of domains is larger than 3, but it drops sharply when u = 2. These experimental results coincide with the theoretical results of subspace identification as well as the intuition where a certain number of domains are necessary for subspace identification (i.e. ns + 1). 3) According to the experimental results of ACC, we can find that the accuracy grows along with the number of domains and its changing pattern is relevant to that of RMSE, i.e., the performance is stable when the number of domains is larger than 3. The ACC results also indirectly support the results of subspace identification, since one straightforward understanding of subspace identification is that the domain-specific information is preserved in ˆzs. And the latent variables are well disentangled with the help of subspace identification, which benefits the model performance. 0.0582(0.0431) 0.0669(0.0482) 0.6184(0.2093) 0.5978(0.3039) 0.1272(0.0608) 5.2 Experiments on Real-world Data 5.2.1 Experimental Setup Datasets: We consider four benchmarks: Office-Home, PACS, ImageCLEF, and DomainNet. For each dataset, we let each domain be a target domain and the other domains be the source domains. For the DomainNet dataset, we equip a cross-attention module to the ResNet101 backbone networks for 7 Table 2: Classification results on the Office-Home and ImageCLEF datasets. For the Office-Home dataset, We employ ResNet50 as the backbone network. For the ImageCLEF dataset, we employ ResNet18 as the backbone network. Model Office-Home ImageCLEF Art Clipart Product RealWorld Average P C I Average Source Only [16] 64.5 DANN [11] 64.2 DAN [40] 68.2 DCTN [69] 66.9 MFSAN [81] 72.1 WADN [54] 75.2 iMSDA [30] 75.4 SIG 76.4 52.3 58.0 57.9 61.8 62.0 61.0 61.4 63.9 77.6 76.4 78.4 79.2 80.3 83.5 83.5 85.4 80.7 78.8 81.9 77.7 81.8 84.4 84.4 85.8 68.8 69.3 71.6 71.4 74.1 76.1 76.2 77.8 77.2 92.3 88.1 77.9 93.7 91.8 77.6 93.3 92.2 75.0 95.7 90.3 79.1 95.4 93.6 77.7 95.8 93.2 79.2 96.3 94.3 79.3 97.3 94.3 85.8 87.8 87.7 87.0 89.4 88.9 90.0 90.3 better usage of domain knowledge. We also employ the alignment of MDD [78]. For the Office-Home and ImageCLEF datasets, we employ the pre-trained ResNet50 with an MLP-based classifier. For the PACS dataset, we use ResNet18 with an MLP-based classifier. The implementation details are provided in the Appendix 10. We report the average results over 3 random seeds. Table 3: Classification results on the PACS datasets. We employ ResNet18 as the backbone network. Experiment results of other compared methods are taken from ([30]). C A Model Baselines: Besides the classical ap- proaches for single source domain adaptation like DANN [11], DAN [40], MCD [50], and ADDA [62]. We also compare our method with several state-of-the-art multi-source domain adaptation methods, for ex- ample, MIAN-γ [45], T-SVDNet [33], LtC-MSDA [63], SPS [64], and PFDA [10]. Moreover, we further consider the WADN [54], which is devised for the target shift of multi-source domain adaptation. For a fair comparison, we employ the same pre-train backbone net- works instead of the pre-trained fea- tures for WADN in the original pa- per. We also consider the latest iMSDA [30], which addresses the MSDA via component-wise identification. Source Only [16] DANN [11] MDAN [79] WBN [43] MCD [50] M3SDA [46] CMSS [70] LtC-MSDA [63] T-SVDNet [33] iMSDA [30] 74.9 81.9 79.1 89.9 88.7 89.3 88.6 90.1 90.4 93.7 72.1 77.5 76.0 89.7 88.9 89.9 90.4 90.4 90.6 92.4 94.1 93.6 SIG 94.5 91.8 91.4 97.4 96.4 97.3 96.9 97.2 98.5 98.4 98.6 P S Average 64.7 74.6 72.0 58.0 73.9 76.7 82.0 81.5 85.4 89.2 89.5 76.7 81.5 79.6 83.8 87.0 88.3 89.5 89.8 91.2 93.4 93.9 5.2.2 Results and Discussion Experimental results on Office-Home, ImageCLEF, PACS, and DomainNet are shown in Table 2, 3, and 4, respectively. Experiment results of other compared methods are provided in Appendix 11.2. According to the experiment results of the Office-Home dataset on the left side of Table 2, our SIG model significantly outperforms all other baselines on all the transfer tasks. Specifically, our method outperforms the most competitive baseline by a clear margin of 1.3% − 4% and promotes the classification accuracy substantially on the hard transfer task, e.g. Clipart. It is noted that our method achieves a better performance than that of WADN, which is designed for the target shift scenario. This is because our method not only considers how the domain variables influence the distribution of labels but also identifies the latent variables of the data generation process. Moreover, our SIG method also outperforms iMSDA, indirectly reflecting that the proposed data generation process is closer to the real-world setting and the subspace identification can achieve better disentanglement performance under limited auxiliary variables. For datasets like ImageCLEF and PACS, our method also achieves the best-averaged results. In detail, we achieved a comparable performance in all the transfer tasks in the ImageCLFE dataset. In the PACS dataset, our SIG method still performs better than the latest compared methods like iMSDA and T-SVDNet in some challenging transfer tasks like Cartoon. Finally, we also consider the 8 Table 4: Classification results on the DomainNet datasets. We employ ResNet101 as the backbone network. Experiment results of other compared methods are taken from ([34] and [64]). Model Clipart Infograph Painting Quickdraw Real Sketch Average Source Only [16] ADDA [62] MCD [50] DANN [11] DCTN [69] M3SDA-β [46] ML_MSDA [35] meta-MCD [32] LtC-MSDA [63] CMSS [70] DRT+ST [34] SPS [64] PFDA [10] iMSDA [30] SIG 52.1 47.5 54.3 60.6 48.6 58.6 61.4 62.8 63.1 64.2 71.0 70.8 64.5 68.1 72.7 23.4 11.4 22.1 25.8 23.5 26.0 26.2 21.4 28.7 28.0 31.6 24.6 29.2 25.9 32.0 47.6 36.7 45.7 50.4 48.8 52.3 51.9 50.5 56.1 53.6 61.0 55.2 57.6 57.4 61.5 13.0 14.7 7.6 7.7 7.2 6.3 19.1 15.5 16.3 16.9 12.3 19.4 17.2 17.3 20.5 60.7 49.1 58.4 62.0 53.5 62.7 57.0 64.6 66.1 63.4 71.4 67.5 67.2 64.2 72.4 46.5 33.5 43.5 51.7 47.3 49.5 50.3 50.4 53.8 53.8 60.7 57.6 55.1 52.0 59.5 40.6 32.2 38.5 43 38.2 42.6 44.3 44.2 47.4 46.5 51.3 49.2 48.5 47.5 53.0 Figure 4: Ablation study on the Office-Home dataset. we explore the impact of different loss terms. most challenging dataset, DomainNet, which contains more classes and more complex domain shifts. Results in Table 4 show the significant performance of the proposed SIG method, which provides 3.3% averaged promotion, although the performance in the task of Sketch is slightly lower than that of DRT+ST. Compared with iMSDA, our SIG overpasses by a large margin under a more general data generation process. Ablation Study: To evaluate the effectiveness of individual loss terms, we also devise the two model variants. 1) SIG-sem: remove the class-aware alignment loss. 2) SIG-vae: remove the reconstruction loss and the KL divergence loss. Experiment results on the Office-Home dataset are shown in Figure 4. We can find that the class-aware alignment loss plays an important role in the model performance, reflecting that the class-aware alignment can mitigate the influence of target shift. We also discover that incorporating the reconstruction and KL divergence has a positive impact on the overall performance of the model, which shows the necessity of modeling the marginal distributions. 6 Conclusion This paper presents a general data generation process for multi-source domain adaptation, which coincides with real-world scenarios. Based on this data generation process, we prove that the changing latent variables are subspace identifiable, which provides a novel solution for disentangled representa- tion. Compared with the existing methods, the proposed subspace identification theory requires fewer auxiliary variables and frees the model from the monotonic transformation of latent variables, making it possible to apply the proposed method to real-world data. Experiment results on several main- stream benchmark datasets further evaluate the effectiveness of the proposed subspace identification guaranteed model. In summary, this paper takes a meaningful step for causal representation learning. Broader Impacts: SIG disentangles the latent variables to create a model that is more transparent, thereby aiding in the reduction of bias and the promotion of fairness. Limitation: However, the proposed subspace identification still requires several assumptions that might not be met in real-world scenarios. Therefore, how further to relax the assumptions, i.e., conditional independent assumption, would be an interesting future direction. 9 ������������������������������������������������������������������������������������������������ 7 Acknowledgements We are very grateful to the anonymous reviewers for their help in improving the paper. This research was supported in part by the National Key R&D Program of China (2021ZD0111501), the National Science Fund for Excellent Young Scholars (62122022), Natural Science Foundation of China (61876043, 61976052), the major key project of PCL (PCL2021A12). References [1] K. Azizzadenesheli, A. Liu, F. Yang, and A. Anandkumar. Regularized learning for domain adaptation under label shifts. arXiv preprint arXiv:1903.09734, 2019. [2] K. Bousmalis, G. Trigeorgis, N. Silberman, D. Krishnan, and D. Erhan. Domain separation networks. Advances in neural information processing systems, 29, 2016. [3] R. Cai, Z. Li, P. Wei, J. Qiao, K. Zhang, and Z. Hao. Learning disentangled semantic repre- sentation for domain adaptation. In IJCAI: proceedings of the conference, volume 2019, page 2060. NIH Public Access, 2019. [4] W.-G. Chang, T. You, S. Seo, S. Kwak, and B. Han. Domain-specific batch normalization for unsupervised domain adaptation. In Proceedings of the IEEE/CVF conference on Computer Vision and Pattern Recognition, pages 7354–7362, 2019. [5] C. Chen, Z. Chen, B. Jiang, and X. Jin. Joint domain alignment and discriminative feature learning for unsupervised deep domain adaptation. In Proceedings of the AAAI conference on artificial intelligence, volume 33, pages 3296–3303, 2019. [6] C. Chen, W. Xie, W. Huang, Y. Rong, X. Ding, Y. Huang, T. Xu, and J. Huang. Progressive In Proceedings of the IEEE/CVF feature alignment for unsupervised domain adaptation. conference on computer vision and pattern recognition, pages 627–636, 2019. [7] X. Chen, S. Wang, M. Long, and J. Wang. Transferability vs. discriminability: Batch spectral penalization for adversarial domain adaptation. In International conference on machine learning, pages 1081–1090. PMLR, 2019. [8] Y. Chen and P. Bühlmann. Domain adaptation under structural causal models. The Journal of Machine Learning Research, 22(1):11856–11935, 2021. [9] P. Comon. Independent component analysis, a new concept? Signal processing, 36(3):287–314, 1994. [10] Y. Fu, M. Zhang, X. Xu, Z. Cao, C. Ma, Y. Ji, K. Zuo, and H. Lu. Partial feature selection and alignment for multi-source domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 16654–16663, 2021. [11] Y. Ganin and V. Lempitsky. Unsupervised domain adaptation by backpropagation. In International conference on machine learning, pages 1180–1189. PMLR, 2015. [12] S. Garg, Y. Wu, S. Balakrishnan, and Z. Lipton. A unified view of label shift estimation. Advances in Neural Information Processing Systems, 33:3290–3300, 2020. [13] M. Gong, K. Zhang, T. Liu, D. Tao, C. Glymour, and B. Schölkopf. Domain adaptation with conditional transferable components. In International conference on machine learning, pages 2839–2848. PMLR, 2016. [14] H. Hälvä and A. Hyvarinen. Hidden markov nonlinear ica: Unsupervised learning from nonstationary time series. In Conference on Uncertainty in Artificial Intelligence, pages 939– 948. PMLR, 2020. [15] H. Hälvä, S. Le Corff, L. Lehéricy, J. So, Y. Zhu, E. Gassiat, and A. Hyvarinen. Disentan- gling identifiable features from noisy data with structured nonlinear ica. Advances in Neural Information Processing Systems, 34:1624–1633, 2021. 10 [16] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770– 778, 2016. [17] J. Hoffman, E. Tzeng, T. Park, J.-Y. Zhu, P. Isola, K. Saenko, A. Efros, and T. Darrell. Cy- cada: Cycle-consistent adversarial domain adaptation. In International conference on machine learning, pages 1989–1998. Pmlr, 2018. [18] A. Hyvärinen. Independent component analysis: recent advances. Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences, 371(1984):20110534, 2013. [19] A. Hyvarinen and H. Morioka. Unsupervised feature extraction by time-contrastive learning and nonlinear ica. Advances in neural information processing systems, 29, 2016. [20] A. Hyvarinen and H. Morioka. Nonlinear ica of temporally dependent stationary sources. In Artificial Intelligence and Statistics, pages 460–469. PMLR, 2017. [21] A. Hyv"arinen and P. Pajunen. Nonlinear independent component analysis: Existence and uniqueness results. Neural networks, 12(3):429–439, 1999. [22] A. Hyvarinen, J. Karhunen, and E. Oja. Independent component analysis. Studies in informatics and control, 11(2):205–207, 2002. [23] A. Hyvarinen, H. Sasaki, and R. Turner. Nonlinear ica using auxiliary variables and general- ized contrastive learning. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 859–868. PMLR, 2019. [24] A. Hyvärinen, I. Khemakhem, and R. Monti. Identifiability of latent-variable and structural- equation models: from linear to nonlinear. arXiv preprint arXiv:2302.02672, 2023. [25] Y. Jin, X. Wang, M. Long, and J. Wang. Minimum class confusion for versatile domain adap- tation. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XXI 16, pages 464–480. Springer, 2020. [26] G. Kang, L. Jiang, Y. Wei, Y. Yang, and A. Hauptmann. Contrastive adaptation network for single-and multi-source domain adaptation. IEEE transactions on pattern analysis and machine intelligence, 44(4):1793–1804, 2020. [27] I. Khemakhem, D. Kingma, R. Monti, and A. Hyvarinen. Variational autoencoders and nonlinear ica: A unifying framework. In International Conference on Artificial Intelligence and Statistics, pages 2207–2217. PMLR, 2020. [28] I. Khemakhem, R. Monti, D. Kingma, and A. Hyvarinen. Ice-beem: Identifiable conditional energy-based deep models based on nonlinear ica. Advances in Neural Information Processing Systems, 33:12768–12778, 2020. [29] D. Klindt, L. Schott, Y. Sharma, I. Ustyuzhaninov, W. Brendel, M. Bethge, and D. Paiton. Towards nonlinear disentanglement in natural data with temporal sparse coding. arXiv preprint arXiv:2007.10930, 2020. [30] L. Kong, S. Xie, W. Yao, Y. Zheng, G. Chen, P. Stojanov, V. Akinwande, and K. Zhang. Partial disentanglement for domain adaptation. In International Conference on Machine Learning, pages 11455–11472. PMLR, 2022. [31] A. Kumar, P. Sattigeri, and A. Balakrishnan. Variational inference of disentangled latent concepts from unlabeled observations. arXiv preprint arXiv:1711.00848, 2017. [32] D. Li and T. Hospedales. Online meta-learning for multi-source and semi-supervised do- main adaptation. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XVI, pages 382–403. Springer, 2020. [33] R. Li, X. Jia, J. He, S. Chen, and Q. Hu. T-svdnet: Exploring high-order prototypical correlations for multi-source domain adaptation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9991–10000, 2021. 11 [34] Y. Li, L. Yuan, Y. Chen, P. Wang, and N. Vasconcelos. Dynamic transfer for multi-source In Proceedings of the IEEE/CVF Conference on Computer Vision and domain adaptation. Pattern Recognition, pages 10998–11007, 2021. [35] Z. Li, Z. Zhao, Y. Guo, H. Shen, and J. Ye. Mutual learning network for multi-source domain adaptation. arXiv preprint arXiv:2003.12944, 2020. [36] Z. Li, R. Cai, T. Z. Fu, and K. Zhang. Transferable time-series forecasting under causal conditional shift. arXiv preprint arXiv:2111.03422, 2021. [37] Z. Lipton, Y.-X. Wang, and A. Smola. Detecting and correcting for label shift with black box predictors. In International conference on machine learning, pages 3122–3130. PMLR, 2018. [38] F. Locatello, S. Bauer, M. Lucic, G. Raetsch, S. Gelly, B. Schölkopf, and O. Bachem. Chal- lenging common assumptions in the unsupervised learning of disentangled representations. In international conference on machine learning, pages 4114–4124. PMLR, 2019. [39] F. Locatello, M. Tschannen, S. Bauer, G. Rätsch, B. Schölkopf, and O. Bachem. Disentangling factors of variation using few labels. arXiv preprint arXiv:1905.01258, 2019. [40] M. Long, Y. Cao, J. Wang, and M. Jordan. Learning transferable features with deep adaptation networks. In International conference on machine learning, pages 97–105. PMLR, 2015. [41] M. Long, H. Zhu, J. Wang, and M. I. Jordan. Deep transfer learning with joint adaptation networks. In International conference on machine learning, pages 2208–2217. PMLR, 2017. [42] S. Magliacane, T. Van Ommen, T. Claassen, S. Bongers, P. Versteeg, and J. M. Mooij. Domain adaptation by using causal inference to predict invariant conditional distributions. Advances in neural information processing systems, 31, 2018. [43] M. Mancini, L. Porzi, S. R. Bulo, B. Caputo, and E. Ricci. Boosting domain adaptation by discovering latent domains. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3771–3780, 2018. [44] S. J. Pan and Q. Yang. A survey on transfer learning. IEEE Transactions on knowledge and data engineering, 22(10):1345–1359, 2010. [45] G. Y. Park and S. W. Lee. Information-theoretic regularization for multi-source domain adaptation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9214–9223, 2021. [46] X. Peng, Q. Bai, X. Xia, Z. Huang, K. Saenko, and B. Wang. Moment matching for multi-source domain adaptation. In Proceedings of the IEEE/CVF international conference on computer vision, pages 1406–1415, 2019. [47] C.-X. Ren, Y.-H. Liu, X.-W. Zhang, and K.-K. Huang. Multi-source unsupervised domain adaptation via pseudo target domain. IEEE Transactions on Image Processing, 31:2122–2135, 2022. [48] M. Roberts, P. Mani, S. Garg, and Z. Lipton. Unsupervised learning under latent label shift. Advances in Neural Information Processing Systems, 35:18763–18778, 2022. [49] A. Robey, G. J. Pappas, and H. Hassani. Model-based domain generalization. Advances in Neural Information Processing Systems, 34:20210–20229, 2021. [50] K. Saito, K. Watanabe, Y. Ushiku, and T. Harada. Maximum classifier discrepancy for unsu- pervised domain adaptation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3723–3732, 2018. [51] B. Schölkopf, F. Locatello, S. Bauer, N. R. Ke, N. Kalchbrenner, A. Goyal, and Y. Bengio. Toward causal representation learning. Proceedings of the IEEE, 109(5):612–634, 2021. [52] H. Shimodaira. Improving predictive inference under covariate shift by weighting the log- likelihood function. Journal of statistical planning and inference, 90(2):227–244, 2000. 12 [53] R. Shu, H. H. Bui, H. Narui, and S. Ermon. A dirt-t approach to unsupervised domain adaptation. arXiv preprint arXiv:1802.08735, 2018. [54] C. Shui, Z. Li, J. Li, C. Gagné, C. X. Ling, and B. Wang. Aggregating from multiple target- shifted sources. In International Conference on Machine Learning, pages 9638–9648. PMLR, 2021. [55] P. Stojanov, M. Gong, J. Carbonell, and K. Zhang. Data-driven approach to multiple-source do- main adaptation. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 3487–3496. PMLR, 2019. [56] P. Stojanov, Z. Li, M. Gong, R. Cai, J. Carbonell, and K. Zhang. Domain adaptation with invari- ant representation learning: What transformations to learn? Advances in Neural Information Processing Systems, 34:24791–24803, 2021. [57] B. Sun, J. Feng, and K. Saenko. Return of frustratingly easy domain adaptation. In Proceedings of the AAAI conference on artificial intelligence, volume 30, 2016. [58] R. Tachet des Combes, H. Zhao, Y.-X. Wang, and G. J. Gordon. Domain adaptation with conditional distribution matching and generalized label shift. Advances in Neural Information Processing Systems, 33:19276–19289, 2020. [59] T. Teshima, I. Sato, and M. Sugiyama. Few-shot domain adaptation by causal mechanism transfer. In International Conference on Machine Learning, pages 9458–9469. PMLR, 2020. [60] F. Träuble, E. Creager, N. Kilbertus, F. Locatello, A. Dittadi, A. Goyal, B. Schölkopf, and In International S. Bauer. On disentangled representations learned from correlated data. Conference on Machine Learning, pages 10401–10412. PMLR, 2021. [61] E. Tzeng, J. Hoffman, N. Zhang, K. Saenko, and T. Darrell. Deep domain confusion: Maximiz- ing for domain invariance. arXiv preprint arXiv:1412.3474, 2014. [62] E. Tzeng, J. Hoffman, K. Saenko, and T. Darrell. Adversarial discriminative domain adaptation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7167–7176, 2017. [63] H. Wang, M. Xu, B. Ni, and W. Zhang. Learning to combine: Knowledge aggregation for multi-source domain adaptation. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part VIII 16, pages 727–744. Springer, 2020. [64] Z. Wang, C. Zhou, B. Du, and F. He. Self-paced supervision for multi-source domain adaptation. In Proceedings of the Thirty-First International Joint Conference on Artificial Intelligence, IJCAI-22, 2022. [65] J. Wen, N. Zheng, J. Yuan, Z. Gong, and C. Chen. Bayesian uncertainty matching for unsuper- vised domain adaptation. arXiv preprint arXiv:1906.09693, 2019. [66] J. Wen, R. Greiner, and D. Schuurmans. Domain aggregation networks for multi-source domain adaptation. In International Conference on Machine Learning, pages 10214–10224. PMLR, 2020. [67] S. Xie, L. Kong, M. Gong, and K. Zhang. Multi-domain image generation and transla- tion with identifiability guarantees. In The Eleventh International Conference on Learning Representations. [68] S. Xie, Z. Zheng, L. Chen, and C. Chen. Learning semantic representations for unsupervised domain adaptation. In International conference on machine learning, pages 5423–5432. PMLR, 2018. [69] R. Xu, Z. Chen, W. Zuo, J. Yan, and L. Lin. Deep cocktail network: Multi-source unsupervised domain adaptation with category shift. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3964–3973, 2018. 13 [70] L. Yang, Y. Balaji, S.-N. Lim, and A. Shrivastava. Curriculum manager for source selection in multi-source domain adaptation. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XIV 16, pages 608–624. Springer, 2020. [71] W. Yao, Y. Sun, A. Ho, C. Sun, and K. Zhang. Learning temporally causal latent processes from general temporal data. arXiv preprint arXiv:2110.05428, 2021. [72] W. Yao, G. Chen, and K. Zhang. Temporally disentangled representation learning. arXiv preprint arXiv:2210.13647, 2022. [73] K. Zhang and L. Chan. Kernel-based nonlinear independent component analysis. In Independent Component Analysis and Signal Separation: 7th International Conference, ICA 2007, London, UK, September 9-12, 2007. Proceedings 7, pages 301–308. Springer, 2007. [74] K. Zhang and L. Chan. Minimal nonlinear distortion principle for nonlinear independent component analysis. Journal of Machine Learning Research, 9(Nov):2455–2487, 2008. [75] K. Zhang, B. Schölkopf, K. Muandet, and Z. Wang. Domain adaptation under target and conditional shift. In International conference on machine learning, pages 819–827. PMLR, 2013. [76] K. Zhang, M. Gong, and B. Schölkopf. Multi-source domain adaptation: A causal view. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 29, 2015. [77] K. Zhang, M. Gong, P. Stojanov, B. Huang, Q. Liu, and C. Glymour. Domain adaptation as a problem of inference on graphical models. Advances in neural information processing systems, 33:4965–4976, 2020. [78] Y. Zhang, T. Liu, M. Long, and M. Jordan. Bridging theory and algorithm for domain adaptation. In International conference on machine learning, pages 7404–7413. PMLR, 2019. [79] H. Zhao, S. Zhang, G. Wu, J. M. Moura, J. P. Costeira, and G. J. Gordon. Adversarial multiple source domain adaptation. Advances in neural information processing systems, 31, 2018. [80] Y. Zheng, I. Ng, and K. Zhang. On the identifiability of nonlinear ica with unconditional priors. In ICLR2022 Workshop on the Elements of Reasoning: Objects, Structure and Causality, 2022. [81] Y. Zhu, F. Zhuang, and D. Wang. Aligning domain-specific distribution and classifier for cross-domain classification from multiple sources. In Proceedings of the AAAI conference on artificial intelligence, volume 33, pages 5989–5996, 2019. [82] Y. Zhu, F. Zhuang, J. Wang, G. Ke, J. Chen, J. Bian, H. Xiong, and Q. He. Deep subdomain adaptation network for image classification. IEEE transactions on neural networks and learning systems, 32(4):1713–1722, 2020. 14 Contents 1 2 Introduction Identifying Target Joint Distribution with Data Generation Process 2.1 Data Generation Process . . . . . . . . . 2.2 Identifying the Target Joint Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Subspace Identifiability for Latent Variables 4 Subspace Identification Guarantee Model 4.1 Variational-Inference-based Neural Architecture . 4.2 Class-aware Conditional Alignment . . . . . . . . 5 Experiments 5.1 Experiments on Simulation Data 5.1.1 Experimental Setup . . . 5.1.2 Results and Discussion . . . . 5.2 Experiments on Real-world Data . 5.2.1 Experimental Setup . . . 5.2.2 Results and Discussion . . . . . . . . . . . . . . . . . . . . . 6 Conclusion 7 Acknowledgements 8 Identify Target Joint Distribution 9 Proof of the Identification of latent variables 9.1 Proof of Subspace Identification . 9.2 Proof of Corollary1.1 . . . . . . . . 9.3 Proof of Blockwise Identification . 10 Implementation Details 11 Experiments 11.1 Simulation Data Experiments . 11.1.1 Model Architecture. . . . . . . 11.1.2 Training Hyper-parameters. 11.2 Real-world Data Experiments . 11.2.1 Dataset Description . . . . . . . . . . . . . . 11.2.2 More Experimental Results . 12 Sensitive Analysis of Hyper-parameters . . . . . . . . . . . . . . . . . . 13 Visualization 14 Related Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 2 3 3 5 5 6 6 6 7 7 7 7 8 9 10 16 16 16 18 20 23 24 24 24 24 24 24 25 25 26 26 14.1 Domain Adaptation . 14.2 Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 27 8 Identify Target Joint Distribution We show how to derive the conditions of identifying the target joint distribution with the help of the proposed data generation process, which is shown in Equation (10). px,y|uT (1) = (2) = (3) = (cid:90) (cid:90) (cid:90) (cid:90) z1 (cid:90) z2 (cid:90) z3 (cid:90) z4 (cid:90) z1 (cid:90) z2 (cid:90) z3 (cid:90) z4 (cid:90) z1 z2 z3 z4 px,y,z1,z2,z3,z4|uT dz1dz2dz3dz4 px,z1,z2,z3,z4|y,uT * py|uT dz1dz2dz3dz4 (10) px|z1,z2,z3,z4 * pz1,z2,z3,z4|y,uT * py|uT dz1dz2dz3dz4. The derivation in Equation (10) can be separated into three steps. (1) We introduce the latent variables z1, z2, z3, and z4, which have mentioned in Section 2.1. (2) We factorize the joint distribution in (1) into px,z1,z2,,z3,,z4|y,uT and py|uT with the help of Bayes Rule. (3), we further use Bayes Rule to factorize px,z1,z2,,z3,,z4|y,uT . Since x is independent of u, y given z1, z2, , z3, , z4, we can obtain px|z1,z2,,z3,,z4 . The aforementioned factorization tells us that we need to model three distributions to identify the target joint distribution. First, we need to model px|z1,z2,z3,z4, implying that we need to model the conditional distribution of observed data give latent variables, which coincides with a generative model for observed data. Second, we need to estimate the label pseudo distribution of target domain py|uT . Third, we need to model pz1,z2,z3,z4|y,uT meaning that the latent variables should be identified with theoretical guarantees. In the next section, we will introduce how to identify these latent variables with subspace identification block-wise identification results. 9 Proof of the Identification of latent variables 9.1 Proof of Subspace Identification Figure 5: A simple data generalization process for introducing subspace identification. In this subsection, we provide proof of the subspace identification based on the data generation process in Figure 5. Theorem 3. (Subspace Identification of zs.) We follow the data generation process in Figure 5 and make the following assumptions: • A1 (Smooth and Positive Density): The probability density function of latent variables is smooth and positive, i.e., pz|u > 0 over Z and U. • A2 (Conditional independent): Conditioned on u, each zi is independent of any other zj for i qi(zi, u) where qi(zi, u) is the log density of i, j ∈ {1, * * * , n}, i ̸= j, i.e. log pz|u(z|u) = (cid:80)n the conditional distribution, i.e., qi : log pzi|u. • A3 (Linear independence): For any zs ∈ Zs ⊆ Rns, there exist ns + 1 values of u, i.e., uj with j = 0, 1, * * * , ns, such that these ns vectors w(z, uj) − w(z, u0) with j = 1, * * * , ns are linearly 16 (cid:3046)(cid:3030) independent, where vector w(z, uj) is defined as follows: ∂qi(zi, u) ∂zi (cid:18) ∂q1(z1, u) ∂z1 w(z, u) = , * * * , , * * * ∂qns (zns, u) ∂zns (cid:19) , (11) By modeling the aforementioned data generation process, zs is subspace identifiable. Proof. We begin with the matched marginal distribution px|u to bridge the relation between z and ˆz. Suppose that ˆg : Z → X is a invertible estimated generating function, we have Equation (12). ∀u ∈ U, pˆx|u = px|u ⇐⇒ pˆg(ˆz)|u = pg(z)|u. (12) Sequentially, by using the change of variables formula, we can further obtain Equation (13) pˆg(ˆz|u) = pg(z|u) ⇐⇒ pg−1◦g(ˆz)|u|Jg−1 | = pz|u|Jg−1 | ⇐⇒ ph(ˆz)|u = pz|u, (13) where h := g−1 ◦ g is the transformation between the ground-true and the estimated latent variables, respectively. Jg−1 denotes the absolute value of Jacobian matrix determinant of g−1. Since we assume that g and ˆg are invertible, |Jg−1| ̸= 0 and h is also invertible. According to A2 (conditional independent assumption), we can have Equation (14). pz|u(z|u) = n (cid:89) i=1 pzi|u(zi|u); pˆz|u(ˆz|u) = n (cid:89) i=1 pˆzi|u(ˆzi|u). For convenience, we take logarithm on both sides of Equation (14) and further let qi log pzi|u, ˆqi := log pˆzi|u. Hence we have: n (cid:88) n (cid:88) log pz|u(z|u) = qi(zi, u); log pˆz|u = ˆqi(ˆzi, u). (14) := (15) By combining Equation (15) and Equation (13), we have: i=1 i=1 pz|u = ph(ˆz|u) ⇐⇒ pˆz|u = pz|u|Jh−1| ⇐⇒ n (cid:88) i=1 qi(zi, u) + log |Jh−1| = n (cid:88) i=1 ˆqi(ˆzi, u), (16) where Jh−1 are the Jacobian matrix of h−1. Sequentially, we take the first-order derivative with ˆzj on Equation (16), where j ∈ {ns + 1, * * * , n}, and have n (cid:88) i=1 ∂qi(zi, u) ∂zi * ∂zi ∂ ˆzj + ∂ log |Jh−1| ∂ ˆzj = ∂qj(ˆzj, u) ∂ ˆzj . (17) Suppose u = u0, u1, * * * , uns , we subtract the Equation (17) corresponding to uk with that corre- sponds to u0, and we have: n (cid:88) i=1 (cid:18) ∂qi(zi, uk) ∂zi (cid:19) − ∂qi(zi, u0) ∂zi * ∂zi ∂ ˆzj = ∂ ˆqj(ˆzj, uk) ∂ ˆzj − ∂ ˆqj(ˆzj, u0) ∂ ˆzj . (18) Since the distribution of estimated ˆzj does not change across different domains, ∂ ˆqj (ˆzj ,uk) ∂ ˆqj (ˆzj ,u0) ∂ ˆzj does not change across different domains, ∂qi(zi,uk) − = ∂qi(zi,u0) ∂zi = 0. Since ∂qi(zi,uk) ∂ ˆzj ∂zi ∂zi for i ∈ {ns + 1, * * * , n}. So we have ns(cid:88) i=1 (cid:18) ∂qi(zi, uk) ∂zi − ∂qi(zi, u0) ∂zi (cid:19) * ∂zi ∂ ˆzj = 0. (19) Based on the linear independence assumption (A3), the linear system is a ns × ns full-rank system. Therefore, the only solution is ∂zi ∂ ˆzj = 0 for i ∈ {1, * * * , ns} and j ∈ {ns + 1, * * * , n}. Since h(*) is smooth over Z, its Jacobian can be formalized as follows (cid:34) Jh = A := ∂zs ∂ˆzs C := ∂zc ∂ˆzs B := ∂zs ∂ˆzc D := ∂zc ∂ˆzc . (cid:35) (20) Note that ∂zi = 0 for i ∈ {1, * * * , ns} and j ∈ {ns + 1, * * * , n} means that B = 0. Since h(*) is ∂ ˆzj invertible, Jh is a full-rank matrix. Therefore, for each zs,i, i ∈ {1, * * * , ns}, there exists a hi such that zs,i = hi(ˆz). 17 9.2 Proof of Corollary1.1 Corollary 3.1. We follow the data generation in Section 3.1, and make the following assumptions which are similar to A1-A3: A4 (Smooth and Positive Density): The probability density function of latent variables is smooth and positive, i.e., pz|u,y > 0 over Z, U, and Y. A5 (Conditional independent): Conditioned on u and y, each zi is independent of any other zj for i, j ∈ {1, * * * , n}, i ̸= j, i.e. log pz|u,y(z|u, y) = (cid:80)n i qi(zi, u, y) where qi(zi, u, y) is the log density of the conditional distribution, i.e., qi : log pzi|u,y. A6 (Linear independence): For any z ∈ Z ⊆ Rn, there exists n1 + n2 + n3 + 1 combination of (u, y), i.e. j = 1, * * * , U and c = 1, * * * , C and U × C + 1 = n1 + n2 + n3, where U and C denote the number of source domains and the number of labels. such that these n′ = n1 + n2 + n3 vectors w(z, uj, yc) − w(z, u0, y0) are linearly independent, where w(z, uj, yc) is defined as follows: w(z, uj, yc) = (cid:18) ∂q1(z1, u, y) ∂z1 , * * * , ∂qi(zi, u, y) ∂zi , * * * ∂qn′(zn′, u, y) ∂zn′ (cid:19) . (21) By modeling the aforementioned data generation process, z2 is subspace identifiable, and z1, z3 can be reconstructed from ˆz1, ˆz2 and ˆz2, ˆz3, respectively. Proof. We begin with the match marginal distribution px|u,y to bridge the relation between z and ˆz. Suppose that ˆg : Z → X is an invertible estimated generating function, we have Equation (22). ∀u ∈ U, y ∈ Y, pˆx|u,y = px|u,y ⇐⇒ pˆg(ˆz)|u,y = pg(z)|u,y. (22) Sequentially, by using the change of variables formula, we can further obtain Equation(23). pˆg(ˆz)|u,y = pg(z)|u,y ⇐⇒ pg−1◦g(ˆz)|u,y|Jg−1| = pz|u,y|Jg−1 | ⇐⇒ ph(ˆz)|u,y = pz|u,y, (23) where h := g−1 ◦ g is the transformation between the ground-true and the estimated latent variables. Jg−1 denotes the absolute value of Jacobian matrix determinant of g−1. Since we assume that g and ˆg are invertible, |Jg−1 | ̸= 0 and h is also invertible. According to A5 (conditional independent assumption), we can have Equation (24). pz|u,y(z|u, y) = n (cid:89) i=1 pzi|u,y(zi|u, y); pˆz|u,y(ˆz|u, y) = n (cid:89) i=1 pˆzi|u,y(ˆzi|u, y). (24) For convenience, we take logarithms on both sides of the Equation(24) and further let qi log pzi|u,y, ˆqi := log pˆzi|u,y. Hence we have: := log pz|u,y(z|u, y) = n (cid:88) i=1 qi(zi, u, y); log p ˆz,y|u = n (cid:88) i=1 ˆqi(ˆzi, u, y). (25) By combining Equation (25) and Equation (23), we have: pz|u,y = ph(ˆz|u,y) ⇐⇒ pˆz|u,y = pz|u,y|Jh−1 | ⇐⇒ n (cid:88) i=1 qi(zi, u, y)+log |Jh−1| = n (cid:88) i=1 ˆqi(ˆzi, u, y), (26) where Jh−1 are the Jacobian matrix of h−1. Sequentially, we take the first-order derivative with ˆzj on Equation (26), where j ∈ {n1 + n2 + n3 + 1, * * * , n}, and have n (cid:88) i=1 ∂qi(zi, u, y) ∂zi * ∂zi ∂ ˆzj + ∂ log |Jh−1| ∂ ˆzj = ∂qj(ˆzj, u, y) ∂ ˆzj . (27) According to A6, there exist n1 + n2 + n3 + 1 conbinations of (u, y), so we subtract the Equation (27) to uk, yl with that corresponds to u0, y0, and we have: n (cid:88) i=1 (cid:18) ∂qi(zi, uk, yl) ∂zi − ∂qi(zi, u0, y0) ∂zi (cid:19) * ∂zi ∂ ˆzj = ∂ ˆqj(ˆzj, uk, yl) ∂ ˆzj − ∂ ˆqj(ˆzj, u0, y0) ∂ ˆzj . (28) 18 Since the distribution of estimated ˆzj does not change across different domains and labels, ∂ ˆqj (ˆzj ,uk,yl) does not change across different domains, ∂ ˆzj ∂qi(zi,uk,yl) ∂zi = 0. Since ∂qi(zi,uk,yl) for i ∈ {1, * * * , n1 + n2 + n3}. So we have: ∂zi (cid:18) ∂qi(zi, uk, yl) ∂zi − ∂qi(zi, u0, y0) ∂zi (cid:19) * ∂zi ∂ ˆzj = 0. (29) − ∂ ˆqj (ˆzj ,u0,y0) ∂ ˆzj = ∂qi(zi,u0,y0) ∂zi n1+n2+n3(cid:88) i=1 Based on the linear independence assumption (A3), the linear system is a n × n full-rank system. Therefore, the only solution is zi = 0 for i ∈ {1, * * * , n1 + n2 + n3} and j ∈ {n1 + n2 + n3 + ˆzj 1, * * * , n}. Since h(*) is smooth over Z, its Jacobian can be formalized as follows Jh =     J 1,1 h J 2,1 h J 3,1 h J 4,1 h J 1,2 h J 2,2 h J 3,2 h J 4,2 h J 1,3 h J 2,3 h J 3,3 h J 4,3 h     J 1,4 h J 2,4 h J 3,4 h J 4,4 h (30) where J ij := ∂zi ∂ˆzj and i, j ∈ {1, 2, 3, 4}. = 0 for i ∈ {1, * * * , n1 + n2 + n3} and j ∈ {n1 + n2 + n3 + 1, * * * , n}, J 3,4 h = 0, J 2,4 h = Since zi ˆzj 0, J 1,4 h = 0. we take the first-order derivative with ˆzj on Equation (26), where j ∈ {n1 + n2 + 1, * * * , n}, and have n (cid:88) i=1 ∂qi(zi, u, y) ∂zi * ∂zi ∂ ˆzj + ∂ log |Jh−1| ∂ ˆzj = ∂qj(ˆzj, u, y) ∂ ˆzj . (31) Then we fix the value of y be y0, so there exist U combinations of (u, y0). We subtract the Equation (31) corresponds to (uk, y0) with that corresponds to (u0, y0) and have: n (cid:88) i=1 (cid:18) ∂qi(zi, uk, y0) ∂zi − ∂qi(zi, u0, y0) ∂zi (cid:19) * ∂zi ∂ ˆzj = ∂ ˆqj(ˆzj, uk, y0) ∂ ˆzj − ∂ ˆqj(ˆzj, u0, y0) ∂ ˆzj . (32) Since the distribution of estimated ˆzj does not change across different domains, ∂ ˆqj (ˆzj ,uk,y0) ∂ ˆqj (ˆzj ,u0,y0) does not change across different domains, ∂qi(zi,uk,y0) ∂ ˆzj ∂qi(zi,u0,y0) ∂zi = 0. Since ∂qi(zi,uk,y0) ∂zi for i ∈ {1, * * * , n1 + n2}. So we have: ∂ ˆzj ∂zi − = n1+n2(cid:88) i=1 (cid:18) ∂qi(zi, uk, y0) ∂zi − ∂qi(zi, u0, y0) ∂zi (cid:19) * ∂zi ∂ ˆzj = 0. (33) Based on the linear independence assumption (A3), the linear system is a n × n full-rank system. Therefore, the only solution is zi = 0 for i ∈ {1, * * * , n1 + n2} and j ∈ {n1 + n2 + 1, * * * , n}. ˆzj Combining Equation (30), we can find that J 1,3 Similarly, we let j ∈ {1, * * * , n1} (cid:83){n1 + n2 + n3 + 1, * * * , n} and have: h = 0, and J 2,4 h = 0, J 1,4 h = 0, J 2,3 h = 0. n (cid:88) i=1 ∂qi(zi, u, y) ∂zi * ∂zi ∂ ˆzj + ∂ log |Jh−1| ∂ ˆzj = ∂qj(ˆzj, u, y) ∂ ˆzj . (34) Then fix the value of u be u0, so there exist C combinations of (u0, yl). We subtract the Equation (34) corresponds to (u0, yl) with that corresponds to (u0, y0) and have: n1+n2+n3(cid:88) i=n1+1 (cid:18) ∂qi(zi, u0, yl) ∂zi − ∂qi(zi, u0, y0) ∂zi (cid:19) * ∂zi ∂ ˆzj = ∂ ˆqj(ˆzj, u0, yl) ∂ ˆzj − ∂ ˆqj(ˆzj, u0, y0) ∂ ˆzj . (35) 19 Based on the linear independence assumption (A3), the linear system is a n × n full-rank system. = 0 for i ∈ {n1+1, * * * , n1+n2+n3} and j ∈ {1, * * * , n1} (cid:83){n1+ Therefore, the only solution is zi ˆzj n2 + n3 + 1, * * * , n}. Combining Equation (30), we can find that J 2,1 h = 0, and J 3,4 h = 0. h = 0, J 3,1 h = 0, J 2,4 In summary, Equation (30) can be written as follows Jh =     J 1,1 J 1,2 h h J 2,1 h = 0 J 2,2 h = 0 J 3,2 J 3,1 h J 4,2 J 4,1 h h h J 1,3 h = 0 J 1,4 h = 0 J 2,4 J 2,3 J 3,4 J 3,3 h J 4,3 h h = 0 h = 0 h = 0 J 4,4 h     . (36) Since h(*) is invertible, Jh is a full-rank matrix. Therefore, for each z2,i, i ∈ {n1 + 1, * * * , n1 + n2}, there exists a h2,i such that z2,i = hi(ˆz2). Moreover, for each z1,i, i ∈ {1, * * * , n1 + 1}, there exists a h1,i such that z1,i = h1,i(ˆz1, ˆz2). And for each z3,i, i ∈ {n1 + n2 + 1, * * * , n1 + n2 + n3}, there exists a h3,i such that z3,i = h3,i(ˆz2, ˆz3). 9.3 Proof of Blockwise Identification Lemma 4. [30] Following the data generation process in Section 2.1 and the assumptions A4-A6 in Theorem 3, we further make the following assumption: • A7 (Domain Variability: For any set Az ⊆ Z) with the following two properties: 1) Az has nonzero probability measure, i.e. P[z ∈ Az|{u = u′, y = y′}] > 0 for any u′ ∈ U and y′ ∈ Y. 2) Az cannot be expressed as Bz4 × Z1 × Z2 × Z3 for any Bz4 ⊂ Z4. ∃u1, u2 ∈ U and y1, y2 ∈ Y, such that (cid:82) z∈Az generation process in Section 2.1, the z4 is block-wise identifiable. pz|u1,y1dz ̸= (cid:82) z∈Az pz|u2,y2 dz. By modeling the data Proof. We divide the proof into four steps for better understanding. In Step 1, we leverage the properties of the data generation process and the marginal distribution matching condition to express the marginal invariance with the indeterminacy transformation h : Z → Z between the estimated and the ground-truth latent variables. The introduction of h(*) allows us to formalize the block-identifiability condition. In Step 2 and Step 3, we show that the estimated ˆz4 does not depend on the ground-truth changing variables, i.e., z1, z2, z3, that is, h4(z) does not depend on the input {z1, z2, z3}. To this end, in Step 2, we derive its equivalent statements which can ease the rest of the proof and avert technical issues (e.g. sets of zero probability measures). In Step 3, we prove the equivalent statement by contradiction. Specifically, we show that if ˆz4 depends of z1, z2, z3, the invariance derived in Step 1 would break. In Step 4, we use the conclusion in Step 3, the smooth and bijective properties of h(*), and the conclusion in Corollary 1.1, to show the invertibility of the indeterminacy function between the ground-truth z4 and estimated ˆz4, i.e. the mapping ˆz4 = h4(z4) being invertible. Step 1. As the data generation process in Section 2.1 establishes the independence between the generation process ˆz4 ∼ pˆz4 and u it follows that for any Az4 ⊆ Z4, we let ns = n1 + n2 + n3, then we have: ∀u1, u2 ∈ U, y1, y2 ∈ Y P (cid:2){ˆg−1 ns:n(ˆx) ∈ Az4}|{u = u1, y = y1}(cid:3) = P (cid:2){ˆg−1 ns:n(ˆx) ∈ Az4}|{u = u2, y = y2}(cid:3) ⇐⇒ (37) ∀u1, u2 ∈ U, y1, y2 ∈ Y P (cid:2)ˆx ∈ (ˆg−1 ns:n)−1(Az4)|{u = u1, y = y1}(cid:3) = P (cid:2)ˆx ∈ (ˆg−1 ns:n)−1(Az4 )|{u = u2, y = y2}(cid:3) , where ˆg−1 variables; and (ˆg−1 observations ˆx originating from z4 in Az4 . ns:n : X → Z4 denotes the estimated transformation from the observation to the z4 latent ns:n)−1(Az4) ⊆ X is the pre-image set of Az4 , that is , the set of estimated 20 Because of the matching observation distributions between the estimated model and the true model, the relation in the Equation (37) can be extended to observation x from the true generating process, i.e., P (cid:2){x ∈ (ˆg−1 ns:n)−1(Az4)}|{u = u1, y = y1}(cid:3) = P (cid:2){x ∈ (ˆg−1 ns:n)−1(Az4)}|{u = u2, y = y2}(cid:3) P (cid:2){ˆg−1 ns:n(x) ∈ Az4 }|u = u1, y = y1 ⇐⇒ (cid:3) = P (cid:2){ˆg−1 ns:n(x) ∈ Az4}|u = u2, y = y2 (cid:3) . (38) Since g and ˆg are smooth and injective, there exists a smooth and injective h = ˆg−1 ◦ g : Z → Z. We note that by definition h = h where h is introduced in the proof of Theorem 3. Expressing ˆg−1 = h ◦ g−1 and h4(*) := hns:n(*) : Z → Z4 in Equation (38) yields P (cid:2){h4(z) ∈ Az4}|{u = u1, y = y1}(cid:3) = P (cid:2){h4(z) ∈ Az4}|{u = u2, y = y2}(cid:3) ⇐⇒ P (cid:104) {z ∈ h (cid:105) −1 4 (Az4)}|{u = u1, y = y1} = P (cid:104) {z ∈ h −1 4 (Az4)}|{u = u2, y = y2} (cid:105) (39) (cid:90) z∈h−1 4 (Az4 ) ⇐⇒ (cid:90) pz|u,y(z|u1, y1)dz = pz|u,y(z|u2, y2)dz, z∈h−1 4 (Az4 ) −1 4 (Az4) = {z ∈ Z : h4(z) ∈ Az4 } is the pre-image of Az4, i.e., those latent variables where h containing z4 in Az4 after the indeterminacy transformation h. Based on the proposed generation process in Section 2.1, we rewrite Equation (39) as follows: ∀Az4 ⊆ Z4, (cid:90) 4 ]⊤∈h−1 2 ,z⊤ 3 ,z⊤ 1 ,z⊤ [z⊤ − pz1,z2,z3|u,y(z1, z2, z3|u2, y2))dz1dz2dz3dz4 = 0 4 (Az4 ) pz4 (z4)(pz1,z2,z3|u,y(z1, z2, z3|u1, y1) (40) 1 , z⊤ := Step 2.In order to show the block-identifiability of z4, we would like to prove that zc h([z⊤ 4 ]⊤) does not depend on z1:ns . To this end, we first develop one equivalent state- ment (i.e., State 3 below) and prove it in a later step instead. By doing so, we are able to leverage the full-support density function assumption to avert technical issues. 3 , z⊤ 2 , z⊤ • Statement 1: h4([z⊤ 1 , z⊤ 2 , z⊤ 3 , z⊤ 4 ]⊤) does not depend on z1:ns • Statement 2: ∀z4 ∈ Z4, it follows that h −1 4 = Bz4 × Z1 × Z2 × Z3 where Bz4 ̸= ∅ and Bz4 ⊆ Z4. • Statement 3: ∀z4 ∈ Z4, r ∈ R+, it follows that h Br(z4) := {z′ 4 ∈ Z4 : ||z′ 4 − z4||2 < r}, B+ z4 −1 4 (Br(z4)) = B+ z4 ̸= ∅, and B+ ⊆ Z4. z4 × Z1 × Z2 × Z3 where Statement 2 is a mathematical formulation of Statement 1. Statement 3 generalizes singletons z4 in Statement 2 to open, non-empty balls Br(z4). Later, we use Statement 3 in Step 3 to show the contraction to Equation (40). Leveraging the continuity of h4(*), we can show the equivalence between Statement 2 and Statement −1 3 as follows. We first show that Statement 2 implies Statement 3. ∀z4, r ∈ R+, h c (B(z4)) = (cid:83) 4). Statement 2 indicates that every participating sets in the union satisfies −1 c (Br(z4)) also satisfies this property, which is × Z1 × Z2 × Z3, thus the union h 4 (z′ 4∈Br(z4) h−1 z′ h−1 4) = B′ 4 (z′ z4 Statement 3. Then, we show that Statement 3 implies Statement 2 by contradiction. Suppose that Statement 2 is false, then ∃ˆz4 ∈ Z4 such that there exist ˆzB ∈ Zns 4 ∈ {zns:n : z ∈ h −1 4 (ˆz4)} and ˆzB ns 21 4 (Bˆr(ˆzc)) = ˆBz4 × Zns . By definition of ˆzB, it is clear that ˆzB )⊤]⊤. As h4(*) is continuous, there exists resulting in h4(ˆzB) ̸= ˆz4 where ˆzB = [(ˆzB ˆr ∈ R+ such that h4(ˆzB) /∈ Bˆr(ˆz4). That is, ˆzB /∈ h−1 4 (Bˆr(ˆz4)). Also, Statement 4 suggests ns:n ∈ ˆBz4. The fact that that h−1 ˆzB /∈ h−1 4 (Bˆr(ˆz4)) contradicts Statement 3. Therefore, Statement 2 is true under the premise of Statement 3. We have shown that Statement 3 implies Statement 2. In summary, Statement 2 and Statement 3 are equivalent, and therefore proving Statement 3 suffices to show Statement 1. 4 )⊤, (ˆzB ns −1 4 (Br(z4)) could be partitioned into two parts (i.e. B∗ Step 3. In this step, we prove State 3 by contradiction. Intuitively, we show that if h4(*) depended on )\B∗ ˆz1, ˆz2, ˆz3, the preimage h z defined below). The dependency between h4(*) and ˆz4 is captured by B∗ z , which would not emerge z also exists when h4(*) does not depend on ˆz1, ˆz2, ˆz3. We evaluate the otherwise. In contrast, h invariance relation Equation (40) and show that the integral over h z is always 0, however, the integral over B∗ z is necessarily non-zero, which leads to the contraction with Equation (40) and thus show the h4(*) cannot depend on ˆz1, ˆz2, ˆz3, −1 4 (A∗ z4 −1 4 (A∗ z4 −1 4 \B∗ z and h )\B∗ −1 First, note that because Br(z4) is open and h4(*) is continuous, the pre-image h 4 (Br(z4)) is open. In addition, the continuity of h(*) and the matched observation distributions ∀u′ ∈ U, P[{x ∈ Ax}|{u = u′, y = y′}] = P[{ˆx ∈ Ax}|{u = u′, y = y′}] lead to h(*) being bijection as shown −1 4 (Br(z4)) is both non-empty and in [29], which implies that h open. Suppose that ∃A∗ z = {z ∈ Z : z ∈ z4 −1 c (A∗ h ), {zns:n} × Zns z contains the partition of the pre-image z4 ∗ 4(A∗ z) that the style part z1:ns can not take on any value in Z1, Z2, Z3. Only certain values of the h style part were able to produce specific outputs of indeterminacy h4(*). Clearly, this would suggest that h4(*) depends on z4. To show contraction with Equation (40), we evaluate the LHS of Equation (40) with such a A∗ −1 4 (Br(z4)) is non-empty. Hence, h := Br∗ (z∗ −1 ⊈ h 4 (A∗ z4 4 where z∗ )} ̸= ∅. Intuitively, B∗ 4 ∈ Z4, r∗ ∈ R+, such that B∗ z4: (cid:90) (cid:90) (cid:124) (cid:90) (cid:124) = + [z⊤ 1 ,z⊤ 2 ,z⊤ 3 ,z⊤ 4 ]⊤∈h−1 4 (A∗ z4 [z⊤ 1 ,z⊤ 2 ,z⊤ 3 ,z⊤ 4 ]⊤∈h−1 4 (A∗ z4 Pz4 (z4) (cid:0)pz1,z2,z3|u,y(z1, z2, z3|u1, y1) − pz1,z2,z3|z,y(z1, z2, z3|u2, y2)(cid:1) dz1dz2dz3dz4 ) Pz4 (z4) (cid:0)pz1,z2,z3|u,y(z1, z2, z3|u1, y1) − pz1,z2,z3|u,y(z1, z2, z3|u2, y2)(cid:1) dz1dz2dz3dz4 )\B∗ z (cid:123)(cid:122) T1 (cid:125) [z⊤ 1 ,z⊤ 2 ,z⊤ 3 ,z⊤ 4 ]⊤∈B∗ z Pz4 (z4) (cid:0)pz1,z2,z3|u,y(z1, z2, z3|u1, y1) − pz1,z2,z3|u,y(z1, z2, z3|u2, y2)(cid:1) dz1dz2dz3dz4 (cid:123)(cid:122) T2 (cid:125) (41) We first look at the value of T1. When h −1 4 (A∗ we can rewrite h z4 follows that z as C ∗ z4 )\B∗ )\B∗ −1 4 (A∗ z4 × Z1 × Z2 × Z3 where C ∗ z4 z = ∅, T1 evaluates to 0. Otherwise, by definition, ⊂ Z4. With this expression, it Pz4 (z4) (cid:0)pz1,z2,z3|u,y(z1, z2, z3|u1, y1) − pz1,z2,z3|u,y(z1, z2, z3|u2, y2)(cid:1) dz1dz2dz3dz4 (cid:90) (cid:90) (cid:90) = = z4∈C∗ z4 z4∈Cz∗ 4 [z⊤ 1 ,z⊤ 2 ,z⊤ 3 ,z⊤ 4 ]⊤∈C∗ C∗ z (cid:90) pz4 (z4) (cid:90) (cid:90) z1∈Z1 z2∈Z2 z3∈Z3 pz4 (z4)(1 − 1)dz4 = 0. (pz1,z2,z3|u,y(z1, z2, z3|u1, y1) − pz1,z2,z3|u,y(z1, z2, z3|u2, y2))dz1dz2dz3dz4 (42) Therefore, in both cases T1 evaluates to 0 for A∗ z4. Now, we address T2. As discuss above, h of h4(*), ∀zB ∈ B∗ (u, z, y), we have P[{z ∈ B∗ −1 4 (A∗ z4 z , there exists r(zB) ∈ R+ such that Br(zB )(zB) ⊆ B∗ ) is open and non-empty. Because of the continuity z . As pz|u,y > 0 over z }|{u = u′, y = y′}] ≥ P[{z ∈ Br(zB )(zB)}|{u = u′, y = y′}] > 0 22 for any z′ ∈ U, y ∈ Y. Assumption A7 indicates that ∃u∗ 1, u∗ 2, such that T2 := (cid:90) [z⊤ 1 ,z⊤ 2 ,z⊤ 3 ,z⊤ 4 ]⊤∈B∗ z Pz4(z4) (cid:0)pz1,z2,z3|u,y(z1, z2, z3|u1, y1) (43) − pz1,z2,z3|u,y(z1, z2, z3|u2, y2)(cid:1) dz1dz2dz3dz4 ̸= 0. Therefore, for such A∗ z4 , we would have T1 + T2 ̸= 0 which leads to contradiction with Equation (40). We have proved by contradiction that Statement 3 is true and hence Statement 1 holds, that is, h4(*) does not depend on the changing variables z1, z2, z3. Step 4.With the knowledge that h4(*) does not depend on the changing variables z1, z2, z3, we now show that there exists an invertible mapping between the true z4 and the estimated z4. As h(*) is smooth over Z, its Jacobian can written as:   , (44)         Jh = denotes ∂ˆzi ∂ˆzj J 1,2 h J 2,2 h J 3,2 h J 4,2 h J 1,3 h J 2,3 h J 3,3 h J 4,3 h J 1,1 h J 2,1 h J 3,1 h J 4,1 h J 1,4 h J 2,4 h J 3,4 h J 4,4 h in which J i,j , i, j ∈ {1, 2, 3, 4}; and we use notation ˆz4 = h(z)ns:n, ˆz1 = h(z)1:n1 , h ˆz2 = h(z)n1+1:n2 , ˆz3 = h(z)n1+n2+1:n3. As we have shown that ˆz4 does not depend on the = 0, J 4,3 changing variables z1, z2, z3, if follows J 4,1 = 0, J 4,2 = 0. On the other hand, as h(*) must be non-singular. We note that J 4,4 is invertible over Z, Jh is non-singular. Therefore, J 4,4 ′ 4 := hc(z) : Z4 → Z4, which takes only the z4 of the input z into is the Jacobian of the function h h4. According to Corollary 1.1, we also find that J 1,4 = 0. Together with the ′ invertibility of h, we can conclude that h 4 is invertible. Therefore, there exists an invertible function ′ ′ 4 between the estimated and the true variables such that ˆz4 = h h 4(z4), which concludes the proof that z4 is block identifiable via ˆg−1(*). = 0, J 2,4 = 0, J 3,4 h h h h h h h h 10 Implementation Details Table 5: Implementation details of the SIG model in different datasets. Datasets Encoder Decoder learning rate α β z1 dimension z2 dimension z3 dimension z4 dimension Optimizer Momentum batch size backbone Office-Home 2-layers MLPs 2-layers MLPs 0.008 1.00E-05 0.1 2 128 128 10 SGD 0.9 32 ResNet50 ImageCLEF 2-layers MLPs 2-layers MLPs 0.01 1.00E-05 0.1 4 128 10 4 SGD 0.9 32 ResNet50 PACS 2-layers MLPs 2-layers MLPs 0.01 1.00E-05 0.1 2 60 24 2 SGD 0.9 32 ResNet18 DomainNet 1-layers MLPs 2-layers MLPs 0.001 1.00E-05 0.1 2 2048 32 2 SGD 0.9 100 ResNet101-based CAN The implementation details of the proposed SIG model are shown in Table 1. For Office-Home and ImageCLEF datasets, we employ the pre-trained ResNet50 as the backbone networks. For the PACS dataset, we use the pre-trained ResNet18 as the backbone network. It is noted that we employ a ResNet101-based cross-attention network (CAN) as the backbone network, which is shown in Figure 6. In CAN, we inject a cross-attention module into each block of the pre-trained ResNet. Technologically, we use the input feature (e.g. f1 in Figure 6) and the domain index to calculate the weights wc. Sequentially, we take wc ⊙ f1 as the input of the pre-trained ResNet Layers and obtain the output of each block. 23 Figure 6: A illustrate framework of the ResNet101-based cross-attention networks (CAN). In each block of the ResNet101, we use the domain information and the inputs of each block to calculate the weights wc of each dimension of the feature, which dynamically selects the most relevant features. 11 Experiments 11.1 Simulation Data Experiments We provide more details for the simulation experiments. First, we introduce the details of model architecture for simulation experiments. Second, we further provide the training hyper-parameters. 11.1.1 Model Architecture. For the model architecture of our simulation experiments, the variational auto-encoder (VAE) encoder and decoder are 1-layer MLPs with a hidden dimension of 200, a ReLU activation function, a batch normalization layer, and a dropout layer. 11.1.2 Training Hyper-parameters. We use an SGD optimizer with a momentum of 0.9 to train VAE models with 50 epochs. We also use a learning rate of 0.0035 with a batch size of 768. For the VAE training, we set the hyper-parameters of the KL loss to 1. 11.2 Real-world Data Experiments We provide implementation details of real-world data experiments. First, we provide detailed descriptions of Office-Home, ImageCLEF, PACS, and DomainNet datasets. Second, we show more experiment results, including more baselines, the mean, and the standard deviation of the results. 11.2.1 Dataset Description Office-Home is a benchmark dataset with 4 domains, where each domain contains 65 categories. These four domains are shown as follows: Art contains artistic images in the form of sketches, paintings, ornamentation, etc.; Clipart contains the collection of clipart images; Product contains images of objects without a background and Real-World contains images of objects captured with a regular camera. ImageCLEF is a standard domain adaptation benchmark dataset for image classification, consisting of three domains: Caltech-256(C), ImageNet ILSVRC(I), and Pascal VOC2012(P), consisting of 12 classes. PACS is a domain adaptation dataset with 9991 images from 4 domains of different styles: Photo, Artpainting, Cartoon, and Sketch. It is noted that these domains are shared with the same 7 categories. DomainNet is a challenging domain adaptation benchmark with 0.6 million images of 345 categories of 6 different styles: clipart, infograph, painting, quickdraw, real, and sketch. 24 BlockBlockBlock...xf(cid:3041)uf(cid:2870)f(cid:2870)f(cid:2869)uw(cid:3030)⊙f(cid:2869)Average Pooling+1-Layer MLP+1-Layer CNN f(cid:2869)1-Layer MLP w(cid:3030)1-Layer MLP Pre-trained ResNetLayersf(cid:2870) 11.2.2 More Experimental Results To show the effectiveness of the proposed SIG model, we further consider more compared methods. Experiment results for Office-Home, ImageCLEF, PACS, and DomainNet are shown in Table 6, 7, 8, and 9, respectively. Note that We report the mean and the standard deviation of our method over 3 random seeds (i.e. 3,4,5). Table 6: Classification results on the Office-home datasets. We employ ResNet50 as the backbone network. Baseline results are taken from ([30]). Models Art Clipart Product RealWorld Average Source Only [16] DANN [11] DANN+BSP [7] DAN [40] MCD [50] DCTN [69] MIAN-γ [45] iMSDA [30] 64.5 (0.68) 64.2 (0.59) 66.1 (0.27) 68.2 (0.45) 67.8 (0.38) 66.9 (0.60) 69.8 (0.35) 75.4 (0.86) 52.3 (0.63) 58.0 (1.55) 61.0 (0.39) 57.9 (0.65) 59.9 (0.55) 61.8 (0.46) 64.2 (0.68) 61.4 (0.73) 77.6 (0.23) 76.4 (0.47) 78.1 (0.31) 78.4 (0.05) 79.2 (0.61) 79.2 (0.58) 80.8 (0.37) 83.5 (0.22) 80.7 (0.81) 78.8 (0.49) 79.9 (0.13) 81.9 (0.35) 80.9 (0.18) 77.7 (0.59) 81.4 (0.24) 84.4 (0.38) SIG 76.4 (0.37) 63.9 (0.34) 85.4 (0.36) 85.8 (0.22) 68.8 69.3 71.2 71.6 71.9 71.4 74.1 76.1 77.8 Table 7: Classification results on the ImageCLEF datasets. We employ ResNet50 as the backbone network. Baseline results are taken from ([47]). Mode I,C→P I,P→C P,C→I Average Source Only [16] DAN [40] ADDA [62] DANN [11] D-CORAL [57] DSBN [4] DSAN [82] MFSAN [81] PTMDA [47] 77.2 77.6 76.5 77.9 77.1 77.7 (0.2) 77.6 (0.2) 79.1 79.1 (0.2) 92.3 93.3 94.0 93.7 93.6 94.1 (0.3) 95.1 (0.1) 95.4 97.3 (0.3) 88.1 92.2 93.2 91.8 91.7 91.9 (0.1) 91.4 (0.6) 93.6 94.1 (0.3) SIG 79.3 (0.57) 97.3 (0.34) 94.3 (0.07) 85.8 87.7 87.0 87.8 87.5 87.9 88.1 89.4 90.1 90.3 Table 8: Classification results on the PACS datasets. We employ ResNet18 as the backbone network. Baseline results are taken from ([30]). Model A C P S Average Source Only [16] DANN [11] MDAN [79] WBN [43] MCD [50] M3SDA [46] CMSS [70] LtC-MSDA [63] T-SVDNet [33] iMSDA [30] 74.9 (0.88) 81.9 (1.13) 79.1 (0.36) 89.9 (0.28) 88.7 (1.01) 89.3 (0.42) 88.6 (0.36) 90.1 90.4 93.7 (0.32) 72.1 77.5 (1.26) 76.0 (0.73) 89.7 (0.56) 88.9 (1.53) 89.9 (1.00) 90.4 (0.80) 90.4 90.6 92.4 (0.23) 94.5 91.8 (1.21) 91.4 (0.85) 97.4 (0.84) 96.4 (0.42) 97.3 (0.31) 96.9 (0.27) 97.2 98.5 98.4 (0.07) 64.7 (1.53) 74.6 (1.03) 72.0 (0.80) 58.0 (1.51) 73.9 (3.94) 76.7 (2.86) 82.0 (0.59) 81.5 85.4 89.2 (0.73) SIG 94.0 (0.07) 93.6 (0.49) 98.6 (0.06) 89.5 (0.71) 76.7 81.5 79.6 83.8 87 88.3 89.5 89.8 91.2 93.4 93.9 12 Sensitive Analysis of Hyper-parameters We also consider the sensitive analysis of α and β, which is shown in Figure 7(a) and 7(b). In detail, we consider different values of α ({0.1, 0.3, 0.5, 0.7, 0.9, 1.1, 1.3}). According to the experiment results, we find that the model performance is stable with α. We also try different values of β ({1e − 5, 3e − 5, 5e − 5, 7e − 5, 9e − 5, 1e − 4, 5e − 4, 1e − 3}), we find that the model performance 25 Table 9: Classification results on the DomainNet datasets. We employ ResNet101 as the backbone network. Baseline results are taken from ([34] and [64]). Model Clipart Infograph Painting Quickdraw Real Sketch Average Source Only [16] 52.1 (0.51) 23.4 (0.28) 47.6 (0.96) 13.0 (0.72) 60.7 (0.23) 46.5 (0.56) ADDA [62] 47.5 (0.76) 11.4 (0.67) 36.7 (0.53) 14.7 (0.50) 49.1 (0.82) 33.5 (0.49) MCD [50] 58.4 (0.65) 43.5 (0.57) 54.3 (0.64) 22.1 (0.70) 45.7 (0.63) DANN [11] 62.0 (0.66) 51.7 (0.19) 60.6 (0.42) 25.8 (0.43) 50.4 (0.51) DCTN [69] 53.5 (0.56) 47.3 (0.47) 48.6 (0.73) 23.5 (0.59) 48.8 (0.63) M3SDA-β [46] 58.6 (0.53) 26.0 (0.89) 52.3 (0.55) 62.7 (0.51) 49.5 (0.76) ML_MSDA [35] 61.4 (0.79) 26.2 (0.41) 51.9 (0.20) 19.1 (0.31) 57.0 (1.04) 50.3 (0.67) meta-MCD [32] 62.8 (0.22) 21.4 (0.07) 50.5 (0.08) 15.5 (0.22) 64.6 (0.16) 50.4 (0.12) LtC-MSDA [63] 63.1 (0.5) 53.8 (0.6) CMSS [70] 64.2 (0.18) 28.0 (0.20) 53.6 (0.39) 16.9 (0.12) 63.4 (0.21) 53.8 (0.35) DRT+ST [34] 71.0 (0.21) 31.6 (0.44) 61.0 (0.32) 12.3 (0.38) 71.4 (0.23) 60.7 (0.31) SPS [64] PFDA [10] 7.6 (0.49) 7.70.68) 7.2 (0.46) 6.3 (0.58) 16.3 (0.5) 66.1 (0.6) 28.7 (0.7) 56.1 (0.5) 19.4 17.2 57.6 55.1 70.8 64.5 24.6 29.2 67.5 67.2 55.2 57.6 SIG 72.7 (0.42) 32.0 (0.71) 60.9 (0.87) 20.5 (0.71) 72.4 (0.14) 59.5 (0.70) 40.6 32.2 38.5 43.0 38.2 42.6 44.3 44.2 47.4 46.5 51.3 49.2 48.5 53.0 is stable in the range of 1e − 5 ∼ 5e − 4, but it drop slightly when the value of β becomes too large, e.g. 1e − 3. (a) Sensitive results of α (b) Sensitive results of β Figure 7: Sensitive analysis of α and β on the → Task in Office-Home. 13 Visualization To evaluate the effectiveness of the SIG model qualitatively, we also provide the visualization results in t-SNE as shown in Figure 8. According to the visualization, we can find that our SIG model can generate the features with a more clear class boundary. 14 Related Works 14.1 Domain Adaptation Domain adaptation [3, 75, 36, 30, 76, 77, 65, 54, 49] leverages the knowledge from the labeled source data and unlabeled target data to build a model with ideal generalization. Several researchers solve the challenges of domain adaptation from different perspectives. One of the most conventional directions is to learn the domain-invariant representation [2], which is raised by [11]. Specifically, the key idea of these methods is to extract the domain-invariant representation by aligning the features from different domains. Some researchers [41] use maximum mean discrepancy (MMD) to realize the domain alignment. Tzeng et.al [61] extract the domain-invariant representation by using an adaptation layer and a domain confusion loss. Another type of idea assumes that the conditional distributions P (z|y) are stable across domains and extract the domain-invariant representation condition on each class [6, 5, 26]. Specifically, Xie et.al [68] minimize the domain discrepancy of inter-class features; Shu et.al [53] consider that the decision boundaries should not cross high-density data regions so they propose the virtual adversarial domain adaptation model. Target shift [75, 37, 66, 12, 48] is also common in domain adaptation, which assumes py|u varies with different domains. Shui et.al 26 ������������������������������������������������������������������������������������������������������������������������������������������ (a) iMSDA (b) SIG Figure 8: The t-SNE visualizations of learned features on the → Art task in Office-Home. Red: source domains, Blue: target domain. [54] propose a unified framework to select relevant sources based on the similarity of the conditional distribution. And Remi et.al [58] analyze the generalized label shift and further provide theoretical guarantees on the transfer performance of any classifier. Recently, several researchers address the domain adaptation problem from the lens of causality [30, 42, 59, 8, 13, 55]. Zhang et.al [75] assume that P (y) and P (x|y) change independently, and raise the target shift, conditional shift, and generalized target shift assumptions. Cai et.al [3] employ the causal generation process to extract the disentangled semantic representation. Based on the causal analysis, Petar et.al [56] find that the domain-invariant should be extracted with the help of domain knowledge, so they propose domain-specific adversarial networks. Despite the outstanding performance of the aforementioned methods, these methods are built on the ad-hoc causal generation process and can not identify the latent variables. In the paper, the proposed SIG method is built on a more general causal generation process and identifies the latent variables with the help of the subspace identification guarantee. 14.2 Identification To endow more explanation and generalization for the deep generative model, causal representation learning [51, 31, 38, 39, 80, 60], which captures the underlying factors and describe the latent generation process, is receiving more and more attention. One of the most classical approaches to learn the causal representation is the independent component analysis (ICA) [22, 18, 74, 73, 67, 9], in which the generation process is assumed to be a linear mixture function. However, the nonlinear ICA is a challenging task since the latent variables are not identifiable without any extra assumptions on the distribution of latent variables or the generation process [21, 80, 24, 28]. Recently, Aapo et.al [19, 20, 23, 27, 15, 14] provide the identification theories by introducing auxiliary variables, e.g. domain indexes, time indexes, and class label. These methods usually assume that the latent variables are conditionally independent and follow the exponential families. Recently, Zhang et.al [30, 67] break the restriction of exponential families assumption and propose the component-wise identification results for nonlinear ICA with a certain number of auxiliary variables. Following these theoretical results, Yao et.al [72, 71] recover time-delay latent causal variables and identify their relations from sequential data under the stationary environment and different distribution shifts. Xie et.al [67] employ the nonlinear ICA to reconstruct the joint distribution of images from different domains; and Kong et.al [30] use the component-wise identification results to solve the domain adaptation problem. However, existing identification results heavily rely on a sufficient number of domains and the too-strong monotonic transformation of latent variables, which is hard to be satisfied in practice. In this paper, we propose the subspace identification results, which only rely on fewer auxiliary variables compared with component-wise identification and do not rely on any monotonic transformation assumptions. 27
http://arxiv.org/abs/2310.04706v3
"2023-10-17T02:11:38"
"2023-10-07T06:52:18"
Offline Imitation Learning with Variational Counterfactual Reasoning
In offline Imitation Learning (IL), an agent aims to learn an optimal expert behavior policy without additional online environment interactions. However, in many real-world scenarios, such as robotics manipulation, the offline dataset is collected from suboptimal behaviors without rewards. Due to the scarce expert data, the agents usually suffer from simply memorizing poor trajectories and are vulnerable to the variations in the environments, lacking the capability of generalizing to new environments. To effectively remove spurious features that would otherwise bias the agent and hinder generalization, we propose a framework named \underline{O}ffline \underline{I}mitation \underline{L}earning with \underline{C}ounterfactual data \underline{A}ugmentation (OILCA). In particular, we leverage the identifiable variational autoencoder to generate \textit{counterfactual} samples. We theoretically analyze the counterfactual identification and the improvement of generalization. Moreover, we conduct extensive experiments to demonstrate that our approach significantly outperforms various baselines on both \textsc{DeepMind Control Suite} benchmark for in-distribution robustness and \textsc{CausalWorld} benchmark for out-of-distribution generalization.
[ "Bowei He", "Zexu Sun", "Jinxin Liu", "Shuai Zhang", "Xu Chen", "Chen Ma" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04706v3", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04706v3", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
http://arxiv.org/abs/2310.04704v1
"2023-10-07T06:48:07"
"2023-10-07T06:48:07"
EdgeFD: An Edge-Friendly Drift-Aware Fault Diagnosis System for Industrial IoT
Recent transfer learning (TL) approaches in industrial intelligent fault diagnosis (FD) mostly follow the "pre-train and fine-tuning" paradigm to address data drift, which emerges from variable working conditions. However, we find that this approach is prone to the phenomenon known as catastrophic forgetting. Furthermore, performing frequent models fine-tuning on the resource-constrained edge nodes can be computationally expensive and unnecessary, given the excellent transferability demonstrated by existing models. In this work, we propose the Drift-Aware Weight Consolidation (DAWC), a method optimized for edge deployments, mitigating the challenges posed by frequent data drift in the industrial Internet of Things (IIoT). DAWC efficiently manages multiple data drift scenarios, minimizing the need for constant model fine-tuning on edge devices, thereby conserving computational resources. By detecting drift using classifier confidence and estimating parameter importance with the Fisher Information Matrix, a tool that measures parameter sensitivity in probabilistic models, we introduce a drift detection module and a continual learning module to gradually equip the FD model with powerful generalization capabilities. Experimental results demonstrate that our proposed DAWC achieves superior performance compared to existing techniques while also ensuring compatibility with edge computing constraints. Additionally, we have developed a comprehensive diagnosis and visualization platform.
[ "Chen Jiao", "Mao Fengjian", "Lv Zuohong", "Tang Jianhua" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04704v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04704v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI" ]
EdgeFD: An Edge-Friendly Drift-Aware Fault Diagnosis System for Industrial IoT Jiao Chen∗, Fengjian Mao∗, Zuohong Lv∗, and Jianhua Tang∗† ∗ Shien-Ming Wu School of Intelligent Engineering, South China University of Technology, China † Pazhou Lab, Guangzhou, China {202110190459,201930362330,202220159664}@mail.scut.edu.cn, jtang4@e.ntu.edu.sg 3 2 0 2 t c O 7 ] G L . s c [ 1 v 4 0 7 4 0 . 0 1 3 2 : v i X r a Abstract-Recent transfer learning (TL) approaches in in- dustrial intelligent fault diagnosis (FD) mostly follow the "pre- train and fine-tuning" paradigm to address data drift, which emerges from variable working conditions. However, we find that this approach is prone to the phenomenon known as catastrophic forgetting. Furthermore, performing frequent models fine-tuning on the resource-constrained edge nodes can be computationally expensive and unnecessary, given the excellent transferability demonstrated by existing models. In this work, we propose the Drift-Aware Weight Consolidation (DAWC), a method optimized for edge deployments, mitigating the challenges posed by frequent data drift in the industrial Internet of Things (IIoT). DAWC efficiently manages multiple data drift scenarios, minimizing the need for constant model fine-tuning on edge devices, thereby conserving computational resources. By detecting drift using classifier confidence and estimating parameter importance with the Fisher Information Matrix-a tool that measures parameter sensitivity in probabilistic models, we introduce a drift detection module and a continual learning module to gradually equip the FD model with powerful generalization capabilities. Experimental results demonstrate that our proposed DAWC achieves superior performance compared to existing techniques while also ensuring compatibility with edge computing constraints. Additionally, we have developed a comprehensive diagnosis and visualization platform. The project webpage is https://github.com/tenderzada/BearingEdge. Index Terms-Mechanical Fault Diagnosis, Drift Detection, Con- tinual Learning, Industrial Internet of Things, Edge Computing I. INTRODUCTION The integration of the Industrial Internet of Things (IIoT) and its key technologies (e.g., reconfigurable intelligent sur- face [1]) into industrial operations has triggered a profound transformation in operational methodologies. IIoT harnesses interconnected sensors, devices, and machinery to capture real-time data, facilitating data-driven decision-making and predictive maintenance strategies [2], [3]. In industry, bearings and harmonic reducers are pivotal mechanical components that support and transmit rotary motions within mechanical systems. However, bearing failures due to prolonged operation and load-bearing can result in equipment downtime and production disruptions, leading to significant economic losses and safety hazards. In response to these challenges, there exists a growing demand for intelligent This work was supported in part by the National Nature Science Foundation of China under Grant 62001168. Fig. 1. Comparative analysis of learning approaches in the context of evolving data distributions. The data distribution of a specific Inner Race Fault (IRF) changes over time due to varying rpm or loads. The objective is to create a model that effectively generalizes across this evolving data distribution. (a) Transfer Learning: Task-specific parameters are fine-tuned for each data drift. (b) Meta-Learning: The model is quickly adapted using a few samples from the new data distribution. (c) Our Approach: Important weights from past data distributions are consolidated while adapting to new tasks, ensuring a balance of specificity and generality. fault diagnosis (FD), early warning, and visualization of bearing faults [4]–[6]. In recent years, integrating edge computing [7] into the IIoT framework have offered a promising avenue for enhancing intelligent diagnostic systems. Edge computing involves pro- cessing and analyzing data at or near the data source, enabling real-time analysis and minimizing data transmission latency. Notably, the convergence of IIoT and edge computing renders the concept of "source-end detection" in mechanical FD both practical and effective. The potential of intelligent FD methods has been showcased in various studies, yet a formidable challenge persists, namely, data drift, which leads to a notable degradation in diagnosis ac- curacy [8]. Data drift, encompassing challenges such as domain incremental learning (where new classes emerge over time), changes in prior probabilities, and covariate drift (changes in the distribution of input data), hampers the deployment of FD models on edge devices [9]. In industrial settings, especially where data can be scarce or the environment rapidly evolves, this problem becomes particularly pronounced. Fault Diagnosis ModelShared ParametersMeta LearnerIncremental LearnerFrozenTunedContinually Changing Environment IRF1100 rpm500 rpm800 rpm(a) Transfer Learning (b) Meta Learning(c) Our ApproachParametersConsolidationSpecific Specific Specific Time To effectively address the issue of data drift in mechanical fault diagnosis, Transfer Learning (TL) [10], [11] and Meta- Learning (ML) [12] are often employed. TL and ML address the data drift problem by facilitating the transfer of knowledge from previously learned tasks to new ones, which enhances model robustness and data efficiency-essential traits in resource- constrained or swiftly evolving industrial settings. These methodologies promote better generalization across diverse fault scenarios. Moreover, ML excels in rapid adaptability to new fault conditions, pushing real-time fault diagnosis closer to realization. As illustrated in Fig. 1(a), TL involves adapting a shared backbone network for diverse tasks. However, a significant downside of TL is catastrophic forgetting, where the model, while learning new tasks, tends to forget the previously learned knowledge. This phenomenon is demonstrated in Fig. 2. On the other hand, as depicted in Fig. 1(b), ML showcases rapid task adaptation, albeit at a computational cost [13], which might hinder its application in time-sensitive scenarios. Given the limitations of TL and ML in addressing data drift, exploring alternative or complementary strategies becomes imperative to mitigate the impact of data drift on mechanical fault diagnosis. Addressing these challenges head-on, we propose a novel approach that seamlessly adapts to dynamic data distributions. Our system, EdgeFD, leverages a data drift detection module and a weight consolidation mechanisms, allowing for the adaptation and optimization of dynamic data distributions. Our contributions are as follows: • We introduce a confidence-based data drift detection module that enables real-time monitoring and precise detection of abnormal data drift in bearing FD tasks. • Our utilization of the continual learning (CL) method based on weight consolidation effectively adapts to drifting data, facilitating incremental learning as new data emerges while efficiently adjusting the drift component. • For situations with frequent data drift and a high emphasis on long-term learning and knowledge retention, our Drift- Aware Weight Consolidation (DAWC) approach stands out as a superior solution. • The EdgeFD system harnesses the benefits of edge computing, enabling bearing FD tasks to be conducted on edge devices, minimizing dependence on cloud resources, and data transfer latency, and ensuring real-time responsiveness. II. PROBLEM DEFINITION In this section, we outline the problem's core attributes, particularly focusing on the challenges faced when naively implementing solutions based solely on TL and ML. A. Problem Definition Mechanical equipment often exhibits drift in the underlying data distribution of their operational conditions. Factors like varying revolutions, measured in rpm (revolutions per minute), or different loads, measured in Hp (horsepower), can instigate such drifts. Fig. 2. When using transfer learning, a model learns four sequential tasks-one in each round. But as the neural network adapts to new tasks, its performance on the first task deteriorates by the second, third, and fourth rounds. This decline stems from weight adjustments for new tasks, which can inadvertently overwrite knowledge from previous tasks. the FD model As mechanical systems function, is it- eratively fine-tuned over a series of tasks, represented as {T (1), T (2), * * * , T (T )}, where T (t) is a labeled dataset of the tth task, and T (t) = {xi, yi}Nt i=1, which consists of Nt pairs of instances xi and their corresponding labels yi. Assuming the most realistic situation, we consider the case where the task sequence is a task stream with an unknown arriving order, such that the model can access T (t) only at the training period of this task T (t), which will become inaccessible afterward. Given T (t) and the model learned so far, the learning objective at t is as follows: L(θ(t); θ(t−1), T (t)), min θ(t) where L(*; *) is the loss function that quantifies the difference between predictions made using the current model parameters θ(t) and the ground truth data associated with task T (t). The role of θ(t−1) is to provide an initial point for the optimization process, enabling the model to adapt quickly and effectively to the new task T (t). To solve the optimization problem described above, various methods have been developed that leverage the knowledge con- tained in θ(t−1) to enhance the learning process for the new task T (t). Particularly, in the context of diagnosis model training, the techniques based on TL and ML have been mostly explored. B. Transfer Learning and Meta Learning Transfer Learning: The goal of TL is to speed up the learning of new tasks by sharing knowledge between different tasks. The optimization goal of TL can be expressed as minimizing empirical risk, for example using a cross-entropy loss function min θ(t) t (cid:88) t=1 E (xi,yi)∼T (t) [l(yi, f (xi; θ(t)))], (1) where f (*; *) is the corresponding classifier function. The model parameter for the t-th task is the combination of the backbone network u(t) and the classifier v(t): θ(t) := (u(t) ◦ v(t)). The TL process freezes the backbone network u(t) = u(t−1) and updates only the parameters of the classification head v(t). l(yi, f (xi; θ)) is the loss function, for measuring the difference of the predicted output f (xi; θ) against true labels yi. Meta-Learning: The goal of ML is to learn the updating rules from multiple tasks, optimizing the learning process for subsequent tasks. A popular algorithm in this domain is Model- Agnostic Meta-Learning (MAML), where the optimization objective is min θ t (cid:88) t=1 E (Ds t ,Dq t )∼T (t) [l (fθ′(Ds t ), Dq t )] , (2) t ), Dq where θ′ = θ − α∇θl(fθ(Ds t ) denotes the model prediction on task T (t). In (2), θ represents the global t is the support set for the task T (t) (used model parameters, Ds to fine-tune the model), Dq t is the query set (used to evaluate the performance), α is the learning rate. t ), and fθ(Ds While achieving certain successes, it is noteworthy that the existing TL-based FD methods often suffer from catastrophic forgetting (as shown in Fig. 2), leading to continuous model adaptation and increased computational burden on edge devices. Meanwhile, ML-based approaches struggle to handle sequential tasks and involve expensive second-order derivative computa- tions. Moreover, these studies assume the learner's awareness of task distribution changes, allowing the computation of a new posterior approximation. However, this assumption diverges from real-world IIoT scenarios encompassing gradual, sudden, and repeated drifts. Therefore, data drift detection is necessary and important before model adaptation, and the detection of data drift can serve as a valuable cue for model adaptation. For example, the drift intensity helps to reduce the search space and ease the learning process [14]. Specifically, by dynamically adjusting the consolidation weights of previous parameters based on the drift detection results, we can effectively address the challenges posed by significant data drifts. III. LEARNING METHODOLOGY In this section, we introduce a novel framework termed DAWC that effectively detects drift in data streams and employs weight consolidation for model fine-tuning. DAWC addresses the challenges faced by TL and ML methods while also reducing computational costs for edge devices. A. Data Drift Detection Inspired by the CUSUM-type [15] detection method, we propose a sliding window data drift detection method based on the Beta distribution, as illustrated in Fig. 3. In the realm of statistical modeling, the Beta distribution stands out when dealing with random variables bounded within a fixed interval, especially those representing proportions or probabilities. This distribution is naturally defined between 0 and 1, making it a prime choice for situations where we model uncertainties of Fig. 3. The simplified flow of drift detection algorithm. Th is the prefixed threshold, which is related to the sensitivity λ. confidence scores. A key strength of the Beta distribution lies in its versatility; its shape can adapt from U-shaped to bell-shaped, contingent upon its parameters. In our context, the confidence scores from model predictions fall between 0 and 1. As data drift manifests, these confidence score distributions might shift. By leveraging the adaptability of the Beta distribution, we can effectively capture and compare these shifts, making it a powerful tool for drift detection in our methodology. Within a sliding window of length N , the tuple [ˆyi, qi] denotes the model's prediction category and the corresponding confidence score for the input data sample xi. The sliding window is partitioned into two segments: the reference window Qr, housing historical confidences, and the target window Qt, which contains the latest confidences. It is assumed that these confidence scores in the two windows follow different Beta distributions. When data drift occurs, the CNN model's classification accuracy declines, causing small confidence values to appear in the target window, leading to discrepancies between the two Beta distributions. To detect data drift, we compare the cumulative probability density function (PDF) values of the confidences in the target window derived from these two Beta distributions. Step 1. Estimate Beta Distribution Parameters: Using the Maximum Likelihood Estimation (MLE) method, we estimate the parameters of the Beta distribution. Next, the PDF of the beta distribution is provided by (cid:40) qα−1 i (1−qi)β−1 B(α,β) f (qi|α, β) = 0, where, , if 0 < qi < 1, otherwise. B(α, β) = (cid:90) 1 0 qα−1 i (1 − qi)β−1dqi. (3) (4) Step 2. Calculate Dissimilarity Score: Compute the dissimi- larity score for PDF values on the two Beta distributions. Sum these scores to obtain the cumulative dissimilarity score sk. Step 3. Detect Drift: If the cumulative dissimilarity score sk surpasses a predefined threshold Th, data drift is confirmed. q1q2q99q100q101q102q103q104q105q999q1000.........Reference window QrTarget window QtFor each data in Qt, compute PDF values over two distributions, then compare their differencesWindow dividerShift window divider right, compute the accumulative differences Skagain, store the biggest SkMaximum Likelihood EstimationSk>Thmeans drift occurred while Sk≤Thindicates no drift Parameters αr,βrParameters αt,βt Algorithm 1: Drift Detection Algorithm Input: Sliding window Q, Sensitivity to change λ, Padding δ, Maximum size for the sliding window Nmax. Output: The boolean value indicates whether drift is detected. 1 sf ← 0, Th ← −log(λ), N ← |Q| 2 for k ← δ to N − δ do 3 mr ← mean(q1 : qk ∈ Q); mt ← mean(qk+1 : qN ∈ Q); if mt ≤ (1 − λ) * mr then sk ← 0 [ˆαr, ˆβr] ← estimateParams(q1 : qk); [ˆαt, ˆβt] ← estimateParams(qk+1 : qN ); for i ← k + 1 to N do sk ← sk + log (cid:16) f (qi| ˆαt, ˆβt) f (qi| ˆαr, ˆβr) (cid:17) ; sf ← Max(sf , sk); 4 5 6 7 8 9 10 11 12 if sf > Th then return true 13 14 else 15 return f alse The prefixed threshold Th is a critical value used to determine the occurrence of data drift. Its value is inversely related to sensitivity λ, i.e., a smaller λ results in a higher threshold, making the drift detection more stringent. Step 4. Determine Drift Location: Resize the sub-windows and shift the divider, recalculating the dissimilarity scores. If the new cumulative dissimilarity score s f is larger, it implies the new divider is closer to the drift point. This process continues until the maximum dissimilarity score sf is reached, pinpointing the position of the data drift occurrence. ′ Algorithm 1 provides a structured procedure to detect data drift using the cumulative dissimilarity score. It iteratively evaluates each data point in the sliding window against a threshold to determine the onset of drift. Given a sliding window Q, sensitivity to change λ, padding δ, and a maximum window size Nmax, the algorithm determines whether a drift has occurred by iterating through the sliding window and evaluating the cumulative dissimilarity score against a threshold. B. Weight Consolidation Once the drift is identified using our approach, the next challenge is fine-tuning the model without compromising or forgetting the previously acquired knowledge. Zhang et al. [16] presented a CL method centered on data prototype replay to address this. While effective, this method comes with the downside of increased storage and computational costs. On the other hand, regularization, a tool traditionally employed to mitigate model overfitting, has garnered attention in the CL domain. Within this sphere, the chief avenues for regularization stem from parameter importance estimates [17], [18] and knowledge distillation [19]. Building upon these insights, we introduce our approach. Drawing from the Elastic Weight Consolidation (EWC) [17] methodology, we employ an approximate Bayesian CL strategy, aiming to seamlessly adapt models in continuous learning scenarios. Let θ be the parameter vector, and consider the posterior of θ: p(θ|T (1:t)) ∝ p(θ) t (cid:89) i=1 p(T (i)|θ), ∝ p(θ|T (1:t−1))p(T (t)|θ). (5) Here, the factorization in (5) arises due to the conditional independence assumption of task data. However, computing the exact posteriors is challenging, leading to Laplace's approximation: p(T (t)|θ) ≈ N (θ∗ t , F −1 t ), (6) where mean θ∗ t centered at the maximum a posteriori parameter when learning task t, and the precision given by the Fisher information matrix Ft evaluated at θ∗ t .This matrix approximates the Hessian of the negative log-likelihood, ensuring positive semidefiniteness. The overall optimization objective is to minimize the empir- ical risk while simultaneously accounting for the significance of parameters from prior tasks through a regularization term: − log p(T (t)|θ) + λ 2 t−1 (cid:88) i Fi(θ − θ∗ i )2, (7) where λ is a hyperparameter that controls the penalty on important parameters from previous tasks. The term Fi is the importance-weighted regularization term for the previous task's T (t) parameter. T (t) represents the current task's data. This regularization mechanism effectively preserves prior knowledge while adapting to new tasks. More detailed mathematical derivation of Eqs. (5)-(7) and additional experimental validations will be included in the extended version of this paper, which will provide an in-depth exploration of the presented methodology. IV. EXPERIMENTS In this section, we present the experimental settings and evaluate the performances of our method by comparing them with baseline methods. Moreover, we conduct extensive ablation studies to provide a deeper understanding of our method. Baseline methods. The chosen baseline methods represent common strategies in the domain of task-oriented learning: • STL: Single-task learning, where each task is treated independently. This serves as the most basic comparison. • FCB [20]: A naive TL approach that preserves the feature extraction capabilities of the backbone network while fine-tuning only the classification head. • MAML [13]: An advanced meta-learning technique aiming at finding a model initialization conducive for rapid adaptation to new tasks. A. Datasets and experimental details Experimental Setup: All experiments are conducted on a system equipped with an NVIDIA RTX 3090 GPU, using PyTorch version 1.9. Dataset: This study employs the publicly accessible CWRU Bearing Dataset [21] encompassing 10 classification tasks. These tasks correspond to different failure sites (Inner Race, Outer Race, Rolling Body) and sizes (0.007', 0.014', 0.021'). The dataset encompasses bearing data with failures under diverse loads (0 hp, 1 hp, 2 hp, 3 hp), reflecting variations in real-world data collection conditions. As a result, we segment the drifting task based on these distinct load conditions. Backbone Network: Inspired by [22], we adopt the WD- CNN as our core network, recognized for its distinct attributes: (1) a broad initial layer featuring convolutional kernels sized 64×1; (2) stacking multiple compact 3×1 convolutional kernels following the wide kernels. The wide initial convolutional kernels capture broad features, while the stacked smaller kernels delve into finer details. Training Setting: From the total of 5000 data samples, each load condition has 1250 samples. We employ an 80-20 split strategy: 1000 samples from each load condition were used for model training, while the remaining 250 samples (per condition) serve as the test set to evaluate model performance. Performance Metric: We use two metrics from [23] to evaluate algorithms when the number of tasks is large, i.e., Average Accuracy (AA) and Average Forgetting (AF). B. Main Results To ensure the stability and reliability of our results, we conduct three independent repetitions of the experiments. The outcomes of these repeated trials showed some standard deviation, with precise values provided in parentheses. Within our experiments, we focus on investigating four distinct heterogeneous/drifting tasks. After completing training on 4000 samples, we aggregate the experimental outcomes as presented in Table I. Encouragingly, our DAWC showcase a remarkable performance. Specifically, DAWC demonstrates a notable 4.64% increase in accuracy compared to the current SOTA baseline method (i.e., MAML). It's worth noting that DAWC not only excelled in terms of performance but also exhibited significant advantages in terms of forgetting rate. This underscores the validation of the efficacy of our proposed weight consolidation strategy. Through Fig. 4, we can observe the trends in AA variations throughout the learning process for the four different methods. Notably, our DAWC approach demonstrates superior perfor- mance, notably in the face of multiple instances of data drift. This serves as evidence of the considerable potential of DAWC in handling heterogeneous tasks. TABLE I PERFORMANCE ON CWRU DATASET Method STL FCB MAML Type AA(%) AF Baseline 81.25 (± 0.63) 0.22 (± 0.02) Transfer Learning Meta-Learning 86.67 (± 0.72) 89.28 (± 0.16) 0.16 (± 0.02) 0.14 (± 0.01) DAWC(ours) Continual Learning 93.92 (± 0.15) 0.07 (± 0.01) Fig. 4. The comparison of the AA over the 4 tasks during the learning phase. thereby validating the effectiveness of the proposed weight consolidation strategy in handling drifting tasks. C. Effectiveness of Core Designs Effect of Drift Detection: We conduct experiments using the parameters λ = 0.05, Nmax = 1000, and δ = 100. Each alteration in bearing load signifies a shift in the fundamental data distribution, indicating data drift. The instances where these shifts occur are 1000, 2000, and 3000. In Fig. 5, the vertical dashed lines indicate where a drift is detected by applying our detection method. We can notice that all drifts are detected shortly after they theoretically occur. Fig. 5. Accuracy for the four tasks in DAWC. The vertical dashed line indicates the time at which a change in the distribution was detected In summary, the DAWC method outperformed the existing baseline methods in terms of both accuracy and forgetting rate, Effect of Weight Consolidation: We evaluate the accuracy of the four methods for each task, as depicted in Fig. 6. 1000150020002500300035004000Number of samples60%65%70%75%80%85%90%95%100%Average AccuracySTLFCBMAMLDAWC01000200030004000Number of samples20%40%60%80%100%AccuracyDAWCtask-1task-2task-3task-4Drift Detection Fig. 6. Accuracy comparison of four methods across sequential tasks. is observed that It the accuracy steadily improves with fewer fluctuations as the training for new tasks progresses, highlighting the robustness of our method. Upon the detection of a bearing fault, the system promptly sends fault alert notifications to administrators, allowing for the timely initiation of necessary maintenance measures. The effectiveness of our approach in mitigating forgetting can be attributed to efficient weight consolidation, which helps preserve previously learned information. Computational Costs: Fig. 7 illustrates the accuracy vari- ations for each task throughout the learning process for the three methods. When confronted with multiple instances of data drift, both TL and DAWC demonstrate a certain reduction in computational costs for edge devices compared to the STL method. However, our approach outperforms TL in this aspect. This superiority arises from the continuous triggering of model fine-tuning thresholds in TL, where parameters are adjusted to accommodate data drift. In contrast, our DAWC scheme rapidly adapts to various data drift scenarios without the need to trigger model fine-tuning thresholds. As a result, it significantly alleviates computational expenses, and it is hence edge-friendly. Fig. 8. Illustration of the system's operational workflow. To provide users with a comprehensive understanding of the system's status and diagnostic results, we design an intuitive visualization interface, as partially depicted in Fig. 9. At the top of the interface, distinct identifiers for various fault categories are presented. Specifically, "Nm" indicates "Normal", "IR0.007" stands for "0.007-inch Inner Race Fault", "OR0.021" represents "0.021-inch Outer Race Fault", and "B0.014" means "0.014-inch Ball Fault". Additionally, beneath each fault classification, the upper section of a rectangular bar displays the associated confidence score, allowing users to grasp the system's confidence in each fault classification. Next, delving into the system's approach towards handling drift data, as showcased in Fig. 10, when the system's confidence in drift data is comparatively low, it employs the term "Drift" accompanied by a red bar, ensuring that users can promptly recognize instances of data drift. Through our meticulous design, we not only achieve signif- icant progress in bearing FD and alerting but also provide users with the convenience of seamlessly monitoring and understanding the system's operational status. Fig. 7. Comparison of average computational costs for drift adaptation. V. SYSTEM DEMO Based on the framework of DAWC, we develop a system for bearing FD and alerting. The operational workflow of the entire system is depicted in Fig. 8, showcasing the major components and stages involved. This system leverages the power of DAWC to discern and classify 10 different types of bearing faults, returning corresponding confidence scores. 1000200030004000Number of samples50%60%70%80%90%100%AccuracySTL1000200030004000Number of samples50%60%70%80%90%100%FCB1000200030004000Number of samples50%60%70%80%90%100%MAML1000200030004000Number of samples50%60%70%80%90%100%DAWCtask-1task-2task-3task-4010203040Drift/Task Number6.06.57.07.58.08.5Edge Device Cost (MMac)FCBDAWCSTL Bearing's Vibration SignalCNN Model Inference Fault Class & Confidence 0.99Nm0.97Nm0.98OR0.56Nm0.48NmTime-axis...Confidence-based Drift DetectionFault Alarm By EmailNonNonNonDriftDrift...Data drift has been detected in the system.Outer race fault -0.007 inchcracks [5] T. Wang, H. Liu, D. Guo, and X.-M. Sun, "Continual residual reservoir computing for remaining useful life prediction," IEEE Trans. Ind. Inf., pp. 1–10, 2023, early access. [6] G. Chen, Y. Lu, and R. Su, "Interpretable fault diagnosis with shapelet temporal logic: Theory and application," Automatica, vol. 142, p. 110350, May 2022. [7] T. Q. Dinh, J. Tang, Q. D. La, and T. Q. S. Quek, "Offloading in mobile edge computing: Task allocation and computational frequency scaling," IEEE Trans. Commun., vol. 65, no. 8, pp. 3571–3584, Aug. 2017. [8] S. Bandyopadhyay, A. Datta, A. Pal, and S. R. R. Gadepally, "Intelligent continuous monitoring to handle data distributional changes for IoT systems," in Proc. SenSys, Boston, MA, USA, Nov. 2022, pp. 1189– 1195. [9] J. Hurtado, D. Salvati, R. Semola, M. Bosio, and V. Lomonaco, "Continual learning for predictive maintenance: Overview and challenges," Intelligent Systems with Applications, p. 200251, Jun. 2023. [10] J. Chen, R. Huang, Z. Chen, W. Mao, and W. Li, "Transfer learning algorithms for bearing remaining useful life prediction: A comprehensive review from an industrial application perspective," Mechanical Systems and Signal Processing, vol. 193, p. 110239, Mar. 2023. [11] J. Chen, D. Li, R. Huang, Z. Chen, and W. Li, "Aero-engine remaining useful life prediction method with self-adaptive multimodal data fusion and cluster-ensemble transfer regression," Reliability Engineering & System Safety, vol. 234, p. 109151, Feb. 2023. [12] Y. Feng, J. Chen, J. Xie, T. Zhang, H. Lv, and T. Pan, "Meta-learning as a promising approach for few-shot cross-domain fault diagnosis: Algorithms, applications, and prospects," Knowledge-Based Systems, vol. 235, p. 107646, Jan. 2022. [13] C. Finn, P. Abbeel, and S. Levine, "Model-agnostic meta-learning for fast adaptation of deep networks," in Proc. ICML, Sydney, Australia, Aug. 2017, pp. 1126–1135. [14] T. Lesort, M. Caccia, and I. Rish, "Understanding continual learning settings with data distribution drift analysis," 2021. [Online]. Available: https://arxiv.org/abs/2104.01678 [15] A. Haque, L. Khan, and M. Baron, "Sand: Semi-supervised adaptive novel class detection and classification over data stream," in Proc. AAAI, vol. 30, no. 1, Phoenix, AZ, USA, Feb. 2016. [16] L. Zhang, G. Gao, and H. Zhang, "Spatial-temporal federated learning for lifelong person re-identification on distributed edges," IEEE Trans. Circuits Syst. Video Technol., 2023, early access. [17] J. Kirkpatrick, R. Pascanu, N. Rabinowitz, J. Veness, G. Desjardins, A. A. Rusu, K. Milan, J. Quan, T. Ramalho, A. Grabska-Barwinska et al., "Overcoming catastrophic forgetting in neural networks," Proceedings of the national academy of sciences, vol. 114, no. 13, pp. 3521–3526, Mar. 2017. [18] R. Aljundi, F. Babiloni, M. Elhoseiny, M. Rohrbach, and T. Tuytelaars, "Memory aware synapses: Learning what (not) to forget," in Proc. ECCV, Munich, Germany, Sep. 2018, pp. 139–154. [19] P. Buzzega, M. Boschini, A. Porrello, D. Abati, and S. Calderara, "Dark experience for general continual learning: a strong, simple baseline," in Proc. NeurIPS, vol. 33, Virtual, Dec. 2020, pp. 15 920–15 930. [20] T. Han, C. Liu, W. Yang, and D. Jiang, "Learning transferable features in deep convolutional neural networks for diagnosing unseen machine conditions," ISA Transactions, vol. 93, pp. 341–353, Oct. 2019. [21] W. A. Smith and R. B. Randall, "Rolling element bearing diagnostics using the case western reserve university data: A benchmark study," Mechanical systems and signal processing, vol. 64-65, pp. 100–131, Jun. 2015. [22] W. Zhang, G. Peng, C. Li, Y. Chen, and Z. Zhang, "A new deep learning model for fault diagnosis with good anti-noise and domain adaptation ability on raw vibration signals," Sensors, vol. 17, no. 2, p. 425, Feb. 2017. [23] S. I. Mirzadeh, M. Farajtabar, R. Pascanu, and H. Ghasemzadeh, "Understanding the role of training regimes in continual learning," in Proc. NeurIPS, vol. 33, Virtual, Dec. 2020, pp. 7308–7320. Fig. 9. Visualization of the system interface, displaying various fault classifications and their corresponding confidence scores. Fig. 10. Highlighting the system's approach to drift data, using the term "Drift" and a red bar for low-confidence drift instances. VI. CONCLUSION In this study, we have presented an edge-oriented method for mechanical fault diagnosis that incorporates drift detection and weight consolidation mechanisms. Distinctively, our method stands out for its significant reduction in computational overhead, especially in scenarios plagued by frequent data drift, offering a resource-efficient solution for edge devices. A prominent characteristic of this method is its simplicity, making it adaptable to various backbone network architectures. This attribute paves the way for leveraging more powerful pre- trained models in future large-scale edge-cloud collaborative settings. By combining this approach with advanced pre-trained models, we can further enhance the performance and scalability of fault diagnosis systems. REFERENCES [1] J. Xiao, J. Tang, and J. Chen, "Efficient radar detection for RIS-aided dual-functional radar-communication system," in Proc. IEEE VTC2023- Spring, Florence, Italy, Jun. 2023, pp. 1–6. [2] B. Yin, J. Tang, and M. Wen, "Connectivity maximization in non- orthogonal network slicing enabled Industrial Internet-of-Things with multiple services," IEEE Trans. Wireless Commun., vol. 22, no. 8, pp. 5642–5656, Aug. 2023. [3] Y. Zhao, D. Saxena, and J. Cao, "Memory-efficient domain incremental learning for Internet of Things," in Proc. SenSys, Boston, MA, USA, Nov. 2022, pp. 1175–1181. [4] J. Chen, J. Tang, and W. Li, "Industrial edge intelligence: Federated-meta learning framework for few-shot fault diagnosis," IEEE Trans. Network Sci. Eng., pp. 1–13, 2023, early access.
http://arxiv.org/abs/2310.04703v1
"2023-10-07T06:41:29"
"2023-10-07T06:41:29"
Integrating Contrastive Learning into a Multitask Transformer Model for Effective Domain Adaptation
While speech emotion recognition (SER) research has made significant progress, achieving generalization across various corpora continues to pose a problem. We propose a novel domain adaptation technique that embodies a multitask framework with SER as the primary task, and contrastive learning and information maximisation loss as auxiliary tasks, underpinned by fine-tuning of transformers pre-trained on large language models. Empirical results obtained through experiments on well-established datasets like IEMOCAP and MSP-IMPROV, illustrate that our proposed model achieves state-of-the-art performance in SER within cross-corpus scenarios.
[ "Chung-Soo Ahn", "Jagath C. Rajapakse", "Rajib Rana" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04703v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04703v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CL", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CL", "cs.HC", "cs.LG", "Speech Emotion Recognition, Domain adaptation" ]
INTEGRATING CONTRASTIVE LEARNING INTO A MULTITASK TRANSFORMER MODEL FOR EFFECTIVE DOMAIN ADAPTATION Chung-Soo Ahn, Jagath C. Rajapakse∗ Rajib Rana School of Computer Science and Engineering Nanyang Technological University, Singapore School of Mathematics, Physics and Computing University of Southern Queensland, Australia 3 2 0 2 t c O 7 ] L C . s c [ 1 v 3 0 7 4 0 . 0 1 3 2 : v i X r a ABSTRACT While speech emotion recognition (SER) research has made significant progress, achieving generalization across various corpora continues to pose a problem. We propose a novel do- main adaptation technique that embodies a multitask frame- work with SER as the primary task, and contrastive learn- ing and information maximisation loss as auxiliary tasks, un- derpinned by fine-tuning of transformers pre-trained on large language models. Empirical results obtained through experi- ments on well-established datasets like IEMOCAP and MSP- IMPROV, illustrate that our proposed model achieves state- of-the-art performance in SER within cross-corpus scenarios. Index Terms- Contrastive learning, cross-corpus adap- tation, domain adaptation, speech emotion recognition, trans- formers 1. INTRODUCTION Speech Emotion recognition (SER) has been an active re- search area for decades, but generalization across multiple corpora has not been fully addressed. Existing SER methods perform poorly when tested on data from different sources, especially when dataset sizes are different. This motivates us to propose a generalized approach for domain adaptation for SER, overcoming the limitations of data constraints. A substantial amount of progress has been made through pre-trained transformer models in speech recognition and au- dio representation learning [1]. Moreover, it is verified that information in pre-trained transformers on language models is easily transferable to emotion recognition [2]. In this pa- per, we intend to tackle cross-corpus SER by exploiting rich knowledge embedded in pre-trained transformers to enhance the generalizability of the models. Here, we address the cross- corpus SER problem where the emotion recognition model is trained on one corpus and tested on a different corpus. Contrastive learning is one of the recent successful paradigms in self-supervised learning that can learn struc- Its tures between data when sample sizes are small [3]. ∗correspondence to asjagath@ntu.edu.sg applicability to domain adaptation has started to gain popu- larity as well [4]. Yet, contrastive learning is under-explored in the cross-corpus SER problem. In particular, how it can be effectively used for domain adaption in SER needs further exploration. Information Maximization (IM) loss follows cluster as- sumption [5], that a better classifier will learn to find class boundaries to have large margins. IM loss is optimized with- out labels, simply optimizing entropy computed from only logits. It has strong potential to be used in domain adapta- tion in SER. In this paper, we address all the above challenges. The contributions of this paper are as follows: 1. We propose a multitask framework for domain adapta- tion in SER, underpinned by a pre-trained transformer, where SER is the primary task and contrastive learning for learning structure of the source and target corpus data are used as secondary task. 2. We add Information Maximization (IM) loss for clus- tering another secondary task as it can explicitly learn the cluster structure when used together with con- trastive learning. 3. We test our model on the cross-corpus experiment, where the model trained on IEMOCAP[6] and tested on MSP-IMPROV[7] and achieve state-of-the-art per- formance with 10% improvement. 2. RELATED WORK In this section, we discuss the literature while clustering them into three groups. In the first group, we present the stud- ies that introduce multitask learning for domain adaptation in SER. Semi-supervised learning which makes use of unsu- pervised learning objectives along with emotion classification objective has been proposed [11]. Such is ladder network that uses layer-wise reconstruction loss that allows usage of additional unlabelled data. Auto-encoder type reconstruction loss was also attempted[12, 13]. Another alternative that re- quires reconstruction loss is GAN-based approaches which 3.1. Wav2Vec2 for SER Wav2Vec2 [1] is self-supervised learning model that takes in- put from raw waveform data of speech. It is consisted of convolution layers for feature extraction and transformer lay- ers. Transformer layers are consisted of 12 layers of trans- former modules. Inspired from Yang et al. [2], we take repre- sentations from every transformer layer (total 13 representa- tions) and compute their weighted sum which is learned dur- ing training. The output of a transformer is average-pooled and fed to followed by a softmax layer. The emotion class label c given the weighted output h of the pre-trained transformer is given by p (c|h) = softmax(W h + b), (1) The weights W and biases b of the fully connected layers are learned during training by minimizing the cross-entropy loss Lemo: Lemo = −E{ (cid:88) c 1c(y)log(p(c|h))}. (2) where y depicts the target emotion label, 1c the indicater func- tion and E computes expectation over the samples. . 3.2. Contrastive learning Contrastive learning is aimed at learning to attract positive pairs of inputs and repel negative pairs. Most common and popular variants now uses InfoNCE [3] loss to achieve this. We follow the framework from Chen et al.[17], generating la- tent variable z by feeding h through single hidden layer feed- forward network, z = V σ(U h), (3) where σ is ReLU activation. It is known that contrastive learn- ing is more effective with z than h[17]. With this setting, we compute InfoNCE loss between representations z and z′ as follows: Fig. 1. Overall architecture of contrastive learning on speech processed by shared pre-trained transformer. also is implemented together with synthetic data generation to aid training [14, 15]. Additional learning objective can be achieved by other labels, such as languages, which relatively easier to obtain and can be used as auxiliary task[16]. In the second group, we present studies using pre-trained transformer for cross-corpus SER. Thanks to recent advance- ment in self-supervised learning with pre-text tasks, such as Wav2Vec2[1], its knowledge transfer to emotion has be- Following the trend, pre-trained come more popular[2]. transformer was combined with domain adversarial learning [8] to achieve cross-corpus SER. VGGish transformer with spectrogram input was used to cross-corpus SER [9], where the model was pre-trained on speaker recogition task and its transferred knowledge helped domain adaptation. It is also common to only take resulting embedding from pre-trained transformer as input and build new transformer and train from scratch[10]. Summarising the existing studies, we note that none of the existing studies have used a pre-trained transformer within a multitask learning framework while using contrastive learn- ing as a secondary task to improve the accuracy of the pri- mary SER tasks in a cross-corpus setting. This confirms the novelty of our approach in contrast to the existing literature. 3. METHODS Lcont = exp (cosine sim(zi, z′ i)/τ ) exp (cid:0)cosine sim(zi, z′ (cid:80)batchsize j=1 j)/τ (cid:1) . (4) Wav2Vec2[1] is adopted and two parallel stream is imple- mented, while sharing same weights. For each speech sample, two augmented speech is generated and fed into those two parallel transformers, as shown in Fig.1. Our method also adopts multitask learning framework, that emotion classifica- tion layer is on top of transformer and other layers for other auxiliary tasks. Both source data and target data for training will be used to compute loss and train the model through back propagation. zi refers to ith sample of latent variable z in the mini batch and z′ i refers to the z from the forward pass of other augment sample. Hyperparameter τ is temperature[18] which controls the smoothness of softmax function. cosine sim refers to cosine similarity score 1 Attracting similar data points and repelling dissimlar data points can reveal structure of the dataset. We intend to achieve clustering effect on both source and target data at the same time. 1cosine sim(a, b) = ab ∥a∥∥b∥ 3.3. Information Maximization loss 3.5. Multitask Learning for domain adaptation Additional auxilliary task is introduced in our work, infoma- tion maximization loss. This is inspired from Krause et al. [5] and Liang et al.[19]. Information Maximization (IM) loss follows cluster assumption [5], that better classifier will learn to find class boundaries to have large margins. IM loss is op- timized without labels, simply optimizing entropy computed from only logits. However, this might lead to trivial solu- tion where every data samples collapse into single class. [5] proposed uniform distribution contraint for each cluster (or class). Finally, we compute IM loss by computing expected en- tropy subtracted by empirical label's entropy. Finally, all the above mentioned losses are summed up for fi- nal loss function for training. Ltotal = Lemo + λ1Laug + λ2Lcont + λ3LIM where λ1,λ2, and λ3 are hyperparamter constants to control importance of each loss and to be deter- mined empirically. This loss is computed same regardless of input coming from source or target. Our work is assuming that small frac- tion of target data with label is available. If label is not avail- able Lemo can be dropped during training with target data. Detailed procedure of our domain adaptation can be referred to subsection 4.2. LIM = −E{ (cid:88) c p(c|h)log(p(c|h))} (cid:88) +E{ c ˆp(c)log(ˆp(c))}. 4. EXPERIMENT 4.1. Datasets (5) max output from all data points) as ˆp (c) = 1 N where empirical label distribution (simply average of soft- i=1 p(ci|hi). We use IM loss to aid contrastive learning in forming clus- ters. IM loss explicitly learns to form wide separation margin, thus capable for our needs. (cid:80)N 3.4. Data augmentation and Augmentation Classification loss Data augmentation is important component in our model as it increases data size for transformers to learn avoiding over- fitting. Also data augmentation is essential for contrastive learning as it requires different views of the same sample to learn similarities between two augmentations. We exploited augmentation tool (https://github.com/asteroid-team/torch- audiomentations) to augment raw audio waveforms. The augmentation function that we adopted are: Gain, Polority- Inversion, Shift, TimeInversion, BandStopFilter, PeakNor- malization and AddColoredNoise. All these functions add perturbation to the waveforms and we used mixtures of them to create five pipelines of augmentation. When implementing data augmentation pipeline, we also assign labels to the data stating which pipeline was this input is perturbed. With this additional label provided, we add an- other classification task as auxiliary task and compute its loss as: Laug = −E{ (cid:88) ca 1ca (ya)log(p(ca|h))}. (6) The label ya represents from which augmentation pipeline this input came from. This classification layer is separate from emotion classification layer, thus learnable weights W ′ and b′ are not same with W and b. In this subsection, we briefly describe the two datasets used for cross-corpus SER experiments. As transformers take raw waveform as inputs, there is no feature extraction. 1. IEMOCAP [6]: IEMOCAP dataset consists of 12 hours conversation between two actors. Total 10 actors were recruited to record five sessions. In this work, we fo- cused on binary emotions: neutral, happy, and excited are labelled as positive; and sad and angry as negative. Recordings with other emotion labels are excluded. 2. MSP-IMPROV [7]: MSP-IMPROV dataset is con- structed similar to IEMOCAP dataset but with 12 ac- tors and six sessions, which has a relatively larger size than IEMOCAP. This dataset only have four emotion labels: neutral, happy, angry and sad. This labels are converted to binary similar to IEMOCAP dataset. 4.2. Domain adaptation experiment Our work is aimed at situations where only a small fraction of target data is available with labels to access. IEMOCAP dataset was used as source data and 90% of the data was used as training set (denoted by Str) and remaining 10% was re- served as validation (denoted by Sva) which was used for early stopping. From target dataset MSP-IMPROV, 5% of Table 1. Performance comparison with existing methods Model CNN-BLSTM[20] CNN-BLSTM+DANN+CenterLoss[20] CNN-LSTM[8] DoGAT[8] Ours (without labels) Ours UAR 59.52% 57.26% 55.73% 59.42% 59.39% 69.25% data was taken with labels as the training set (denoted by Ttr) and remaining 95% was reserved for testing set (denoted by Tte). And we also experimented with a situation where labels was considered unavailable for all target data. In this case, we set 30% and 70% ratio of the MSP-IMPROV dataset for Ttr and Tte, respectively. Domain adaptation was tested by training on Str and Ttr for one epoch alternatively. After each epoch, emotion clas- sification accuracy was measured on Sva. When the accuracy did not improve from previous epoch, training was halted and UAR (Unweighted Average Recall) on Tte was recorded. We empirically set the hyperparameters of the loss: λ1 = 0.1, λ2 = 0.5 and λ3 = 0.5. Pre-trained transform- ers with name 'facebook/wav2vec2-base-960h' (downloaded from https://huggingface.co/facebook/wav2vec2-base-960h) which was trained in Wav2Vec2 with hidden layer size of 768; and we set size for U and V as 256 and 128, respec- tively. Learning rate was 1 × 10−4 and decayed on plateau by factor of 0.1 with patience of 5. Validation accuracy was measured for learning rate decay and the epoch (separate from early stopping validation) was set as 100 batches for source dataset and 25 batches for target dataset with labels. When target data was without labels, epoch was set as same with the source and 100 batches were evaluated to decide on learning rate decay. Our experiment results is presented in Table.1. Our method outperforms the state-of-the-art methods by about 10%. Even more, our model performs on par with state-of- the-art methods when trained on target data without labels. 4.3. Ablation atudy Our ablation study focused on cases where no labels are avail- able, to clearly examine generalizability of our model. We also tested contribution of component losses in the cost func- tion. Contribution of Lcont was the largest and Laug was the least. Especially, Laug had negligible impact (UAR de- creased by 0.2% when removed). We believe that Lcont learns to attract representation from similar data samples and repel representation from dissimilar data samples, thus learning the overall structure of the dataset. And LIM enforces represen- tation to have larger separation margin, resulting in localizing representations from the same cluster in to a dense region. Table 2. Ablation Study Our Model complete model without labels without Laug without LIM & Laug without Lcont & Laug UAR 69.25% 59.39% 59.10% 58.68% 57.37% Fig. 2. Visualizing h computed from Tte from model without Laug. We also visualized the data in the latent space in Figure.2 to test the effect of each loss component. Each marker repre- sents h computed for data from Tte without Laug and differ- entiated per class. It is notifiable that representations are well dispersed thanks to contrastive learning. The edge region of scatter plot is denser than center and each class is more con- centrated either left-end or right-end, thanks to information maximization loss. Finally, contrastive learning and informa- tion maximization proves to be effective in domain adaptation as it did not exploit labels of target data to achieve this. 5. CONCLUSION We proposed to incorporate contrastive learning via multitask learning for domain adaptation in SER. Earlier, contrastive learning was rarely studied on domain adaption problem in context of SER. We proposed to train a transformer model with contrastive learning and other tasks as auxiliary tasks on top of emotion classification. Our experiments demon- strated that multitask learning with contrastive learning was able to learn the structure from data without labels by attract- ing similar and repelling dissimilar data. Furthermore, in- formation maximization turned out to be capable of pushing representations of different classes to the edge region of dif- ferent directions for separation. Our experiments showed that our model is able to achieve on par with state-of-the-art in do- main adaption without labels. Moreover, our model improved 10% above state-of-the-art with only 5% of the target dataset with labels. 6. REFERENCES [1] Alexei Baevski, Yuhao Zhou, Abdelrahman Mohamed, and Michael Auli, "wav2vec 2.0: A framework for self-supervised learning of speech representations," Ad- vances in neural information processing systems, vol. 33, pp. 12449–12460, 2020. [2] Shu-wen Yang, Po-Han Chi, Yung-Sung Chuang, Cheng-I Jeff Lai, Kushal Lakhotia, Yist Y Lin, Andy T Liu, Jiatong Shi, Xuankai Chang, Guan-Ting Lin, et al., "Superb: Speech processing universal perfor- mance benchmark," arXiv preprint arXiv:2105.01051, 2021. [3] Aaron van den Oord, Yazhe Li, and Oriol Vinyals, "Rep- resentation learning with contrastive predictive coding," arXiv preprint arXiv:1807.03748, 2018. [4] Rui Wang, Zuxuan Wu, Zejia Weng, Jingjing Chen, Guo-Jun Qi, and Yu-Gang Jiang, "Cross-domain con- trastive learning for unsupervised domain adaptation," IEEE Transactions on Multimedia, 2022. [5] Andreas Krause, Pietro Perona, and Ryan Gomes, "Dis- criminative clustering by regularized information max- imization," Advances in neural information processing systems, vol. 23, 2010. [6] Carlos Busso, Murtaza Bulut, Chi-Chun Lee, Abe Kazemzadeh, Emily Mower, Samuel Kim, Jeannette N Chang, Sungbok Lee, and Shrikanth S Narayanan, "Iemocap: Interactive emotional dyadic motion capture database," Language resources and evaluation, vol. 42, pp. 335–359, 2008. [7] Carlos Busso, Srinivas Parthasarathy, Alec Burma- nia, Mohammed AbdelWahab, Najmeh Sadoughi, and Emily Mower Provost, "Msp-improv: An acted cor- pus of dyadic interactions to study emotion perception," IEEE Transactions on Affective Computing, vol. 8, no. 1, pp. 67–80, 2016. [8] Yuan Gao, Longbiao Wang, Jiaxing Liu, Jianwu Dang, and Shogo Okada, "Adversarial domain generalized transformer for cross-corpus speech emotion recogni- tion," IEEE Transactions on Affective Computing, 2023. [9] Alessandro Arezzo and Stefano Berretti, "Speaker vgg cct: Cross-corpus speech emotion recognition with speaker embedding and vision transformers," in Pro- ceedings of the 4th ACM International Conference on Multimedia in Asia, 2022, pp. 1–7. [10] Shiqing Zhang, Ruixin Liu, Yijiao Yang, Xiaoming Zhao, and Jun Yu, "Unsupervised domain adaptation in- tegrating transformer and mutual information for cross- corpus speech emotion recognition," in Proceedings of the 30th ACM International Conference on Multimedia, 2022, pp. 120–129. [11] Srinivas Parthasarathy and Carlos Busso, "Semi- supervised speech emotion recognition with ladder net- works," IEEE/ACM transactions on audio, speech, and language processing, vol. 28, pp. 2697–2709, 2020. [12] Michael Neumann and Ngoc Thang Vu, "Improving speech emotion recognition with unsupervised repre- in ICASSP sentation learning on unlabeled speech," 2019-2019 IEEE International Conference on Acous- tics, Speech and Signal Processing (ICASSP). IEEE, 2019, pp. 7390–7394. [13] Vipula Dissanayake, Haimo Zhang, Mark Billinghurst, and Suranga Nanayakkara, "Speech emotion recogni- Interspeech tion 'in the wild'using an autoencoder," 2020, 2020. [14] Bo-Hao Su and Chi-Chun Lee, "Unsupervised cross- corpus speech emotion recognition using a multi-source cycle-gan," IEEE Transactions on Affective Computing, 2022. [15] Siddique Latif, Rajib Rana, Sara Khalifa, Raja Jurdak, and Bjorn Wolfgang Schuller, "Self supervised ad- versarial domain adaptation for cross-corpus and cross- language speech emotion recognition," IEEE Transac- tions on Affective Computing, 2022. [16] Siddique Latif, Rajib Rana, Sara Khalifa, Raja Jurdak, and Bj ̈orn W Schuller, "Multitask learning from aug- mented auxiliary data for improving speech emotion recognition," IEEE Transactions on Affective Comput- ing, 2022. [17] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton, "A simple framework for contrastive learning of visual representations," in International con- ference on machine learning. PMLR, 2020, pp. 1597– 1607. [18] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean, "Distill- ing the knowledge in a neural network," arXiv preprint arXiv:1503.02531, 2015. [19] Jian Liang, Dapeng Hu, and Jiashi Feng, "Do we re- ally need to access the source data? source hypothe- sis transfer for unsupervised domain adaptation," in In- ternational Conference on Machine Learning (ICML), 2020, pp. 6028–6039. [20] Yuan Gao, Shogo Okada, Longbiao Wang, Jiaxing Liu, and Jianwu Dang, "Domain-invariant feature learn- ing for cross corpus speech emotion recognition," in ICASSP 2022-2022 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2022, pp. 6427–6431.
http://arxiv.org/abs/2310.04701v1
"2023-10-07T06:28:41"
"2023-10-07T06:28:41"
Twin Graph-based Anomaly Detection via Attentive Multi-Modal Learning for Microservice System
Microservice architecture has sprung up over recent years for managing enterprise applications, due to its ability to independently deploy and scale services. Despite its benefits, ensuring the reliability and safety of a microservice system remains highly challenging. Existing anomaly detection algorithms based on a single data modality (i.e., metrics, logs, or traces) fail to fully account for the complex correlations and interactions between different modalities, leading to false negatives and false alarms, whereas incorporating more data modalities can offer opportunities for further performance gain. As a fresh attempt, we propose in this paper a semi-supervised graph-based anomaly detection method, MSTGAD, which seamlessly integrates all available data modalities via attentive multi-modal learning. First, we extract and normalize features from the three modalities, and further integrate them using a graph, namely MST (microservice system twin) graph, where each node represents a service instance and the edge indicates the scheduling relationship between different service instances. The MST graph provides a virtual representation of the status and scheduling relationships among service instances of a real-world microservice system. Second, we construct a transformer-based neural network with both spatial and temporal attention mechanisms to model the inter-correlations between different modalities and temporal dependencies between the data points. This enables us to detect anomalies automatically and accurately in real-time. The source code of MSTGAD is publicly available at https://github.com/alipay/microservice_system_twin_graph_based_anomaly_detection.
[ "Jun Huang", "Yang Yang", "Hang Yu", "Jianguo Li", "Xiao Zheng" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04701v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04701v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.SE" ]
Twin Graph-based Anomaly Detection via Attentive Multi-Modal Learning for Microservice System Jun Huang1, Yang Yang1, Hang Yu2∗, Jianguo Li2∗, Xiao Zheng1 1 School of Computer Science and Technology, Anhui University of Technology, Maanshan, China 2 Ant Group, Hangzhou, China {huangjun.cs,young978,xzheng}@ahut.edu.cn, {hyu.hugo,lijg.zero}@antgroup.com 3 2 0 2 t c O 7 ] G L . s c [ 1 v 1 0 7 4 0 . 0 1 3 2 : v i X r a Abstract-Microservice architecture has sprung up over recent years for managing enterprise applications, due to its ability to independently deploy and scale services. Despite its benefits, ensuring the reliability and safety of a microservice system re- mains highly challenging. Existing anomaly detection algorithms based on a single data modality (i.e., metrics, logs, or traces) fail to fully account for the complex correlations and interactions leading to false negatives and between different modalities, false alarms, whereas incorporating more data modalities can offer opportunities for further performance gain. As a fresh attempt, we propose in this paper a semi-supervised graph- based anomaly detection method, MSTGAD, which seamlessly integrates all available data modalities via attentive multi-modal learning. First, we extract and normalize features from the three modalities, and further integrate them using a graph, namely MST (microservice system twin) graph, where each node represents a service instance and the edge indicates the scheduling relationship between different service instances. The MST graph provides a virtual representation of the status and scheduling re- lationships among service instances of a real-world microservice system. Second, we construct a transformer-based neural network with both spatial and temporal attention mechanisms to model the inter-correlations between different modalities and temporal dependencies between the data points. This enables us to detect anomalies automatically and accurately in real-time. Extensive experiments on two real-world datasets verify the effectiveness of our proposed MSTGAD method, achieving competitive perfor- mance against state-of-the-art approaches, with a 0.961 F1-score and an average increase of 4.85%. The source code of MSTGAD is publicly available at https://github.com/alipay/microservice system twin graph based anomaly detection. Index Terms-anomaly detection, multi-modal learning, system twin graph I. INTRODUCTION The microservice architecture has gained popularity in recent years as a method of developing applications. This methodology involves breaking down a single application into a suite of small services, each running in its own process and communicating via lightweight mechanisms [1]. One of the key advantages of this architecture is that services can be independently deployed and scaled. As a result, many industries have adopted this architecture to manage their enter- prise applications. However, ensuring the reliability and safety of a Microservice system can be challenging. Traditional approaches rely on manual inspection, which is impractical for * Corresponding authors This work was sponsored by CCF-AFSG research fund. large-scale distributed systems consisting of numerous services running on different machines. Fortunately, various types of data can be monitored in a microservice system, including service/machine metrics, logs, traces, etc. These data play a crucial role in ensuring the reliability and safety of the system. For example, metrics are real-valued time-series providing information on the status of services or machines and the associated requirements that need to be met during runtime operations. Logs are semi- structured text messages printed by logging statements to record the system's run-time status. Traces are hierarchical descriptions of the modules and services called upon to fulfill a user request. They are usually recorded with the service name or category and the time duration of each module. By leveraging the monitored data of a microservice system, many works [2], [3] have successfully replaced manual inspection with automated anomaly detection algorithms, such as the log- based approaches [4]–[8], metric-based approaches [9]–[15] and trace-based approaches [16]–[22]. Despite their effectiveness, they are often based on a single data modality, which can incur both false negatives and false alarms. Practical abnormal patterns vary across data modal- ities, with some only being evident in specific modalities. Failing to account for these modalities can lead to false nega- tives, which may further cause system outrage and substantial financial loss. For instance, consider an anomaly related to an API version, where a service request does not receive a timely response or is not properly parsed. Such an anomaly may not be detectable through metrics data alone, as there might not be any noticeable increase in resource consumption for the executed service container. However, it is feasible to detect this anomaly by leveraging trace data. On the other hand, different modalities can complement each other to filter out false alarms. For example, when configuring new applications, which is a normal change, metric-based approaches may interpret in- creased CPU and memory usage as an anomaly, resulting in false alarms. However, by incorporating logs and traces, such false alarms can be reduced. It is essential to acknowledge that reducing the number of false alarms is of significant importance in real-world scenarios, as a high volume of false alarms can obscure true positive detections. In light of these challenges associated with single-modal anomaly detection methods, several works have proposed approaches based on Fig. 1. Framework of the proposed method MSTGAD multi-modal data, such as DeepTraLog [1], SCWarn [23], and HADES [24]. However, they use at most two modalities and do not fully consider the complex correlations between different data modalities. Another problem with the existing works is that they are typically constructed in an unsupervised way and fail to exploit the labeling information. However, in real-world scenarios, anomaly information is usually available [25], particularly when the anomaly detection algorithm fails to identify a system failure and further causes a system outage. Utilizing this labeling information can further enhance the algorithm's performance, but it cannot be incorporated into unsupervised learning methods. On the other hand, unlabeled data is more abundant and readily available. It is beneficial to consider a semi-supervised approach that combines both labeled and unlabeled data. The key to remedying the above two issues lies in the extraction of useful information from heterogeneous multi- source data involved in Microservice systems and the construc- tion of a semi-supervised model that can accurately identify anomalies. To move forward to this goal, two major challenges must be overcome. 1) How to unite and represent heterogeneous multi-source data and model the complex correlations and interactions between them? In a Microservice system, service instances are configured in containers and called upon by user requests. Concurrently, traces are generated, and logs and metrics are monitored and recorded for these service instances and machines by timestamp. Therefore, it is natural to represent the multi-modal data using a graph to reflect the state of a Microservice system. The nodes represent service instances, and the edges correspond to their scheduling relationships. Since diverse modalities are integrated into a graph, graph machine learning techniques can be utilized to model com- plex correlations and interactions between them, such as the message-passing mechanism. 2) How to construct a semi-supervised anomaly detection model? In the IT industry, apart from the abundant unlabeled data, some supervised information can be collected, as some anomalies can be labeled and reported by users. Therefore, the supervised information can be utilized to create an efficient semi-supervised anomaly detection model. In this paper, we present a novel approach to address the challenges of anomaly detection in microservice systems. Our proposed method, MSTGAD, is a microservice system twin (MST) graph-based anomaly detection method that uses attentive multi-modal learning. It aims to automatically and accurately detect anomalies by leveraging metrics, logs, and traces simultaneously. The framework of MSTGAD is pre- sented in Fig. 1. We first extract and normalize the features of metrics, logs, and traces. Then, we propose to integrate the three modalities together via a graph structure, where each node represents a service instance, and the edge indicates the scheduling relationship between different service instances obtained from the traces. Since logs and metrics are recorded according to service instances, we use the features of metrics and logs to represent the node features. Traces describe the scheduling relationships between service instances within a microservice system, which are extracted and used to represent the features of edges. Similar to a digital twin system, for each timestamp, the information about a microservice system can be reflected by the graph which can be considered a twin of the physical microservice system and virtually represent the status and scheduling relationships among service instances of a real-world microservice system. Therefore, we name it a microservice system twin graph, i.e., MST graph. It can be used to design effective anomaly detection models to improve the reliability and safety of its physical counterpart. Next, we construct a transformer-based neural network that incorporates both spatial and temporal attention mechanisms based on the MST graphs. The spatial attention module (SAM) is used to model the inter-correlation between different modalities, while the temporal attention module (TAM) is used to model the temporal dependency between data points in a sliding window. Our proposed method is evaluated on two real- world datasets, and the results demonstrate its effectiveness in anomaly detection. To sum up, our contributions include: • We perform the first empirical study of semi-supervised anomaly detection via multi-modal learning from metrics, logs, and traces simultaneously. 15/47数据结构–第六章树和二叉树安徽工业大学计算机科学与技术学院MSTGADLogTraceEdgeFeaturesn×n×FnNodeFeaturesn×FeSpanASpanBSpanCSpanDSpanESpanFGraph SequenceDtSI: Service InstanceNAdd & NormalizationPEPosition EncodingMetricSAMAttentionNTAMAttentionNFFNNSAMAttentionNFeed ForwardNMask TAMAttentionCAMAttentionNNInput EmbeddingInput EmbeddingL ×EncoderL ×DecoderReconstructionMLP & SoftmaxClassificationGt′−GtPtPEZtLegendSI1SI2SI4SI3SI5GraphstructureMicroservice System TwinGraph(GraphStructureisfixed,butedgeandnodefeaturesareupdatedateachtimestamp)SAM:SpatialAttentionModuleMLP:MultilayerperceptionCAM:CrossAttentionModuleTAM:TemporalAttentionModuleFFN: FeedForwardNeural NetworkOt • We propose to integrate and represent the three types of data together via a microservice system twin (MST) graph which can be taken as a virtual representation of a real- world microservice system. • We develop a transformer-based neural network with both spatial and temporal attention mechanisms based on the MST graphs to model the inter-correlation between different modalities and the temporal dependency among the data points (i.e., the MST graphs) of a sliding window. • Extensive experiments on two real-world datasets show that the proposed MSTGAD model achieves competitive performance against all compared approaches, achieving 0.961 F1-score with an average increase of 4.85%. Addi- tionally, ablation studies further validate the effectiveness of each design in our model. II. RELATED WORK In the past decades, various techniques [2], [3] have been proposed for anomaly detection based on metrics (Key Per- formance Indicators), logs, and traces. Log data records the system state and significant events at various critical timestamps, which is an important and valuable resource for online monitoring, anomaly detection, and root cause analysis. There have been a lot of studies on log-based anomaly detection. These logs-based approaches first parse the unstructured logs into structured representations through log parsing approaches including Drain [26], AEL [27], IPLoM [28] and Spell [29], and SemParser [30], then build the anomaly detection models. Deeplog [4] adopts LSTM to model a system log as a natural language sequence, which can automatically learn log patterns from normal execution and detect anomalies when log patterns deviate from the model trained from log data under normal execution, and also it can be incrementally updated in an online manner. LogAnomaly [5] is an end-to-end framework also using the LSTM network to automatically detect sequential and quantitative anomalies simultaneously. To solve log data containing previously unseen log events or log sequences, LogRobust [31] is proposed to extract semantic information of log events and represent them as semantic vectors. It then detects anomalies by utilizing an attention-based Bi-LSTM model, which has the ability to capture the contextual information in the log sequences and automatically learn the importance of different log events. PLELog [7] is a semi-supervised log-based anomaly detec- tion approach via probabilistic label estimation based on an attention-based GRU neural network. To overcome the errors caused by log parsing, NeuralLog [6] is proposed to extract the semantic meaning of raw log messages and represent them as semantic vectors. Existing log anomaly detection approaches treat a log as a sequence of events and cannot handle microservice logs that are distributed in a large number of services with complex interactions. Inspired by kernel-based one-class classification [9], Deep SVDD [10] is proposed to train a neural network by mini- mizing the volume of a hypersphere that encloses the network representations of the data. Tuli et. al. propose a transformer- based anomaly detection model TranAD [15] which uses training process. The self-conditioning and an adversarial DAGMM [11] method uses a deep autoencoding Gaussian mixture model for dimension reduction in the feature space and recurrent networks for temporal modeling. The USAD [12] method uses an autoencoder with two decoders with an adversarial game-style training framework. This is one of the first works that focus on low overheads by using a simple autoencoder and can achieve a several-fold reduction in training times compared to the prior art. The GDN [32] approach learns a graph of relationships between data modes and uses attention-based forecasting and deviation scoring to output anomaly scores. In microservice systems, traces are widely used in anomaly detection and root cause analysis. Seer [17] is an online cloud performance debugging system that leverages deep learning and a massive amount of tracing data to learn spatial and temporal patterns to detect Qos violations. TraceAnomaly [18] is an unsupervised anomaly detection ap- proach of microservice through Service-Level Deep Bayesian Networks. GMTA [19] is a graph-based approach for archi- tecture understanding and problem diagnosis of microservice trace analysis. Liu et al. propose a high-efficient root cause localization approach MicroHECL [20] which dynamically constructs a service call graph and analyzes possible anomaly propagation chains by traversing the graph along anomalous service calls. Although the above approaches have achieved great per- formance in anomaly detection. While they are mainly con- structed based on single-modal data, such as logs, metrics, or traces respectively. However, as a single source of information is often insufficient to depict the status of a microservice system precisely, existing methods could produce many false alarms and may omit some true positives [24]. Recently, several studies have been done based on multi-modal data to further improve the performance of anomaly detection. DeepTraLog [1] utilizes a unified graph representation to describe the complex structure of a trace together with log events embedded in the structure, and trains a GGNNs-based deep SVDD [10] model and detects anomalies in new traces and the corresponding logs. SCWarn [23] is proposed for online service systems to identify the bad software changes via multimodal learning from heterogeneous multi-source data. In SCWarn, the temporal dependency in each time series is captured by the LSTM model, and the inter-correlations among multi-source data are encoded via multimodal fusion. Similar to SCWarn, Liu et al. propose HADES [24] which employs a hierarchical architecture to learn a global representation of the system status by fusing log semantics and metric patterns, and a novel cross-modal attention module to capture discriminative features and meaningful interactions from multi-modal data. In parallel to our research, several other endeavors have emerged to explore the combined utilization of logs, metrics, and traces as modalities, such as [25], [33], [34] Specifically, Eadro [25] presents an end-to-end framework that seamlessly integrates anomaly detection and root cause localization based on multi-source data, specifically designed for troubleshooting purposes. This framework adeptly models both intra-service behaviors and inter-service interactions, exploiting shared knowledge through multi-task learning. AnoFusion [33] offers an unsupervised failure detection approach that efficiently identifies instance failures through multimodal data. It employs a Graph Transformer Network (GTN) to effectively capture correlations within the heterogeneous multimodal data. Addi- tionally, it seamlessly integrates a Graph Attention Network (GAT) with a Gated Recurrent Unit (GRU) to address the challenges introduced by dynamically changing multimodal data. DiagFusion [34], on the other hand, employs embedding techniques and data augmentation to accurately represent mul- timodal data of service instances. By combining deployment data and traces, it constructs a dependency graph and subse- quently employs a graph neural network to localize the root cause instance and determine the type of failure. It is important to note that all the aforementioned approaches are either fully supervised or unsupervised. In contrast, our proposed method is semi-supervised, which effectively leverages both labeled and unlabeled data to enhance model performance. Furthermore, the existing works consider all three modalities as node features in their graph neural networks for capturing spatial dependence, but our approach treats traces as edge fea- tures. Additionally, Eadro [25] and AnoFusion [33] employs CNN and GRU to capture the temporal dependence, whereas our proposed method harnesses the power of Transformers. Transformers have been proven to outperform CNNs and GRUs for time series modeling [35], [36]. Lastly, it is worth mentioning that AnoFusion primarily focuses on anomaly detection, DiagFusion on root cause analysis, while Eadro tackles both anomaly detection and root cause localization. In line with our work, our objective here is anomaly detection, akin to AnoFusion, but distinct from DiagFusion and Eadro. III. PRELIMINARIES In our proposed model, MSTGAD, we use various attention mechanisms to capture the dependencies between different parts of the input data. Before delving into the details of our model, we first introduce different attention mechanisms used in the following sections. A. Scaled Dot-Product Attention The fundamental concept of attention is to determine a series of weights that express the significance or pertinence of various elements within the input information, depending on a particular inquiry. These weights can be utilized to calculate a weighted sum of the input data, which may then be utilized as an input for the subsequent layer of the model. Specifically, given the query Q ∈ RLQ×dk , key K ∈ RLK ×dk , and value V ∈ RLV ×dv , a scaled-dot product attention [37] of the three matrices can be defined as Attention(Q, K, V) = Softmax( QK⊤ √ dk )V, (1) dk) ∈ RLQ×LK can be considered as where Softmax(QK⊤/ a similarity or attention score matrix, and dk is the number of √ features. By selectively focusing on different parts of the input data, attention can help the model to better capture long-term dependencies and improve its overall performance. B. Multi-head Attention Multihead attention is an extension of the above standard attention mechanism that allows the model to jointly attend to information from different representation subspaces. The basic idea behind multi-head attention is to split the input queries, keys, and values into multiple heads, and to compute separate attention scores for each head. The outputs from each head are then concatenated and passed through a linear projection to generate the final output. By using multiple heads, the model can learn to attend to different aspects of the input data, and the final output is a combination of the outputs from multiple heads. Mathematically, the multi-head attention function can be expressed as follows: MultiHead(Q, K, V) = Concat(H1, . . . , Hh) WO, (2) where each Hi = Attention(QWQ i ) is single- head attention, and h is the number heads. The projections WQ i ∈ Rdmodel×dv and WO ∈ Rhdv×dmodel are learnable parameters. i ∈ Rdmodel×dk , WV i ∈ Rdmodel×dk , WK i , KWK i , VWV C. Graph Attention Graph attention is also an extension of the scaled dot- product attention mechanism that can be used to process graph-structured data. Unlike traditional attention mechanisms where the input is a sequence of vectors, in graph attention, the input is a graph where each node represents a vector. Each node is associated with "query" , "key" , and "value" vec- tors, which are used to compute attention scores between pairs of nodes. Specifically, For a graph G = (V, A, E), V is the set of nodes, E is the set of edges and A is the adjacency matrix. A Graph Attention Network (GAT) [38]–[40] layer updates each node representation by aggregating the representations of its neighboring nodes. Each node vi can be updated by (cid:88) ′ v i = αi,uWvu, (3) u∈N(i) where W ∈ Rdmodel×Fv is a learnable parameter, and the graph attention weight αij is defined as e(vi, vj, eij) u∈N(i) e(vi, vu, eiu) αi,j = (4) (cid:80) , where vi ∈ RFv and vj ∈ RFv are the i-th and j-th nodes' feature representation, and eij is the edge representation between the two nodes. Different from standard GAT, the edges are also used to calculate the attention weight. N(i) includes the i-th node and its directed connected neighbors. e(vi, vj, eij) indicates the importance of the features of node j to node i, which is defined as e(vi, vj, eij) = β⊤LeakyReLU(W[vi∥vj∥eij]), (5) where β ∈ R3dmodel and W ∈ R3dmodel×(2Fv+Fe) are learnable parameters, and ∥ denotes vector concatenation. Equivalently, the above formulations can be written in the matrix form as SpatialAtt(V, V, E) = Softmax(e(V, V, E))VW⊤, (6) where e(V, V, E) = β⊤LeakyReLU(W[V∥V∥E]). IV. APPROACH The proposed method, MSTGAD, aims to automatically and accurately detect anomalies by leveraging multi-modal learning from metrics, logs, and traces simultaneously. The approach takes all three modalities as input and trains a graph- based deep learning model based on an enhanced transformer structure. The framework of MSTGAD is presented in Fig. 1, which is mainly composed of two stages, i.e., multi-modal data fusion and representation, and anomaly detection. In the first stage, the features of metrics, logs, and traces are extracted and integrated using an MST graph. The graph represents service instances as nodes and scheduling rela- tionships between different instances as edges. In the second stage, a transformer-based neural network is constructed with spatial and temporal attention based on the MST graphs, for the sake of anomaly detection. The network can model the inter-correlation between different modalities and the temporal dependency of data points in a sliding window. Next, we elaborate on these two stages. A. Pre-Processing and MST graph construction 1) Metric Pre-processing: Metrics provide valuable infor- mation regarding the status of services and machines, such as response time, the number of threads, and CPU and memory usage. In this paper, we focus on multivariate time-series data, denoted as TM etric = {M1, M2, ..., MT }, which represents a sequence of timestamped observations of size T . Each data point Mt ∈ RN ×Fm is collected at a specific timestamp t for N service instances and machines, where Fm is the number of metrics. We further normalize the data and convert it to time-series windows for both training and testing purposes. Specifically, each data point Mt is normalized using min-max normalization, as follow: Mt = Mt − min(TM etric) max(TM etric) − min(TM etric) + ε , (7) where max(TM etric) ∈ RFm and min(TM etric) ∈ RFm are the maximum and minimum vectors in the training time-series, and ε is a small constant vector used to avoid zero-division. In practice, the number of metrics might be huge. To cope with the challenge of real-time data collection, we can remove those metrics whose variances are very low, since anomalies are reflected by metrics with fluctuation. 2) Log Parsing: Logs are text messages that are semi- structured and record system states and significant events at critical timestamps. In this step, we aim to convert unstructured log messages into structured log events. To achieve this, we use the widely adopted parser, Drain3 [26], similar to other studies on anomaly detection [1], [23], [24]. Drain3 can parse logs in a streaming and timely manner with high parsing accuracy and efficiency. After parsing, timestamp, service instance ID, Fig. 2. Framework of MSTGAD and log template index are attached to each log event for further analysis. To enable combined analysis with metrics, we count the occurrences of each template in each timestamp, creating log representations consistent with the formulation of metrics. This yields a timestamped log sequence, denoted as TLog = {L1, L2, ..., LT } of observation of size T , where each data point Lt ∈ RN ×Fl , and Fl is the number log templates. Similar to the normalization of metrics, each data point Lt is also normalized via the min-max normalization as Lt = Lt − min(TLog) max(TLog) − min(TLog) + ε , (8) where max(TLog) ∈ RFl and min(TLog) ∈ RFl are the maximum and minimum vectors in the training time-series. Serializing logs can potentially introduce challenges associ- ated with long-tail distributions. However, it is possible to miti- gate this issue to some extent by leveraging the complementary information from other modalities. For instance, although the occurrence of out-of-memory anomalies is rare and may be affected by the long-tail problem, such anomalies can also be detected through the analysis of metric data. Furthermore, the performance of our method can be further enhanced by incorporating more advanced log parsing techniques [41], including semantic-based approaches [6], [30]. 3) Trace Parsing: Each trace in a microservice system depicts the execution processes of user requests. These pro- cesses are known as spans, and they possess valuable attributes such as trace ID, request type, span ID, father span ID, service instance ID, start time, and duration time. In the spirit of TraceAnomaly [18], we represent spans as time series. Within a sliding window, we aggregate the total duration time of spans sharing the same request type, service instance launcher, and service instance receiver for each timestamp. It is important to note that unfinished spans are omitted from the window. Consequently, we obtain a timestamped trace sequence TT race = {S1, S2, ..., ST } of size T , and each data 22/47数据结构–第六章树和二叉树安徽工业大学计算机科学与技术学院L×EncoderL×DecoderInput EmbeddingInputs Dt(Shifted right)MASKTAMCAMReconstructionMLP & SoftmaxGt′−GtPtOutput Gt′PredictionInput EmbeddingInputs DtTAMZtTime point St ∈ RN ×N ×Fs , where N indicates the number of service instances of a microservice system, and Fs indicates the dimension of the extracted features of traces. Since not all service instances are interconnected, we use an approximate normalization technique to differentiate between small spans and no spans. Specifically, we define it as: St = St mean(TT race) , (9) where mean(TT race) ∈ RFs is the average of TT race In reality, if tremendous traces are generated, state-of-the-art head-based and tail-based sampling techniques can be applied to reduce the processing and storage costs. 4) Graph Construction: After obtaining TM etrics, TLog, and TT race, we can integrate these three modalities together by constructing an MST graph to virtually represent the status and scheduling relationships among service instances of a real- world microservice system. In an MST graph, nodes represent service instances, and edges represent scheduling relationships between different instances. Formally, for each timestamp t, the MST graph is defined as Gt =< Vt, At, Et >, where Vt is the set of nodes and the corresponding node features are defined as Vt = Mt∥Lt, i.e., the concatenation of metric and log features, and ∥ indicates the concatenation operator. Et is the set of edges, and Et = St is used to represent the features of edges, and At is the adjacent matrix. Each element aij of At is defined as aij =    1, 0, if their is scheduling between the i-th and j-th service instances otherwise . In reality, microservice systems undergo constant changes, such as services scaling up or down. These changes can be accommodated by updating the adjacency matrix when services are added or removed. However, it is important to note that the parameters of the Graph ATtention network (GAT) used in the proposed model, which will be introduced in the following sections, can remain unchanged. This is because the GAT operates on the graph structure itself, rather than being dependent on the specific services present in the system. As a result, the model can effectively adapt to changes in the microservice system without the need for retraining or mod- ifying the GAT parameters. Furthermore, by considering the preprocessed metrics and logs as node features, and the traces as edge features, we can characterize the dynamic behavior of traces by adjusting the edge features accordingly, without modifying the underlying graph structure. This property al- lows for efficient representation of changes in the scheduling relationships among service instances. Consequently, when a service is removed from the system, we can alternatively set the corresponding node and edge features to zero without removing the service from the graph. In summary, the real-time status and scheduling relation- ships among service instances of a real-world microservice system can be virtually represented by the MST graph, which can be used to design an effective anomaly detection model to improve the reliability and safety of its physical counterpart. To model the temporal dependence of a data point at timestamp t, we consider a sliding window of length k as Dt = {Gt−k+1, * * * , Gt}. (10) For each sliding window Dt, yt ∈ R1×N is the ground truth label vector, and yti ∈ {−1, 0, 1} is the ground truth label for the i-th service instance in Gt. The numbers 1 and 0 indicate abnormal and normal data respectively, and −1 indicates the corresponding label is unknown for the unlabelled data. B. Transformer with Spatial and Temporal Attention MSTGAD is constructed based on the transformer [37] architecture for anomaly detection via attentive multi-modal learning. Fig. 2 shows the architecture of the neural network used in MSTGAD, which consists of encoding (left side) and decoding (right side) steps with several attention modules. In the encoding step, the encoder takes the input sequence Dt with k MST graphs (cf. Eq (10)) and converts it to a hidden state Zt. To accomplish this, Dt is first subjected to the Input Embedding operation, a linear layer that maps multi-source features to appropriate dimensions for multi-head attention. We also add position encoding [37] of each data point on the time dimension to provide MSTGAD with local position information. In order to model the inter-correlation between different modalities, we propose the spatial attention module (SAM), which is based on GAT [39]. Moreover, we propose the temporal attention module (TAM) to model the temporal dependency between different data points in the sliding window Dt. Specifically, the workflow of each layer of the encoder can be defined by a series of operations: EI1 = Norm(EI0 + SAM(EI0)), EI2 = Norm(EI1 + TAM(EI1)), Zt = Norm(EI2 + FFN(EI2)), where Norm(*) is the normalization operation, and FFN is the Feed-forward neural network. In the decoding step, Dt−1 will be used to predict the representation of Dt. To achieve this goal, Dt is shifted one timestamp to the right and padded with zero at the first times- tamp as the input of decoding. After that, the input sequence Dt−1 is also converted to DI0 via the Input Embedding operation. The spatial attention module (SAM) is then applied to model the inter-correlation between different modalities. Unlike the encoding step, TAM is run with a causal mask to ensure that each Gt is updated or predicted only based on its former data points. In addition, we propose a cross- attention module (CAM) to update Dt with the guidance of Zt. Correspondingly, the workflow of each layer of the decoder can be defined as the following operations: DI1 = Norm(DI0 + SAM(DI0)), DI2 = Norm(DI1 + Mask(TAM(DI1))), DI3 = Norm(DI2 + CAM(DI2, Zt)), Ot = Norm(DI3 + FFN(DI3)). Finally, we detect anomalies based on the reconstruction errors between Dt and Ot. The following subsections provide (a) Update the feature of nodes (b) Update the feature of edges Fig. 3. Spatial Attention further details about the SAM, TAM, and CAM attention mod- ules. Dt is the input of MSTGAD, and Mt−k+1:t, Lt−k+1:t, and St−k+1:t are used to represent the features of metrics, logs, and traces of Dt respectively for convenience. 1) Spatial Attention Module: As mentioned in the introduc- tion, metrics, logs, and traces are different ways of viewing the status of a microservice system. By exploiting the complemen- tary information from these different modalities, we can boost the generalization ability of anomaly detection algorithms. To achieve this, we propose a spatial attention module (SAM) that models the inter-correlation between modalities using two layers of Graph Attention Network (GAT) [39]. SAM allows for the updating of node and edge features by incorporating information from their neighbors through message passing. Fig. 3 provides a toy example, where SI stands for service instance. In Fig. 3(a), when updating the representation of a node, the information from its directed neighbors will be passed to it with an attention weight along the edges. Similarly, the feature of edges can be updated by exchanging the roles of nodes and edges in an MST graph (see Fig. 3(b)). As a result, the representation of each modal can be updated and improved by absorbing the complementary information from other modalities. In this paper, for an input MST graph Gt = (Vt, At, Et), we apply multi-head attention (see Eq.(2)), and then the features of nodes of service instances of Gt can be updated by ′ V (11) t = MultiHead(Vt, Vt, Et), where each head Hi = SpatialAtt(Vt, Vt, Et) (see Eq.(6)). Unlike standard GAT [39], our approach incorporates edges in the calculation of the attention weight. The reasoning behind this is that edge features represent the features of traces, and excluding them would result in the loss of valuable trace information. By exchanging the roles of nodes and edges in an MST graph, the features Et of edges of service scheduling in each Gt can be updated in the same manner as ′ E t), t = MultiHead(Et, Et, V where each head Hi = SpatialAtt(Et, Et, V t). ′ ′ (12) The SAM module consists of two layers of GAT which alternate in updating the features of nodes and edges. This enables the module to efficiently model the complex inter- correlation among metrics, logs, and traces by learning the representation of each MST graph Gt in a sliding window Dt. Through the thorough integration and fusion of comple- mentary information among the three modalities, the SAM Fig. 4. Framework of the Temporal Attention module produces an enriched representation G t. Thus, for a sliding window, we will update all the MST graphs to get a new representation of Dt as DSAM ′ ′ t = (G t−k+1, . . . , G t) = SAM(Dt). ′ 2) Temporal Attention Module: The above SAM module is designed to model the complex inter-correlation among different modalities at the local graph level across space. In this section, we further propose the temporal attention module (TAM) to capture the complex inter-correlation among different modalities at the global sequence level across time. Notice that in a microservice system, multi-source monitored data are generated sequentially and exhibit temporal trends. To improve anomaly detection performance, it is crucial to model temporal dependencies within these sequences. Therefore, we adopt the TAM module to capture time dependencies for data points in a sliding window. As a first step, we extend the attention mechanism in Eq. (1) as TemporalAtt(Q, K, V, C) = Softmax( QK⊤ √ dk + C)V, (13) where C is the average of attention scores of multi-source data. This is used to capture the common temporal dependencies shared by the multi-source data and fuse the complementary information among them. Next, we apply the multi-head self-attention across time to a sequence of the spatial representation of the MST graph given by the SAM. The structure of TAM is shown in Fig. 4. By capturing the temporal dependency, the feature of metrics Mt−k+1:t can be updated as t−k+1:t = Multihead(Mt−k+1:t, Mt−k+1:t, Mt−k+1:t, C), i , Mt−d+1:tWK i , i , C), and the average of attention score C is ′ M where each Hi = TemporalAtt(Mt−d+1:tWQ Mt−d+1:tWV defined as ( t−k+1:t Mt−k+1:tM⊤ √ Lt−k+1:tL⊤ Fl Similarly, the feature of logs and traces can be updated as St−k+1:tS⊤ Fs t−k+1:t t−k+1:t Fm )/3. √ √ + + ′ L S t−k+1:t = Multihead(Lt−k+1:t, Lt−k+1:t, Lt−k+1:t, C), t−k+1:t = Multihead(St−k+1:t, St−k+1:t, St−k+1:t, C). ′ In summary, we will update all modalities within Dt as t = TAM(Norm(Dt + DSAM DTAM )) t (cid:9)(cid:8)(cid:2)(cid:9)(cid:8)(cid:1)(cid:9)(cid:8)(cid:3)(cid:7)(cid:10)(cid:12)(cid:11)(cid:3)(cid:7)(cid:10)(cid:12)(cid:11)(cid:4)(cid:7)(cid:10)(cid:12)(cid:11)(cid:1)(cid:7)(cid:10)(cid:12)(cid:11)(cid:2)(cid:7)(cid:10)(cid:12)(cid:11)(cid:5)(cid:7)(cid:10)(cid:12)(cid:11)(cid:6)(cid:7)(cid:10)(cid:12)(cid:11)(cid:4)(cid:9)(cid:8)(cid:1)(cid:7)(cid:10)(cid:12)(cid:11)(cid:3)(cid:7)(cid:10)(cid:12)(cid:11)(cid:2)(cid:7)(cid:10)(cid:12)(cid:11)(cid:1)(cid:7)(cid:10)(cid:12)(cid:11)(cid:6)(cid:7)(cid:10)(cid:12)(cid:11)(cid:5)(cid:9)(cid:8)(cid:2)(cid:9)(cid:8)(cid:3)(cid:9)(cid:8)(cid:2)(cid:9)(cid:8)(cid:3)(cid:9)(cid:8)(cid:1)(cid:9)(cid:8)(cid:2)(cid:9)(cid:8)(cid:1)(cid:9)(cid:8)(cid:3)(cid:7)(cid:10)(cid:12)(cid:11)(cid:3)(cid:7)(cid:10)(cid:12)(cid:11)(cid:4)(cid:7)(cid:10)(cid:12)(cid:11)(cid:1)(cid:7)(cid:10)(cid:12)(cid:11)(cid:2)(cid:7)(cid:10)(cid:12)(cid:11)(cid:5)(cid:7)(cid:10)(cid:12)(cid:11)(cid:6)(cid:7)(cid:10)(cid:12)(cid:11)(cid:4)(cid:9)(cid:8)(cid:1)(cid:7)(cid:10)(cid:12)(cid:11)(cid:3)(cid:7)(cid:10)(cid:12)(cid:11)(cid:2)(cid:7)(cid:10)(cid:12)(cid:11)(cid:1)(cid:7)(cid:10)(cid:12)(cid:11)(cid:6)(cid:7)(cid:10)(cid:12)(cid:11)(cid:5)(cid:9)(cid:8)(cid:2)(cid:9)(cid:8)(cid:3)(cid:9)(cid:8)(cid:2)(cid:9)(cid:8)(cid:3)(cid:9)(cid:8)(cid:1)9/47数据结构–第六章树和二叉树安徽工业大学计算机科学与技术学院xm(l)xl(l)xs(l)xm(l+1)xl(l+1)xs(l+1)+AttlAttmAttsAttm′Attl′Atts′+++ ′ = (M t−k+1:t, L t−k+1:t, S t−k+1:t). ′ ′ 3) Cross Attention Module: The cross-attention module CAM is proposed to perform decoding using the hidden state Zt given by the encoder. This module assists the decoder in obtaining guidance information from Zt. To achieve this goal, we adopt the multi-head attention (see Eq.(2)). To distinguish features between Dt and Zt, we add a superscript, e.g. MZ t−k+1:t, to indicate the feature of metrics in the encoding and decoding stages respectively. In CAM, features of the three modalities are updated by t−k+1:t and MD ′D ′D M t−k+1:t, MZ t−k+1:t, MZ t−k+1:t = MultiHead(MD t−k+1:t, LZ t−k+1:t = MultiHead(LD L t−k+1:t, SZ t−k+1:t = MultiHead(SD S Similarly to TAM, we can update all modalities by Dt and of the sliding window. t−k+1:t, LZ t−k+1:t, SZ Zt to obtain a new representation DCAM t−k+1:t), t−k+1:t). t−k+1:t), ′D DCAM t t = CAM(Norm(DI1 + Mask(TAM(DI1))), Zt) = (M ′D t−k+1:t, L ′D t−k+1:t, S ′D t−k+1:t). where DI1 = Norm(Dt + DSAM ). This updated representation is then passed through the feed-forward and normalization layers to generate the final reconstruction representation. t 4) Loss Function: For an anomaly algorithm deployed to production, given a sliding window Dt = {Gt−k+1, * * * , Gt} with k MST graphs, our primary concern is whether the service instances in the last graph Gt is abnormal or not. Therefore, we only calculate the distance between the input Gt and the output G ′ t as ∥Gt − G ′ t∥ = R ◦ R ′ ′ ′ t), (Lt − L where ◦ indicates the element-wise product, R = Concat t)) ∈ RN ×(Fm+Fl+Fs), t), W(St − S ((Mt − M and W is a learnable parameter that maps the third item to the same dimension as the first two items. Using this distance, we can make predictions for the service instances within an MST graph via supervised learning (i.e., the probability of being abnormabl Pt ∈ RN ×2) and unsupervised learning (i.e., the reconstruction error REt ∈ RN ), as follows: REt = sum(∥Gt − G t∥, 2), ′ Pt = Softmax(MLP(∥Gt − G ′ t∥)), where sum(*, 2) indicates the summation by colmuns. MSTGAD aims to train an efficient anomaly detection model based on limited labeled data and a substantial amount of unlabelled data. To this end, we adopt a semi-supervised reconstruction loss and a supervised classification loss, which can be combined as follows: Loss = 1 epoch L1 + (1 − 1 epoch )L2, (14) where L1 is the loss for data reconstruction, L2 is the loss for classification, and epoch represents the current epoch number. More concretely, the semi-supervised loss L1 is defined as: L1 = 1 m + n (η m (cid:88) i=1 REi + na(cid:88) i=1 1 REi + nn(cid:88) i=1 REi), (15) Algorithm 1: The MSTGAD training algorithm Input: Dataset used for training {Dt}T Decoder D, Iteration limit M ; t=1, Encoder E, Output: Model Coefficients 1 Initialization: Initialize the weights of E and D; 2 i ← 1; 3 repeat 4 0 ← InputEmbedding(Dt); for t = 1 to T do EI t 0, DI t Zt ← E(EI t ′ t ← D(DI t G Calculate REt and Pt; i L1 + (1 − 1 L = 1 i )L2; Update the weights of E and D using L; 0) ; 0, Zt); 5 6 7 8 9 10 i ← i + 1; 11 12 until i > M ; where m and n are respectively the numbers of unlabeled and labeled service instances in the training data, REi indicates the reconstruction error for the i-th service instance, η is a hyperparameter that balances the weight between labeled and unlabeled data, na and nn are the numbers of abnormal and normal service instances in the training data, respectively, and n = na + nn. This semi-supervised reconstruction loss helps the model learn the underlying patterns in the data and detect anomalies based on deviations from these patterns. The supervised classification loss, on the other hand, helps the model to classify the service instances as normal or ab- normal based on the learned patterns. Specifically, we employ the binary cross entropy loss: n (cid:88) yi log(ˆyi) + (1 − yi) log(1 − ˆyi)], L2 = − (16) 1 n [ nn na i=1 where ˆyi denotes the predicted probability for the i-th service instance, nn is introduced to control the trade-off between na normal and abnormal data in the loss function. This loss function enables the model to learn to distinguish between normal and abnormal service instances more accurately, which leads to better performance in detecting anomalies. Note that in Eq. (14) the weight of the two losses changes with the number of epochs to balance the relative impor- tance of the reconstruction loss and the classification loss during the training process. In the early stages of training, the model relies more on the reconstruction loss to learn the underlying patterns in the data and reconstruct the input data accurately. At this stage, the importance of the classi- fication loss is relatively smaller, as the model has not yet learned to distinguish between normal and abnormal service instances accurately. As the training progresses, the model becomes better at reconstructing the input data and learning the underlying patterns. At this stage, the importance of the classification loss increases, as the model needs to learn to distinguish between normal and abnormal service instances more accurately. Therefore, we adjust the weight of the two losses with the number of epochs, starting with a higher weight for the reconstruction loss and gradually decreasing it while increasing the weight of the classification loss. This approach ensures that the model can learn the underlying patterns in the data effectively while also accurately identifying anomalies, ultimately leading to a more robust and accurate anomaly detection model. The overall training processes of MSTGAD are summarized in Algorithm 1. V. EVALUATION A. Datasets To evaluate the effectiveness of our proposed method, we used two multi-modal anomaly detection datasets in our experiment. Both datasets contain metrics, logs, and traces. 1) MSDS: The multi-modal dataset MSDS1 [42] is com- posed of distributed traces, application logs, and metrics from a complex distributed system (Openstack) that is used for AI-powered analytics. The metrics data contains information from 5 physical nodes in the infrastructure, each containing 7 metrics such as RAM and CPU usage. The log files are dis- tributed across the infrastructure and recorded for each node, with a total of 23 features. The trace information encompasses various attributes such as host, event name, service name, span ID, parent ID, and trace ID. Notably, the MSDS also provides a JSON file containing the ground-truth information for the injected anomalies, including their start and end times, as well as their corresponding anomaly types. Hence, by leveraging this JSON file, the service instances' label information can be easily extracted and assigned within an MST graph. The ratio of normal and abnormal data is approximately 80:1. 2) AIOps-Challenge: The AIOps-Challenge 2 dataset serves as the foundation for the CCF International AIOps Challenge organized by CCF (China Computer Federation), Tsinghua University, and CCB (China Construction Bank) in 2022. This dataset is derived from a simulated e-commerce system operating on a microservice architecture, with 40 ser- vice instances deployed across 6 physical nodes. Each service instance records metrics, encompassing a total of 56 metrics, of which 25 are utilized in this study, including metrics related to RAM and CPU usage. Additionally, log files are recorded for each service instance, containing a collective set of 5 features, such as timestamps and original logs, among others. The traces within the dataset capture scheduling information among service instances, including timestamps, types, status codes, service instance names, span IDs, parent IDs, and trace IDs. Within the AIOps-Challenge dataset, three levels of anomalies are intentionally injected, specifically at the service, pod (service instance), and node levels. The injected anomalies are accompanied by their start times, levels, service names, and types. Accordingly, the label information for service instances can be extracted based on the injected anomalies. In specific terms, if a service anomaly is injected, the corresponding service instances are labeled as abnormal. Similarly, if a node 1https://zenodo.org/record/3549604 2https://aiops-challenge.com/ anomaly is injected, the service instances configured within that node are all labeled as abnormal. It is crucial to note that the end time of an injected anomaly is not provided. To address this limitation, we manually set the end time with a maximum interval of two minutes. The ratio of normal data to abnormal data in this dataset is approximately 120:1. B. Experiment Settings Unless otherwise specified, for all datasets, we allocated 60% of the data for training, 10% for validation, and the remaining 30% for testing. Since PLELog, HADES, and our approach MSTGAD are semi-supervised, we randomly selected 50% of the training data as unlabelled. To evaluate the performance of all approaches, we utilized precision (PR), recall (RC), F1-score, average precision (AP), and area under the receiver operating characteristic curve (ROC/AUC) as the criteria [1]–[3]. PR indicates how many of the anomalous events predicted are actual. RC denotes the percentage of predicted abnormal events versus all abnormal events. The F1-score is the harmonic mean of precision and recall. AP indicates the weighted mean of precisions achieved at each threshold, with the increase in recall from the previous thresh- old used as the weight. All experiments are run on a Linux server equipped with an Intel(R) Xeon(R) Gold 5318Y CPU, 64 GB RAM, RTX 3090 with 24GB GPU memory, and Ubuntu 18.04.6 OS. Our implementation of MSTGAD is created using Python 3.8.13, PyTorch 1.12.0 [43] with CUDA 11.3, and PyTorch Geometric Library 2.2.0 [44]. The encoder and decoder layers were set to two, the batch size was 50, the window size was 10, and the Dropout was set to 0.2. We used the AdaBelief [45] optimizer with an initial learning rate of 0.001 and a step-scheduler with a step size of 0.9 for training. We trained models for up to 300 epochs and utilized early stopping with a patience of 15. C. Benchmark Algorithms To verify the effectiveness of our proposed method MST- GAD, we conducted a comparative analysis with state-of- the-art models for multivariate time-series anomaly detec- tion, including TraceAnomaly [18], PLELog [7], TranAD [15], USAD [12], SCWarn [23] and HADES [24]. Table I presents an overview of the distinguishing features of these models. We utilized the open-source codes provided by their respective publications for comparisons. For these approaches, the window size is 10, the batch size is 50, and the other hyperparameters of them are tuned by grid searching based on the validation set. D. Experimental Result 1) Results of Anomaly Detection: The average experimental results for the benchmark algorithms on the MSDS and AIOps-Challenge datasets are presented in Table II and III respectively. Based on the outcomes of the experiments, we can make the following observations: MSTGAD, our proposed method, achieves the best per- formance among all compared approaches and outperforms TABLE I CHARACTERISTICS OF THE COMPARING MODELS TABLE III EXPERIMENTAL RESULTS ON AIOPS-CHALLENGE DATASET Method TraceAnomaly TranAD USAD SCWarn PLELog HADES MSTGAD Data Used Trace Metric Metric Metric & Log Log Metric & Log Metric&Log& Trace Supervised Type Unsupervised Unsupervised Unsupervised Unsupervised Semi-supervised Semi-supervised Semi-supervised TABLE II EXPERIMENTAL RESULTS ON MSDS DATASET Method TraceAnomaly PLELog TranAD USAD SCWarn HADES MSTGAD PR 0.903 0.753 0.772 0.481 0.440 0.908 0.946 RC 0.989 0.663 0.815 0.463 0.371 0.895 0.969 AUC 0.986 0.826 0.907 0.730 0.679 0.947 0.996 AP 0.894 0.516 0.815 0.611 0.581 0.814 0.971 Online × (cid:8) (cid:8) (cid:8) (cid:8) (cid:8) (cid:8) F1 0.944 0.705 0.793 0.472 0.402 0.901 0.957 Method TraceAnomaly PLELog TranAD USAD SCWarn HADES MSTGAD PR 0.857 0.750 0.661 0.667 0.878 0.911 1 RC 0.239 0.173 0.789 0.750 0.625 0.937 0.933 AUC 0.619 0.586 0.827 0.813 0.798 0.958 0.974 AP 0.234 0.142 0.738 0.728 0.762 0.865 0.977 F1 0.374 0.281 0.719 0.706 0.730 0.924 0.965 TABLE IV EXPERIMENTAL RESULTS OF ABLATION STUDY ON MSDS DATASET Method MSTGAD-Metric MSTGAD-Log MSTGAD-Trace MSTGAD-TAM MSTGAD-SAM MSTGAD-C MSTGAD PR 0.920 0.758 0.720 0.932 0.965 0.939 0.946 RC 0.957 0.917 0.920 0.917 0.929 0.929 0.969 AUC 0.996 0.986 0.977 0.960 0.975 0.967 0.996 AP 0.960 0.949 0.876 0.948 0.967 0.955 0.971 F1 0.937 0.830 0.807 0.921 0.947 0.933 0.957 all baselines by a significant margin, attaining F1-score of 0.957 and 0.965 on the two datasets. The high scores of MSTGAD indicate that there are few instances of missed anomalies or false alarms, which highlights the effectiveness of our approach for anomaly detection. Moreover, compared with single-modal approaches, MST- GAD achieves superior performance. Previous studies have shown that metrics, logs, and traces can all reflect anomalies, and none of them are sufficient when acting alone. Thus, constructing the model based on a single data modality can omit important information hidden in the other data modalities, resulting in performance degradation. Additionally, the log- based approach PLELog's performance may be influenced by the distribution of logs, i.e., the significant difference in the number of logs in different sliding windows. On the other hand, compared with multi-modal based ap- proaches SCWarn and HADES, MSTGAD outperforms them across all measurements on average. The possible reasons are summarized from three aspects: 1) SCWarn and HADES only use two types of data modalities, i.e., metrics and logs. 2) SCWarn is an unsupervised method and does not use super- vised information to guide the training process. Furthermore, it detects anomalies on each modality individually and fails to identify the hidden correlations among the multi-modal data. 3) HADES is designed with an attention-based module, which fuses information between metrics and logs. However, it only detects anomalies for a single service instance and ignores the interaction between multiple service instances. In contrast, MSTGAD detects anomalies via multi-modal learning based on metrics, logs, and traces simultaneously. The three modalities are effectively integrated via an MST graph, while spatial and temporal attention modules are proposed to model the interactions between different data modalities, and the complementary information among them and specific information are thoroughly fused and effectively integrated. In conclusion, MSTGAD effectively detects abnormal pat- terns in all datasets, significantly proving its superiority over all baselines in terms of every evaluation criterion. 2) Ablation Study: To comprehensively assess the efficacy of different modules of MSTGAD, we conducted an ablation study on the MSDS dataset, and the experimental results are listed in Table IV, where "MSTGAD-X" indicates that MST- GAD is executed without the module or data modal "X" . For example, "MSTGAD-Metric" means MSTGAD is executed without the metrics data. It can be seen from Table IV that all modules and data modalities contribute significantly to im- proving the performance of MSTGAD. Concretely, MSTGAD improvement over MSTGAD-Metric, exhibits a significant MSTGAD-Log, and MSTGAD-Trace with an impressive mar- gin of 3.933% in terms of F1-score on average, showcasing its exceptional ability to effectively utilize multi-modal data for anomaly detection. Notably, MSTGAD-Trace performs worse in than MSTGAD-Metric and MSTGAD-Log. Recall MSTGAD, both metrics and logs serve as node features, while only traces are utilized as edge features. When trace data is removed, the SAM module can only utilize the node features, compromising the effectiveness of updating and enhancing the graph representation. Consequently, the complementary information from different modalities cannot be effectively integrated, resulting in suboptimal performance. Remarkably, similar observations have been reported in Eadro [25], further emphasizing the fundamental role of trace data in combining and exploiting information from the other two modalities. that In the meantime, MSTGAD demonstrates statistically sig- nificant or, at the very least, comparable performance com- pared to MSTGAD-TAM and MSTGAD-SAM. The impres- sive performance of MSTGAD validates the effectiveness of incorporating both spatial and temporal attention mechanisms in anomaly detection. Moreover, MSTGAD-SAM outperforms MSTGAD-TAM, indicating that modeling temporal depen- dencies is crucial and highly effective in addressing anomaly detection challenges. TABLE V STATISTICAL CHARACTERISTICS OF THE EXPERIMENTAL DATASETS AND THE PROCESSING TIME OF MSTGAD Dataset MSDS AIOps Dataset MSDS AIOps Interval 1s 1min # Metrics (instance*metric) 5*3 40*25 Running Time # Logs # Spans 11 9260 152 6253 Preprocessing 0.014s 6.7946s Constructing graph 0.0088s 0.173s Detecting 0.0035s 0.4648s Total 0.0263s 7.4324s The results demonstrated that the performance of MSTGAD significantly improved with an increase in labeled data. It is worth noting that most of the labeled data are normal patterns that are easily obtainable in real-world applications. Finally, Fig. 5(d) shows the impact of the sliding window size k on the precision, recall, and F1-score of MSTGAD. Smaller or larger values of k typically lead to lower perfor- mance due to insufficient or unrelated features in the window. We observed that the best performance was achieved when k was set to 10, as shown in Fig. 5(d). 4) Real-time Detection: In the proposed method, the three modalities are first extracted and then integrated using an MST graph structure for anomaly detection. It is essential for the time consumption of this step to be smaller than the process interval of a microservice system, ensuring real-time detection capabilities. In this section, we present experimental results conducted on the MSDS and AIOps-Challenge datasets to demonstrate the efficiency of our method. The summarized results are presented in Table V, where # Metrics, # Logs, and # Spans correspond to the average number of metrics, logs, and spans observed within each processing interval. It is important to note that all experiments were conducted exclusively using CPU resources, without utilizing GPU or multithreading techniques for acceleration. The results un- equivocally illustrate the applicability of the proposed method to real-world applications, exhibiting its capability to perform real-time anomaly detection. VI. CONCLUSION In this paper, we propose a novel semi-supervised graph- based anomaly detection method MSTGAD that utilizes at- tentive multi-modal learning. We fuse the multi-modal data and represent them via an MST graph, where each node corresponds to a service instance, and the edge indicates the scheduling relationship between different service in- stances. Based on the MST graph sequences, we construct a transformer-based neural network with both spatial and temporal attention mechanisms to automatically and accurately detect anomalies in a timely manner. Experimental results demonstrate that MSTGAD achieves superior performance compared to state-of-the-art approaches. Furthermore, our results verify that effectively modeling the correlation between different data modalities and the time dependency within each data modality can further improve the performance of anomaly detection. (a) Number of layers of encoder and decoder (b) Balance weight η (c) Percent of labelled data (d) Sliding window size Fig. 5. Parameter Sensitivity Analysis MSTGAD-C indicates that MSTGAD runs without mod- eling the common temporal dependency shared by different modalities, i.e., the matrix C is removed from Eq.(13). As shown in Table IV, MSTGAD achieves a better performance than MSTGAD-C. It demonstrates the effectiveness of captur- ing the common temporal dependencies shared by the multi- source data and fusing the complementary information among them. 3) Parameter Sensitivity Analysis: The proposed method, MSTGAD, incorporates several crucial hyperparameters, in- cluding the sliding window size k, the number of encoder and decoder layers, the balance weight η, and the percentage of labeled data. To evaluate the sensitivity of these parameters, we conducted experiments on the MSDS dataset, and the results are displayed in Fig. 5. Fig. 5(a) demonstrates the impact of the number of encoding and decoding layers on the performance of MSTGAD. We observed that a smaller or larger number of layers typically leads to lower performance, with the optimal range being between two and six layers. The performance of MSTGAD decreased with an increase in the number of hidden layers, probably due to the over-smoothing that makes the features indistinguishable, leading to reduced classification accuracy. Fig. 5(b) illustrates the impact of the balance weight η on the precision, recall, and F1-score of MSTGAD. As described in Section IV-B, η controls the trade-off between labeled and unlabeled data in the reconstruction loss. The results indicate that both precision and F1-score decrease with an increase in η, primarily due to the model giving more attention to the noisy unlabeled data points. η is typically set between 10−4 and 10−1, based on the preference for precision and recall. The impact of the percentage of labeled data for the training stage on the performance of MSTGAD is depicted in Fig. 5(c). REFERENCES [1] C. Zhang, X. Peng, C. Sha, K. Zhang, Z. Fu, X. Wu, Q. Lin, and D. Zhang, "Deeptralog: Trace-log combined microservice anomaly detection through graph-based deep learning," in Proceedings of the IEEE/ACM 44th International Conference on Software Engineering (ICSE), 2022, p. 623–634. [2] J. Soldani and A. Brogi, "Anomaly detection and failure root cause analysis service-based cloud applications: A survey," ACM Comput. Surv., vol. 55, no. 3, feb 2022. [Online]. Available: https://doi.org/10.1145/3501297 in (micro) [3] P. Notaro, J. Cardoso, and M. Gerndt, "A survey of aiops methods for failure management," ACM Trans. Intell. Syst. Technol., vol. 12, no. 6, nov 2021. [Online]. Available: https://doi.org/10.1145/3483424 [4] M. Du, F. Li, G. Zheng, and V. Srikumar, "Deeplog: Anomaly de- tection and diagnosis from system logs through deep learning," in Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security. ACM, October 2017, p. 1285–1298. [5] W. Meng, Y. Liu, Y. Zhu, S. Zhang, D. Pei, Y. Liu, Y. Chen, R. Zhang, S. Tao, P. Sun, and R. Zhou, "Loganomaly: Unsupervised detection of sequential and quantitative anomalies in unstructured logs," in Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence. AAAI Press, August 2019, p. 4739–4745. [6] V.-H. Le and H. Zhang, "Log-based anomaly detection without log parsing," in Proceedings of the 36th IEEE/ACM International IEEE Conference on Automated Software Engineering, ser. ASE '21. Press, 2022, p. 492–504. [Online]. Available: https://doi.org/10.1109/ ASE51524.2021.9678773 [7] L. Yang, J. Chen, Z. Wang, W. Wang, J. Jiang, X. Dong, and W. Zhang, "Plelog: Semi-supervised log-based anomaly detection via probabilistic label estimation," in 2021 IEEE/ACM 43rd International Conference on Software Engineering: Companion Proceedings (ICSE-Companion), Madrid, ser. ICSE '21. IEEE Press, 2021, p. 230–231. [Online]. Available: https://doi.org/10.1109/ICSE-Companion52605.2021.00106 [8] V.-H. Le and H. Zhang, "Log-based anomaly detection with deep learning: How far are we?" in Proceedings of the 44th International Conference on Software Engineering, ser. ICSE '22. New York, NY, USA: Association for Computing Machinery, 2022, p. 1356–1367. [Online]. Available: https://doi.org/10.1145/3510003.3510155 [9] B. Sch ̈olkopf, J. C. Platt, J. Shawe-Taylor, A. J. Smola, and R. C. Williamson, "Estimating the support of a high-dimensional distribution," Neural Computation, vol. 13, no. 7, pp. 1443–1471, 2001. [10] L. Ruff, R. Vandermeulen, N. Goernitz, L. Deecke, S. A. Siddiqui, A. Binder, E. M ̈uller, and M. Kloft, "Deep one-class classification," in Proceedings of the 35th International Conference on Machine Learning, ser. Proceedings of Machine Learning Research, J. Dy and A. Krause, Eds., vol. 80. PMLR, 10–15 Jul 2018, pp. 4393–4402. [Online]. Available: https://proceedings.mlr.press/v80/ruff18a.html [11] B. Zong, Q. Song, M. R. Min, W. Cheng, C. Lumezanu, D. Cho, and H. Chen, "Deep autoencoding gaussian mixture model for unsupervised anomaly detection," in Proceedings of the International Conference on Learning Representations, 2018. [Online]. Available: https://openreview.net/forum?id=BJJLHbb0- [12] J. Audibert, P. Michiardi, F. Guyard, S. Marti, and M. A. Zuluaga, "Usad: Unsupervised anomaly detection on multivariate time series," in Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, ser. KDD '20. New York, NY, USA: Association for Computing Machinery, 2020, p. 3395–3404. [Online]. Available: https://doi.org/10.1145/3394486.3403392 [13] Z. Li, Y. Zhao, J. Han, Y. Su, R. Jiao, X. Wen, and D. Pei, "Multivariate time series anomaly detection and interpretation using hierarchical inter-metric and temporal embedding," in Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, ser. KDD '21. New York, NY, USA: Association for Computing Machinery, 2021, p. 3220–3230. [Online]. Available: https://doi.org/10.1145/3447548.3467075 [14] G. Zerveas, S. Jayaraman, D. Patel, A. Bhamidipaty, and C. Eickhoff, "A transformer-based framework for multivariate time series representation learning," in Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, ser. KDD '21. New York, NY, USA: Association for Computing Machinery, 2021, p. 2114–2124. [Online]. Available: https://doi.org/10.1145/3447548.3467401 [15] S. Tuli, G. Casale, and N. R. Jennings, "Tranad: Deep transformer networks for anomaly detection in multivariate time series data," Proc. VLDB Endow., vol. 15, no. 6, p. 1201–1214, Available: https://doi.org/10.14778/3514061.3514067 jun 2022. [Online]. [16] Z. Ren, C. Liu, X. Xiao, H. Jiang, and T. Xie, "Root cause localization for unreproducible builds via causality analysis over system call tracing," in Proceedings of the 34th IEEE/ACM International Conference on Automated Software Engineering, ser. ASE '19. IEEE Press, 2020, p. 527–538. [Online]. Available: https://doi.org/10.1109/ASE.2019.00056 [17] Y. Gan, Y. Zhang, K. Hu, D. Cheng, Y. He, M. Pancholi, and C. Delimitrou, "Seer: Leveraging big data to navigate the complexity of performance debugging in cloud microservices," in Proceedings of the Twenty-Fourth International Conference on Architectural Support for Programming Languages and Operating Systems, ser. ASPLOS '19. New York, NY, USA: Association for Computing Machinery, 2019, p. 19–33. [Online]. Available: https://doi.org/10.1145/3297858.3304004 [18] P. Liu, H. Xu, Q. Ouyang, R. Jiao, Z. Chen, S. Zhang, J. Yang, L. Mo, J. Zeng, W. Xue, and D. Pei, "Unsupervised detection of microser- vice trace anomalies through service-level deep bayesian networks," in Proceedings of the IEEE 31st International Symposium on Software Reliability Engineering (ISSRE), 2020, pp. 48–58. [19] X. Guo, X. Peng, H. Wang, W. Li, H. Jiang, D. Ding, T. Xie, and L. Su, "Graph-based trace analysis for microservice architecture understanding and problem diagnosis," in Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, ser. ESEC/FSE 2020. New York, NY, USA: Association for Computing Machinery, 2020, p. 1387–1397. [Online]. Available: https://doi.org/10.1145/3368089.3417066 ICSE-SEIP '21. [20] D. Liu, C. He, X. Peng, F. Lin, C. Zhang, S. Gong, Z. Li, J. Ou, and Z. Wu, "Microhecl: High-efficient root cause localization in large-scale microservice systems," in Proceedings of the 43rd International Conference on Software Engineering: Software Engineering in Practice, [Online]. ser. Available: https://doi.org/10.1109/ICSE-SEIP52600.2021.00043 [21] G. Yu, P. Chen, H. Chen, Z. Guan, Z. Huang, L. Jing, T. Weng, X. Sun, and X. Li, "Microrank: End-to-end latency issue localization with extended spectrum analysis in microservice environments," in Proceedings of the Web Conference 2021, ser. WWW '21. New York, NY, USA: Association for Computing Machinery, 2021, p. 3087–3098. [Online]. Available: https://doi.org/10.1145/3442381.3449905 IEEE Press, 2021, p. 338–347. [22] Z. Li, J. Chen, R. Jiao, N. Zhao, Z. Wang, S. Zhang, Y. Wu, L. Jiang, L. Yan, Z. Wang, Z. Chen, W. Zhang, X. Nie, K. Sui, and D. Pei, "Practical root cause localization for microservice systems via trace analysis," in 2021 IEEE/ACM 29th International Symposium on Quality of Service (IWQOS), 2021, pp. 1–10. [23] N. Zhao, J. Chen, Z. Yu, H. Wang, J. Li, B. Qiu, H. Xu, W. Zhang, K. Sui, and D. Pei, "Identifying bad software changes via multimodal anomaly detection for online service systems," in Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, ser. ESEC/FSE 2021. New York, NY, USA: Association for Computing Machinery, 2021, p. 527–539. [Online]. Available: https://doi.org/10.1145/3468264.3468543 [24] C. Lee, T. Yang, Z. Chen, Y. Su, Y. Yang, and M. R. Lyu, "Heteroge- neous anomaly detection for software systems via semi-supervised cross- modal attention," in 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE), 2023, pp. 1724–1736. [25] C. Lee, T. Yang, Z. Chen, Y. Su, and M. R. Lyu, "Eadro: An end- to-end troubleshooting framework for microservices on multi-source data," in 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE), 2023, pp. 1750–1762. [26] P. He, J. Zhu, Z. Zheng, and M. R. Lyu, "Drain: An online log parsing approach with fixed depth tree," in Proceedings of the 2017 IEEE International Conference on Web Services, 2017, p. 33–40. [Online]. Available: https://doi.org/10.1109/ICWS.2017.13 [27] Z. M. Jiang, A. E. Hassan, P. Flora, and G. Hamann, "Abstracting execution logs to execution events for enterprise applications (short paper)," in Proceedings of the 2008 The Eighth International Conference on Quality Software, 2008, pp. 181–186. [28] A. A. Makanju, A. N. Zincir-Heywood, and E. E. Milios, "Clustering event logs using iterative partitioning," in Proceedings of the 15th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, ser. KDD '09. New York, NY, USA: Association for Computing Machinery, 2009, p. 1255–1264. [Online]. Available: https://doi.org/10.1145/1557019.1557154 [29] M. Du and F. Li, "Spell: Streaming parsing of system event logs," in Proceedings of the 2016 IEEE 16th International Conference on Data Mining (ICDM), 2016, pp. 859–864. [30] Y. Huo, Y. Su, C. Lee, and M. R. Lyu, "Semparser: A semantic parser for log analytics," in 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE), 2023, pp. 881–893. [31] X. Zhang, Y. Xu, Q. Lin, B. Qiao, H. Zhang, Y. Dang, C. Xie, X. Yang, Q. Cheng, Z. Li, J. Chen, X. He, R. Yao, J.-G. Lou, M. Chintalapati, F. Shen, and D. Zhang, "Robust log-based anomaly detection on unstable log data," in Proceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, ser. ESEC/FSE 2019. New York, NY, USA: Association for Computing Machinery, 2019, p. 807–817. [32] A. Deng and B. Hooi, "Graph neural network-based anomaly detection in multivariate time series," in Proceedings of the AAAI Conference on Artificial Intelligence, vol. 35, no. 5, 2021, pp. 4027–4035. [Online]. Available: https://doi.org/10.1609/aaai.v35i5.16523 [33] C. Zhao, M. Ma, Z. Zhong, S. Zhang, Z. Tan, X. Xiong, L. Yu, J. Feng, Y. Sun, Y. Zhang, D. Pei, Q. Lin, and D. Zhang, "Robust multimodal failure detection for microservice systems," 2023. [34] S. Zhang, P. Jin, Z. Lin, Y. Sun, B. Zhang, S. Xia, Z. Li, Z. Zhong, M. Ma, W. Jin, D. Zhang, Z. Zhu, and D. Pei, "Robust failure diagnosis of microservice system through multimodal data," IEEE Transactions on Services Computing, pp. 1–14, 2023. [35] S. Li, X. Jin, Y. Xuan, X. Zhou, W. Chen, Y.-X. Wang, and X. Yan, "En- hancing the locality and breaking the memory bottleneck of transformer on time series forecasting," Advances in neural information processing systems, vol. 32, 2019. [36] S. Liu, H. Yu, C. Liao, J. Li, W. Lin, A. X. Liu, and S. Dustdar, "Pyraformer: Low-complexity pyramidal attention for long-range time series modeling and forecasting," in International conference on learning representations, 2021. [37] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin, "Attention is All you Need," in Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, 2017, pp. 5998–6008. [38] P. Velickovic, G. Cucurull, A. Casanova, A. Romero, P. Li`o, and Y. Bengio, "Graph Attention Networks," in 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net, 2018. [Online]. Available: https://openreview.net/forum?id=rJXMpikCZ [39] S. Brody, U. Alon, and E. Yahav, "How attentive are graph atten- tion networks?" in The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022, 2022. [40] Z. Wang, J. Chen, and H. Chen, "Egat: Edge-featured graph atten- tion network," in Artificial Neural Networks and Machine Learning – ICANN 2021, I. Farkaˇs, P. Masulli, S. Otte, and S. Wermter, Eds. Cham: Springer International Publishing, 2021, pp. 253–264. [41] T. Zhang, H. Qiu, G. Castellano, M. Rifai, C. S. Chen, and F. Pianese, "System log parsing: A survey," IEEE Transactions on Knowledge and Data Engineering, vol. 35, no. 8, pp. 8596–8614, 2023. [42] S. Nedelkoski, J. Bogatinovski, A. K. Mandapati, S. Becker, J. Cardoso, and O. Kao, "Multi-source distributed system data for ai-powered analyt- ics," in Service-Oriented and Cloud Computing, A. Brogi, W. Zimmer- mann, and K. Kritikos, Eds. Cham: Springer International Publishing, 2020, pp. 161–176. [43] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, A. Desmaison, A. K ̈opf, E. Z. Yang, Z. DeVito, M. Raison, A. Tejani, S. Chilamkurthy, B. Steiner, L. Fang, J. Bai, and S. Chintala, "PyTorch: An Imperative Style, High- Performance Deep Learning Library," in Advances in Neural Information Processing Systems,December 8-14, Vancouver, BC, Canada, 2019, pp. 8024–8035. [44] M. Fey and J. E. Lenssen, "Fast graph representation learning with pytorch geometric," CoRR, vol. abs/1903.02428, 2019, arXiv: 1903.02428. [Online]. Available: http://arxiv.org/abs/1903.02428 [45] J. Zhuang, T. Tang, Y. Ding, S. Tatikonda, N. C. Dvornek, X. Pa- pademetris, and J. S. Duncan, "AdaBelief Optimizer: Adapting Stepsizes by the Belief in Observed Gradients," in Advances in Neural Information Processing Systems, December 6-12, virtual, 2020.
http://arxiv.org/abs/2310.04693v2
"2023-10-10T04:12:56"
"2023-10-07T05:53:56"
Robustness-enhanced Uplift Modeling with Adversarial Feature Desensitization
Uplift modeling has shown very promising results in online marketing. However, most existing works are prone to the robustness challenge in some practical applications. In this paper, we first present a possible explanation for the above phenomenon. We verify that there is a feature sensitivity problem in online marketing using different real-world datasets, where the perturbation of some key features will seriously affect the performance of the uplift model and even cause the opposite trend. To solve the above problem, we propose a novel robustness-enhanced uplift modeling framework with adversarial feature desensitization (RUAD). Specifically, our RUAD can more effectively alleviate the feature sensitivity of the uplift model through two customized modules, including a feature selection module with joint multi-label modeling to identify a key subset from the input features and an adversarial feature desensitization module using adversarial training and soft interpolation operations to enhance the robustness of the model against this selected subset of features. Finally, we conduct extensive experiments on a public dataset and a real product dataset to verify the effectiveness of our RUAD in online marketing. In addition, we also demonstrate the robustness of our RUAD to the feature sensitivity, as well as the compatibility with different uplift models.
[ "Zexu Sun", "Bowei He", "Ming Ma", "Jiakai Tang", "Yuchen Wang", "Chen Ma", "Dugang Liu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04693v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04693v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI" ]
Robustness-enhanced Uplift Modeling with Adversarial Feature Desensitization Zexu Sun§, Bowei He†, Ming Ma‡, Jiakai Tang§, Yuchen Wang‡, Chen Ma†, Dugang Liu⋆(cid:66) §Gaoling School of Artificial Intelligence, Renmin University of China †Department of Computer Science, City University of Hong Kong ‡Kuaishou Technology ⋆Guangdong Laboratory of Artificial Intelligence and Digital Economy (SZ), Shenzhen University 3 2 0 2 t c O 0 1 ] G L . s c [ 2 v 3 9 6 4 0 . 0 1 3 2 : v i X r a Abstract-Uplift modeling has shown very promising results in online marketing. However, most existing works are prone to the robustness challenge in some practical applications. In this paper, we first present a possible explanation for the above phenomenon. We verify that there is a feature sensitivity problem in online marketing using different real-world datasets, where the perturbation of some key features will seriously affect the performance of the uplift model and even cause the opposite trend. To solve the above problem, we propose a novel robustness- enhanced uplift modeling framework with adversarial feature desensitization (RUAD). Specifically, our RUAD can more effec- tively alleviate the feature sensitivity of the uplift model through two customized modules, including a feature selection module with joint multi-label modeling to identify a key subset from the input features and an adversarial feature desensitization module using adversarial training and soft interpolation operations to enhance the robustness of the model against this selected subset of features. Finally, we conduct extensive experiments on a public dataset and a real product dataset to verify the effectiveness of our RUAD in online marketing. In addition, we also demonstrate the robustness of our RUAD to the feature sensitivity, as well as the compatibility with different uplift models. Index Terms-Uplift modeling, Robustness, Adversarial train- ing, Feature desensitization I. INTRODUCTION One of the critical tasks in each service platform is to increase user engagement and platform revenue through online marketing, which uses some well-designed incentives and then delivers them to the platform users, such as coupons, discounts and bonuses [1]. Since each incentive usually comes with a cost, a successful online marketing needs to accurately find the corresponding sensitive user group for each of them to avoid some ineffective delivery. To achieve this goal, an important step is that the marketing model needs to identify the change in the user's response caused by different incentives, and only deliver each incentive to its high-uplift users. This involves a typical causal inference problem, i.e., the estimation of the individual treatment effect (ITE) [2] (also known as the uplift), since we usually only observe one type of user response in practice, which may be for a certain incentive (i.e., treatment group) or for no incentive (i.e., control group). Therefore, uplift modeling has been proposed in previous works and verified its effectiveness in online marketing [3]–[5]. the users' responses by using existing predictive models as the base learner. Two of the most representative methods are S-Learner and T-Learner [6], which adopt a global base learner and two base learners corresponding to the treatment and control groups, respectively. 2) Tree (or Forest)-based. The basic idea of this line is to employ a hierarchical tree structure to systematically partition the user population into sub-populations that exhibit sensitivity to specific treatments. An essential step involves modeling the uplift directly by applying diverse splitting criteria, including considerations of distribution divergences [7] and expected responses [8], [9]. 3) Neural network-based. The basic idea of this line is to leverage the power of neural networks to develop estimators that are both intricate and versatile in predicting the user's response. Note that most of them can be seen as the variants of meta- learners. In this paper, we focus on the neural network-based line because they can be more flexibly adapted to modeling the complex feature interactions in many industrial systems. Furthermore, due to the widespread use of various neural network models in these systems, research on this line is also easier to seamlessly integrate than alternative lines. Although existing works on uplift modeling have shown very promising results, they generally suffer from the ro- bustness challenge in many real-world scenarios [10], [11], and little research has been conducted to reveal how such challenges arise. In this paper, we first identify a feature sen- sitivity problem in the uplift model as a possible explanation for the above phenomenon using different real-world datasets. Specifically, for each dataset, we randomly select 30% of all continuous-valued features and apply a Gaussian noise with η ∼ N (0, 0.052) as perturbation to them. We repeat this process multiple times to obtain a set of copies with different feature subsets. Finally, we train the same uplift models for each copy and compare their performance with that obtained on the original dataset. Due to space limitations, we show the results of using S-Learner [4] as the uplift model on the Production dataset used in the experiment in Fig. 1, and similar results are also found on other datasets or uplift models. We can find that there are some sensitive key features and a slight perturbation to them will seriously affect the performance of the uplift model, and even an opposite trend appears. According to the research ideas, the existing uplift modeling methods can broadly be categorized into three research lines: 1) Meta-learner-based. The basic idea of this line is to estimate The above empirical findings suggest that the sensitivity of uplift models to these key features may be one of the important reasons for their robustness challenges. Therefore, to alleviate demonstrate the effectiveness, robustness and compatibil- ity of our RUAD. The structure of this paper is organised as follows: we present some necessary preliminaries in Sec. II, and a detailed description of method is given in Sec. III; we analyze and discuss extensive experimental results in Sec. IV; we briefly introduce some related works in Sec. V, and present a con- clusion and some future works in Sec. VI. II. PRELIMINARIES A. Problem Formulation To formalize the problem, we follow the Neyman-Rubin po- tential outcome framework [12], to define the uplift modeling problem. Let the observed sample set be D = {xi, ti, yi}n i=1. Without loss of generality, for each sample, assuming yi ∈ Y ⊂ R is a continuous response variable, xi ∈ X ⊂ RN is a vector of features, and ti ∈ {0, 1} denotes the treatment indicator variable, i.e., whether to get an incentive delivery. Note that the proposed framework can also be easily extended to other types of uplift modeling problems. For a user i, the change in user response caused by a incentive ti, i..e, individual treatment effect or uplift, denote as τi, is defined as the difference between the treatment response and the control response, τi = yi(1) − yi(0), (1) where yi(0) and yi(1) are the user responses of the control and treatment groups, respectively. In the ideal world, i.e., obtaining the responses of a user in both groups simultaneously, we can easily determine the uplift τi based on Eq.(1). However, in the real world, usually only one of the two responses is observed for any one user. For example, if we have observed the response of a customer who receives the discount, it is impossible for us to observe the response of the same customer when they do not receive a discount, where such responses are often referred to as counterfactual responses. Therefore, the observed response can also be described as, yi = tiyi(1) + (1 − ti)yi(0). (2) For the brevity of notation, we will omit the subscript i in the following if no ambiguity arises. As mentioned above, the uplift τ is not identifiable since the observed response y is only one of the two necessary terms (i.e., y(1) and y(0)). Fortunately, with some appropriate assumptions [2], [13], we can use the conditional average treatment effect (CATE) as an estimator for the uplift, where CATE is defined as, τ (x) = E (Y (1) | X = x) − E (Y (0) | X = x) = E(Y | T = 1, X = x) (cid:123)(cid:122) (cid:125) μ1(x) (cid:124) − E(Y | T = 0, X = x) (cid:123)(cid:122) (cid:125) μ0(x) (cid:124) . (3) Intuitively, the desired objective τ (x) can be described as the difference between two conditional means τ (x) = μ1(x) − μ0(x). (a) Without perturbation (b) Perturbation on feature set 1 (c) Perturbation on feature set 2 (d) Perturbation on feature set 3 Fig. 1. Bar graphs of predicted uplift with 5 bins, w.r.t the origin dataset (i.e., (a)) and three kinds of varieties (i.e., (b)-(d)). For each dataset, we randomly select 30% of all continuous-valued features and apply a Gaussian noise with η ∼ N (0, 0.052) as perturbation while constraining ∥η∥∞ < 0.1. Note that a good uplift model will usually have a bar graph sorted in descending order. the feature sensitivity problem, we propose a novel robustness- enhanced uplift modeling framework with adversarial feature desensitization, or RUAD for short. Our RUAD contains two new custom modules that match our empirical findings and can be integrated with most existing uplift models to improve their robustness. Specifically, a feature selection module with joint multi-label modeling will be used to identify the desired set of key sensitive features from the original dataset under the supervision of a trade-off optimization objective. Then, an adversarial feature desensitization module performs an adversarial training operation and a soft interpolation operation based on the selected subset of features, to force the model to reduce sensitivity to them, thus effectively truncating a key source of robustness challenges. Finally, we experimentally verify the effectiveness of our RUAD on a public dataset and a real product dataset. We summarize the main contributions of this work in the following: • We provide the first possible explanation and empirical study for the robustness challenge that uplift models suffer in practice, i.e., the problem of feature sensitivity driven by a set of key sensitive features. • We design a feature selection module with joint multi- label modeling to select the desired set of key sensitive features from all the input features, which is consistent with our empirical findings. • We propose an adversarial feature desensitization module that uses an adversarial training operation to remove the sensitivity to these key sensitive features from the uplift model, thereby improving the model's robustness. • We conduct extensive experiments on a public dataset and a real product dataset, and the experimental results 0-2020-4040-6060-8080-100Population Targeted (%)-0.2-0.10.00.10.2Uplift (%)0-2020-4040-6060-8080-100Population Targeted (%)-0.2-0.10.00.10.2Uplift (%)0-2020-4040-6060-8080-100Population Targeted (%)-0.2-0.10.00.10.2Uplift (%)0-2020-4040-6060-8080-100Population Targeted (%)-0.2-0.10.00.10.2Uplift (%) B. Adversarial Training B. Base Model Previous works in different research fields have demon- strated the powerful ability of adversarial training to improve the model robustness [14], [15]. From a robust optimization perspective, a general adversarial training framework can be formulated as [16], θ∗ ← arg min θ∈Θ E(x,y)∼D (cid:20) max δ∈B(ε) (cid:21) L(x + δ, y; θ) . (4) where L(*, *) is the loss function, D is the distribution of training set, and θ is the model parameters. B(ε) is the allowed perturbation set, which can be expressed as B(ε) := {δ ∈ Rm | ∥δ∥p ≤ ε}. Intuitively, adversarial training aims to find the perturbation direction that has the greatest impact on the model and adjust the model to adapt to it. In this paper, we will use adversarial training to remove the sensitivity of the uplift model to some key features. III. METHODOLOGY According to the empirical findings in Sec. I, a key source of robustness challenges for uplift models is their sensitivity to some key features. Therefore, this motivates us to design an effective framework to constrain the effect of feature sensitivity during the training of the uplift model, thereby improving the robustness of the model. A. Architecture The proposed robustness-enhanced uplift modeling frame- work with adversarial feature desensitization, or RUAD for short, is shown in Fig. 2. Given a sample {x, t, y}, where x may include the categorical features or the numerical features, and the categorical features will be converted into low-dimensional dense vectors through an encoding layer. The feature selection module with joint multi-label training will train a masker m(x) with the temperature weights on all the input features to filter the desired key features. We will also adopt a joint optimization involving the true response y and the transformed response y∗ as a trade-off supervision objective of the process to further ensure that the selected features conform to the desired properties. After receiving the sample xm after feature selection, the adversarial feature desensitization module first uses an adversarial training operation to obtain the adversarial example xadv with the largest perturbation on the key feature level, and then uses the soft interpolation operation to combine it with the masked sample to obtain a milder adversarial example ̃xadv. Finally, we jointly train the model with the adversarial samples and observed sample sets to free the model from feature sensitivity, and the final optimization objective function of our RUAD can be expressed as follows, min θ LRU AD = Lo + Lr + La + λ∥θ∥, (5) where Lo, Lr, and La denote the prediction loss of the trans- formed and true responses for the feature selection module, loss for the adversarial feature desen- and the adversarial sitization module, respectively. λ and ∥θ∥ are the trade-off parameter and the regularization terms. Next, we describe each module in detail based on the training process. Since our RUAD is model-agnostic, it can be integrated with most existing uplift models. For the convenience of the subsequent description, we use T-Learner [2] as the base model for an example, but different uplift models will be integrated in the experiments to verify the compatibility of our RUAD. In T-Learner, the samples in the treatment group and the control group will be trained respectively by two base learners to obtain the two conditional mean functions required in Eq.(3). Specifically, we consider a T-leaner with the following components, • Treatment Response Network: An multi-layer percep- tron (MLP) for estimating the user response in the treat- ment group, i.e., μ1(x) ← ˆy(1) = ft(x, t = 1). • Control Response Network: An MLP for estimating the user response in the control group, i.e., μ0(x) ← ˆy(0) = fc(x, t = 0). ft and fc are the mapping functions corresponding to the MLP layer, and note that for each sample, its predicted response during training will only use one of the two. C. Feature Selection Module with Joint Multi-Label Modeling Based on our experimental findings in Fig. 1, it can be found that the perturbation of only some of the key features will cause significant performance changes in the uplift model, i.e., not all the features have sensitivity problems. Therefore, in order to solve the feature sensitivity problem suffered by the uplift model, we first need to enable the uplift model to identify the key sensitive features we expect to obtain from all the input features. This involves a feature selection process and a reasonable optimization objective that guides the process to perform correctly. Based on this idea, our RUAD first formulates a feature selection module with joint multi-label training. Note that although feature selection has been exten- sively studied in different research areas, including different designs for selection strategies or guidance objectives [17], it is still less addressed in uplift modeling. 1) Feature Selection Process: In this paper, we utilize a neural network-based masking function, denoted as ˆw(*), to determine the contribution of each feature in the uplift modeling. An additional Gumbel-Softmax trick [18] is used to constrain the model to obtain an approximate k-hot mask vector m(x). The κ-ratio features with the largest contribution are regarded as desired key features, while the rest are regarded as irrelevant or redundant ones. The m(x) is formulated as, m(x) = Gumbel-Softmax( ˆw(x), κN ) ∈ RN , (6) where k = ⌊κN ⌋ ∈ Z+ is the number of features expected to be obtained, N is the number of input features. Specifically, in Eq.(6), let z = ˆw(x) ∈ RN be a probability vector, then for any feature dimension j ∈ {1, . . . , N }, we have zj ≥ 0 and (cid:80) j zj = 1. Based on a pre-defined temperature weight ζ > 0, Fig. 2. The architecture of our RUAD. The propensity network π(x) is pre-trained to calculate the transformed response y∗. The left is the feature selection module (FS), it leverages a masker to select key sensitive features for jointly modeling transformed response y∗ and user response y. The right is an adversarial feature desensitization module (AFD) to reduce the sensitivity of the base uplift model to these key features. Specially, Lo and Lr are used for FS, while La is used for AFD. The detailed form of the loss function is presented in Eq.(5) the calculation of each feature dimension in the mask vector can be expressed as [19], mj = max l∈{1,...,k} exp (cid:0)(cid:0)log zj + ξl (cid:16)(cid:16) j (cid:1) /ζ(cid:1) (cid:17) log zj′ + ξl j′ (cid:80)N j′=1 exp (cid:17) , /ζ (7) j (cid:1), and ul where l ∈ {1, . . . , k} denotes the index of the selected feature, j = − log (cid:0)− log ul ξl j ∼ Uniform(0, 1) denotes a uniformly distributed sampling. Note that for simplicity, in our experiments, we follow the setup of previous work [19], i.e., ζ = 0.5. Finally, we can get the masked samples xm by multiplying the original samples x with the resulting mask vector m(x), xm = x ⊙ m(x), (8) where ⊙ denotes the element-wise multiplication. 2) Joint Multi-Label Modeling: The success of the feature selection process largely depends on a reasonable guiding op- timization objective. Most of the existing uplift models adopt a traditional optimization objective for response modeling, which directly constrains the model to fit the true response y of each sample, where π(x) is the propensity score estimation function and is usually modeled by a neural network in practice. The Eq.(10) transforms the observed true response y into y∗, such that the expected uplift predictions τ equals the conditional expectation of the transformed response y∗. Note that the parameter update of this estimation function π(x) is performed by a binary cross-entropy (BCE) loss between its output and t, and π(x) is usually pre-trained to ensure the correctness of the transformed response y∗ [21]. Since the transformed response is a consistent unbiased estimator of the uplift effect τ , we can fit it with the uplift prediction of the base model to improve the base model's ability to capture the uplift effect, ˆy∗ x = μ1(x) − μ0(x). (11) However, using only Eq.(11) as the objective may also cause the predicted response of the model to violate the true response of the user, i.e., damage the coherent prediction. Therefore, to better guide the training of the above feature selection process to obtain the desired key features that have a greater impact on the performance of the uplift model, we define a joint multi-label modeling as a trade-off optimization objective, Lr = L (μt(x), y(t)) . (9) Lo + Lr = αL (cid:0)ˆy∗ xm , y∗(cid:1) + (1 − α)L (μt(xm), y(t)) , (12) This can ensure the coherent prediction of the model on the user response. However, we can find that Eq.(9) is not consistent with the objective of the uplift model (as shown in Eq.(3)), and this will make the performance of the uplift model easily uncontrollable. On the other hand, there is little work focusing on estab- lishing the link between the user responses y and the expected uplift effect τ [20], among which the transformed response is one of the most representative ways. The specific form of the transformed response is shown in Eq.(10), y π(x) y 1 − π(x) * (1 − t), y∗ = * t − (10) where α is the loss weight, and note that each prediction is based on masked samples xm after feature selection. D. Adversarial Feature Desensitization Module After obtaining the desired key features, the next key step is how to effectively reduce the sensitivity of the uplift model to these sensitive features during its training process. Based on the empirical findings in Fig. 1, we find that the feature sensitivity is reflected in the inadaptability of the uplift model to the perturbations on these key features. This can be linked to previous work [22], where it was shown that the features used to train deep learning models can be divided into adversarial Numerical FeaturesCategorical FeaturesEmbedding MaskInput TreatmentResponseAdversarial FeatureDesensitizationMaskPerturbationAdversarial ExamplesJoint Multi-label ModeilingLoss FunctionTransformedoutcome ConditionalmeanFeature SelectionPropensityNetworkBase Uplift ModelFSAFDSoft InterpolationMaskedSamplesAdversarialExamples robust features and non-robust features, and the sensitive key features in uplift models can be considered as the latter. Given that existing works show that adversarial training with feature importance can effectively address the limitation of adversarial non-robust features [23]–[25], our RUAD formalizes an adver- sarial feature desensitization module, including an adversarial training operation and a soft interpolation process. 1) Adversarial Training Operation: Our goal is to construct a set of adversarial samples for the uplift model and constrain the model to adapt to them during the adversarial training. These samples can be generated by feature-level perturbation of masked samples xm undergoing feature selection. Specifi- cally, for numerical features, the perturbation will act directly on the feature value itself, and for discrete features, the per- turbation will act on the corresponding encoding embedding. To improve the effectiveness and efficiency of adversarial training, many existing works have been proposed to show how to obtain ideal adversarial samples to meet the goal of maximizing the disturbance on model performance [14], [16], [26], [27], max xadv L(ˆyadv, ˆy), (13) where ˆy and ˆyadv are the model predictions based on the orig- inal sample x and the adversarial example xadv, respectively, and xadv = x + δ (as shown in Eq.(4)). In this paper, we follow virtual adversarial training frame- work (VAT) [28] to obtain ideal adversarial samples. Specif- ically, in order to strengthen the interference of adversarial samples on the model's uplift effect estimation, we first modify the original adversarial loss (i.e., Eq.(13)) to a form based on the transformed response, max xadv L(ˆy∗ adv, ˆy∗), (14) where ˆy∗ adv is estimated by using xadv as input in Eq.(11). Then, we perform the search process based on the power iteration method proposed by VAT, where new adversarial samples obtained at each iteration are calculated as follows, adv = x(z) x(z+1) adv + ε * ∇xadv L(ˆy∗ ∥∇xadv L(ˆy∗ adv, ˆy∗) adv, ˆy∗)∥2 ⊙ m(x), (15) where ε is a hyper-parameter to control the step size of the perturbation, and z is the number of iterations. Note that we will use the masked samples after feature selection as the initialization of this search process, i.e., x(0) adv = xm, and apply the same mask m(x) to the perturbations to ensure that adversarial training is only performed on selected key features. 2) Soft Interpolation Process: Since the adversarial train- ing operation and the feature selection module are jointly trained, excessively large perturbations on some features in the early stages of model training may damage the effect of feature selection. To control the magnitude of the adversarial perturbation within a more moderate level, we integrate the obtained adversarial examples (i.e., x(Z) adv) and the received original samples (i.e., x(0) adv or xm) in a soft interpolation form. 4: 5: 6: 7: 8: 9: 10: 11: Algorithm 1 The training procedure of RUAD. Input: The data D = {xi, ti, yi}n i=1, the model parameters θ (including base model, feature selection model), training epochs M , adversarial learning steps Z, hyper-parameters α, β and ε. 1: for m = 1 to M do 2: 3: Sample (x, t, y) ∼ D Get the propensity score by using π(x). Get the transformed response y∗ according to Eq.(10). Get the mask vector m(x) and the selected key fea- ▷ Feature Selection tures according to Eq.(6) and (8). Predict ˆy∗ according to Eq.(11). x(0) adv = xm for z = 1 to Z do ▷ Adversarial Feature Desensitization Search the maximum-allowable adversarial sample x(z) adv according to Eq.(15). end for Get the soft interpolation adversarial example accord- ing to Eq.(16). Update θ according to Eq.(5), (12) and (17). 12: 13: end for Specifically, the final adversarial examples can be obtained as follows, ̃xadv = γ ∗ x(0) adv + (1 − γ) ∗ x(Z) adv, (16) where γ ∼ Uniform(0, 1), and Z is the number of iterations for the power iteration method. After obtaining ideal adver- sarial examples, we expect the uplift model to adapt to them during training. Therefore, we introduce an adversarial loss to constrain the model not to have large prediction differences between the adversarial examples and the original samples, La = βL( ̃y∗ adv, ˆy∗), (17) where β is a hyper-parameter to control the weight of adversar- ial loss. For ease of understanding, we provide the pseudocode of our RUAD in Algorithm 1. E. Complexity Analysis Since the base model contains two MLPs for predicting the user responses in their respective groups, its overall complexity can be expressed as O(M N d|D|), where M is the number of training epochs, N is the number of features, d is the em- bedding dimension, and |D| is the dataset size. For the feature selection module in our RUAD, its complexity mainly involves a neural network-based mask function, and the complexity is O(N d|D|) in one training epoch. The adversarial feature desensitization module mainly involves a search process with the power iterative method, and the complexity is O(ZN d|D|) in one training epoch, where Z is the number of steps in the power iteration method. Therefore, the complexity of the base model integrating our RUAD will be O(ZM N d|D|). Since satisfactory model performance can usually be obtained based on fewer adversarial learning steps in practice, i.e., Z is usually a small value, thus the complexity of our RUAD is competitive. IV. EXPERIMENTS In this section, we present the overall performance of RUAD and the other methods to be compared. The following questions are also proposed and investigated: • RQ1: How does our RUAD help the training of the backbones on both IHDP and Production Datasets? • RQ2: How does each module of our RUAD help the uplift model training procedure? • RQ3: Can our RUAD improve the robustness of the learned uplift model? • RQ4: How is the compatibility of our RUAD? A. Experiment Setup 1) Datasets: To compare the model performance from an uplift ranking perspective, we use two datasets to show the effectiveness of our training framework, the overall data statistic is presented in Table I. • IHDP1. The IHDP dataset is utilized as a semi-synthetic dataset to assess predicted uplift in [29]. This evalua- tion involves the synthetic generation of counterfactual outcomes based on the original features, along with the introduction of selection bias. The resulting dataset contained 747 subjects (608 control and 139 treated) with 25 features (6 continuous and 19 binary features) that described both the characteristics of the infants and the characteristics of their mothers. T = 1 represents that the subject is provided with intensive, high-quality childcare and home visits from a trained health-care provider. • Production. This dataset comes from an industrial pro- duction environment, one of the largest short-video plat- forms in China. For such kind of short video platforms, clarity is an important user experience indicator. And a decrease in clarity may lead to a decrease in users' playback time. Therefore, through random experiments within a week, we provided high-clarity videos (T = 1) to the treatment group, and low-clarity videos (T = 0) to the control group. We count the total viewing time of users' short videos in a week, and quantify the impact of definition degradation on user experience. The resulting dataset contains more than 3.6 million users (1.82 million treat and 1.85 million control) with 123 features (108 continuous and 15 categorical features) describing user relative characteristics. We present the visualization of online data collection in Fig. 3. 2) Baselines: We compare RUAD with the representative methods in uplift modeling. All methods use all the input continuous features in the two datasets. • S-Learner (S-NN) [6]: S-NN is a kind of meta-learner method that uses a single estimator to estimate the outcome without giving the treatment a special role. The uplift is estimated by the difference between changed treatment with fixed other features. 1https://github.com/AMLab-Amsterdam/CEVAE/tree/master/datasets/IHDP TABLE I STATISTICS OF THE IHDP DATASET AND PRODUCTION DATASET. WE RANDOMLY SPLIT THE TWO DATASETS FOR TRAIN/VALIDATION/TEST SPLIT PROPORTION OF 70%/20%/10%. Dataset Features Sample number Treated Control IHDP Production 25 123 139 1.82 million 608 1.85 million Fig. 3. The visualization for the online data collection experiment of the Production dataset. • T-Learner (T-NN) [6]: T-NN is similar to S-NN, which uses two estimators for the treatment group and control group, respectively. • Causal Forest [30]: Causal Forest is a non-parametric Random Forest-based tree model that directly estimates the treatment effect, which is another representative of tree-based uplift models. • Transformed Outcome (TO-NN) [20]: TO-NN trans- forms the observed outcome Y to Y ∗, such that the uplift equals the conditional expectation of the transformed outcome. • TARNet [31]: TARNet is a commonly used neural it network-based uplift model. Compared with T-NN, omits the additional imputed treatment effects fitting sub- models but introduces the shared layers for treated and control response networks. The shared network parame- ters could help alleviate the sample imbalance. • CFR [31]: CFR applies an additional loss to TARNet, which forces the learned treated and control feature distributions to be closer. We report the CFR perfor- mance using two distribution distance measurement loss functions, Wasserstein [32] (denoted as CFRwass) and Maximum Mean Discrepancy (MMD) [33] (denoted as CFRmmd). • Dragonnet [34]: Dragonnet exploits the sufficiency of the propensity score for estimation adjustment, and uses a regularization procedure based on the non-parametric estimation theory. Treatment group(High clarity: 1080P)Control group(Low clarity: 720P) TABLE II MAIN HYPER-PARAMETERS AND THEIR VALUES TUNED IN THE EXPERIMENTS. Parameter Range Functionality d lr ε α β λ {23, 24, 25} {1e−5, 1e−4, 1e−3} {1e−2, 2e−2, 4e−2} {0.5, 0.6, 0.7, 0.8} {0.1, 0.2, 0.3, 0.4} {1e−5, 1e−4, 1e−3} Embedding dimension Learning rate Adversarial step size Regression loss weighting Adversarial loss weighting Regularization loss weighting • CITE [21]: CITE is based on the contrastive task de- signed for causal inference. It fully exploits the self- supervision information in the data to achieve balanced and predictive representations while appropriately lever- aging causal prior knowledge. 3) Evaluation Metrics: Following the setup of previous work [5], we employ two evaluation metrics commonly used in uplift modeling, i.e., the Qini coefficient ˆq, and Kendall's uplift rank correlation ˆρ. 4) Implementation Details: We implement all baselines and our RUAD with Pytorch 1.10. Besides, we use Adam optimizer and set the maximum number of iterations to 30, to search for the best hyper-parameters, and we leverage ˆq as the parameter searching objective. We also adopt an early stopping mechanism with a patience of 5 to avoid over-fitting to the training set. Furthermore, we utilize the hyper-parameter search library Optuna [35] to accelerate the tuning process, and we set the Qini coefficient as the hyper-parameter searching objective. The tuned values of the main hyper-parameters is shown in Table II. B. Overall Performance (RQ1) We present the comparison results of IHDP and Production datasets in Table III. For the evaluation, we use both the Qini coefficient and Kendall's uplift rank correlation with 5 bins and 10 bins, and then we have the following observations: For the IHDP dataset, 1) Meta-learners (S-NN, T-NN) per- form bad among all the methods, because there exists a sample imbalance in the dataset. Causal Forest performs competitively on all the metrics, and the reason may be that the Causal Forest can obtain an unbiased estimation of the causal effect in all dimensions due to the feature space being repeatedly partitioned to achieve data homogeneity in the local feature space. TO-NN performs pretty well in all cases, and the trans- formed label can also solve the sample imbalance problem by leveraging the propensity score. 2) The neural network-based methods also have a good performance. Dragonnet performs pretty well among them, where the target regularization may enhance the model learning. And it is worth noting that the more complex architecture may not get higher performance for uplift modeling evaluation. 3) For RUAD, the learned model performs better than other baselines in most cases. This is because that the feature selection module with joint multi-label modeling can select sensitive key features for uplift modeling task, reduce the computational cost and improve the prediction accuracy; the adversarial feature desensitization can help to solve the feature sensitivity problem, which can train a more robust uplift model on the sensitive key features, then to get higher performance on the evaluation metrics. For the Production dataset, 1) TO-NN significantly outper- forms many neural network-based methods, even though some of them use more complex network architectures. This shows that the task of uplift modeling may be different from the traditional ITE estimation, that is, more complex architectures may not get better results. In particular, we can observe that, with high dimensional features for the uplift modeling, most neural network-based methods can not learn a good feature embedding for the final objective. Thus, they no longer have an advantage over the TO-NN. 2) S-NN, T-NN, Causal Forest, TO-NN, and Dragonnet perform better than other baselines. Especially, S-NN, T-NN, Causal Forest, and TO-NN can be seen as the traditional methods for uplift modeling. The results show that, for an industrial application, these methods can satisfy the basic requirements and get a acceptable perfor- mance. Dragonnet performs pretty well among the neural network-based methods. It leverages the propensity score to address the imbalance issue of treatment effect estimation and introduces the biases into the model parameters to form a target regularization. Although in the Production dataset, it is almost balanced for the sample number of treated and control groups, the well-learned propensity score also can facilitate the model training with less variance between different samples. 3) For RUAD, it consistently outperforms other baselines in most cases. Considering the high dimensional data of the Production dataset, the feature selection module with joint multi-label modeling can significantly improve the training efficiency and the model performance. Due to the fact that this dataset is collected from the online environment, there may exist some noise in the collected data. Thus, adversarial feature desensitization module can improve prediction accuracy with the adversarial training operation on the sensitive key features. C. Ablation Study (RQ2) Moreover, we conduct the ablation studies of our RUAD with S-NN as the uplift model, and we analyze the role played by each module. We sequentially remove the two components of the RUAD, i.e. the feature selection module (FS) and the adversarial feature desensitization module (AFD). We construct three variants of RUAD, which are denoted as RUAD (w/o FS-JMM), RUAD (w/o FS) and RUAD (w/o AFD). Specially, RUAD (w/o FS-JMM) represents that we only use the response as the training label of the base uplift model. We present the results in Table IV. From the results, we can see that removing any part may bring performance degradation. This verifies the validity of each part designed in our RUAD. In particular, the feature selection module can select the key sensitive features for uplift modeling, the joint multi-label modeling can help the feature selection to get more sensitive key feature set for the uplift modeling task; the adversarial feature desensitization module can help the uplift model to be more robust on the selected feature set. All the TABLE III OVERALL COMPARISON BETWEEN OUR MODELS AND THE BASELINES ON IHDP AND PRODUCTION DATASETS, WHERE THE BEST AND SECOND BEST RESULTS ARE MARKED IN BOLD AND UNDERLINED, RESPECTIVELY. NOTE THE REPORTED RESULTS ARE THE MEAN ± STANDARD DEVIATION OVER FIVE RUNS WITH DIFFERENT SEEDS. Methods S-NN T-NN Causal Forest TO-NN TARNet CFRwass CFRmmd Dragonnet CITE ˆq (5 bins) ˆρ (5 bins) ˆq (10 bins) ˆρ (10 bins) ˆq (5 bins) ˆρ (5 bins) ˆq (10 bins) ˆρ (10 bins) IHDP Dataset Production Dataset 0.5455 ± 0.0698 0.6233 ± 0.0731 0.7991 ± 0.0002 0.8301 ± 0.0922 0.7233 ± 0.1022 0.7487 ± 0.0893 0.7396 ± 0.0912 0.8374 ± 0.0721 0.8099 ± 0.1120 0.4879 ± 0.0784 0.5098 ± 0.0541 0.8204 ± 0.0001 0.7944 ± 0.0913 0.7603 ± 0.0605 0.7463 ± 0.0703 0.7542 ± 0.0851 0.8094 ± 0.0642 0.7996 ± 0.0839 0.5071 ± 0.0674 0.6427 ± 0.0804 0.8185 ± 0.0003 0.8233 ± 0.0981 0.7408 ± 0.0985 0.7463 ± 0.0703 0.7782 ± 0.0925 0.8305 ± 0.0795 0.8277 ± 0.0742 0.4576 ± 0.0643 0.5386 ± 0.0459 0.7994 ± 0.0002 0.8102 ± 0.0897 0.7780 ± 0.0806 0.7291 ± 0.0699 0.7298 ± 0.0945 0.8575 ± 0.0844 0.7893 ± 0.1198 1.2213 ± 0.0104 1.7244 ± 0.0056 1.7189 ± 0.0002 2.1798 ± 0.0089 0.9504 ± 0.0051 0.9466 ± 0.0047 0.9608 ± 0.0038 1.6453 ± 0.0102 0.8467 ± 0.0108 0.4424 ± 0.0122 0.6766 ± 0.0231 0.7137 ± 0.0001 0.7666 ± 0.0113 0.3454 ± 0.0165 0.4666 ± 0.0137 0.6785 ± 0.0228 0.4999 ± 0.0254 0.5233 ± 0.0146 1.1766 ± 0.0076 1.8102 ± 0.0064 1.7002 ± 0.0002 2.2030 ± 0.0075 0.6799 ± 0.0096 0.8996 ± 0.0099 1.0452 ± 0.0088 1.8308 ± 0.0071 0.8866 ± 0.0121 0.3987 ± 0.0156 0.5988 ± 0.0133 0.6899 ± 0.0002 0.6388 ± 0.0121 0.3089 ± 0.0145 0.5677 ± 0.0102 0.6887 ± 0.0152 0.6544 ± 0.0164 0.6017 ± 0.0221 RUAD 0.9021 ± 0.0967 0.8184 ± 0.0634 0.9127 ± 0.0847 0.8248 ± 0.0821 2.4433 ± 0.0044 0.6877 ± 0.0132 2.3733 ± 0.0083 0.7288 ± 0.0137 modules are helpful in solving the feature sensitivity problem and improving prediction accuracy. D. Robustness Evaluation (RQ3) Regarding the issue presented in Fig. 1, we also conduct the same testing data of the production dataset for the robustness evaluation. In specific, we first train the model on normal test- ing data and add perturbation with the same distribution on the same feature sets after feature normalization. We present the results of RUAD in Fig. 4. The main problem shown in Fig. 1 is that for the third feature set, the perturbation on it makes the learned model get an opposite uplift barplot for the evaluation. After applying our RUAD and getting a well-trained deep uplift model, the results of the uplift bar become more stable than before. This observation suggests that our RUAD can improve the model's feature-level robustness. Also, the results of feature set 3 show that the feature selection module with joint multi-label modeling can select the sensitive key feature set, then using the adversarial feature desensitization module can enhance the learned uplift model to be more robust to the perturbation on these features. E. Compatibility Evaluation (RQ4) To verify the effectiveness of our RUAD on different uplift models, except for T-NN, we also combine it with two typical models, i.e., S-NN, and Dragonnet, in our experiments. The results of the Production datasets are shown in Fig. 5. Ac- cording to the results, we have the following observations: Our RUAD outperforms the base models on two evaluation metrics ˆq (5 bins) and ˆp (5 bins). In particular, S-NN and T-NN are the models that are commonly used for uplift modeling tasks. Especially, for S-NN, after combining it with RUAD to train the model, we can significantly improve the performance of the Qini coefficient. Dragonnet is an ITE estimation model which performs best among all the neural network-based models in Table III. Although it has a complex model structure to get a better uplift prediction, combining it with RUAD also can improve the model performance in all cases. For the three variants of RUAD, the best-performed variant changes with the evaluation metrics. The users can select the proper base model to combine it with RUAD according to the specific scenario. The above observations suggest that our RUAD can (a) Without perturbation (b) Perturbation on feature set 1 (c) Perturbation on feature set 2 (d) Perturbation on feature set 3 Fig. 4. Bar graphs of predicted uplift with 5 bins, w.r.t the origin dataset (i.e., (a)) and three kinds of varieties (i.e., (b)-(d)). We present the results of our RUAD with S-NN as the base uplift model. (a) Qini coeffcient (b) Kendall uplift rank correlation Fig. 5. Performance of our RUAD with three typical base uplift models on the Production dataset, i.e. S-NN, T-NN and Dragonnet. We evaluate the results by using Qini coefficient and Kendall uplift rank correlation with 5 bins. be used as a general framework to improve the accuracy of uplift prediction and the robustness of the uplift model. V. RELATED WORKS A. Uplift Modeling Uplift modeling has received much attention for the online marketing in recent years [2]. Research in this area has focused 0-2020-4040-6060-8080-100Population Targeted (%)-0.2-0.10.00.10.2Uplift (%)0-2020-4040-6060-8080-100Population Targeted (%)-0.2-0.10.00.10.2Uplift (%)0-2020-4040-6060-8080-100Population Targeted (%)-0.2-0.10.00.10.2Uplift (%)0-2020-4040-6060-8080-100Population Targeted (%)-0.2-0.10.00.10.2Uplift (%)S-NNT-NNDragonnet0.00.51.01.52.02.53.0q (5 bins)Base ModelRUADS-NNT-NNDragonnet0.00.20.40.60.81.0 (5 bins)Base ModelRUAD TABLE IV RESULTS OF THE ABLATION STUDIES ON THE PRODUCTION DATASET, WHERE THE BEST AND SECOND BEST RESULTS ARE MARKED IN BOLD AND UNDERLINED, RESPECTIVELY. NOTE THE REPORTED RESULTS ARE THE MEAN ± STANDARD DEVIATION OVER FIVE RUNS WITH DIFFERENT SEEDS. Methods ˆq (5 bins) ˆρ (5 bins) ˆq (10 bins) ˆρ (10 bins) RUAD (w/o FS-JMM) RUAD (w/o FS) RUAD (w/o AFD) RUAD 2.1910 ± 0.0083 2.3224 ± 0.0079 2.1100 ± 0.0028 2.4433 ± 0.0044 0.5231 ± 0.0092 0.6890 ± 0.0143 0.5477 ± 0.0122 0.6766 ± 0.0132 2.1876 ± 0.0102 2.3733 ± 0.0142 2.1764 ± 0.0088 2.3766 ± 0.0083 0.5443 ± 0.0076 0.6774 ± 0.0055 0.6088 ± 0.0104 0.7288 ± 0.0137 on various aspects of uplift modeling, including methods for model building, performance evaluation, and real-world appli- cations. For binary outcome, the intuitive approach to model uplift is to build two classification models [6]. This consists of two separate conditional probability models, one for the treated users, and the other for untreated users. Any off-the- shelf estimator can be used in the two-model approach, such as regression trees [36]. This method is simple and flexible, but it can not mitigate the influence of disparity in feature distributions between treatment and control groups. K ̈unzel et al. [6] propose X-Learner to solve the difference in feature distributions, which leverages the propensity score [37] to get a weighted average of two estimators. However, in practice, X- Learner is usually shown to be easily over-fitting and difficult to tune the parameters. Then, Nie and Wager [38] propose the R-Learner. R-Learner has guaranteed error bounds when using penalized kernel regression as the base learner. To directly model the uplift, a transformed response approach [20] is proposed, but it heavily relies on the accuracy of the propensity score. For continuous outcome, Causal Forest [30] is a random forest-like algorithm for uplift modeling. It uses the causal tree [39] as its base learner, which is a general framework with theoretical guarantees. With the development of deep learning in causal inference, there are many works proposed that focus on ITE estimation. TARNet [31] is a two-head structure like T-Learner, but the information between two heads is shared by a representation layer. CFRNet leverages the distance metrics (MMD and WASS) based on the structure of TARNet to balance the representation between the two heads. To solve the sample imbalance between the treatment and control groups, Dragonnet [34] designs a tree-head structure, which uses a separated head to learn the propensity score. The propensity score is commonly used in ITE estimation. CITE [21] uses it to distinguish the positive and negative samples, and then builds a contrastive learning structure. Unlike the above methods, our RUAD builds the transformed outcome and conditional means together, which can leverage the deep neural network to obtain better feature representations for uplift modeling. B. Robust Optimization The robust optimization has been widely studied in the machine-learning community. In general, there are two most popular types are distributional robustness and adversarial robustness. For the first one [40], it aims to solve the training and testing distribution shift problem. For the second one [41], the key problem is that even if the input has been slightly perturbed, the models can still predict the original output. Our work is more related to the second one, which leverages adversarial training to improve the model's robustness. Adversarial training is initially proposed by [14]. They discover that some architectures of NNs are particularly vulnerable to a perturbation applied to an input. They also show that training the models to be robust against adversar- ial perturbation is effective in reducing test error. However, the definition of adversarial perturbation in [14] requires a computationally expensive inner loop in order to evaluate the adversarial direction. To overcome this problem, Goodfellow et al. [26] propose another definition of adversarial perturba- tion which admits a form of approximation that is free of the expensive inner loop. Bachman et al. [42] study the effect of random perturbation in the setting of semi-supervised learning. Pseudo Ensemble Agreement introduced in [43] trains the model in a way that the output from each layer in the NNs does not vary too much with the introduction of random perturbations. To improve the efficiency of adversarial training, we propose adversarial feature desensitization to improve the model robustness. It leverages a masker to select the important features for the uplift prediction, which can enhance the feature-level robustness for the model. VI. CONCLUSION AND FUTURE WORK In this paper, to address the feature sensitivity problem existing in most uplift modeling methods, we propose a robust- enhanced uplift modeling framework with adversarial feature desensitization (RUAD). RUAD consists of two customized modules, where the feature selection module with joint multi- label modeling selects the key sensitive features for the uplift prediction, which can help get more accurate and robust uplift prediction while reducing the computational cost; then the ad- versarial feature desensitization module adding perturbations on the key sensitive features can help solve the feature sensitiv- ity problem. We conduct extensive evaluations to validate the effectiveness of RUAD. Also, we demonstrate its robustness to the feature sensitivity issue and the compatibility with different uplift models, which show that RUAD is a general training framework for uplift modeling. For future works, we plan to analyze more reasons for the lack of robustness in uplift modeling and provide a theoretical analysis of the feature-level sensitivity. In addition, we are also interested in extending the uplift models to the scenarios with multiple treatments. REFERENCES [1] D. Liu, X. Tang, H. Gao, F. Lyu, and X. He, "Explicit feature interaction-aware uplift network for online marketing," arXiv preprint arXiv:2306.00315, 2023. [2] W. Zhang, J. Li, and L. Liu, "A unified survey of treatment effect het- erogeneity modelling and uplift modelling," ACM Computing Surveys, vol. 54, no. 8, pp. 1–36, 2021. [3] P. Rzepakowski and S. Jaroszewicz, "Decision trees for uplift modeling," in Proceedings of the 2010 IEEE International Conference on Data Mining, 2010, pp. 441–450. [4] P. Gutierrez and J.-Y. G ́erardy, "Causal inference and uplift modelling: A review of the literature," in Proceedings of the 4th International Conference on Predictive APIs and Apps, 2017, pp. 1–13. [5] M. Belbahri, A. Murua, O. Gandouet, and V. Partovi Nia, "Qini-based uplift regression," The Annals of Applied Statistics, vol. 15, no. 3, pp. 1247–1272, 2021. [6] S. R. K ̈unzel, J. S. Sekhon, P. J. Bickel, and B. Yu, "Metalearners for estimating heterogeneous treatment effects using machine learning," Proceedings of the National Academy of Sciences, vol. 116, no. 10, pp. 4156–4165, 2019. [7] N. J. Radcliffe and P. D. Surry, "Real-world uplift modelling with trees," White Paper TR-2011-1, Stochastic significance-based uplift Solutions, pp. 1–33, 2011. [8] Y. Zhao, X. Fang, and D. Simchi-Levi, "Uplift modeling with multiple treatments and general response types," in Proceedings of the 2017 SIAM International Conference on Data Mining, 2017, pp. 588–596. [9] Y. Saito, H. Sakata, and K. Nakata, "Cost-effective and stable policy optimization algorithm for uplift modeling with multiple treatments," in Proceedings of the 2020 SIAM International Conference on Data Mining, 2020, pp. 406–414. [10] F. Oechsle, "Increasing the robustness of uplift modeling using addi- tional splits and diversified leaf select," Journal of Marketing Analytics, pp. 1–9, 2022. [11] A. Wu, K. Kuang, R. Xiong, B. Li, and F. Wu, "Stable estimation of heterogeneous treatment effect," in Proceedings of the 40th International Conference on Machine Learning, 2023. [12] D. B. Rubin, "Causal inference using potential outcomes: Design, modeling, decisions," Journal of the American Statistical Association, vol. 100, no. 469, pp. 322–331, 2005. [13] J. Abrevaya, Y.-C. Hsu, and R. P. Lieli, "Estimating conditional average treatment effects," Journal of Business & Economic Statistics, vol. 33, no. 4, pp. 485–505, 2015. [14] C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Goodfellow, and R. Fergus, "Intriguing properties of neural networks," arXiv preprint arXiv:1312.6199, 2013. [15] F. Tram`er, A. Kurakin, N. Papernot, I. Goodfellow, D. Boneh, and P. McDaniel, "Ensemble adversarial training: Attacks and defenses," arXiv preprint arXiv:1705.07204, 2017. [16] U. Shaham, Y. Yamada, and S. Negahban, "Understanding adversarial training: Increasing local stability of supervised models through robust optimization," Neurocomputing, vol. 307, pp. 195–204, 2018. [17] F. Lyu, X. Tang, D. Liu, L. Chen, X. He, and X. Liu, "Optimizing feature set for click-through rate prediction," in Proceedings of the ACM Web Conference 2023, 2023, pp. 3386–3395. [18] E. Jang, S. Gu, and B. Poole, "Categorical reparameterization with gumbel-softmax," arXiv preprint arXiv:1611.01144, 2016. [19] F. Lv, J. Liang, S. Li, B. Zang, C. H. Liu, Z. Wang, and D. Liu, "Causality inspired representation learning for domain generalization," in Proceedings of the 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022, pp. 8046–8056. [20] S. Athey and G. Imbens, "Recursive partitioning for heterogeneous causal effects," Proceedings of the National Academy of Sciences, vol. 113, no. 27, pp. 7353–7360, 2016. [21] X. Li and L. Yao, "Contrastive individual treatment effects estimation," in Proceedings of the 2022 IEEE International Conference on Data Mining, 2022, pp. 1053–1058. [22] A. Ilyas, S. Santurkar, D. Tsipras, L. Engstrom, B. Tran, and A. Madry, "Adversarial examples are not bugs, they are features," in Proceedings of the 33rd International Conference on Neural Information Processing Systems, 2019, pp. 125–136. [23] H. Zhang and J. Wang, "Defense against adversarial attacks using feature scattering-based adversarial training," in Proceedings of the 33rd International Conference on Neural Information Processing Systems, 2019, pp. 1831–1841. [24] Z. Wang, H. Guo, Z. Zhang, W. Liu, Z. Qin, and K. Ren, "Feature importance-aware transferable adversarial attacks," in Proceedings of the 2021 IEEE/CVF International Conference on Computer Vision, 2021, pp. 7639–7648. [25] M. Chapman-Rounds, U. Bhatt, E. Pazos, M.-A. Schulz, and K. Geor- gatzis, "Fimap: Feature importance by minimal adversarial perturbation," in Proceedings of the 35th AAAI Conference on Artificial Intelligence, 2021, pp. 11 433–11 441. [26] I. J. Goodfellow, J. Shlens, and C. Szegedy, "Explaining and harnessing adversarial examples," arXiv preprint arXiv:1412.6572, 2014. [27] A. Kurakin, I. Goodfellow, and S. Bengio, "Adversarial machine learning at scale," arXiv preprint arXiv:1611.01236, 2016. [28] T. Miyato, S.-i. Maeda, M. Koyama, and S. Ishii, "Virtual adversarial training: a regularization method for supervised and semi-supervised learning," IEEE Transactions on Pattern Analysis and Machine Intelli- gence, vol. 41, no. 8, pp. 1979–1993, 2018. [29] A. Jesson, S. Mindermann, U. Shalit, and Y. Gal, "Identifying causal- effect inference failure with uncertainty-aware models," in Proceedings of the 34th International Conference on Neural Information Processing Systems, 2020, pp. 11 637–11 649. [30] J. M. Davis and S. B. Heller, "Using causal forests to predict treatment heterogeneity: An application to summer jobs," American Economic Review, vol. 107, no. 5, pp. 546–550, 2017. [31] U. Shalit, F. D. Johansson, and D. Sontag, "Estimating individual treatment effect: generalization bounds and algorithms," in Proceedings of the 34th International Conference on Machine Learning, 2017, pp. 3076–3085. [32] S. Vallender, "Calculation of the wasserstein distance between probabil- ity distributions on the line," Theory of Probability and Its Applications, vol. 18, no. 4, pp. 784–786, 1974. [33] K. M. Borgwardt, A. Gretton, M. J. Rasch, H.-P. Kriegel, B. Sch ̈olkopf, and A. J. Smola, "Integrating structured biological data by kernel maximum mean discrepancy," Bioinformatics, vol. 22, no. 14, pp. e49– e57, 2006. [34] C. Shi, D. Blei, and V. Veitch, "Adapting neural networks for the estimation of treatment effects," in Proceedings of the 33rd International Conference on Neural Information Processing Systems, 2019, pp. 2507– 2517. [35] T. Akiba, S. Sano, T. Yanase, T. Ohta, and M. Koyama, "Optuna: A next- generation hyperparameter optimization framework," in Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2019, pp. 2623–2631. [36] W.-Y. Loh, "Classification and regression trees," Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery, vol. 1, no. 1, pp. 14– 23, 2011. [37] M. Caliendo and S. Kopeinig, "Some practical guidance for the imple- mentation of propensity score matching," Journal of Economic Surveys, vol. 22, no. 1, pp. 31–72, 2008. [38] X. Nie and S. Wager, "Quasi-oracle estimation of heterogeneous treat- ment effects," Biometrika, vol. 108, no. 2, pp. 299–319, 2021. [39] P. Darondeau and P. Degano, "Causal trees," in Proceedings of the 16th International Colloquium on Automata, Languages and Programming, 1989, pp. 234–248. [40] H. Rahimian and S. Mehrotra, "Distributionally robust optimization: A review," arXiv preprint arXiv:1908.05659, 2019. [41] T. Bai, J. Luo, J. Zhao, B. Wen, and Q. Wang, "Recent advances robustness," arXiv preprint training for adversarial in adversarial arXiv:2102.01356, 2021. [42] P. Bachman, O. Alsharif, and D. Precup, "Learning with pseudo- ensembles," in Proceedings of the 27th International Conference on Neural Information Processing Systems, 2014, pp. 3365–3373. [43] A. Bagnall, R. Bunescu, and G. Stewart, "Training ensembles to detect adversarial examples," arXiv preprint arXiv:1712.04006, 2017.
http://arxiv.org/abs/2310.17784v1
"2023-10-07T04:53:31"
"2023-10-07T04:53:31"
Data-Centric Financial Large Language Models
Large language models (LLMs) show promise for natural language tasks but struggle when applied directly to complex domains like finance. LLMs have difficulty reasoning about and integrating all relevant information. We propose a data-centric approach to enable LLMs to better handle financial tasks. Our key insight is that rather than overloading the LLM with everything at once, it is more effective to preprocess and pre-understand the data. We create a financial LLM (FLLM) using multitask prompt-based finetuning to achieve data pre-processing and pre-understanding. However, labeled data is scarce for each task. To overcome manual annotation costs, we employ abductive augmentation reasoning (AAR) to automatically generate training data by modifying the pseudo labels from FLLM's own outputs. Experiments show our data-centric FLLM with AAR substantially outperforms baseline financial LLMs designed for raw text, achieving state-of-the-art on financial analysis and interpretation tasks. We also open source a new benchmark for financial analysis and interpretation. Our methodology provides a promising path to unlock LLMs' potential for complex real-world domains.
[ "Zhixuan Chu", "Huaiyu Guo", "Xinyuan Zhou", "Yijia Wang", "Fei Yu", "Hong Chen", "Wanqing Xu", "Xin Lu", "Qing Cui", "Longfei Li", "Jun Zhou", "Sheng Li" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.17784v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.17784v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CL", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CL", "cs.AI", "cs.LG" ]
3 2 0 2 t c O 7 ] L C . s c [ 1 v 4 8 7 7 1 . 0 1 3 2 : v i X r a Under review as a conference paper at ICLR 2024 DATA-CENTRIC FINANCIAL LARGE LANGUAGE MODELS Zhixuan Chu1, Huaiyu Guo1, Xinyuan Zhou1, Yijia Wang1, Fei Yu1, Hong Chen1, Wanqing Xu1, Xin Lu1, Qing Cui1, Longfei Li1, Jun Zhou1, Sheng Li2 Ant Group1 University of Virginia2 {chuzhixuan.czx,guohuaiyu.ghy,zhouxinyuan.zxy,wangyijia.wyj, fred.yf,wuyi.ch,wanqing.xwq,lx111333,cuiqing.cq,longyao.llf, jun.zhoujun}@antgroup.com, shengli@virginia.edu ABSTRACT Large language models (LLMs) show promise for natural language tasks but strug- gle when applied directly to complex domains like finance. LLMs have diffi- culty reasoning about and integrating all relevant information. We propose a data- centric approach to enable LLMs to better handle financial tasks. Our key insight is that rather than overloading the LLM with everything at once, it is more effec- tive to preprocess and pre-understand the data. We create a financial LLM (FLLM) using multitask prompt-based finetuning to achieve data pre-processing and pre- understanding. However, labeled data is scarce for each task. To overcome man- ual annotation costs, we employ abductive augmentation reasoning (AAR) to au- tomatically generate training data by modifying the pseudo labels from FLLM's own outputs. Experiments show our data-centric FLLM with AAR substantially outperforms baseline financial LLMs designed for raw text, achieving state-of- the-art on financial analysis and interpretation tasks. We also open source a new benchmark for financial analysis and interpretation. Our methodology provides a promising path to unlock LLMs' potential for complex real-world domains. INTRODUCTION 1 Large language models (LLMs) such as GPT-3 (Brown et al., 2020), GPT-4 (OpenAI, 2023), and Llama (Touvron et al., 2023) have revolutionized natural language processing tasks, excelling in text understanding, reasoning, and human-like response generation. While general LLMs are trained on broad corpora to acquire general knowledge about language, recent research (Li et al., 2023; Wu et al., 2023; Yang et al., 2023) has explored developing domain-specific LLMs by incorporating knowledge from specific fields. Domain-specific LLMs aim to achieve superior performance on domain-relevant tasks compared to general LLMs. Strategies like fine-tuning, prompt-based tuning, and in-context learning have been employed to incorporate domain knowledge into LLMs. The core challenge is developing effective techniques to inject the right domain knowledge into the LLMs and align their Language Modeling objective with domain-specific goals (Chu et al., 2023). LLMs' attempt to directly access and utilize all domain knowledge in one shot is unrealistic. There are two main approaches to injecting knowledge into LLMs with or without additional training. One is to utilize prompt engineering to conduct in-context learning without any training, inserting information into prompts (Wang et al., 2023). However, token limitations arise when cramming excessive prompts into the context. Although tools like LangChain (Wu et al., 2022) can utilize embeddings instead of raw text, embedding provides a less direct means to integrate such external knowledge sources. They are limited in representing more complex conceptual relationships that are clear from linguistic context. A second technique involves leveraging new data to further train the large language model, fine-tuning its parameters on specific domains or tasks in order to adapt it for improved performance (Chu et al., 2023). While fine-tuning the large language model on new data can enhance its capabilities for certain applications, this approach has limitations in scale. As the model grows ever larger and more data is generated continuously, it becomes infeasible to retrain the model on all new information. 1 Under review as a conference paper at ICLR 2024 Figure 1: Our framework utilizes two key components - a large language model (FLLM) trained on financial data to preprocess domain-specific texts and an abductive reasoning module that augments data to improve FLLM. This differs from LangChain which operates directly on raw text corpora without any deep understanding and analysis of the raw financial data. Therefore, in our work, we take the finance domain as an example. To enable language models to reason like financial experts, they must comprehend financial information multifariously. This necessitates integrating assorted tasks to acquire domain knowledge, such as event matching and analogy, assessing viewpoint quality, and extracting key points, among others. Thus, we propose a data-centric financial large language model named FLLM in Figure 1, based on a multitask prompt- based finetuning to achieve these different objectives. However, labeled data is limited for each specialized task in the complex financial domain, and annotators without domain expertise cannot competently label such data. We employ abductive learning to automatically generate training data by modifying pseudo labels from fledgling FLLM's own outputs to overcome the high cost of expert manual annotation. Our framework is highly adaptable, enabling the development of knowledgeable assistants across many domains. In summary, our proposed data-centric AI approach has two key facets. First, the financial knowledge base provides large language models with a preprocessed and parsed text corpus via data-centric FLLM. Second, abductive augmentation reasoning (AAR) addresses the scarcity of labeled data for specialized tasks to help train the FLLM. This combination of a financial large language model and abductive learning enables both knowledge injection into large language models and more sophisticated reasoning by conducting complex domain-specific tasks. The adaptable data-centric framework paves the way for knowledgeable AI assistants across finance and many other specialized fields. 2 BACKGROUND 2.1 IN-CONTEXT LEARNING Large language models (LLMs) such as GPT-3 (Brown et al., 2020), GPT-4 (OpenAI, 2023), and Llama (Touvron et al., 2023) have shown impressive performance on a wide range of natural lan- guage tasks through a method known as in-context learning (Brown et al., 2020). This approach differs from traditional supervised learning which requires large labeled datasets. Instead, in-context learning allows models to acquire new skills and knowledge simply by being exposed to demonstra- tions of the task framed as natural language prompts (Liu et al., 2023). By conditioning the model on new prompts that provide examples, LLMs can exhibit zero-shot capabilities ranging from trans- lation and summarization to mathematics and dialog, without updating the model parameters (Lu et al., 2021). Our work on abductive augmentation reasoning also relies on prompt-based in-context learning, with three core modules that leverage this technique to enable intuitive reasoning. 2.2 MULTITASK PROMPT-BASED FINETUNEING By providing input-output examples as prompts, GPT-3 (Brown et al., 2020) showed an ability to solve NLP problems without full fine-tuning. This led to many prompt design techniques following a "pre-train, prompt, and predict" approach (Liu et al., 2021b). Some methods (Jiang et al., 2020; Shin et al., 2020; Liu et al., 2021a; Gao et al., 2021; Lu et al., 2022) search over discrete prompts, while others use continuous vector embeddings. Instruction-based prompts are more flexible and natural, containing detailed task descriptions. As human-like prompts enable learning from crowd- sourced data, instruction tuning of large language models is a promising approach for general NLP capabilities (Weller et al., 2020; Efrat & Levy, 2020). Similar to Geng et al. (2023), our work uses multi-task prompt finetuning on a financial corpus for data preprocessing and understanding, which unifies various financial subtasks in a shared model. 2 Under review as a conference paper at ICLR 2024 Figure 2: The framework of the financial large language model (FLLM), which specifically prepro- cesses the original corpus information, so as to establish a bridge between the input to be analyzed and the knowledge sources. Small labeled datasets are insufficient for finetuning large FLLM. AAR corrects pseudo labels from the fledgling FLLM to augment the labeled training data. 2.3 ABDUCTIVE REASONING Reasoning is the process of using logic to draw conclusions based on available information (Wang et al., 2023). There are three main types of reasoning: deductive, inductive, and abductive. Deduc- tive reasoning involves starting with a general premise or theory and drawing a specific conclusion based on that premise. Inductive reasoning works in the opposite direction - moving from specific observations to a general conclusion that is probable but not certain based on the evidence. Finally, abductive reasoning (Walton, 2014; Kov ́acs & Spens, 2005; Zhou, 2019) starts with an observation and then seeks the simplest explanation that would lead to that observation. It generates hypothe- ses to explain a phenomenon rather than drawing conclusions. For example, upon observing that the grass is wet, one could abductively reason that it rained last night as a possible explanation. Abductive reasoning is useful for generating theories and new insights that can then be tested. Our approach leverages the semantic reasoning abilities of large language models to augment train- ing data through abductive inference. Rather than relying on symbolic rule formulations, we directly prompt the model with natural language descriptions of reasoning tasks. Recent work has shown that large language models learn rich semantic representations that allow them to make plausible in- ferences in context, despite lacking explicit symbolic reasoning capabilities (Tang et al., 2023). This pseudo-logical reasoning emerges from the models' ability to build robust connections between to- kens, forming chains of reasoning that appear logically sound on the surface. Our method provides a more scalable approach to dataset augmentation through abductive logic compared to previous methods that require hand-crafted symbolic knowledge bases (Zhong et al., 2023). 3 METHODOLOGY 3.1 PROBLEM STATEMENT Large language models (LLMs) have demonstrated impressive capabilities across a variety of do- mains, enabling applications for medical diagnosis and legal assistance. However, LLMs still strug- gle with complex reasoning and analysis tasks that require understanding, reasoning, and integrating information from diverse sources. This limitation is particularly evident in specialized domains like finance, where interpreting events, news, policies, and regulations requires integrating nuanced do- main knowledge, synthesizing insights from multiple sources, elaborating logical reasoning, and generating an insightful point of view. In this work, our proposed system includes one fine-tuned financial large language model with access to external knowledge sources such as search engines, domain databases, and expert systems. This allows conducting financial sub-tasks to provide ma- terials in a data-centric manner for final frozen LLM generation. Our ultimate goal is to utilize this deeply processed corpus to produce sophisticated financial analysis and interpretations. While we focus on financial analytics, our approach is designed to be generalizable across domains that require abundant information and complex reasoning. 3.2 DATA-CENTRIC FINANCIAL LARGE LANGUAGE MODEL For the financial analysis and interpretation task, unlike the plain LangChain framework directly utilizing the raw information from different data sources, we establish one financial large language model (FLLM), which specifically preprocess the original corpus information, so as to establish 3 Under review as a conference paper at ICLR 2024 Figure 3: The example to instantiate the workflow of FLLM and the specific role of each subtask. a bridge between the input to be analyzed and the knowledge sources, including domain expert knowledge, financial databases, and search engines. As shown in Figure 2, our designed FLLM is a multitask prompt-based fine-tuning LLM that is designed to handle three key subtasks for this financial analysis and interpretation task, i.e., (1) event matching and analogy, (2) viewpoint quality evaluation, and (3) key point extraction. The model first matches the input news to relevant materials in the databases and finds analogous cases and reports. Then, the matched materials are evaluated for quality of opinion and analysis. Only the most insightful sentences are selected. Finally, the model extracts key details like industry, evaluation dimensions, sentiment, etc. to construct the structure for text generation. In this way, our financial large language model acts as an interpretive bridge between the input text and background knowledge sources. By preprocessing the data and learning correlations between events, viewpoints, and details, it can better leverage the information to produce high-quality financial analyses. Specifically, we will use the example in Figure 3 to instantiate the end-to-end workflow of FLLM and the specific role of each subtask. The input is a new piece of government financial policy, about Guangzhou optimizes the standards for determining the number of housing units in personal hous- ing loans. Firstly, we use a sub-ability of FLLM to match this financial policy with more materials, and get more analysis reports, although they may be inaccurate, scattered, or biased. Next, in step 2, FLLM selects the most insightful statements from this information and scores them to filter out irrel- evant noise and distills the content down to concise prompts suitable for the language model's length limits later on. step 3, FLLM extracts high-level key information, such as industry, main indicators, analysis perspectives, sentiment, etc., to grasp and guide the direction, angle, and tone (positive or negative) for generating coherent text later. Through this series of FLLM modules, refined, focused, and filtered textual data has been prepared. In step 4, all this pre-processed information is formatted into a prompt template. Finally, in step 5, a large language model like ChatGPT utilizes this re- fined prompt to fluently generate useful interpretation and analysis of the policy's implications. By systematically preparing and guiding the input in a data-centric workflow, FLLM enables the final language model to produce focused, logical explanations of new financial policies. The end result is a cogent analysis specifically tailored to the original policy statement. 3.3 DATA-CENTRIC ABDUCTIVE AUGMENTATION REASONING The workflow of the Financial Large Language Model has been detailed, but training such a multi- task prompt-based fine-tuning system poses challenges. These three financial subtasks demand strong domain knowledge, beyond what typical annotators possess. Thus, our labeled data is severely limited for these subtasks. Small labeled datasets are insufficient for finetuning large mod- els. We must expand the data in a scalable way to improve the FLLM's performance. Although large language models show promise for text annotation (Dai et al., 2023), complex professional tasks remain difficult. Empirically, we have demonstrated that ChatGPT and GPT-4 struggle with 4 Under review as a conference paper at ICLR 2024 Figure 4: The example of AAR on viewpoint quality evaluation task. The examples of AAR on event matching and analogy and key point evaluation tasks are provided in the Appendix. these financial annotation tasks in the following experimental section. More advanced methods are needed to obtain quality labeled data. With better and more labeled data, the potential of FLLM can be realized for specialized subtasks. 3.4 FRAMEWORK OF AAR We propose an Abductive Augmentation Reasoning (AAR) algorithm to augment the training data for our fledgling FLLM in an abductive manner. The AAR takes as input the pseudo-labels produced for unlabeled data by the FLLM, which was trained on a small labeled dataset. These generated labels from fledgling FLLM may be erroneous due to the limited training data, making it challenging to achieve strong performance. To address this, the AAR refines the pseudo-labels through three key modules, i.e., Further Analysis Prompting through Dynamic Knowledge Questioning (FAP), Further Analysis Enabling through Consistent Knowledge Answering (FAE), and Further Analysis-Driven Output Modification through Knowledge-Enriched Question-Answer Fusion (FADOM). These three modules are driven by LLM such as ChatGPT or GPT-4 and interact with domain expert knowledge to refine the preliminary pseudo-labels, aiming to enhance the fledgling model's performance. This abductive reasoning process is used to correct faulty labels and provide higher-quality training data. FAP. Further Analysis Prompting through Dynamic Knowledge Questioning (FAP) takes the orig- inal input text, the initial output predictions from the fledgling FLLM, and domain expert knowledge as inputs. FAP automatically generates a comprehensive series of analysis questions that aim to ad- dress any gaps, inconsistencies, or need for clarification in the fledgling FLLM's output. These questions are dynamically generated based on the specific output, prompting further reasoning and exploration. Example analysis questions can request more details on ambiguous conclusions, ask for the reasoning or evidence behind claims, probe hypothetical scenarios to check consistency, identify missing links in an argument, etc. The key is producing questions tailored to the output that can elicit a more complete, well-reasoned analysis when answered. Answering these questions will prompt further reasoning and lead to a more complete, logical analysis. FAE. Further Analysis Enabling through Consistent Knowledge Answering (FAE) takes the orig- inal input text, the fledgling FLLM's initial output, the analysis questions from FAP, and the domain knowledge as inputs. FAE answers the analysis questions in a robust, consistent manner based on the domain knowledge. This provides broader, logically valid reasoning that aligns with known 5 Under review as a conference paper at ICLR 2024 facts, relationships, and rules in the domain. FAE ensures the analysis is expanded in a knowledge- grounded way to fully address the gaps identified by the FAP questions. FADOM. Further Analysis-Driven Output Modification through Knowledge-Enriched Question- Answer Fusion (FADOM) takes the original input, the fledgling FLLM's initial output, the analysis questions and answers from FAP and FAE as inputs. FADOM selectively fuses the original output with the question-answer pairs in a way that incorporates the expanded analysis, reasoning, clari- fications, and details provided by the QA process. This produces an improved output that benefits from abductive augmentation. The result is a more complete output aligned with domain expertise. In summary, the automated AAR framework leverages abductive learning and dynamic QA over knowledge to augment FLLM's training data. This drives the fledgling FLLM to make more well- reasoned, detailed outputs consistent with the domain. As shown in Figure 9, the detailed prompt design, domain knowledge, input, and output of these three subtasks are provided, which shows that the three modules work together to enable systematic enhancement for each subtask. 4 EXPERIMENTS In this section, we conduct experiments to evaluate the effectiveness of data-centric FLLM to en- hance the generation by preprocessing the corpus information and data-centric AAR to improve FLLM by providing higher-quality and more training data. Specifically, we aim to address the fol- lowing research questions: 1. Does AAR provide higher-quality data augmentation compared to annotations generated solely by large language models? 2. Can AAR boost performance on key financial subtasks addressed by our Financial Large Language Model? 3. Can providing pre-processed financial text data to LangChain through a financial language model lead to better financial analysis and interpretation compared to giving LangChain access to only raw financial text data? Through these experiments, we aim to demonstrate that abductive reasoning based on LLM is an effective technique for data augmentation and model improvement. Further, the preprocessing and deep processing of corpus information in a data-centric manner is necessary and critical for complex text understanding, analysis, reasoning, and generation tasks in the field of expertise, such as finance. 4.1 DATASET AND TASK The data were obtained from three main sources - web crawling (real-time storage of high-quality public opinion and analysis from across the web), purchasing (procurement of industry-specific an- alytical reports and exclusive information), and in-house data (large amounts of user discussions, influencer perspectives, and high-quality works accumulated within the platform ecosystem). Tens of millions of text corpus are stored daily. We also open source a new benchmark for financial anal- ysis and interpretation. In this work, we take three financial subtasks as examples. Event matching and analogy. This task involves matching input news to relevant materials in databases to find analogous cases and reports. Evaluation metrics are precision, recall, and F1 score. These metrics measure the accuracy of matching input news to relevant materials. Higher scores indicate better performance. Viewpoint quality evaluation. This task evaluates the quality of opinion and analysis in the matched materials. Only the most insightful sentences are selected. The evaluation metric is classification accuracy. Measures how accurately the model classifies sentence quality into 2 or 4 categories like good/bad or excellent/good/fair/poor. Higher accuracy indicates better performance. Key point extraction. This task extracts key details like industry, evaluation dimensions, sentiment etc from materials to construct text summaries. Evaluation metrics are accuracy and BLEU score. Accuracy measures the correct extraction of key points. BLEU measures how close the constructed summary is to a human reference summary. Higher scores indicate better performance. 4.2 QUESTION 1: DOES AAR PROVIDE HIGHER-QUALITY DATA AUGMENTATION? To answer whether abductive augmentation reasoning (AAR) provides higher-quality data augmen- tation compared to annotations generated solely by large language models, we designed a series of 6 Under review as a conference paper at ICLR 2024 experiments to compare the annotation effects of AAR versus directly using existing large language models for annotation. We used ChatGPT and GPT-4 respectively to directly annotate 1000 unla- beled data points for each of three tasks: (1) event matching and analogy (EMA), (2) viewpoint quality evaluation (VQE), and (3) key point extraction (KPE). Since our AAR includes three modules, and each module is built on top of the LLM, in order to explore the effects of different foundation models on AAR annotation, we also conducted a series of ablation studies, using ChatGPT, GPT-4, ChatGLM, ChatGLM2, Alpaca2, and LLama2 respec- tively as the foundation model for AAR. From Table 1, we can observe that simply using large language models makes it difficult to achieve annotation for these three complex financial tasks, while our AAR based on GPT-4 achieved the best results. In addition, we can see that AARs built on ChatGLM, ChatGLM2, Alpaca2, and LLama2 have difficulty directly running through the entire AAR workflow, with more or less issues existing, leading to the abductive reasoning process be- ing unable to proceed smoothly. In summary, our experiments demonstrate that AAR can provide higher quality and more robust annotations compared to solely using LLMs, especially for complex domain-specific tasks. The choice of foundation model is also important, with more capable LLMs like GPT-4 better supporting the reasoning capabilities of AAR. There are still challenges in suc- cessfully implementing end-to-end abductive reasoning across different LLMs that require further research. There are three modules in abductive augmentation reasoning (AAR), namely FAP, FAE, and FADOM. We incorporated domain expert knowledge to guide each of these three modules. To further explore the impact of AAR on data annotation and the role of domain expert knowledge in each module, we designed a series of experiments. As shown in Table 2, one or two modules contain expert knowledge to verify the impact of their knowledge on the overall AAR annotation results. From the table, we can observe that domain expert knowledge is useful for all three modules - removing any one of them affects the AAR annotation performance. The experiments provide insights into how expert knowledge can be effectively incorporated into AAR to improve its data annotation capabilities. This allows AAR to be customized for different domains by plugging in rel- evant knowledge bases. Overall, explicitly encoding domain knowledge is shown to be an important aspect of developing robust AAR systems. Table 1: The comparison of AAR data augmentation and direct annotation by LLM. Settings KPE VQE EMA Strategy Base Model Prompt Precision Recall F1 Accuracy(2) Accuracy(4) Accuracy BLEU Direct annotation ChatGPT GPT-4 1 shot 1 shot AAR ChatGPT GPT-4 1 shot 1 shot ChatGLM 1 shot ChatGLM2 1 shot 1 shot 1 shot Alpaca2 LLama2 0.014 0.009 0.004 0.226 - - - - 0.023 0.018 0.016 0.011 0.008 0.005 0.414 0.293 - - - - - - - - 0.47 0.60 0.52 0.71 - - - - 0.21 0.22 0.32 0.40 - - - - 0.67 0.80 0.75 0.87 - - - - 0.399 0.482 0.316 0.533 - - - - Table 2: The influence of domain expert knowledge of three modules on the AAR performance. Settings KPE VQE EMA AAR Knowledge Precision Recall F1 Accuracy(2) Accuracy(4) Accuracy BLEU 0.000 No GPT-4 0.005 FAP GPT-4 0.041 FAE GPT-4 0.042 FADOM GPT-4 GPT-4 0.027 FAP+FAE GPT-4 FAP+FADOM 0.029 GPT-4 FAE+FADOM 0.163 0.226 All GPT-4 0.000 0.000 0.008 0.006 0.062 0.050 0.070 0.053 0.039 0.032 0.047 0.036 0.234 0.192 0.414 0.293 0.40 0.40 0.42 0.58 0.36 0.56 0.59 0.71 0.14 0.18 0.15 0.27 0.15 0.33 0.36 0.40 0.78 0.82 0.84 0.82 0.87 0.84 0.84 0.87 0.465 0.477 0.496 0.504 0.511 0.483 0.520 0.533 4.3 QUESTION 2: CAN AAR BOOST THE PERFORMANCE OF OUR FLLM? To explore whether AAR can boost performance on key financial subtasks addressed by our Fi- nancial Large Language Model, we designed three strategies with our FLLM. First, we leveraged state-of-the-art general-purpose large language models like ChatGPT and GPT-4 without any train- ing, using prompt engineering with one-shot and few-shot demonstrations to guide the FLLM on the three financial tasks. Second, we fine-tuned the openly available large language models on a 7 Under review as a conference paper at ICLR 2024 Table 3: The performance comparison of different training strategies of FLLM on three tasks. Red: the best, Blue: the second best. Settings KPE VQE EMA Strategy FLLM Prompt Precision Recall F1 Accuracy(2) Accuracy(4) Accuracy BLEU No training Finetune AAR + Finetune ChatGPT GPT-4 1 shot 1 shot ChatGPT 20 shots 20 shots GPT-4 ChatGLM 1 shot 1 shot ChatGLM2 1 shot Alpaca2 ChatGLM 1 shot 1 shot ChatGLM2 1 shot Alpaca2 0.014 0.009 0.179 0.245 0.057 0.093 0.160 0.260 0.182 0.209 0.023 0.018 0.016 0.011 0.203 0.190 0.266 0.255 0.047 0.052 0.133 0.109 0.164 0.162 0.305 0.281 0.344 0.238 0.367 0.266 0.47 0.60 0.52 0.71 0.53 0.50 0.57 0.63 0.62 0.69 0.21 0.22 0.32 0.49 0.30 0.36 0.34 0.26 0.34 0.39 0.67 0.80 0.75 0.84 0.60 0.60 0.55 0.68 0.67 0.83 0.399 0.482 0.357 0.535 0.328 0.353 0.295 0.379 0.389 0.485 Figure 5: The performance of fine-tuned FLLMs as the amount of labeled training data increases. small amount of expert-annotated financial data. Third, we utilized the AAR technique to augment the small amount of expert-labeled data into a larger high-quality labeled dataset for fine-tuning our FLLM foundation model. As shown in Table 3, While GPT-4 with 20 shots prompting demonstrates impressive capabilities out-of-the-box, our approach of applying AAR data augmentation and then fine-tuning tailors the model more specifically to the financial domain. This allows our FLLM to reach comparable per- formance to GPT-4 on the key metrics across all three financial analysis subtasks. The augmented training dataset created through AAR provides the FLLM with sufficient coverage of the problem space to match the few-shot generalization abilities of a cutting-edge general-purpose LLM like GPT-4. Our results highlight the potential of targeted data augmentation techniques like AAR to unlock specialized performance in limited resource contexts where acquiring substantial direct hu- man annotations is infeasible. With further development, AAR data augmentation could enable high-performance financial LLMs without the need for massive human labeling efforts. The key advantage of AAR is that it provides an efficient way to generate more labeled data from a small seed set, which is especially valuable in specialized domains like finance where expert-labeled data is scarce. By leveraging AAR to amplify the limited human annotations, we were able to signif- icantly boost our FLLM's performance on core financial analysis subtasks relevant to real-world applications. Furthermore, to further explore the effects of abductive augmentation reasoning (AAR) on finan- cial large language models (FLLMs), we conducted a series of experiments by annotating different amounts of FLLM training data with AAR annotations. We then fine-tuned the FLLMs and ob- served how their performance changed across all tasks and metrics as the amount of annotated data increased. The results, shown in Figure 5, demonstrate that metrics across all three tasks improved as more annotated data was used. This suggests that incorporating AAR into the training process can enhance FLLMs' reasoning and generalization abilities for financial applications. Specifically, AAR's iterative generation and evaluation of hypotheses appears to provide a form of inductive bias that helps the model better capture financial reasoning patterns and semantics from limited data. Overall, our experiments reveal the promise of AAR for imbuing FLLMs with more robust finan- cial intelligence. Further research is warranted to determine optimal AAR annotation strategies and model architectures to maximize the financial reasoning capacity of large language models. 4.4 QUESTION 3: CAN FLLM HELP LANGCHAIN TO GENERATE BETTER OUTPUT? We will evaluate LangChain's ability to provide insightful financial analysis and interpretations when given pre-processed via FLLM vs. raw financial text data, rating it on four dimensions: Rel- evance (0-5): The analysis should focus on interpreting the core events described, without straying 8 Under review as a conference paper at ICLR 2024 Table 4: The comparison of LangChain and our pipeline on financial analysis and interpretations. Metric LangChain FLLM w/ 1,2,3 FLLM w/ 1 FLLM w/ 1,2 Relevance 4.28 ± 0.57 Accuracy 4.14 ± 1.14 3.71 ± 0.23 Logic Expertise 3.57 ± 0.28 4.85 ± 0.14 4.78 ± 0.15 4.28 ± 0.23 4.71 ± 0.23 4.42 ± 0.61 4.57 ± 0.61 4.35 ± 0.55 4.50 ± 0.25 3.42 ± 0.28 3.57 ± 0.62 3.78 ± 0.15 3.85 ± 0.14 Figure 6: Real financial analysis and interpretation examples with detailed reasons and scores. into unrelated topics or generic background. Accuracy (0-5): The analysis's viewpoint and reason- ing should seem reasonable. It should consistently express a positive or negative outlook, without exaggerating or downplaying the event's impact on the industry. Logic (0-5): The analysis should flow smoothly and logically, with clear causality and relationships between points (Chu et al., 2021). It should not simply restate event details or repeat the same point in different words. The overall meaning should be coherent and well-structured. Expertise (0-5): The analysis should examine the event's impacts from multiple professional investing angles. It should demonstrate sound financial logic and insightful consideration of how the event could affect valuations. There should be a clear, layered structure to the interpretation. To robustly evaluate the capabilities of plain LangChain versus enhanced LangChain via FLLM, we conducted a rigorous comparative experiment. 1000 recent news articles were analyzed and interpreted using both plain LangChain and LangChain enhanced with the FLLM. To obtain objec- tive assessments, five independent human annotators were then invited to carefully review the 1000 sample outputs across the four dimensions mentioned above. By averaging the annotators' scores in each dimension, we could quantify the improvements afforded by integrating FLLM into LangChain in an unbiased, statistically-sound manner. From Table 4, we observed that our method significantly outperformed plain LangChain on all metrics. Additionally, to evaluate the contribution of our 3 subtasks of FLLM - (1) event matching and analogy, (2) viewpoint quality evaluation, and (3) key point extraction - we designed 2 additional ablation studies. In our original design (FLLM w/ 1,2,3), the outputs from all 3 subtasks are injected into the final prompt of ChatGPT to guide generation. In the first ablation study (FLLM w/ 1), we only input the results from subtask 1 on event matching and analogy, containing only the matched corpus resources. In the second ablation study (FLLM w/ 1,2), we input the results from subtask 1 and 2, including the matched corpus resources and high-quality viewpoints selected. From the results, we observed that all 3 subtasks play necessary and complementary roles in producing the final generated text. In addition, as shown in Figure 6, we give a real example with detailed reasons. 5 CONCLUSION AND FUTURE WORK This paper proposes a data-centric approach based on FLLM to improve LLMs' capabilities on financial analysis tasks. To overcome the scarcity of labeled data, they employ abductive augmen- tation reasoning to automatically generate training data. Experiments demonstrate their data-centric financial LLM with abductive augmentation reasoning substantially outperforms baseline LLMs, achieving state-of-the-art on financial analysis and interpretation benchmarks. The data-centric methodology provides a promising direction to unlock the potential of LLMs for complex real- world domains. The introduction of a new benchmark for financial analysis and interpretation is also a valuable contribution. Besides, an interesting direction for future work is to combine the 9 Under review as a conference paper at ICLR 2024 data-centric approach with other methods like prompting and self-supervised pretraining on finan- cial texts. Integrating multi-modal data like financial reports, earnings calls, and stock prices could also enable more nuanced financial analysis. REFERENCES Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. Zhixuan Chu, Stephen L Rathbun, and Sheng Li. Graph infomax adversarial learning for treatment effect estimation with networked observational data. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pp. 176–184, 2021. Zhixuan Chu, Hongyan Hao, Xin Ouyang, Simeng Wang, Yan Wang, Yue Shen, Jinjie Gu, Qing Cui, Longfei Li, Siqiao Xue, et al. Leveraging large language models for pre-trained recommender systems. arXiv preprint arXiv:2308.10837, 2023. Haixing Dai, Zhengliang Liu, Wenxiong Liao, Xiaoke Huang, Yihan Cao, Zihao Wu, Lin Zhao, Shaochen Xu, Wei Liu, Ninghao Liu, Sheng Li, Dajiang Zhu, Hongmin Cai, Lichao Sun, Quanzheng Li, Dinggang Shen, Tianming Liu, and Xiang Li. Auggpt: Leveraging chatgpt for text data augmentation, 2023. Avia Efrat and Omer Levy. The turking test: Can language models understand instructions? arXiv preprint arXiv:2010.11982, 2020. Tianyu Gao, Adam Fisch, and Danqi Chen. Making pre-trained language models better few-shot learners. In ACL-IJCNLP, 2021. Shijie Geng, Shuchang Liu, Zuohui Fu, Yingqiang Ge, and Yongfeng Zhang. Recommendation as language processing (rlp): A unified pretrain, personalized prompt predict paradigm (p5), 2023. Zhengbao Jiang, Frank F Xu, Jun Araki, and Graham Neubig. How can we know what language models know? Transactions of the Association for Computational Linguistics, 8:423–438, 2020. Gy ̈ongyi Kov ́acs and Karen M Spens. Abductive reasoning in logistics research. journal of physical distribution & logistics management, 35(2):132–144, 2005. International Yunxiang Li, Zihan Li, Kai Zhang, Ruilong Dan, Steve Jiang, and You Zhang. Chatdoctor: A medical chat model fine-tuned on a large language model meta-ai (llama) using medical domain knowledge, 2023. Jiachang Liu, Dinghan Shen, Yizhe Zhang, Bill Dolan, Lawrence Carin, and Weizhu Chen. What makes good in-context examples for gpt-3? arXiv preprint arXiv:2101.06804, 2021a. Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pre- train, prompt, and predict: A systematic survey of prompting methods in natural language pro- cessing. arXiv preprint arXiv:2107.13586, 2021b. Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pre- train, prompt, and predict: A systematic survey of prompting methods in natural language pro- cessing. ACM Computing Surveys, 55(9):1–35, 2023. Kevin Lu, Aditya Grover, Pieter Abbeel, and Igor Mordatch. Pretrained transformers as universal computation engines. arXiv preprint arXiv:2103.05247, 1, 2021. Yao Lu, Max Bartolo, Alastair Moore, Sebastian Riedel, and Pontus Stenetorp. 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, 2022. OpenAI. Gpt-4 technical report, 2023. 10 Under review as a conference paper at ICLR 2024 Taylor Shin, Yasaman Razeghi, Robert L Logan IV, Eric Wallace, and Sameer Singh. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. In EMNLP, 2020. Xiaojuan Tang, Zilong Zheng, Jiaqi Li, Fanxu Meng, Song-Chun Zhu, Yitao Liang, and Muhan Zhang. Large language models are in-context semantic reasoners rather than symbolic reasoners. arXiv preprint arXiv:2305.14825, 2023. Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timoth ́ee Lacroix, Baptiste Rozi`ere, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. Douglas Walton. Abductive reasoning. University of Alabama Press, 2014. Yan Wang, Zhixuan Chu, Xin Ouyang, Simeng Wang, Hongyan Hao, Yue Shen, Jinjie Gu, Siqiao Xue, James Y Zhang, Qing Cui, et al. Enhancing recommender systems with large language model reasoning graphs. arXiv preprint arXiv:2308.10835, 2023. Orion Weller, Nicholas Lourie, Matt Gardner, and Matthew E Peters. Learning from task descrip- tions. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Pro- cessing (EMNLP), pp. 1361–1375, 2020. Shijie Wu, Ozan Irsoy, Steven Lu, Vadim Dabravolski, Mark Dredze, Sebastian Gehrmann, Prab- hanjan Kambadur, David Rosenberg, and Gideon Mann. Bloomberggpt: A large language model for finance, 2023. Tongshuang Wu, Ellen Jiang, Aaron Donsbach, Jeff Gray, Alejandra Molina, Michael Terry, and Carrie J Cai. Promptchainer: Chaining large language model prompts through visual program- ming, 2022. Hongyang Yang, Xiao-Yang Liu, and Christina Dan Wang. Fingpt: Open-source financial large language models, 2023. Tianyang Zhong, Yaonai Wei, Li Yang, Zihao Wu, Zhengliang Liu, Xiaozheng Wei, Wenjun Li, Jun- jie Yao, Chong Ma, Xiang Li, et al. Chatabl: Abductive learning via natural language interaction with chatgpt. arXiv preprint arXiv:2304.11107, 2023. Zhi-Hua Zhou. Abductive learning: towards bridging machine learning and logical reasoning. Sci- ence China Information Sciences, 62:1–3, 2019. 11 Under review as a conference paper at ICLR 2024 A THE EXAMPLES OF AAR ON THREE FINANCIAL TASKS IN ENGLISH AND CHINESE. From Figure 1 to Figure 6. B THE EXAMPLE TO INSTANTIATE THE WORKFLOW OF FLLM IN CHINESE. Figure 7. C REAL FINANCIAL ANALYSIS AND INTERPRETATION EXAMPLES WITH DETAILED REASONS AND SCORES IN ENGLISH AND CHINESE. From Figure 8 to Figure 15. 12 Under review as a conference paper at ICLR 2024 Figure 7: The example of AAR on event matching and analogy task. Figure 8: The example of AAR on event matching and analogy task. 13 Under review as a conference paper at ICLR 2024 Figure 9: The example of AAR on viewpoint quality evaluation task. The examples of AAR on event matching and analogy and key point evaluation tasks are provided in the Appendix. Figure 10: The example of AAR on viewpoint quality evaluation task. 14 Under review as a conference paper at ICLR 2024 Figure 11: The example of AAR on key point evaluation task. Figure 12: The example of AAR on key point evaluation task. 15 Under review as a conference paper at ICLR 2024 Figure 13: The example to instantiate the workflow of FLLM and the specific role of each subtask. Figure 14: Real financial analysis and interpretation examples with detailed reasons and scores. 16 Under review as a conference paper at ICLR 2024 Figure 15: Real financial analysis and interpretation examples with detailed reasons and scores. Figure 16: Real financial analysis and interpretation examples with detailed reasons and scores. 17 Under review as a conference paper at ICLR 2024 Figure 17: Real financial analysis and interpretation examples with detailed reasons and scores. Figure 18: Real financial analysis and interpretation examples with detailed reasons and scores. 18 Under review as a conference paper at ICLR 2024 Figure 19: Real financial analysis and interpretation examples with detailed reasons and scores. Figure 20: Real financial analysis and interpretation examples with detailed reasons and scores. 19 Under review as a conference paper at ICLR 2024 Figure 21: Real financial analysis and interpretation examples with detailed reasons and scores. 20
http://arxiv.org/abs/2310.04686v1
"2023-10-07T04:14:13"
"2023-10-07T04:14:13"
Tight Rates in Supervised Outlier Transfer Learning
A critical barrier to learning an accurate decision rule for outlier detection is the scarcity of outlier data. As such, practitioners often turn to the use of similar but imperfect outlier data from which they might transfer information to the target outlier detection task. Despite the recent empirical success of transfer learning approaches in outlier detection, a fundamental understanding of when and how knowledge can be transferred from a source to a target outlier detection task remains elusive. In this work, we adopt the traditional framework of Neyman-Pearson classification -- which formalizes supervised outlier detection -- with the added assumption that one has access to some related but imperfect outlier data. Our main results are as follows: We first determine the information-theoretic limits of the problem under a measure of discrepancy that extends some existing notions from traditional balanced classification; interestingly, unlike in balanced classification, seemingly very dissimilar sources can provide much information about a target, thus resulting in fast transfer. We then show that, in principle, these information-theoretic limits are achievable by adaptive procedures, i.e., procedures with no a priori information on the discrepancy between source and target outlier distributions.
[ "Mohammadreza M. Kalan", "Samory Kpotufe" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04686v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04686v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 6 8 6 4 0 . 0 1 3 2 : v i X r a TIGHT RATES IN SUPERVISED OUTLIER TRANSFER LEARNING Mohammadreza M. Kalan Statistics, Columbia University mm6244@columbia.edu Samory Kpotufe Statistics, Columbia University samory@columbia.edu ABSTRACT A critical barrier to learning an accurate decision rule for outlier detection is the scarcity of outlier data. As such, practitioners often turn to the use of similar but imperfect outlier data from which they might transfer information to the target outlier detection task. Despite the recent empirical success of transfer learning approaches in outlier detection, a fundamental understanding of when and how knowledge can be transferred from a source to a target outlier detection task remains elusive. In this work, we adopt the traditional framework of Neyman-Pearson classification-which formalizes supervised outlier detection-with the added assumption that one has access to some related but imperfect outlier data. Our main results are as follows: • We first determine the information-theoretic limits of the problem under a measure of discrepancy that extends some existing notions from traditional balanced classification; interestingly, unlike in balanced classification, seemingly very dissimilar sources can provide much information about a target, thus resulting in fast transfer. • We then show that, in principle, these information-theoretic limits are achievable by adaptive procedures, i.e., procedures with no a priori information on the discrepancy between source and target outlier distributions. 1 Introduction A primary objective in many data science applications is to learn a decision rule that separates a common class with abundant data from a rare class with limited or no data. This is a traditional problem which often appears under the umbrella term of outlier detection or rare class classification, and has seen a resurgence of interest in modern applications such as malware detection in cybersecurity and IoT (Jose et al., 2018; Kumar & Lim, 2019), fraud detection in credit card transactions (Malini & Pushpa, 2017), disease diagnosis (Bourzac, 2014; Zheng et al., 2011), among others. A main goal in these applications-which distinguishes it from traditional classification where performance is asssessed on average over all classes-is to achieve low classification error on the rare class, while at the same time maintaining low error w.r.t. the common class. Such a constrained objective is commonly referred to as Neyman-Pearson classification. Formally, letting μ0, μ1 denote the common and rare class distributions, Neyman-Pearson classification takes the form: Minimize μ1-error over classifiers h in some hypothesis space H subject to keeping the μ0-error of such an h under a threshold α. In this work, we focus on the common supervised setting where practitioners have access to not only training data from the common class, but also some (limited amount of) data from the rare class or, pertinently, from a related distribution they hope has information on the rare class. Henceforth, for simplicity of notation, we denote the target rare class distribution by μ1,T and the related but imperfect rare class distribution by μ1,S, where "S" stands for source. As an example, such related rare-class data may be from a different infected device in IoT applications, or from similar cancer types in medical applications, or from laboratory simulations of a rare class. This is thus a transfer learning problem, however for supervised outlier detection rather than for traditional classification as is usual in the literature. While this outlier transfer problem is quite common in applications due to the scarcity of rare class data (Su et al., 2023; Wen & Keyes, 2019; Aburakhia et al., 2020), the problem has so far received little rigorous attention. Our main aim is Figure 1: μ0 = N (a0, σ2) is the common distribution, and μ1,S, μ1,T = N (a1,S, σ2), N (a1,T , σ2) are the source and target distributions. The universally optimal decision rules for the source and target are identical, i.e., h∗ T,α, in fact for any value of α ∈ [0, 1] (see Section 3). S,α = h∗ therefore to further theoretical understanding of this timely problem, and in particular to gain much needed insight on the extent to which related but imperfect rare class data may improve performance for the target Neyman-Pearson classification problem. Such achievable transfer performance of course must depend on how far the related rare class distribution μ1,S is from the target μ1,T -somehow properly formalized-and or whether the related rare-class distribution μ1,S induces similar optimal decision rules as for the target rare class distribution μ1,T . We first argue that, unlike in traditional classification, seemingly very different source and target distributions μ1,S, μ1,T may induce the same exact (universally) optimal decision rules in Neyman-Pearson classification; this is obtained as a consequence of a simple extension of the classical Neyman-Pearson Lemma (Lehmann & Lehmann, 1986) to the case of transfer (see Proposition 3.6). This is illustrated in Fig 1 and explained in detail in Section 3. As a consequence, unlike in usual classification, we can approximate the universally best classifier h∗ T,α under the target arbitrarily well asymptotically, i.e., with sufficiently large data from a seemingly unrelated source. However, the story turns out more nuanced in finite-sample regimes, i.e, as we consider the rate of such approximation (in terms of relevant sample sizes), even when μ1,S and μ1,T admits the same optimal classifiers. That is, two different sources μ1,S and μ′ 1,S may yield considerably different transfer rates in finite-sample regimes even if both of them share the same optimal classifiers as the target μ1,T : this is because a given source may yield more data near the common decision boundary h∗ T,α at a faster rate. In particular, we show in our first main result of Theorem 4.4-a minimax lower bound-that the rate of convergence of any outlier-transfer approach is in fact controlled by a relatively simple notion of outlier transfer exponent (adapted from transfer results in traditional classification) which essentially measures how well a source may reveal the unknown decision boundary. Theorem 4.4 is in fact rather general: the minimax lower bound holds for any hypothesis space H of finite VC dimension (at least 3), even in cases where no samples from the rare target class μ1,T are available. Moreover, the result holds generally h∗ and h∗ T,α than another source, thus revealing h∗ T,α are the same or not. S,α We finally turn our attention to whether such rates may be achieved adaptively, i.e., from samples alone without prior knowledge of the discrepancy between μ1,S and μ1,T as captured by both the transfer exponent and the amount of difference between optimal classifiers h∗ T,α. We show in Theorem 4.6 that this is indeed the case: the minimax lower bounds of Theorem 4.4 can be matched up to logarithmic factors by some careful adaptation approach that essentially compares the performance of the empirical best source and target classifiers on the target data. This is described in Section 4.3. S,α and h∗ 1.1 Related Work Outlier detection and transfer learning have mostly been studied separately, despite the clear need for transfer learning in applications of outlier detection where the rare class of data is by definition, always scarce. As such, transfer learning works have mostly focused on traditional classification and regression starting from seminal works of Mansour et al. (2009); David et al. (2010); Ben-David et al. (2010, 2006), to more recent works of Hanneke & Kpotufe (2019, 2022); Kalan et al. (2022); Mousavi Kalan et al. (2020); Lei et al. (2021). The works of Hanneke & Kpotufe (2019, 2022) are most closely related as our notion of outlier transfer exponent may be viewed as an extention of their notion of transfer exponent; however, besides for the fact that both notions capture discrepancies around decision boundaries, transfer in outlier detection is fundamentally different from the case of traditional classification studied in the above works: for instance, as stated earlier, distributions that are significantly different in traditional classification can be quite close in outlier transfer as revealed in this work. Theoretical works on outlier detection on the other hand have mostly focused on unsupervised and supervised settings, but without considering the more practical transfer setting. Unsupervised outlier detection assumes that only data 2 from the common class μ0 is available; theoretical works include studies of density-level set estimation (Steinwart et al., 2005; Polonik, 1995; Ben-David & Lindenbaum, 1997; Tsybakov, 1997) where outliers are viewed as data in low density regions, or in works on so-called one-class classification that aim to learn a contour of the common class μ0 (Schölkopf et al., 2001). Supervised outlier-detection has commonly been formalized via Neyman-Pearson classification, where some data from both the common and rare classes are used to optimize and constrain empirical errors. Early works include (Cannon et al., 2002; Scott & Nowak, 2005; Blanchard et al., 2010; Rigollet & Tong, 2011) which establish convergence rates in various distributional and model selection settings, but all exclude the question of transfer. Transfer learning for outlier detection has in fact received much recent attention in the methodological literature (Xiao et al., 2015; Andrews et al., 2016; Idé et al., 2017; Chalapathy et al., 2018; Yang et al., 2020) where various approaches have been proposed that aim to leverage shared structural aspects of source and target rare class data. On the theoretical front however, much less is understood about outlier transfer. The recent work of Scott (2019) initiates theoretical understanding of the problem: they are first to show that, in some situations where both source and target share the same optimal classifiers, various procedures can guarantee consistency (i.e., taking sample size to infinity) even as source and target μ1,S, μ1,T appear different. Our Proposition 3.6 shows that in fact optimal classifiers may be shared in even more general situations, similarly implying consistency for seemingly very different source and target rare class distributions. Our main results of Theorems 4.4 and 4.6 reach further in deriving the first insights into the finite-sample regimes of outlier transfer, by establishing information-theoretic limits of the problem, along with a notion of discrepancy between source and target that tightly captures such limits. 2 Setup We first formalize the Neyman-Pearson classification framework, followed by its extension to the transfer case. 2.1 Neyman-pearson Classification Let μ0 and μ1 denote probability distributions on some measurable space (X , Σ). Furthermore, suppose that H is a hypothesis class consisting of measurable 0-1 functions on the domain X , where we view h(x) = 0 or 1 as predicting that x is generated from class μ0 or μ1. We view μ0 and μ1 as representing a common and rare class of (future) data. Definition 2.1. We are interested in the so-called Type-I and Type-II errors defined as follows: Rμ0 (h) = μ0(h(x) = 1), Rμ1(h) = μ1(h(x) = 0). Neyman-Pearson classification then refers to the problem of minimizing Type-II error subject to low Type-I error: Minimize h∈H Rμ1(h) s.t. Rμ0(h) ≤ α (2.1) Under mild conditions, the universally optimal classifier, i.e., taking H as the set of all measurable 0-1 functions, is fully characterized by the classical Neyman-Pearson Lemma (see Appendix A) in terms of density ratios. Namely, let p0 and p1 denote densities of μ0 and μ1 w.r.t. some dominating measure ν, then the minimizer of (2.1) has the form h∗ α(x) = 1 { whenever there exists λ such that Rμ0 (h∗ α) is exactly α1. p1 (x) p0 (x) ≥λ} In Section 3 we ask when such universal minimizer transfers across source and target rare class distributions. 2.2 Transfer Learning Setup Population Setup. We consider the following two source and target Neyman-Pearson problems, defined for a fixed common class distribution μ0, and source and target rare class distributions μ1,S and μ1,T : Minimize h∈H Rμ1,S (h) s.t. Rμ0(h) ≤ α (2.2) Minimize h∈H Rμ1,T (h) s.t. Rμ0(h) ≤ α (2.3) 1If we further allow for randomized classifiers, then Neyman Pearson Lemma fully characterizes universally optimal solutions of (2.1) and establishes uniqueness almost-surely under mild restrictions. 3 We let (μ0, μ1,S, α) and (μ0, μ1,T , α) denote these source and target problems. We will see later that the limits of outlier transfer, especially in finite-sample regimes, are well captured by discrepancies between these two problems. In particular, we will be interested in discrepancies between optimal solutions and the measure of the corresponding decision boundaries under involved distributions. We henceforth let h∗ T,α denote (not necessarily unique) solutions of (2.2) and (2.3) (which we assume exist). S,α and h∗ Finite-Sample Setup. We assume access to n0, nS, nT i.i.d. data points respectively from μ0, μ1,S, μ1,T , where we allow nT = 0. The transfer-learning procedure is then allowed to return ˆh ∈ H satisfying for some slack ε0 = ε0(n0), usually of order n−1/2 0 Rμ0(ˆh) ≤ α + ε0, . The goal of the learner is to minimize the target-excess error E1,T (ˆh) ≐ max {0, Rμ1,T (ˆh) − Rμ1,T (h∗ T,α)}. A main aim of this work is to understand which rates of E1,T (ˆh) are achievable in terms of sample sizes nS and nT , and which notions of discrepancy from source to target help capture these limits. 3 Equivalence of Population Problems As discussed in the introduction, we may have seemingly very different source and target distributions μ1,S and μ1,T which however yield the same (universally) optimal classifiers. We investigate this phenomena in this section, the main aim being to illustrate how fundamentally different outlier transfer is from traditional classification. To this end, we consider the set U of all possible measurable 0-1 functions on X , and let H = U in the dicussion below. We will henceforth say that the source problem (μ0, μ1,S, α) is equivalent to the target problem (μ0, μ1,T , α) (at the population level), if all solutions to (2.2) are also solutions to (2.3). Clearly, when this is the case, source samples alone can drive down the target risk at least asymptotically. We first notice that Neyman-Pearson Lemma offers some immediate answers under mild conditions. To see this, let p0, p1,S, p1,T denote densities w.r.t. a common dominating measure ν. In what follows we will simply let the dominating measure ν ≐ μ0 + μ1,S + μ1,T . As previously discussed, Neyman-Pearson Lemma characterizes optimal classifiers in terms of level sets of density ratios. λ ∶= {x ∶ p1,S (x) Definition 3.1 (Level sets). LS p0(x) fraction is zero we view it as infinity no matter if the nominator is zero or nonzero. ≥ λ}. Here, when the denominator of a λ ∶= {x ∶ p1,T (x) p0(x) ≥ λ} and LT The following then establishes equivalence between source and target under mild conditions as a direct consequence of Neyman-Pearson Lemma. Proposition 3.2. Suppose μ0, μ1,S, μ1,T are mutually dominating. Assume further that μ0(LS strictly monotonic in (0, 1) as a function of λ. Then, if {LS a solution of the target problem (2.3). λ }λ≥0, we have for all 0 < α < 1, that any h∗ λ ) is continuous and S,α is λ }λ≥0 ⊂ {LT The above statement was already evident in the work of Scott (2019) where it is assumed that source density ratios are given as a monotonic function of the target density ratios; this immediately implies {LS λ } ⊂ {LT λ }. The statement is illustrated in the example of Fig 1 with Gaussian distributions where the source may appear significantly different from the target (and in fact would yield different Bayes classifiers in traditional classification). To contrast, consider the example of Fig 2 where the source problem yields different level sets than for the target problem (simply by changing the Gaussian variance), and we hence do not have equivalence. Remark 1 (Issue with Disjoint Supports). We have assumed in Proposition 3.2 that all 3 distributions are mutually dominating, while in practice this might rarely be the case. However, without this assumption (essentially of shared support), we may not easily have equivalence between source and target. For intuition, consider a region A of space where μ1,S(A) = 0 while μ1,T (A) > 0. Then let h∗,0 both optimal under the source problem; clearly we may have R1,T (h∗,0 S,α = 0 on A and h∗,1 S,α) since μ1,T (A) > 0. S,α) > R1,T (h∗,1 S,α = 1 The rest of this section is devoted to handling this issue by restricting the attention to more reasonable classifiers that essentially classify any point outside the support of μ0 as 1. The right notion of support is critical in establishing our main relaxation of the above proposition, namely Proposition 3.6 below. We require the following definitions and assumptions. 4 Figure 2: μ0, μ1,S, μ1,T = N (a0, σ2), N (a1,S, σ2), N (a1,T , σ′2) where a1,S = a1,T and σ′ < σ. Optimal decision rules differ. (a) μ0, μ1,S, μ1,T (b) Source and target solu- tions. (c) h′∗ source but not for target. S,α is a solution for Figure 3: Illustration of Example 2 (see Appendix A.1), where h∗ not for target. In other words, the source problem remains equivalent to the target over the more reasonable decision rules of U ∗. S,α ∈ U is also a solution for source but T,α in U ∗, while h′∗ S,α = h∗ Definition 3.3 (Restricted Universal Hyposthesis Class). We let U ∗ consist of all 0-1 measurable functions on the domain X such that for every h ∈ U ∗, h ≡ 1 on {x ∶ p0(x) = 0} a.s. ν. Definition 3.4. We say that α is achievable if there exist thresholds λ and λ′ such that μ0(LS λ′ ) = α. Definition 3.5 (α-level set). Whenever α is achievable, we define LS(α) as the level set in the source whose measure under μ0 is α. The definition of LT (α) which corresponds to the target is the same. Remark 2. Definition 3.4 ensures that LS(α) exists, but it may not be unique. However, we will show in Appendix A by Proposition A.2, it is unique a.s. ν. λ ) = α and μ0(LT The following proposition relaxes the conditions of Proposition 3.2 above by restricting attention to universal classifiers in U ∗. Its proof is technical to various corner cases described in Appendix A. Proposition 3.6. Let 0 ≤ α < 1 and suppose that α is achievable. Then (μ0, μ1,S, α) is equivalent to (μ0, μ1,T , α) under U ∗ iff LS(α) ∈ {LT λ }λ≥0 a.s. ν for all 0 ≤ α < 1, then (μ0, μ1,S, α) is equivalent to (μ0, μ1,T , α) for all 0 ≤ α < 1. λ }λ≥0 a.s. ν. In particular, if α is achievable for all 0 ≤ α < 1 and LS(α) ∈ {LT Proof. See A. Remark 3. Notice that the statements of Proposition 3.6 trivially also hold over any hypothesis class H (rather than just U ∗) containing the level sets 1LS (α), 1LT (α) ∈ H and where, for every h ∈ H, h ≡ 1 on {x ∶ p0(x) = 0} a.s. ν. We illustrate this final proposition in Figure 3: the simple restriction to U ∗ reveals more scenarios where source is equivalent to target (at the population level) even when the distributions appear significantly different. 4 Finite-Sample Results Neyman-Pearson Lemma offers the solution(s) of the optimization problem (2.3) when we have the knowledge of the underlying distributions. However, in practical scenarios, we typically lack information about these distributions and only possess some samples drawn from them. In addressing this challenge, Cannon et al. (2002) embarked on an empirical study of Neyman-Pearson classification and introduced a relaxed version of Neyman-Pearson classification problem. Let n0 and nT be the number of i.i.d. samples generated by μ0 and μ1,T , respectively, and ε0 > 0. Cannon et al. (2002) proposed the following optimization problem: ˆh = arg min h∈H ˆRμ1,T (h) ε0 2 s.t. ˆRμ0 (h) ≤ α + 5 (4.1) where ˆRμ0 (h) = 1 n0 ∑ Xi∼μ0 1{h(Xi)≠0} and ˆRμ1,T (h) = 1 nT ∑ Xi∼μ1,T 1{h(Xi)≠1}, and then derived the convergence rate of excess error in terms of the number of samples and VC dimension of the hypothesis class. Neyman-Pearson classification in the setting of transfer finite-sample scenarios remains unexplored. In this section, Our objective is to understand the fundamental limits of transfer outlier detection in the finite-sample regime, where there are n0, nS, nT i.i.d. samples from μ0, μ1,S, μ1,T , under a measure of discrepancy between source and target. We first define a discrepancy measure in transfer outlier detection and then characterize the fundamental limits of the problem by deriving a minimax lower bound in terms of the number of samples as well as the notion of discrepancy. Finally, we show that this lower bound is achievable through an adaptive algorithm which does not require the prior knowledge of the discrepancy between source and target. 4.1 Outlier Transfer Exponent We aim to define an appropriate notion of outlier transfer distance between source and target under a hypothesis class. Here we adapt the transfer exponent notion defined in Hanneke & Kpotufe (2019) to a notion of discrepancy between source and target in outlier detection. Definition 4.1 (Outlier transfer exponent). Let S∗ α ⊂ H denote the set of solutions of source (2.2). Furthermore, let (μ0, μ1,S, α) and (μ0, μ1,T , α) denote the source and target problems, respectively. We call ρ(r) > 0 outlier transfer exponent from (μ0, μ1,S, α) to (μ0, μ1,T , α) under H, if there exist r, Cρ(r) > 0 such that Cρ(r) ⋅ max {0, Rμ1,S (h) − Rμ1,S (h∗ S,α)} ≥ max {0, Rμ1,T (h) − Rμ1,T (h∗ S,α)} ρ(r) (4.2) for all h ∈ H with Rμ0(h) ≤ α + r, where h∗ S,α = arg max Rμ1,T (h). h∈S∗ α We will show later (Theorem 4.4) that this notion of discrepancy captures the fundamental limits of transfer outlier detection. The following example shows that for a fixed target and for any arbitrary ρ ≥ 1, there exists a source such that it shares the same optimal decision rule as the target and attains the outlier transfer exponent ρ with coefficient Cρ = 1. Therefore, for a given target, there can exist a wide range of sources with differing levels of discrepancy, all of which nevertheless share the same optimal decision rules. Example 1. Let μ0 ∼ N (−1, 1), μ1,T ∼ U nif [0, 1], p1,S = ρxρ−11{x∈[0,1]} for ρ ≥ 1 where p1,S is the density of μ1,S w.r.t. Lebesgue measure. Furthermore, let α = μ0([0, 1]) ,H = {1{t≤x≤1}(x) ∶ t ∈ [−1, 1]}, and r be small enough. Then, we have h∗ S,α = 1{0≤x≤1}. Moreover, for h = 1{t≤x≤1} for t ≥ 0 we obtain T,α = h∗ Rμ1,T (h) − Rμ1,T (h∗ S,α) = t and Rμ1,S (h) − Rμ1,S (h∗ S,α) = tρ. Hence, the outlier transfer exponent is ρ and the coefficient Cρ is 1. Following proposition shows the effect of r on the outlier transfer exponent ρ(r). For small enough r, ρ(r) could be small while for a large r, ρ(r) is infinite. Proposition 4.2. There exist μ0, μ1,S, μ1,T , H, α, r such that for any h ∈ H with Rμ0(h) ≤ α + r, (4.2) holds for ρ(r) = 1 and there exists an h ∈ H with Rμ0 (h) > α + r for which (4.2) does not hold for any ρ < ∞. 4.2 Minimax Lower Bound for Transfer Outlier Detection S,α) ≤ ∆, and there exist ρ(r) ≤ ρ, Cρ(r) ≤ C for any 0 < r < 2α dH Equipped with the notion of outlier transfer exponent, we characterize the fundamental limits of transfer outlier detection by establishing a minimax lower bound. To achieve this objective, first we need to specify the class of distributions for which the minimax lower bound is derived. Definition 4.3 (Class of distributions). Fix a hypothesis class H with finite VC dimension dH. Let FH(ρ, α, C, ∆) denote the class of triplets of distributions (μ0, μ1,S, μ1,T ) for which α is achievable according to Definition 3.4, E1,T (h∗ Remark 4. Deriving a minimax lower bound for the class of distributions satisfying α achievability is a stronger result than for the class without necessarily satisfying that, as the former is contained in the latter. Theorem 4.4 (Minimax lower bound). Fix a hypothesis class H with finite VC dimension dH ≥ 3. Moreover, let 2 , ρ ≥ 1, ∆ ≤ 1, and δ0 > 0. Furthermore, Let ˆh be any learner's classifier that is supposed to output a classifier α < 1 from {h ∈ H ∶ μ0(h) ≤ α + 2α } with probability at least 1 − δ0, by having access to n0, nS, nT i.i.d. samples from dH per Definition 4.1. 6 μ0, μ1,S, μ1,T , respectively. Denote the samples from μ0, μ1,S, μ1,T by Sμ0, Sμ1,S , Sμ1,T and suppose that there are sufficiently many samples such that min{∆ + ( dH nS ) 1 2 } ≤ 2. Then, we have 2ρ , ( dH nT ) 1 inf ˆh sup F (ρ,α,1,∆) E Sμ0 ,Sμ1,S ,Sμ1,T [E1,T (ˆh)] ≥ c ⋅ min{∆ + ( dH nS 1 2ρ , ( ) ) 1 2 } dH nT (4.3) 1 ) 2ρ , ( dH nT where c is a numerical constant. Remark 5. In Theorem 4.4, the minimax lower bound for the class of equivalent source and target distributions, i.e, ) 1 ∆ = 0, reduces to c ⋅ min{( dH 2 }. In this case, by only having access to unlimited source samples, achieving nS an arbitrary small target-excess error is possible. 1 Remark 6. The outlier transfer exponent in the term ( dH 2ρ captures the relative effectiveness of source samples in the nS target. If source and target share the same optimal decision rules and ρ = 1, source samples would be equally effective as target samples. However, even if the source and target share the same optimal decision rules, source samples may result in poor transfer performance when ρ is large. Remark 7. In Theorem 4.4, the learner is allowed to output a classifier ˆh with a Type-I error that slightly exceeds the pre-defined threshold α. However, in certain applications, it is imperative to uphold the threshold without any exceeding. The minimax lower bound in Theorem 4.4, implies that (4.3) holds even if the learner is only allowed to output a classifier ˆh from {h ∈ H ∶ μ0(h) ≤ α} with probability 1 − δ0. ) 4.3 Adaptive Rates In Section 4.2, we establish a minimax lower bound that can be attained by an oracle that effectively disregards the least informative dataset from either the source or target. Let ˆH0 = {h ∈ H ∶ ˆRμ0(h) ≤ α + ˆhT = arg min ˆRμ1,T (h) ε0 2 } h∈ ˆH0 ˆhS = arg min h∈ ˆH0 ˆRμ1,S (h). Then E1,T (ˆhS) ≤ E1,T (h∗ S,α) + ( dH nS 1 2ρ ) and E1,T (ˆhT ) ≤ ( ) 1 2 dH nT with high probability. However, deciding whether ˆhS or ˆhT achieves a smaller error requires the knowledge of outlier transfer exponent and the target Type-II error of the optimal source decision rule, which are not available in practical scenarios. In this section, we show that by using an adaptive algorithm that takes source and target samples as input and produces a hypothesis ˆh ∈ H without using any additional information such as prior knowledge of the outlier transfer exponent, the rate is achievable. To accomplish this, we adapt the algorithm introduced in Hanneke & Kpotufe (2019). First we state the following lemma proved by Vapnik & Chervonenkis (1974). Lemma 4.5. Let μ1 be a probability measure. Moreover, let H be a hypothesis class with finite VC dimension dH and An = dH ). Then with probability at least 1 − δ ) + 1 n log ( max{n,dH} dH 3 , ∀h, h′ ∈ H n log ( 1 δ Rμ1(h) − Rμ1(h′) ≤ ˆRμ1(h) − ˆRμ1(h′) + c √ min{μ1(h ≠ h′), ˆμ1(h ≠ h′)}An + cAn 1{h(Xi)≠1} for n number of i.i.d. samples generated by μ1, where c ∈ (0, ∞) is a universal constant, ˆRμ1 (h) = 1 and ˆμ1 denotes the corresponding empirical measure. n ∑ Xi∼μ1 We propose the following algorithm: 7 Define ˆh = ˆhS if ˆRμ1,T (ˆhS) − ˆRμ1,T (ˆhT ) ≤ c otherwise, define ˆh = ˆhT √ AnT , (4.4) Theorem 4.6. Let H be a hypothesis class with finite VC dimension dH ≥ 3. Furthermore, let (μ0, μ1,S, α) and (μ0, μ1,T , α) denote a source and a target problem. Suppose that there are n0, nS, nT i.i.d. samples from μ0, μ1,S, μ1,T , respectively. Let δ0, δ > 0, ε0 = , AnS and AnT be as defined in Lemma 4.5. Moreover, let the outlier transfer exponent be ρ(r) with coefficient Cρ(r) for r ≥ ε0. Then the hypothesis ˆh obtained by Algorithm (4.4) satisfies: 128 dH log n0+log(8/δ0) √ n0 E1,T (ˆh) ≤ min{E1,T (h∗ Rμ0(ˆh) ≤ α + ε0 S,α) + C ⋅ A 1 2ρ(r) nS , C ⋅ A 1 2 nT } with probability at least 1 − δ0 − 2δ 3 , where C ∈ (0, ∞) is a constant depending on Cρ(r), ρ(r). Proof. Consider the intersection of the following events which happens with probability at least 1 − δ0 − 2δ 3 : 1) {sup h∈H ∣Rμ0(h) − ˆRμ0(h)∣ ≤ ε0 }, 2 2) The event from Lemma 4.5 for nT number of samples generated by μ1,T , 3) The event from Lemma 4.5 for nS number of samples generated by μ1,S. Since on the considered event h∗ S,α ∈ ˆH0, we get ˆRμ1,S (ˆhS) ≤ ˆRμ1,S (h∗ S,α). Then using Lemma 4.5 we obtain Rμ1,S (ˆhS) − Rμ1,S (h∗ S,α) ≤ ˆRμ1,S (ˆhS) − ˆRμ1,S (h∗ S,α) + C ⋅ A 1 2 nS ≤ C ⋅ A 1 2 nS . On the event {sup h∈H ∣Rμ0 (h) − ˆRμ0 (h)∣ ≤ ε0 }, we have Rμ0(ˆhS) ≤ α + r which implies that 2 Hence, Rμ1,T (ˆhS) − Rμ1,T (h∗ S,α) ≤ C ⋅ A 1 2ρ(r) nS . Rμ1,T (ˆhS) − Rμ1,T (h∗ T,α) = Rμ1,T (ˆhS) − Rμ1,T (h∗ S,α) + Rμ1,T (h∗ S,α) − Rμ1,T (h∗ T,α) ≤ E1,T (h∗ S,α) + C ⋅ A 1 2ρ(r) nS . (4.5) Now if Rμ1,T (ˆhS) ≤ Rμ1,T (ˆhT ), by Lemma 4.5 the constraint in Algorithm (4.4) holds, which implies that ˆh = ˆhS and the upper bound (4.5) holds for Rμ1,T (ˆh) − Rμ1,T (h∗ T,α). On the other hand, if Rμ1,T (ˆhS) > Rμ1,T (ˆhT ), then Rμ1,T (ˆhT ) − Rμ1,T (h∗ T,α) < Rμ1,T (ˆhS) − Rμ1,T (h∗ T,α). So, regardless of whether ˆh = ˆhS or ˆh = ˆhT , the upper bound (4.5) holds for Rμ1,T (ˆh) − Rμ1,T (h∗ ˆh satisfies the constraint in Algorithm (4.4), we get T,α). Moreover, Since Rμ1,T (ˆh) − Rμ1,T (h∗ T,α) = Rμ1,T (ˆh) − Rμ1,T (ˆhT ) + Rμ1,T (ˆhT ) − Rμ1,T (h∗ nT ≤ 2C ⋅ A nT + C ⋅ A ≤ C ⋅ A 1 2 nT 1 2 1 2 T,α) which completes the proof. 8 5 Overview of Proof of Theorem 4.4 (Minimax Lower Bound) To establish the minimax lower bound it suffices to show the following theorem. Theorem 5.1. Consider the setting of Theorem 4.4. Then for any learner described in Theorem 4.4 that outputs a hypothesis ˆh, there exist μ0, μ1,S, μ1,T ∈ FH(ρ, α, 1, ∆) such that P Sμ0 ,Sμ1,S ,Sμ1,T (E1,T (ˆh) > c ⋅ min{∆ + ( dH nS 1 2ρ , ( ) dH nT ) 1 2 }) ≥ c′ where c, c′ are universal numerical constants. To prove Theorem 5.1, We follow Tysbakov's method (Tsybakov, 2009). Theorem 5.2. (Tsybakov, 2009) Assume that M ≥ 2 and the function dist(⋅, ⋅) is a semi-metric. Furthermore, suppose that {Πθj }θj ∈Θ is a family of distributions indexed over a parameter space, Θ, and Θ contains elements θ0, θ1, ..., θM such that: (i) dist(θi, θj) ≥ 2s > 0, ∀ 0 ≤ i < j ≤ M (ii) Πj ≪ Π0, ∀ j = 1, ..., M, and 1 M ∑M and Dkl denotes the KL-divergence. j=1 Dkl(Πj∣Π0) ≤ γ log M with 0 < γ < 1/8 and Πj = Πθj , j = 0, 1, ..., M Then inf ˆθ sup θ∈Θ Πθ(dist(ˆθ, θ) ≥ s) ≥ 1 + √ M √ M (1 − 2γ − √ 2γ log M ). We also utilize the following proposition for constructing a packing of the parameter space. Proposition 5.3. (Gilbert-Varshamov bound) Let d ≥ 8. Then there exists a subset {σ0, ..., σM } of {−1, +1}d such that σ0 = (1, 1, ..., 1), dist(σj, σk) ≥ , ∀ 0 ≤ j < k ≤ M and M ≥ 2d/8, d 8 where dist(σ, σ′) = card(i ∈ [m] ∶ σ(i) ≠ σ′(i)) is the Hamming distance. First note that min{∆ + ( dH nS 1 2ρ , ( ) dH nT ) 1 2 } ≤ 2 ⋅ min{max{∆, ( dH nS ) 1 2ρ }, ( ) 1 2 } dH nT ) 1 2 }, min{∆, ( = 2 ⋅ max{min{( dH nS 1 2ρ , ( ) dH nT ) 1 2 }} dH nT So it suffices to show that the minimax lower bound is larger than both min{( dH nS We divide the proof into three parts: ) 1 2ρ , ( dH nT ) 1 2 } and min{∆, ( dH nT ) 1 2 }. • Minimax lower bound is larger than min{( dH nS • Minimax lower bound is larger than min{( dH nS ) ) 1 2ρ , ( dH nT 2ρ , ( dH nT 1 ) 1 2 } for dH ≥ 17 (see Section C.1). ) 1 2 } for 16 ≥ dH ≥ 3 (see Section C.2). • Minimax lower bound is larger than min{∆, ( dH nT ) 1 2 } (see Section C.3). In each part, following Theorem 5.2, we construct a family of pairs of source and target distributions that belong to the class FH. To accomplish this, we pick some points from the domain X shattered by the hypothesis class H and then define appropriate distributions on these points. Additionally, this family of distributions is indexed by {−1, +1}dH , which can be treated as a metric space using the Hamming distance. To meet the requirement of condition (i) in Theorem 5.2, it is necessary for these indices to be well-separated, a condition that can be satisfied through utilizing Proposition 5.3. See Appendix C for the complete proof. 9 References Sulaiman Aburakhia, Tareq Tayeh, Ryan Myers, and Abdallah Shami. A transfer learning framework for anomaly detection using model of normality. In 2020 11th IEEE Annual Information Technology, Electronics and Mobile Communication Conference (IEMCON), pp. 0055–0061. IEEE, 2020. Jerone Andrews, Thomas Tanay, Edward J Morton, and Lewis D Griffin. Transfer representation-learning for anomaly detection. JMLR, 2016. Shai Ben-David and Michael Lindenbaum. Learning distributions by their density levels: A paradigm for learning without a teacher. Journal of Computer and System Sciences, 55(1):171–182, 1997. Shai Ben-David, John Blitzer, Koby Crammer, and Fernando Pereira. Analysis of representations for domain adaptation. Advances in neural information processing systems, 19, 2006. Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Machine learning, 79(1-2):151–175, 2010. Gilles Blanchard, Gyemin Lee, and Clayton Scott. Semi-supervised novelty detection. The Journal of Machine Learning Research, 11:2973–3009, 2010. Katherine Bourzac. Diagnosis: early warning system. Nature, 513(7517):S4–S6, 2014. Adam Cannon, James Howse, Don Hush, and Clint Scovel. Learning with the neyman-pearson and min-max criteria. 2002. Raghavendra Chalapathy, Aditya Krishna Menon, and Sanjay Chawla. Anomaly detection using one-class neural networks. arXiv preprint arXiv:1802.06360, 2018. Shai Ben David, Tyler Lu, Teresa Luu, and Dávid Pál. Impossibility theorems for domain adaptation. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 129–136. JMLR Workshop and Conference Proceedings, 2010. Steve Hanneke and Samory Kpotufe. On the value of target data in transfer learning. In Advances in Neural Information Processing Systems, pp. 9867–9877, 2019. Steve Hanneke and Samory Kpotufe. A no-free-lunch theorem for multitask learning. The Annals of Statistics, 50(6): 3119–3143, 2022. Tsuyoshi Idé, Dzung T Phan, and Jayant Kalagnanam. Multi-task multi-modal models for collective anomaly detection. In 2017 IEEE International Conference on Data Mining (ICDM), pp. 177–186. IEEE, 2017. Shijoe Jose, D Malathi, Bharath Reddy, and Dorathi Jayaseeli. A survey on anomaly based host intrusion detection system. In Journal of Physics: Conference Series, volume 1000, pp. 012049. IOP Publishing, 2018. Seyed Mohammadreza Mousavi Kalan, Mahdi Soltanolkotabi, and A Salman Avestimehr. Statistical minimax lower bounds for transfer learning in linear binary classification. In 2022 IEEE International Symposium on Information Theory (ISIT), pp. 282–287. IEEE, 2022. Ayush Kumar and Teng Joon Lim. Edima: Early detection of iot malware network activity using machine learning techniques. In 2019 IEEE 5th World Forum on Internet of Things (WF-IoT), pp. 289–294. IEEE, 2019. Erich Leo Lehmann and EL Lehmann. Testing statistical hypotheses, volume 2. Springer, 1986. Qi Lei, Wei Hu, and Jason Lee. Near-optimal linear regression under distribution shift. In International Conference on Machine Learning, pp. 6164–6174. PMLR, 2021. N Malini and M Pushpa. Analysis on credit card fraud identification techniques based on knn and outlier detection. In 2017 third international conference on advances in electrical, electronics, information, communication and bio-informatics (AEEICB), pp. 255–258. IEEE, 2017. Yishay Mansour, Mehryar Mohri, and Afshin Rostamizadeh. Domain adaptation: Learning bounds and algorithms. arXiv preprint arXiv:0902.3430, 2009. Mohammadreza Mousavi Kalan, Zalan Fabian, Salman Avestimehr, and Mahdi Soltanolkotabi. Minimax lower bounds for transfer learning with linear and one-hidden layer neural networks. Advances in Neural Information Processing Systems, 33:1959–1969, 2020. Wolfgang Polonik. Measuring mass concentrations and estimating density contour clusters-an excess mass approach. The annals of Statistics, pp. 855–881, 1995. Philippe Rigollet and Xin Tong. Neyman-pearson classification, convexity and stochastic constraints. Journal of Machine Learning Research, 2011. 10 Bernhard Schölkopf, John C Platt, John Shawe-Taylor, Alex J Smola, and Robert C Williamson. Estimating the support of a high-dimensional distribution. Neural computation, 13(7):1443–1471, 2001. Clayton Scott. A generalized neyman-pearson criterion for optimal domain adaptation. In Algorithmic Learning Theory, pp. 738–761. PMLR, 2019. Clayton Scott and Robert Nowak. A neyman-pearson approach to statistical learning. IEEE Transactions on Information Theory, 51(11):3806–3819, 2005. Ingo Steinwart, Don Hush, and Clint Scovel. A classification framework for anomaly detection. Journal of Machine Learning Research, 6(2), 2005. Yueyang Su, Di Yao, and Jingping Bi. Transfer learning for region-wide trajectory outlier detection. IEEE Access, 2023. Alexandre B Tsybakov. On nonparametric estimation of density level sets. The Annals of Statistics, 25(3):948–969, 1997. Alexandre B Tsybakov. Introduction to Nonparametric Estimation. Springer series in statistics. Springer, Dordrecht, 2009. doi: 10.1007/b13794. Vladimir Vapnik and Alexey Chervonenkis. Theory of pattern recognition, 1974. Tailai Wen and Roy Keyes. Time series anomaly detection using convolutional neural networks and transfer learning. arXiv preprint arXiv:1905.13628, 2019. Yanshan Xiao, Bo Liu, Philip S Yu, and Zhifeng Hao. A robust one-class transfer learning method with uncertain data. Knowledge and Information Systems, 44(2):407–438, 2015. Ziyi Yang, Iman Soltani Bozchalooi, and Eric Darve. Anomaly detection with domain adaptation. arXiv preprint arXiv:2006.03689, 2020. Yefeng Zheng, Maciej Loziczonek, Bogdan Georgescu, S Kevin Zhou, Fernando Vega-Higuera, and Dorin Comaniciu. Machine learning based vesselness measurement for coronary artery segmentation in cardiac ct volumes. In Medical Imaging 2011: Image Processing, volume 7962, pp. 489–500. Spie, 2011. 11 A Appendix A (Equivalence of Population Problems) We begin by stating Neyman-Pearson Lemma (Lehmann & Lehmann, 1986) for deterministic tests. In the following, a classifier h ∶ X → {0, 1} aims at classifying H0 ∶ μ0 against the alternative H1 ∶ μ1. In the context of hypothesis testing, h is called a deterministic test. Moreover, Rμ0(h) and 1 − Rμ1 (h) are called size and power, respectively. Theorem A.1 (Neyman-Pearson Lemma (Lehmann & Lehmann, 1986)). Let μ0 and μ1 be probability distributions possessing densities p0 and p1 respectively with respect to a dominating measure ν. (i) Sufficient condition for a solution of the optimization problem (2.1). Let h be a classifier for H0 ∶ μ0 against the alternative H1 ∶ μ1 such that for a constant λ the followings hold and Then h is a solution of (2.1). Rμ0(h) = α h(x) = { 1 when p1(x) ≥ λp0(x) 0 when p1(x) < λp0(x) (A.1) (A.2) (ii) Necessary condition for a solution of the optimization problem (2.1). Suppose that there exist a classifier h and a constant λ such that (A.1) and (A.2) hold. Then, any solution of (2.1), denoted by h∗, satisfies the following a.s. ν h∗(x) = { 1 when p1(x) > λp0(x) 0 when p1(x) < λp0(x) (A.3) λ (LT h∗ also satisfies Rμ0(h∗) = α unless there exists a classifier h′ with Rμ0(h′) < α and Rμ1 (h′) = 0. Remark 8. To obtain a solution of the optimization problem (2.2) in the source (or (2.3) in the target) it suffices to take the level set LS λ′ in the target) whose measure under μ0 is α, and then define a classifier h as h = 1LS in the source (h = 1LT λ′ in the target). Obviously, the classifier h satisfies (A.1) and (A.2), and therefore it is a solution of (2.2). Proposition A.2. Suppose that there exist a classifier h with h ≡ 1 on {x ∶ p0(x) = 0} a.s. ν and a constant λ such that (A.1) and (A.2) hold for h. Then any solution of (2.1), denoted by h∗, such that h∗ ≡ 1 on {x ∶ p0(x) = 0} a.s. ν and Rμ0(h∗) = α satisfies (A.2) a.s. ν. λ Proof. Let S1 = {x ∶ h∗(x) = h(x)}, S2 = {x ∶ h∗(x) ≠ h(x), p1(x) ≠ λp0(x)}, S3 = {x ∶ h∗(x) ≠ h(x), p1(x) = λp0(x)}. By Neyman-Pearson Lemma part (ii), we know that ν(S2) = 0. Moreover, we have α = ∫ h∗p0dν = ∫ S1 h∗p0dν + ∫ h∗p0dν + ∫ h∗p0dν S3 S2 Since ν(S2) = 0, we conclude that ∫S2 h∗p0dν = 0. Hence, and ∫S3 h∗p0dν = 0. Furthermore, on S3 we have h ≡ 1 and h ≠ h∗. So h∗ ≡ 0 on S3 On the other hand, we have α = ∫ S1 h∗p0dν = ∫ hp0dν S1 α = ∫ hp0dν = ∫ hp0dν + ∫ hp0dν + ∫ hp0dν S3 S2 S1 = α + ∫ S3 hp0dν hp0dν = ∫S3 p0dν = 0, because h ≡ 1 on S3. We claim that ν(S3) = 0. By contradiction assume that Therefore, ∫S3 ν(S3) > 0. First we show that p0 is positive on S3 a.s. ν. The reason is that on S3 we have h ≡ 1 and h ≠ h∗. In addition, for x satisfying p0(x) = 0, we have h(x) = h∗(x) = 1 a.s. ν. Therefore, p0 must be positive on S3 a.s. ν. p0dν = 0 which cannot be true since ν(S3) > 0 and p0 > 0 a.s. ν on S3. Hence, we conclude that However, we have ∫S3 ν(S3) = 0. Finally, we obtain that ν(S2 ∪ S3) = 0, where S2 ∪ S3 = {x ∶ h∗(x) ≠ h(x)}. Remark 9. Proposition A.2 implies that LS(α) in Definition 3.5 is unique a.s. ν. 12 Now we are ready to prove Proposition 3.6 in Section 3, which characterizes equivalent source and target pairs. First we show the following technical lemma. Lemma A.3. Suppose that α is achievable. If α < 1, then (2.2) cannot have any other solution h with Rμ0 (h) < α and Rμ1,S (h) = 0. Proof of Lemma A.3. By contradiction, suppose that there exists a solution h1 of (2.2) with Rμ0 (h1) < α and Rμ1,S (h1) = 0. Furthermore, let h = 1LS (α). Since both h and h1 are solutions of (2.2), we have Rμ1,S (h) = Rμ1,S (h1) = 0. By Neyman-Pearson Lemma part (ii), we know that h1 = h on {x ∶ p0(x) ≠ λp1,S(x)} a.s. ν. Let us define the sets S1 = {x ∶ h1(x) ≠ h(x)} and S2 = {x ∶ p0(x) = λp1,S(x)}. Then we have S1 ⊂ S2 a.s. ν. Since h ≡ 1 on S2, we must have h1 ≡ 0 on S1 a.s. ν. From Rμ1,S (h) = Rμ1,S (h1) = 0 we conclude that μ1,S(S1) = 0 and from Rμ0(h1) < Rμ0(h) = α we conclude that μ0(S1) > 0. Let S′ 1) > 0 and ν(S′ 1 = {x ∈ S1 ∶ p0(x) > 0}. Hence μ0(S′ 1) > 0. Then, let us define the set A = {x ∶ x ∈ S′ 1, p1,S(x) = 0}. We have μ1,S(S′ 1) = ∫ p1,Sdν = ∫ S′ 1 S′ 1/A p1,Sdν = 0. Since p1S > 0 on S1/A, we conclude that ν(S′ h ≡ 1 a.s. ν. Hence, we should have λ = 0 which implies that μ0(LS(α)) = 1. However, we assumed that α < 1. 1/A) = 0 which implies that ν(A) > 0. On A, p1,S ≡ 0 and p0 > 0 and λ }λ≥0, there exists LT Proof of Proposition 3.6. (Sufficiency) Suppose that LS(α) ∈ {LT λ }λ≥0 a.s. ν. Due to Neyman-Pearson Lemma part (i), 1LS (α) is a solution of (2.2). Let hS ∈ U ∗ be any arbitrary solution of (2.2). First we consider the case that Rμ1,S (hS) > 0 (or the power of hS in the source problem is less than 1). By Neyman-Pearson Lemma part (ii) we have Rμ0(hS) = α. Then by Proposition A.2, hS = 1LS (α) a.s. ν. We claim that hS is a solution of (2.3). Since LS(α) ∈ {LT λ′ is a solution of (2.3). Furthermore, hS = 1LS (α) = 1LT λ′ such that LS(α) = LT λ′ a.s. ν which implies that hS is a solution of (2.3). If Rμ1,S (hS) = 0 and Rμ0(hS) = α, it would be similar to the previous case. Furthermore, by Lemma A.3, we cannot have a solution hS with Rμ1,S (hS) = 0 and Rμ0 (hS) < α. (Necessity) Suppose that any solution of (2.2) is also a solution of (2.3). Since 1LS (α) is a solution of (2.2), we conclude that it is also a solution of (2.3). Since Rμ0 (1LS (α)) = α, by Proposition A.2 and α achievability, 1LT (α) = 1LS (α) a.s. ν. Therefore, LS(α) = LT (α) a.s. ν and LS(α) ∈ {LT λ }λ≥0 a.s. ν. λ′ a.s. ν. Hence, μ0(LT λ′ ) = α and 1LT A.1 Example corresponding to Fig 3 Example 2. Let ν be the Lebesgue measure, α = 1 16 , and U be the class of all the measurable 0-1 functions on R. 3 , 8 Furthermore, let μ1,S = U nif [1, 2], μ1,T = U nif [ 4 ], and 3 p0(x) = { x 4 −x 4 + 1 2 + 1 2 −2 ≤ x ≤ 0 0 < x ≤ 2 Then, we have LS(α) = LT (α) = (−∞, −2] ∪ [ 3 in the source but not in the target. However, source is equivalent to target under U ∗. 2 , +∞). Consider the hypothesis h = 1{x∈[ 3 2 ,2]} ∈ U which is a solution B Appendix B (Outlier Transfer Exponent) B.1 Proof of Proposition 4.2 Proof. Let μ0 = N (0, 1) μ1,S = U nif [0, 1] μ1,T = A1 ⋅ U nif [t1, 2t0 − 1] + A2 ⋅ U nif [2t0 − 1, 1] where A2 > A1 > 0, t1 > 0, 1 2 < t0 < 1, 2t0 − 1 > t1 and A1(2t0 − t1 − 1) + A2(2 − 2t0) = 1. Moreover, H = {1{x∈[a,1]∪[b,t0]}(x) ∶ t0 ≤ a ≤ 1, t1 ≤ b ≤ t0}. 13 Let α = μ0([t0, 1]) and r < μ0([2t0 − 1, t0]) − α. Clearly by Neyman-Pearson Lemma the unique source and target solutions are h∗ T,α = 1{t0≤x≤1}. Then for any h with Rμ0(h) ≤ α + r, h is of the form h = 1{x∈[a,1]∪[b,t0]} for some a ∈ [t0, 1] and b ∈ [2t0 − 1, t0]. Hence, S,α = h∗ Rμ1,S (h) − Rμ1,S (h∗ Rμ1,T (h) − Rμ1,T (h∗ S,α) = a + b − 2t0, S,α) = A2(a + b − 2t0) which implies that ρ(r) = 1. However, if we take h = 1{2t0−1−ε≤x≤t0}(x) for small enough 0 < ε < (1−t0)(A2−A1) which violates the condition Rμ0(h) ≤ α + r, (4.2) does not hold for any ρ < ∞. A1 , C Appendix C: Proof of Theorem 4.4 (Minimax Lower Bound) C.1 Minimax lower bound is larger than min{( dH nS ) 1 2ρ , ( dH nT ) 1 2 } for dH ≥ 17 2 , x2,1, ..., x2, d Let d = dH − 1 and dH be odd (If dH is even then define d = dH − 2). Then pick dH points S = {x0, x1,1, ..., x1, d } from X shattered by H (if dH is even then we pick dH − 1 points). Moreover, let ̃H be the projection of H onto the set S with the constraint that all h ∈ ̃H classify x0 and x−1 as 0. Next we construct a distribution μ0 and a family of pairs of distributions (μσ following, we fix ε = c1 ⋅ min{( dH nS ) 1 2 } for a constant c1 < 1 to be determined. 1,T ) indexed by σ ∈ {−1, +1} d 2ρ , ( dH nT 1,S, μσ 2 . In the ) 2 1 Distribution μ0: We define μ0 on S as follows: μ0(x1,i) = μ0(x2,i) = 2α d for i = 1, ..., d 2 and μ0(x0) = 1 − 2α. Distribution μσ 1,T : We define μσ 1,T on S as follows: μσ 1,T (x1,i) = μσ 1,T (x2,i) = 1 d 1 d + (σi/2) ⋅ − (σi/2) ⋅ and μσ 1,T (x0) = 0. Distribution μσ 1,S: We define μσ 1,S on S as follows: μσ 1,S(x1,i) = μσ 1,S(x2,i) = 1 d 1 d + (σi/2) ⋅ − (σi/2) ⋅ and μσ 1,S(x0) = 0. ε d ε d ερ d ερ d for i = 1, ..., for i = 1, ..., for i = 1, ..., for i = 1, ..., d 2 d 2 d 2 d 2 Verifying the transfer distance condition. For any σ ∈ {−1, +1} d with Type-I error w.r.t. μ0 at most α. Then hσ satisfies the following: 2 , let hσ ∈ ̃H be the minimizer of Rμσ and Rμσ 1,T 1,S 1 hσ(x1,i) = 1 − hσ(x2,i) = { 0 if σi = 1 otherwise for i = 1, ..., d 2 For any ˆh ∈ ̃H with α − 2α d < μ0(ˆh) < α + 2α d , we have μ1,T (hσ = 1) − μ1,T (ˆh = 1) = μ1,S(hσ = 1) − μ1,S(ˆh = 1) = k d k d ⋅ ε ⋅ ερ 14 for some non-negative integer k ≤ d for ˆh ∈ ̃H with μ0(ˆh) ≤ α − 2α d . In this case we have 2 . So the outlier transfer exponent is ρ with Cρ = 1. The condition is also satisfied + + μ1T (hσ = 1) − μ1T (ˆh = 1) = k1 d k1 d 2 and k2 ≤ d. Using inequality (a + b)ρ ≤ 2ρ−1(aρ + bρ) the condition can be easily verified. μ1S (hσ = 1) − μ1S (ˆh = 1) = k2ε 2d k2ερ 2d ), ˆh(x2,1), ..., ˆh(x2, d for some integers k1 ≤ d Reduction to a packing. Any classifier ˆh ∶ S → {0, 1} can be reduced to a binary sequence in the domain {−1, +1}d. We can first map ˆh to (ˆh(x1,1), ˆh(x1,2), ..., ˆh(x1, d )) and then convert any element 0 to −1. We choose the Hamming distance as the distance required in Theorem 5.2. By applying Proposition 5.3 we can get a subset Σ of {−1, +1} d 2 with ∣Σ∣ = M ≥ 2d/16 such that the hamming distance of any two σ, σ′ ∈ Σ is at least d/16. Any σ, σ′ ∈ Σ can be mapped to binary sequences in the domain {+1, −1}d by replicating and negating, i.e., (σ, −σ), (σ′, −σ′) ∈ {+1, −1}d and the hamming distance of resulting sequences in the domain {+1, −1}d is at least d/8. Then for any ˆh ∈ ̃H with μ0(ˆh = 1) < α + 2α d and σ ∈ Σ, if the hamming distance of the corresponding binary sequence of ˆh and σ in the domain {+1, −1}d is at least d/8 then we have ε d μ1,T (hσ = 1) − μ1,T (ˆh = 1) ≥ d 8 ε 8 = ⋅ 2 2 In particular, for any σ, σ′ ∈ Σ we have μ1,T (hσ = 1) − μ1,T (hσ′ = 1) ≥ d 8 ⋅ ε d = ε 8 KL divergence bound. Define Πσ = (μσ of Πσ, Πσ′ . We have 1,S)nS × (μσ 1,T )nT . For any σ, σ′ ∈ Σ, our aim is to bound the KL divergence Dkl(Πσ∣Πσ′ ) = nS ⋅ Dkl(μσ 1,S∣μσ 1,S) + nT ⋅ Dkl(μσ 1,T ∣μσ 1,T ) ′ ′ The distribution μσ X × P σ Y ∣X=i is a Bernoulli distribution with parameter 1 P σ 1,S can be expressed as P σ 2 + 1 2 ⋅ (σi/2) ⋅ ερ. Hence we get Y ∣X where P σ X is a uniform distribution over the set {1, 2, ..., d 2 } and Dkl(μσ 1,S∣μσ 1,S) = ′ ⋅ Dkl(Ber( 1 2 + 1 2 ⋅ (σi/2) ⋅ ερ)∣Ber( 1 2 + 1 2 ⋅ (σ′ i/2) ⋅ ερ)) d 2 ∑ i=1 1 d/2 1 4 c0c2ρ 1 ⋅ ≤ 1 4 ≤ c0 ⋅ ⋅ ε2ρ ≤ c0c2ρ 1 ⋅ dH nS d nS for some numerical constant c0. Using the same argument we can obtain Dkl(μσ ′ 1,T ∣μσ 1,T ) ≤ c0c2 1 ⋅ d nT (C.1) . Hence we get Dkl(Πσ∣Πσ′) ≤ 2c0c1d. Then, for sufficiently small c1 we get Dkl(Πσ∣Πσ′) ≤ 1 Therefore, for any learner that outputs a hypothesis ˆh from {h ∈ H ∶ μ0(h) ≤ α + 2α dH exist (μ0, μ1,S, μ1,T ) ∈ FH(ρ, α, 1, ∆) such that condition on the event ˆh ∈ {h ∈ H ∶ μ0(h) ≤ α + 2α dH 8 log M which satisfies condition (ii) in Proposition 5.2. } we have } with probability 1 − δ0, there P Sμ0 ,Sμ1,S ,Sμ1,T (E1,T (ˆh) > c ⋅ min{∆ + ( dH nS 1 2ρ , ( ) dH nT ) 1 2 }) ≥ c′ which implies that the unconditional probability is as follows P Sμ0 ,Sμ1,S ,Sμ1,T (E1,T (ˆh) > c ⋅ min{∆ + ( dH nS 1 2ρ , ( ) dH nT ) 1 2 }) ≥ (1 − δ0)c′ ≥ c′′ 15 C.2 Minimax lower bound is larger than min{( dH nS ) 1 2ρ , ( dH nT ) 1 2 } for 16 ≥ dH ≥ 3 Pick three points S = {x0, x1, x2} from X shattered by H. Then we construct a distribution μ0 and two pairs of ) 1 distributions (μk 2 } for a constant c1 < 1 to be determined. 1,T ) for k = −1, 1. Also fix ε = c1 ⋅ min{( 1 nS 2ρ , ( 1 nT 1,S, μk ) 1 Distribution μ0: We define μ0 on S as follows: μ0(x0) = 1 − 2α, μ0(x1) = μ0(x2) = α Distribution μk 1,T : We define μk 1,T on S as follows: 1,T (x0) = 0, μk μk 1,T (x1) = 1 2 + k 2 ⋅ ε, μk 1,T (x2) = 1 2 − k 2 ⋅ ε Distribution μk 1,S: We define μk 1,S on S as follows: 1,S(x0) = 0, μk μk 1,S(x1) = 1 2 + k 2 ⋅ ερ, μk 1,S(x2) = 1 2 − k 2 ⋅ ερ 1,S)nS × (μk Let Πk = (μk numerical constant. Furthermore, let hk be the solution with Type-I error at most α for the distributions (μ0, μk (μ0, μk 1,T ). It is easy to see that Rμk from Hα = {h ∈ H ∶ μ0(h) ≤ α + 2α 3 1,T )nT for k = −1, 1. Then using the same argument we get Dkl(Π−1∣Π1) ≤ c where c is a 1,S) and (hk) = ε. Using Le Cam's method we get that for any ˆh chosen } there exist (μ0, μ1,S, μ1,T ) ∈ FH(ρ, α, 1, 0) such that (h−k) − Rμk 1,T 1,T P Sμ1,S ,Sμ1,T (E1,T (ˆh) > c ⋅ min{( 1 nS 1 2ρ , ( ) 1 nT ) 1 2 }) ≥ c′ Since dH ≤ 16 we conclude that P Sμ1,S ,Sμ1,T (E1,T (ˆh) > c ⋅ min{( dH nS 1 2ρ , ( ) dH nT ) 1 2 }) ≥ c′ for some numerical constants c, c′. C.3 Minimax lower bound is larger than min{∆, ( dH nT ) 1 2 } We only show it for the case where dH ≥ 17. The other case follows the same idea as in Section C.2. We follow the same idea as in the previous part. Let ε = c1 ⋅ min{∆, ( dH nT by H construct the distributions on S as follows: Distribution μ0: We define μ0 on S as follows: ) 1 2 } and pick the same set S from X shattered μ0(x1,i) = μ0(x2,i) = 2α d for i = 1, ..., d 2 and μ0(x0) = 1 − 2α. Distribution μσ 1,T : We define μσ μσ 1,T (x1,i) = 1,T on S as follows: 1 d 1 d μσ 1,T (x2,i) = and μσ 1,T (x0) = 0. Distribution μσ 1,S: We define μσ μσ 1,S(x1,i) = 1,S on S as follows: 1 d 1 d μσ 1,S(x2,i) = + (σi/2) ⋅ − (σi/2) ⋅ ε d ε d for i = 1, ..., for i = 1, ..., + (1/2) ⋅ − (1/2) ⋅ ερ d ερ d for i = 1, ..., for i = 1, ..., 16 d 2 d 2 d 2 d 2 and μσ 1,S(x0) = 0. Note that unlike previous part, all the distributions μσ 1,S, μσ S,α) ≤ ∆. For every pair of (μσ Verifying E1,T (h∗ 1S are the same for different σ's. 1,T ) we have E1,T (h∗ S,α) ≤ d 2 ⋅ ε d ≤ ∆ verifying the transfer distance condition and reducing to a packing parts follow the same idea. We just bound the corresponding kL-divergence. KL divergence bound. Define Πσ = (μσ 1,T )nT . We have 1,S)nS × (μσ Dkl(Πσ∣Πσ′) = nS ⋅ Dkl(μσ ′ 1,S∣μσ 1S ) + nT ⋅ Dkl(μσ 1,T ∣μσ 1,T ) ′ Since source distributions are the same, the first term is zero. Following the same argument we get Dkl(μσ 1,T ∣μσ 1,T ) ≤ c0ε2 ≤ c0c1 ′ d nT where c0 is the same numerical constant used in (C.1). Then for sufficiently small c1 we get Dkl(Πσ∣Πσ′) ≤ 1 which satisfies condition (ii) in Proposition 5.2. 8 log M 17
http://arxiv.org/abs/2310.04680v1
"2023-10-07T03:36:39"
"2023-10-07T03:36:39"
The Cost of Down-Scaling Language Models: Fact Recall Deteriorates before In-Context Learning
How does scaling the number of parameters in large language models (LLMs) affect their core capabilities? We study two natural scaling techniques -- weight pruning and simply training a smaller or larger model, which we refer to as dense scaling -- and their effects on two core capabilities of LLMs: (a) recalling facts presented during pre-training and (b) processing information presented in-context during inference. By curating a suite of tasks that help disentangle these two capabilities, we find a striking difference in how these two abilities evolve due to scaling. Reducing the model size by more than 30\% (via either scaling approach) significantly decreases the ability to recall facts seen in pre-training. Yet, a 60--70\% reduction largely preserves the various ways the model can process in-context information, ranging from retrieving answers from a long context to learning parameterized functions from in-context exemplars. The fact that both dense scaling and weight pruning exhibit this behavior suggests that scaling model size has an inherently disparate effect on fact recall and in-context learning.
[ "Tian Jin", "Nolan Clement", "Xin Dong", "Vaishnavh Nagarajan", "Michael Carbin", "Jonathan Ragan-Kelley", "Gintare Karolina Dziugaite" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04680v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04680v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CL", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CL", "cs.AI", "cs.LG" ]
3 2 0 2 t c O 7 ] L C . s c [ 1 v 0 8 6 4 0 . 0 1 3 2 : v i X r a The Cost of Down-Scaling Language Models: Fact Recall Deteriorates before In-Context Learning Tian Jin∗ MIT CSAIL tianjin@csail.mit.edu Nolan Clement∗ MIT nolangc@mit.edu Xin Dong∗ Harvard University xindong@g.harvard.edu Vaishnavh Nagarajan Google Research vaishnavh@google.com Michael Carbin MIT CSAIL mcarbin@csail.mit.edu Jonathan Ragan-Kelley MIT CSAIL jrk@mit.edu Gintare Karolina Dziugaite Google DeepMind gkdz@google.com Abstract How does scaling the number of parameters in large language models (LLMs) affect their core capabilities? We study two natural scaling techniques - weight pruning and simply training a smaller or larger model, which we refer to as dense scaling - and their effects on two core capabilities of LLMs: (a) recalling facts presented during pre-training and (b) processing information presented in-context during inference. By curating a suite of tasks that help disentangle these two capabilities, we find a striking difference in how these two abilities evolve due to scaling. Reducing the model size by more than 30% (via either scaling approach) significantly decreases the ability to recall facts seen in pre-training. Yet, a 60–70% reduction largely preserves the various ways the model can process in-context information, ranging from retrieving answers from a long context to learning parameterized functions from in-context exemplars. The fact that both dense scaling and weight pruning exhibit this behavior suggests that scaling model size has an inherently disparate effect on fact recall and in-context learning. 1 Introduction Scaling up the size of LLMs is known to yield impressive performance gains on various tasks (Kaplan et al., 2020a; Hoffmann et al., 2022b; Brown et al., 2020b; Wei et al., 2022). On the other hand, to deploy language models sustainably, it is also critical to scale them down while preserving their end utility. Naturally, scaling, in both directions, has gained interest in a recent wave of research on language models (Kaplan et al. (2020a); Hoffmann et al. (2022b); Frantar & Alistarh (2023); Jiang et al. (2022); Kurtic et al. (2023); Santacroce et al. (2023)). Much of this work evaluates size–performance tradeoffs of scaling through aggregate performance metrics such as perplexity or downstream accuracy on existing benchmarks. However, we argue that there must exist subtle but important effects of scaling that cannot be captured by standard metrics alone. Indeed, work on image classification already hints at this. Pruning image models, for example, can introduce biases (Hooker et al., 2019) or disproportionate effects on certain subsets of the data (Jin et al., 2022) - these are effects that simply do not reflect in the overall accuracy of the model. Taking inspiration from this, our goal is to identify the subtler effects of scaling (up or down) LLMs in terms of the various capabilities that underpin their success in practice. Our approach. In this work, we study the effects of scaling the number of parameters in an LLM on two fundamentally dichotomous capabilities as put forth by Chan et al. (2022b;a): the ability ∗These authors contribute equally to this work. 1 Figure 1: Pruning to moderate sparsity (> 30% sparse) harms fact recall while in-context learning withstands even aggressive pruning (60% sparse). We plot the accuracy versus sparsity for the OPT-13B, OPT-30B, LLaMA-13B, and LLaMA-33B models on TriviaQA dataset for fact recall evaluation (left) and linear classification dataset for ICL evaluation (right). We plot their average performance in red. We color the range of sparsity where accuracy drop is within (relative) 5% of the dense model. Accepting (relative) 5% accuracy drop w.r.t. the dense model, the maximum sparsity on fact recall task is 30%, whereas the maximum sparsity on ICL task is 60%. to process information stored in weights (such as facts seen during pre-training) and the ability to process information stored in context (such as hints given in the context). It is, however, challenging to isolate how well a model has learned these abilities by simply measuring performance on an arbitrary downstream task - after all, most tasks require both abilities to varying extents to succeed. Instead, we carefully curate a set of downstream tasks that help tease apart the performance of any given model on the two abilities (as explained shortly). We then evaluate model performance in terms of these two abilities under two fundamentally different types of scaling: pruning and dense scaling. For the former, we consider recent scalable pruning methods that prune and update the remaining weights in one-shot (Frantar & Alistarh, 2023; Sun et al., 2023); for the latter, we use (separately-trained) dense models with increased/reduced width and depth. Our curated suite of benchmarks involve four classes of tasks, defining a gradation of reliance on information stored in-weights and in-context. The first three are Q&A tasks: (1) a closed book Q&A that necessarily requires fact recall from pre-training for which the model needs to process information from the weights, (2) an open book Q&A for which it suffices to copy information from the context and (3) an overriding Q&A, where the information provided in-context overrides facts seen during pre-training (Li et al., 2022; Longpre et al., 2021). Finally, to evaluate more sophisticated context-processing abilities, we consider testing the model on its ability to (4) learn parameterized functions (e.g., linear classifiers) using input–output pairs presented in-context. Overall, we consider open-book, overriding Q&A and learning tasks as tasks that require increasing levels of in-context learning (ICL) abilities (See Section 3.1 for more discussion). We summarize these tasks in Table 1. Fact recall results. Prior pruning literature demonstrates significant down-scaling without noticeable change to accuracy: pioneering work (Dong et al., 2017b) removes ∼ 45% of the weights in a ResNet50 model without noticeable accuracy degradation. 1 However, when examining the effect of pruning on the ability to recall facts, we find a much different story: removing more than 30% of weights leads to significant (> 5%, relative) accuracy degradation on fact recall related tasks (Figure 1, left). Fact recall shows the same striking sensitivity to dense scaling. In-context learning results. The seminal work of Brown et al. (2020a) hypothesized that scaling up the number of parameters strongly benefits the ICL ability of LLMs.2 However, our evaluations on the suite of tasks that require a gradation of ICL abilities (with little to no reliance on fact recall) demonstrate the opposite: substantial down-scaling still preserves LLM's ICL ability. Specifically, 1Please refer to Section 4.1, Figure 2.(a) of Dong et al. (2017b). Notably, Dong et al. (2017b) obtained these results similarly by pruning without retraining. 2"Since in-context learning involves absorbing many skills and tasks within the parameters of the model, it is plausible that in-context learning abilities might show similarly strong gains with scale." (Brown et al., 2020a) 2 020406080Sparsity (%)02040Exact Match (%)TriviaQA020406080Sparsity (%)0204060Exact Match (%)Linear ClassificationOPT-13BOPT-30BLLaMA-13BLLaMA-33BAverage Table 1: Tasks employed in our experiments. Task Type Task Q&A Learning WebQuestions NaturalQuestions TriviaQA TriviaQA (Filtered) DisentQA Linear CLS 2-layer NN Decision Tree Context Type Empty Factual Empty Factual Synthetic Exemplary Exemplary Exemplary Recalling Facts from Pre-training ✓ ✓ ✓ ✓ ✗ Retrieving Facts from Contexts ✗ ✓ ✗ ✓ ✓ - - - - - - Learning Patterns from Contexts - - - - - ✓ ✓ ✓ Considered ICL ✗ ✓ ✗ ✓ ✓ ✓ ✓ ✓ even after pruning 60% of weights, the relative accuracy decrease on ICL tasks is less than 5% (Figure 1, right). ICL shows a similar insensitivity to dense scaling. Implications. Our work reveals the disparate effects of scaling on fact recall and in-context learning (ICL), which notably holds for two substantially different types of scaling: pruning and dense scaling. This motivates several lines of future work: Improve inference efficiency. Our work reveals that scaling down model size alone has little impact on tasks demanding processing information in the LLM's context. Practitioners may thus use our findings to identify scenarios where decisions could be routed to a smaller model instead of a larger one without hurting task performance (Chen et al., 2023; Dohan et al., 2022). Improve LLM systems. Our work shows the utility of feeding external supportive information, like documents from similarity search (Borgeaud et al., 2022; Guu et al., 2020), in question–answering tasks to improve the compute cost and task accuracy trade-off for down-scaled models. Improve LLM Interpretability. We find a remarkably small set of weights responsible for ICL. This underscores the potential of pruning as a tool for isolating neurons responsible for LLM capabilities. Contributions. 1. We curate a set of benchmarks for assessing the disparate effects of down-scaling on core capabilities of LLMs, focusing on fact recall and ICL. 2. Using these benchmarks, we evaluate two scalable weight pruning algorithms for LLMs. We investigate an extensive set of models comprising six base LLMs, with sizes reaching up to 33 billion parameters. We find that: • even moderate levels of pruning (> 30%) hurt fact recall. However, when the evidence required to solve a question-answering task is provided in context, the model's ability to correctly answer questions survives to higher levels of sparsity; • in contrast, in-context learning withstands aggressive pruning (up to 60–70%). 3. Similarly for dense scaling, we find the same disparate patterns as above for fact recall and ICL abilities relative to model size. This underscores that the disparate effects on ICL and fact recall are not exclusive to pruning but are broader characteristics of scaling in general. 2 Related Work LLM scaling. Studies on scaling laws (Hoffmann et al., 2022a; Kaplan et al., 2020b) suggest a predictable relationship between the quality of language models (i.e., perplexity) and the size of the pre-training corpus and model. Pursuant to this, many have scaled up and discovered remarkable capabilities of language models. Brown et al. (2020b) discover that LLMs can perform in-context learning (ICL) effectively: the model learns to perform tasks based on a few examples of input–output demonstrations in the model's context. Other studies (Devlin et al., 2019; Wei et al., 2022; Liang et al., 2022; Srivastava et al., 2022; Gao et al., 2021; Ganguli et al., 2022; Bubeck et al., 2023; Biderman et al., 2023a) benchmark LLMs across many tasks and metrics to assess the utility of scaling. Our work differs in two ways: while prior work (Kaplan et al., 2020b) studies joint scaling of both pre-training corpus size and model size, we focus on scaling model size alone. Furthermore, instead 3 of measuring an arbitrary notion of task performance, we focus on the foundational capabilities of fact recall and ICL. These capabilities underpin the success of many real world applications of LLMs. In-weight versus in-context learning. LLMs utilize information both stored in weights and present in context (Chan et al., 2022a). Recent research illustrates the similarities and differences between these learning approaches: Von Oswald et al. (2022) demonstrated that in-context learning (ICL) can implement an algorithm akin to gradient descent, commonly associated with in-weight learning. Aky ̈urek et al. (2023) revealed that ICL resembles various in-weight learning algorithms, depending on model size. Chan et al. (2022b;a) study how how the properties of the data distribution disparately affect the two abilities in the model. Our work identifies yet another crucial difference: scaling model size has distinct impacts on in-weight learning versus in-context learning abilities. Neural network pruning. Pruning removes unimportant parameters in a model. The origin of pruning traces back to LeCun et al. (1990); Hassibi et al. (1993), with a focus on reducing the computational footprint. More recently, with the advent of deep learning, pruning research has seen a resurgence (Renda et al., 2020; Han et al., 2016; Liu et al., 2017; Frankle et al., 2021; Molchanov et al., 2017; Dong et al., 2017a; Ma et al., 2023; Tao et al., 2023; Kurtic et al., 2023; Dettmers et al., 2023). Though pruning traditionally focuses on preserving aggregate metrics such as accuracy, the versatility of LLMs calls for a different approach to assessing pruned models. Our work begins to fill this gap, proposing to evaluate pruning's effect on fact recall and ICL. Our investigation extends a growing line of studies on effects of pruning beyond aggregate metrics such as accuracy and perplexity. Hooker et al. (2019; 2020) show that pruning may harm under-represented categories of examples; Liebenwein et al. (2021) suggest that the pruned models are less accurate than the dense one when predicting out-of-distribution examples. Jin et al. (2022) demonstrate that pruning mitigates the harmful effects of noisy labels on generalization. Concurrent to our work, Yin et al. (2023); Jaiswal et al. (2023) remarked on the pronounced negative effect of pruning on knowledge-intensive tasks. These works extensively evaluate tasks that require abilities of fact recall and in-context information retrieval. Our work additionally curates a gradation of tasks that further disentangle these abilities - specifically via overriding QA and parameterized ICL tasks, which are not covered in these works. 3 Preliminaries Pruning algorithms. We investigate pruning as one possible technique to (down-)scale LLMs. Few pruning algorithms currently scale to LLMs. We use SparseGPT (Frantar & Alistarh, 2023) in the main text and Wanda (Sun et al., 2023) in Appendix F. Both are one-shot pruning algorithms that scale to LLMs and outperform magnitude pruning (i.e., pruning the smallest magnitude weights), without computationally intensive re-training (Frantar & Alistarh, 2023). SparseGPT/Wanda prune each layer of the language model by minimizing the l2-distance between the outputs of the original dense layer and the pruned layer. SparseGPT/Wanda computes these outputs based on a small training dataset. See Frantar & Alistarh (2023, Sec. 3) for more details. While SparseGPT update the remaining weights after weights removal, Wanda does not. Following standard practice (Frantar & Alistarh, 2023; Frankle & Carbin, 2019), we only prune fully-connected layers. Since attention and feed forward modules consist of mostly fully-connected layers, parameters in fully-connected layers account for > 97.5% parameters for all models we examine. We do not prune embedding layers, language modeling heads and normalization layers. Models. We evaluate 6 models from 3 families: OPT (Zhang et al., 2022), LLaMA (Touvron et al., 2023) and Pythia (Biderman et al., 2023b). We focus on OPT and LLaMA in our main text and present Pythia results in Appendix G. Pythia family models show consistent results as LLaMA and OPT family models. From the OPT family, we evaluate the two largest models that fit in our hardware setup – OPT-13B and OPT-30B, with 13 and 30 billion parameters, respectively. From the LLaMA family, we evaluate LLaMA-13B and LLaMA-33B, with 13 and 33 billion parameters, respectively. A notable difference between OPT and LLaMA families is the ratio of training data to model parameters. Zhang et al. (2022) train the OPT family of models with 180 billion tokens, yielding approximately 14 and 5.5 tokens per parameter, respectively, for our two considered OPT models. Touvron et al. (2023) train the LLaMA-13B model with 1 trillion tokens (77 tokens/parameter) and the LLaMA-33B model with 1.4 trillion tokens (42 tokens/parameter). 4 3.1 Evaluation We evaluate models on two complementary abilities: the ability to call on information seen during pre-training (and then stored in the model's weights) and the ability to call on information presented in-context. Unfortunately, it is difficult to construct tasks that strictly isolate one of these two abilities. On the one hand, for every conceivable natural language task, the model must rely on the semantic representations of language learned from pre-training and stored in the weights. On the other, every conceivable task necessitates processing all of the context to understand the instructions in the first place. To help disentangle the two (overly) broad abilities, we focus on two well-defined instantiations of these abilities: (a) the ability to recall facts from pre-training to answer questions and, complementing that (b) the ability to learn patterns from context. Fact recall. We isolate (a) by evaluating the model on recalling facts from training data not provided in-context. We do this using closed-book QA benchmarks. In-context learning. To evaluate (b), we consider a gradation of tasks that require the increasingly advanced ways of learning from in-context information. Broadly, we consider a series of in-context learning tasks: tasks where the context contains examplars of (query, answer) pairs in some form, followed by a test query that the model has to answer. First, as a simple ICL task, we consider an Open-book QA (Section 4) counterpart of our QA task. Here the context is augmented with supporting evidence that directly helps answer the question. This can be thought of as a simple ICL task where the test query ("who is the author of the novel The Eagle Has Landed?") is simply already present as an in-context examplar within the evidence ("The author of The Eagle Has Landed is..."), along with its ground truth answer (e.g., "...Jack Higgins"). Note that in addition to the aforementioned evidence–question–answer triplet, we further aid the model with an independent one-shot triplet to demonstrate how to format its answer. In the above case, the answer provided in-context may also have been present in pre-training data; thus the model may opt to ignore the context, and recall facts from pre-training, and still succeed at the task. Thus, to more rigorously isolate the two mechanisms, we next evaluate on the Overriding QA task (Section 4), where the in-context evidence contradicts a fact present in training data. We present a one-shot evidence–question–answer triplet, where the answer is based on the contextual evidence rather than on pre-training facts. Thus, to solve the task correctly, it is clear that the model must retrieve from the context rather than recall pre-training facts. Next, we investigate ICL abilities more sophisticated than copying an answer present in an in-context exemplar. To this end, we are interested in tasks where the test query is not already seen as an in-context exemplar. As one such example, consider English–French translation task (Brown et al., 2020b) where the examplars are pairs of English and French sentences, and the test query is a new English sentence. However, such conventional instances of ICL tasks require significant background knowledge of languages and the world, not available in the context. To ensure we disentangle the role of background knowledge from ICL, we consider tasks where the query–answer mapping is given by a parameterized function. Arguably, learning this mapping, would require advanced context-processing mechanisms that go beyond information-retrieval mechanisms required for the Open-book and Overriding QA tasks. Metrics. As a simple point of comparison, we measure the effect of scaling on perplexity. However, our main metric of interest is exact match accuracy (of the answer to each task) because it is a direct measure of the model's ability to satisfactorily perform a task. We present pruning's effects on model perplexity in Appendix B and details of our hardware/software configurations in Appendix J. 4 Effect of Pruning on Question Answering Tasks The ability of LLMs to answer questions underpins many applications of LLMs. Within a question- answering evaluation framework, we examine the effect of pruning on its ability to recall facts learnt during pre-training. We also test a simple form of ICL capability – extracting answers exclusively from the provided context, where answers do not exist in the pre-training corpus. Finally, we interpolate between these two capabilities by providing supporting evidence in context when querying 5 Figure 2: Evaluation for question answering tasks under pruning. Each color represents a different model; each line-style/marker-shape combination represents a different QA dataset. Moderate pruning harms LLMs' ability to recall facts learnt during pre-training: in close-book QA tasks, accepting a 5% drop in average accuracy w.r.t. the dense models, we can prune to 30 and 40% on TriviaQA and WebQA dataset. However, when we present the model with the necessary information to answer the question in its context, the model's ability to answer questions survives to higher sparsity: on open-book QA tasks, accepting the same drop in average accuracy, we can prune to 50% and 60% on TriviaQA(F) and NatQ dataset. On the overriding task (DissentQA dataset), we may even prune to 70% while maintaining the same acceptable relative accuracy drop. information is likely also available in pre-training data. Our results expose that, with contextual information in question-answering tasks, the model's ability to answer questions withstands more aggressive pruning than without contextual information. With no supporting evidence in context, accuracy rapidly drops as sparsity increases. Datasets. We use these datasets: (a) TriviaQA. Joshi et al. (2017) developed the TriviaQA dataset with questions and supporting evidence. We use its Wikipedia validation partition consisting of 7993 questions. (b) WebQuestions. Berant et al. (2013) collected question-answer pairs from the Freebase knowledge database. We use its test set consisting of 2032 questions. (c) NaturalQuestions. Kwiatkowski et al. (2019) compiled the NaturalQuestions dataset from Google search queries. We sampled a 7700-question subset of its validation partition (the same size as the following dataset derived from it), to make our evaluation computationally feasible. (d) DissentQA. Neeman et al. (2022) constructed the DissentQA dataset from the NaturalQuestions dataset. It contains pairs of questions and evidence for a made-up answer that is different from the factual one. It assesses whether the model can override its memory formed during pre-training with new context. We use its validation partition consisting of 7700 questions. Evaluation setup. Using the aforementioned datasets, we evaluate the ability of pruned models on the following task setup: (i) Close-book. We feed the question without any supporting information to the model. We use the Wikipedia partition of the TriviaQA dataset without the supporting evidence and the WebQA dataset for this setup. (ii) Open-book. We feed the question with supporting evidence to the model in its context. It is important to note that this evaluation setup only evaluates whether the answer is right; it is however agnostic to the mechanism by which the answer is retrieved: the model may either generate its answer using the supporting evidence, or by recalling facts from pre-training. To create this dataset, we use a subset of the TriviaQA dataset whose context can fit within the maximum sequence length of the model, consisting of 881 questions. We denote this filtered subset as TriviaQA(F). Additionally, we use the NaturalQuestions dataset for this setup with factual contexts. (iii) Overriding. We present the question accompanied by evidence that deviates from the facts presented during pre-training. Given that the anticipated made-up answers are randomized and different from the factual ones, the model cannot depend on memorization from its pre-training data to generate responses. This evaluation framework rigorously assesses the model's ability to override its pre-training data with new, context-specific information. We use the DisentQA dataset with synthetic contexts for this setup. Examples of the setups are shown in Appendix H. 6 0255075Sparsity (%)0204060Exact Match (%)Linear Classification0255075Sparsity (%)0204060Exact Match (%)2-layer Neural Net0255075Sparsity (%)02040Exact Match (%)Decision TreeOPT-13BOPT-30BLLaMA-13BLLaMA-33B0255075Sparsity (%)0204060Exact Match (%)Close-bookTriviaQAWebQA0255075Sparsity (%)0204060Exact Match (%)Open-bookTriviaQA(F)NatQ0255075Sparsity (%)020406080Exact Match (%)OverridingDissentQA To summarize: across these setups, our prompts have three parts to them: first, (1) an example context–question–answer triplet (or question–answer pair in close-book setting) for demonstration, (2) the supporting evidence for a test question (except in the close-book setup), and (3) a test question to answer. Answers are the model's prompt completions produced by greedy decoding. We report the percentage of answers that exactly match ground truth. Close-book versus open-book results. Left 2 plots of Figure 2 shows close-book and open-book results. Notably, for all the models, the pruned model maintains performance on open-book tasks until much higher sparsity levels compared to close-book tasks. In particular, when we accept a relative decrease of 5% from pruning in the mean accuracy over four models, the highest achievable sparsities for closed-book tasks are 30% on TriviaQA and 40% on WebQA. In contrast, maintaining the same acceptable performance drop, the highest acceptable sparsity levels for open-book tasks are 50% on TriviaQA(F) and 60% on NaturalQuestions. Our results suggest that while pruning hurts the model's ability to recall information from its pre-training data at moderate sparsity (30–40%), one possible remedy is to provide the model with relevant evidence in context. The model's ability to answer questions with relevant evidence in its context remains largely intact to higher sparsity levels (50–60%). Overriding results. The rightmost plot of Figure 2 demonstrates a consistent trend for the overriding tasks. On the DisentQA dataset with overriding context, the highest achievable sparsity is 70% allowing for the same 5% accuracy drop as before. Recall that to solve the overriding task, the model must rely on in-context information rather than in-weights information from the pre-training data. Thus, our observations here further substantiate that the model's ability to extracting information from its context remains largely intact at higher sparsity levels. Accuracy improvements. We note that, surprisingly, on open-book and overriding tasks, there can be small accuracy boosts from pruning. For example, the pruned OPT-30B sees a 9.7% accuracy improvement on DissentQA dataset in overriding task setup. The pruned LLaMa-13B sees 3.5% accuracy improvement on NaturalQuestions in the open-book task setup. Though prior work often reports accuracy improvements with pruning (Frankle & Carbin, 2019; Renda et al., 2020), we are, to the best of our knowledge, the first to observe such improvement in the QA setup. Takeaways. Our findings suggest that scaling via pruning has a much higher impact on the ability to retrieve facts from pre-training than on the ability to retrieve information from the context. Pruning may even improve model's ability to answer questions when its context includes the necessary information to answer the question. 5 More Sophisticated In-context Learning Section 4 demonstrates that moderate pruning preserves question answering task accuracy when relevant information is available in context. In this section, we show that even with more sophisticated ICL tasks than previously studied, moderately pruned models maintain their ICL abilities. Typical complex ICL tasks require extensive knowledge about language and the world gathered from pre-training. However, as Section 4 shows, pruning likely impairs such knowledge. So, to isolate LLMs' ICL ability from factual recall abilities, we choose a set of tasks where the goal is to learn a parameterized function (e.g., a linear model) through input-output examples present in-context. Method. We evaluate LLMs in their ability to learn multiclass classifiers of the form f : RD → {0, 1, * * * K − 1} from in-context examples. To generate a sequence consisting of a context, query and an answer, we first pick a random parameterized function f from one of three function classes: 2-way linear classifiers, 2-way neural network classifiers with 2 layers and 4-way decision tree classifiers (Appendix C contains details for constructing f ). Then, in the context, we provide N exemplars of the form (x, f (x)), followed by a novel query xquery. The goal of the model is to correctly predict the answer as f (xquery). Please refer to Appendix H for an example of the full prompt. All task instances consist of N total in-context examples split evenly across all possible labels. We draw all random numbers uniformly from integers between -10 and 10 inclusive. We set D=4, N=32. We record additional methodological details in Appendix D. 7 Figure 3: ICL withstands aggresive pruning (60-70% spasity). Accepting a relative average (over 4 models) accuracy drop of 5% w.r.t. the dense models, we can prune to 60%, 60% and 70% on linear classification, 2-layer NN, decision tree tasks, respectively. Pruning results. Figure 3 shows the accuracy of pruned models versus sparsity. We can remove a substantial number of parameters from the models without affecting their ICL ability. Specifically, the average accuracy of the pruned models on linear, 2-layer NN, decision tree classification tasks is within 5% of the dense models up to 60%, 60% and 70% sparsity, respectively. Task difficulty. One trivial explanation for our observation is that perhaps these tasks are so easy that they are solvable even by a severely pruned model. To eliminate this hypothesis, in Appendix E, we increase the input dimension (D) of the linear classification task. Even as we increase this to a significant extent (say, to an extent that the task is almost, but not totally, unlearnable), we find that the ICL performance is maintained under aggressive pruning. Conclusion. Our results suggest that when pruning LLMs moderately (i.e., to < 70% sparsity), the model's ICL ability stays largely intact. Thus, unlike fact recall tasks, one can prune models significantly more while maintaining ICL performance. 6 Dense Scaling In the context of vision models, it is known that pruned models behave similarly to smaller dense models trained with similar hyperparameters (Jin et al., 2022). Here, we examine the effects of dense scaling (i.e., choosing from a suite of independently trained models of various sizes) on fact recall vs. ICL abilities of LLMs. Method. With the same benchmarks as in Sections 4 and 5, we evaluate the accuracy of dense models with different parameter count, but the same pre-training data size. The OPT family of models provides an ideal collection of dense models for our evaluation: Zhang et al. (2022) trained all OPT models with the same number of tokens (300b). Figure 4: Like pruning, moderate dense down-scaling preserves ICL while harming fact recall. 8 0255075Sparsity (%)0204060Exact Match (%)Linear Classification0255075Sparsity (%)0204060Exact Match (%)2-layer Neural Net0255075Sparsity (%)02040Exact Match (%)Decision TreeOPT-13BOPT-30BLLaMA-13BLLaMA-33B0102030Param Count (B)0204060Exact Match (%)Linear Classification0102030Param Count (B)0204060Exact Match (%)2-layer Neural Net0102030Param Count (B)010203040Exact Match (%)Decision TreePruned OPT-30BPruned OPT-13BDense0102030Param Count (B)010203040Exact Match (%)Close-bookTriviaQAWebQA0102030Param Count (B)02040Exact Match (%)Open-book & CounterfactualTriviaQA(F)NatQDisentQA0102030Param Count (B)203040506070Exact Match (%)ICLlinearnndt Results. Figure 4 shows that fact recall ability is highly sensitive to dense scaling – e.g., focusing on scaling downwards, moving from the 30B model to the next largest 13B model leads to more than 5% relative task accuracy degradation on close-book TriviaQA and WebQA task. However, open-book/overriding QA accuracy is much less sensitive to dense scaling. Specifically, maintaining the same 5% acceptable relative accuracy degradation with respect to the 30B models, one may replace a 30B model on TriviaQA(F) and NaturalQuestions dataset with a 6.7B model. Figure 4 also shows that ICL ability is similarly robust to dense scaling. Conclusion. Like pruning, changing a dense model's size more readily affects its ability to retrieve facts from pre-training than to process information from context. We hypothesize that this effect stems from scaling in general – be it pruning or using a dense model of different size. 7 Pruning Attention and Feed Forward Layers A growing line of work (Dai et al., 2021; Meng et al., 2022) suggests that feed forward (FFW) layers and the attention layers are responsibly for distinct capabilities considered in this paper - namely, fact recall and in-context learning. To test this, we exclusively prune either type of layers and examine how the model's abilities deteriorate on fact recall and ICL tasks. Method. We prune a LLaMA-13B model. We either exclusively prune attention layers or ex- clusively prune FFW layers and observe their effects on accuracy of TriviaQA task (fact recall) and linear classification task (ICL). We plotted the task accuracy as a function of module spar- sity. Module sparsity refers to the fraction of parameters pruned from a specific type of layers (either attention or FFW), with respect to the total number of parameters of that type. Results. Figure 5 shows that while attention and FFW layers appear equally important for ICL, FFW layers appear more important for fact recall. For example, pruning 60% FFW layers lead to 14% more accuracy degradation than pruning 60% of attention layers. Conclusion. Attention and FFW layers show similar importance for ICL; and FFW layers show greater importance for knowledge recall. 8 Closing Discussion (a) Linear Classification (b) TriviaQA Close-book Figure 5: Effects of pruning only attention layers versus pruning only FFW layers on fact recall (Triv- iaQA) versus ICL (Linear Classification). Module sparsity computes the fraction of parameters of the specified module ( attention or FFW) that pruning removes. Attention and FFW layers appear equally important for ICL. FFW layers appear more impor- tant than attention layers for fact recall. We study the effects of scaling model size via pruning and dense scaling on two core abilities of LLMs that underpin their practical success: the ability to recall facts and the ability to perform ICL. In both cases, we find similar disparate effects on the two abilities. Moderate pruning (> 30% sparsity) harms fact recall, and yet the ability to learn from a few input-output examples from context withstands aggressive pruning (up to 60–70% sparsity). The same disparity arises when changing the width and depth of dense (independently-trained) models. What could explain this disparity? We conjecture that the number of parameters required to store a set of facts must scale in proportion to the number of independent facts. On the other hand, in-context learning of many kinds may be accomplished by a smaller set of parameters that act as a universal gradient descent module (von Oswald et al., 2022) that can be applied for any task. Verifying these hypotheses theoretically is an important direction for future work. Our findings also invite various research directions for practice: Pruning & interpretability. Our findings suggest, remarkably, a relatively small fraction of weights are responsible for ICL performance. This observation could prove to be valuable for enhancing 9 20406080Module Sparsity (%)57.560.062.565.067.570.0Exact Match (%)LLaMa-13B/Linear ICLAttentionFFW20406080Module Sparsity (%)01020304050Exact Match (%)LLaMa-13B/TriviaQAAttentionFFW the interpretability of LLMs, reviving a decades-old motivation behind work in pruning (Mozer & Smolensky, 1988).3 In particular, pruning may help better localize the weights responsible for in-context ability, and complement recent approaches (Wang et al., 2023; Bills et al., 2023). Memory augmentation. Our observations advocate for memory augmentation as a promising way to improve the trade-off between computational cost and task accuracy. Memory augmentation techniques present helpful facts to the model by augmenting them directly in the context. Thus, rather than having the LLM to rely on fact recall from pre-training - an ability that is degraded under downscaling - we can delegate fact-retrieval to a separate retrieval model (Borgeaud et al., 2022; Guu et al., 2020), and allow the LLM to focus on retrieving the fact from the context-which is an ability that is preserved under down-scaling. Limitations. We address the limitations of our work in Appendix A. References Ekin Aky ̈urek, Dale Schuurmans, Jacob Andreas, Tengyu Ma, and Denny Zhou. What learning algorithm is in-context learning? investigations with linear models. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum? id=0g0X4H8yN4I. Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. Semantic parsing on Freebase from question-answer pairs. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pp. 1533–1544, Seattle, Washington, USA, October 2013. Association for Computational Linguistics. URL https://aclanthology.org/D13-1160. Stella Biderman, USVSN Sai Prashanth, Lintang Sutawika, Hailey Schoelkopf, Quentin Anthony, Shivanshu Purohit, and Edward Raff. Emergent and predictable memorization in large language models, 2023a. Stella Biderman, Hailey Schoelkopf, Quentin Anthony, Herbie Bradley, Kyle O'Brien, Eric Hallahan, Mohammad Aflah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, Aviya Skowron, Lintang Sutawika, and Oskar van der Wal. Pythia: A suite for analyzing large language models across training and scaling, 2023b. Steven Bills, Nick Cammarata, Dan Mossing, Henk Tillman, Leo Gao, Gabriel Goh, Ilya Sutskever, Jan Leike, Jeff Wu, and William Saunders. Language models can explain neurons in language mod- https://openaipublic.blob.core.windows.net/neuron-explainer/ els. paper/index.html, 2023. Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Mil- lican, George Bm Van Den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, Diego De Las Casas, Aurelia Guy, Jacob Menick, Roman Ring, Tom Hennigan, Saffron Huang, Loren Maggiore, Chris Jones, Albin Cassirer, Andy Brock, Michela Paganini, Ge- offrey Irving, Oriol Vinyals, Simon Osindero, Karen Simonyan, Jack Rae, Erich Elsen, and Laurent Sifre. In Kama- lika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato (eds.), Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pp. 2206–2240. PMLR, 2022. URL https: //proceedings.mlr.press/v162/borgeaud22a.html. Improving language models by retrieving from trillions of tokens. Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, In H. Larochelle, M. Ranzato, and Dario Amodei. Language models are few-shot learners. R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 1877–1901, 2020a. 3"This skeletonization technique can be used ... to understand the behavior of networks in terms of minimal 'rules.'" (Mozer & Smolensky, 1988) 10 Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners, 2020b. S ́ebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, Harsha Nori, Hamid Palangi, Marco Tulio Ribeiro, and Yi Zhang. Sparks of artificial general intelligence: Early experiments with gpt-4, 2023. Stephanie C. Y. Chan, Ishita Dasgupta, Junkyung Kim, Dharshan Kumaran, Andrew K. Lampinen, and Felix Hill. Transformers generalize differently from information stored in context vs in weights. 2022a. doi: 10.48550/arXiv.2210.05675. URL https://doi.org/10.48550/ arXiv.2210.05675. Stephanie C. Y. Chan, Adam Santoro, Andrew K. Lampinen, Jane X. Wang, Aaditya Singh, Pierre H. Richemond, Jay McClelland, and Felix Hill. Data distributional properties drive emergent in- context learning in transformers, 2022b. Lingjiao Chen, Matei Zaharia, and James Zou. Frugalgpt: How to use large language models while reducing cost and improving performance, 2023. Damai Dai, Li Dong, Y. Hao, Zhifang Sui, and Furu Wei. Knowledge neurons in pretrained transformers. ArXiv, abs/2104.08696, 2021. Tim Dettmers, Ruslan Svirschevski, Vage Egiazarian, Denis Kuznedelev, Elias Frantar, Saleh Ashk- boos, Alexander Borzunov, Torsten Hoefler, and Dan Alistarh. Spqr: A sparse-quantized represen- tation for near-lossless llm weight compression, 2023. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https: //aclanthology.org/N19-1423. David Dohan, Winnie Xu, Aitor Lewkowycz, Jacob Austin, David Bieber, Raphael Gontijo Lopes, Yuhuai Wu, Henryk Michalewski, Rif A. Saurous, Jascha Sohl-dickstein, Kevin Murphy, and Charles Sutton. Language model cascades, 2022. Xin Dong, Shangyu Chen, and Sinno Pan. Learning to prune deep neural networks via layer-wise optimal brain surgeon. In Advances in Neural Information Processing Systems, 2017a. Xin Dong, Shangyu Chen, and Sinno Pan. Learning to prune deep neural networks via layer-wise optimal brain surgeon. Advances in Neural Information Processing Systems, 30, 2017b. Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id=rJl-b3RcF7. Jonathan Frankle, Gintare Karolina Dziugaite, Daniel Roy, and Michael Carbin. Pruning neural networks at initialization: Why are we missing the mark? In International Conference on Learning Representations, 2021. Elias Frantar and Dan Alistarh. Sparsegpt: Massive language models can be accurately pruned in one-shot, 2023. Elias Frantar, Saleh Ashkboos, Torsten Hoefler, and Dan Alistarh. Gptq: Accurate post-training quantization for generative pre-trained transformers, 2023. 11 Deep Ganguli, Danny Hernandez, Liane Lovitt, Amanda Askell, Yuntao Bai, Anna Chen, Tom Conerly, Nova Dassarma, Dawn Drain, Nelson Elhage, Sheer El Showk, Stanislav Fort, Zac Hatfield-Dodds, Tom Henighan, Scott Johnston, Andy Jones, Nicholas Joseph, Jackson Kernian, Shauna Kravec, Ben Mann, Neel Nanda, Kamal Ndousse, Catherine Olsson, Daniela Amodei, Tom Brown, Jared Kaplan, Sam McCandlish, Christopher Olah, Dario Amodei, and Jack Clark. Predictability and surprise in large generative models. In Proceedings of the 2022 ACM Conference on Fairness, Accountability, and Transparency, FAccT '22, pp. 1747–1764, New York, NY, USA, 2022. Association for Computing Machinery. ISBN 9781450393522. doi: 10.1145/3531146. 3533229. URL https://doi.org/10.1145/3531146.3533229. Leo Gao, Jonathan Tow, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Gold- ing, Jeffrey Hsu, Kyle McDonell, Niklas Muennighoff, Jason Phang, Laria Reynolds, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, September 2021. URL https://doi.org/10.5281/zenodo.5371628. Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrieval- augmented language model pre-training. In Proc. International Conference on Machine Learning, 2020. Song Han, Huizi Mao, and William J. Dally. Deep compression: Compressing deep neural network with pruning, trained quantization and huffman coding. In International Conference on Learning Representations, 2016. B. Hassibi, D.G. Stork, and G.J. Wolff. Optimal brain surgeon and general network pruning. In IEEE International Conference on Neural Networks, 1993. Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Ruther- ford, Diego de las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, Tom Hennigan, Eric Noland, Katherine Millican, George van den Driessche, Bogdan Damoc, Aurelia Guy, Simon Osindero, Karen Simonyan, Erich Elsen, Oriol Vinyals, Jack William Rae, and Laurent Sifre. An empirical analysis of compute-optimal large language model training. In Alice H. Oh, Alekh Agar- wal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022a. URL https://openreview.net/forum?id=iBBcRUlOAPR. Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, Tom Hennigan, Eric Noland, Katie Millican, George van den Driessche, Bogdan Damoc, Aurelia Guy, Simon Osindero, Karen Simonyan, Erich Elsen, Jack W. Rae, Oriol Vinyals, and Laurent Sifre. Training compute-optimal large language models, 2022b. Sara Hooker, Aaron C. Courville, Yann N. Dauphin, and Andrea Frome. What do compressed deep neural networks forget?, 2019. Sara Hooker, Nyalleng Moorosi, Gregory Clark, Samy Bengio, and Emily Denton. Characterising bias in compressed models, 2020. Ajay Jaiswal, Zhe Gan, Xianzhi Du, Bowen Zhang, Zhangyang Wang, and Yinfei Yang. Compressing llms: The truth is rarely pure and never simple, 2023. Ting Jiang, Deqing Wang, and Fuzhen Zhuang. Pruning pre-trained language models without fine-tuning, 2022. Tian Jin, Michael Carbin, Dan Roy, Jonathan Frankle, and Gintare Karolina Dziugaite. Prun- In S. Koyejo, ing's effect on generalization through the lens of training and regularization. S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh (eds.), Advances in Neu- ral Information Processing Systems, volume 35, pp. 37947–37961. Curran Associates, Inc., URL https://proceedings.neurips.cc/paper_files/paper/2022/ 2022. file/f7ede9414083fceab9e63d9100a80b36-Paper-Conference.pdf. Mandar Joshi, Eunsol Choi, Daniel S. Weld, and Luke Zettlemoyer. Triviaqa: A large scale distantly In Proceedings of the 55th Annual supervised challenge dataset for reading comprehension. Meeting of the Association for Computational Linguistics, Vancouver, Canada, 2017. Association for Computational Linguistics. 12 Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. CoRR, abs/2001.08361, 2020a. URL https://arxiv.org/abs/2001.08361. Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models, 2020b. Eldar Kurtic, Elias Frantar, and Dan Alistarh. Ziplm: Hardware-aware structured pruning of language models, 2023. Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Matthew Kelcey, Jacob Devlin, Kenton Lee, Kristina N. Toutanova, Llion Jones, Ming-Wei Chang, Andrew Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. Natural questions: a benchmark for question answering research. Transactions of the Association of Computational Linguistics, 2019. Yann LeCun, John Denker, and Sara Solla. Optimal brain damage. In Conference on Neural Information Processing Systems, 1990. Daliang Li, Ankit Singh Rawat, Manzil Zaheer, Xin Wang, Michal Lukasik, Andreas Veit, Felix X. Yu, and Sanjiv Kumar. Large language models with controllable working memory. CoRR, 2022. doi: 10.48550/arXiv.2211.05110. Percy Liang, Rishi Bommasani, Tony Lee, Dimitris Tsipras, Dilara Soylu, Michihiro Yasunaga, Yian Zhang, Deepak Narayanan, Yuhuai Wu, Ananya Kumar, Benjamin Newman, Binhang Yuan, Bobby Yan, Ce Zhang, Christian Cosgrove, Christopher D. Manning, Christopher R ́e, Diana Acosta-Navas, Drew A. Hudson, Eric Zelikman, Esin Durmus, Faisal Ladhak, Frieda Rong, Hongyu Ren, Huaxiu Yao, Jue Wang, Keshav Santhanam, Laurel Orr, Lucia Zheng, Mert Yuksekgonul, Mirac Suzgun, Nathan Kim, Neel Guha, Niladri Chatterji, Omar Khattab, Peter Henderson, Qian Huang, Ryan Chi, Sang Michael Xie, Shibani Santurkar, Surya Ganguli, Tatsunori Hashimoto, Thomas Icard, Tianyi Zhang, Vishrav Chaudhary, William Wang, Xuechen Li, Yifan Mai, Yuhui Zhang, and Yuta Koreeda. Holistic evaluation of language models, 2022. Lucas Liebenwein, Cenk Baykal, Brandon Carter, David Gifford, and Daniela Rus. Lost in pruning: The effects of pruning neural networks beyond test accuracy. In Conference on Machine Learning and Systems, 2021. Tiedong Liu and Bryan Kian Hsiang Low. Goat: Fine-tuned llama outperforms gpt-4 on arithmetic tasks, 2023. Zhuang Liu, Jianguo Li, Zhiqiang Shen, Gao Huang, Shoumeng Yan, and Changshui Zhang. Learn- ing efficient convolutional networks through network slimming. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2017. Shayne Longpre, Kartik Perisetla, Anthony Chen, Nikhil Ramesh, Chris DuBois, and Sameer Singh. Entity-based knowledge conflicts in question answering. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, EMNLP 2021, Virtual Event / Punta Cana, Dominican Republic, 7-11 November, 2021, pp. 7052–7063. Association for Computational Linguistics, 2021. Xinyin Ma, Gongfan Fang, and Xinchao Wang. Llm-pruner: On the structural pruning of large language models, 2023. Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov. Locating and editing factual associations in gpt. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh (eds.), Advances in Neural Information Processing Systems, volume 35, pp. 17359–17372. Curran Asso- ciates, Inc., 2022. URL https://proceedings.neurips.cc/paper_files/paper/ 2022/file/6f1d43d5a82a37e89b0665b33bf3a182-Paper-Conference.pdf. Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila, and Jan Kautz. Pruning convolutional neural networks for resource efficient inference. In International Conference on Learning Repre- sentations, 2017. 13 Michael C Mozer and Paul Smolensky. A technique for trim- In D. Touretzky (ed.), Information Processing Systems, volume 1. Morgan-Kaufmann, URL https://proceedings.neurips.cc/paper_files/paper/1988/ ming the fat Advances 1988. file/07e1cd7dca89a1678042477183b7ac3f-Paper.pdf. from a network via relevance assessment. Skeletonization: in Neural Ella Neeman, Roee Aharoni, Or Honovich, Leshem Choshen, Idan Szpektor, and Omri Abend. Disen- tqa: Disentangling parametric and contextual knowledge with counterfactual question answering, 2022. Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high- performance deep learning library. In Advances in Neural Information Processing Systems 32, pp. 8024–8035. Curran Associates, Inc., 2019. URL http://papers.neurips.cc/paper/ 9015-pytorch-an-imperative-style-high-performance-deep-learning-library. pdf. Alex Renda, Jonathan Frankle, and Michael Carbin. Comparing rewinding and fine-tuning in neural network pruning. In International Conference on Learning Representations, 2020. Michael Santacroce, Zixin Wen, Yelong Shen, and Yuanzhi Li. What matters in the structured pruning of generative language models?, 2023. Aarohi Srivastava, Abhinav Rastogi, Abhishek Rao, Abu Awal Md Shoeb, Abubakar Abid, Adam Fisch, Adam R. Brown, Adam Santoro, Aditya Gupta, Adri`a Garriga-Alonso, Agnieszka Kluska, Aitor Lewkowycz, Akshat Agarwal, Alethea Power, Alex Ray, Alex Warstadt, Alexander W. Kocurek, Ali Safaya, Ali Tazarv, Alice Xiang, Alicia Parrish, Allen Nie, Aman Hussain, Amanda Askell, Amanda Dsouza, Ambrose Slone, Ameet Rahane, Anantharaman S. Iyer, Anders An- dreassen, Andrea Madotto, Andrea Santilli, Andreas Stuhlm ̈uller, Andrew Dai, Andrew La, Andrew Lampinen, Andy Zou, Angela Jiang, Angelica Chen, Anh Vuong, Animesh Gupta, Anna Gottardi, Antonio Norelli, Anu Venkatesh, Arash Gholamidavoodi, Arfa Tabassum, Arul Menezes, Arun Kirubarajan, Asher Mullokandov, Ashish Sabharwal, Austin Herrick, Avia Efrat, Aykut Erdem, Ayla Karakas ̧, B. Ryan Roberts, Bao Sheng Loe, Barret Zoph, Bartłomiej Bojanowski, Batuhan ̈Ozyurt, Behnam Hedayatnia, Behnam Neyshabur, Benjamin Inden, Benno Stein, Berk Ekmekci, Bill Yuchen Lin, Blake Howald, Cameron Diao, Cameron Dour, Catherine Stinson, Cedrick Argueta, C ́esar Ferri Ram ́ırez, Chandan Singh, Charles Rathkopf, Chenlin Meng, Chitta Baral, Chiyu Wu, Chris Callison-Burch, Chris Waites, Christian Voigt, Christopher D. Manning, Christopher Potts, Cindy Ramirez, Clara E. Rivera, Clemencia Siro, Colin Raffel, Courtney Ashcraft, Cristina Garbacea, Damien Sileo, Dan Garrette, Dan Hendrycks, Dan Kilman, Dan Roth, Daniel Freeman, Daniel Khashabi, Daniel Levy, Daniel Mosegu ́ı Gonz ́alez, Danielle Perszyk, Danny Hernandez, Danqi Chen, Daphne Ippolito, Dar Gilboa, David Dohan, David Drakard, David Jurgens, Debajyoti Datta, Deep Ganguli, Denis Emelin, Denis Kleyko, Deniz Yuret, Derek Chen, Derek Tam, Dieuwke Hupkes, Diganta Misra, Dilyar Buzan, Dimitri Coelho Mollo, Diyi Yang, Dong-Ho Lee, Ekaterina Shutova, Ekin Dogus Cubuk, Elad Segal, Eleanor Hagerman, Elizabeth Barnes, Elizabeth Donoway, Ellie Pavlick, Emanuele Rodola, Emma Lam, Eric Chu, Eric Tang, Erkut Erdem, Ernie Chang, Ethan A. Chi, Ethan Dyer, Ethan Jerzak, Ethan Kim, Eunice En- gefu Manyasi, Evgenii Zheltonozhskii, Fanyue Xia, Fatemeh Siar, Fernando Mart ́ınez-Plumed, Francesca Happ ́e, Francois Chollet, Frieda Rong, Gaurav Mishra, Genta Indra Winata, Gerard de Melo, Germ ́an Kruszewski, Giambattista Parascandolo, Giorgio Mariani, Gloria Wang, Gonzalo Jaimovitch-L ́opez, Gregor Betz, Guy Gur-Ari, Hana Galijasevic, Hannah Kim, Hannah Rashkin, Hannaneh Hajishirzi, Harsh Mehta, Hayden Bogar, Henry Shevlin, Hinrich Sch ̈utze, Hiromu Yakura, Hongming Zhang, Hugh Mee Wong, Ian Ng, Isaac Noble, Jaap Jumelet, Jack Geissinger, Jackson Kernion, Jacob Hilton, Jaehoon Lee, Jaime Fern ́andez Fisac, James B. Simon, James Koppel, James Zheng, James Zou, Jan Koco ́n, Jana Thompson, Jared Kaplan, Jarema Radom, Jascha Sohl-Dickstein, Jason Phang, Jason Wei, Jason Yosinski, Jekaterina Novikova, Jelle Boss- cher, Jennifer Marsh, Jeremy Kim, Jeroen Taal, Jesse Engel, Jesujoba Alabi, Jiacheng Xu, Jiaming Song, Jillian Tang, Joan Waweru, John Burden, John Miller, John U. Balis, Jonathan Berant, J ̈org Frohberg, Jos Rozen, Jose Hernandez-Orallo, Joseph Boudeman, Joseph Jones, Joshua B. 14 Tenenbaum, Joshua S. Rule, Joyce Chua, Kamil Kanclerz, Karen Livescu, Karl Krauth, Karthik Gopalakrishnan, Katerina Ignatyeva, Katja Markert, Kaustubh D. Dhole, Kevin Gimpel, Kevin Omondi, Kory Mathewson, Kristen Chiafullo, Ksenia Shkaruta, Kumar Shridhar, Kyle McDonell, Kyle Richardson, Laria Reynolds, Leo Gao, Li Zhang, Liam Dugan, Lianhui Qin, Lidia Contreras- Ochando, Louis-Philippe Morency, Luca Moschella, Lucas Lam, Lucy Noble, Ludwig Schmidt, Luheng He, Luis Oliveros Col ́on, Luke Metz, L ̈utfi Kerem S ̧ enel, Maarten Bosma, Maarten Sap, Maartje ter Hoeve, Maheen Farooqi, Manaal Faruqui, Mantas Mazeika, Marco Baturan, Marco Marelli, Marco Maru, Maria Jose Ram ́ırez Quintana, Marie Tolkiehn, Mario Giulianelli, Martha Lewis, Martin Potthast, Matthew L. Leavitt, Matthias Hagen, M ́aty ́as Schubert, Medina Orduna Baitemirova, Melody Arnaud, Melvin McElrath, Michael A. Yee, Michael Cohen, Michael Gu, Michael Ivanitskiy, Michael Starritt, Michael Strube, Michał Swedrowski, Michele Bevilacqua, Michihiro Yasunaga, Mihir Kale, Mike Cain, Mimee Xu, Mirac Suzgun, Mo Tiwari, Mohit Bansal, Moin Aminnaseri, Mor Geva, Mozhdeh Gheini, Mukund Varma T, Nanyun Peng, Nathan Chi, Nayeon Lee, Neta Gur-Ari Krakover, Nicholas Cameron, Nicholas Roberts, Nick Doiron, Nikita Nangia, Niklas Deckers, Niklas Muennighoff, Nitish Shirish Keskar, Niveditha S. Iyer, Noah Constant, Noah Fiedel, Nuan Wen, Oliver Zhang, Omar Agha, Omar Elbaghdadi, Omer Levy, Owain Evans, Pablo Antonio Moreno Casares, Parth Doshi, Pascale Fung, Paul Pu Liang, Paul Vicol, Pegah Alipoormolabashi, Peiyuan Liao, Percy Liang, Peter Chang, Peter Eckersley, Phu Mon Htut, Pinyu Hwang, Piotr Miłkowski, Piyush Patil, Pouya Pezeshkpour, Priti Oli, Qiaozhu Mei, Qing Lyu, Qinlang Chen, Rabin Banjade, Rachel Etta Rudolph, Raefer Gabriel, Rahel Habacker, Ram ́on Risco Delgado, Rapha ̈el Milli`ere, Rhythm Garg, Richard Barnes, Rif A. Saurous, Riku Arakawa, Robbe Raymaekers, Robert Frank, Rohan Sikand, Roman Novak, Roman Sitelew, Ronan LeBras, Rosanne Liu, Rowan Jacobs, Rui Zhang, Ruslan Salakhutdinov, Ryan Chi, Ryan Lee, Ryan Stovall, Ryan Teehan, Rylan Yang, Sahib Singh, Saif M. Mohammad, Sajant Anand, Sam Dillavou, Sam Shleifer, Sam Wiseman, Samuel Gruetter, Samuel R. Bowman, Samuel S. Schoen- holz, Sanghyun Han, Sanjeev Kwatra, Sarah A. Rous, Sarik Ghazarian, Sayan Ghosh, Sean Casey, Sebastian Bischoff, Sebastian Gehrmann, Sebastian Schuster, Sepideh Sadeghi, Shadi Hamdan, Sharon Zhou, Shashank Srivastava, Sherry Shi, Shikhar Singh, Shima Asaadi, Shixiang Shane Gu, Shubh Pachchigar, Shubham Toshniwal, Shyam Upadhyay, Shyamolima, Debnath, Siamak Shakeri, Simon Thormeyer, Simone Melzi, Siva Reddy, Sneha Priscilla Makini, Soo-Hwan Lee, Spencer Torene, Sriharsha Hatwar, Stanislas Dehaene, Stefan Divic, Stefano Ermon, Stella Bider- man, Stephanie Lin, Stephen Prasad, Steven T. Piantadosi, Stuart M. Shieber, Summer Misherghi, Svetlana Kiritchenko, Swaroop Mishra, Tal Linzen, Tal Schuster, Tao Li, Tao Yu, Tariq Ali, Tatsu Hashimoto, Te-Lin Wu, Th ́eo Desbordes, Theodore Rothschild, Thomas Phan, Tianle Wang, Tiberius Nkinyili, Timo Schick, Timofei Kornev, Timothy Telleen-Lawton, Titus Tunduny, Tobias Gerstenberg, Trenton Chang, Trishala Neeraj, Tushar Khot, Tyler Shultz, Uri Shaham, Vedant Misra, Vera Demberg, Victoria Nyamai, Vikas Raunak, Vinay Ramasesh, Vinay Uday Prabhu, Vishakh Padmakumar, Vivek Srikumar, William Fedus, William Saunders, William Zhang, Wout Vossen, Xiang Ren, Xiaoyu Tong, Xinran Zhao, Xinyi Wu, Xudong Shen, Yadollah Yaghoobzadeh, Yair Lakretz, Yangqiu Song, Yasaman Bahri, Yejin Choi, Yichi Yang, Yiding Hao, Yifu Chen, Yonatan Belinkov, Yu Hou, Yufang Hou, Yuntao Bai, Zachary Seid, Zhuoye Zhao, Zijian Wang, Zijie J. Wang, Zirui Wang, and Ziyi Wu. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models, 2022. Mingjie Sun, Zhuang Liu, Anna Bair, and J. Zico Kolter. A simple and effective pruning approach for large language models, 2023. Chaofan Tao, Lu Hou, Haoli Bai, Jiansheng Wei, Xin Jiang, Qun Liu, Ping Luo, and Ngai Wong. In Findings of the Structured pruning for efficient generative pre-trained language models. Association for Computational Linguistics: ACL 2023, pp. 10880–10895, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.findings-acl.692. URL https://aclanthology.org/2023.findings-acl.692. Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timoth ́ee Lacroix, Baptiste Rozi`ere, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models, 2023. Johannes von Oswald, Eyvind Niklasson, Ettore Randazzo, Jo ̃ao Sacramento, Alexander Mordvintsev, Andrey Zhmoginov, and Max Vladymyrov. Transformers learn in-context by gradient descent, 2022. 15 Kevin Ro Wang, Alexandre Variengien, Arthur Conmy, Buck Shlegeris, and Jacob Steinhardt. Interpretability in the wild: a circuit for indirect object identification in GPT-2 small. In The Eleventh International Conference on Learning Representations, 2023. URL https: //openreview.net/forum?id=NpsVSN6o4ul. Jason Wei, Yi Tay, Rishi Bommasani, Colin Raffel, Barret Zoph, Sebastian Borgeaud, Dani Yogatama, Maarten Bosma, Denny Zhou, Donald Metzler, Ed H. Chi, Tatsunori Hashimoto, Oriol Vinyals, Percy Liang, Jeff Dean, and William Fedus. Emergent abilities of large lan- guage models. Transactions on Machine Learning Research, 2022. ISSN 2835-8856. URL https://openreview.net/forum?id=yzkSU5zdwD. Survey Certification. Lu Yin, Shiwei Liu, Ajay Jaiswal, Souvik Kundu, and Zhangyang Wang. Junk dna hypothesis: A task-centric angle of llm pre-trained weights through sparsity, 2023. Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, Todor Mihaylov, Myle Ott, Sam Shleifer, Kurt Shuster, Daniel Simig, Punit Singh Koura, Anjali Sridhar, Tianlu Wang, and Luke Zettlemoyer. Opt: Open pre-trained transformer language models, 2022. 16 Name/Sparsity 0.0 OPT-13B OPT-30B LLaMa-13B LLaMa-33B 11.5 10.9 6.6 5.9 10.0 11.5 10.9 6.6 6.0 20.0 11.6 10.9 6.7 6.0 30.0 11.6 11.0 6.8 6.1 40.0 11.9 11.1 7.1 6.4 50.0 12.4 11.4 7.8 7.0 60.0 13.7 12.2 10.0 8.5 70.0 17.8 14.6 20.0 13.7 80.0 45.3 35.4 59.9 36.1 90.0 40362.3 4187.5 822.1 355.9 Table 2: Pruning's effect on perplexity. Figure 6: Pruning's effect on model perplexity. A Limitation. Overall, our study provides a valuable first step towards evaluating pruning algorithms for LLMs, as well as identifying limitations of a particular type of pruning approaches. We have validated our claims on a large number of benchmarks (a total of 8 tasks and 6 models). Since our work is empirical in nature, our observations may not generalize to the full spectrum of tasks and large language models (LLMs). In this study, we focused on evaluating pruning algorithms that scale to large-scale LLMs. This was a deliberate decision, as we believe that scalability is essential for any pruning algorithm to be widely adopted in the real world. More sophisticated one-shot/iterative pruning algorithms exist (Renda et al., 2020). They typically require re-training – redoing the training of these foundation models for every sparsity level we examine. The cost of such an experiment is at least in the millions of dollars therefore beyond our means. B Pruning Perplexity Eval In Table 2 we present the full range of pruning's effect on the perplexity of models we consider in this work. We obtain perplexity results by running the pruned model on a randomly sampled subset of C4 validation set, following the precedent of Frantar et al. (2023). C Constructing Parameterized Functions in ICL Evaluation While it may be unreasonable to expect the model to infer any arbitrary f , we focus on three natural classes of functions from which we pick f : the class of linear, 2-layered neural network, and decision tree models. These classes are defined as follows: (a) Linear. For each task instance, we generate a distinct random hyperplane in the D-dimensional input space as the decision boundary. We label each example as positive/negative depending on the side of the decision boundary it falls on. (b) 2-layer NN. For each task instance, we generate a 2-layer neural network mapping a D-dimensional input vector x to a binary label y with the following form: W2σ(W1x), where W1, W2 are D × D, D × 2 matrices correspondingly. We draw elements within these two matrices from independent, Gaussian distributions with zero-mean and unit variance. We use ReLU as the activation function σ. (c) Decision tree. For each task instance, we construct a full depth-2 binary decision tree, with each of its four leaf nodes representing one possible label. This maps D-dimensional input vectors to the said labels. We assign each non-leaf node an index from 0 to D − 1. We evaluate the tree by traversing from the root, comparing the input vector's value at each node's associated index to determine the next step: if negative, we go left; if zero or positive, we go right. Reaching a leaf node marks the end of traversal, and the corresponding label represents the evaluation result. 17 0255075Sparsity (%)10.012.515.017.520.022.5PerplexityOPT-13B0255075Sparsity (%)10.012.515.017.520.0PerplexityOPT-30B0255075Sparsity (%)681012PerplexityLLaMa-13B0255075Sparsity (%)46810PerplexityLLaMa-33B D Additional Details for ICL Evaluation Methodology In this section, we provide additional details for our ICL task evaluation methodology. In-context example label distribution. When generating the ICL evaluation datasets, we program- matically enforce that the labels for the N in-context demonstrations are split exactly evenly between K possible labels. Evaluation label distribution. Each evaluation input has an equal probability of receiving one of the K possible classification labels. Therefore, evaluation label distribution should be even in expectation. However, we do not programmatically enforce an even distribution of evaluation labels. Size of evaluation dataset. We generate 2048 independent task instances for each function class. Each task instance represents a unique parameterization of the classification function to learn. Prompting technique. We do not use any advanced prompting technique when solving ICL tasks. The LLMs only generate answer tokens corresponding directly to classification labels. We do not generate any other tokens during evaluation. Tokenizer. The OPT models use a byte-pair encoding tokenizer whereas the LLaMA models use a sentence piece tokenizer. Notably, LLaMA tokenizers split each digit into an individual token. This feature of LLaMA tokenizers boosts LLaMA performance on arithmetic tasks (Liu & Low, 2023). E Increasing Input Dimension of ICL Evaluation In this section, we further evaluate the effect of pruning on ICL tasks with different input dimensions. Method. In Section 5, we evaluate pruning's effect on learning linear classification tasks in-context. The task is to classify 4-dimensional input vectors. Here, we increase the input vector dimensions to 8 and 16, and observe whether our observation about pruning's effect generalize to larger input dimenions. Figure 7: Pruning's effect on ICL linear classification tasks with input dimension of 4, 8 and 16. We observe that even with increased input dimension, ICL ability of LLMs continue to be robust to aggresive pruning. Results. Figure 7 presents the relationship between task accuracy and sparsity for linear classifica- tion task. We increase the input dimension from 4 to 8 and 16. We observe that tolerating the same 5% relative drop in the average accuracy among all four models with respect to the dense model, we can prune to 60%, 80% sparsity on linear classification task with 4, 8 dimensional inputs respectively. Dense models perform close to chance on 16-dimensional inputs, thus we refrain from drawing conclusions based on these results. 18 020406080Sparsity (%)40506070Exact Match (%)Linear Classification, Dim=4020406080Sparsity (%)40506070Exact Match (%)Linear Classification, Dim=8020406080Sparsity (%)40506070Exact Match (%)Linear Classification, Dim=16OPT-13BOPT-30BLLaMA-13BLLaMA-33B Figure 8: An alternative pruning algorithm (Wanda) shows the same patterns of accuracy drop as findings in our original paper: moderate pruning hurts fact recall (e.g., left, TriviaQA in Closebook setting) while ICL (e.g., right, in-context linear classification) survives to higher sparsity. Specifi- cally, accepting a 5% relative drop in accuracy, one may remove 30%, 40% and 50% weights on TriviaQA(Closebook), TriviaQA(Openbook) and Linear Classification tasks, respectively. Conclusion. Even with higher dimensional inputs, model's ICL ability remains resilient to aggres- sive pruning (>= 60% sparsity). F Additional Pruning Algorithm Evaluation In our main paper, we focus on a single pruning algorithm SparseGPT (Frantar & Alistarh, 2023). In this section, we study whether our observation that scaling down LLM size affects fact recall more readily than ICL generalize to another pruning algorithm. Method. We repeat key experiments with another pruning algorithm called Wanda (Sun et al., 2023). Notably, unlike SparseGPT, Wanda does not update the remaining weights after weights removal. The author of Wanda shows that at 50% sparsity, Wanda achieves accuracy that is competitive with SparseGPT. Results. We observe the same disparate effects from pruning on fact recall versus ICL: while moderate pruning hurts fact recall, ICL survives to higher sparsity. Specifically, accepting the same 5% relative drop in accuracy as we did for SparseGPT results, one may remove 30%, 40% and 50% weights on TriviaQA(Closebook), TriviaQA(Openbook) and Linear Classification tasks. Unsurprisingly, given that Wanda is computationally less expensive, it underperforms SparseGPT at high sparsities on ICL tasks. Conclusion. With our experiments repeated with another pruning algorithm, we show that our observation is general. G Pythia Models Evaluation In this section, we study whether our observation that scaling down LLM size affects fact recall more readily than ICL generalize to another model family: Pythia (Biderman et al., 2023b). Method. We repeat key experiments with Pythia model family. With SparseGPT, we pruned two variants of the Pythia-12B model, the original and a "deduped" variant where the model is trained on a deduplicated dataset. They're the most capable models in the Pythia family. Results. ?? shows consistent disparate effect of pruning on fact recall versus ICL. Specifically, accepting the same 5% accuracy drop as in all our results, one can remove 20%, 30% and 50% weights for TriviaQA(Closebook), TriviaQA(Openbook) and in-context linear classification tasks. Conclusion. Our observation is robust to the choice of model families. 19 020406080Sparsity (%)02040Accuracy (%)TriviaQA(CloseBook)llama-13bllama-30bopt-13bopt-30b020406080Sparsity (%)02040Accuracy (%)TriviaQA(OpenBook)llama-13bllama-30bopt-13bopt-30b020406080Sparsity (%)0204060Accuracy (%)Linear Classificationllama-13bllama-30bopt-13bopt-30b Figure 9: Two variants of Pythia-12B model shows the same patterns of accuracy drop as findings in our original paper: moderate pruning hurts fact recall (e.g., left, TriviaQA in Closebook setting) while ICL (e.g., right, in-context linear classification) survives to higher sparsity. Specifically, accepting a 5% relative drop in average accuracy, one may remove 20%, 30% and 50% weights on TriviaQA(Closebook), TriviaQA(Openbook) and Linear Classification tasks, respectively. Answer these questions: Q: In Scotland a bothy/bothie is a? A: House Q: Which 90s sci fi series with James Belushi was based on Bruce Wagner's comic strip of the same name? A: Figure 10: Examples Prompt for Question-answering Task without Context. H Example Prompts In this section, we present example prompts for Q&A tasks in Section 4 and ICL on algorithmic tasks in Section 5. H.1 Question-answering without context. Our prompt follows the precedent of Touvron et al. (2023). We show our prompt for Q/A tasks without context in Figure 10. H.2 Question-answering with context. We show an example prompt we use to evaluate Q/A task with the necessary information to answer the question available in-context in Figure 11. H.3 ICL on algorithmic task. We present the prompt we use to evaluate ICL on linear classification task in Figure 12. Evaluations for ICL on check-sorting, check-even uses analogous prompts. 20 0102030405060708090Sparsity (%)01020Accuracy (%)TriviaQA/Closed-bookpythia-12bpythia-12b-deduped0102030405060708090Sparsity (%)051015Accuracy (%)TriviaQA(F)/Open-bookpythia-12bpythia-12b-deduped0102030405060708090Sparsity (%)0204060Accuracy (%)Linear Classification/ICLpythia-12bpythia-12b-deduped Answer these questions: Context: Scattered across the Highlands and rural areas of Scotland, a bothy is a small house that can be used by anyone. Q: In Scotland a bothy/bothie is a? A: House Context: "Roses Are Red (My Love)" is a popular song composed by Al Byron and Paul Evans. It was recorded by Bobby Vinton and was his first hit. The song was released in April 1962. It reached No. 1 in Australia, New Zealand, Norway, the Philippines, South Africa, and the United States, and was a major hit in many other countries as well. The song topped the Billboard Hot 100 singles chart on July 14, 1962, and remained there for four weeks. The single was also the first number-one hit for Epic Records. Billboard ranked the record as the No. 4 song of 1962. Vinton found the song in a reject pile at Epic Records. He first recorded it as an R&B number, but was allowed to re-record it in a slower more dramatic arrangement, with strings and a vocal choir added. Ronnie Carroll version In the UK, a cover version by Ronnie Carroll reached No. 3 on the Record Retailer chart on August 8, 1962, the same week that the Bobby Vinton record peaked at No. 15. It peaked at No. 7 in the very first Irish Singles Chart published in October 1962. Other versions The song was recorded by Jim Reeves in 1963 and released on the album Gentleman Jim, one of the last albums released while he was still alive. While it did not chart in the US, it became a minor hit in Norway and Germany. The song was covered by Singaporean female artist Zhuang Xue Fang, in edited Standard Chinese lyrics written by Suyin under title name of, with Ruby Records in 1967. In 1962, an answer song, entitled "Long As The Rose Is Red", was recorded by Florraine Darlin. The song spent seven weeks on the Billboard Hot 100, reaching No. 62, while reaching No. 15 on Billboards Easy Listening chart. It was released by Epic Records (single #9529) and was also produced by Robert Morgan. Charts Bobby Vinton version Ronnie Carroll version Q: Which singer had a big 60s No 1 with Roses Are Red? A: Figure 11: Examples Prompt for Question-answering Task with Context. 21 [5, -5, -1, 6] = -1 [3, 5, -9, -2] = 1 [-10, 5, -9, -10] = 1 [7, 0, -4, -7] = -1 [-2, -2, 9, -3] = -1 [9, -5, -5, -1] = -1 [-4, -1, -10, -8] = 1 [-10, -1, -3, 6] = -1 [3, 6, -5, -8] = 1 [-1, 7, -2, 6] = -1 [-5, 8, -1, -9] = 1 [-6, -1, -6, -9] = 1 [1, 0, -10, -9] = 1 [-5, 5, -3, 6] = -1 [-4, 6, -10, -7] = 1 [-4, 5, -6, -10] = 1 [-10, 5, -3, -9] = 1 [-7, -2, -7, -9] = 1 [-7, 1, -7, 4] = -1 [-2, 2, -3, -10] = 1 [1, -4, -4, 9] = -1 [7, 0, 6, -10] = -1 [2, 7, -6, -1] = 1 [1, -2, -10, -9] = 1 [-8, 3, 7, -7] = -1 [0, 7, -3, -8] = 1 [0, 2, 0, 0] = -1 [-7, 9, 2, 8] = -1 [1, -8, -9, 6] = -1 [-5, 1, -6, -10] = 1 [8, 8, 1, -4] = -1 [-3, 6, 2, 2] = -1 [-3, 9, 0, -5] = Figure 12: Examples Prompt for ICL on Linear Classification Task. 22 I Analysis on Accuracy Improvement On many tasks, such as ICL on algorithmic tasks in Section 5, we observe accuracy improvement from pruning. In this section, we provide further analysis on this phenomenon. Method. We focus on the ICL task of check-sorting and check-even from Section 5, where the pruned LLaMA models see significant accuracy improvement. We analyze the prediction of the pruned model, in relation to the following two answers: 1). Answer without context. We compute the classification output with the highest log likelihood, without all the in-context examples. The prompt thus looks like "[1, 0, 3, -5]=" without any other information such as in-context training examples. The LLM thus classifies this input array exclusively based on likelihood of a classification label as a continuation of the prompt. We denote this classification outcome as the answer without context. 2). Ground-truth answer. Results. In Figure 13, we present the percentage of time when the prediction of the pruned model matches the answer without context versus the ground truth. We observe that accuracy improvement often mirrors a departure of the model's prediction from answer without context (the solid line dropping whilst the dashed line raising). This suggest that for some pruned models (for example LLaMA-30B at 60% sparsity), the presence of in-context examples changes the prediction of the LLM more than the dense models. Conclusion. We hypothesize, without testing, that pruning may improve task accuracy by enhancing the effect of contextual information on its prediction. Figure 13: Analyzing the accuracy improvement of pruned model on ICL tasks. 23 020406080Sparsity %406080100%Results for Check Sorting020406080Sparsity %406080100%Results for Check EvenLLaMa-13B without-contextLLaMa-13B ground-truthLLaMa-33B without-contextLLaMa-33B ground-truth J Details on Computing Software/Hardware We perform pruning on 80GB version of A100 GPUs, using the implementation of SparseGPT(Frantar & Alistarh, 2023). We perform our evaluations using TPU v3 running PyTorch (Paszke et al., 2019) with XLA backend. Our research project consumes approximately 3 TPU-month worth of computation. Our computing software/hardware necessitates the use of the bfloat16 numerical format. We assess its impact on our experimental results in Appendix K. K Characterizing Errors from Numerical Precision All our experiments run on TPU v3. The TPU hardware does not support float16 (IEEE 754 half precision floating point format), which are the formats used for training the OPT/LLaMA models. We thus use a closely related floating point format called bfloat16 (Brain Float) instead to evaluate these models. Both bfloat 16 and float16 are floating point numbers requiring 16 bits to represent, the key difference is that bfloat16 format can represent numbers in a slightly wider range of values, but with slightly reduced precision compared with float16. For this reason, we expect our results to contain small systematic errors. In this section, we characterize the difference between our results in bfloat16 and standard results in float16. Perplexity and accuracy results. In Figure 14, we plot the perplexity and accuracy in next token prediction in bfloat16 on TPU v3 and float16 on A100. We observe that the average accuracy difference is 1.0%, 0.89%, 0.70% and 0.68% for OPT-13B, OPT-30B, LLaMA-13B and LLaMA-33B. The perplexity grows to very large numbers at high sparsity, so we report the average perplexity difference for sparsity level less than or equal to 50%. The average perplexity difference is: 0.86, 0.69, 0.19, 0.13. We note that 1). the difference in accuracy and perplexity due to numerical precision is systematic. The accuracy of next token prediction raises by a similar amount across all sparsity levels. 2). the difference in next token prediction accuracy is small (¡1%). OPT. OPT models see higher difference in accuracy and perplexity. This is because its GPU implementation uses mixed precision arithmetic, where the attention score computes in float32. Our compiler and runtime, however, does not support mixed precision arithmetic, we therefore compute entirely within bfloat16. Figure 14: Characterizing the difference between float16 and bfloat16. 24 050Sparsity (%)10.012.515.017.520.022.5Perplexityopt-13b050Sparsity (%)10.012.515.017.520.0Perplexityopt-30b050Sparsity (%)4681012Perplexityllama-13b050Sparsity (%)46810Perplexityllama-30b1020304050Accuracy (%)1020304050Accuracy (%)2030405060Accuracy (%)2030405060Accuracy (%)bfloat16 pplfloat16 pplbfloat16 accuracyfloat16 accuracy
http://arxiv.org/abs/2310.04676v1
"2023-10-07T03:21:58"
"2023-10-07T03:21:58"
Surgical Gym: A high-performance GPU-based platform for reinforcement learning with surgical robots
Recent advances in robot-assisted surgery have resulted in progressively more precise, efficient, and minimally invasive procedures, sparking a new era of robotic surgical intervention. This enables doctors, in collaborative interaction with robots, to perform traditional or minimally invasive surgeries with improved outcomes through smaller incisions. Recent efforts are working toward making robotic surgery more autonomous which has the potential to reduce variability of surgical outcomes and reduce complication rates. Deep reinforcement learning methodologies offer scalable solutions for surgical automation, but their effectiveness relies on extensive data acquisition due to the absence of prior knowledge in successfully accomplishing tasks. Due to the intensive nature of simulated data collection, previous works have focused on making existing algorithms more efficient. In this work, we focus on making the simulator more efficient, making training data much more accessible than previously possible. We introduce Surgical Gym, an open-source high performance platform for surgical robot learning where both the physics simulation and reinforcement learning occur directly on the GPU. We demonstrate between 100-5000x faster training times compared with previous surgical learning platforms. The code is available at: https://github.com/SamuelSchmidgall/SurgicalGym.
[ "Samuel Schmidgall", "Axel Krieger", "Jason Eshraghian" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04676v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04676v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.RO", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.RO", "cs.LG" ]
Surgical Gym: A high-performance GPU-based platform for reinforcement learning with surgical robots Samuel Schmidgall1, Axel Krieger2 and Jason Eshraghian3 3 2 0 2 t c O 7 ] O R . s c [ 1 v 6 7 6 4 0 . 0 1 3 2 : v i X r a Abstract- Recent advances in robot-assisted surgery have resulted in progressively more precise, efficient, and minimally invasive procedures, sparking a new era of robotic surgical intervention. This enables doctors, in collaborative interaction with robots, to perform traditional or minimally invasive surgeries with improved outcomes through smaller incisions. Recent efforts are working toward making robotic surgery more autonomous which has the potential to reduce variability of surgical outcomes and reduce complication rates. Deep rein- forcement learning methodologies offer scalable solutions for surgical automation, but their effectiveness relies on extensive data acquisition due to the absence of prior knowledge in successfully accomplishing tasks. Due to the intensive nature of simulated data collection, previous works have focused on making existing algorithms more efficient. In this work, we focus on making the simulator more efficient, making training data much more accessible than previously possible. We intro- duce Surgical Gym, an open-source high performance platform for surgical robot learning where both the physics simulation and reinforcement learning occur directly on the GPU. We demonstrate between 100-5000× faster training times compared with previous surgical learning platforms. The code is available at: https://github.com/SamuelSchmidgall/SurgicalGym. I. INTRODUCTION The field of surgery has undergone a major transformation with the introduction of robots. These robots, controlled directly by surgeons, have enhanced the precision and ef- ficiency of complex surgical procedures [1]. In practice, the surgeon operates the robot from a control station using tools like hand controllers and foot pedals. The robot, in response, carries out the surgeon's movements with great accuracy, eliminating even the smallest amount of shaking. In modern medical practice, surgical robots play a pivotal role in supporting surgeons during minimally invasive pro- cedures, with over a million surgeries per year carried out by human surgeons guiding these robots [2]. Despite their complexity, surgical robots in practice are not autonomous and rely on human control to function. The incorporation of autonomy has the potential to dramatically improve surgical outcomes since automation of these tasks can alleviate the burden of repetitive tasks and minimize surgeon fatigue [3]. The growing desire to improve surgical efficiency has led to a growth in efforts focused on automating various surgical tasks, ranging from suturing [4], [5], [6], endoscope control 1Samuel Schmidgall is with the Department of Electrical Engineering, Johns Hopkins University, Baltimore, MD, USA sschmi46@jhu.edu 2Axel Kriger is with the Department of Mechanical Engineering, Johns Hopkins University, Baltimore, MD, USA axel@jhu.edu 2Jason Eshraghian is with the Department of Electrical Engineer- ing, University of California, Santa Cruz, Santa Cruz, CA, USA jeshragh@ucsc.edu Fig. 1. Demonstration of Smart Tissue Autonomous Robot robot per- forming path following (path in blue dashed lines) going from right to left. Suturing tool end-effector (red) precisely follows randomly generated points along a nonlinear path. [7], [8], [9], and tissue manipulation [10], [11], [12], [13], to pattern cutting [14], [15], [16]. Recently, deep reinforcement learning (RL) methods have shown they can produce various control strategies exceed- ingly well, which is promising for automated surgery [17], [16], [18], [19], [20]. However, this development does not come without a myriad of challenges. One of the most significant challenges results from the fact that RL-based methods often require a large amount of data to succeed, particularly because they start without any pre-existing do- main knowledge [21], [22], [23]. While strategies using specialized domain knowledge provide significant value (e.g. expert demonstration from surgeon), there remains a sub- stantial need for larger and more diverse training datasets to improve task generalization [24], [25]. Building on this, the field of robotics has recently experienced a surge of major advancements with learning-based control algorithms due to the development of high-performance GPU-based physics simulators, which provide 100-10000× faster data collection rates than CPU based simulators [26], [27], [28], [29]. Despite these advancements in other areas of robotics, the potential benefits of these high-performance simulators for surgical robot learning are yet to be realized. We believe that providing easy access to surgical robotic training data is the next step toward building more capable and autonomous surgical robots. Toward this, we present Surgical Gym, an open-source GPU-based learning platform for surgical robotics. Our main contributions are as follows: • We introduce an open-source high-performance plat- (Left) Data process flow comparison. Comparison between the traditional reinforcement learning pipeline which use CPU based physics engines Fig. 2. and Surgical Gym, which uses a GPU based physics engine. Surgical Gym avoids expensive data transfer between the CPU and GPU, with all operations tensorized on the GPU. (Right) Detailed Surgical Gym process flow. Large scale GPU accelerated physics are executed with thousands of robots in parallel. Sensor data is calculated from actor bodies and their corresponding positions, rotations and velocities which are stored directly in PyTorch tensors. Reward calculation takes relevant sensor data, calculates a per-agent reward, which is passed to the GPU-accelerated Proximal Policy Optimization implementation for gradient calculation. Finally, sensor data is forward propagated through an ANN to calculate an action, which is sent to the physics engine. form for surgical robot learning that accelerates training times up to 5000× by leveraging GPU-based physics simulation and reinforcement learning, thereby making surgical robot training data more accessible. • We built five training environments which support learn- ing for six different surgical robots & attachments (da Vinci Research Kit [30] and the Smart Tissue Au- tonomous Robot [31], [32]). GPU-based RL algorithms are incorporated into this library, making training on these environments simple and reproducible even with- out RL expertise. We believe that providing easy access to surgical robot training data is the next step toward building surgical robots with greater autonomy, and hope Surgical Gym provides a step forward in this direction. All of the code and environ- ments are open-source and can be found at the following link: https://github.com/SamuelSchmidgall/SurgicalGym. II. BACKGROUND Reinforcement Learning for Robotics RL is a machine learning paradigm where an agent learns from the environment by interacting with it and receiving re- wards for performing actions [33]. The fundamental concept behind reinforcement learning is trial-and-error search, i.e., the agent selects an action at when given a particular state st, receives a reward rt based on that state, and then transitions to a new state st+1. The goal of the agent is to maximize the expected cumulative reward over time. Mathematically, the environment is modeled as a Markov Decision Process (MDP), defined by a tuple (S, A, P, R), where S is the space of possible states, A is the space of possible actions, P is the state transition probability, i.e., P (s′|s, a) is the probability of transitioning to state s′ after taking action a in state s, and R is the reward function. R(s, a) is the expected reward received after taking action a in state s. The agent's behavior is defined by a policy (π), which is a mapping from states to probabilities of selecting each action, i.e., π(a|s) is the probability of taking action a in state s. The value of a state, denoted by V π(s), is the expected cumulative reward when starting from state s and following policy π. The Bellman equations for V π(s) is defined as: V π(s) = (cid:88) a (cid:34) π(a|s) R(s, a) + γ (cid:35) P (s′|s, a)V π(s′) (cid:88) s′ where γ is the discount factor, s′ is the next state, and a′ is the next action. The objective in reinforcement learning is to find the optimal policy π∗ that maximizes the expected cumulative reward, i.e., π∗ = arg maxπ V π(s). Surgical Robot Algorithms Previous efforts in surgical robotics have focused on devel- oping sophisticated controllers for particular subtasks [34], [35], [31], [32]. While these approaches are quite successful and reliable, they typically focus on solving surgical sub- problems independently. Considering the wide diversity of scenarios that clinical surgeries may present, it is unlikely that lead to full surgical automation. isolated subtask solutions will RL, on the other hand, demonstrates the ability to gener- alize well to novel circumstances given a sufficient amount of experience [36]. However, while control algorithms have been demonstrated to be reliable over decades of research, RL algorithms are relatively new and have yet to be deployed in patient-critical applications. This is particularly important for high-precision problems like automated surgery. There- fore, it is likely a combination of control-based and RL- based approaches will enable highly reliable and autonomous surgery. Surgical Robot Platforms The da Vinci: The da Vinci Surgical System is a robotic surgical system designed to facilitate complex surgery using a minimally invasive approach [37]. The system operates through an interface with the Mas- ter Tool Manipulator (MTM), which serves as the control center for the surgeon to direct surgical actions. Through the MTM's handles or joysticks, the surgeon's movements are translated into corresponding motions of the Patient Side Manipulators (PSMs), which are robotic arm attach- ments responsible for performing the surgery. The PSMs are flexible, multi-jointed instruments capable of holding and manipulating surgical tools, adjusting to the unique anatomy and requirements of each procedure. A third component of the da Vinci system is the Endo- scopic Camera Manipulator (ECM). The ECM is another robotic arm attachment that holds and controls the movement of a stereo endoscope, a special camera that provides a high-definition, three-dimensional view of the surgical field. This allows the surgeon, from the control console, to have a detailed and magnified view of the area being operated on, improving precision during the surgical procedure. The Smart Tissue Autonomous Robot: The Smart Tis- sue Autonomous Robot (STAR) [35], [31] is an autonomous robot designed to perform soft tissue surgery with minimal assistance from a surgeon. The STAR robot has been used for a variety of autonomous surgical procedures, most notably, the first autonomous laparoscopic surgery for intestinal anas- tomosis [32] (reconnection of two tubular structures such as blood vessels or intestines). The STAR performed the procedure in four different animals, producing better results than humans executing the same procedure. The STAR uses a seven DoF light-weight arm mounted with an actuated suturing tool, which has actuators to drive a circular needle and a pitch axis (see Robot Descriptions). The STAR supports a manual mode and an automatic mode. In manual mode, a surgeon selects where each stitch is placed, whereas in automatic mode, an incision area is outlined and the STAR determines where each stitch is placed. Automatic mode chooses these placements based on the contour of the incision, which, once chosen, is transformed to the 3D camera frame and stitches are distributed evenly [35]. Software Platforms for Surgical Robot Learning The first open-source RL-focused environment for surgical robotics is the da Vinci Reinforcement Learning (dVRL) suite [38], which aims to enable scientists without a sur- gical background to develop algorithms for autonomous surgery. dVRL introduces two straightforward training tasks: a robotic reach and a pick-and-place problem. Transfer to robotic hardware is demonstrated using the robotic target reaching policy for suctioning blood using a simulated ab- domen (created by molding pig parts into gelatin and then filled with blood). Transfer to hardware was made possible since environments were designed around being compatible with the da Vinci Research Kit (dVRK) [30], a large-scale effort which enables institutions to share of a common hardware platform for the da Vinci system. UnityFlexML [39] presents a framework that expands on autonomous surgical training, focusing on manipulating deformable tissues during a nephrectomy procedure. This framework was built on Unity3D, which naturally supports Fig. 3. Surgical Gym on a target reaching task. Demonstration of surgical robots & attachments supported in deformable objects. Like dVRL, the policy in UnityFlexML demonstrates successful transferability to the dVRK. LapGym [40] provides an RL environment for developing and testing automation algorithms in laparoscopic surgery, covering four main skills: spatial reasoning, deformable object manipulation & grasping, dissection, and thread ma- nipulation. This includes a rich set of tasks from rope threading to tissue dissection. Unlike previous simulators, it presents a variety of image-based learning problems from which it supports RGB, depth, point clouds and semantic segmentation. Finally, SurRoL [22] is an open-source RL focused simu- lation platform, like previous work, designed to be compati- ble with the dVRK. SurRoL develops environments for both da Vinci attachments (patient side and endoscopic camera manipulators, see subsection The da Vinci System) as well as for multiple arms. SurRoL and LapGym have many environments, where SurRoL implements ten unique training tasks and LapGym implements a total of twelve. Other platforms only supported a limited number of training tasks, with UnityFlexML having one and dVRL having two. Applications of RL on these environments focus on data-efficiency, aiming to develop interactions, e.g. algorithms which use few environment with SurRoL only 100,000 [22], [23] interactions in their experiments. This is because data collection in these environ- ments is expensive (see subsection Simulator Performance Comparison) and thus experimentation is much more limited. III. METHODS Simulation Setup We build Surgical Gym on Isaac Gym [26], which is a tensorized physics platform utilizing PhysX. The physics simulation as well as the observation, reward, and action calculation takes place on the GPU, enabling direct data transfer from the physics buffers to GPU tensors in PyTorch [41]. This process bypasses any potential slowdowns that could occur if the data were to pass through the CPU. In Surgical Gym, an actor is composed of rigid bodies connected by joints. Rigid bodies are the primitive shapes or meshes that comprise of the actor. Different joint types link rigid bodies, each having a specific number of DoFs: fixed joints have 0, revolute and prismatic joints have 1, and spherical joints have 3. Joints can take different types of simulation input, including forces, torques, and PD controls (position or velocity targets). The action space for Surgical Gym environments are currently configured for position- based (PD) commands. However, each environment also supports torque and velocity-based commands. Like experiments in Isaac Gym, we use the Temporal Gauss Seidel (TGS) solver [42] to calculate future object states. It uses sub-stepping to accelerate convergence better than solvers using larger steps with multiple iterations. The solver computes and accumulates scaled velocities into a delta buffer per iteration, which is then projected onto con- straint Jacobians and added to the biases in constraints. This process has a similar computational cost as the traditional Gauss-Seidel solver [43], but without the expense of sub- stepping. For positional joint constraints, an extra rotational term is calculated for joint anchors to prevent linearization artifacts. Robot Descriptions To support dVRK compatibility for the PSM and ECM attachments, URDF descriptor models were derived from the dVRK-ros1 speficiations [30] and converted to Universal Scene Descriptor (USD) format to be compatible with the GPU-based physics engine. For the STAR robot, we used descriptors for the Kuka LWR (7 DoF) arm and the suturing tool from the Endo360 specification, as was used in suturing demonstrations with the STAR robot [32]. The PSM has seven DoFs, where the arm position is deter- mined by the first six (denoted as θi), and the seventh DoF corresponds to the PSM jaw angle, which, from an action perspective, is either open or closed (ajaw ∈ {0, 1}) but has an intermediate angle (θjaw ∈ R) during the process of opening or closing. The PSM arm includes both revolute (R) and prismatic (P) actuated joints, arranged in the following sequence: RRPRRR. The ECM tool follows a similar structure to the PSM, however it does not have a jaw, rather, a camera attached tip. The ECM arm also consists of revolute to the tool and prismatic joints arranged in the following sequence: RRPRRR. 1https://github.com/jhu-dvrk/dvrk-ros The STAR robot has 8 DoFs with a suturing tool at- tachment extending from the end of the robot arm. The STAR arm consists entirely of revolute joints arranged in the following sequence: RRRRRRRR. Action Space: Although the dVRK supports 6-DoF motion (and the STAR 7-DoF), previous works have defined the action space as positional coordinates of the end-effector with a dynamics controller actuating the joints [22], [40]. While this accelerates learning where data is scarce, (1) it can restrict the utilization of the robot's complete motion capabilities and (2) it tends to be computationally expensive. However, in practice, end-effector control is likely a much better option from a safety perspective. We opted to define the action space in a way that enables the full range of robot motions via torque or PD control, capitalizing on the exten- sive data available in Surgical Gym, with the opportunity for custom controllers to be wrapped on top of this action space for all of the supported robots. Observation Space: While the observation space dif- fers slightly between tasks, most of it remains consistent. The base observation space for the robot is defined by the concatenation of DoF positions (θ ∈ Rn where n = number of DoFs), DoF velocities ( ̇θ ∈ Rn), the tool link tip position (ptip ∈ R3), and the current PD-targets for the DoF (θtarget ∈ Rn). With tasks involving a goal position (e.g. Target Reaching and Active Tracking) the goal position (g or gt ∈ R3) is included in the observation vector. Similarly, with tasks involving image input (e.g. Endoscopic Image Matching) the target image (px,y,target) and the current end- effector image (px,y) is provided. Policy learning and control For policy learning in Surgical Gym, we utilize a GPU- optimized implementation of Proximal Policy Optimization (PPO) algorithm [44] which has been adapted for efficient parallel learning with numerous robots [45]. Previous work found that the hyper-parameter, batch size B = nrobotsnsteps, plays a significant role in learning ef- ficiency. Here, nsteps signifies the steps each robot takes per update, and nrobots denotes parallel-simulated robots. By increasing nrobots, we decrease nsteps to optimize training times. However, to ensure algorithm convergence and effec- tive Generalized Advantage Estimation (GAE) [46], nsteps cannot be reduced below a threshold, which has been shown to be fewer than 25 steps or 0.5s of simulated time [45]. For backpropagation, the batch is split into large mini-batches, which improves the learning stability without increasing training time. During training, robot resets, triggered either by falls or after specific intervals to facilitate new trajectory exploration, disrupt the infinite reward horizon assumed by the PPO al- gorithm's critic function, potentially impairing performance. To rectify this, we differentiate between terminations due to falls or goal attainment, which the critic can anticipate, and time-outs, which are unpredictable. We address time-out cases by augmenting the reward with the critic's prediction of the infinite sum of future discounted rewards, a technique known as "bootstrapping." [45] This strategy, necessitating modification of the standard Gym interface to detect time- outs, effectively maintains the infinite horizon assumption. IV. RESULTS Environments Surgical Gym makes RL easier to use by including a common Gym-like interface [47], which helps make the pro- cess of developing and evaluating algorithms more straight- forward. Included in this interface, we have developed a range of learning-based tasks that are useful for surgical automation, covering varying degrees of task complexity. We build five tasks that support five different surgical robots & attachments. We chose to incorporate tasks that develop low- level control capabilities (e.g. end-effector target reaching, image-guided navigation) to build a foundation for more advanced problems that would require these skills. These five tasks are described in more detail below. • Target Reaching: The Target Reaching task involves aligning the end-effector, ηt, of the robot with a red target sphere with a randomly sampled position, g, for each environment. The task's reward structure is devised based on the distance between the end-effector and the sphere. r(st) = ρ||ηt − g|| This environment supports the PSM and ECM attach- ments for the da Vinci, and the STAR robot with the suturing tool end-effector. The goal point for this task has a randomization range of gx,y,z ∼ N (0, 0.05) in front of the robot for the ECM & PSM and gx,y,z ∼ N(0, 0.15) for the STAR, providing a wide reaching range relative to the robot. • Active Tracking: In the Active Tracking task, simi- lar to the Target Reaching task, the goal is to align the end-effector with a target position, gt. Unlike the previous task, the goal location in this environment is time-varying and changes its position in all directions (x, y, z) as follows: gt = gt + ̇gt ̇gt = ̇gt + N(0, 1−4) This environment supports the PSM and ECM attach- ments for the da Vinci, and the STAR robot. The task reward system is based on the distance between the moving sphere and the end-effector. The tracking problem samples the goal coordinates from gx,y,z ∼ N (0, 0.05) for ECM & PSM and gx,y,z ∼ N (0, 0.15) for STAR with a max positional offset of −0.2 and 0.2. • Endoscopic Image Matching: In the Endoscopic Im- age Matching task, the sensory input is a specific target image (px,y,target), and the goal is to attain the same image through the endoscopic camera of the ECM robot on its end-effector (px,y). The task is about creating an accurate match between the given image and the current viewpoint of the end-effector. The reward is defined as follows: r(st) = 1 w * h (cid:88) (px,y − px,y,target) x,y This task tests the robot's ability to precisely position and orient itself to match a specific visual scene, sim- ulating the surgical requirement of aligning tools to match reference images. • Path following: In the Path Following task, the robot's objective is to navigate its end-effector, ηt, along a predefined trajectory, P, which is represented as a sequence of waypoints in the environment. The main challenge lies in maintaining a consistent alignment with the path while adapting to any minor perturbations in the environment. The path waypoints are sampled using a parametric representation of the path, which is application configurable. By default, a cubic spline S(t) is used to represent the path P, which interpolates the given waypoints. The cubic spline S(t) can be represented as: S(t) = a(t − ti)3 + b(t − ti)2 + c(t − ti) + d, where [a, b, c, d] are the coefficients of the spline, which are randomly sampled within a set of values at the beginning of the task. Once the path is represented by the spline, the waypoints are sampled at regular intervals of distance along the spline. The resulting samples are then used as reference positions for the end-effector, ηt, at each timestep. The reward function for this task is calculated based on how closely the end-effector follows the trajectory: r(st) = −α||ηt − P(t)|| where α is a scaling factor determining the penalty for deviating from the path and P(t) denotes the desired position on the path at time t. Supported environments for this task include the PSM & ECM attachments for the da Vinci, and the STAR robot. • Multi-Tool Target Reaching: In the Multi-Tool Target Reaching task, the robot is required to coordinate the movement and positioning of several end-effectors, (e.g. with n = 2 there is η1 and η2) to align with multiple target spheres (e.g. g1 and g2). Each target sphere has its own distinct position, and the challenge lies in simul- taneously positioning multiple tools and handling self- collisions. The reward function takes into account the distance between each end-effectors and their targets: r(st) = ρ n (cid:88) i=1 ||ηi − gηi|| The environment setup is designed to simulate complex surgical scenarios where multiple tools need to be coordinated simultaneously. This task is an extension of the Target Reaching task and represents a higher level of complexity. Supported environments for this task include position two independent PSMs (Bimanual PSM), two indepdendent STARs (Bimanual STAR), and two PSMs together with one ECM (Trimanual PSM- ECM). TABLE II SIMULATION SPEED OF SIMULATOR LEARNING DYNAMICS Simulator UnityFlexML UnityFlexML WD4 LapGym (8 core) dVRL SurRoL Surgical Gym Seconds per 1M Timesteps 37037 ± 1796 19231 ± 1342 833 ± 13.5 7024 ± 26.5 612 ± 35.2 6.8 ± 0.4 Frames per second 27 ± 2.9 52 ± 3.9 1200 ± 19.1 142 ± 0.5 1634 ± 94.3 147059 ± 8170 Simulator Performance Comparison To properly assess the computational efficiency of various surgical robot learning platforms, we conducted performance profiling of each simulation environment. Time profiling begins after the first simulation step and ends after one million simulation steps were reached. Profiling was done for each environment on their respective PSM Reach task, which was a shared environment among all simulators. Simulation times were collected for each environment by running the simulator 30 times in separate instances2. The performance of each simulator was first tested without incorporating learning dynamics in order to evaluate the speed of the simulator by itself. In this condition, the physics simulator was given random action input (ai ∼ U (−1, 1)) and simulator feedback was ignored. Results are shown below in Table I. TABLE I SIMULATION SPEED OF SURGICAL SIMULATORS Simulator UnityFlexML UnityFlexML WD3 LapGym dVRL SurRoL Surgical Gym Seconds per 1M Timesteps 17857 ± 1123.1 6410 ± 124 2166 ± 52.1 2113 ± 12.2 242 ± 3.2 2.9 ± 0.2 Frames per second 56 ± 4.2 156 ± 6.4 461 ± 11 473 ± 3.1 4124 ± 54 344828 ± 22247 As can be seen, Surgical Gym takes an average of 2.9 seconds to collect 1M timesteps (344828 frames per second), whereas UnityFlexML takes as much as 17857 seconds (∼ 300 minutes at 56 frames per second). In terms of simulation time, Surgical Gym is ∼ 7000× faster than the slowest simulator and ∼ 80× faster than the fastest simulator. Next, the performance was tested with the incorporation of learning dynamics. In this condition, the simulator is given action input forward propagated through a neural network, reward is accumulated, and policy gradient updates are calculated. The neural network is a 3 hidden-layer network with hidden dimensions 256, 128, and 64 respectively using ELU nonlinear activations[48]. Rather than testing the pure simulation speed, this test benchmarks how long it takes for the policy to be optimized on one million simulation steps, validating the time efficiency of the learning dynamics. Results are shown below in Table II. 2Simulation speed times for LapGym and UnityFlexML were self- reported by the authors of the respective libraries. Incorporating the learning dynamics, Surgical Gym takes an average of 6.8 seconds to train on 1M timesteps (147059 frames per second), whereas UnityFlexML takes as much as 37037 seconds (∼ 600 minutes at 27 frames per second). With respect to training times Surgical Gym is ∼ 5500× faster than the slowest simulator and ∼ 90× faster than the fastest simulator. For each of the libraries, default configurations were used for evaluation (e.g. LapGym using 8 cores). For Surgical Gym, we ran 20, 000 environments in parallel directly on a single GPU (8GB NVIDIA Quadro RTX 4000). V. CONCLUSION We see Surgical Gym expanding beyond the environments discussed in this paper. Future work could advance this library with more complex problems, such as in SurRoL [22] and LapGym [40]. We also see the incorporation of tasks involving soft body models which more closely resem- ble surgical tasks, such as tissue manipulation [10], which IsaacGym supports [49]. Transferring from simulation to hardware is more challenging with RL-trained torque and PD controllers than inverse dynamics (which was used in previous works). Thus, the further integration of V-REP kinematic models [50] redesigned with GPU-compatibility may make the transfer from simulation to hardware simpler. While Surgical Gym provides significant improvements in simulation speed, there is still much work to be done before this can be applied to autonomous surgery. We hope by making this work open-source, researchers can build on it to make sophisticated autonomous controllers for a wide variety of surgical applications (e.g. suturing, tissue manipulation, pattern cutting). Here, we introduce an open- source platform that accelerates surgical robot training with GPU-based simulations and RL. This platform features five training environments, with six surgical robots. We believe easier access to simulated training data will enable the next generation of autonomous surgery and hope Surgical Gym provides a step in that direction. ACKNOWLEDGEMENT This material is based upon work supported by the Na- tional Science Foundation Graduate Research Fellowship for Comp/IS/Eng-Robotics under Grant No. DGE2139757 and NSF/FRR 2144348. REFERENCES [1] A. Attanasio, B. Scaglioni, E. De Momi, P. Fiorini, and P. Valdastri, "Autonomy in surgical robotics," Annual Review of Control, Robotics, and Autonomous Systems, vol. 4, pp. 651–679, 2021. [2] M. Tindera, "Robot wars: $60b intuitive surgical dominated its market for 20 years. now rivals like alphabet are moving in. forbes," 2019. [3] T. Haidegger, and paradigms," IEEE Transactions on Medical Robotics and Bionics, vol. 1, no. 2, pp. 65–76, 2019. robots: Concepts "Autonomy for surgical [4] Y. Barnoy, M. O'Brien, W. Wang, and G. Hager, "Robotic surgery with lean reinforcement learning," arXiv preprint arXiv:2105.01006, 2021. [5] Z.-Y. Chiu, F. Richter, E. K. Funk, R. K. Orosco, and M. C. Yip, "Bimanual regrasping for suture needles using reinforcement learning for rapid motion planning," in 2021 IEEE International Conference on Robotics and Automation (ICRA), pp. 7737–7743, IEEE, 2021. [6] V. M. Varier, D. K. Rajamani, N. Goldfarb, F. Tavakkolmoghaddam, A. Munawar, and G. S. Fischer, "Collaborative suturing: A reinforce- ment learning approach to automate hand-off task in suturing for surgical robots," in 2020 29th IEEE international conference on robot and human interactive communication (RO-MAN), pp. 1380–1386, IEEE, 2020. [7] A. Pore, M. Finocchiaro, D. Dall'Alba, A. Hernansanz, G. Ciuti, A. Arezzo, A. Menciassi, A. Casals, and P. Fiorini, "Colonoscopy navigation using end-to-end deep visuomotor control: A user study," in 2022 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 9582–9588, IEEE, 2022. [8] M. Turan, Y. Almalioglu, H. B. Gilbert, F. Mahmood, N. J. Durr, H. Araujo, A. E. Sarı, A. Ajay, and M. Sitti, "Learning to navigate endoscopic capsule robots," IEEE Robotics and Automation Letters, vol. 4, no. 3, pp. 3075–3082, 2019. [9] G. Trovato, M. Shikanai, G. Ukawa, J. Kinoshita, N. Murai, J. Lee, H. Ishii, A. Takanishi, K. Tanoue, S. Ieiri, et al., "Development of a colon endoscope robot that adjusts its locomotion through the use of reinforcement learning," International journal of computer assisted radiology and surgery, vol. 5, pp. 317–325, 2010. [10] Y. Li, F. Richter, J. Lu, E. K. Funk, R. K. Orosco, J. Zhu, and M. C. Yip, "Super: A surgical perception framework for endoscopic tissue manipulation with surgical robotics," IEEE Robotics and Automation Letters, vol. 5, no. 2, pp. 2294–2301, 2020. [11] C. Shin, P. W. Ferguson, S. A. Pedram, J. Ma, E. P. Dutson, and J. Rosen, "Autonomous tissue manipulation via surgical robot using learning based model predictive control," in 2019 International conference on robotics and automation (ICRA), pp. 3875–3881, IEEE, 2019. [12] S. A. Pedram, P. W. Ferguson, C. Shin, A. Mehta, E. P. Dutson, F. Alambeigi, and J. Rosen, "Toward synergic learning for autonomous manipulation of deformable tissues via surgical robots: An approxi- mate q-learning approach," in 2020 8th IEEE RAS/EMBS International Conference for Biomedical Robotics and Biomechatronics (BioRob), pp. 878–884, IEEE, 2020. [13] J. Lu, A. Jayakumari, F. Richter, Y. Li, and M. C. Yip, "Super deep: A surgical perception framework for robotic tissue manipulation using deep learning for feature extraction," in 2021 IEEE International Conference on Robotics and Automation (ICRA), pp. 4783–4789, IEEE, 2021. [14] T. Nguyen, N. D. Nguyen, F. Bello, and S. Nahavandi, "A new tensioning method using deep reinforcement learning for surgical pattern cutting," in 2019 IEEE international conference on industrial technology (ICIT), pp. 1339–1344, IEEE, 2019. [15] B. Thananjeyan, A. Garg, S. Krishnan, C. Chen, L. Miller, and K. Goldberg, "Multilateral surgical pattern cutting in 2d orthotropic gauze with deep reinforcement learning policies for tensioning," in 2017 IEEE International Conference on Robotics and Automation (ICRA), pp. 2371–2378, IEEE, 2017. [16] N. D. Nguyen, T. Nguyen, S. Nahavandi, A. Bhatti, and G. Guest, "Manipulating soft tissues by deep reinforcement learning for au- tonomous robotic surgery," in 2019 IEEE International Systems Con- ference (SysCon), pp. 1–7, IEEE, 2019. [17] M. Yip, S. Salcudean, K. Goldberg, K. Althoefer, A. Menciassi, J. D. Opfermann, A. Krieger, K. Swaminathan, C. J. Walsh, H. Huang, et al., "Artificial intelligence meets medical robotics," Science, vol. 381, no. 6654, pp. 141–146, 2023. [18] P. M. Scheikl, E. Tagliabue, B. Gyenes, M. Wagner, D. Dall'Alba, P. Fiorini, and F. Mathis-Ullrich, "Sim-to-real transfer for visual reinforcement learning of deformable object manipulation for robot- assisted surgery," IEEE Robotics and Automation Letters, vol. 8, no. 2, pp. 560–567, 2022. [19] Y. Barnoy, O. Erin, S. Raval, W. Pryor, L. O. Mair, I. N. Weinberg, Y. Diaz-Mercado, A. Krieger, and G. D. Hager, "Control of magnetic surgical robots with model-based simulators and reinforcement learn- ing," IEEE Transactions on Medical Robotics and Bionics, vol. 4, no. 4, pp. 945–956, 2022. [20] Y. Ou and M. Tavakoli, "Sim-to-real surgical robot learning and autonomous planning for internal tissue points manipulation using re- inforcement learning," IEEE Robotics and Automation Letters, vol. 8, no. 5, pp. 2502–2509, 2023. [21] K. Pertsch, Y. Lee, Y. Wu, and J. J. Lim, "Guided reinforcement learning with learned skills," arXiv preprint arXiv:2107.10253, 2021. [22] J. Xu, B. Li, B. Lu, Y.-H. Liu, Q. Dou, and P.-A. Heng, "Surrol: An open-source reinforcement learning centered and dvrk compatible platform for surgical robot learning," in 2021 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 1821–1828, IEEE, 2021. [23] T. Huang, K. Chen, B. Li, Y.-H. Liu, and Q. Dou, "Guided reinforce- ment learning with efficient exploration for task automation of surgical robot," arXiv preprint arXiv:2302.09772, 2023. [24] N. Heess, D. Tb, S. Sriram, J. Lemmon, J. Merel, G. Wayne, Y. Tassa, T. Erez, Z. Wang, S. Eslami, et al., "Emergence of locomotion behaviours in rich environments," arXiv preprint arXiv:1707.02286, 2017. [25] J. Hilton, J. Tang, and J. Schulman, "Scaling laws for single-agent reinforcement learning," arXiv preprint arXiv:2301.13442, 2023. [26] V. Makoviychuk, L. Wawrzyniak, Y. Guo, M. Lu, K. Storey, M. Mack- lin, D. Hoeller, N. Rudin, A. Allshire, A. Handa, et al., "Isaac gym: High performance gpu-based physics simulation for robot learning," arXiv preprint arXiv:2108.10470, 2021. [27] I. Radosavovic, T. Xiao, S. James, P. Abbeel, J. Malik, and T. Dar- rell, "Real-world robot learning with masked visual pre-training," in Conference on Robot Learning, pp. 416–426, PMLR, 2023. [28] T. Chen, J. Xu, and P. Agrawal, "A system for general in-hand object re-orientation," in Conference on Robot Learning, pp. 297–307, PMLR, 2022. [29] H. Qi, A. Kumar, R. Calandra, Y. Ma, and J. Malik, "In-hand object rotation via rapid motor adaptation," in Conference on Robot Learning, pp. 1722–1732, PMLR, 2023. [30] P. Kazanzides, Z. Chen, A. Deguet, G. S. Fischer, R. H. Taylor, and S. P. DiMaio, "An open-source research kit for the da vinci® surgical system," in 2014 IEEE international conference on robotics and automation (ICRA), pp. 6434–6439, IEEE, 2014. [31] A. Shademan, R. S. Decker, J. D. Opfermann, S. Leonard, A. Krieger, and P. C. Kim, "Supervised autonomous robotic soft tissue surgery," Science translational medicine, vol. 8, no. 337, pp. 337ra64–337ra64, 2016. [32] H. Saeidi, J. D. Opfermann, M. Kam, S. Wei, S. L ́eonard, M. H. Hsieh, J. U. Kang, and A. Krieger, "Autonomous robotic laparoscopic surgery for intestinal anastomosis," Science robotics, vol. 7, no. 62, p. eabj2908, 2022. [33] R. S. Sutton and A. G. Barto, Reinforcement learning: An introduction. MIT press, 2018. [34] J. H. Palep, "Robotic assisted minimally invasive surgery," Journal of minimal access surgery, vol. 5, no. 1, p. 1, 2009. [35] S. Leonard, K. L. Wu, Y. Kim, A. Krieger, and P. C. Kim, "Smart tissue anastomosis robot (star): A vision-guided robotics system for laparoscopic suturing," IEEE Transactions on Biomedical Engineering, vol. 61, no. 4, pp. 1305–1317, 2014. [36] C. Packer, K. Gao, J. Kos, P. Kr ̈ahenb ̈uhl, V. Koltun, and D. Song, "As- sessing generalization in deep reinforcement learning," arXiv preprint arXiv:1810.12282, 2018. [37] S. DiMaio, M. Hanuschik, and U. Kreaden, "The da vinci surgical system," Surgical robotics: systems applications and visions, pp. 199– 217, 2011. [38] F. Richter, R. K. Orosco, and M. C. Yip, "Open-sourced reinforce- learning environments for surgical robotics," arXiv preprint ment arXiv:1903.02090, 2019. [39] E. Tagliabue, A. Pore, D. Dall'Alba, M. Piccinelli, and P. Fiorini, "Unityflexml: Training reinforcement learning agents in a simulated surgical environment," in I-RIM Conf., 2020. [40] P. M. Scheikl, B. Gyenes, R. Younis, C. Haas, G. Neumann, M. Wag- ner, and F. Mathis-Ullrich, "Lapgym–an open source framework for reinforcement learning in robot-assisted laparoscopic surgery," arXiv preprint arXiv:2302.09606, 2023. [41] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, et al., "Pytorch: An imperative style, high-performance deep learning library," Advances in neural information processing systems, vol. 32, 2019. [42] M. Macklin, K. Storey, M. Lu, P. Terdiman, N. Chentanez, S. Jeschke, and M. M ̈uller, "Small steps in physics simulation," in Proceedings of the 18th Annual ACM SIGGRAPH/Eurographics Symposium on Computer Animation, pp. 1–7, 2019. [43] R. Bagnara, "A unified proof for the convergence of jacobi and gauss– seidel methods," SIAM review, vol. 37, no. 1, pp. 93–97, 1995. [44] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov, preprint optimization algorithms," arXiv "Proximal arXiv:1707.06347, 2017. policy [45] N. Rudin, D. Hoeller, P. Reist, and M. Hutter, "Learning to walk in minutes using massively parallel deep reinforcement learning," in Conference on Robot Learning, pp. 91–100, PMLR, 2022. [46] J. Schulman, P. Moritz, S. Levine, M. Jordan, and P. Abbeel, "High- dimensional continuous control using generalized advantage estima- tion," arXiv preprint arXiv:1506.02438, 2015. [47] G. Brockman, V. Cheung, L. Pettersson, J. Schneider, J. Schul- man, J. Tang, and W. Zaremba, "Openai gym," arXiv preprint arXiv:1606.01540, 2016. [48] D.-A. Clevert, T. Unterthiner, and S. Hochreiter, "Fast and accurate linear units (elus)," arXiv deep network learning by exponential preprint arXiv:1511.07289, 2015. [49] V. Lim, H. Huang, L. Y. Chen, J. Wang, J. Ichnowski, D. Seita, M. Laskey, and K. Goldberg, "Real2sim2real: Self-supervised learning of physical single-step dynamic actions for planar robot casting," in 2022 International Conference on Robotics and Automation (ICRA), pp. 8282–8289, IEEE, 2022. [50] G. A. Fontanelli, M. Selvaggio, M. Ferro, F. Ficuciello, M. Vendittelli, and B. Siciliano, "A v-rep simulator for the da vinci research kit robotic platform," in 2018 7th IEEE International Conference on Biomedical Robotics and Biomechatronics (Biorob), pp. 1056–1061, IEEE, 2018.
http://arxiv.org/abs/2310.04674v1
"2023-10-07T03:18:26"
"2023-10-07T03:18:26"
Modeling non-uniform uncertainty in Reaction Prediction via Boosting and Dropout
Reaction prediction has been recognized as a critical task in synthetic chemistry, where the goal is to predict the outcome of a reaction based on the given reactants. With the widespread adoption of generative models, the Variational Autoencoder(VAE) framework has typically been employed to tackle challenges in reaction prediction, where the reactants are encoded as a condition for the decoder, which then generates the product. Despite effectiveness, these conditional VAE (CVAE) models still fail to adequately account for the inherent uncertainty in reaction prediction, which primarily stems from the stochastic reaction process. The principal limitations are twofold. Firstly, in these CVAE models, the prior is independent of the reactants, leading to a default wide and assumed uniform distribution variance of the generated product. Secondly, reactants with analogous molecular representations are presumed to undergo similar electronic transition processes, thereby producing similar products. This hinders the ability to model diverse reaction mechanisms effectively. Since the variance in outcomes is inherently non-uniform, we are thus motivated to develop a framework that generates reaction products with non-uniform uncertainty. Firstly, we eliminate the latent variable in previous CVAE models to mitigate uncontrol-label noise. Instead, we introduce randomness into product generation via boosting to ensemble diverse models and cover the range of potential outcomes, and through dropout to secure models with minor variations. Additionally, we design a ranking method to union the predictions from boosting and dropout, prioritizing the most plausible products. Experimental results on the largest reaction prediction benchmark USPTO-MIT show the superior performance of our proposed method in modeling the non-uniform uncertainty compared to baselines.
[ "Taicheng Guo", "Changsheng Ma", "Xiuying Chen", "Bozhao Nan", "Kehan Guo", "Shichao Pei", "Nitesh V. Chawla", "Olaf Wiest", "Xiangliang Zhang" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04674v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04674v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "physics.chem-ph" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 4 7 6 4 0 . 0 1 3 2 : v i X r a Preprint. Under review. MODELING NON-UNIFORM UNCERTAINTY IN REAC- TION PREDICTION VIA BOOSTING AND DROPOUT Taicheng Guo1∗, Changsheng Ma2∗, Xiuying Chen2, Bozhao Nan1, Kehan Guo1 Shichao Pei3, Nitesh V. Chawla1, Olaf Wiest1, Xiangliang Zhang1† 1University of Notre Dame, 2King Abdullah University of Science and Technology, 3University of Massachusetts Boston 1{tguo2,bnan,kguo2,nchawla,owiest,xzhang33}@nd.edu, 2{Changsheng.ma, xiuying.chen}@kaust.edu.sa, 3shichao.pei@umb.edu ABSTRACT Reaction prediction has been recognized as a critical task in synthetic chemistry, where the goal is to predict the outcome of a reaction based on the given reactants. With the widespread adoption of generative models, the Variational Autoencoder (VAE) framework has typically been employed to tackle challenges in reaction prediction, where the reactants are encoded as a condition for the decoder, which then generates the product. Despite effective, these conditional VAE (CVAE) models still fail to adequately account for the inherent uncertainty in reaction pre- diction, which primarily stems from the stochastic reaction process. The principal limitations are twofold. Firstly, in these CVAE models, the prior of generation is independent of the reactants, leading to a default wide and assumed uniform distribution variance of the generated product. Secondly, reactants with analogous molecular representations are presumed to undergo similar electronic transition processes, thereby producing similar products. This hinders the ability to model diverse reaction mechanisms effectively. Chemical reactions are inherently stochas- tic processes. Reactions may have multiple potential pathways leading to different products, and some pathways might be more probable than others, depending on the reactants and condition involved. Since the variance in outcomes is inherently non-uniform, we are thus motivated to develop a framework that generates reaction products with non-uniform uncertainty. Firstly, we eliminate the latent variable sampled from an independent prior in previous CVAE models to mitigate uncontrol- lable noise. Instead, we introduce randomness into product generation via boosting to ensemble diverse models and cover the range of potential outcomes, and through dropout to secure models with minor variations. Additionally, we design a rank- ing method to union the predictions from boosting and dropout, prioritizing the most plausible products. Experimental results on the largest reaction prediction benchmark USPTO-MIT show the superior performance of our proposed method in modeling the non-uniform uncertainty compared to baselines. 1 INTRODUCTION Reaction outcome prediction is one of the fundamental problems in computer-aided organic synthesis. The aim of this task is to predict the most likely products formed given a set of reactants and reagents (Corey & Wipke, 1969; Coley et al., 2017). A number of works have aimed at inferring products from a reaction. These methods can be grouped into two main categorizes: template- based (Segler & Waller, 2017a;b) and template-free (Jin et al., 2017). Template-based methods are typically rule-based and rely heavily on expert knowledge for generalizing reaction patterns and mechanistic pathways. The intense knowledge requirement and the labor-intensive nature of template creation constrain these methods' scalability and adaptability, struggling with novel or unconventional ∗Equal Contribution †Corresponding author. 1 Preprint. Under review. reactions. To tackle this challenge, template-free methods are proposed to leverage deep generative models to predict products from reactants. Traditionally, these template-free methods formulate reaction prediction as graph-level sequential editing or Seq2Seq translation tasks with autoregressive decoding (Coley et al., 2019; Somnath et al., 2021), which poses two major limitations. 1) One failed step in this successive procedure may invalidate the entire prediction (Schwaller et al., 2019; Ucak et al., 2021; Tu & Coley, 2022); and 2) They lack the efficiency of parallel decoding. Hence, a non-autoregressive reaction prediction (NERF) method has been proposed recently (Bi et al., 2021). This method uses Graph Neural Networks and Transformers to predict the redistribution of electrons between the reactants and products. During inference, given the reactants, this method can predict the electron transition matrix, which, when added to the reactant matrix, yields the product matrix. This method has achieved state-of-the-art performance while supporting parallel decoding. Nevertheless, the conditional VAE (CVAE) frame- work employed by NERF fails to adequately ac- count for the inherent non-uniform uncertainty in reaction prediction, especially concerning the variance in the distribution of the generated prod- ucts. Given the intrinsic stochastic nature of chem- ical reactions, multiple potential pathways can ex- ist for the same reactant, each leading to different products. The probability of these pathways can vary significantly as well, depending on the reac- tants and condition involved. Thus the variance in outcomes is inherently non-uniform. Figure 1 shows the examples of reaction with high and low uncertainty. It is evident that, in reactions charac- terized by high uncertainty, the two mechanisms of electron redistribution are substantially different. This creates a unique challenge to strike a balance between extreme and mild variances in outcomes; that is, to handle reactions with lower-level uncertainty effectively while concurrently predicting diverse outcomes accurately for a single reactant in scenarios with high-level uncertainty. Figure 1: Non-uniform uncertainty in chemical reactions. To illustrate this challenge, we present a two-dimensional plot featuring pairs of reactants alongside their corresponding electron redistributions to predict. As shown in Figure 2(a), for identical or similar reactants (sharing the same x-axis coordinate value), the electron redistributions may yield a singular outcome (indicative of low uncertainty) or multiple possibilities (highlighted by samples with varying y-axis coordinate values). A deterministic prediction can only handle a one-to-one mapping between reactants and electron redistribution (see Figure 2(b)). CVAE architectures incorporating an independent prior (unrelated to the reactants) in generation cannot manage non-uniform uncertainties effectively. This leads to incorrect or invalid predictions in cases with low-level uncertainty and a lack of varied predictions in scenarios characterized by high-level uncertainty, as illustrated in Figure 2(c). The optimal mapping function, capable of managing the non-uniform uncertainty depicted in Fig- ure 2(a), should exhibit the following key features: 1) in low uncertainty scenarios, it accurately maps reactants to the singular, predictable outcome; and 2) In high uncertainty scenarios, it predicts a plausible list of products for the given reactant, reflecting the range and diversity in possible electron redistributions. Drawing upon the efficacies of boosting and dropout during inference, as depicted in Figure 2(d-e), our approach integrates Boosting Training and Dropout to respectively manage large and small range uncertainties. Concretely, we first replace the CVAE architecture with a deterministic GNN+Transformer architecture to mitigate the uncontrollable noise that CVAE suffers from. This eliminates noise from independent prior in the decoder during inference, leading to more accurate predictions. Then we employ Boosting Training to decompose the complex reaction mapping to several independent mappings. This is complemented by the application of Dropout, managing the small-range uncertainty, as shown in Figure 2(f). The underlying principle here is that dropout enables the creation of diverse neural networks by allowing a random subset of neurons to be nullified. Each distinct neural network conceived in this manner represents a spectrum of potentialities for electron transition within a smaller range. By integrating Boosting Training and Dropout, we produce an array of model variations, enabling a comprehensive exploration of reaction spaces. A simple ranking method is designed to prioritize most plausible products predicted by the model variations, maintaining an optimal balance between accuracy and diversity in predictions. We summarize our contributions as follows: 2 Preprint. Under review. (a) Reaction Electron Redistribution (b) Deterministic Prediction (c) CVAE (Bi et al., 2021) (d) Boosting (e) Dropout during inference (f) Boosting + Dropout(Our method) Figure 2: (a) Illustrates pairs of reactants with their corresponding electron redistributions to predict. The electron redistributions are illustrated by an atom-atom adjacency matrix; units situated at the (i, j) position are marked in red to denote an electron deletion (bond-breaking), while those in green represent an electron insertion (bond-formation). (b-f) Showcase the mapping functions learned by various methods, with the respective model architectures depicted above ("E" denotes the Encoder and "D" denotes the Decoder. The partially lit model symbol demonstrates the application of dropout). • To the best of our knowledge, we are the first to investigate the issue of non-uniform uncertainty in reaction prediction tasks. This is a distinct and specialized challenge presented to generative models when applying AI to scientific discovery. • We innovatively resolve identified challenges by utilizing boosting and dropout to model varied uncertainties. • Our method's efficacy is validated through experiments on the USPTO-MIT dataset (Jin et al., 2017), demonstrating consistent advancements over existing baselines. 2 RELATED WORK Reaction Prediction: Machine learning methods for reaction prediction can be categorized as template-based and template-free. Template-based methods (Segler & Waller, 2017a;b), although effective, rely heavily on expert knowledge and tend to be less generalizable. Among template-free methods, most solutions are autoregressive methods which either model reactions as a sequence of graph edits (Shi et al., 2020; Coley et al., 2017) or as a seq2seq translation (Liu et al., 2017; Schwaller et al., 2019; Guo et al., 2023). To address the drawbacks of autoregressive generation, the NERF model (Bi et al., 2021) is proposed to model electron redistribution in a non-autoregressive way. ReactionSink (Meng et al., 2023) extends NERF by imposing two essential rules of electron redistribution during generation. Both non-autoregressive methods are based on CVAE architecture and unable to handle the non-uniform uncertainty problem in the reaction prediction. Boosting: In earlier years, boosting has been widely used in machine learning methods such as Adaboost (Schapire, 2013) or Gradient Boosting Decision Tree (Ke et al., 2017), which combine a set of weak models to a single stronger model. During the boosting phase, individual models are 3 Preprint. Under review. trained with varying sample weights, resulting in complementary and diverse models. Unlike prior applications focusing mainly on minimizing the bias error, our motivation is to leverage the model diversity during boosting phase to model the large-range uncertainty in the reaction prediction task. Dropout: Dropout (Srivastava et al., 2014) is a common technique used to improve the generalization of the neural networks. It operates by randomly omitting a unique subset of neurons during each training iteration, preventing the network from becoming overly sensitive to the specific weights of neurons. In our work, we deviate from the conventional motivation behind Dropout. We utilize the variability induced by selecting different neuron subsets through Dropout to model the small-range uncertainty present in the reaction prediction task. Thus, contrasting with conventional approaches that implement Dropout exclusively during training, we incorporate it during the inference phase. This approach facilitates the construction of slightly divergent models in each sampling process, allowing us to explore subtle differences in the predicted outcomes. 3 THE PROPOSED SOLUTION 3.1 NOTATIONS AND PROBLEM DEFINITION Following the definition of previous reaction prediction methods (Bi et al., 2021), we formulate the reaction prediction as a transformation from reactants Gr = (V r, Er) to products Gp = (V p, Ep). V r and V p denote the atoms, and Er and Ep denote the number of shared electrons between atoms in the reactants and products, respectively. For example, Eij denotes the number of shared electrons (1 denotes the single bond and 2 denotes the double bond) between atom i and atom j. The aim of the reaction prediction task is to learn a function f that can predict the potential product list P given the reactants Gr. The ground-truth product Gp should be at the top of the predicted product list P . 3.2 CVAE WITHOUT INDEPENDENT PRIOR As discussed earlier, the CVAE architecture falls short in accounting for the non-uniform uncertainty in reaction prediction. To address this, we first discard the prior sampling process and retain only the Encoder-Decoder part (see Figure 2b). The Encoder can be implemented by Graph Neural Networks (GNN) (Scarselli et al., 2008) to capture the local dependency between atoms in Gr, followed by a Transformer (Vaswani et al., 2017) to model the long-range dependency between atoms. After encoding, the reactants Gr are represented by vector hr. Note that the latent variable sampled from an independent prior is omitted. hr = Transformer-Encoder(GNN(Gr)) (1) Thus, only hr is fed to the Decoder for product prediction. Following the setting in NERF, Point- erNet (Vinyals et al., 2015) is employed to compute the probabilities of an electron flow between atoms. Based on the Octet Rule, the number of active valence electrons in an atom is generally at most 8. Therefore, 16 independent PointerNets are used to compute the attention weights between atoms to represent the BondFormation w(+d) , where wij denotes the attention weights (i.e. probability of an electron flow from i to j), and d = 1, 2, * * * , 8. The values w(+d) ij and BondBreaking w(−d) are all between 0 and 1. , w(−d) ij ij ij w(+d) ij = PointerNet + d (hr, i, j) , d ∈ 1, 2, * * * , 8; w(−d) ij = PointerNet − d (hr, i, j) , d ∈ 1, 2, * * * , 8 (2) Based on the BondFormation w(+d) and BondBreaking w(−d) reactants and products denoted by ∆wij can be calculated by: ij ij , the overall bond changes between ∆wij = 8 (cid:88) d=1 w(+d) ij − 8 (cid:88) d=1 w(−d) ij . 4 (3) Preprint. Under review. Figure 3: The overall framework. The application of dropout is illustrated by partial lighting. Adding ∆wij to the reactant edges Er, we can obtain the predicted product edges ˆEp. Since the prior has been removed, the overall loss is defined only for product prediction (no KL-divergence): (cid:88) (cid:16) L = (i,j)∈Ep Ep ij − ˆEp ij (cid:17)2 . (4) 3.3 BOOSTING After removing the prior, CVAE becomes a deterministic model. It is thus necessary to introduce appropriate randomness for generation purpose. As shown in Figure 3, Boosting and Dropout techniques are integrated to manage the non-uniform uncertainty in generation. In this section, we will introduce the design of the boosting strategy in the training phase and inference phase. 3.3.1 BOOSTING IN TRAINING PHASE The key to designing the boosting strategy is to build a set of models F = {f1, f2, . . . , fn} that are diverse and able to cover the large-range uncertainty. Warm-start. Before launching the boosting training, we prepare the encoder-decoder network through a warm-up phase, in which the model is trained for several iterations utilizing the entire training dataset. This warm-start phase is crucial to ensure that the models, when engaged in boosting training, are proficient in recognizing and applying basic reaction prediction transformations. Consequently, this ensures that the predictive capabilities of all models fi are maintained at a satisfying level. Recording. Inspired by Adaboost (Schapire, 2013), we train the model by different subsets of training data in each boosting iteration to obtain a set of diverse models. In traditional Adaboost iterations, the method discriminates between correctly classified and misclassified samples, elevating the weights of the misclassified and reducing those of the correctly classified for the next iteration. However, within our context of reaction prediction, the output from each model is interpreted as a predicted product, which is incompatible with the approach of adjusting sample weights for upcoming iterations prevalent in classification tasks. Therefore, we modify the soft-sampling by weights typically seen in traditional Adaboost and employ hard-sampling instead. Any samples predicted correctly are omitted from the sample pool in the following iteration. Consequently, we maintain a record of samples accurately predicted after each iteration, Correcti = {(Gr, Gp) ∈ Di | L(Gr, Gp) ≤ δ} (5) 5 Preprint. Under review. where Di = {(Gr n)} is the training set in the ith iteration, L(Gr, Gp) is the loss of the sample, and δ is for determining the prediction correctness (empirically set to 1e-3). 2), . . . , (Gr 1), (Gr n, Gp 1, Gp 2, Gp Training Set Updating. Given the unstable performance of the generative model, we assess the "correctness" of predictions on a single sample across t iterations, instead of basing our judgment on a single iteration. A sample is only excluded from the training set if it is consistently correctly predicted over the t iterations: Di+1 = Di − (Correcti ∩ Correcti−1 ∩ * * * ∩ Correcti−t+1) (6) where Di+1 denotes the training set used for the next iteration, Di is the training set of cur- rent iteration (i.e., ith iteration). During updating, we also save the current model fi and add it to the final set of models F . Additionally, we store the correct training data S = (Correcti ∩ Correcti−1 ∩ * * * ∩ Correcti−t+1) for future usage. Termination. Boosting training continues until it reaches the maximum iteration. The model list F and the corresponding training set S are then obtained. For each sample in S, we then identify an fi that can accurately process it. This association between samples and models is represented as τ . Major Model Training. The models within F exhibit substantial diversity, each tailored to predict specific subsets of samples, leading to compromised generalization on unseen datasets. To counteract this, we train a Major Model, fmajor, by utilizing the entirety of the data until convergence, aiming to encapsulate all electron redistribution patterns. While it excels in generalization ability due to its comprehensive learning scope, fmajor tends to lack in diversity. Consequently, fmajor serves as a complementary entity to the boosting models in F , enhancing the overall generalization capabilities. 3.3.2 SIMILARITY GATING In this section, we outline our methodology to route test reactants to the appropriate models in F during inference. Unlike the original boosting method intended for classification or regression where outputs are numerical, our scenario necessitates product lists. Thus, our gating method ensures test reactants align with suitable models, prioritizing the ground truth product. Illustrated in Figure 3, we implement a similarity gating module during sampling, hypothesizing molecules with akin properties share analogous reaction mechanisms and, hence, fit similar prediction models. For each test reactant Gr, Tanimoto Similarity (Bajusz et al., 2015) of the Morgan Fingerprint (Capec- chi et al., 2020) (radius=2) computes the molecular scaffold similarity between Gr and all training samples in S. Subsequently, the Top-N most analogous training molecules to the test reactants are selected, denoted as T opN . Reactants-to-models mapping obtained earlier τ then determines corre- sponding models fi for each reactant in T opN , returning them in descending order of occurrence for subsequent prediction phase. 3.4 DROPOUT DESIGN The boosting stage generates a suite of diversified models capable of addressing extensive-range uncertainties; however, each fi remains deterministic. To manage finer, small-range uncertainties, we integrate the dropout technique. Initially deployed to regulate deep neural network training, prior dropout studies (Srivastava et al., 2014) mainly focus on its regularization and consistency during training for deterministic tasks. We propose a different approach, hypothesizing that dropout at each iteration yields subtly variant neural network weights and, consequently, differing attention weights between atoms, capturing fine-grained uncertainties in electron redistribution during reactions. This contrasts previous works in reaction prediction, which model uncertainty explicitly through classifier probabilities or latent variables. We suggest utilizing dropout during inference to model the intricate uncertainties inherent in chemical reactions. We now delve into the specifics of our approach. What to drop. We directly incorporate the dropout layer from the NERF model, applying dropout to the GNN encoder for molecules and the self-attention layer of the Transformer Encoder. This strategy ensures the most important neural network weights are subject to dropout. When to drop. Different from the NERF model, which only uses dropout during training, we additionally apply dropout during inference. This modification implies that the outputs from the same model may vary with each inference iteration. 6 Preprint. Under review. How to drop. Dropout is activated during inference. Given that the dropout layers are influenced by the random seed, we alter the random seed for each inference iteration to introduce variability in the predictions. This process repeats 10 times to generate the list of predicted products for each model. 3.5 RANKING IN THE FINAL PREDICTION PHASE In the final-stage determination of the product for a given reactant, we utilize the models fi as selected by the similarity gating method (refer to Section 3.3.2), along with the Major Model fmajor. Each produces predictions without dropout once and with dropout 10 times. The aggregate of these predictions is diverse, varying in reliability and accuracy. Different from the original boosting method which applies a weighted sum to the prediction of each model to get one single predicted value, our model generates a number of product candidates that need to be ranked to move the most likely product candidates to the front of the list. The ranking of product candidates is determined based on the positional order of the prediction models fi. As explained in Section 3.3.2, the selected fi are ordered according to the count of training molecules in T opN associated with them. For each time of dropout, the potential product list is updated by including the ranked candidates. 4 EXPERIMENTS 4.1 EXPERIMENT SETTINGS Datasets and preprocessing. Same as most previous work (Coley et al., 2019; Schwaller et al., 2019), we evaluate our method on the current largest public reaction prediction dataset USPTO-MIT (Jin et al., 2017), which removes duplicates and erroneous reactions from the original data proposed by (Lowe, 2012). There are 479K reactions in this dataset. Follow the preprocessing of the NERF method (Bi et al., 2021), 0.3% of the USPTO-MIT reactions do not satisfy the non-autoregressive learning settings. Thus we also remove such reactions from both training and testing and subtract the predictive top-k accuracy by 0.3% as the final accuracy of our model. Implementation details. We implement our model by Pytorch (Paszke et al., 2019) and conduct all the experiments on a Linux server with GPUs (4 Nvidia V100). As we mentioned in Section 3.2, we reuse the encoder and decoder architectures from the NERF model. To ensure a fair comparison to previous non-autoregressive methods, we follow the same detailed settings as the previous model. We set the number of self-attention layers in the Transformer encoder and decoder to 6, and the number of attention heads is 8. We also set the node embedding dimension to 256 and use the AdamW optimizer (Loshchilov & Hutter, 2017) at a learning rate 10−4 with linear warmup and learning rate decay. For the boosting training, we set the maximum boosting training iteration to 100 and the update interval t to 2. For the similarity gating, we set the N to 10 for selecting T opN . The implementation code will be made publicly available upon the acceptance of the paper. Evaluation metrics. Following (Coley et al., 2019; Schwaller et al., 2019; Bi et al., 2021; Meng et al., 2023), we use the Top-K accuracy to evaluate the performance of our model and baselines. The Top-K accuracy measures the percentage of reactions that have the ground-truth product in the top-K predicted products. Following the previous setting, the K is set as: {1, 2, 3, 5, 10}. For test reactants that have more than two products in the USPTO-MIT dataset, we assess prediction performance by calculating the reactant-wise HitRate, which is the percentage of products appearing in the predicted products that are also in the ground truth. It also means how many of the multiple ground truth products are correctly identified by the model among its predictions. 4.2 BASELINES We compare our method with the following baselines which are classified into four categories: Template-based. Symbolic (Qian et al., 2020) introduces symbolic inference which is based on chemical rules to the neural network to do reaction prediction. Two-Stage. WLDN (Jin et al., 2017) firstly recognizes a group of reaction centers and corresponding bond configurations and then ranks them to obtain the final potential products. 7 Preprint. Under review. Table 1: The Top-K Accuracy % on the USPTO-MIT dataset. † indicates that the results are copied from the corresponding papers. "Parallel" indicates whether the model can perform parallel decoding. "Data Augmentation" indicates whether the model is trained by the augmented dataset. The best results are in bold font. Category Template-based Two-stage Autoregressive Non-autoregressive Model Symbolic † WLDN † GTPN † MT-base † MEGAN † Chemformer † Sub-reaction † Graph2Smiles † MT † AT ×100† ReactionSink 1 NERF Our method + NERF Top-1 90.4 79.6 83.2 88.8 89.3 91.3 91.0 90.3 90.4 90.6 91.3 90.7 91.5 Top-2 93.2 - - 92.6 92.7 - - - 93.7 94.4 93.3 92.3 93.6 Top-3 94.1 87.7 86.0 93.7 94.4 - 94.5 94.0 94.6 - 94.0 93.3 94.4 Top-5 95.0 89.2 86.5 94.4 95.6 93.7 95.7 94.8 95.3 96.1 94.5 93.7 95.1 Top-10 - - - 94.9 96.7 94.0 - 95.3 - - 94.9 94.0 95.6 Parallel Data Augmentation ✓ ✓ × × × × × × × × ✓ ✓ ✓ × × × × × × × × ✓ ✓ × × × Autoregressive. GTPN (Do et al., 2019) converts the reaction prediction problem as a sequence of graph transformations problem and then applies policy networks to learn such transformations; MT-based (Schwaller et al., 2019) treats the reaction prediction problem as a machine translation task from the reactants SMILES strings to products SMILES strings and applies transformer-based modeling; MEGAN (Sacha et al., 2021) models reaction prediction as a graph editing task and predicts the edit sequences autoregressively; MT (Schwaller et al., 2019) is based on MT-base and additionally apply data augmentation techniques on the SMILES; Chemformer (Irwin et al., 2022) is also a transformer-based model and it additionally pretrains the SMILES encoder with three self- supervised tasks; Sub-reaction (Fang et al., 2022) achieves the substructure-aware reaction prediction via modeling the motif of the molecule graphs; Graph2Smiles (Tu & Coley, 2022) combines the graph encoder and transformer encoder to achieve permutation-invariance encoding of molecule graphs in the reaction prediction; AT × 100 (Tetko et al., 2020) is also based on transformer and applies more data augmentations on SMILES. Non-autoregressive. NERF (Bi et al., 2021) is the first to model reaction prediction in a non- autoregressive way; ReactionSink (Meng et al., 2023) is based on NERF and integrates two essential chemical rules of electron redistribution to NERF via Sinkhorn's algorithm. Both of them are based on the CVAE architecture and leverage the latent variable of a prior to introduce randomness, leaving the non-uniform uncertainty of the reaction prediction out of consideration. 4.3 OVERALL PERFORMANCE The overall performance measured by Top-K accuracy is reported in Table 1. We can see that our method improves the NERF model, resulting in the highest Top-1 to Top-10 accuracy. The top-1 accuracy of our method is 91.5%, which is higher than all other non-autoregressive and autoregressive models. This indicates that removing prior in our method can help avoid introducing noise latent variable compared to the original NERF model, thus enforcing the model to fit the dataset better. The Top-2 to Top-10 accuracy of our method is consistently higher than all other non-autoregressive models and competitive with autoregressive models. When considering top-2 and top-3 accuracy, our method is higher than all autoregressive models without data augmentation. This demonstrates that our method can help generate diverse products while achieving precise Top-1 prediction. It is worth to mention that the computational efficiency of our method is nearly the same as the NERF model and better than another non-autoregressive method ReactionSink. 4.4 ABLATION STUDIES To further investigate the effect of each component of our method, we conduct ablation studies. The results are shown in Table 2. We can observe that removing prior can have better Top-1 accuracy than with it but lose diversity. To introduce diversity, we apply boosting training and dropout strategies and the performance of these two strategies is better than the original NERF model. The performance of 1Our method can be also applied to ReactionSink. Due to no open source code and the instability of ReactionSink, we haven't tested our method with it. We will test this once the code of ReactionSink is released. 8 Preprint. Under review. (a) Percentage of different groups (b) HitRate of different groups Figure 4: The Percentage and Hitrate of test reactions grouped by the number of predicted products. the combination of these three strategies is the best. This demonstrates that each strategy is beneficial to the model and they can compensate each other and help achieve better performance. Table 2: The impact of Removing prior, Boosting, Dropout, and the combination of these three strategies for the USPTO-MIT dataset. The unsolvable case is indicated by -. Model Name NERF Removing prior of NERF Removing prior + Boosting Removing prior + Dropout Removing prior + Boosting + Dropout Top-1 Top-2 Top-3 Top-5 Top-10 93.3 90.7 91.5 - 91.5 93.9 91.5 93.7 94.4 91.5 92.3 - 93.4 93.0 93.6 94.0 - 94.2 94.2 95.6 93.7 - 94.2 94.1 95.1 4.5 THE DISTRIBUTION OF PREDICTED PRODUCTS We also investigate whether our method can help generate a more precise set of plausible products compared to NERF. For the test set, we group the reactions by the number of predicted products and compute the percentage and HitRate (how many ground-truth products are identified in the predicted products) for each group. Figure 4(a) shows that our method predicts more accurate plausible products compared to NERF, aligning more closely with the real-world scenario where the quantity of plausible products adheres to a power-law distribution. The HitRate of our method for each group (in Figure 4(b)) is higher than that of the NERF model, indicating our method can generate more precise products. 4.6 THE UTILIZATION DISTRIBUTION OF BOOSTING MODELS Since we have many model variants produced by boosting training, we evaluate the utilization of each boosting model by calculating the percentage of test samples each infers. As shown in Figure 5, we observe that except for the last model-88, the utilization percentage of most models is around 2%, indicating the boosting models are load balanced. The percentage of model-88 is high mainly because at the end of boosting training, all remaining training reactions are associated with this model which is more easily to be selected by similarity gating. Figure 5: Utilization distribution of boosting models. 4.7 EVALUATION ON MULTI-SELECTIVITY REACTIONS We finally evaluate our method on test reactants with multi-selectivity reactions. To simplify, we select the reactants that have more than two products in the USPTO-MIT dataset and compute the reactant-wise HitRate. Note that a higher HitRate would indicate that a higher percentage of the actual (ground truth) products are being correctly predicted. As shown in Table 3, we can see that 9 Preprint. Under review. our method has a higher HitRate than the NERF model, confirming that our method has enhanced capability for predicting multi-selectivity reactions. Table 3: The HitRate of our method and NERF model in multi-selectivity reactions. Model Name NERF Our method + NERF HitRate@2 HitRate@3 HitRate@5 HitRate@10 0.305 0.315 0.312 0.338 0.315 0.348 0.315 0.358 5 CONCLUSION Reaction Prediction task is a fundamental and challenging task. In this paper, we first identify the non-uniform uncertainty problem in the reaction prediction which is ignored by all previous non-autoregressive methods. To tackle this challenge, we replace the common generation CVAE architecture with a well-designed generation framework via Boosting and Dropout. Boosting training can obtain large-difference models to capture the large-range uncertainty while dropout can obtain small-different models to capture the small-range uncertainty. We also designed a simple ranking method to rank the predicted products of boosting and dropout to ensure the predicted products are as precise as possible. Experiment results show our model can consistently outperform the baselines. REFERENCES D ́avid Bajusz, Anita R ́acz, and K ́aroly H ́eberger. Why is tanimoto index an appropriate choice for fingerprint-based similarity calculations? Journal of cheminformatics, 7(1):1–13, 2015. Hangrui Bi, Hengyi Wang, Chence Shi, Connor Coley, Jian Tang, and Hongyu Guo. Non- autoregressive electron redistribution modeling for reaction prediction. In International Conference on Machine Learning, pp. 904–913. PMLR, 2021. Alice Capecchi, Daniel Probst, and Jean-Louis Reymond. One molecular fingerprint to rule them all: drugs, biomolecules, and the metabolome. Journal of cheminformatics, 12(1):1–15, 2020. Connor W Coley, Regina Barzilay, Tommi S Jaakkola, William H Green, and Klavs F Jensen. Prediction of organic reaction outcomes using machine learning. ACS central science, 3(5): 434–443, 2017. Connor W Coley, Wengong Jin, Luke Rogers, Timothy F Jamison, Tommi S Jaakkola, William H Green, Regina Barzilay, and Klavs F Jensen. A graph-convolutional neural network model for the prediction of chemical reactivity. Chemical science, 10(2):370–377, 2019. Elias James Corey and W Todd Wipke. Computer-assisted design of complex organic syntheses: Pathways for molecular synthesis can be devised with a computer and equipment for graphical communication. Science, 166(3902):178–192, 1969. Kien Do, Truyen Tran, and Svetha Venkatesh. Graph transformation policy network for chemical In Proceedings of the 25th ACM SIGKDD international conference on reaction prediction. knowledge discovery & data mining, pp. 750–760, 2019. Lei Fang, Junren Li, Ming Zhao, Li Tan, and Jian-Guang Lou. Leveraging reaction-aware substruc- tures for retrosynthesis analysis. arXiv 2204.05919, 2022. Taicheng Guo, Kehan Guo, Bozhao Nan, Zhenwen Liang, Zhichun Guo, Nitesh V. Chawla, Olaf Wiest, and Xiangliang Zhang. What can large language models do in chemistry? a comprehensive benchmark on eight tasks. arXiv 2305.18365, 2023. Ross Irwin, Spyridon Dimitriadis, Jiazhen He, and Esben Jannik Bjerrum. Chemformer: a pre-trained transformer for computational chemistry. Machine Learning: Science and Technology, 3(1): 015022, 2022. Wengong Jin, Connor Coley, Regina Barzilay, and Tommi Jaakkola. Predicting organic reaction outcomes with weisfeiler-lehman network. Advances in neural information processing systems, 30, 2017. 10 Preprint. Under review. Guolin Ke, Qi Meng, Thomas Finley, Taifeng Wang, Wei Chen, Weidong Ma, Qiwei Ye, and Tie-Yan Liu. Lightgbm: A highly efficient gradient boosting decision tree. Advances in neural information processing systems, 30, 2017. Bowen Liu, Bharath Ramsundar, Prasad Kawthekar, Jade Shi, Joseph Gomes, Quang Luu Nguyen, Stephen Ho, Jack Sloane, Paul Wender, and Vijay Pande. Retrosynthetic reaction prediction using neural sequence-to-sequence models. ACS central science, 3(10):1103–1113, 2017. Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. Daniel Mark Lowe. Extraction of chemical structures and reactions from the literature. PhD thesis, University of Cambridge, 2012. Ziqiao Meng, Peilin Zhao, Yang Yu, and Irwin King. Doubly stochastic graph-based non- autoregressive reaction prediction. arXiv preprint arXiv:2306.06119, 2023. Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32, 2019. Wesley Qian, Nathan Russell, Claire Simons, Yunan Luo, Martin Burke, and Jian Peng. Integrating deep neural networks and symbolic inference for organic reactivity prediction. 10.26434/chem- rxiv.11659563, 2020. Mikołaj Sacha, Mikołaj Błaz, Piotr Byrski, Paweł Dabrowski-Tumanski, Mikołaj Chrominski, Rafał Loska, Paweł Włodarczyk-Pruszynski, and Stanisław Jastrzebski. Molecule edit graph atten- tion network: modeling chemical reactions as sequences of graph edits. Journal of Chemical Information and Modeling, 61(7):3273–3284, 2021. Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE transactions on neural networks, 20(1):61–80, 2008. Robert E Schapire. Explaining adaboost. In Empirical Inference: Festschrift in Honor of Vladimir N. Vapnik, pp. 37–52. Springer, 2013. Philippe Schwaller, Teodoro Laino, Th ́eophile Gaudin, Peter Bolgar, Christopher A Hunter, Costas Bekas, and Alpha A Lee. Molecular transformer: a model for uncertainty-calibrated chemical reaction prediction. ACS central science, 5(9):1572–1583, 2019. Marwin HS Segler and Mark P Waller. Modelling chemical reasoning to predict and invent reactions. Chemistry–A European Journal, 23(25):6118–6128, 2017a. Marwin HS Segler and Mark P Waller. Neural-symbolic machine learning for retrosynthesis and reaction prediction. Chemistry–A European Journal, 23(25):5966–5971, 2017b. Chence Shi, Minkai Xu, Hongyu Guo, Ming Zhang, and Jian Tang. A graph to graphs framework for retrosynthesis prediction. In International conference on machine learning, pp. 8818–8827. PMLR, 2020. Vignesh Ram Somnath, Charlotte Bunne, Connor Coley, Andreas Krause, and Regina Barzilay. Learning graph models for retrosynthesis prediction. Advances in Neural Information Processing Systems, 34:9405–9415, 2021. Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929–1958, 2014. Igor V Tetko, Pavel Karpov, Ruud Van Deursen, and Guillaume Godin. State-of-the-art augmented nlp transformer models for direct and single-step retrosynthesis. Nature communications, 11(1): 5575, 2020. 11 Preprint. Under review. Zhengkai Tu and Connor W Coley. Permutation invariant graph-to-sequence model for template-free retrosynthesis and reaction prediction. Journal of chemical information and modeling, 62(15): 3503–3513, 2022. Umit V Ucak, Taek Kang, Junsu Ko, and Juyong Lee. Substructure-based neural machine translation for retrosynthetic prediction. Journal of cheminformatics, 13:1–15, 2021. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz In Advances in Neural Information Kaiser, and Illia Polosukhin. Attention is all you need. Processing Systems, volume 30, 2017. Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. Advances in neural information processing systems, 28, 2015. 12
http://arxiv.org/abs/2310.04673v3
"2023-10-11T02:55:54"
"2023-10-07T03:17:59"
LauraGPT: Listen, Attend, Understand, and Regenerate Audio with GPT
Generative Pre-trained Transformer (GPT) models have achieved remarkable performance on various natural language processing tasks. However, there has been limited research on applying similar frameworks to audio tasks. Previously proposed large language models for audio tasks either lack sufficient quantitative evaluations, or are limited to tasks for recognizing and understanding audio content, or significantly underperform existing state-of-the-art (SOTA) models. In this paper, we propose LauraGPT, a unified GPT model for audio recognition, understanding, and generation. LauraGPT is a versatile language model that can process both audio and text inputs and generate outputs in either modalities. It can perform a wide range of tasks related to content, semantics, paralinguistics, and audio-signal analysis. Some of its noteworthy tasks include automatic speech recognition, speech-to-text translation, text-to-speech synthesis, machine translation, speech enhancement, automated audio captioning, speech emotion recognition, and spoken language understanding. To achieve this goal, we use a combination of continuous and discrete features for audio. We encode input audio into continuous representations using an audio encoder and decode output audio from discrete codec codes. We then fine-tune a large decoder-only Transformer-based language model on multiple audio-to-text, text-to-audio, audio-to-audio, and text-to-text tasks using a supervised multitask learning approach. Extensive experiments show that LauraGPT achieves competitive or superior performance compared to existing SOTA models on various audio processing benchmarks.
[ "Jiaming Wang", "Zhihao Du", "Qian Chen", "Yunfei Chu", "Zhifu Gao", "Zerui Li", "Kai Hu", "Xiaohuan Zhou", "Jin Xu", "Ziyang Ma", "Wen Wang", "Siqi Zheng", "Chang Zhou", "Zhijie Yan", "Shiliang Zhang" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04673v3", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04673v3", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.SD", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.SD", "cs.AI", "cs.LG", "cs.MM", "eess.AS" ]
3 2 0 2 t c O 1 1 ] D S . s c [ 3 v 3 7 6 4 0 . 0 1 3 2 : v i X r a Preprint. Under review. LAURAGPT: LISTEN, ATTEND, UNDERSTAND, AND RE- GENERATE AUDIO WITH GPT Jiaming Wang†, Zhihao Du†, Qian Chen, Yunfei Chu, Zhifu Gao, Zerui Li, Kai Hu, Xiaohuan Zhou, Jin Xu, Ziyang Ma, Wen Wang, Siqi Zheng, Chang Zhou, Zhijie Yan, Shiliang Zhang‡∗ Damo Academy, Alibaba Group, China {wangjiaming.wjm,neo.dzh,sly.zsl}@alibaba-inc.com ABSTRACT Generative Pre-trained Transformer (GPT) models have achieved remarkable per- formance on various natural language processing tasks. However, there has been limited research on applying similar frameworks to audio tasks. Previously pro- posed large language models for audio tasks either lack sufficient quantitative evaluations, or are limited to tasks for recognizing and understanding audio con- tent, or significantly underperform existing state-of-the-art (SOTA) models. In this paper, we propose LauraGPT, a unified GPT model for audio recognition, understanding, and generation. LauraGPT is a versatile language model that can process both audio and text inputs and generate outputs in either modalities. It can perform a wide range of tasks related to content, semantics, paralinguistics, and audio-signal analysis. Some of its noteworthy tasks include automatic speech recog- nition, speech-to-text translation, text-to-speech synthesis, machine translation, speech enhancement, automated audio captioning, speech emotion recognition, and spoken language understanding. To achieve this goal, we use a combination of continuous and discrete features for audio. We encode input audio into continuous representations using an audio encoder and decode output audio from discrete codec codes. We then fine-tune a large decoder-only Transformer-based language model on multiple audio-to-text, text-to-audio, audio-to-audio, and text-to-text tasks using a supervised multitask learning approach. Extensive experiments show that LauraGPT achieves competitive or superior performance compared to existing SOTA models on various audio processing benchmarks. 1 INTRODUCTION One of the main goals of artificial intelligence (AI) research is to achieve artificial general intelligence (AGI), which is the hypothetical ability of a machine to perform any intellectual task that a human can do. A popular approach to pursue this goal is to use large language models (LLMs), which are neural networks that generate natural language texts based on a given context. LLMs can learn from massive amounts of text data and mimic human language to acquire most human knowledge. LLMs such as GPT-4 (OpenAI, 2023), PaLM2 (Anil et al., 2023), LLaMA (Touvron et al., 2023) have demonstrated impressive capabilities across various domains, exhibiting zero-shot generalization without the need for task-specific fine-tuning. However, these models are primarily limited to processing text data. Text and audio are two important modalities for human communications. Recent research aims to create a seamless integration of text and audio through a unified audio-text model that can handle various tasks within and across these modalities. However, existing approaches have limitations in terms of model architecture, data representation, and task coverage. One category of existing approaches employs an encoder-decoder architecture that converts continu- ous speech features into discrete text tokens, such as Whisper (Radford et al., 2022) and USM (Zhang et al., 2023b). These models can perform multilingual automatic speech recognition (ASR) and speech-to-text translation (S2TT) with a single model, leveraging large-scale paired speech-text ∗† equal contribution. ‡ correspondence author. 1 Preprint. Under review. data. However, these models cannot generate speech outputs from text tokens, which restricts their applications for speech generation tasks such as text-to-speech synthesis (TTS). Another category of existing approaches adopts a decoder-only framework after converting continuous audio into discrete tokens and merging text and audio tokens into a shared vocabulary, such as VioLA (Wang et al., 2023b) and AudioPaLM (Rubenstein et al., 2023). These models can perform ASR, TTS, S2TT, machine translation (MT), and speech-to-speech translation (S2ST) tasks with a single model, enabling a more natural and flexible interaction between text and audio. They can generate speech outputs from text or speech inputs by using codec-based discrete features (Zeghidour et al., 2022; Défossez et al., 2022). However, they may suffer from the information loss caused by the quantization of speech signals into discrete tokens, which leads to significant performance degradation over models using continuous speech features. Moreover, while capable of supporting content/semantics-oriented speech tasks, they cannot handle speech-signal-processing related tasks such as speech enhancement (SE) or general audio tasks such as automated audio captioning (AAC). In this paper, we propose a novel unified audio-text LLM that overcomes these limitations of the existing approaches. Our model adopts a decoder-only Transformer framework, which offers enhanced simplicity and generality compared to the Transformer encoder-encoder framework. We introduce a unique data representation that combines the strengths of both continuous and discrete representations of audio signals. Specifically, we use continuous features to represent the input audio, which ensures performance of audio comprehension tasks, and use codec-based discrete features to represent the output audio, which enables joint autoregressive modeling with text features for audio generation tasks. Experimental results reveal that continuous features for audio (such as Filterbank) have notable advantages over discrete units on audio recognition, understanding, and audio-signal related tasks, such as ASR, S2TT, and SE. Overall, our model achieves a better trade-off over existing approaches between model uniformity and high performance on diverse categories of audio tasks. Our paper makes three main contributions 1: • We propose LauraGPT, a unified audio-text LLM under the GPT framework, which uses a novel data representation that combines continuous and discrete features for audio signals. This data representation preserves both fidelity and generality of audio data and enables joint modeling with text features. • We conduct multi-task fine-tuning of our unified model on diverse audio tasks. Specifically, we reformulate speech-signal-related tasks such as speech enhancement and paralinguistics-centered tasks such as speech emotion recognition (SER) as sequence-to-sequence modeling. Further- more, we extend our model to support general audio tasks such as automated audio captioning and semantics-oriented tasks such as spoken language understanding (SLU). To the best of our knowledge, our single model supports the largest number of and most diverse audio processing tasks among existing unified audio-text models that focus on audio recognition, understanding, and generation. • We conduct extensive experiments on multiple benchmarks and show that our proposed LauraGPT trained with open source data achieves competitive or superior performance compared to SOTA models. Our model effectively strikes a balance between model uniformity and performance on diverse audio processing tasks. 2 RELATED WORK 2.1 UNIFIED AUDIO-TEXT MODELING Existing works on unified audio-text modeling can be categorized into four groups: (1) self-supervised learning of a universal audio encoder, (2) encoder-decoder models with modal-specific pre-nets and post-nets, (3) models converting audio features to text, and (4) decoder-only models with discrete audio tokens. The first group of works, such as wav2vec 2.0 (Baevski et al., 2020), HuBERT (Hsu et al., 2021), and WavLM (Chen et al., 2022), can leverage unlabeled speech data for pre-training, but they require additional task-specific models for downstream audio tasks. The second group, such as SpeechT5 (Ao et al., 2022) and SpeechNet (Chen et al., 2021b), can perform various speech tasks with a single model, but they need to employ modal-specific pre-nets and post-nets to handle different input/output modalities. The third group, such as Whisper (Radford et al., 2022), USM (Zhang et al., 1Demos are available at https://lauragpt.github.io 2 Preprint. Under review. 2023b), and Pengi (Deshmukh et al., 2023), focus on converting continuous speech features into text, but they cannot support audio generation tasks. The fourth group, such as VioLA (Wang et al., 2023b), AudioPaLM (Rubenstein et al., 2023), SpeechGPT (Zhang et al., 2023a) and SpeechGen (Wu et al., 2023), use decoder-only Transformers to model discrete audio tokens and text tokens as a shared vocabulary, but they may suffer from the information loss caused by the quantization of audio signals into discrete tokens. Table 1 compares our LauraGPT against the most related works, which, similar to LauraGPT, are all multi-task unified audio-text models. Distinct from unified audio-text modeling, some studies integrate expert audio models with LLMs to enable direct audio interaction with LLMs, such as HuggingGPT (Shen et al., 2023) and AudioGPT (Huang et al., 2023b); however these models have high complexity, resource consumption, and error accumulation. Table 1: Comparisons with the most related multi-task unified audio-text models. SpeechT5 Whisper VioLA AudioPaLM LauraGPT(Ours) Date Organization Model Size Pair Data (hrs) Unsup. Pretrain Audio Input Audio Output Languages ASR S2TT TTS MT SE AAC SER SLU 2021.10 Microsoft 0.14B 0.96K N/A 2022.12 OpenAI 1.5B 680K N/A Continuous Continuous N/A EN ✓ ✓ ✓ ✗ ✓ ✗ ✗ ✗ N/A 99 ✓ ✓ ✗ ✗ ✗ ✗ ✗ ✗ 2023.5 Microsoft 0.25B 79K N/A Discrete Discrete EN/CN ✓ ✓ ✓ ✓ ✗ ✗ ✗ ✗ 2023.6 Google 8B 48K PaLM-2 Discrete Discrete 113 ✓ ✓ ✓ ✓ ✗ ✗ ✗ ✗ 2023.9 Ours 2.0B 60K Qwen-2B Continuous Discrete EN/CN ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ 2.2 AUDIO GENERATION FROM TEXT PROMPTS Two prominent categories of approaches have emerged recently for generating audio signals from text prompts. (1) In the first category, continuous representations such as utterance-level embed- dings (Elizalde et al., 2022; Liu et al., 2023; Huang et al., 2023a) and Mel-frequency spectro- grams (Nachmani et al., 2023) are used as the targets. However, continuous representations present a challenge for unified modeling of text and audio within a single language model. (2) In the second category, discrete codec tokens are employed as audio representations and generated by diffusion models (Yang et al., 2023) or autoregressive language models (Kreuk et al., 2023; Borsos et al., 2023; Copet et al., 2023; Wang et al., 2023a). Among them, in models such as AudioGen (Kreuk et al., 2023), AudioLM (Borsos et al., 2023), and MusicGen (Copet et al., 2023), multiple output heads are used after the language model to predict synchronized or delayed groups of codec tokens. However, this approach is only suitable for audio generation and may not be applicable to diverse audio-text tasks. In VALL-E (Wang et al., 2023a), the language model predicts output tokens of the first quantizer, while tokens of the remaining quantizers are predicted by a non-autoregressive model one by one. This mechanism requires numerous prediction procedures to achieve an acceptable quality. Moreover, the indices of the remaining codec groups are challenging to predict due to the multi-modal distribution nature of codec tokens (Jenrungrot et al., 2023). To overcome these challenges, we propose a one-step codec vocoder in our LauraGPT, where a transformer-based predictor is trained to estimate the summation of all codec token groups instead of the multi-group indices, by minimizing the reconstruction losses. Our approach reduces the audio generation process to a single feed-forward calculation and overcomes the prediction challenge arising from the multi-modal distribution nature. 3 METHODOLOGY Figure 1 illustrates an overview of the proposed LauraGPT. LauraGPT comprises three components: a GPT backbone, an audio encoder, and a codec vocoder. For audio inputs, we extract the log- compressed Mel spectrogram features and feed them into the audio encoder, while the audio outputs are discretized into tokens using the audio tokenizer. As for text data, both inputs and outputs are 3 Preprint. Under review. Figure 1: An overview of the proposed LauraGPT model. The right part provides an enlarged view of the Codec Vocoder in LauraGPT. We omit the text tokenizer for simplicity. processed by the text tokenizer. We describe the pre-trained GPT backbone and text tokenizer in Section 3.1 and the audio tokenizer in Section 3.2. Section 3.3 elaborates our modifications made to the GPT backbone to enable unified audio-text modeling. Section 3.4 introduces an efficient and high-quality one-step codec vocoder for converting audio tokens into raw waveforms. Section 3.5 describes our multi-task fine-tuning approach and the paradigm for supporting more complex tasks. 3.1 PRE-TRAINED GPT BACKBONE AND TEXT TOKENIZER We utilize the open-source language model, Qwen (Bai et al., 2023), as the backbone, which is pre-trained on a diverse corpus of 3 trillion tokens covering various domains in English and Chinese. Qwen models are decoder-only transformers equipped with rotary position embedding (RoPE) (Su et al., 2021). Compared with other open-source GPT models of similar model sizes, Qwen models demonstrate strong competitiveness, achieving better performance on widely used benchmarks, especially for Chinese tasks (Bai et al., 2023). To leverage pre-trained Qwen checkpoints, we employ the original Qwen tokenizer, which inherits the fast BPE tokenizer tiktoken from GPT-4 (Jain, 2022) and incorporates additional augmentations for commonly used characters and words in different languages. The text tokenizer has a vocabulary size of approximately 152K. 3.2 AUDIO TOKENIZER Different from text, audio signal is commonly represented as a sequence of continuous features. This poses a challenge when integrating text and audio generation into a single GPT model. To address this challenge, we utilize a codec model as the audio tokenizer to extract discrete representations. Our codec model shares a similar architecture as Encodec (Défossez et al., 2022), which consists of a convolutional recurrent encoder/decoder network (Tagliasacchi et al., 2020) and a residual vector quantizer (RVQ) (Vasuki & Vanathi, 2006). We enhance the original Encodec model with the following modifications. Firstly, we add reconstruction losses in the magnitude spectrum domain to improve the quality of middle-frequency and high-frequency audio. Secondly, to address the challenge of long sequence lengths, we stack five strided convolution blocks with strides of [8, 5, 4, 2, 2], resulting in a token rate of 25 Hz for each group. Thirdly, the RVQ module comprises 32 quantizers with structured dropout, each with a vocabulary size of 1024. This modification improves speech quality with more quantizers, while preserving the most information in the shallow quantizers. The encoder and the first quantizer in RVQ are used as an audio tokenizer, and the outputs of the first quantizer are treated as the audio tokens. Note that the remaining quantizers and the decoder are only used during the training stage. Other details are similar to Du et al. (2023). 3.3 MODIFIED LANGUAGE MODEL FOR UNIFYING AUDIO-TEXT MODELING In text-only GPTs, the tokenized text is first passed through an embedding matrix that converts discrete tokens into dense embeddings. In other speech-text Transformers (Wang et al., 2023b; 4 LauraGPTGPTTextAudioAudioText Codec VocoderSoftmax layerAudio EncoderEmbeddingCodec TokenText/Audio ConditionsTransformerDense EmbeddingDecoderAudioCodec Vocoder Preprint. Under review. Rubenstein et al., 2023), the embedding matrix is augmented with speech tokens to unify speech-text modeling. However, our preliminary experiments revealed that using a single tokenizer to represent diverse audio signals significantly impairs the performance of all audio tasks (see Section 5.2 for more details). Therefore, to strike a balance between uniformity and performance, we use a Conformer- based encoder to convert audio inputs into continuous representations, while the tokenized text inputs continue to undergo embedding matrix transformation to generate dense vectors. The audio representations and text embeddings have the same dimension D. The Conformer-based encoder is initialized with weights from a pre-trained ASR model (Gao et al., 2023). Since batch normalization can lead to endless loop decoding, we replace it with layer normalization in the Conformer-based encoder (see Appendix B.1 for more details). To achieve the goal of unified generation of audio and text, we augment the embedding matrix with codec tokens. The embedding matrix E in the final softmax layer is of size (N + M + L) × D and is utilized to calculate the logits for audio and text tokens at each position. Within E, N embeddings represent text tokens obtained from the Qwen tokenizer, M embeddings are assigned to audio tokens extracted by codec models, and L embeddings are allocated for special tokens (e.g., task IDs) to differentiate between different tasks. To leverage the pre-trained weights, N text-related embeddings are initialized with the Qwen-2B model checkpoint. In contrast, M audio-related embeddings and L special token embeddings are randomly initialized. Based on the aforementioned representations, the Qwen backbone is trained to model various audio/text tasks by minimizing the cross-entropy loss: LLM = − 1 Tv Tv(cid:88) j=1 log pθ (vj|u1, . . . , uTu, utask, v1, . . . , vj−1) (1) where u denotes the input embeddings with a sequence length of Tu. v represents the sequence of target tokens with a length of Tv. To specify a task, a special task-related token utask is inserted between the input embeddings and output tokens. Note that only the losses of outputs are taken into account, while losses on inputs and task embeddings are masked out. After the final output layer, text tokens are converted to the final outputs using the Qwen tokenizer, and audio tokens are decoded to raw waveforms using a codec vocoder, as described in Section 3.4. All model parameters are jointly trained, except for the codec vocoder, which is trained independently and kept frozen during both training and inference stages of LauraGPT. 3.4 ONE-STEP CODEC VOCODER FOR AUDIO GENERATION In LauraGPT, we propose a one-step codec vocoder that generates raw audio signals from the predicted codec tokens. The one-step codec vocoder comprises two components: a transformer-based predictor and a codec decoder. Alongside the predicted codec tokens from the Qwen backbone, text and audio conditions are also concatenated. For instance, the text content serves as a condition for the TTS task, while the noisy speech features are employed as conditions for the SE task. The predictor is trained to estimate the summation of token embeddings in all groups by minimizing the L1 and L2 distances between the predicted embeddings ˆE and their corresponding ground truth E: Lpre = 1 T 1 Dc T (cid:88) Dc(cid:88) t=1 i=1 ||Et,i − ˆEt,i||1 + 0.5 * ||Et,i − ˆEt,i||2 (2) where T denotes the total number of frames, and Dc denotes the dimension of the codec embeddings. After obtaining the estimated embeddings, the decoder of an pre-trained codec model is utilized to reconstruct the raw audio signals. 3.5 MULTI-TASK FINETUNING Basic Tasks In this work, we unify modeling of the following tasks under the GPT framework and use them for multi-task fine-tuning of LauraGPT: Automatic Speech Recognition (ASR), Spoken Language Understanding (SLU), Speech to Text Translation (S2TT), Speech Emotion Recognition (SER), Automated Audio Captioning (AAC), Speech Enhancement (SE), Text-to-speech Synthesis (TTS). Task definitions can be found in Appendix A.1. 5 Preprint. Under review. Unified Task Expression LauraGPT operates based on a unified task expression: input embed- dings, task ID, output tokens. With the same inputs, the desired outputs can differ across tasks. Task-related tokens are included in both the input and output embedding matrices. It is worth noting that in addition to masking out the losses on inputs, the cross-entropy loss at the position of the task token is also masked out. The TTS and SLU tasks take text embeddings as inputs, while the ASR, S2TT, SE, ACC, and SER tasks take audio encodings as inputs. The TTS and SE tasks use the outputs of the first quantizer as the target outputs, while the remaining tasks use text tokens as the target outputs. Support More Complex Tasks With its modular and flexible design, LauraGPT provides an extensible framework to support complex tasks. By breaking a task into sub-tasks among the aforementioned basic tasks and cascading the raw inputs and model outputs of sub-tasks, LauraGPT can perform more complex tasks than the basic tasks. As an example, this paper demonstrates that LauraGPT is capable of performing the advanced task of speech-to-speech translation (S2ST) by combining the S2TT and TTS tasks. Initially, a sequence is constructed to translate the speech content into another language using the S2TT task token: [audio embedding, <S2TT>]. Subsequently, the translated text is combined with the TTS task token to synthesize speech: [text embedding, <TTS>]. If maintaining the speaker identity is desired, the original inputs and content can be incorporated to perform personalized TTS. This can be achieved with an input sequence as [ASR recognized text embedding, S2TT translated text embedding, <TTS>, codec token of raw speech], where ASR recognized text embedding is obtained using the ASR task: [audio embedding, <ASR>]. This approach treats the bilingual text as the complete input and allows the model to generate an output sequence of codec tokens while maintaining the same speaker identity. We provide synthesized audio samples to demonstrate this S2ST capacity at https://lauragpt.github.io. 4 EXPERIMENTAL SETTINGS This section describes the model architecture and training setup for all experiments. Details of the training datasets and the evaluation datasets and evaluation metrics are presented in Appendix A.2 and Appendix A.3, respectively. 4.1 MODEL ARCHITECTURE The Conformer-based encoder for extracting continuous audio representations consists of 32 con- former blocks. Each block consists of a feed-forward module with 1536 units, an attention module with 16 attention heads and an attention dimension of 512, a convolutional module including the pointwise and depthwise convolution layers, and a second feed-forward module with 1536 units. Sinusoidal positional encoding is applied on the inputs of Conformer. As explained in Section 3.3, batch normalization is replaced with layer normalization in the convolutional module. For a trade-off between performance and training efficiency, we use Qwen-2B2 with 1.8B trainable parameters as the backbone. Qwen-2B comprises 24 transformer layers with a hidden size of 2048 and 16 attention heads. Note that although Conformer and Qwen-2B are selected as the audio encoder and GPT backbone in this work, they can be replaced by other encoders and GPT models. 4.2 TRAINING SETUP In all experiments, we optimize the model parameters through the following steps: (1) We initialize the Qwen backbone and audio encoder with the pre-trained checkpoints. (2) We perform multi-task finetuning on the whole training set using the AdamW optimizer with a peak learning rate of 1 × 10−4 and 10K warmup steps. For the codec vocoder, we train the predictor on the training data of the TTS and SE tasks. We use the Adam optimizer with a peak learning rate of 0.001 and 25K warmup steps. The predictor is trained for 300k steps with a batch size of 12,800 tokens. The decoder of the codec vocoder is initialized with the pre-trained checkpoints3 and kept frozen during the multi-task finetuning of LauraGPT. 2https://github.com/QwenLM/Qwen 3https://funcodec.github.io 6 Preprint. Under review. 5 EXPERIMENTAL RESULTS AND ANALYSIS Section 5.1 presents the main experimental results of each task. Additional experimental results for MT can be found in Appendix A.5. In Section 5.2, we analyze the effectiveness of using continuous features as inputs and discrete tokens as outputs in LauraGPT by comparing LauraGPT with a model trained with discrete inputs and outputs (denoted "Discrete IO"). Further details regarding the comparison of batch normalization and layer normalization in the audio encoder can be found in Appendix B.1, while the impact of initialization from pre-trained models is discussed in Appendix B.2. 5.1 RESULTS ON EACH TASK ASR Evaluation We evaluate the ASR performance on Chinese AISHELL and English Libirispeech test sets, as shown in Table 2. The baselines include Paraformer (Gao et al., 2022) and Whisper Large V2 (Radford et al., 2023). The recently proposed Paraformer is a competitive non-autoregressive ASR model. Two open-source models Paraformer(CN)4 and Paraformer(EN)5 are directly used for evaluation, which are pre-trained on large-scale industrial Chinese (60K hours) and English (20K hours) datasets, respectively. We also compared with the off-the-shelf Whisper model, a multilingual ASR model trained on diverse audio datasets of 680K hours. Table 2 shows that both Paraformer and Whisper are highly competitive baselines on Chinese and English ASR tasks. Notably, LauraGPT greatly outperforms Whisper on Chinese sets by -3.9 and -2.3 absolute on CER and performs comparably to Paraformer(CN) with much smaller amount of training data. On the English test sets, LauraGPT demonstrates comparable performance to Paraformer(EN), specifically in terms of the averaged WER for test-clean and test-other. However, Whisper outperforms LauraGPT, which may be primarily attributed to the much smaller English data used for training LauraGPT. Table 2: Comparison of different models on the ASR task in terms of CER(%, ↓) for Chinese and WER(%, ↓) for English. Data size denotes the number of hours. Model Model Size Data Size AISHELL-1 test AISHELL-2 test-ios Librispeech test-clean Librispeech test-other Paraformer (CN) Paraformer (EN) Whisper Large V2 0.2 B 60K 20K 0.2 B 1.5 B 680K Discrete IO LauraGPT (Ours) 1.8 B 2.0 B 22K 22K 2.0 - 5.7 7.1 1.8 2.9 - 5.5 8.6 3.2 - 3.5 2.7 9.1 4.4 - 8.2 5.2 24.0 7.7 SLU Evaluation We evaluate the SLU performance of different models on the SLURP test set (Bas- tianelli et al., 2020), as shown in Table 3. The first group of Table 3 reports the results of two competitive baselines, CRDNN and Wav2Vec 2.0. The Wav2Vec 2.0 includes self-supervised pre- training, while the CRDNN does not. We find that LauraGPT achieves the highest accuracy among all models, indicating its superiority to understand the user's intent. It also achieves comparable results with wav2vec 2.0 on word-F1, char-F1, and SLU-F1, demonstrating its effectiveness on slot filling. Model Table 3: Comparison of different models on the SLU task. Action (ACC ↑) Scenario (ACC ↑) Intent (ACC ↑) Word-F1 ↑ Char-F1 ↑ Ravanelli et al. (2021) CRDNN Ravanelli et al. (2021) Wav2Vec 2.0 LauraGPT (Ours) 82.15 89.49 91.04 77.79 86.40 89.07 75.64 85.34 87.87 62.35 72.60 71.20 66.45 76.76 75.86 SLU-F1 ↑ 64.34 74.62 73.45 S2TT Evaluation We evaluate LauraGPT on BSTC dev set (Zh→En) (Zhang et al., 2021) and CoVOST2 test set (En→Zh)(Wang et al., 2020), as shown in Table 4. We report the baseline results on BSTC and CoVOST2 for comparison. The baseline of BSTC is a cascaded system that includes an 4https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common- vocab8404-pytorch/summary 5https://www.modelscope.cn/models/damo/speech_paraformer_asr-en-16k-vocab4199-pytorch/summary 7 Preprint. Under review. SMLTA ASR model and an MT model pre-trained on the WMT19 corpus (Zhang et al., 2021). The CoVOST2 baseline is an end-to-end S2TT model pre-trained on ASR (Wang et al., 2020). On the CoVOST2 test set (En→Zh), LauraGPT improves the baseline BLEU score by +13.1 absolute. When compared to the BSTC baseline (Zh→En), LauraGPT only yields a minor -0.4 BLEU reduction. These results demonstrate the competitive performance of LauraGPT on the S2TT task. Table 4: Comparison of different models on the S2TT task in terms of BLEU (↑). Model Zhang et al. (2021) (SMLTA ASR + pre-trained MT) Wang et al. (2020) (Transformer) Discrete IO LauraGPT (Ours) Zh→En En→Zh 18.2 - 5.1 17.8 - 25.4 5.0 38.5 SER Evaluation We evaluate the SER performance on the MELD test set (Poria et al., 2018), as shown in Table 5. Considering the imbalanced data distribution of the MELD dataset, we report the weighted F1 score (WF1) as the primary metric, together with weighted accuracy (WA) and unweighted accuracy (UA). We take the WavLM model (Chen et al., 2022) and the recently developed SER-specialized Vesper-L2 model (Chen et al., 2023) as the competitive baselines. Table 5 shows that LauraGPT improves WF1 and UA over the baselines, demonstrating its superiority on SER task. Further details regarding SER evaluation can be found in Appendix A.4. Table 5: Comparison of different models on the SER task. WF1 is the primary metric. Model Chen et al. (2023) WavLM Base Chen et al. (2023) WavLM Large Chen et al. (2023) Vesper-12 LauraGPT (Ours) WA ↑ UA ↑ WF1 ↑ 0.499 0.542 0.535 0.201 0.253 0.268 0.507 0.312 0.400 0.476 0.480 0.492 AAC Evaluation We evaluate the AAC performance of LauraGPT on the evaluation set of Clotho (Drossos et al., 2020). Alongside the dataset, an attention-based encoder-decoder network (EncDec-Attn) is released and we cite its results as a baseline. We also compare LauraGPT with a competitive ensemble model Koizumi et al. (2020), which comprises an audio embedding model, a caption keyword estimation model, and a meta keyword estimation model. The evaluation is based on Huggingface's implementation, reporting BLEU-4, SPICE, CIDEr, and SPIDERr metrics. Five annotated captions are utilized to calculate the metrics for each test sample, and the results are shown in Table 6. We find that LauraGPT outperforms EncDec-Attn on all metrics. Compared to the ensem- ble model, LauraGPT achieves a higher SPICE score while the ensemble model excels on CIDEr and SPIDEr. These results indicate that LauraGPT tends to generate captions that closely match one of the references, whereas the ensemble model prioritizes maintaining consensus of multiple references. Table 6: Comparison of different models on the AAC task. Model BLEU-4 ↑ SPICE ↑ CIDEr ↑ SPIDEr ↑ Oracle Drossos et al. (2020) (EncDec-Attn) Koizumi et al. (2020) (Ensemble) LauraGPT (Ours) 1.00 0.02 - 0.08 0.43 - 0.09 0.15 2.64 0.10 0.32 0.22 1.54 - 0.21 0.08 SE Evaluation We randomly select 500 clean utterances from the Librispeech test-clean set and mix them with noises from the test set of FSD50K at random SNRs of [2, 5, 7, 10, 12, 15]. We include the SOTA model on SE tasks as a baseline, which is a conformer-based metric generative adversarial network (CMGAN) Cao et al. (2022). To ensure a fair comparison, we train CMGAN6 6Use https://github.com/ruizhecao96/CMGAN 8 Preprint. Under review. using the same SE training data as LauraGPT. Results are shown in Table 7. Compared to original noisy utterances (Noisy), LauraGPT improves speech quality (PESQ) and intelligibility (STOI), leading to a significant reduction in recognition error rates. This suggests that LauraGPT indeed enhances the noisy speech and reduces the acoustic interference. Compared to the SOTA CMGAN, LauraGPT achieves comparable PESQ scores, while CMGAN outperforms on STOI, CER, and WER. Considering that CMGAN incorporates multiple discriminators during the training stage, we hypothesize that incorporating adversarial losses and fine-tuning the GPT backbone with the codec vocoder in an end-to-end manner may help close the gap between LauraGPT and CMGAN. Table 7: Comparison of different models on the SE task. Model PESQ ↑ STOI ↑ CER ↓ WER ↓ Clean Clean_codec_syn Noisy CMGAN Discrete IO LauraGPT (Ours) 4.50 2.72 2.34 2.95 1.96 2.97 100.0 87.0 85.0 91.0 64.0 88.0 3.31 7.46 13.81 6.42 40.91 9.05 7.55 14.28 23.00 12.29 53.97 15.94 TTS Evaluation We construct test samples using LibriTTS and AISHELL-1 corpora for Chinese and English TTS, respectively. We re-implement two VALL-E models (Wang et al., 2023a) as competitive baselines with 0.34B trainable parameters, both trained with the same data as LauraGPT. One VALL-E model uses phonemes (Phone) as the text input representation, while the other uses WordPiece tokens (Token) from the text tokenizer. Table 8 shows that VALL-E Phone outperforms VALL-E Token, indicating the importance of text representation for the TTS task. Compared to VALL-E Phone and VALL-E Token, LauraGPT achieves comparable speaker similarity and speech quality. The degradation in content consistency from LauraGPT results from the generalization issue, since the training data is too limited for the large LauraGPT model with 2B parameters. Table 8: Comparison of VALL-E and LaruaGPT on Zero-Shot TTS task in terms of content consis- tency (CER/WER), speaker similarity (SECS), and speech quality (MOSNet). Model AISHELL LibriTTS CER ↓ SECS ↑ MOSNet ↑ WER ↓ SECS ↑ MOSNet ↑ Origin VALL-E Phone VALL-E Token LauraGPT (Ours) 1.70 4.75 6.52 6.91 0.92 0.91 0.91 0.90 3.27 3.22 3.19 3.14 2.90 4.30 6.57 8.62 0.94 0.92 0.93 0.91 3.35 3.28 3.28 3.26 5.2 DISCRETE VERSUS CONTINUOUS REPRESENTATIONS FOR AUDIO INPUTS Different from unified audio-text models that use discrete tokens to represent audio inputs, LauraGPT employs the continuous features. We investigate the impact of discrete versus continuous representa- tions for audio inputs on ASR, S2TT, and SE tasks, which demonstrate capacity of audio recognition, understanding, and generation, respectively. We flatten the outputs of the first four quantizers to represent audio signals for both inputs and outputs, resulting in a token rate of 100 Hz. Table 2 shows that replacing continuous features with discrete audio tokens significantly degrades the ASR performance. For the S2TT task (Table 4), the model utilizing discrete tokens as inputs only yields BLEU scores of 5.1 and 5.0 on BSTC dev and CoVOST2 test sets, indicating lack of translation capability. Regarding the SE task (Table 7), using codec tokens as inputs cannot improve speech quality and intelligibility. This may be attributed to two reasons. Firstly, the distribution of noisy speech is too extensive to be effectively modeled by a single codec model trained on only speech signals. Secondly, the results in the "Clean" and "Clean_codec_syn" rows demonstrate that solely utilizing the first four groups to synthesize waveforms leads to natural degradation. 9 Preprint. Under review. 6 CONCLUSION In this paper, we propose LauraGPT, a novel and versatile GPT model for audio recognition, under- standing, and generation. LauraGPT can handle both audio and text inputs and outputs, and perform a wide range of tasks related to content, semantics, paralinguistics, and audio-signal analysis. We demonstrate that LauraGPT can achieve competitive or superior performance compared to strong baselines across various audio processing benchmarks. We show that LauraGPT effectively combines both continuous and discrete features for audio, and benefits from supervised multitask fine-tuning. In future work, we plan to extend LauraGPT to instruction-following multi-modal LLMs and evaluate its transferablity as a foundation model, such as broad zero-shot capabilities. REFERENCES Adaeze Adigwe, Noé Tits, Kevin El Haddad, Sarah Ostadabbas, and Thierry Dutoit. The emotional voices database: Towards controlling the emotion dimension in voice generation systems. arXiv preprint arXiv:1806.09514, 2018. Rohan Anil, Andrew M. Dai, Orhan Firat, Melvin Johnson, Dmitry Lepikhin, Alexandre Passos, Siamak Shakeri, Emanuel Taropa, Paige Bailey, Zhifeng Chen, Eric Chu, Jonathan H. Clark, Laurent El Shafey, Yanping Huang, Kathy Meier-Hellstern, Gaurav Mishra, Erica Moreira, Mark Omernick, Kevin Robinson, Sebastian Ruder, Yi Tay, Kefan Xiao, Yuanzhong Xu, Yujing Zhang, Gustavo Hernández Ábrego, Junwhan Ahn, Jacob Austin, Paul Barham, Jan A. Botha, James Bradbury, Siddhartha Brahma, Kevin Brooks, Michele Catasta, Yong Cheng, Colin Cherry, Christo- pher A. Choquette-Choo, Aakanksha Chowdhery, Clément Crepy, Shachi Dave, Mostafa Dehghani, Sunipa Dev, Jacob Devlin, Mark Díaz, Nan Du, Ethan Dyer, Vladimir Feinberg, Fangxiaoyu Feng, Vlad Fienber, Markus Freitag, Xavier Garcia, Sebastian Gehrmann, Lucas Gonzalez, and et al. Palm 2 technical report. CoRR, abs/2305.10403, 2023. doi: 10.48550/arXiv.2305.10403. URL https://doi.org/10.48550/arXiv.2305.10403. Junyi Ao, Rui Wang, Long Zhou, Chengyi Wang, Shuo Ren, Yu Wu, Shujie Liu, Tom Ko, Qing Li, Yu Zhang, Zhihua Wei, Yao Qian, Jinyu Li, and Furu Wei. Speecht5: Unified-modal encoder- decoder pre-training for spoken language processing. In Smaranda Muresan, Preslav Nakov, and Aline Villavicencio (eds.), Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), ACL 2022, Dublin, Ireland, May 22-27, 2022, pp. 5723–5738. Association for Computational Linguistics, 2022. doi: 10.18653/v1/2022.acl-long. 393. URL https://doi.org/10.18653/v1/2022.acl-long.393. Alexei Baevski, Yuhao Zhou, Abdelrahman Mohamed, and Michael Auli. wav2vec 2.0: A framework for self-supervised learning of speech representations. In Hugo Larochelle, Marc'Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. URL https://proceedings.neurips.cc/ paper/2020/hash/92d1e1eb1cd6f9fba3227870bb6d7f07-Abstract.html. Jinze Bai, Shuai Bai, Yunfei Chu, Zeyu Cui, Kai Dang, Xiaodong Deng, Yang Fan, Wenbin Ge, Yu Han, Fei Huang, and et. al. Qwen technical report. arxiv preprint, 2309.16609, 2023. Emanuele Bastianelli, Andrea Vanzo, Pawel Swietojanski, and Verena Rieser. Slurp: A spoken language understanding resource package. arXiv preprint arXiv:2011.13205, 2020. Zalán Borsos, Raphaël Marinier, Damien Vincent, Eugene Kharitonov, Olivier Pietquin, Matthew Sharifi, Dominik Roblek, Olivier Teboul, David Grangier, Marco Tagliasacchi, and Neil Zeghidour. Audiolm: A language modeling approach to audio generation. IEEE ACM Trans. Audio Speech Lang. Process., 31:2523–2533, 2023. doi: 10.1109/TASLP.2023.3288409. URL https://doi. org/10.1109/TASLP.2023.3288409. Hui Bu, Jiayu Du, Xingyu Na, Bengu Wu, and Hao Zheng. Aishell-1: An open-source mandarin speech corpus and a speech recognition baseline. In 2017 20th conference of the oriental chapter of the international coordinating committee on speech databases and speech I/O systems and assessment (O-COCOSDA), pp. 1–5. IEEE, 2017. 10 Preprint. Under review. Carlos Busso, Murtaza Bulut, Chi-Chun Lee, Abe Kazemzadeh, Emily Mower, Samuel Kim, Jean- nette N Chang, Sungbok Lee, and Shrikanth S Narayanan. Iemocap: Interactive emotional dyadic motion capture database. Language resources and evaluation, 42:335–359, 2008. Houwei Cao, David G Cooper, Michael K Keutmann, Ruben C Gur, Ani Nenkova, and Ragini Verma. Crema-d: Crowd-sourced emotional multimodal actors dataset. IEEE transactions on affective computing, 5(4):377–390, 2014. Ruizhe Cao, Sherif Abdulatif, and Bin Yang. CMGAN: Conformer-based Metric GAN for Speech Enhancement. In Proc. Interspeech 2022, pp. 936–940, 2022. doi: 10.21437/Interspeech.2022-517. Guoguo Chen, Shuzhou Chai, Guanbo Wang, Jiayu Du, Wei-Qiang Zhang, Chao Weng, Dan Su, Daniel Povey, Jan Trmal, Junbo Zhang, et al. Gigaspeech: An evolving, multi-domain asr corpus with 10,000 hours of transcribed audio. arXiv preprint arXiv:2106.06909, 2021a. Sanyuan Chen, Chengyi Wang, Zhengyang Chen, Yu Wu, Shujie Liu, Zhuo Chen, Jinyu Li, Naoyuki Kanda, Takuya Yoshioka, Xiong Xiao, et al. Wavlm: Large-scale self-supervised pre-training for full stack speech processing. IEEE Journal of Selected Topics in Signal Processing, 16(6): 1505–1518, 2022. Weidong Chen, Xiaofen Xing, Peihao Chen, and Xiangmin Xu. Vesper: A compact and effective pretrained model for speech emotion recognition. CoRR, abs/2307.10757, 2023. Yi-Chen Chen, Po-Han Chi, Shu-Wen Yang, Kai-Wei Chang, Jheng-Hao Lin, Sung-Feng Huang, Da-Rong Liu, Chi-Liang Liu, Cheng-Kuang Lee, and Hung-yi Lee. Speechnet: A universal modularized model for speech processing tasks. CoRR, abs/2105.03070, 2021b. URL https: //arxiv.org/abs/2105.03070. Jade Copet, Felix Kreuk, Itai Gat, Tal Remez, David Kant, Gabriel Synnaeve, Yossi Adi, and Alexandre Défossez. Simple and controllable music generation. CoRR, abs/2306.05284, 2023. Alexandre Défossez, Jade Copet, Gabriel Synnaeve, and Yossi Adi. High fidelity neural audio compression. CoRR, abs/2210.13438, 2022. doi: 10.48550/arXiv.2210.13438. URL https: //doi.org/10.48550/arXiv.2210.13438. Soham Deshmukh, Benjamin Elizalde, Rita Singh, and Huaming Wang. Pengi: An audio language model for audio tasks. CoRR, abs/2305.11834, 2023. doi: 10.48550/arXiv.2305.11834. URL https://doi.org/10.48550/arXiv.2305.11834. Konstantinos Drossos, Samuel Lipping, and Tuomas Virtanen. Clotho: An audio captioning dataset. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 736–740. IEEE, 2020. Jiayu Du, Xingyu Na, Xuechen Liu, and Hui Bu. Aishell-2: Transforming mandarin asr research into industrial scale. arXiv preprint arXiv:1808.10583, 2018. Zhihao Du, Shiliang Zhang, Kai Hu, and Siqi Zheng. Funcodec: A fundamental, reproducible and integrable open-source toolkit for neural speech codec, 2023. Alexandre Défossez, Jade Copet, Gabriel Synnaeve, and Yossi Adi. High fidelity neural audio compression. arXiv:2210.13438, 2022. Benjamin Elizalde, Soham Deshmukh, Mahmoud Al Ismail, and Huaming Wang. CLAP: learning audio concepts from natural language supervision. CoRR, abs/2206.04769, 2022. Eduardo Fonseca, Xavier Favory, Jordi Pons, Frederic Font, and Xavier Serra. FSD50K: an open dataset of human-labeled sound events. IEEE ACM Trans. Audio Speech Lang. Process., 30: 829–852, 2022. Zhifu Gao, Shiliang Zhang, Ian McLoughlin, and Zhijie Yan. Paraformer: Fast and accurate parallel transformer for non-autoregressive end-to-end speech recognition. In INTERSPEECH, pp. 2063– 2067. ISCA, 2022. 11 Preprint. Under review. Zhifu Gao, Zerui Li, Jiaming Wang, Haoneng Luo, Xian Shi, Mengzhe Chen, Yabin Li, Lingyun Zuo, Zhihao Du, Zhangyu Xiao, and Shiliang Zhang. Funasr: A fundamental end-to-end speech recognition toolkit. In INTERSPEECH, 2023. Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan Salakhutdinov, and Abdelrahman Mohamed. Hubert: Self-supervised speech representation learning by masked prediction of hidden units. IEEE ACM Trans. Audio Speech Lang. Process., 29:3451–3460, 2021. doi: 10.1109/TASLP.2021.3122291. URL https://doi.org/10.1109/TASLP.2021.3122291. Rongjie Huang, Jiawei Huang, Dongchao Yang, Yi Ren, Luping Liu, Mingze Li, Zhenhui Ye, Jinglin Liu, Xiang Yin, and Zhou Zhao. Make-an-audio: Text-to-audio generation with prompt-enhanced In ICML, volume 202 of Proceedings of Machine Learning Research, pp. diffusion models. 13916–13932. PMLR, 2023a. Rongjie Huang, Mingze Li, Dongchao Yang, Jiatong Shi, Xuankai Chang, Zhenhui Ye, Yuning Wu, Zhiqing Hong, Jiawei Huang, Jinglin Liu, Yi Ren, Zhou Zhao, and Shinji Watanabe. Audiogpt: Un- derstanding and generating speech, music, sound, and talking head. CoRR, abs/2304.12995, 2023b. doi: 10.48550/arXiv.2304.12995. URL https://doi.org/10.48550/arXiv.2304.12995. Philip Jackson and SJUoSG Haq. Surrey audio-visual expressed emotion (savee) database. University of Surrey: Guildford, UK, 2014. Shantanu Jain. tiktoken: A fast BPE tokeniser for use with OpenAI's models, 2022. URL https: //github.com/openai/tiktoken/. Teerapat Jenrungrot, Michael Chinen, W. Bastiaan Kleijn, and et al. LMCodec: A low bitrate speech codec with causal transformer models. In ICASSP, 2023. Chris Dongjoo Kim, Byeongchang Kim, Hyunmin Lee, and Gunhee Kim. Audiocaps: Generating captions for audios in the wild. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 119–132, 2019. Tom Ko, Vijayaditya Peddinti, Daniel Povey, Michael L Seltzer, and Sanjeev Khudanpur. A study on data augmentation of reverberant speech for robust speech recognition. In ICASSP, pp. 5220–5224, 2017. Tom Kocmi, Rachel Bawden, Ondˇrej Bojar, Anton Dvorkovich, Christian Federmann, Mark Fishel, Thamme Gowda, Yvette Graham, Roman Grundkiewicz, Barry Haddow, et al. Findings of the 2022 conference on machine translation (wmt22). In Proceedings of the Seventh Conference on Machine Translation (WMT), pp. 1–45, 2022. Yuma Koizumi, Daiki Takeuchi, Yasunori Ohishi, Noboru Harada, and Kunio Kashino. The ntt dcase2020 challenge task 6 system: Automated audio captioning with keywords and sentence length estimation. arXiv preprint arXiv:2007.00225, 2020. Felix Kreuk, Gabriel Synnaeve, Adam Polyak, Uriel Singer, Alexandre Défossez, Jade Copet, Devi Parikh, Yaniv Taigman, and Yossi Adi. Audiogen: Textually guided audio generation. In ICLR. OpenReview.net, 2023. Haohe Liu, Zehua Chen, Yi Yuan, Xinhao Mei, Xubo Liu, Danilo P. Mandic, Wenwu Wang, and Mark D. Plumbley. Audioldm: Text-to-audio generation with latent diffusion models. In ICML, volume 202 of Proceedings of Machine Learning Research, pp. 21450–21474. PMLR, 2023. Steven R Livingstone and Frank A Russo. The ryerson audio-visual database of emotional speech and song (ravdess): A dynamic, multimodal set of facial and vocal expressions in north american english. PloS one, 13(5):e0196391, 2018. Xinhao Mei, Chutong Meng, Haohe Liu, Qiuqiang Kong, Tom Ko, Chengqi Zhao, Mark D Plumbley, Yuexian Zou, and Wenwu Wang. Wavcaps: A chatgpt-assisted weakly-labelled audio captioning dataset for audio-language multimodal research. arXiv preprint arXiv:2303.17395, 2023. 12 Preprint. Under review. Eliya Nachmani, Alon Levkovitch, Julian Salazar, Chulayuth Asawaroengchai, Soroosh Mariooryad, R. J. Skerry-Ryan, and Michelle Tadmor Ramanovich. Lms with a voice: Spoken language modeling beyond speech tokens. CoRR, abs/2305.15255, 2023. OpenAI. GPT-4 technical report. CoRR, abs/2303.08774, 2023. doi: 10.48550/arXiv.2303.08774. URL https://doi.org/10.48550/arXiv.2303.08774. Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: an asr corpus based on public domain audio books. In 2015 IEEE international conference on acoustics, speech and signal processing (ICASSP), pp. 5206–5210. IEEE, 2015. Douglas B. Paul and Janet M. Baker. The design for the wall street journal-based CSR corpus. In ICSLP, pp. 899–902. ISCA, 1992. M Kathleen Pichora-Fuller and Kate Dupuis. Toronto emotional speech set (tess). Scholars Portal Dataverse, 1:2020, 2020. Soujanya Poria, Devamanyu Hazarika, Navonil Majumder, Gautam Naik, Erik Cambria, and Rada Mihalcea. Meld: A multimodal multi-party dataset for emotion recognition in conversations. arXiv preprint arXiv:1810.02508, 2018. Alec Radford, Jong Wook Kim, Tao Xu, Greg Brockman, Christine McLeavey, and Ilya Sutskever. Robust speech recognition via large-scale weak supervision. CoRR, abs/2212.04356, 2022. doi: 10.48550/arXiv.2212.04356. URL https://doi.org/10.48550/arXiv.2212.04356. Alec Radford, Jong Wook Kim, Tao Xu, Greg Brockman, Christine McLeavey, and Ilya Sutskever. Robust speech recognition via large-scale weak supervision. In International Conference on Machine Learning, pp. 28492–28518. PMLR, 2023. Mirco Ravanelli, Titouan Parcollet, Peter Plantinga, Aku Rouhe, Samuele Cornell, Loren Lugosch, Cem Subakan, Nauman Dawalatabad, Abdelwahab Heba, Jianyuan Zhong, Ju-Chieh Chou, Sung- Lin Yeh, Szu-Wei Fu, Chien-Feng Liao, Elena Rastorgueva, François Grondin, William Aris, Hwidong Na, Yan Gao, Renato De Mori, and Yoshua Bengio. Speechbrain: A general-purpose speech toolkit. CoRR, abs/2106.04624, 2021. URL https://arxiv.org/abs/2106.04624. Paul K. Rubenstein, Chulayuth Asawaroengchai, Duc Dung Nguyen, Ankur Bapna, Zalán Borsos, Félix de Chaumont Quitry, Peter Chen, Dalia El Badawy, Wei Han, Eugene Kharitonov, Hannah Muckenhirn, Dirk Padfield, James Qin, Danny Rozenberg, Tara N. Sainath, Johan Schalkwyk, Matthew Sharifi, Michelle Tadmor Ramanovich, Marco Tagliasacchi, Alexandru Tudor, Miha- jlo Velimirovic, Damien Vincent, Jiahui Yu, Yongqiang Wang, Vicky Zayats, Neil Zeghidour, Yu Zhang, Zhishuai Zhang, Lukas Zilka, and Christian Havnø Frank. Audiopalm: A large language model that can speak and listen. CoRR, abs/2306.12925, 2023. doi: 10.48550/arXiv.2306.12925. URL https://doi.org/10.48550/arXiv.2306.12925. Yongliang Shen, Kaitao Song, Xu Tan, Dongsheng Li, Weiming Lu, and Yueting Zhuang. Hugginggpt: Solving AI tasks with chatgpt and its friends in huggingface. CoRR, abs/2303.17580, 2023. doi: 10.48550/arXiv.2303.17580. URL https://doi.org/10.48550/arXiv.2303.17580. Jianlin Su, Yu Lu, Shengfeng Pan, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. CoRR, abs/2104.09864, 2021. URL https://arxiv.org/abs/2104. 09864. Marco Tagliasacchi, Yunpeng Li, Karolis Misiunas, and Dominik Roblek. Seanet: A multi-modal speech enhancement network. In INTERSPEECH, pp. 1126–1130, 2020. Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurélien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models. CoRR, abs/2302.13971, 2023. doi: 10.48550/arXiv.2302.13971. URL https://doi. org/10.48550/arXiv.2302.13971. A Vasuki and PT Vanathi. A review of vector quantization techniques. IEEE Potentials, 25(4):39–47, 2006. 13 Preprint. Under review. Changhan Wang, Anne Wu, and Juan Pino. Covost 2 and massively multilingual speech-to-text translation. arXiv preprint arXiv:2007.10310, 2020. Chengyi Wang, Sanyuan Chen, Yu Wu, Ziqiang Zhang, Long Zhou, Shujie Liu, Zhuo Chen, Yanqing Liu, Huaming Wang, Jinyu Li, Lei He, Sheng Zhao, and Furu Wei. Neural codec language models are zero-shot text to speech synthesizers. CoRR, abs/2301.02111, 2023a. Tianrui Wang, Long Zhou, Ziqiang Zhang, Yu Wu, Shujie Liu, Yashesh Gaur, Zhuo Chen, Jinyu Li, and Furu Wei. Viola: Unified codec language models for speech recognition, synthesis, and translation. CoRR, abs/2305.16107, 2023b. doi: 10.48550/arXiv.2305.16107. URL https: //doi.org/10.48550/arXiv.2305.16107. Daimeng Wei, Zhiqiang Rao, Zhanglin Wu, Shaojun Li, Yuanchang Luo, Yuhao Xie, Xiaoyu Chen, Hengchao Shang, Zongyao Li, Zhengzhe Yu, et al. Hw-tsc's submissions to the wmt 2022 general machine translation shared task. In Proceedings of the Seventh Conference on Machine Translation (WMT), pp. 403–410, 2022a. Xiangpeng Wei, Heng Yu, Yue Hu, Rongxiang Weng, Weihua Luo, and Rong Jin. Learning to generalize to more: Continuous semantic augmentation for neural machine translation. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics, ACL 2022, 2022b. Haibin Wu, Kai-Wei Chang, Yuan-Kuei Wu, and Hung-yi Lee. Speechgen: Unlocking the generative power of speech language models with prompts. CoRR, abs/2306.02207, 2023. doi: 10.48550/ arXiv.2306.02207. URL https://doi.org/10.48550/arXiv.2306.02207. Dongchao Yang, Jianwei Yu, Helin Wang, Wen Wang, Chao Weng, Yuexian Zou, and Dong Yu. Diffsound: Discrete diffusion model for text-to-sound generation. IEEE ACM Trans. Audio Speech Lang. Process., 31:1720–1733, 2023. Changtong Zan, Keqin Peng, Liang Ding, Baopu Qiu, Boan Liu, Shwai He, Qingyu Lu, Zheng Zhang, Chuang Liu, Weifeng Liu, et al. Vega-mt: The jd explore academy machine translation system for wmt22. In Proceedings of the Seventh Conference on Machine Translation (WMT), pp. 411–422, 2022. Neil Zeghidour, Alejandro Luebs, Ahmed Omran, Jan Skoglund, and Marco Tagliasacchi. Sound- stream: An end-to-end neural audio codec. IEEE ACM Trans. Audio Speech Lang. Process., 30: 495–507, 2022. doi: 10.1109/TASLP.2021.3129994. URL https://doi.org/10.1109/TASLP. 2021.3129994. Binbin Zhang, Hang Lv, Pengcheng Guo, Qijie Shao, Chao Yang, Lei Xie, Xin Xu, Hui Bu, Xiaoyu Chen, Chenchen Zeng, et al. Wenetspeech: A 10000+ hours multi-domain mandarin corpus for speech recognition. In ICASSP 2022-2022 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6182–6186. IEEE, 2022. Dong Zhang, Shimin Li, Xin Zhang, Jun Zhan, Pengyu Wang, Yaqian Zhou, and Xipeng Qiu. Speechgpt: Empowering large language models with intrinsic cross-modal conversational abilities. CoRR, abs/2305.11000, 2023a. doi: 10.48550/arXiv.2305.11000. URL https://doi.org/10. 48550/arXiv.2305.11000. Ruiqing Zhang, Xiyang Wang, Chuanqiang Zhang, Zhongjun He, Hua Wu, Zhi Li, Haifeng Wang, Ying Chen, and Qinfei Li. Bstc: A large-scale chinese-english speech translation dataset. arXiv preprint arXiv:2104.03575, 2021. Yu Zhang, Wei Han, James Qin, Yongqiang Wang, Ankur Bapna, Zhehuai Chen, Nanxin Chen, Bo Li, Vera Axelrod, Gary Wang, Zhong Meng, Ke Hu, Andrew Rosenberg, Rohit Prabhavalkar, Daniel S. Park, Parisa Haghani, Jason Riesa, Ginger Perng, Hagen Soltau, Trevor Strohman, Bhuvana Ramabhadran, Tara N. Sainath, Pedro J. Moreno, Chung-Cheng Chiu, Johan Schalkwyk, Françoise Beaufays, and Yonghui Wu. Google USM: scaling automatic speech recognition beyond 100 languages. CoRR, abs/2303.01037, 2023b. doi: 10.48550/arXiv.2303.01037. URL https://doi.org/10.48550/arXiv.2303.01037. Siqi Zheng, Luyao Cheng, Yafeng Chen, Hui Wang, and Qian Chen. 3d-speaker: A large-scale multi-device, multi-distance, and multi-dialect corpus for speech representation disentanglement. arxiv preprint, 2306.15354, 2023. 14 Preprint. Under review. Appendices A EXPERIMENTAL DETAILS A.1 BASIC TASKS In our experiments, the following tasks are involved: Automatic speech recognition (ASR) is a vital task in the speech processing community. It focuses on transcribing speech into textual content. Spoken language understanding (SLU) is a task of deriving high-level semantic meaning directly from audio input. It aims to identify the user's intent and the relevant entity slots that fill the intent. An intent is composed of a scenario type and an action type, while slots and fillers are key-value pairs that specify the details of the intent. Speech to text translation (S2TT) is similar to machine translation, but it takes speech as input rather than text. Speech emotion recognition (SER) categorizes the emotions in speech input. Compared to textual emotion recognition, speech signals convey additional information, including tone, speed, and prosody, which enhances emotion recognition. Automated audio captioning (AAC) aims to generate a natural language sentence that describes the content of an audio clip. Speech enhancement (SE) is an audio-to-audio task that aims to improve speech quality through noise suppression and echo cancellation. In order to incorporate this task into a unified framework, we reformulate it as a classification problem using codec tokens. Text-to-speech synthesis (TTS) can be considered as the inverse process of ASR, where it generates speech that matches the given text. S2TT directly translates the source language speech into the target language text. Machine translation (MT) aims at translating text sequences from one language to another. A.2 TRAINING DATASETS To ensure reproducibility, we exclusively utilize publicly available datasets to train and test LauraGPT. The training sets for the basic tasks in Section 3.5 are prepared as follows. For the ASR task, we utilize open-source Chinese datasets such as AISHELL-1 (Bu et al., 2017), AISHELL-2 (Du et al., 2018), WenetSpeech (Zhang et al., 2022), as well as open-source English datasets including LibriSpeech (Panayotov et al., 2015) and GigaSpeech (Chen et al., 2021a). For the S2TT task, we employ the commonly used BSTC (Zhang et al., 2021) and CoVOST 2 (Wang et al., 2020) datasets. Due to the limited data volumes of BSTC and CoVoST 2, we further augment the training set by translating AISHELL-1 and AISHELL-2 datasets into English and translating LibriSpeech dataset into Chinese using a publicly available text translation model (Wei et al., 2022b). Consequently, we obtain approximately 2,000 hours of supplementary data for Chinese-to-English and English- to-Chinese S2TT tasks. For the SER task, we collect corpora including MELD (Poria et al., 2018), IEMOCAP (Busso et al., 2008), RAVDESS (Livingstone & Russo, 2018), TESS (Pichora-Fuller & Dupuis, 2020), Crema-D (Cao et al., 2014), Emov-DB (Adigwe et al., 2018), and SAVEE (Jackson & Haq, 2014). These corpora are recorded in multi-modal formats, comprising audio or visual data. For the SLU task, we use the multi-domain Spoken Language Understanding Resource Package (SLURP) dataset (Bastianelli et al., 2020), which covers 18 scenarios. For the AAC task, we use AudioCaps (Kim et al., 2019), WavCaps (Mei et al., 2023), and Clotho (Drossos et al., 2020) datasets. For the SE task, pairs of noisy and clean speech are required for training. The clean utterances are extracted from the AISHELL-1, AISHELL-2, LibriSpeech, and WSJ datasets Paul & Baker (1992), while the noisy counterparts are generated by mixing the clean speech with noises from the FSD-50K dataset (Fonseca et al., 2022) at random signal-to-noise rates (SNR) ranging from 2 to 15. Besides the additional noises, we also simulate convolutional noises by convolving the clean speech data with room impulse responses (Ko et al., 2017). As a result, we obtain approximately 6000 hours of paired data for the SE task. For the TTS task, we use the open-source LibriTTS and 3D-speaker datasets (Zheng et al., 2023). For the MT task, we use the ParaCrawl v9 dataset (Kocmi et al., 2022), which consists of 14M parallel sentences for Zh→En and En→Zh translation. Further details of the training data for all tasks can be found in Table 9. For audio inputs, we extract the log-compressed Mel spectrogram features and feed them into the audio encoder (Section 3.3), while the audio outputs are discretized into tokens using the audio tokenizer (Section 3.2). As for the text data, both inputs and outputs are processed by the text tokenizer (Section 3.1). 15 Preprint. Under review. Table 9: Statistics of the training data for basic tasks in Section 3.5. Corpus×N means that the training samples in this corpus are copied N times during training. Task Training Data # Samples AISHELL-1, AISHELL-2, WenetSpeech, LibriSpeech, GigaSpeech 24.2 M ASR SLU SLURP×10 S2TT BSTC, CoVOST 2, AISHELL-1, AISHELL-2, LibriSpeech SER MELD×10, IEMOCAP×10, RAVDESS×10, TESS×10 Crema-D×10, Emov-DB×10, SAVEE×10 AAC Clotho×10, AudioCaps×10, WavCaps×5 SE TTS MT AISHELL-1, AISHELL-2, LibriSpeech, WSJ, FSD-50K, RIR LibriTTS×2, 3D-Speaker×2 ParaCrawl 1.2 M 2.2 M 0.3 M 1.3 M 5.3 M 5.0 M 14.2 M A.3 EVALUATION DATASETS AND METRICS Table 10 presents the evaluation datasets and evaluation metrics for various tasks. The metrics used in our experiments are described below: • CER stands for Character Error Rate, a commonly used metric to evaluate the recognition perfor- mance of Chinese and English utterances. We also utilize CER to assess the content consistency in TTS task. • WER stands for Word Error Rate, which considers entire words rather than individual characters. In our experiments, we use WER to evaluate ASR recognition performance, content consistency in TTS, and speech intelligibility in SE. • SECS, which stands for Speaker Encoder Cosine Similarity, utilizes speaker embeddings extracted from a pre-trained speaker verification model 7 for both prompt and synthesized speech. The cosine similarity between the two embeddings is then employed to measure the speaker similarity between the prompt speech and the synthesized speech. Furthermore, the naturalness of the synthesized speech is evaluated using MOSNet, a non-intrusive score derived from a pre-trained neural network 8. • BLEU and BLEU-4 represent the Bilingual Evaluation Understudy metric and its extension, respectively, considering the precision of 4-grams. BLEU is commonly used to assess the quality of machine-generated text by comparing it to reference translations. In our experiments, we use BLEU to evaluate MT and S2TT, while the BLEU-4 extension is employed for AAC. • PESQ represents Perceptual Evaluation of Speech Quality, while STOI stands for Short-time Objective Intelligibility. Both metrics are widely used to assess speech enhancement. PESQ ranges from −0.5 to 4.5, whereas STOI is in the range of [0, 1]. • SPICE, CIDEr and SPIDEr are metrics borrowed from the image captioning task and employed for AAC evaluation. SPICE stands for Semantic Propositional Image Caption Evaluation, CIDEr denotes Consensus-based Image Description Evaluation, and SPIDEr represents the average of SPICE and CIDEr. • WA, UA and WF1 stands for weighted accuracy, unweighted accuracy and the weighted F1 score. WA corresponds to the overall accuracy, UA corresponds to the average class-wise accuracy, and WF1 corresponds to the average class-wise F1 score. • ACC measures the accuracy of predicting the scenario, action, and intent (i.e., the combination of scenario and action) in SLU evaluation. The Word-F1, Char-F1, and SLU-F1 metrics assess the slot filling performance. Word-F1 and Char-F1 are based on the span-based F-measure. Word-F1 7Code is available at https://huggingface.co/microsoft/wavlm-base-plus-sv 8Code is available at https://github.com/lochenchou/MOSNet 16 Preprint. Under review. uses word-level spans, while Char-F1 uses character-level spans. SLU-F1 is a metric that balances Word-F1 and Char-F1, computed as the sum of the confusion matrices. Table 10: Evaluation datasets and metrics for different tasks. ↑ indicates that higher values of the metric are desirable, while ↓ implies the opposite. Task Evaluation Datasets Evaluation Metrics ASR AISHELL-1 test, AISHELL-2 test-ios, Librispeech test-clean & test-other CER (↓), WER (↓) SLU SLURP test ACC (↑), Word-F1 (↑), Char-F1 (↑), SLU-F1 (↑) S2TT BSTC dev, En→Zh subset of CoVOST2 BLEU (↑) SER MELD test AAC Clotho eval WA (↑), UA (↑), WF1 (↑) BLEU-4 (↑), SPIDEr (↑), CIDEr (↑), SPICE (↑) SE Librispeech test-clean, FSD50K, noise-92 PESQ (↑), STOI (↑), WER (↓) TTS AISHELL-1 test, LibriTTS test-clean CER (↓), WER (↓), SECS (↑), MOS (↑) MT WMT22 test BLEU (↑) A.4 DETAILS OF SER EVALUATION During the training stage, emotion labels within different training corpora are unified into the following nine classes: anger, disgust, neutral, like, sadness, surprise, happiness, joy, and fear. At the test stage, we map the "like" and "happiness" emotion classes into the "joy" class to match the MELD test set. LauraGPT uses an autoregressive structure to generate emotion labels. Out-of-domain outputs are considered as classification errors, making the task harder. Both WavLM Base model and WavLM Large model utilize the weighted sum of multiple layers with learnable parameters as speech features, which are fed into a downstream network for classification. A.5 MT EVALUATION LauraGPT can also support text-to-text tasks such as MT. Here we use WMT22 to evaluate the performance of Zh↔En MT task and the results are summarized in Table 11. We cite results from Vega-MT (Zan et al., 2022) and HuaweiTSC (Wei et al., 2022a) in the WMT22 competition. Simultaneously, we take Transformer-Big (Zan et al., 2022) as the baseline, comprising 6 stacks with hidden nodes of 4096-1024. By employing the LauraGPT model for generating translations, we attain BLEU scores of 15.5 and 29.5 for Zh→En and En→Zh, respectively. Compared to the baseline, LauraGPT shows a notable decline in translation quality, which could potentially be attributed to the restricted proportion of the translation training data for LauraGPT. We only use the ParaCrawl dataset for MT training for LauraGPT, without implementing common strategies such as data augmentation. Despite the limited MT training data, LauraGPT still demonstrates its capability to fairly perform Chinese-English translation. Table 11: Comparison of different models on MT task. Model Zan et al. (2022) Transformer-BIG Zan et al. (2022) Vega-MT Wei et al. (2022a) HuaweiTSC LauraGPT Zh→En En→Zh 21.9 33.5 29.8 15.5 33.2 49.7 49.7 29.5 17 Preprint. Under review. B ANALYSIS OF CRITICAL DESIGN CHOICES B.1 BATCH NORMALIZATION VERSUS LAYER NORMALIZATION IN AUDIO ENCODER In the original design, batch normalization is applied after the convolution module in the Conformer- based audio encoder. However, we discover that this choice leads to endless looping decoding due to inaccurate estimations of mean and variance, particularly for tasks with long sequence lengths. To address this issue, we replace batch normalization with layer normalization, which is more robust to various mini-batch sizes. We validate this design by focusing on the SE task, which generally has the longest sequence among all the included tasks. The results are shown in Table 12. The results indicate that batch normalization causes a significantly high loop ratio at the inference stage, leading to unacceptable PESQ and STOI scores. In contrast, by replacing batch normalization with layer normalization, we observe a considerable reduction in the loop ratio to a very low level, thereby greatly improving the speech enhancement performance. It should be noted that although the loop ratio of layer normalization is restricted, further research is still desired to explore more general normalization methods suitable for all audio-text tasks. Table 12: Comparison of batch normalization and layer normalization on the SE task in terms of Loop Ratio (%), PESQ and STOI(%). ↑ indicates that higher values are desired, while ↓ implies the opposite. Normalization Type Loop Ratio (↓) PESQ (↑) STOI (↑) Batch normalization Layer normalization 86.00 4.60 1.27 2.97 22.0 88.0 B.2 IMPACT OF INITIALIZATION FROM PRE-TRAINED MODELS In LauraGPT, both the GPT backbone and audio encoder are initialized with the weights of pre- trained checkpoints. We investigate how the initialization affects the performance of LauraGPT. The experimental results for the ASR, S2TT and SE tasks are presented in Table 13, Table 14 and Table 15, respectively. From the results, we observe that the initialization has a significant impact on the performance of ASR and S2TT tasks, while its influence on the SE task is relatively limited. This suggests that the prior knowledge learned by the GPT backbone is crucial for text generation tasks, but less important for audio generation tasks. Consequently, we hypothesize that a reasonable approach to enhance the quality of generated audios could be to pre-train the GPT backbone not only with text sequences but also with audio token sequences. Table 13: Impact of initialization on the ASR task in terms of CER(%, ↓) for Chinese and WER(%, ↓) for English. Model AISHELL-1 test AISHELL-2 test-ios Librispeech test-clean Librispeech test-other LauraGPT Without Init. 1.8 4.3 3.2 6.0 4.4 8.3 7.7 17.6 Table 14: Impact of initialization on the S2TT task in terms of BLEU. Model Zh→En En→Zh LauraGPT Without Init. 17.8 8.4 38.5 12.2 18 Preprint. Under review. Table 15: Impact of initialization on SE task in terms of Loop Ratio (%), PESQ and STOI(%). ↑ indicates that higher values are desired, while ↓ implies the opposite. Normalization Type Loop Ratio (↓) PESQ (↑) STOI (↑) LauraGPT Without init. 4.60 6.00 2.97 2.88 88.0 85.3 19
http://arxiv.org/abs/2310.04668v2
"2023-10-12T18:34:08"
"2023-10-07T03:14:11"
Label-free Node Classification on Graphs with Large Language Models (LLMS)
In recent years, there have been remarkable advancements in node classification achieved by Graph Neural Networks (GNNs). However, they necessitate abundant high-quality labels to ensure promising performance. In contrast, Large Language Models (LLMs) exhibit impressive zero-shot proficiency on text-attributed graphs. Yet, they face challenges in efficiently processing structural data and suffer from high inference costs. In light of these observations, this work introduces a label-free node classification on graphs with LLMs pipeline, LLM-GNN. It amalgamates the strengths of both GNNs and LLMs while mitigating their limitations. Specifically, LLMs are leveraged to annotate a small portion of nodes and then GNNs are trained on LLMs' annotations to make predictions for the remaining large portion of nodes. The implementation of LLM-GNN faces a unique challenge: how can we actively select nodes for LLMs to annotate and consequently enhance the GNN training? How can we leverage LLMs to obtain annotations of high quality, representativeness, and diversity, thereby enhancing GNN performance with less cost? To tackle this challenge, we develop an annotation quality heuristic and leverage the confidence scores derived from LLMs to advanced node selection. Comprehensive experimental results validate the effectiveness of LLM-GNN. In particular, LLM-GNN can achieve an accuracy of 74.9% on a vast-scale dataset \products with a cost less than 1 dollar.
[ "Zhikai Chen", "Haitao Mao", "Hongzhi Wen", "Haoyu Han", "Wei Jin", "Haiyang Zhang", "Hui Liu", "Jiliang Tang" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04668v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04668v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.CL" ]
Preprint LABEL-FREE NODE CLASSIFICATION ON GRAPHS WITH LARGE LANGUAGE MODELS (LLMS) Zhikai Chen1, Haitao Mao1, Hongzhi Wen1, Haoyu Han1, Wei Jin2, Haiyang Zhang3, Hui Liu1, Jiliang Tang1 1Michigan State University {chenzh85, haitaoma, wenhongz, hanhaoy1, liuhui7, tangjili}@msu.edu, wei.jin@emory.edu, hhaiz@amazon.com 2Emory University 3Amazon.com 3 2 0 2 t c O 2 1 ] G L . s c [ 2 v 8 6 6 4 0 . 0 1 3 2 : v i X r a ABSTRACT In recent years, there have been remarkable advancements in node classification achieved by Graph Neural Networks (GNNs). However, they necessitate abun- dant high-quality labels to ensure promising performance. In contrast, Large Lan- guage Models (LLMs) exhibit impressive zero-shot proficiency on text-attributed graphs. Yet, they face challenges in efficiently processing structural data and suf- fer from high inference costs. In light of these observations, this work introduces a label-free node classification on graphs with LLMs pipeline, LLM-GNN. It amal- gamates the strengths of both GNNs and LLMs while mitigating their limitations. Specifically, LLMs are leveraged to annotate a small portion of nodes and then GNNs are trained on LLMs' annotations to make predictions for the remaining large portion of nodes. The implementation of LLM-GNN faces a unique chal- lenge: how can we actively select nodes for LLMs to annotate and consequently enhance the GNN training? How can we leverage LLMs to obtain annotations of high quality, representativeness, and diversity, thereby enhancing GNN perfor- mance with less cost? To tackle this challenge, we develop an annotation quality heuristic and leverage the confidence scores derived from LLMs to advanced node selection. Comprehensive experimental results validate the effectiveness of LLM- GNN. In particular, LLM-GNN can achieve an accuracy of 74.9% on a vast-scale dataset OGBN-PRODUCTS with a cost less than 1 dollar. 1 INTRODUCTION Graphs are prevalent across multiple disciplines with diverse applications (Ma & Tang, 2021). A graph is composed of nodes and edges, and nodes often with certain attributes, especially text at- tributes, representing properties of nodes. For example, in the OGBN-PRODUCTS dataset (Hu et al., 2020b), each node represents a product, and its corresponding textual description corresponds to the node's attribute. Node classification is a critical task for graphs which aims to assign labels to unla- beled nodes based on a part of labeled nodes, node attributes, and graph structures. In recent years, Graph Neural Networks (GNNs) have achieved superior performance in node classification (Kipf & Welling, 2016; Hamilton et al., 2017; Veliˇckovi ́c et al., 2017). Despite the effectiveness of GNNs, they always assume the ready availability of ground truth labels as a prerequire. Particularly, such assumption often neglects the pivotal challenge of procuring high-quality labels for graph-structured data: (1) given the diverse and complex nature of graph-structured data, human labeling is inherently hard; (2) given the sheer scale of real-world graphs, such as OGBN-PRODUCTS (Hu et al., 2020b) with millions of nodes, the process of annotating a significant portion of the nodes becomes both time-consuming and resource-intensive. Compared to GNNs which require adequate high-quality labels, Large Language Models (LLMs) with massive knowledge have showcased impressive zero-shot and few-shot capabilities, especially for the node classification task on text-attributed graphs (TAGs) (Guo et al., 2023; Chen et al., 2023; He et al., 2023a). Such evidence suggests that LLMs can achieve promising performance with- out the requirement for any labeled data. However, unlike GNNs, LLMs cannot naturally capture and understand informative graph structural patterns (Wang et al., 2023). Moreover, LLMs can 1 Preprint not be well-tuned since they can only utilize limited labels due to the limitation of input context length (Dong et al., 2022). Thus, though LLMs can achieve promising performance in zero-shot or few-shot scenarios, there may still be a performance gap between LLMs and GNNs trained with abundant labeled nodes (Chen et al., 2023). Furthermore, the prediction cost of LLMs is much higher than that of GNNs, making it less scalable for large datasets such as OGBN-ARXIV and OGBN-PRODUCTS (Hu et al., 2020b) In summary, we make two primary observations: (1) Given adequate annotations with high qual- ity, GNNs excel in utilizing graph structures to provide predictions both efficiently and effectively. Nonetheless, limitations can be found when adequate high-quality annotations are absent. (2) In contrast, LLMs can achieve satisfying performance without high-quality annotations while being costly. Considering these insights, it becomes evident that GNNs and LLMs possess complemen- tary strengths. This leads us to an intriguing question: Can we harness the strengths of both while addressing their inherent weaknesses? In this paper, we provide an affirmative answer to the above question by investigating the potential of harnessing the zero-shot learning capabilities of LLMs to alleviate the substantial training data demands of GNNs, a scenario we refer to as label-free node classification. Notably, unlike the common assumption that ground truth labels are always available, noisy labels can be found when annotations are generated from LLMs. We thus confront a unique challenge: How can we ensure the high quality of the annotation without sacrifice diversity and representativeness? On one hand, we are required to consider the design of appropriate prompts to enable LLMs to produce more accurate annotations. On the other hand, we need to strategically choose a set of training nodes that not only possess high-quality annotations but also exhibit informativeness and representativeness, as prior research has shown a correlation between these attributes and the performance of the trained model (Huang et al., 2010). To overcome these challenges, we propose a label-free node classification on graphs with LLMs pipeline, LLM-GNN. Different from traditional graph active node selection (Wu et al., 2019; Cai et al., 2017), LLM-GNN considers the node annotation difficulty by LLMs to actively select nodes. Then, it utilizes LLMs to generate confidence-aware annotations and leverages the confidence score to further refine the quality of annotations as post-filtering. By seamlessly blending annotation quality with active selection, LLM-GNN achieves impressive results at a minimal cost, eliminating the necessity for ground truth labels. Our main contributions can be summarized as follows: 1. We introduce a new label-free pipeline LLM-GNN to leverage LLMs for annotation, providing training signals on GNN for further prediction. 2. We adopt LLMs to generate annotations with calibrated confidence, and introduce difficulty- aware active selection with post filtering to get training nodes with a proper trade-off between annotation quality and traditional graph active selection criteria. 3. On the massive-scale OGBN-PRODUCTS dataset, LLM-GNN can achieve 74.9% accuracy with- out the need for human annotations. This performance is comparable to manually annotating 400 randomly selected nodes, while the cost of the annotation process via LLMs is under 1 dollar. 2 PRELIMINARIES In this section, we introduce text-attributed graphs and notation utilized in our study. We then review two primary pipelines on node classification. The first pipeline is the default node classification pipeline to evaluate the performance of GNNs (Kipf & Welling, 2016), while it totally ignores the data selection process. The second pipeline further emphasizes the node selection process, trying to identify the most informative nodes as training sets to maximize the model performance within a given budget. Our study focuses on Text-Attributed Graph (TAG), represented as GT = (V, A, T, X). V = {v1, * * * , vn} is the set of n nodes paired with raw attributes T = {t1, t2, . . . , tn}. Each text attributes can then be encoded as sentence embedding X = {x1, x2, . . . , xn} with the help of Sen- tenceBERT (Reimers & Gurevych, 2019). The adjacency matrix A ∈ {0, 1}n×n represents graph connectivity where A[i, j] = 1 indicates an edge between nodes i and j. Traditional GNN-based node classification pipeline. assumes a fixed training set with ground truth labels yVtrain for the training set Vtrain. The GNN is trained on those graph truth labels. The well-trained GNN predicts labels of the rest unlabeled nodes V \ Vtrain in the test stage. 2 Preprint Traditional graph active learning-based node classification. aims to select a group of nodes Vact = S(A, X) from the pool V so that the performance of GNN models trained on those graphs with labels yVact can be maximized. Limitations of the current pipelines. Both pipelines above assume they can always obtain ground truth labels (Zhang et al., 2021c; Wu et al., 2019) while overlooking the intricacies of the anno- tation process. Nonetheless, annotations can be both expensive and error-prone in practice, even for seemingly straightforward tasks (Wei et al., 2021). For example, the accuracy of human an- notations for the CIFAR-10 dataset is approximately 82%, which only involves the categorization of daily objects. Annotation on graphs meets its unique challenge. Recent evidence (Zhu et al., 2021a) shows that the human annotation on graphs is easily biased, focusing nodes sharing some characteristics within a small subgraph. Moreover, it can be even harder when taking graph active learning into consideration, the improved annotation diversity inevitably increase the difficulty of ensuring the annotation quality. For instance, it is much easier to annotate focusing on a few small communities than annotate across all the communities in a social network. Considering these limi- tations of existing pipelines, a pertinent question arises: Can we design a pipeline that can leverage LLMs to automatically generate high-quality annotations and utilize them to train a GNN model with promising node classification performance? 3 METHOD To overcome the limitations of current pipelines for node classifications, we propose a new pipeline Label-free Node Classification on Graphs with LLMs, short for LLM-GNN. It (1) adopts LLMs that demonstrate promising zero-shot performance on var- ious node classification datasets (Chen et al., 2023; He et al., 2023a) as the annotators; and (2) introduces the difficulty-aware active selection and filtering strategy to get training nodes with high annotation quality, rep- resentativeness, and diversity simultaneously. 3.1 AN OVERVIEW OF LLM-GNN The proposed LLM-GNN pipeline is designed with four components as shown in Figure 1: difficulty- aware active node selection, confidence-aware anno- tations, post-filtering, and GNN model training and prediction. Compared with the original pipelines with ground truth label, the annotation quality of LLM pro- vides a unique new challenge. (1) The active node se- lection phase is to find a candidate node set for LLM annotation. Despite only considering the diversity and representativeness (Zhang et al., 2021c) as the orig- inal baseline, we pay additional attention to the in- fluence on annotation quality. Specifically, we incor- porate a difficulty-aware heuristic that correlates the annotation quality with the feature density. (2) With the selected node set, we then utilize the strong zero- shot ability of LLMs to annotate those nodes with confidence-aware prompts. The confidence score as- sociated with annotations is essential, as LLM anno- tations (Chen et al., 2023), akin to human annotations, can exhibit a certain degree of label noise. This confidence score can help to identify the annotation quality and help us filter high-quality la- bels from noisy ones. (3) The post-filtering stage is a unique step in our pipeline, which aims to remove low-quality annotations. Building upon the annotation confidence, we further refine the quality of annotations with LLMs' confidence scores and remove those nodes with lower confidence from the previously selected set and (4) With the filtered high-quality annotation set, we then train Figure 1: Our proposed pipeline LLM- GNN for label-free node classification on It is designed with four compo- graphs. (1)difficulty-aware active node se- nents: lection to select suitable nodes which are easy to annotate. (2) confidence-aware an- notations generate the annotation on the node set and confidence score reflecting the label quality. (3) post-filtering removes low quality annotation via confidence score (4) GNN model training and prediction is then conducted based on the LLM annotations. 3 Difficulty-aware active node selection12GNN training &predict22111Confidence-aware annotationsPost-filtering Preprint GNN modelson selected nodes and their annotations. Ultimately, the well-trained GNN model are then utilized to perform predictions. Since the component of GNN model training and prediction is similar to traditional one, next we detail other three components. 3.2 DIFFICULTY-AWARE ACTIVE NODE SELECTION Node selection aims to select a node candidate set, which will be annotated by LLMs, and then learned on GNN. Notably, the selected node set is generally small to ensure a controllable money budget. Unlike traditional graph active learning which mainly takes diversity and representativeness into consideration, label quality should also be included since LLM can produce noisy labels with large variances across different groups of nodes. In the difficulty-aware active selection stage, we have no knowledge of how LLMs would respond to those nodes. Consequently, we are required to identify some heuristics building connections to the difficulty of annotating different nodes. A preliminary investigation of LLMs' annotations brings us inspiration on how to infer the annotation difficulty through node features, where we find that the accuracy of annotations generated by LLMs is closely related to the clustering density of nodes. To demonstrate this correlation, we employ k-means clustering on the original feature space, setting the number of clusters equal to the distinct class count. 1000 nodes are sampled from the whole dataset and then annotated by LLMs. They are subsequently sorted and divided into ten equally sized groups based on their distance to the nearest cluster center. As shown in Figure 2, we observe a consistent pattern: nodes closer to cluster centers typically exhibit better annotation quality, which indicates lower annotation difficulty. Full results are included in Appendix G.2. We then adopt this distance as a heuristic to approximate the annotation reliability. Since the cluster number equals the distinct class count, we denote this heuristic as C-Density, calculcated as C-Density(vi) = ∥ , where for any node vi and its closest cluster center CCvi, and xvi represents the 1 1+∥xvi −xCCvi feature of node vi. (a) CORA (b) CITESEER Figure 2: The annotation accuracy by LLMs vs. the distance to the nearest clustering center. The bars represent the average accuracy within each selected group, while the blue line indicates the cumulative average accuracy. At group i, the blue line denotes the average accuracy of all nodes in the preceding i groups. We then incorporate this annotation difficulty heuristic in traditional active selection. For traditional active node selection, we select B nodes from the unlabeled pools with top scores fact(vi), where fact() is a score function. To benefit the performance of the trained models, the selected nodes should have a trade-off between annotation difficulty and traditional active selection criteria ( e.g., representativeness (Cai et al., 2017) and diversity (Zhang et al., 2021c)). In traditional graph active learning, selection criteria can usually be denoted as a score function, such as PageRank centrality fpg(vi) for measuring the structural diversity. Then, one feasible way to integrate difficulty heuristic into traditional graph active learning is ranking aggregation. Compared to directly combining sev- eral scores via summation or multiplication, ranking aggregation is more robust to scale differences since it is scale-invariant and considers only the relative ordering of items. Considering the original score function for graph active learning as fact(vi), we denote rfact(vi) as the high-to-low ranking percentage. Then, we incorporate difficulty heuristic by first transforming C-Density(vi) into a rank rC-Density(vi). Then we combine these two scores: fDA-act(vi) = α0 × rfact(vi) + α1 × rC-Density(vi). "DA" stands for difficulty aware. Hyper-parameters α0 and α1 are introduced to balance annota- tion difficulty and traditional graph active learning criteria such as representativeness, and diversity. Finally, nodes vi with larger fDA-act(vi) are selected for LLMs to annotate, which is denoted as Vanno. 4 0123456789Region Index0.600.650.700.750.800.850.900.951.00Average Accuracy0123456789Region Index0.600.650.700.750.800.850.900.951.00Average Accuracy Preprint Table 1: Accuracy of annotations. Yellow denotes the best and Green denotes the second best result. The cost is determined by comparing the token consumption to that of zero-shot prompts. CORA OGBN-PRODUCTS WIKICS Prompt Strategy Acc (%) Cost Acc (%) Cost Acc (%) Cost Vanilla (zero-shot) Vanilla (one-shot) TopK (zero-shot) Most Voting (zero-shot) Hybrid (zero-shot) Hybrid (one-shot) 68.33 ± 6.55 69.67 ± 7.72 68.00 ± 6.38 68.00 ± 7.35 67.33 ± 6.80 70.33 ± 6.24 1 2.2 1.1 1.1 1.5 2.9 75.33 ± 4.99 78.67 ± 4.50 74.00 ± 5.10 75.33 ± 4.99 73.67 ± 5.25 75.67 ± 6.13 1 1.8 1.2 1.1 1.4 2.3 68.33 ± 1.89 72.00 ± 3.56 72.00 ± 2.16 69.00 ± 2.16 71.00 ± 2.83 73.67 ± 2.62 1 2.4 1.1 1.1 1.4 2.9 3.3 CONFIDENCE-AWARE ANNOTATIONS Figure 3: An illustration of the relation be- tween accuracy and confidence on WIKICS. After obtaining the candidate set Vanno through active selection, we use LLMs to generate annota- tions for nodes in the set. Despite we select nodes easily to annotate with difficulty-aware active node selection, we are not aware of how the LLM responds to the nodes at that stage. It leads to the potential of remaining low-quality nodes. To figure out the high-quality annotations, we need some guidance on their reliability, such as the confidence scores. Inspired by recent literature on generating calibrated confidence from LLMs (Xiong et al., 2023; Tian et al., 2023; Wang et al., 2022), we investigate the following strategies: (1) directly asking for confidence (Tian et al., 2023), denoted as "Vanilla (zero-shot)"; (2) reasoning-based prompts to generate annotations, including chain-of-thought and multi-step reasoning (Wei et al., 2022; Xiong et al., 2023); (3) TopK prompt, which asks LLMs to generate the top K possible answers and select the most probable one as the answer (Xiong et al., 2023); (4) Consistency-based prompt (Wang et al., 2022), which queries LLMs multiple times and selects the most common output as the answer, denoted as "Most voting"; (5) Hy- brid prompt (Wang et al., 2023), which combines both TopK prompt and consistency-based prompt. In addition to the prompt strategy, few-shot samples have also been demonstrated critical to the per- formance of LLMs (Chen et al., 2023). We thus also investigate incorporating few-shot samples into prompts. In this work, we try 1-shot sample to avoid time and money cost. Detailed descriptions and full prompt examples are shown in Appendix E. Then, we do a comparative study to identify the effective prompts in terms of accuracy, calibration of confidence, and costs. (1) For accuracy and cost evaluation, we adopt popular node classification benchmarks CORA, OGBN-PRODUCTS, and WIKICS. We randomly sample 100 nodes from each dataset and repeat with three different seeds to reduce sampling bias, and then we compare the generated annotations with the ground truth labels offered by these datasets. The cost is estimated by the number of tokens in input prompts and output contents. (2) It is important to note that the role of confidence is to assist us in identifying label reliability. Therefore, To validate the quality of the confidence produced by LLMs is to examine how the confidence can reflect the quality of the corresponding annotation. Therefore, we check how the annotation accuracy changes with the confidence. Specifically, we randomly select 300 nodes and sort them in descending order based on their confidence. Subsequently, we calculate the annotation accuracy for the top k nodes where K is varied in {50, 100, 150, 200, 250, 300}. For each K, a higher accuracy indicates a better quality of the generated confidence. Empirically, we find that reasoning-based prompts will generate outputs that don't follow the format requirement, and greatly increase the query time and costs. Therefore, we don't further consider them in this work. For other prompts, we find that for a small portion of inputs, the outputs of LLMs do not follow the format requirements (for example, outputting an annotation out of the valid label names). For those invalid outputs, we design a self-correction prompt and set a larger temperature to review previous outputs and regenerate annotations. The evaluation of performance and cost is shown in Table 1, and the evaluation of confidence is shown in Figure 3. The full results are included in Appendix F. From the experimental results, we make the following observations: First, LLMs present promising zero-shot prediction performance on all datasets, which suggests that LLMs are potentially good annotators. Second, compared to zero-shot prompts, prompts with few-shot demonstrations could slightly increase performance with double costs. Third, zero-shot hybrid strategies present the most effective approach to extract high- quality annotations since the confidence can greatly indicate the quality of annotation. We thus adopt zero-shot hybrid prompt in the following studies and leave the evaluation of other prompts as one future work. 5 50100150200250300k0.700.800.90AccuracyOne-ShotMost VotingTop-KHybrid(One-Shot)Zero-ShotHybrid(Zero-Shot) Preprint 3.4 POST-FILTERING After achieving annotations together with the confidence scores, we may further refine the set of annotated nodes since we have access to confidence scores generated by LLMs, which can be used to filter high-quality labels. However, directly filtering out low-confidence nodes may result in a label distribution shift and degrade the diversity of the selected nodes, which will degrade the per- formance of subsequently trained models. Unlike traditional graph active learning methods which try to model diversity in the selection stage with criteria such as feature dissimilarity (Ren et al., 2022), in the post-filtering stage, label distribution is readily available. As a result, we can directly consider the label diversity of selected nodes. To measure the change of diversity, we propose a simple score function change of entropy (COE) to measure the entropy change of labels when re- moving a node from the selected set. Assuming that the current selected set of nodes is Vsel, then COE can be computed as: COE(vi) = H( ̃yVsel−{vi}) − H( ̃yVsel) where H() is the Shannon entropy function (Shannon, 1948), and ̃y denotes the annotations generated by LLMs. It should be noted that the value of COE may possibly be positive or negative, and a small COE(vi) value indicates that removing this node could adversely affect the diversity of the selected set, potentially compromis- ing the performance of trained models. When a node is removed from the selected set, the entropy adjusts accordingly, necessitating a re-computation of COE. However, it introduces negligible com- putation overhead since the size of the selected set Vanno is usually much smaller than the whole dataset. COE can be further combined with confidence fconf(vi) to balance diversity and annotation quality, in a ranking aggregation manner. The final filtering score function ffilter can be stated as: ffilter(vi) = β0 × rfconf(vi) + β1 × rCOE(vi). Hyper-parameters β0 and β1 are introduced to balance label diversity and annotation quality. rfconf is the high-to-low ranking percentage of the confidence score fconf. To conduct post-filtering, each time we remove the node with the smallest ffilter value until a pre-defined maximal number is reached. 3.5 DISCUSSIONS ON SELECTION STRATEGY CHOICES In this section, we present our pipeline LLM-GNN. It should be noted that our framework is flexible, which means difficulty-aware term in active selection and post-filtering is optional. For example, we may combine a traditional graph active learning method with the post-filtering strategy, or directly use a difficulty-aware active selection without post-filtering. In practice, we also find that using difficulty-aware terms and post-filtering simultaneously may not get the best performance, which will be further discussed in Section 4.2. Moreover, one advantage of difficulty-aware terms is that we may use a normal prompt to replace the confidence-aware prompt, which may further decrease the cost. Our proposed LLM-GNN pipeline presents a flexible framework, that supports a wide range of selection and filtering algorithms. We just present some possible implementations in this paper. 4 EXPERIMENT In this section, we present experiments to evaluate the performance of our proposed pipeline LLM- GNN. We begin by detailing the experimental settings. Next, we investigate the following research questions: RQ1. How do active selection and post-filtering strategies affect the performance of LLM-GNN? RQ2. How does the performance and cost of LLM-GNN compare to other label- free node classification methods? RQ3. How do different budgets affect the performance of the pipelines? RQ4. How do LLMs' annotations compare to ground truth labels? 4.1 EXPERIMENTAL SETTINGS In this paper, we adopt the following TAG datasets widely adopted for node classification: CORA (McCallum et al., 2000), CITESEER (Giles et al., 1998), PUBMED (Sen et al., 2008), OGBN- ARXIV, OGBN-PRODUCTS (Hu et al., 2020b), and WIKICS (Mernyei & Cangea, 2020). Statistics and descriptions of these datasets are in Appendix D. In terms of the settings for each component in the pipeline, we adopt gpt-3.5-turbo-0613 1 to gener- ate annotations. In terms of the prompt strategy for generating annotations, we choose the "zero-shot 1 https://platform.openai.com/docs/models/gpt-3-5 6 Preprint Table 2: Impact of different active selection strategies. We show the top three performance in each dataset with pink, green, and yellow, respectively. To compare with traditional graph active selec- tions, we underline their combinations with our selection strategies if the combinations outperform their corresponding traditional graph active selection. OOT means that this method can not scale to large-scale graphs because of long execution time. CORA CITESEER PUBMED WIKICS OGBN-ARXIV OGBN-PRODUCTS Random C-Density PS-Random Density DA-Density PS-Density PS-DA-Density Degree DA-Degree PS-Degree PS-DA-Degree Pagerank DA-Pagerank PS-Pagerank PS-DA-Pagerank AGE DA-AGE PS-AGE PS-DA-AGE RIM DA-RIM PS-RIM PS-DA-RIM GraphPart DA-GraphPart PS-GraphPart PS-DA-GraphPart 70.48 ± 0.73 42.22 ± 1.59 69.83 ± 0.81 72.40 ± 0.35 70.73 ± 0.32 73.60 ± 0.13 71.07 ± 0.19 68.67 ± 0.30 74.64 ± 0.42 71.29 ± 0.55 73.61 ± 0.57 70.31 ± 0.42 72.79 ± 0.29 72.92 ± 0.26 72.19 ± 0.37 69.15 ± 0.38 71.56 ± 0.37 72.30 ± 0.13 71.53 ± 0.19 68.28 ± 0.38 75.00 ± 0.35 72.96 ± 0.35 72.34 ± 0.19 69.54 ± 2.18 69.34 ± 2.08 69.26 ± 0.19 66.64 ± 2.26 65.11 ± 1.12 64.98 ± 1.15 66.62 ± 0.72 61.06 ± 0.95 63.26 ± 0.50 59.19 ± 1.11 62.62 ± 0.33 60.23 ± 0.54 59.93 ± 0.31 58.54 ± 0.60 59.29 ± 0.39 61.21 ± 0.11 60.44 ± 0.40 63.87 ± 0.15 60.36 ± 0.14 54.25 ± 0.31 57.18 ± 0.72 63.04 ± 0.18 56.38 ± 0.14 63.06 ± 0.11 60.33 ± 0.40 62.43 ± 0.25 65.21 ± 0.17 66.59 ± 1.34 69.39 ± 1.05 70.00 ± 0.35 63.57 ± 4.14 75.64 ± 2.15 39.76 ± 0.00 73.77 ± 4.08 74.43 ± 0.28 46.92 ± 5.23 68.54 ± 0.23 39.81 ± 0.14 67.77 ± 0.07 74.25 ± 0.13 67.70 ± 0.03 74.21 ± 0.15 68.58 ± 0.14 75.02 ± 0.77 67.57 ± 0.31 73.41 ± 0.19 74.55 ± 0.54 62.81 ± 1.84 70.84 ± 0.76 64.61 ± 0.29 76.48 ± 0.16 63.97 ± 0.94 76.97 ± 0.29 71.76 ± 0.29 78.52 ± 1.34 67.36 ± 4.31 78.45 ± 1.12 66.78 ± 4.14 62.30 ± 1.73 57.77 ± 0.85 62.92 ± 2.18 64.96 ± 0.53 62.12 ± 1.15 66.66 ± 0.61 65.27 ± 0.69 66.09 ± 0.35 63.66 ± 0.20 68.38 ± 0.31 63.57 ± 0.39 67.13 ± 0.46 67.13 ± 0.80 70.22 ± 0.41 69.14 ± 0.29 55.51 ± 0.12 58.67 ± 0.31 64.00 ± 0.37 59.74 ± 0.19 67.06 ± 0.16 66.95 ± 0.01 68.56 ± 0.39 63.23 ± 0.29 67.28 ± 0.87 71.32 ± 0.81 67.74 ± 0.32 69.10 ± 2.46 64.59 ± 0.16 44.08 ± 0.39 64.18 ± 0.08 51.77 ± 0.24 44.13 ± 0.12 49.30 ± 0.30 44.37 ± 0.30 54.98 ± 0.37 53.48 ± 0.35 53.33 ± 0.28 51.05 ± 0.29 59.52 ± 0.03 58.82 ± 0.52 59.30 ± 0.21 60.12 ± 0.29 46.68 ± 0.30 48.21 ± 0.80 50.63 ± 0.19 50.55 ± 0.39 OOT OOT OOT OOT OOT OOT OOT OOT 70.59 ± 0.60 8.29 ± 0.00 71.60 ± 0.34 20.22 ± 0.11 8.50 ± 0.32 19.11 ± 0.18 8.72 ± 0.24 72.28 ± 0.21 32.31 ± 0.11 72.13 ± 0.19 45.38 ± 0.28 69.87 ± 0.32 48.11 ± 0.13 70.57 ± 0.38 51.48 ± 0.39 65.63 ± 0.15 60.03 ± 0.11 68.69 ± 0.13 67.21 ± 0.39 OOT OOT OOT OOT OOT OOT OOT OOT FeatProp PS-FeatProp 72.82 ± 0.08 75.54 ± 0.34 66.61 ± 0.55 69.06 ± 0.32 76.28 ± 0.13 74.98 ± 0.35 64.17 ± 0.18 66.09 ± 0.35 66.06 ± 0.07 66.14 ± 0.27 74.04 ± 0.15 74.91 ± 0.17 hybrid strategy" considering its effectiveness in generating calibrated confidence. We leave the eval- uation of other prompts as future works considering the massive costs. For the budget of the active selection, we refer to the popular semi-supervised learning setting for node classifications (Yang et al., 2016) and set the budget equal to 20 multiplied by the number of classes. For GNNs, we adopt two of the most popular models GCN (Kipf & Welling, 2016) and GraphSage (Hamilton et al., 2017).The major goal of this evaluation is to show the potential of the LLM-GNN pipeline. Therefore, we do not tune the hyper-parameters in both difficulty-aware active selection and post- filtering but simply setting them with the same value. In terms of evaluation, we compare the generated prediction of GNNs with the ground truth labels offered in the original datasets and adopt accuracy as the metric. Similar to (Ma et al., 2022), we adopt a setting where there's no validation set, and models trained on selected nodes will be further tested based on the rest unlabeled nodes. All experiments will be repeated for 3 times with different seeds. For hyper-parameters of the experiment, we adopt a fixed setting commonly used by previous papers or benchmarks Kipf & Welling (2016); Hamilton et al. (2017); Hu et al. (2020b). One point that should be strengthened is the number of training epochs. Since there's no validation set and the labels are noisy, models may suffer from overfitting (Song et al., 2022). However, we find that most models work well across all datasets by setting a small fixed number of training epochs, such as 30 epochs for small and medium-scale datasets (CORA, CITESEER, PUBMED, and WIKICS), and 50 epochs for the rest large-scale datasets. This setting, which can be viewed as a simpler alternative to early stop trick (without validation set) (Bai et al., 2021) for training on noisy labels so that we can compare different methods more fairly and conveniently. 7 Preprint 4.2 RQ1. IMPACT OF DIFFERENT ACTIVE SELECTION STRATEGIES We conduct a comprehensive evaluation of different active selection strategies, which is the key component of our pipeline. Specifically, we examine how effectiveness of (1) difficulty-aware ac- tive node selection before LLM annotation (2) post-filtering after LLM annotation and how they combine with traditional active learning algorithms. For selection strategies, we consider (1) Tradi- tional graph active selection: Random selection, Density-based selection (Ma et al., 2022), Graph- Part (Ma et al., 2022), FeatProp (Wu et al., 2019), Degree-based selection (Ma et al., 2022), Pagerank centrality-based selection (Ma et al., 2022), AGE (Cai et al., 2017), and RIM (Zhang et al., 2021b). (2) Difficulty-aware active node selection: C-Density-based selection, and traditional graph active selections combined with C-Density. To denote these selections, we add the prefix "DA-". For example, "DA-AGE" means combining the original AGE method with our proposed C-Density. (3) Post Filtering: Traditional graph active selection combined with confidence and COE-based se- lections, we add the prefix "PS-". (4) Combing both difficulty-aware active node selection with post-filtering: We add the prefix "PS-DA" to those methods. For FeatProp, as it selects candidate nodes directly using the K-Medoids algorithm (Wu et al., 2019), integrating it with difficulty-aware active selections is not feasible. Detailed introductions of these methods are shown in Appendix B. The full results for GCN are shown in Table 2, while the results for GraphSAGE are shown in Appendix I. From the experimental results, we make the following observations: 1. The proposed post-filtering strategy presents promising effectiveness. Combined with traditional graph active learning methods like GraphPart, RIM, and Featprop, it can consistently outperform. Combined with FeatProp, it can achieve both promising accuracy and better scalability. 2. Although C-Density-based selection can achieve superior annotation quality, merely using this metric will make the trained model achieve poor performance. To better understand this phe- nomenon, we check the labels of the selected nodes. We find that the problem lies in label imbalance brought by active selection. For example, we check the selected nodes for PUBMED, and find that all annotations belong to one class. 3. The focus of this work is to show the potential of the LLM-GNN pipeline. Thus, we do not investigate the strategies to tune its hyperparameters, instead we simply assign them with the same value. Therefore, the results in the table can validate the potential of LLM-GNN, but they are not optimized. For example, considering the "DA-AGE" method on CITESEER which currently achieves around 57% accuracy. If we use the grid search to select the hyper-parameters in the difficulty-aware active node selection, we find that it can achieve more than 66% accuracy, which surpasses the performance of merely using C-Density and AGE. Therefore, there is still a large room to improve the performance, especially when combining difficulty-aware active node selection with post-filtering. 4.3 (RQ2.) COMPARISON WITH OTHER LABEL-FREE NODE CLASSIFICATION METHODS Table 3: Comparison of label-free node classifi- cation methods. The cost is computed in dollars. The performance of methods with * are taken from Li & Hooi (2023). Notably, the time cost of LLMs is proportional to the expenses. To demonstrate the effectiveness and novelty of our proposed pipeline, we further conduct a comparison with other label-free node classifi- cation pipelines, which include: (1) Zero-shot node classification method: SES, TAG-Z (Li & Hooi, 2023); (2) Zero-shot classification mod- els for texts: BART-large-MNLI (Lewis et al., 2019); and (3) Directly using LLMs for predic- tions: LLMs-as-Predictors (Chen et al., 2023). Detailed introductions of these models can be found in Appendix B. We compare both perfor- mance and costs of these models, and the results are shown in Table 3. From the experimental results in the table, we can see that (1) our proposed pipeline LLM-GNN can significantly outperform SES, TAG-Z and BART-large-MNLI. (2) Despite LLMs-as-Predictors has better performance than LLM-GNN, its cost is much higher than LLM-GNN. For example, the cost of LLMs-as-Predictors in OGBN-PRODUCTS is 2, 124× that of LLM-GNN. Besides, the promising SES(*) TAG-Z(*) BART-large-MNLI LLMs-as-Predictors LLM-GNN 6.67 N/A 47.08 N/A N/A 28.8 1572 75.33 0.74 74.91 13.08 N/A 37.08 N/A N/A 13.2 79 73.33 0.63 66.14 OGBN-ARXIV OGBN-PRODUCTS Methods Cost Cost Acc Acc 8 Preprint performance of LLMs-as-Predictors on OGBN-ARXIV may be an exception, relevant to the specific prompts leveraging the memorization of LLMs (Chen et al., 2023). 4.4 (RQ3.) HOW DO DIFFERENT BUDGETS AFFECT THE PERFORMANCE OF OUR PIPELINES? We conduct a comprehensive evaluation on different budgets rather the fixed budget in previous experiments. It aims to examine how effective our algorithm is when confronting different real- world scenarios with different to meet different cost and performance requirements. Experiments are typically conducted on the CORA dataset by setting the budget as {70, 140, 280, 560, 1,120, 2,240}. We choose both random selections and those methods that perform well in Table 2. We can have the following observations from Figure 4. (1) with the increase in the budget, the performance tends to increase gradually. (2) unlike using ground truth, the performance growth is relatively limited as the budget increases. It suggests that there exists a trade-off between the performance and the cost in the real-world scenario. 4.5 (RQ4.) CHARACTERISTICS OF LLMS' ANNOTATIONS Although LLMs' annotations are noisy labels, we find that they are more benign than the ground truth labels injected with synthetic noise adopted in (Zhang et al., 2021b). Specifically, assuming that the quality of LLMs' annotations is q%, we randomly select (1−q)% ground truth labels and flip them into other classes uniformly to generate synthetic noisy labels. We then train GNN models on LLMs' annotations, synthetic noisy labels, and LLMs' annotations with all incorrect labels removed, respectively. We also investigate RIM (Zhang et al., 2021b), which adopts a weighted loss and achieves good performance on synthetic noisy labels. We include this model to check whether weighted loss designed for learning on noisy labels may further boost the model's performance. The results are demonstrated in Figure 5, from which we observe that: (1) LLMs' annotations present totally different training dynamics from synthetic noisy labels. The extent of over-fitting for LLMs' annotations is much less than that for synthetic noisy labels. (2) Comparing the weighted loss and normal cross-entropy loss, we find that weighted loss which is adopted to deal with synthetic noisy labels, presents limited effectiveness for LLMs' annotations. Figure 4: Investigation on how different budgets affect the performance of LLM-GNN. Methods achieving top performance in Table 2 and ran- dom selection-based methods are compared in the figure. 5 RELATED WORKS Figure 5: Comparisons among LLMs' annota- tions, ground truth labels, and synthetic noisy la- bels. "Ran" represents random selection, "GT" indicates the ground truth labels. "ce" and "weighted" denote the normal cross-entropy and weighted cross-entropy loss, respectively. Graph active learning. Graph active learning (Cai et al., 2017) aims to maximize the test perfor- mance with nodes actively selected under a limited query budget. To achieve this goal, algorithms are developed to maximize the informativeness and diversity of the selected group of nodes (Zhang et al., 2021c). These algorithms are designed based on assumptions. In Ma et al. (2022), diversity is assumed to be related to the partition of nodes, and thus samples are actively selected from dif- ferent communities. In Zhang et al. (2021c;b;a), representativeness is assumed to be related to the influence of nodes, and thus nodes with a larger influence score are first selected. Another line of work directly sets the accuracy of trained models as the objective (Gao et al., 2018; Hu et al., 2020a; Zhang et al., 2022), and then adopts reinforcement learning to do the optimization. 9 7028011202240Budget666870727476AccuracyRandomPS-RandomFeatPropPS-FeatpropDA-Degree0255075100125150Epochs0.50.60.70.80.91.0AccuracyRan AnnoRan GTRan FilteredRan SynRim Anno ceRim Anno weighted Preprint LLMs for graphs. Recent progress on applying LLMs for graphs (He et al., 2023a; Guo et al., 2023) aims to utilize the power of LLMs and further boost the performance of graph-related tasks. LLMs are either adopted as the predictor (Chen et al., 2023; Wang et al., 2023; Ye et al., 2023), which directly generates the solutions or as the enhancer (He et al., 2023a), which takes the capability of LLMs to boost the performance of a smaller model with better efficiency. In this paper, we adopt LLMs as annotators, which combine the advantages of these two lines to train an efficient model with promising performance and good efficiency, without the requirement of any ground truth labels. 6 CONCLUSION In this paper, we revisit the long-term ignorance of the data annotation process in existing node clas- sification methods and propose the pipeline label-free node classification on graphs with LLMs to solve this problem. The key design of our pipelines involves LLMs to generate confidence-aware annotations, and using difficulty-aware selections and confidence-based post-filtering to further en- hance the annotation quality. Comprehensive experiments validate the effectiveness of our pipeline. REFERENCES Yingbin Bai, Erkun Yang, Bo Han, Yanhua Yang, Jiatong Li, Yinian Mao, Gang Niu, and Tongliang Liu. Understanding and improving early stopping for learning with noisy labels. Advances in Neural Information Processing Systems, 34:24392–24403, 2021. Parikshit Bansal and Amit Sharma. Large language models as annotators: Enhancing generalization of nlp models at minimal cost. arXiv preprint arXiv:2306.15766, 2023. Hongyun Cai, Vincent W Zheng, and Kevin Chen-Chuan Chang. Active learning for graph embed- ding. arXiv preprint arXiv:1705.05085, 2017. Zhikai Chen, Haitao Mao, Hang Li, Wei Jin, Hongzhi Wen, Xiaochi Wei, Shuaiqiang Wang, Dawei Yin, Wenqi Fan, Hui Liu, et al. Exploring the potential of large language models (llms) in learning on graphs. arXiv preprint arXiv:2307.03393, 2023. Bosheng Ding, Chengwei Qin, Linlin Liu, Lidong Bing, Shafiq Joty, and Boyang Li. Is gpt-3 a good data annotator? arXiv preprint arXiv:2212.10450, 2022. Qingxiu Dong, Lei Li, Damai Dai, Ce Zheng, Zhiyong Wu, Baobao Chang, Xu Sun, Jingjing Xu, and Zhifang Sui. A survey for in-context learning. arXiv preprint arXiv:2301.00234, 2022. Li Gao, Hong Yang, Chuan Zhou, Jia Wu, Shirui Pan, and Yue Hu. Active discriminative network representation learning. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, IJCAI-18, pp. 2142–2148. International Joint Conferences on Artificial Intelligence Organization, 7 2018. doi: 10.24963/ijcai.2018/296. URL https://doi.org/ 10.24963/ijcai.2018/296. Fabrizio Gilardi, Meysam Alizadeh, and Ma ̈el Kubli. Chatgpt outperforms crowd-workers for text- annotation tasks. arXiv preprint arXiv:2303.15056, 2023. C. Lee Giles, Kurt D. Bollacker, and Steve Lawrence. Citeseer: An automatic citation indexing system. In Proceedings of the Third ACM Conference on Digital Libraries, DL ́98, pp. 89–98, New York, NY, USA, 1998. ACM. ISBN 0-89791-965-3. doi: 10.1145/276675.276685. URL http://doi.acm.org/10.1145/276675.276685. Jiayan Guo, Lun Du, and Hengyu Liu. Gpt4graph: Can large language models understand graph structured data? an empirical evaluation and benchmarking. arXiv preprint arXiv:2305.15066, 2023. Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. Advances in neural information processing systems, 30, 2017. Haibo He and Edwardo A. Garcia. Learning from imbalanced data. IEEE Transactions on Knowledge and Data Engineering, 21(9):1263–1284, 2009. doi: 10.1109/TKDE.2008.239. 10 Preprint Xiaoxin He, Xavier Bresson, Thomas Laurent, and Bryan Hooi. Explanations as features: Llm- based features for text-attributed graphs. arXiv preprint arXiv:2305.19523, 2023a. Xingwei He, Zhenghao Lin, Yeyun Gong, Alex Jin, Hang Zhang, Chen Lin, Jian Jiao, Siu Ming Yiu, Nan Duan, Weizhu Chen, et al. Annollm: Making large language models to be better crowd- sourced annotators. arXiv preprint arXiv:2303.16854, 2023b. Graph policy network for transferable active learning on graphs. Shengding Hu, Zheng Xiong, Meng Qu, Xingdi Yuan, Marc-Alexandre Cˆot ́e, Zhiyuan Liu, and Jian Tang. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 10174–10185. Curran Associates, Inc., 2020a. URL https://proceedings.neurips.cc/paper_files/paper/2020/ file/73740ea85c4ec25f00f9acbd859f861d-Paper.pdf. Weihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong, Hongyu Ren, Bowen Liu, Michele Catasta, and Jure Leskovec. Open graph benchmark: Datasets for machine learning on graphs. Advances in neural information processing systems, 33:22118–22133, 2020b. Sheng-jun Huang, Rong Jin, and Zhi-Hua Zhou. Active learning by querying informative and representative examples. In J. Lafferty, C. Williams, J. Shawe-Taylor, R. Zemel, and A. Culotta (eds.), Advances in Neural Information Processing Systems, volume 23. Curran Associates, Inc., 2010. URL https://proceedings.neurips.cc/paper_files/ paper/2010/file/5487315b1286f907165907aa8fc96619-Paper.pdf. Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional net- works. arXiv preprint arXiv:1609.02907, 2016. Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: denoising sequence-to-sequence pre- training for natural language generation, translation, and comprehension. CoRR, abs/1910.13461, 2019. URL http://arxiv.org/abs/1910.13461. Yuexin Li and Bryan Hooi. Prompt-based zero-and few-shot node classification: A multimodal approach. arXiv preprint arXiv:2307.11572, 2023. Yuwen Li, Miao Xiong, and Bryan Hooi. Graphcleaner: Detecting mislabelled samples in popular graph learning benchmarks. arXiv preprint arXiv:2306.00015, 2023. Jiaqi Ma, Ziqiao Ma, Joyce Chai, and Qiaozhu Mei. Partition-based active learning for graph neural networks. arXiv preprint arXiv:2201.09391, 2022. Yao Ma and Jiliang Tang. Deep learning on graphs. Cambridge University Press, 2021. Andrew McCallum, Kamal Nigam, Jason D. M. Rennie, and Kristie Seymore. Automating the construction of internet portals with machine learning. Information Retrieval, 3:127–163, 2000. P ́eter Mernyei and C ̆at ̆alina Cangea. Wiki-cs: A wikipedia-based benchmark for graph neural net- works. arXiv preprint arXiv:2007.02901, 2020. Nicholas Pangakis, Samuel Wolken, and Neil Fasching. Automated annotation with generative ai requires validation. arXiv preprint arXiv:2306.00176, 2023. Xiaohuan Pei, Yanxi Li, and Chang Xu. Gpt self-supervision for a better data annotator. arXiv preprint arXiv:2306.04349, 2023. Nils Reimers and Iryna Gurevych. Sentence-bert: Sentence embeddings using siamese bert- networks. In Conference on Empirical Methods in Natural Language Processing, 2019. URL https://api.semanticscholar.org/CorpusID:201646309. Zhicheng Ren, Yifu Yuan, Yuxin Wu, Xiaxuan Gao, Yewen Wang, and Yizhou Sun. Dissimilar nodes improve graph active learning. arXiv preprint arXiv:2212.01968, 2022. 11 Preprint Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi- Rad. Collective classification in network data. AI Magazine, 29(3):93, Sep. 2008. doi: 10.1609/aimag.v29i3.2157. URL https://ojs.aaai.org/aimagazine/index.php/ aimagazine/article/view/2157. C. E. Shannon. A mathematical theory of communication. The Bell System Technical Journal, 27 (3):379–423, 1948. doi: 10.1002/j.1538-7305.1948.tb01338.x. Hwanjun Song, Minseok Kim, Dongmin Park, Yooju Shin, and Jae-Gil Lee. Learning from noisy labels with deep neural networks: A survey. IEEE Transactions on Neural Networks and Learning Systems, 2022. Katherine Tian, Eric Mitchell, Allan Zhou, Archit Sharma, Rafael Rafailov, Huaxiu Yao, Chelsea Finn, and Christopher D Manning. Just ask for calibration: Strategies for eliciting calibrated confidence scores from language models fine-tuned with human feedback. arXiv preprint arXiv:2305.14975, 2023. Petar Veliˇckovi ́c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017. Heng Wang, Shangbin Feng, Tianxing He, Zhaoxuan Tan, Xiaochuang Han, and Yulia arXiv preprint Tsvetkov. Can language models solve graph problems in natural language? arXiv:2305.10037, 2023. Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdh- ery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022. Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Fei Xia, Ed Chi, Quoc V Le, Denny Zhou, et al. Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35:24824–24837, 2022. Jiaheng Wei, Zhaowei Zhu, Hao Cheng, Tongliang Liu, Gang Niu, and Yang Liu. Learn- ing with noisy labels revisited: A study using real-world human annotations. arXiv preprint arXiv:2110.12088, 2021. Yuexin Wu, Yichong Xu, Aarti Singh, Yiming Yang, and Artur Dubrawski. Active learning for graph neural networks via node feature propagation. arXiv preprint arXiv:1910.07567, 2019. Miao Xiong, Zhiyuan Hu, Xinyang Lu, Yifei Li, Jie Fu, Junxian He, and Bryan Hooi. Can llms express their uncertainty? an empirical evaluation of confidence elicitation in llms. arXiv preprint arXiv:2306.13063, 2023. Zhilin Yang, William W. Cohen, and Ruslan Salakhutdinov. Revisiting semi-supervised learning with graph embeddings. ArXiv, abs/1603.08861, 2016. URL https://api. semanticscholar.org/CorpusID:7008752. Ruosong Ye, Caiqi Zhang, Runhui Wang, Shuyuan Xu, and Yongfeng Zhang. Natural language is all a graph needs. arXiv preprint arXiv:2308.07134, 2023. Wentao Zhang, Yu Shen, Yang Li, Lei Chen, Zhi Yang, and Bin Cui. Alg: Fast and accurate active learning framework for graph convolutional networks. In Proceedings of the 2021 International Conference on Management of Data, SIGMOD '21, pp. 2366–2374, New York, NY, USA, 2021a. Association for Computing Machinery. ISBN 9781450383431. doi: 10.1145/3448016.3457325. URL https://doi.org/10.1145/3448016.3457325. Wentao Zhang, Yexin Wang, Zhenbang You, Meng Cao, Ping Huang, Jiulong Shan, Zhi Yang, and Bin Cui. Rim: Reliable influence-based active learning on graphs. Advances in Neural Information Processing Systems, 34:27978–27990, 2021b. Wentao Zhang, Zhi Yang, Yexin Wang, Yu Shen, Yang Li, Liang Wang, and Bin Cui. Grain: Im- proving data efficiency of graph neural networks via diversified influence maximization. arXiv preprint arXiv:2108.00219, 2021c. 12 Preprint Yuheng Zhang, Hanghang Tong, Yinglong Xia, Yan Zhu, Yuejie Chi, and Lei Ying. Batch active learning with graph neural networks via multi-agent deep reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pp. 9118–9126, 2022. Qi Zhu, Natalia Ponomareva, Jiawei Han, and Bryan Perozzi. Shift-robust gnns: Overcoming the limitations of localized graph training data. Advances in Neural Information Processing Systems, 34:27965–27977, 2021a. Zhaowei Zhu, Yiwen Song, and Yang Liu. Clusterability as an alternative to anchor points when learning with noisy labels. In International Conference on Machine Learning, pp. 12912–12923. PMLR, 2021b. 13 Preprint A LINKS TO THE SOURCE CODE Links to the code repo https://github.com/CurryTang/LLMGNN. B DETAILED INTRODUCTIONS OF BASELINE MODELS In this part, we present a more detailed introduction to related works, especially those baseline models adopted in this paper. B.1 GRAPH ACTIVE LEARNING METHODS 1. Density-based selection (Ma et al., 2022): We apply KMeans clustering in the feature space with the number of clusters set to the number of budgets. Then, nodes with closest distances to their clustering centers are selected as the training nodes. 2. GraphPart (Ma et al., 2022): A graph partition method is first applied to ensure the selection diversity. Then inside each region, nodes with high aggregated density are selected based on an approximate K-medoids algorithm. 3. FeatProp (Wu et al., 2019): Node features are first aggregated based on the adjacency matrix. Then, K-Medoids is applied to select the training nodes. 4. Degree-based selection (Ma et al., 2022): Nodes with the highest degrees are selected as the training nodes. 5. Pagerank-based selection (Ma et al., 2022): Nodes with the highest PageRank centrality are selected as the training nodes. 6. AGE (Cai et al., 2017): Nodes are selected based on a score function that considers both the density of features and PageRank centrality. We ignore the uncertainty measurement since we adopt a one-step selection setting. 7. RIM (Zhang et al., 2021b): Nodes with the highest reliable social influence are selected as the training nodes. Reliability is measured based on a pre-defined oracle accuracy and similarity between the aggregated node feature matrices. B.2 ZERO-SHOT CLASSIFICATION BASELINE MODELS 1. SES (Li & Hooi, 2023): An unsupervised method to do classification. Both node features and class names are projected into the same semantic space, and the class with the smallest distance is selected as the label. 2. TAG-Z (Li & Hooi, 2023): Adopting prompts and graph topology to produce preliminary logits, which are readily applicable for zero-shot node classification. 3. BART-Large-MNLI (Lewis et al., 2019): A zero-shot text classification model fine-tuned on the MNLI dataset. C MORE RELATED WORKS LLMs as Annotators. Curating human-annotated data is both labor-intensive and expensive, es- pecially for intricate tasks or niche domains where data might be scarce. Due to the exceptional zero-shot inference capabilities of LLMs, recent literature has embraced their use for generating pseudo-annotated data (Bansal & Sharma, 2023; Ding et al., 2022; Gilardi et al., 2023; He et al., 2023b; Pangakis et al., 2023; Pei et al., 2023). Gilardi et al. (2023); Ding et al. (2022) evaluate LLMs' efficacy as annotators, showcasing superior annotation quality and cost-efficiency compared to human annotators, particularly in tasks like text classification. Furthermore, Pei et al. (2023); He et al. (2023b); Bansal & Sharma (2023) delve into enhancing the efficacy of LLM-generated annotations: Pei et al. (2023); He et al. (2023b) explore prompt strategies, while Bansal & Sharma (2023) investigates sample selection. However, while acknowledging their effectiveness, Pangakis et al. (2023) highlights certain shortcomings in LLM-produced annotations, underscoring the need for caution when leveraging LLMs in this capacity. 14 Preprint D DATASETS In this paper, we use the following popular datasets commonly adopted for node classifications: CORA, CITESEER, PUBMED, WIKICS, OGBN-ARXIV, and OGBN-PRODUCTS. Since LLMs can only understand the raw text attributes, for CORA, CITESEER, PUBMED, OGBN-ARXIV, and OGBN- PRODUCTS, we adopt the text attributed graph version from Chen et al. (2023). For WIKICS, we get the raw attributes from https://github.com/pmernyei/wiki-cs-dataset. Then, we give a detailed description of each dataset in Table 4. In our examination of the TAG version from CITESEER, we identify a substantial number of incorrect labels. Such inaccuracies can potentially skew the assessment of model performance. To rectify this, we employ the methods proposed by Li et al. (2023) available at https://github.com/lywww/GraphCleaner. Table 4: Dataset descriptions Dataset Name #Nodes #Edges Task Description Classes CORA 2708 5429 Given the title and abstract, predict the category of this paper Rule Learning, Neural Networks , Case Based, Genetic Algorithms, Theory, Reinforcement Learning, Probabilistic Methods CITESEER 3186 4277 Given the title and abstract, predict the category of this paper Agents, Machine Learning, Information Retrieval, Database, Human Computer Interaction, Artificial Intelligence PUBMED 19717 44335 WIKICS 11701 215863 OGBN-ARXIV 169343 1166243 OGBN-PRODUCTS 2449029 61859140 Given the title and abstract, predict the category of this paper Given the contents of the Wikipedia article, predict the category of this article Given the title and abstract, predict the category of this paper Given the product description, predict the category of this product Diabetes Mellitus Experimental, Diabetes Mellitus Type 1, Diabetes Mellitus Type 2 Computational linguistics, Databases, Operating systems, Computer architecture, Computer security, Internet protocols, Computer file systems, Distributed computing architecture, Web technology, Programming language topics 40 classes from https://arxiv.org/archive/cs 47 classes from Amazon, including Home & Kitchen, Health & Personal Care... E PROMPTS In this part, we show the prompts designed for annotations. We require LLMs to output a Python dictionary-like object so that it's easier to extract the results from the output texts. We demonstrate the prompt used to generate annotations with 1-shot demonstration on CITESEER in 6, and the prompt used to do self-correction in 5. Table 5: Prompt used for self-correction Previous prompt: (Previous input) Your previous output doesn't follow the format, please correct it old output: (Previous output) Your previous answer (Previous answer) is not a valid class. Your should only output categories from the following list: (Lists of label names) New output here: F COMPLETE RESULTS FOR THE PRELIMINARY STUDY ON EFFECTIVENESS OF CONFIDENCE-AWARE PROMPTS The complete results for the preliminary study on confidence-aware prompts are shown in Table 7, Figure 6, and Figure 7. 15 Preprint Table 6: Full prompt example for 1-shot annotation with TopK strategy on the CITESEER dataset Input: I will first give you an example and you should complete task following the example. Question: (Contents for in-context learning samples) Argument in Multi-Agent Systems Multi- agent systems ...(Skipped for clarity) Computational societies are developed for two primary rea- sons: Mode... Task: There are following categories: [agents, machine learning, information retrieval, database, human computer interaction, artificial intelligence] What's the category of this paper? Provide your 3 best guesses and a confidence number that each is correct (0 to 100) for the follow- ing question from most probable to least. The sum of all confidence should be 100. For example, [ {"answer": <your first answer>, "confidence": <confidence for first answer>}, ... ] Output: [{"answer": "agents", "confidence": 60}, {"answer": "artificial intelligence", "confidence": 30}, {"answer": "human computer interaction", "confidence": 10}] Question: Decomposition in Data Mining: An Industrial Case Study Data (Contents for data to be annotated) Task: There are following categories: [agents, machine learning, information retrieval, database, human computer interaction, artificial intelligence] What's the category of this paper? Provide your 3 best guesses (The same instruction, skipped for clarity) ... Output: Table 7: Accuracy of annotations generated by LLMs after applying various kinds of prompt strate- gies. We use yellow to denote the best and green to denote the second best result. The cost is determined by comparing the token consumption to that of zero-shot prompts. CORA CITESEER PUBMED OGBN-ARXIV OGBN-PRODUCTS WIKICS Prompt Strategy Acc (%) Cost Acc (%) Cost Acc (%) Cost Acc (%) Cost Acc (%) Cost Acc (%) Cost Zero-shot One-shot TopK Most Voting Hybrid (Zero-shot) Hybrid (One-shot) 68.33 ± 6.55 69.67 ± 7.72 68.00 ± 6.38 68.00 ± 7.35 67.33 ± 6.80 70.33 ± 6.24 1 2.2 1.1 1.1 1.5 2.9 64.00 ± 7.79 65.67 ± 7.13 66.00 ± 5.35 65.33 ± 7.41 66.33 ± 6.24 67.67 ± 7.41 1 2.1 1.1 1.1 1.5 2.7 88.67 ± 2.62 90.67 ± 1.25 89.67 ± 1.25 88.33 ± 2.49 87.33 ± 0.94 90.33 ± 0.47 1 2.0 1.1 1.4 1.7 2.2 73.67 ± 4.19 69.67 ± 3.77 72.67 ± 4.50 73.33 ± 4.64 72.33 ± 4.19 70.00 ± 2.16 1 1.9 1 1.1 1.2 2.1 75.33 ± 4.99 78.67 ± 4.50 74.00 ± 5.10 75.33 ± 4.99 73.67 ± 5.25 75.67 ± 6.13 1 1.8 1.2 1.1 1.4 2.3 68.33 ± 1.89 72.00 ± 3.56 72.00 ± 2.16 69.00 ± 2.16 71.00 ± 2.83 73.67 ± 2.62 1 2.4 1.1 1.1 1.4 2.9 Figure 6: Relationship between the group accuracies sorted by confidence generated by LLMs. k refers to the number of nodes selected in the groups. 16 50100150200250300k0.700.800.90AccuracyCora50100150200250300k0.700.750.800.850.900.95AccuracyWikiCSOne-ShotMost VotingTop-KHybrid(One-Shot)Zero-ShotHybrid(Zero-Shot) Preprint Figure 7: Relationship between the group accuracies sorted by confidence generated by LLMs. k refers to the number of nodes selected in the groups. G PRELIMINARY OBSERVATIONS OF LLM'S ANNOTATIONS G.1 LABEL-LEVEL OBSERVATIONS We begin by examining the label-level characteristics of annotations generated by LLMs. Label distribution is critical as it can influence model training. For example, imbalanced training labels may make models overfit to the majority classes (He & Garcia, 2009). Specifically, we juxtapose the distribution of LLM annotations against the ground truths. To facilitate this analysis, we employ noise transition matrices, a tool frequently used to study both real-world noisy labels (Wei et al., 2021) and synthetic ones (Zhu et al., 2021b). Considering a classification problem with N classes, the noise transition matrix T will be an N ×N matrix where each entry Tij represents the probability that an instance from the true class i is given the label j. If i = j, then Tij is the probability that a true class i is correctly labeled as i. If i ̸= j, then Tij is the probability that a true class i is mislabeled as j. To generate the noise transition matrices, we sample 1000 nodes randomly for each dataset. Fig- ure 8 demonstrates the noise transition matrix for WIKICS, CORA, and CITESEER, three datasets with proper number of classes for visualization. We demonstrate the results of adopting the "zero- shot hybrid" prompting strategy in this figure. We illustrate the results for few-shot demonstration strategies and synthetic noisy labels in Appendix G.1. Since the number of samples in each class is imbalanced, we also show the label distribution for both ground truth and LLM's annotations in Figure 11. An examination of Figure 8 reveals intriguing patterns. FIRST, the quality of annotations, defined as the proportion of annotations aligned with the ground truth, exhibits significant variation across different classes. For instance, in the WIKICS dataset, LLMs produce perfect annotations for sam- ples where the ground truth class is c0 (referring to "Computational linguistics"). In contrast, only 31% of annotations are accurate for samples belonging to c7, referring to "distributed computing architecture". Similar phenomena can be observed in the CORA and CITESEER datasets. SECOND, for those classes with low annotation quality, incorrect annotations will not be distributed to other classes with a uniform probability. Instead, they are more likely to fall into one or two specific categories. For example, for WIKICS, c7 ("distributed computing architecture") tends to flip into c8 ("web technology"). The reason may be that these two classes present similar meanings, and for some samples, categorizing them into any of these two classes is reasonable. Moreover, we find that such kind of flipping can be asymmetric. Although c7 in WIKICS tends to flip into c8, samples from c8 never flip into c7. These properties make LLMs' annotations highly different from the synthetic noisy labels commonly adopted in previous literature (Song et al., 2022), which are much more uniform among different classes. Referring to Figure 11, we observe a noticeable divergence between the annotation distribution generated by LLMs and the original ground truth distribution across various datasets. Notably, in the WIKICS dataset, what is originally a minority class, c8, emerges as one of the majority classes. A similar shift is evident with class c6 in the CORA dataset. This trend can be largely attributed to the asymmetry inherent in the noise transition matrix. 17 50100150200250300k0.600.650.700.750.80AccuracyCiteseer50100150200250300k0.900.930.950.971.00AccuracyPubmedOne-ShotMost VotingTop-KHybrid(One-Shot)Zero-ShotHybrid(Zero-Shot) Preprint (a) WIKICS (b) CORA (c) CITESEER Figure 8: Noise transition matrix plot for WIKICS, CORA, and CITESEER with annotations gener- ated by LLMs (a) WIKICS (b) CORA (c) CITESEER Figure 9: Noise transition matrix plot for WIKICS, CORA, and CITESEER with annotations gener- ated by LLMs using prompts with few-shot demonstrations G.2 RELATIONSHIP BETWEEN ANNOTATION QUALITY AND C-DENSITY As shown in Figure 12, the phenomenon on PUBMED is not as evident as on the other datasets. One possible reason is that the annotation quality of LLM on PUBMED is exceptionally high, making the differences between different groups less distinct. Another possible explanation, as pointed out in (Chen et al., 2023), is that LLM might utilize some shortcuts present in the text attributes during its annotation process, and thus the correlation between features and annotation qualities is weakened. (a) WIKICS (b) PUBMED Figure 12: Relationship between the group accuracies and distances to the clustering centers. The bar shows the average accuracy inside the selected group. The line shows the accumulated average accuracy. 18 012345678901234567891.000.000.000.000.000.000.000.000.000.000.060.850.000.000.040.020.000.000.020.000.040.000.720.040.060.010.010.010.090.020.150.000.080.580.030.020.010.010.130.010.040.000.020.000.850.040.010.000.040.000.020.000.030.030.050.730.000.000.130.000.000.000.120.000.060.020.710.080.000.000.040.070.000.050.030.030.000.310.470.000.030.000.000.000.000.080.000.000.860.030.070.020.020.030.020.000.000.000.090.74012345601234560.360.070.120.000.100.050.310.010.650.020.000.070.030.230.080.050.690.000.080.040.060.020.060.000.820.030.030.030.170.100.040.010.270.110.300.000.050.030.010.010.880.010.010.040.010.000.030.010.890123450123450.520.100.050.010.100.230.040.770.060.000.010.120.020.210.700.020.050.010.020.050.180.640.010.100.040.100.120.020.690.030.080.310.110.000.070.43012345678901234567891.000.000.000.000.000.000.000.000.000.000.000.970.000.000.030.000.000.000.000.000.040.020.760.030.040.010.020.000.060.030.060.010.130.660.010.010.030.020.070.010.010.010.010.000.840.060.030.000.040.000.000.000.010.030.060.750.040.000.110.000.000.000.090.000.040.000.770.090.020.000.080.110.030.040.010.010.040.110.560.000.030.000.000.000.000.030.000.000.940.000.110.010.030.050.010.000.010.010.090.69012345601234560.620.070.050.030.070.030.120.010.630.030.020.120.000.170.070.020.640.010.210.030.020.020.040.010.830.060.040.010.230.090.060.020.380.070.160.000.080.010.050.040.760.050.010.030.030.010.090.010.830123450123450.820.060.030.010.060.030.020.810.080.010.010.070.010.180.750.030.020.000.020.040.230.650.010.050.030.080.150.040.690.020.180.430.100.020.050.220123456789Region Index0.600.650.700.750.800.850.900.951.00Average Accuracy0123456789Region Index0.600.650.700.750.800.850.900.951.00Average Accuracy Preprint (a) WIKICS (b) CORA (c) CITESEER Figure 10: Noise transition matrix plot for WIKICS, CORA, and CITESEER with annotations gener- ated by injecting random noise into the ground truth. (a) WIKICS (b) CORA Figure 11: Label distributions for ground truth labels and LLM's annotations H HYPERPARAMTERS AND EXPERIMENTAL SETUPS We now demonstrate the hyper-parameters adopted in this paper, which is inspired by Hu et al. (2020b): 1. For small-scale datasets including CORA, CITESEER, PUBMED, and WIKICS, we set: learning rate to 0.01, weight decay to 5e−4, hidden dimension to 64, dropout to 0.5. 2. For large-scale datasets including OGBN-ARXIV and OGBN-PRODUCTS, we set: learning rate to 0.01, weight decay to 5e−4, hidden dimension to 256, dropout to 0.5. For detailed implementation of GCN (Kipf & Welling, 2016) and GraphSage (Hamilton et al., 2017) on large-scale graphs OGBN-PRODUCTS, we adopt the pre-computing strategy shown in https://github.com/snap-stanford/ogb/tree/master/examples/ nodeproppred/products to store the intermediate computation results and conduct full- training training and inference. I EXPERIMENTAL RESULTS FOR GRAPHSAGE The results when setting GraphSAGE as the GNN model are shown in Table 8. 19 012345678901234567890.570.000.000.140.140.000.070.000.070.000.040.540.020.040.060.040.080.040.060.060.020.020.710.040.030.030.030.050.010.050.030.040.040.750.020.020.020.020.020.040.060.020.030.060.670.050.030.030.030.030.030.030.030.000.000.720.080.000.070.030.020.000.040.020.020.020.750.080.020.020.040.050.030.010.010.010.030.770.040.000.000.030.000.060.030.030.060.000.720.080.040.020.030.040.020.000.020.030.050.73012345601234560.610.050.050.050.120.070.050.050.650.070.050.070.050.050.070.070.620.060.030.070.080.050.080.050.660.060.060.040.070.030.080.040.690.050.050.040.010.030.070.070.730.050.030.100.030.030.060.060.680123450123450.660.050.050.040.110.080.060.620.100.070.070.090.050.090.660.070.070.050.080.060.060.660.060.080.080.050.060.080.670.060.060.110.070.060.120.580123456789Labels0100200300#AppearancesGround truthAnnotations0123456Labels0100200300#AppearancesGround truthAnnotations Preprint Table 8: Comparative studies on different active selection strategies. GraphSAGE is selected as the base model. OOT means this method can not scale to large-scale graphs because of too long execution time. Random C-Density PS-Random Density DA-Density PS-Density DA-PS-Density Degree DA-degree PS-degree DA-PS-degree Pagerank DA-pagerank PS-pagerank DA-PS-pagerank AGE DA-AGE PS-AGE DA-PS-AGE RIM DA-RIM PS-RIM DA-PS-RIM GraphPart DA-GraphPart PS-GraphPart DA-PS-GraphPart CORA CITESEER PUBMED WIKICS 69.03 ± 0.48 40.46 ± 3.56 69.89 ± 1.53 71.51 ± 0.16 71.38 ± 0.79 72.92 ± 0.22 71.25 ± 0.54 68.81 ± 0.36 74.53 ± 0.44 68.13 ± 0.58 75.22 ± 0.55 70.24 ± 0.86 72.57 ± 0.18 70.76 ± 0.48 72.89 ± 0.52 71.11 ± 0.06 72.29 ± 1.11 70.87 ± 0.17 72.70 ± 0.59 66.94 ± 0.86 70.60 ± 0.93 68.54 ± 0.43 70.85 ± 0.40 66.38 ± 2.10 66.38 ± 2.10 62.29 ± 0.08 63.32 ± 0.79 65.64 ± 0.90 61.72 ± 0.12 66.34 ± 0.35 58.70 ± 0.80 61.26 ± 0.88 55.47 ± 0.51 64.90 ± 0.99 64.45 ± 0.52 61.85 ± 0.85 59.88 ± 0.62 62.28 ± 0.41 62.25 ± 0.51 63.36 ± 0.73 61.55 ± 0.85 65.51 ± 0.47 53.62 ± 0.72 58.46 ± 1.22 62.65 ± 0.58 65.04 ± 0.61 63.19 ± 0.76 60.22 ± 1.31 58.35 ± 0.98 67.89 ± 0.29 65.26 ± 1.27 65.26 ± 1.27 65.73 ± 0.84 63.97 ± 2.59 73.73 ± 1.54 39.76 ± 0.00 71.03 ± 4.28 73.34 ± 0.27 39.78 ± 0.00 66.54 ± 3.67 39.81 ± 0.00 66.02 ± 0.47 69.96 ± 0.61 39.81 ± 0.00 66.21 ± 0.62 65.55 ± 1.10 65.55 ± 1.10 71.34 ± 1.44 66.53 ± 0.34 64.20 ± 2.15 59.10 ± 0.66 74.02 ± 0.34 74.02 ± 0.34 73.57 ± 0.58 39.87 ± 0.00 64.96 ± 1.28 57.74 ± 0.61 75.50 ± 1.79 74.65 ± 2.25 75.50 ± 1.79 77.36 ± 0.98 62.13 ± 2.30 60.95 ± 1.00 63.41 ± 2.24 65.84 ± 0.29 64.32 ± 0.73 53.08 ± 0.74 65.57 ± 0.76 67.68 ± 0.54 64.54 ± 1.12 68.97 ± 0.57 64.54 ± 1.19 67.49 ± 0.56 67.44 ± 0.58 70.33 ± 0.49 67.10 ± 0.46 59.49 ± 0.38 58.32 ± 0.25 60.77 ± 0.70 59.84 ± 0.92 67.26 ± 0.63 67.67 ± 0.55 68.92 ± 0.49 62.15± 0.31 67.32 ± 0.39 70.74 ± 0.37 65.96 ± 0.13 69.35 ± 1.05 FeatProp PS-Featprop 70.21 ± 0.00 72.62 ± 0.64 67.19 ± 0.00 66.48 ± 1.40 76.18 ± 0.45 71.64 ± 1.08 66.16 ± 0.37 68.32 ± 0.34 20
http://arxiv.org/abs/2310.04652v1
"2023-10-07T02:17:22"
"2023-10-07T02:17:22"
Oracle Efficient Algorithms for Groupwise Regret
We study the problem of online prediction, in which at each time step $t$, an individual $x_t$ arrives, whose label we must predict. Each individual is associated with various groups, defined based on their features such as age, sex, race etc., which may intersect. Our goal is to make predictions that have regret guarantees not just overall but also simultaneously on each sub-sequence comprised of the members of any single group. Previous work such as [Blum & Lykouris] and [Lee et al] provide attractive regret guarantees for these problems; however, these are computationally intractable on large model classes. We show that a simple modification of the sleeping experts technique of [Blum & Lykouris] yields an efficient reduction to the well-understood problem of obtaining diminishing external regret absent group considerations. Our approach gives similar regret guarantees compared to [Blum & Lykouris]; however, we run in time linear in the number of groups, and are oracle-efficient in the hypothesis class. This in particular implies that our algorithm is efficient whenever the number of groups is polynomially bounded and the external-regret problem can be solved efficiently, an improvement on [Blum & Lykouris]'s stronger condition that the model class must be small. Our approach can handle online linear regression and online combinatorial optimization problems like online shortest paths. Beyond providing theoretical regret bounds, we evaluate this algorithm with an extensive set of experiments on synthetic data and on two real data sets -- Medical costs and the Adult income dataset, both instantiated with intersecting groups defined in terms of race, sex, and other demographic characteristics. We find that uniformly across groups, our algorithm gives substantial error improvements compared to running a standard online linear regression algorithm with no groupwise regret guarantees.
[ "Krishna Acharya", "Eshwar Ram Arunachaleswaran", "Sampath Kannan", "Aaron Roth", "Juba Ziani" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04652v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04652v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 2 5 6 4 0 . 0 1 3 2 : v i X r a Oracle Efficient Algorithms for Groupwise Regret Krishna Acharya1, Eshwar Ram Arunachaleswaran2, Sampath Kannan2, Aaron Roth2, and Juba Ziani1 1Georgia Institute of Technology 2University of Pennsylvania October 10, 2023 Abstract We study the problem of online prediction, in which at each time step t ∈ {1, 2, * * * T }, an individual xt arrives, whose label we must predict. Each individual is associated with various groups, defined based on their features such as age, sex, race etc., which may intersect. Our goal is to make predictions that have regret guarantees not just overall but also simultaneously on each sub-sequence comprised of the members of any single group. Previous work [Blum and Lykouris, 2019] provides attractive regret guarantees for these problems; however, these are computationally intractable on large model classes (e.g., the set of all linear models, as used in linear regression). We show that a simple modification of the sleeping-experts-based approach of Blum and Lykouris [2019] yields an efficient reduction to the well-understood problem of obtaining diminishing external regret absent group considerations. Our approach gives similar regret guarantees compared to Blum and Lykouris [2019]; however, we run in time linear in the number of groups, and are oracle-efficient in the hypothesis class. This in particular implies that our algorithm is efficient whenever the number of groups is polynomially bounded and the external-regret problem can be solved efficiently, an improvement on Blum and Lykouris [2019]'s stronger condition that the model class must be small. Our approach can handle online linear regression and online combinatorial optimization problems like online shortest paths. Beyond providing theoretical regret bounds, we evaluate this algorithm with an extensive set of experiments on synthetic data and on two real data sets - Medical costs and the Adult income dataset, both instantiated with intersecting groups defined in terms of race, sex, and other demographic characteristics. We find that uniformly across groups, our algorithm gives substantial error improvements compared to running a standard online linear regression algorithm with no groupwise regret guarantees. 1 Introduction Consider the problem of predicting future healthcare costs for a population of people that is arriving dynamically and changing over time. To handle the adaptively changing nature of the problem, we might deploy an online learning algorithm that has worst-case regret guarantees for arbitrary sequences. For example, we could run the online linear regression algorithm of Azoury and Warmuth [2001], which would guarantee that the cumulative squared error of our predictions is at most (up to low order terms) the squared error of the best fixed linear regression function in hindsight. Here we limit ourselves to a simple hypothesis class like linear regression models, because in general, efficient no-regret algorithms are not known to exist for substantially more complex hypothesis classes. It is likely however that the underlying population is heterogenous: not all sub-populations are best modeled by the same linear function. For example, "the best" linear regression model in hindsight might be different for different subsets of the population as broken out by sex, age, race, occupation, or other demographic characteristics. Yet because these demographic groups overlap - an individual belongs to some group based on race, another based on sex, and still another based on age, etc - we cannot simply run a different algorithm for each demographic group. This motives the 1 notion of groupwise regret, first studied by Blum and Lykouris [2019]. A prediction algorithm guarantees diminishing groupwise regret with respect to a set of groups G and a hypothesis class H, if simultaneously for every group in G, on the subsequence of rounds consisting of individuals who are members of that group, the squared error is at most (up to low order regret terms) the squared error of the best model in H on that subsequence. Blum and Lykouris [2019] gave an algorithm for solving this problem for arbitrary collections of groups G and hypothesis classes H - see Lee et al. [2022] for an alternative derivation of such an algorithm. Both of these algorithms have running times that depend polynomially on |G| and |H| – for example, the algorithm given in Blum and Lykouris [2019] is a reduction to a sleeping experts problem in which there is one expert for every pairing of groups in G with hypotheses in H. Hence, neither algorithm would be feasible to run for the set H consisting of e.g. all linear functions, which is continuously large - and which is exponentially large in the dimension even under any reasonable discretization. Our first result is an "oracle efficient" algorithm for obtaining diminishing groupwise regret for any polynomially large set of groups G and any hypothesis class H: In other words, it is an efficient reduction from the problem of obtaining groupwise regret over G and H to the easier problem of obtaining diminishing (external) regret to the best model in H ignoring group structure. This turns out to be a simple modification of the sleeping experts construction of Blum and Lykouris [2019]. Because there are efficient, practical algorithms for online linear regression, a consequence of this is that we get the first efficient, practical algorithm for online linear regression for obtaining groupwise regret for any reasonably sized collection of groups G (our algorithm needs to enumerate over the groups at each round and so has running time linear in |G|). Theorem 1 (Informal). Any online learning problem with a computationally efficient algorithm guaranteeing vanishing regret also admits a computationally efficient algorithm (Algorithm 1) guaranteeing vanishing groupwise regret in the full information setting, for any polynomial-size collection of of arbitrarily intersecting groups. We can instantiate this theorem in any setting in which we have an efficient no (external) regret learning algorithm. For example, we can instantiate it for online classification problems when the benchmark class has a small separator set, using the algorithm of Syrgkanis et al. [2016]; for online linear optimization problems, we can instantiate it using the "Follow the Perturbed Leader" (FTPL) algorithm of Kalai and Vempala [2005]. For online linear regression problems, we can instantiate it with the online regression algorithm of Azoury and Warmuth [2001]. With our algorithm in hand, we embark on an extensive set of experiments in which the learning task is linear regression, both on synthetic data and on two real datasets. In the synthetic data experiment, we construct a distribution with different intersecting groups. Each group is associated with a (different) underlying linear model; individuals who belong to multiple groups have labels that are generated via an aggregation function using the models of all of the containing groups. We experiment with different aggregation func- tions (such as using the mean, minimum, maximum generated label, as well as the label of the first relevant group in a fixed lexicographic ordering). We find that consistently across all aggregation rules, our algorithm for efficiently obtaining groupwise regret when instantiated with the online regression algorithm of Azoury and Warmuth [2001] has substantially lower cumulative loss and regret on each group compared to when we run the online regression algorithm of Azoury and Warmuth [2001] alone, on the entire sequence of examples. In fact, when using our algorithm, the regret to the best linear model in hindsight when restricted to a fixed group is often negative, which 2 Figure 1: Regret vs. time (as a fraction of subsequence length), for 5 demographic groups based on age, sex; and 2 non- demographic groups based on smoking habits 0.00.20.40.60.81.0Time / length of subsequence1.51.00.50.00.5RegretDemographic groups: age(young, middle, old), sex(male, female)Young (Baseline)Young (Our Algorithm)Middle (Baseline)Middle (Our Algorithm)Old (Baseline)Old (Our Algorithm)Male (Baseline)Male (Our Algorithm)Female (Baseline)Female (Our Algorithm)0.00.20.40.60.81.0Time / length of subsequence012345RegretGroups: smoker, non-smokerSmoker (Baseline)Smoker (Our Algorithm)Non-Smoker (Baseline)Non-Smoker (Our Algorithm) means we make predictions that are more accurate than that of the best linear model tailored for that group, despite using linear learners as our underlying hypothesis class. This occurs because there are many individuals who are members of multiple groups, and our algorithm must guarantee low regret on each group separately, which requires ensembling different linear models across groups whenever they intersect. This ensembling leads to an accuracy improvement. We then run comparisons on two real datasets: the prediction task in the first is to predict patient medical costs, and the task in the second is to predict income from demographic attributes recorded in Census data. We define intersecting groups using attributes like age, sex, race etc. Here too, our algorithm, instantiated with the online regression algorithm of Azoury and Warmuth [2001], has consistently lower groupwise regret than the baseline of just running the algorithm of Azoury and Warmuth [2001] alone on the entire sequence of examples. Thus, even though algorithms with worst-case regret guarantees are not known for hypothesis classes substantially beyond linear regression, we can use existing online linear regression algorithms to efficiently obtain substantially lower error while satisfying natural fairness constraints by demanding groupwise regret guarantees. In Figure 1, we plot the performance of our algorithm instantiated with the online linear regression algorithm of Azoury and Warmuth [2001], compared to the baseline of running Azoury and Warmuth [2001] alone on all data points, on a medical cost prediction task. We divide the population into a number of intersecting groups, on the basis of age (young, middle, and old), sex (male and female) and smoking status (smoker and non-smoker). We plot the regret (the difference between the squared error obtained, and the squared error obtainable by the best linear model in hindsight) of our algorithm compared to the baseline on each of these demographic groups (in the top panel for age and sex groups, and in the bottom panel for smoking related groups). Since the number of individuals within each group is different for different groups, we normalize the x axis to represent the fraction of individuals within each group seen so far, which allows us to plot all of the regret curves on the same scale. In these computations, the performance of our algorithm comes from a single run though the data, whereas "the best model in hindsight" is computed separately for each group. The plot records average performance over 10 runs. Here medical costs have been scaled to lie in [0, 1] and so the absolute numbers are not meaningful; it is relative comparisons that are important. What we see is representative on all of our experiments: the groupwise regret across different groups is consistently both lower and growing with time at a lower rate than the regret of the baseline. The regret can even be increasingly negative as seen in the age and sex groups. 1.1 Related Work The problem of obtaining diminishing groupwise regret in a sequential decision-making setting was introduced by Blum and Lykouris [2019] (see also Rothblum and Yona [2021] who introduce a related problem in the batch setting). The algorithm of Blum and Lykouris [2019] is a reduction to the sleeping experts problem; Lee et al. [2022] derive another algorithm for the same problem from first principles as part of a general online multi-objective optimization framework. Both of these algorithms have running time that scales at least linearly with (the product of) the number of groups and the cardinality of the benchmark hypothesis class. In the batch setting, Tosh and Hsu [2022] use an online-to-batch reduction together with the sleeping-experts style algorithm of Blum and Lykouris [2019] to obtain state-of-the-art batch sample complexity bounds. None of these algorithms are oracle efficient, and as far as we are aware, none of them have been implemented - in fact, Tosh and Hsu [2022] explicitly list giving an efficient version of Blum and Lykouris [2019] that avoids enumeration of the hypothesis class as an open problem. Globus-Harris et al. [2022] derive an algorithm for obtaining group-wise optimal guarantees that can be made to be "oracle efficient" by reduction to a ternary classification problem, and they give an experimental evaluation in the batch setting-but their algorithm does not work in the sequential prediction setting. Multi-group regret guarantees are part of the "multi-group" fairness literature, which originates with Kearns et al. [2018] and H ́ebert-Johnson et al. [2018]. In particular, multicalibration H ́ebert-Johnson et al. [2018] is related to simultaneously minimizing prediction loss for a benchmark class, on subsets of the data Gopalan et al. [2022, 2023], Globus-Harris et al. [2023]. One way to get groupwise regret guarantees with respect to a set of groups G and a benchmark class H would be to promise "multicalibration" with respect to 3 the class of functions G × H. Very recently, Garg et al. [2023] gave an oracle efficient algorithm for obtaining multicalibration in the sequential prediction setting by reduction to an algorithm for obtaining diminishing external regret guarantees. However, to apply this algorithm to our problem, we would need an algorithm that promises external regret guarantees over the functions in the class G × H. We do not have such an algorithm: For example the algorithm of Azoury and Warmuth [2001] can be used to efficiently obtain diminishing regret bounds with respect to squared error and the class of linear functions: but even when H is the set of linear functions, taking the Cartesian product of H with a set of group indicator functions will result in a class of highly non-linear functions for which online regret bounds are not known. In contrast to Garg et al. [2023], our approach can be used to give groupwise regret using a learning algorithm only for H (rather than an algorithm for G × H), which lets us give an efficient algorithm for an arbitrary polynomial collection of groups, and the benchmark class of linear functions. 2 Model We study a model of online contextual prediction against an adversary in which we compare to benchmarks simultaneously across multiple subsequences of time steps in {1, . . . , T }. Each subsequence is defined by a time selection function I : {1, . . . , T } → {0, 1} 1 which specifies whether or not each round t is a member of the subsequence or not. In each round, the learner observes a context xt ∈ X where X ⊆ [0, 1]d; based on this context, he chooses a prediction pt ∈ A ⊆ [0, 1]n. Then, the learner observes a cost (chosen by an adversary) for each possible prediction in A. The learner is aware of a benchmark class of policies H; each f ∈ H is a function from X to A and maps contexts to predictions. The learner's goal is to achieve loss that is as low as the loss of the best policy in hindsight - not just overall, but also simultaneously on each of the subsequences (where "the best policy in hindsight" may be different on different subsequences). More precisely, the interaction is as follows. The loss function l maps actions of the learner and the adversary to a real valued loss in [0, 1]. The time selection functions I = {I1, I2, * * * I|I|} are the indicator function for the corresponding subsequence. In rounds t ∈ {1, . . . , T }: 1. The adversary reveals context xt ∈ X (representing any features relevant to the prediction task at hand), as well as I(t) for each I ∈ I, the indicator for whether each subsequence contains round t. 2. The learner (with randomization) picks a policy pt : X → A 2 and makes prediction pt(xt) ∈ A. Simultaneously, the adversary selects an action yt taken from a known set Y. 3. The learner learns the adversary's action yt and obtains loss l(pt(xt), yt) ∈ [0, 1]. We define the regret on any subsequence against a policy f ∈ H as the difference in performance of the algorithm and that of using f in hindsight to make predictions. The regret of the algorithm on subsequence I is measured against the best benchmark policy in hindsight (for that subsequence): Regret on Subsequence I = E (cid:35) I(t)l(pt(xt), yt) (cid:34) (cid:88) t − min fI ∈H (cid:88) t I(t)l (fI (xt), yt) . Here, E [(cid:80) (cid:80) t I(t)l(pt(xt), yt)] is the expected loss obtained on subsequence I by an algorithm that uses policy pt at time step t, and minfI ∈H t I(t)l (f (xt), yt) represents the smallest loss achievable in hindsight on this subsequence given a fixed policy f ∈ H. This regret measures, on the current subsequence, how well our algorithm is doing compared to what could have been achieved had we known the contexts xt and the actions yt in advance-if we could have made predictions for this subsequence in isolation. Of course the same example can belong to multiple subsequences, which complicates the problem. The goal is to upper bound the regret on each subsequence I by some sublinear function o(TI ) where TI = (cid:80) t I(t) is the 'length' of I. 1Our results hold without significant modification for fractional time selection, i.e., I : 1 . . . T → [0, 1]. 2For most of our applications, the policy is in fact picked from the benchmark class, however in one of our applications, online least regression, the analysis is simplified by allowing policies beyond the benchmark. 4 In the context of our original motivation, the subsequences map to the groups we care about-the subsequence for a group is active on some round t if the round t individual is a member of that group. Our benchmark class can be, e.g., the set of all linear regression functions. Obtaining low subsequence regret would be straightforward if the subsequences were disjoint3. The main challenge is that in our setting, the subsequences can intersect, and we cannot treat them independently anymore. In aid of our techniques, we briefly describe the problem of external regret minimization, a problem that is generalized by the setup above, but which consequently admits stronger results (better bounds in running time/ regret) in various settings. External Regret Minimization In this problem, the learner has access to a finite set of experts E, and picks an expert et ∈ E with randomization in each round t ∈ {1, 2 * * * T }, in each round. An adversary then reveals a loss vector lt ∈ R|E| with the learner picking up a loss of lt(et). The learner's objective is to minimize the overall regret, called external regret, on the entire sequence as measured against the single best expert in hindsight. Formally : External Regret = E (cid:34) (cid:88) t (cid:35) lt(et) − min e∈E (cid:88) t lt(e). An online learning algorithm is called a no-regret algorithm if its external regret is sublinear in T , i.e. o(T ), and its running time and regret are measured in terms of the complexity of the expert set E. 3 Subsequence Regret Minimization via Decomposition We outline our main algorithm for online subsequence regret minimization. Algorithm 1 maintains |I| experts, each corresponding to a single subsequence, and aggregates their predictions suitably at each round. Each expert runs their own external regret minimizing or no-regret algorithms (each measuring regret against the concept class H). However and as mentioned above, the challenge is that any given time step might belong simultaneously to multiple subsequences. Therefore, it is not clear how to aggregate the different suggested policies corresponding to the several currently "active" subsequences (or experts) to come up with a prediction. To aggregate the policies suggested by each expert or subsequence, we use the AdaNormalHedge algorithm of Luo and Schapire [2015] with the above no-regret algorithms forming the set of k meta-experts for this problem. Theorem 2. For each subsequence I, assume there is an online learning algorithm Z I that picks amongst policies in H mapping contexts to actions and has external regret (against H) upper bounded by αI . Then, there exists an online learning algorithm (Algorithm 1), that given |I| subsequences I , has total runtime (on a per round basis) equal to the sum of runtimes of the above algorithms and a term that is a polynomial in |I| and d and obtains a regret of αI + O for any subsequence I with associated length TI . (cid:17) (cid:16)(cid:112)TI log |I|| In the interest of space, the proof has been moved to Appendix B. As an immediate consequence of this theorem, we obtain the main result of our paper as a corollary (informally stated). Theorem 3. Any online learning problem with a computationally efficient algorithm for obtaining vanishing regret also admits a computationally efficient algorithm for vanishing subsequence regret over subsequences defined by polynomially many time selection functions. Improved computational efficiency compared to Blum and Lykouris [2019] We remark that our method is similar to Blum and Lykouris [2019] in that it relies on using AdaNormalHedge to decide between different policies. However, it differs in the set of actions or experts available to this algorithm, allowing us to obtain better computational efficiency in many settings. 3One could just run a separate no-regret learning algorithm on all subsequences separately. 5 Parameters: Time Horizon T 1. Initialize an instance Z I of an external regret minimization algorithm for the subsequence corresponding to each time selection function I ∈ I, with the policy class H as the set of experts. 2. Initialize an instance Z of AdaNormalHedge with {Z I }I∈I as the set of policies, which we call meta-experts. 3. For t = 1, 2, * * * T : (a) Subsequence-level prediction step: Observe context xt. Each meta-expert Z I recom- mends a randomized policy pI t with realization zI t (from H). (b) Prediction aggregation step: Using the information from the subsequence indicators and a. Set the policy pt I ′(xt)). fresh randomness, use AdaNormalHedge to sample a meta-expert Z I ′ of the algorithm to be policy zt I ′ offered by this meta-expert (i.e. pick action zt (c) Update step: Observe the adversary's action yt. Update the state of algorithm Z by treating the loss of meta-expert Z I as l(zI t (xt), yt) For each subsequence I that is 'active' in this round (i.e., with I(t) = 1), update the internal state of the algorithm Z I using xt and yt. aAdaNormalHedge in fact samples from only the set of meta-experts corresponding to active subsequences Algorithm 1: Algorithm for Subsequence Regret Minimization In our algorithm, we use exactly |I| experts; each of these experts corresponds to a single subsequence and makes recommendations based on a regret minimization algorithm run only on that subsequence. Their construction instead instantiates an expert for each tuple (f, I), where f ∈ H is a policy and I ∈ I is a subsequence; a consequence is that their running time is polynomial in the size of the hypothesis class. We avoid this issue by delegating the question of dealing with the complexity of the policy class to the external regret minimization algorithm associated with each subsequence, and by only enumerating |I| experts (one for each subsequence). Practical algorithms are known for the external regret minimization sub-problem (that must be solved by each expert) for many settings of interest with large (or infinite) but structured policy classes (expanded upon in Section 4). 4 Applications of our Framework 4.1 Online Linear Regression Our first application is online linear regression with multiple groups. At each round t, a single individual arrives with context xt and belongs to several groups; the learner observes this context and group membership for each group and must predict a label. Formally, the context domain is X = [0, 1]d where a context is an individual's feature vector; the learner makes a prediction ˆyt in A = [0, 1], the predicted label ; the adversary, for its action, picks yt ∈ Y = [0, 1] as his action, which is the true label ; and the policy class H is the set of linear regressors in d dimensions, i.e. H consists of all policies θ ∈ Rd where θ(xt) := ⟨θ, xt⟩ ∀xt ∈ X. 4 Each subsequence I corresponds to a single group g within the set of groups G = {g1, g2, * * * g|G|}; in each round the subsequence indicator functions I(t) are substituted by group membership indicator functions g(t), for each g ∈ G. The goal is to minimize regret (as defined in Section 2) with respect to the squared error loss: 4While these predictions may lie outside [0, 1], we allow our instantiation of AdaNormalHedge to clip predictions outside this interval to the nearest endpoint to ensure the final prediction lies in [0, 1], since this can only improve its performance. We also note that the algorithm of Azoury and Warmuth [2001] has reasonable bounds on the predictions, which is reflected in the corresponding external regret bounds (See Cesa-Bianchi and Lugosi [2006] for details). 6 i.e., given that yt is the true label at round t, ˆyt is the label predicted by the learner, the loss accrued in round t is simply the squared error l(ˆyt, yt) = (ˆyt − yt)2. The notion of subsequence regret measured against a policy θ ∈ H in this setting leads exactly to the following groupwise regret metric for any given group g (against θ): Regret of Group g against policy θ = E (cid:35) g(t)(ˆyt − yt)2 − (cid:34) T (cid:88) t=1 T (cid:88) t=1 g(t)(⟨θ, xt⟩ − yt)2. (1) Our goal is to bound this quantity for each group g in terms of Tg := (cid:80) of subsequence associated with group g, and in terms of the size of θ. t g(t), which we refer to as the length For each subsequence I, we use the online ridge regression algorithm of Azoury and Warmuth [2001] to instantiate the corresponding meta-expert Z I in Algorithm 1. We note that our algorithm obtains the following groupwise regret guarantees as a direct corollary from Theorem 2. Corollary 1. There exists an efficient algorithm with groupwise regret guarantees for online linear regression with squared loss. This algorithm runs in time polynomial in |G| and d and guarantees that the regret for group g as measured against any policy θ ∈ H is upper-bounded by (cid:18) O d ln(1 + Tg) + (cid:113) Tg ln(|G|) + ∥θ∥2 2 (cid:19) , where Tg denotes the length of group subsequence g. 4.2 Online Classification with Guarantees for Multiple Groups We now study online multi-label classification under multiple groups. We perform classification on an individual arriving in round t based upon the individual's context xt and his group memberships. Formally, the context domain is X ⊆ {0, 1}d and each context describes an individual's feature vector; the prediction domain is A ⊆ {0, 1}n, with the prediction being a multi-dimensional label; and the adversary's action domain is Y = {0, 1}n with the action being the true multi-dimensional label that we aim to predict. Each subsequence I corresponds to a group g, with the set of groups being denoted by G = {g1, g2, * * * g|G|}. We assume that the learner has access to an optimization oracle that can solve the corresponding, simpler, offline classification problem: i.e., given t context-label pairs {xs, ys}t s=1, an oracle that finds the policy f ∈ H that minimizes (cid:80)t s=1 l(f (xs), ys) for the desired loss function l(.). Our subsequence regret is equivalently the groupwise regret associated with group g. Formally: Regret of Group g = E (cid:35) g(t)l(pt(xt), yt) (cid:34) (cid:88) t − min f ∈H (cid:88) t g(t)l (f (xt), yt) . We describe results for two special settings of this problem, introduced by Syrgkanis et al. [2016] for the external regret minimization version of this problem. Small Separator Sets: A set S ⊂ X of contexts is said to be a separator set of the policy class H if for any two distinct policies f, f ′ ∈ H, there exists a context x ∈ S such that f (x) ̸= f ′(x). We present groupwise regret bounds assuming that H has a separator set of size s – note that a finite separator set implies that the set H is also finite (upper bounded by |A|s). Transductive setting In the transductive setting, the adversary reveals a set S of contexts with |S| = s to the learner before the sequence begins, along with the promise that all contexts in the sequence are present in the set S. Note that the order and multiplicity of the contexts given for prediction can be varied adaptively by the adversary. When plugging in the online classification algorithm of Syrgkanis et al. [2016] as the regret minimizing algorithm Z I for each subsequence I (here, equivalently, for each group g) in Algorithm 1, we obtain the following efficiency and regret guarantees: 7 Corollary 2. There exists an oracle efficient online classification algorithm (that runs in time polynomial in |G|, d, n, and s) for classifiers with small separator sets (size s) with groupwise regret upper bounded by (cid:16)(cid:112)Tg((cid:112)(s3/2n3/2 log |H| + (cid:112)log |G|) (cid:17) O for each group g. Corollary 3. There exists an oracle efficient online classification algorithm (running in time polynomial in |G|, d, n, and s) for classifiers in the transductive setting (with transductive set size s) with groupwise regret upper bounded by O (cid:16)(cid:112)Tg((cid:112)s1/2n3/2 log |H| + (cid:112)log |G|) (cid:17) for each group g. Note that in the above corollaries, "oracle efficient" means an efficient reduction to a (batch) ERM problem-the above algorithms are efficient whenever the ERM problem can be solved efficiently. We also briefly mention how the ideas of Blum and Lykouris [2019] lift the results in this section for binary classification to the "apple-tasting model" where we only see the true label yt if the prediction is pt = 1. For sake of brevity, this discussion is moved to Appendix E. 4.3 Online Linear Optimization Our framework gives us subsequence regret guarantees for online linear optimization problems, which, among other applications, includes the online shortest path problem. In each round t, the algorithm picks a prediction at from A ⊆ [0, 1]d and the adaptive adversary picks cost vector yt from Y ⊆ Rd as its action. The algorithm obtains a loss of l(at, yt) = ⟨at, yt⟩. Unlike the previous applications, there is no context, and the policy class H is directly defined as the set of all possible predictions A. The algorithm is assumed to have access to an optimization oracle that finds some prediction in arg mina∈A⟨a, c⟩ for any c ∈ Rd. The objective is to bound the regret associated with each subsequence I (described below) in terms of TI := (cid:80) t I(t), the length of the subsequence. Regret of Subsequence I = E (cid:34) (cid:88) t I(t)⟨at, yt⟩ (cid:35) − min a∈A (cid:88) t I(t)⟨a, yt⟩ Kalai and Vempala [2005] show an oracle efficient algorithm that has regret upper bounded by 8CAdT where A = maxa,a′∈A ||a − a′||1 and C = maxc∈Y ||c||1. Using this algorithm for minimizing external regret for each subsequence in Algorithm 1, we obtain the following corollary: √ Corollary 4. There is an oracle efficient algorithm for online linear optimization (of polynomial time in |I|) with the regret of subsequence I (of length TI ) upper bounded by O( TI CAd + (cid:112)TI log |I|)). √ 5 Experiments We empirically investigate the performance of our algorithm in an online regression problem. We present our experimental results on two datasets in the main body. First, we run experiments on a synthetic dataset in Section 5.2. Second, we perform experiments on real data in Section 5.3 using dataset [Lantz, 2013] for medical cost prediction tasks. We provide additional experiments on the census-based Adult income dataset 5 [Ding et al., 2021, Flood et al., 2020] in Appendix C.5. 5.1 Algorithm description and metric Learning task: In our experiments, we run online linear regression with the goal of obtaining low subsequence regret. We focus on the case where subsequences are defined according to group membership, and we aim to obtain low regret in each group for the sake of fairness. Our loss functions and our regret metrics are the same as described in Section 4.1. 5adult reconstruction.csv is available at https://github.com/socialfoundations/folktables 8 Our algorithm: We aim to evaluate the performance of Algorithm 1 for groupwise regret minimization. Given |G| groups, our algorithm uses |G| + 1 subsequences: for each group g ∈ G, there is a corresponding subsequence that only includes the data of individuals in group g; further, we consider an additional "always active" subsequence that contains the entire data history. We recall that our algorithm uses an inner no-regret algorithm for each meta-expert or subsequence, and AdaNormalHedge to choose across active subsequences on a given time step. We choose online ridge regression from Azoury and Warmuth [2001] for the meta-experts' algorithm as per Section 4.1. Baseline: We compare our results to a simple baseline. At every time step t, the baseline uses the entire data history from the first t − 1 rounds, without splitting the data history across the |G| + 1 subsequences defined above. (Recall that since the subsequences intersect, there is no way to partition the data points by group). The baseline simply runs traditional online Ridge regression: at every t, it estimates ˆθt ≜ arg minθ{(cid:80)t−1 2}, then predicts label ˆyt ≜ ⟨ˆθt, xt⟩. τ =1(⟨θ, xτ ⟩ − yτ )2 + ∥θ∥2 Note that both our algorithm and the baseline have access to group identity (we concatenate group indicators to the original features), thus the baseline can learn models for different groups that differ by a linear shift6. 5.2 Synthetic Data Feature and group generation Our synthetic data is comprised of 5 groups: 3 shape groups (circle, square, triangle) and 2 color groups (red, green). Individual features are 20-dimensional; they are independently and identically distributed and taken from the uniform distribution over support [0, 1]20. Each individual is assigned to one of the 3 shape groups and one of the 2 color groups randomly; this is described by vector at ∈ {0, 1}5 which concatenates a categorical distribution over pshape = [0.5, 0.3, 0.2] and one over pcolor = [0.6, 0.4]. Label generation Individual labels are generated as follows: first, we draw a weight vector wg for each group g uniformly at random on [0, 1]d. Then, we assign an intermediary label to each Individual in group g; this label is given by the linear expression w⊤ g x. Note that each individual has two intermediary labels by virtue of being in two groups: one from shape and one from color. The true label of an individual is then chosen to be a function of both intermediary labels, that we call the label aggregation function. We provide experiments from the following aggregation functions: mean of the intermediary labels; minimum of the intermediary labels; maximum of the intermediary labels; and another aggregation rule which we call the permutation model (described in Appendix C.3). Our main motivation for generating our labels in such a manner is the following: first, we pick linear models to make sure that linear regression has high performance in each group, which allows us to separate considerations of regret performance of our algorithm from considerations of performance of the model class we optimize on. Second, with high probability, the parameter vector wg significantly differs across groups; thus it is important for the algorithm to carefully ensemble models for individuals in the intersection of two groups, which is what makes it possible to out-perform the best linear models in hindsight and obtain negative regret. Results Here, we show results for the mean aggregation function described in Section 5.2. Results for the other three (min, max, and permutation) are similar and provided in Appendix C.1,C.2,and C.3 respectively. Across all the groups we can see that our algorithm has significantly lower regret than the baseline, which in fact has linearly increasing regret. Note that this is not in conflict with the no-regret guarantee of Azoury and Warmuth [2001] as the best fixed linear model in hindsight is different for each group: indeed we see in box (f) that Azoury and Warmuth [2001] does have low regret on the entire sequence, despite having linearly increasing regret on every relevant subsequence. Further, we note that our algorithm's groupwise regret guarantees sometimes vastly outperform our already strong theoretical guarantees. In particular, while we show that our algorithm guarantees that the regret evolves sub-linearly, we note that in several of our experiments, it is in fact negative and decreasing over time (e.g. for the colors green and red). This means that our algorithm performs even better than the 6We know of no implementable algorithms other than ours that has subsequence regret guarantees for linear regression (or other comparably large model class) that would provide an alternative point of comparison. 9 (a) Shape: Circle (b) Shape: Square (c) Shape: Triangle (d) Color: Green (e) Color: Red (f) Always on Figure 2: Regret for the baseline (blue) & our algorithm (orange) on synthetic data with mean of intermediary labels. Our algorithm always has lower regret than the baseline. best linear regressor in hindsight; This is possible because by necessity, our algorithm is ensembling linear models for individuals who are members of multiple groups, giving it access to a more expressive (and more accurate) model class. Quantitatively, the rough 7 magnitude of the cumulative least-squared loss (for the best performing linear model in hindsight) is 33. Our algorithm's cumulative loss is roughly lower than the baseline by an additive factor of 20, which represents a substantial improvement compared to the loss of the baseline. This implies that our regret improvements in Figure 2 are of a similar order of magnitude as the baseline loss itself, hence significant. Note that Fig 2 is for the data shuffled with 10 random seeds. In Fig 3 we repeat the experiment on the same dataset but with the following sorted order: individuals with the color red all appear before those with color green. This sequence validates that our algorithm has similar qualitative guarantees even when the data sequence is not i.i.d.; this in line with the no-regret guarantee we prove in Corollary 1, which holds for adversarial sequences. 5.3 Medical Cost Data Dataset description The "Medical Cost" dataset Lantz [2013] looks at an individual medical cost prediction task. Individual features are split into 3 numeric {age, BMI, #children} and 3 categoric features {sex, smoker, region}. The dataset also has a real-valued medical charges column that we use as our label. Data pre-processing All the numeric columns are min-max scaled to the range [0, 1] and all the categoric columns are one-hot encoded. We also pre-process the data to limit the number of groups we are working with for simplicity of exposition. In particular, we simplify the following groups: 1. We divide age into 3 groups: young (age ≤ 35), middle (age ∈ (35, 50]), old (age> 50) 7Exact values provided in Appendix D table 1 10 01000020000300004000050000time0246810121416RegretcircleBaselineOur algorithm050001000015000200002500030000time0246810121416RegretsquareBaselineOur algorithm02500500075001000012500150001750020000time024681012RegrettriangleBaselineOur algorithm0100002000030000400005000060000time151050510RegretgreenBaselineOur algorithm0500010000150002000025000300003500040000time2.50.02.55.07.510.012.515.0RegretredBaselineOur algorithm020000400006000080000100000time403020100Regretalways_onBaselineOur algorithm (a) Shape: Circle (b) Shape: Square (c) Shape: Triangle (d) Color: Green (e) Color: Red (f) Always on Figure 3: Regret for the baseline (blue) & our algorithm (orange) on synthetic data(sorted by color) with mean of intermediary labels. Our algorithm always has lower regret than the baseline. 2. For sex, we directly use the 2 groups given in the dataset : male, female 3. For smoker, we directly use the 2 groups given in the datset : smoker, non-smoker 4. We divide BMI (Body Masss Index) into 4 groups: underweight (BMI < 18.5), healthy (BMI ∈ [18.5, 25)), overweight (BMI ∈ [25, 30)), obese (BMI ≥ 30) We provide detailed plots (including error bars) for all groups in Appendix C.4. Here, we provide a summary in Figure 4 with the regret for each group, with the x axis representing the fraction of individuals within each group seen so far. Results We have already discussed the age, sex, smoking groups in Sec 1, Fig 1. We remark that the BMI group results in Fig 4 (d) are similar: the groupwise regret is consistently lower and growing with time at a lower rate than the baseline. Quantitatively, the rough magnitude8 of the cumulative loss of the best linear model in hindsight is ∼ 4.1, and our algorithm's cumulative loss is ∼ 1.9 units lower than the baseline, which is a significant decrease. Note that Fig 4 is for the data shuffled with 10 random seeds. In Fig 5 we repeat the experiment on the same dataset but with the age feature appearing in ascending order. This shows that our algorithm has similar qualitative guarantees even when the data sequence is not i.i.d.. 8Exact values provided in Appendix D table 9 11 01000020000300004000050000time2024681012RegretcircleBaselineOur algorithm050001000015000200002500030000time02468101214RegretsquareBaselineOur algorithm02500500075001000012500150001750020000time0.02.55.07.510.012.515.017.5RegrettriangleBaselineOur algorithm0100002000030000400005000060000time0510152025RegretgreenBaselineOur algorithm0500010000150002000025000300003500040000time15.012.510.07.55.02.50.0RegretredBaselineOur algorithm020000400006000080000100000time403020100Regretalways_onBaselineOur algorithm (a) Age groups (b) Sex groups (c) Smoking groups (d) BMI groups (e) Always on group Figure 4: Regret vs. time (as a fraction of subsequence length). Our algorithm (solid line) always has lower regret than the baseline(marked line) (a) Age groups (b) Sex groups (c) Smoking groups (d) BMI groups (e) Always on group Figure 5: Regret vs. time (as a fraction of subsequence length) for medical cost data (sorted by age). Our algorithm (solid line) always has lower regret than the baseline (marked line). 12 0.00.20.40.60.81.0Time / length of subsequence1.51.00.50.00.5Cumulative regretAge groupsYoung (Baseline)Young (Our Algorithm)Middle (Baseline)Middle (Our Algorithm)Old (Baseline)Old (Our Algorithm)0.00.20.40.60.81.0Time / length of subsequence1.51.00.50.00.5Cumulative regretSex groupsMale (Baseline)Male (Our Algorithm)Female (Baseline)Female (Our Algorithm)0.00.20.40.60.81.0Time / length of subsequence012345Cumulative regretGroups: smoker, non-smokerSmoker (Baseline)Smoker (Our Algorithm)Non-Smoker (Baseline)Non-Smoker (Our Algorithm)0.00.20.40.60.81.0Time / length of subsequence0.00.51.01.52.02.53.03.5Cumulative regretBMI groupsUnderweight (Baseline)Underweight (Our Algorithm)Healthyweight (Baseline)Healthyweight (Our Algorithm)Overweight (Baseline)Overweight (Our Algorithm)Obese (Baseline)Obese (Our Algorithm)0.00.20.40.60.81.0Time / length of subsequence32101Cumulative regretAlways on groupAlways_On (Baseline)Always_On (Our Algorithm)0.00.20.40.60.81.0Time / length of subsequence1.00.50.00.5Cumulative regretAge groupsYoung (Baseline)Young (Our Algorithm)Middle (Baseline)Middle (Our Algorithm)Old (Baseline)Old (Our Algorithm)0.00.20.40.60.81.0Time / length of subsequence1.51.00.50.00.5Cumulative regretSex groupsMale (Baseline)Male (Our Algorithm)Female (Baseline)Female (Our Algorithm)0.00.20.40.60.81.0Time / length of subsequence012345Cumulative regretGroups: smoker, non-smokerSmoker (Baseline)Smoker (Our Algorithm)Non-Smoker (Baseline)Non-Smoker (Our Algorithm)0.00.20.40.60.81.0Time / length of subsequence0.00.51.01.52.02.53.03.5Cumulative regretBMI groupsUnderweight (Baseline)Underweight (Our Algorithm)Healthyweight (Baseline)Healthyweight (Our Algorithm)Overweight (Baseline)Overweight (Our Algorithm)Obese (Baseline)Obese (Our Algorithm)0.00.20.40.60.81.0Time / length of subsequence32101Cumulative regretAlways on groupAlways_On (Baseline)Always_On (Our Algorithm) References Katy S Azoury and Manfred K Warmuth. Relative loss bounds for on-line density estimation with the exponential family of distributions. Machine learning, 43:211–246, 2001. Avrim Blum and Thodoris Lykouris. Advancing subgroup fairness via sleeping experts. arXiv preprint arXiv:1909.08375, 2019. Nicolo Cesa-Bianchi and G ́abor Lugosi. Prediction, learning, and games. Cambridge university press, 2006. Frances Ding, Moritz Hardt, John Miller, and Ludwig Schmidt. Retiring adult: New datasets for fair machine learning. Advances in Neural Information Processing Systems, 34, 2021. Sarah Flood, Miriam King, Renae Rodgers, Steven Ruggles, and J. Robert Warren. D030.V8.0 - IPUMS - ipums.org. https://www.ipums.org/projects/ipums-cps/d030.v8.0, 2020. Sumegha Garg, Christopher Jung, Omer Reingold, and Aaron Roth. Oracle efficient online multicalibration and omniprediction. arXiv preprint arXiv:2307.08999, 2023. Ira Globus-Harris, Michael Kearns, and Aaron Roth. An algorithmic framework for bias bounties. In 2022 ACM Conference on Fairness, Accountability, and Transparency, pages 1106–1124, 2022. Ira Globus-Harris, Declan Harrison, Michael Kearns, Aaron Roth, and Jessica Sorrell. Multicalibration as boosting for regression. In Andreas Krause, Emma Brunskill, Kyunghyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett, editors, International Conference on Machine Learning, ICML 2023, 23-29 July 2023, Honolulu, Hawaii, USA, volume 202 of Proceedings of Machine Learning Research, pages 11459–11492. PMLR, 2023. URL https://proceedings.mlr.press/v202/globus-harris23a.html. Parikshit Gopalan, Adam Tauman Kalai, Omer Reingold, Vatsal Sharan, and Udi Wieder. Omnipredictors. In 13th Innovations in Theoretical Computer Science Conference (ITCS 2022). Schloss Dagstuhl-Leibniz- Zentrum f ̈ur Informatik, 2022. Parikshit Gopalan, Lunjia Hu, Michael P Kim, Omer Reingold, and Udi Wieder. Loss minimization through the lens of outcome indistinguishability. In 14th Innovations in Theoretical Computer Science Conference (ITCS 2023). Schloss Dagstuhl-Leibniz-Zentrum f ̈ur Informatik, 2023. Ursula H ́ebert-Johnson, Michael Kim, Omer Reingold, and Guy Rothblum. Multicalibration: Calibration for the (computationally-identifiable) masses. In International Conference on Machine Learning, pages 1939–1948. PMLR, 2018. Adam Kalai and Santosh Vempala. Efficient algorithms for online decision problems. Journal of Computer and System Sciences, 71(3):291–307, 2005. Michael Kearns, Seth Neel, Aaron Roth, and Zhiwei Steven Wu. Preventing fairness gerrymandering: Auditing and learning for subgroup fairness. In International conference on machine learning, pages 2564–2572. PMLR, 2018. Brett Lantz. Medical Cost Personal Datasets - kaggle.com, 2013. URL https://www.kaggle.com/datasets/ mirichoi0218/insurance. Daniel Lee, Georgy Noarov, Mallesh Pai, and Aaron Roth. Online minimax multiobjective optimization: Multicalibeating and other applications. Advances in Neural Information Processing Systems, 35:29051– 29063, 2022. Haipeng Luo and Robert E. Schapire. Achieving all with no parameters: Adaptive normalhedge, 2015. Guy N Rothblum and Gal Yona. Multi-group agnostic pac learnability. In International Conference on Machine Learning, pages 9107–9115. PMLR, 2021. 13 Vasilis Syrgkanis, Akshay Krishnamurthy, and Robert Schapire. Efficient algorithms for adversarial contextual learning. In International Conference on Machine Learning, pages 2159–2168. PMLR, 2016. Christopher J Tosh and Daniel Hsu. Simple and near-optimal algorithms for hidden stratification and multi-group learning. In International Conference on Machine Learning, pages 21633–21657. PMLR, 2022. A Organization The Appendix is organized as follows. Appendix B contains the proof of Theorem 2. Regret curves for the synthetic data with the 3 other label aggregations functions: min, max, permutation are in Appendix C.1, C.2 and C.3 respectively. In Appendix C.4 and C.5 we provide detailed plots for the 2 real datasets: Medical cost and Adult income respectively. Appendix D provides tables with regret at the end of each subsequence, along with cumulative loss of the best linear model for all the experiments. Lastly, Appendix E contains the binary classification with apple-tasting feedback results. B Proof of Theorem 2 Our algorithm uses the AdaNormalHedge algorithm of Luo and Schapire [2015]. AdaNormalHedge is an online prediction algorithm, that given a finite benchmark set of |I| policies and |I| time selection functions, guarantees a subsequence regret upper bound of O((cid:112)TI log |I|) with a running time that is polynomial in |I| and the size of the contexts that arrive in each round. We refer to meta-experts {Z I }I∈I as policies even though they are themselves algorithms, and not policies mapping contexts to predictions, however, the output of each one of these algorithms in any time step are policies in H mapping contexts to predictions. Therefore, when algorithm Z picks Z I as the policy to play in a round, it is in fact picking the policy zI t that is the output of algorithm Z I in that round. Thus, the running time claim follows from the construction of Algorithm 1. By appealing to the regret guarantees of each algorithm Z I and taking the expectation only over the random bits used by these algorithms, we get the following for each subsequence I: (cid:32) (cid:34) E (cid:88) t I(t)l(zI t (xt), yt) (cid:35) − min f ∈H (cid:88) t (cid:33) I(t)l(f (xt), yt) ≤ αI t is the (randomized) policy suggested by the algorithm Z I and TI = (cid:80) where pI t I(t). Note that the actual prediction pt(xt) made by Algorithm 1 might differ from pI t (xt), however since the regret guarantee holds for arbitrary adversarial sequences, we can still call upon it to measure the expected regret of hypothetically using this algorithm's prediction on the corresponding subsequence. Importantly, we update the algorithm Z I with the true label yt on every round where the subsequence I is active. t as zI Next, we appeal to the regret guarantee of algorithm Z. Before doing so, we fix the realization of the offered expert pI t from each meta-expert Z I i.e. we do the analysis conditioned upon the draw of internal randomness used by each meta-expert. In particular, our analysis holds for every possible realization of predictions pI t offered by each of the meta-experts over all the rounds. Since our algorithm updates the loss of each meta-expert with respect to these realized draws of the meta-experts, therefore, we use the subsequence regret guarantee of Z (i.e the results about AdaNormalHedge in Luo and Schapire [2015]) for each subsequence I to get: (cid:32) (cid:34) E (cid:88) t (cid:35) I(t)l(pt(xt), yt) − (cid:88) t (cid:33) I(t)l(zI t (xt), yt) ≤ O (cid:17) (cid:16)(cid:112)TI log(|I|) where the expectation is taken only over the random bits used by A to select which meta-expert to use in each round. We then additionally measure the expected regret over the random bits used internally by the meta-experts to get: 14 (cid:32) E (cid:34) (cid:88) t (cid:35) I(t)l(pt(xt), yt) − E (cid:34) (cid:88) t (cid:35)(cid:33) I(t)l(pI t (xt), yt) ≤ O (cid:16)(cid:112)TI log(|I|) (cid:17) Putting together the first and last inequality in this proof gives us (for each subsequence I): (cid:32) (cid:34) E (cid:88) t I(t)l(pt(xt), yt) (cid:35) − min f ∈H (cid:88) t (cid:33) I(t)l(f (xt), yt) ≤ αI + O (cid:17) (cid:16)(cid:112)TI log(|I|) C Additional Figures On the synthetic data with the 3 other aggregation rules: min, max, permutation; the plots and qualitative inferences are similar to the mean aggregation in Section 5.2, i.e., across all the groups we see that our algorithm has significantly lower regret than the baseline, which in fact has linearly increasing regret 9. Thus, here, we only discuss quantitative values such as the magnitudes of the cumulative loss, and difference between the cumulative loss of the baseline and our algorithm. Note that in each of these experiments, like in Sec 5 we provide two sets of figures, one in which the data sequences are obtained by shuffling, in the other they're obtained by sorting 10, the latter is used to validate that our algorithm has similar qualitative results even when the data sequences are not i.i.d. For the synthetic dataset the individuals with color red all appear before those with color green. In both the medical cost and adult income dataset we repeat the experiment on the same dataset but with the age feature appearing in ascending order. C.1 Synthetic Data - Min Recall here that the label of any individual is the minimum of the intermediary labels of the groups it's a part of. Quantitatively, the rough magnitude 11 of the cumulative loss of the best linear model in hindsight is ∼ 79, and our algorithm's cumulative loss is ∼ 48 units lower than the baseline, which is a significant decrease. Fig 6, 7 have the plots for the shuffled, sorted by color sequences respectively. 9On the always on group, the baseline has sublinear growth, we have discussed this phenomenon in Sec 5.2 10We shuffle the data, and the online algorithms either 1) use this sequence directly or 2) mergesort according to the specified feature; the latter represents a non-i.i.d data sequence 11Exact values provided in Appendix D table 3 15 (a) Shape: Circle (b) Shape: Square (c) Shape: Triangle (d) Color: Green (e) Color: Red (f) Always on Figure 6: Regret for the baseline (blue) & our algorithm (orange) on synthetic data with minimum of intermediary labels, our algorithm always has lower regret than the baseline. (a) Shape: Circle (b) Shape: Square (c) Shape: Triangle (d) Color: Green (e) Color: Red (f) Always on Figure 7: Regret for the baseline (blue) & our algorithm (orange) on synthetic data(sorted by color) with minimum of intermediary labels, our algorithm always has lower regret than the baseline 16 01000020000300004000050000time05101520RegretcircleBaselineOur algorithm050001000015000200002500030000time0102030405060RegretsquareBaselineOur algorithm02500500075001000012500150001750020000time024681012RegrettriangleBaselineOur algorithm0100002000030000400005000060000time40302010010RegretgreenBaselineOur algorithm0500010000150002000025000300003500040000time1510505101520RegretredBaselineOur algorithm020000400006000080000100000time806040200Regretalways_onBaselineOur algorithm01000020000300004000050000time5051015RegretcircleBaselineOur algorithm050001000015000200002500030000time010203040506070RegretsquareBaselineOur algorithm02500500075001000012500150001750020000time20246810RegrettriangleBaselineOur algorithm0100002000030000400005000060000time20100102030RegretgreenBaselineOur algorithm0500010000150002000025000300003500040000time403020100RegretredBaselineOur algorithm020000400006000080000100000time100806040200Regretalways_onBaselineOur algorithm C.2 Synthetic Dataset - Max Recall here that the label of any individual is the maximum of the intermediary labels of the groups it's a part of. Quantitatively, the rough magnitude 12 of the cumulative loss of the best linear model in hindsight is ∼ 59, and our algorithm's cumulative loss is ∼ 34 units lower than the baseline, which is a significant decrease. Fig 8, 9 have the plots for the shuffled, sorted by color sequences respectively. (a) Shape: Circle (b) Shape: Square (c) Shape: Triangle (d) Color: Green (e) Color: Red (f) Always on Figure 8: Regret for the baseline (blue) & our algorithm (orange) on synthetic data with maximum of intermediary labels, our algorithm always has lower regret than the baseline. 12Exact values provided in Appendix D table 5 17 01000020000300004000050000time05101520RegretcircleBaselineOur algorithm050001000015000200002500030000time0.02.55.07.510.012.515.017.5RegretsquareBaselineOur algorithm02500500075001000012500150001750020000time051015202530RegrettriangleBaselineOur algorithm0100002000030000400005000060000time2520151050510RegretgreenBaselineOur algorithm0500010000150002000025000300003500040000time2520151050510RegretredBaselineOur algorithm020000400006000080000100000time706050403020100Regretalways_onBaselineOur algorithm (a) Shape: Circle (b) Shape: Square (c) Shape: Triangle (d) Color: Green (e) Color: Red (f) Always on Figure 9: Regret for the baseline (blue) & our algorithm (orange) on synthetic data(sorted by color) with maximum of intermediary labels, our algorithm always has lower regret than the baseline C.3 Synthetic Dataset - Permutation Recall here there is an underlying fixed ordering or permutation over the groups, and the label of any individual is decided by the linear model corresponding to the first group in the ordering that this individual is a part of. The permutation (chosen randomly) for experiments in Figure 10 is (1:green, 2:square, 3:red, 4:triangle, 5:circle). Let's see two simple examples to understand this aggregation: For an individual which is a red square we use the intermediary label for square, for an individual which is a green square we use the intermediary label for green. Quantitatively, the rough magnitude 13 of the cumulative loss of the best linear model in hindsight is ∼ 94, and our algorithm's cumulative loss is ∼ 93 units lower than the baseline, which is a significant decrease. Fig 10, 11 have the plots for the shuffled, sorted by color sequences respectively. 13Exact values provided in Appendix D table 7 18 01000020000300004000050000time0.02.55.07.510.012.515.017.520.0RegretcircleBaselineOur algorithm050001000015000200002500030000time5051015RegretsquareBaselineOur algorithm02500500075001000012500150001750020000time0510152025303540RegrettriangleBaselineOur algorithm0100002000030000400005000060000time1510505101520RegretgreenBaselineOur algorithm0500010000150002000025000300003500040000time4035302520151050RegretredBaselineOur algorithm020000400006000080000100000time706050403020100Regretalways_onBaselineOur algorithm (a) Shape: Circle (b) Shape: Square (c) Shape: Triangle (d) Color: Green (e) Color: Red (f) Always on Figure 10: Regret for the baseline (blue) & our algorithm (orange) on synthetic data with permutation aggregation of intermediary labels, our algorithm always has lower regret than the baseline (a) Shape: Circle (b) Shape: Square (c) Shape: Triangle (d) Color: Green (e) Color: Red (f) Always on Figure 11: Regret for the baseline (blue) & our algorithm (orange) on synthetic data(sorted by color) with permutation of intermediary labels, our algorithm always has lower regret than the baseline 19 01000020000300004000050000time403020100102030RegretcircleBaselineOur algorithm050001000015000200002500030000time020406080RegretsquareBaselineOur algorithm02500500075001000012500150001750020000time151050510RegrettriangleBaselineOur algorithm0100002000030000400005000060000time01020304050607080RegretgreenBaselineOur algorithm0500010000150002000025000300003500040000time020406080100RegretredBaselineOur algorithm020000400006000080000100000time1751501251007550250Regretalways_onBaselineOur algorithm01000020000300004000050000time504030201001020RegretcircleBaselineOur algorithm050001000015000200002500030000time4020020406080100RegretsquareBaselineOur algorithm02500500075001000012500150001750020000time20151050510RegrettriangleBaselineOur algorithm0100002000030000400005000060000time0255075100125150175RegretgreenBaselineOur algorithm0500010000150002000025000300003500040000time6050403020100RegretredBaselineOur algorithm020000400006000080000100000time250200150100500Regretalways_onBaselineOur algorithm C.4 Medical Cost dataset For the medical cost data we have already discussed the rough quantitative results in Section 5.3, for exact values see Appendix D table 9. Here we discuss regret curves for the baseline and our algorithm on all the groups. Regret on age, sex groups On all three age groups: young, middle, old (Fig 12), and both sex groups: male, female (Fig 13); our algorithm has significantly lower regret than the baseline, in fact, our algorithm's regret is negative and decreasing over time. i.e., our algorithm outperforms the best linear regressor in hindsight. This qualitatively matches the same phenomenon occurring in the synthetic data. (a) Age: Young (b) Age: Middle (c) Age: Old Figure 12: Age groups (a) Sex: Male (b) Sex: Female Figure 13: Sex groups Regret on smoker, BMI groups For both smokers and non smokers (Fig 14), and all four BMI groups: underweight, healthyweight, overweight, obsese (Fig 15); our algorithm has significantly lower regret than the baseline, which in fact has linearly increasing regret. 20 0100200300400500600time1.51.00.50.00.5RegretyoungBaselineOur algorithm050100150200250300350400time1.000.750.500.250.000.250.50RegretmiddleBaselineOur algorithm050100150200250300350time0.80.60.40.20.00.20.40.6RegretoldBaselineOur algorithm0100200300400500600700time2.01.51.00.50.00.51.0RegretmaleBaselineOur algorithm0100200300400500600time1.51.00.50.00.5RegretfemaleBaselineOur algorithm (a) Smoker: Yes (b) Smoker: No Figure 14: Smoking groups (a) Bmi: Underweight (b) Bmi: Healthyweight (c) Bmi: Overweight (d) Bmi: Obese Figure 15: Bmi groups Regret on the always-on group In Fig 16 our algorithm's regret is negative and decreasing with time, i.e., it outperforms the best linear regressor in hindsight. The baseline's regret evolves sublinearly, this matches the same phenomenon occurring in the synthetic data in Section 5.2 Fig 2 (f). 21 050100150200250time012345RegretsmokerBaselineOur algorithm02004006008001000time0.000.250.500.751.001.251.501.75Regretnon-smokerBaselineOur algorithm2.55.07.510.012.515.017.5time0.0000.0250.0500.0750.1000.1250.1500.175RegretunderweightBaselineOur algorithm050100150200time0.000.250.500.751.001.251.501.75RegrethealthyweightBaselineOur algorithm050100150200250300350400time0.000.250.500.751.001.251.501.75RegretoverweightBaselineOur algorithm0100200300400500600700time0.51.01.52.02.53.03.5RegretobeseBaselineOur algorithm Figure 16: Always on In Fig 17 to 21 we repeat the experiment but with the age feature appearing in ascending order. In all of them we see the same qualitative results as the shuffled data. (a) Age: Young (b) Age: Middle (c) Age: Old Figure 17: Age groups (a) Sex: Male (b) Sex: Female Figure 18: Sex groups 22 0200400600800100012001400time32101Regretalways_onBaselineOur algorithm0100200300400500600time1.00.50.00.51.0RegretyoungBaselineOur algorithm050100150200250300350400time1.21.00.80.60.40.20.00.2RegretmiddleBaselineOur algorithm050100150200250300350time1.00.80.60.40.20.00.2RegretoldBaselineOur algorithm0100200300400500600700time2.01.51.00.50.00.5RegretmaleBaselineOur algorithm0100200300400500600time2.01.51.00.50.00.5RegretfemaleBaselineOur algorithm (a) Smoker: Yes (b) Smoker: No Figure 19: Smoking groups (a) Bmi: Underweight (b) Bmi: Healthyweight (c) Bmi: Overweight (d) Bmi: Obese Figure 20: Bmi groups Figure 21: Always on 23 050100150200250time012345RegretsmokerBaselineOur algorithm02004006008001000time0.000.250.500.751.001.251.501.75Regretnon-smokerBaselineOur algorithm2.55.07.510.012.515.017.5time0.020.040.060.080.100.120.140.160.18RegretunderweightBaselineOur algorithm050100150200time0.00.20.40.60.81.01.21.4RegrethealthyweightBaselineOur algorithm050100150200250300350400time0.00.20.40.60.81.01.21.4RegretoverweightBaselineOur algorithm0100200300400500600700time0.00.51.01.52.02.53.03.5RegretobeseBaselineOur algorithm0200400600800100012001400time432101Regretalways_onBaselineOur algorithm C.5 Adult Income Dataset Dataset description The Adult income dataset 14 is targeted towards income prediction based on cen- sus data. Individual features are split into: 5 numeric features, {hours-per-week, age, capital-gain, capital-loss, education-num}; and 8 categoric features, {workclass, education, marital-status, relationship, race, sex, native-country, occupation}. The dataset also contains a real-valued income column that we use as our label. Data pre-processing All the numeric columns are min-max scaled to [0, 1], while all the categoric columns are one-hot encoded. We also pre-process the data to limit the number of groups we are working with for simplicity of exposition. In particular, we simplify the following groups: 1. We divide the age category into three groups: young (age ≤ 35), middle (age ∈ (35, 50]), old (age> 50) 2. We divide the education level into 2 groups: at most high school versus college or more. 3. For sex, we directly use the 2 groups given in the dataset: male, female. 4. For race, we directly use the 5 groups given in the dataset: White, Black, Asian-Pac-Islander, Amer- Indian-Eskimo, Other. Quantitatively, the rough magnitude 15 of cumulative loss of the best linear model in hindsight is ∼ 568, and our algorithm's cumulative loss is ∼ 14 units lower than the baseline, so there is a decrease but not as significant as for the other datasets. This may be because in this case, conditional on having similar features, group membership is not significantly correlated with income; in fact, we observe in our data that different groups have relatively similar best fitting models. This explains why a one-size-fits-all external regret approach like Azoury and Warmuth [2001] has good performance: one can use the same model for all groups and does not need to fit a specific, different model to each group. Regret on age groups On all three age groups: young, middle, old (Fig 22); our algorithm has lower regret than the baseline. (a) Age: young (b) Age: middle (c) Age: old Figure 22: Age groups Regret on education level groups For both the education level groups: atmost high school and college or more (Fig 23), our algorithm has lower regret than the baseline. 14adult reconstruction.csv at https://github.com/socialfoundations/folktables 15Exact values provided in Appendix D table 11 24 05000100001500020000time0510152025303540RegretyoungBaselineOur algorithm025005000750010000125001500017500time05101520RegretmiddleBaselineOur algorithm0200040006000800010000time151050510152025RegretoldBaselineOur algorithm (a) Education: at most High school (b) Education: college or more Figure 23: Education level groups Regret on sex groups On both the sex groups: male and female (Fig 24), our algorithm has lower regret than the baseline (a) Sex: male (b) Sex: female Figure 24: Sex groups Regret on race groups On all 5 race groups: White, Black, Asian-Pac-Islander, Amer-Indian-Eskimo, Other (Fig 25) our algorithm has lower regret than the baseline. 25 05000100001500020000time5101520253035RegretHighSchool&lessBaselineOur algorithm0500010000150002000025000time51015202530RegretCollege&moreBaselineOur algorithm050001000015000200002500030000time05101520RegretMaleBaselineOur algorithm0200040006000800010000120001400016000time505101520RegretFemaleBaselineOur algorithm (a) Race: White (b) Race: Black (c) Race: Asian-Pac-Islander (d) Race: Amer-Indian-Eskimo (e) Race: Other Figure 25: Race groups Regret on always-on group In Fig 26 our algorithm's regret is negative and decreasing with time, i.e., it outperforms the best linear regressor in hindsight. The baseline's regret evolves sublinearly, this matches the same phenomenon occurring in the synthetic data in Section 5.2 Fig 2 (f). Figure 26: Always on In Fig 27 to 31, we repeat the experiment but with the age feature appearing in ascending order. In all of them we see the same qualitative results as the shuffled data. 26 010000200003000040000time10075502502550RegretWhiteBaselineOur algorithm01000200030004000time202468RegretBlackBaselineOur algorithm0200400600800100012001400time210123456RegretAsian-Pac-IslanderBaselineOur algorithm0100200300400time10.07.55.02.50.02.55.07.5RegretAmer-Indian-EskimoBaselineOur algorithm050100150200250300350400time42024RegretOtherBaselineOur algorithm01000020000300004000050000time201510505101520Regretalways_onBaselineOur algorithm (a) Age: young (b) Age: middle (c) Age: old Figure 27: Age groups (a) Education: at most High school (b) Education: college or more Figure 28: Education level groups (a) Sex: male (b) Sex: female Figure 29: Sex groups 27 05000100001500020000time420246RegretyoungBaselineOur algorithm025005000750010000125001500017500time100102030RegretmiddleBaselineOur algorithm0200040006000800010000time3020100102030RegretoldBaselineOur algorithm05000100001500020000time0510152025RegretHighSchool&lessBaselineOur algorithm0500010000150002000025000time05101520253035RegretCollege&moreBaselineOur algorithm050001000015000200002500030000time10505101520RegretMaleBaselineOur algorithm0200040006000800010000120001400016000time0246810RegretFemaleBaselineOur algorithm (a) Race: White (b) Race: Black (c) Race: Asian-Pac-Islander (d) Race: Amer-Indian-Eskimo (e) Race: Other Figure 30: Race groups Figure 31: Always on D Regret Tables In these tables, for a given group we record: its size, regret for the baseline, regret for our algorithm, and the cumulative loss of the best linear model in hindsight. Since the baseline and our algorithm are online algorithms we feed the data one-by-one using 10 random shuffles, recording the mean and standard deviation. Note that the cumulative loss of the best linear model in hindsight will be the same across all the shuffles, since it's just solving for the least squares solution on the entire group subsequence. We also provide regret tables for the non-i.i.d sequences obtained by sorting, just after the corresponding table with shuffled data. 28 010000200003000040000time20151050510RegretWhiteBaselineOur algorithm01000200030004000time642024RegretBlackBaselineOur algorithm0200400600800100012001400time32101234RegretAsian-Pac-IslanderBaselineOur algorithm0100200300400time1.00.50.00.51.01.52.02.53.0RegretAmer-Indian-EskimoBaselineOur algorithm050100150200250300350400time3210123RegretOtherBaselineOur algorithm01000020000300004000050000time2520151050510Regretalways_onBaselineOur algorithm Group name Group size Baseline's regret Our algorithm's regret circle square triangle green red always on 49857 30044 20099 59985 40015 100000 15.25 ± 0.22 15.43 ± 0.13 12.13 ± 0.10 10.02 ± 0.15 14.75 ± 0.16 0.76 ± 0.06 0.73 ± 0.09 0.63 ± 0.06 0.76 ± 0.04 -14.13 ± 0.19 -1.80 ± 0.17 -39.93 ± 0.10 Cumulative loss of best linear model in hindsight 23.57 14.12 9.43 38.81 26.37 89.18 Table 1: Synthetic data with mean of intermediary labels Group name Group size Baseline's regret Our algorithm's regret circle square triangle green red always on 49857 30044 20099 59985 40015 100000 11.30 ± 0.18 13.64 ± 0.11 17.82 ± 0.13 24.10 ± 0.01 0.61 ± 0.07 0.71 ± 0.07 -2.07 ± 0.22 0.85 ± 0.13 1.18 ± 0.08 -2.63 ± 0.26 -15.46 ± 0.16 -42.09 ± 0.36 Cumulative loss of best linear model in hindsight 23.57 14.12 9.43 38.81 26.37 89.18 Table 2: Synthetic data(sorted by color) with mean of intermediary labels Group name Group size Baseline's regret Our algorithm's regret circle square triangle green red always on 49857 30044 20099 59985 40015 100000 21.62 ± 0.28 64.21 ±0.31 12.47 ± 0.13 14.55 ± 0.19 21.64 ± 0.20 1.04 ± 0.06 0.81 ± 0.10 0.94 ± 0.05 0.57 ± 0.07 -43.10 ± 0.23 -16.69 ± 0.23 -94.94 ± 0.08 Cumulative loss of best linear model in hindsight 63.49 15.17 26.37 97.42 69.72 202.29 Table 3: Synthetic data with min of intermediary labels Group name Group size circle square triangle green red always on 49857 30044 20099 59985 40015 100000 Baseline's regret Our algorithm's regret 14.71 ± 0.26 73.06 ± 0.31 10.45 ± 0.18 35.28 ± 0.01 0.83 ± 0.07 0.96 ± 0.07 -4.63 ± 0.66 1.15 ± 0.10 -0.20 ± 0.26 -23.29 ± 0.41 -42.50 ± 0.16 -100.94 ± 0.53 Cumulative loss of best linear model in hindsight 63.49 15.17 26.37 97.42 69.72 202.29 Table 4: Synthetic data(sorted by color) with min of intermediary labels 29 Group name Group size Baseline's regret Our algorithm's regret circle square triangle green red always on 49857 30044 20099 59985 40015 100000 22.78 ± 0.32 17.86 ± 0.14 29.51 ± 0.22 8.65 ± 0.20 12.48 ± 0.22 0.86 ± 0.08 0.91 ± 0.07 0.52 ± 0.08 0.87 ± 0.05 -23.25 ± 0.24 -23.46 ± 0.29 -66.98 ± 0.13 Cumulative loss of best linear model in hindsight 32.46 36.92 9.42 65.38 62.42 148.08 Table 5: Synthetic data with max of intermediary labels Group name Group size Baseline's regret Our algorithm's regret circle square triangle green red always on 49857 30044 20099 59985 40015 100000 19.01 ± 0.26 10.95 ± 0.09 40.20 ± 0.19 20.37 ± 0.01 0.77 ± 0.07 0.87 ± 0.07 0.95 ± 0.10 -6.99 ± 0.26 1.03 ± 0.07 -14.77 ± 0.22 -39.27 ± 0.18 -74.30 ± 0.29 Cumulative loss of best linear model in hindsight 32.46 36.92 9.42 65.38 62.42 148.08 Table 6: Synthetic data(sorted by color) with max of intermediary labels Group name Group size Baseline's regret Our algorithm's regret circle square triangle green red always on 49857 30044 20099 59985 40015 100000 28.84 ± 0.45 92.10 ± 0.64 12.03 ± 0.20 75.89 ± 0.89 112.49 ± 0.88 1.26 ± 0.09 -38.63 ± 0.17 -0.28 ± 0.27 -15.15 ± 0.09 1.31 ± 0.07 0.04 ± 0.26 -185.77 ± 0.25 Cumulative loss of best linear model in hindsight 77.14 54.87 30.67 28.95 78.32 294.39 Table 7: Synthetic data with permutation of intermediary labels Group name Group size Baseline's regret circle square triangle green red always on 49857 30044 20099 59985 40015 100000 24.05 ± 0.63 99.59 ± 0.70 9.15 ± 0.20 187.32 ± 0.01 0.88 ± 0.08 1.08 ± 0.09 Our algorithm's regret -51.72 ± 0.17 -38.91 ± 0.12 -20.49 ± 0.11 1.42 ± 0.09 -57.12 ± 0.15 -242.83 ± 0.19 Cumulative loss of best linear model in hindsight 77.14 54.87 30.67 28.95 78.32 294.39 Table 8: Synthetic data(sorted by color) with permutation of intermediary labels 30 Group name Group size Baseline's regret Our algorithm's regret young middle old underweight healthyweight overweight obese smoker non-smoker male female always on 574 408 356 20 225 386 707 274 1064 676 662 1338 0.55 ± 0.14 0.38 ± 0.15 0.44 ± 0.18 0.16 ± 0.02 1.59 ± 0.14 1.55 ± 0.17 3.42 ± 0.31 5.06 ± 0.17 1.70 ± 0.15 0.65 ± 0.21 0.59 ± 0.24 1.13 ± 0.09 -1.58 ± 0.18 -0.97 ± 0.16 -0.64 ± 0.19 0.11 ± 0.02 0.36 ± 0.07 0.43 ± 0.07 1.25 ± 0.12 1.47 ± 0.09 0.73 ± 0.13 -1.75 ± 0.21 -1.57 ± 0.24 -3.43 ± 0.13 Table 9: Medical costs data Group name Group size Baseline's regret Our algorithm's regret young middle old underweight healthyweight overweight obese smoker non-smoker male female always on 574 408 356 20 225 386 707 274 1064 676 662 1338 0.82 ± 0.09 0.22 ± 0.01 0.20 ± 0.01 0.16 ± 0.01 1.47 ± 0.05 1.37 ± 0.04 3.64 ± 0.10 5.05 ± 0.07 1.60 ± 0.07 0.63 ± 0.16 0.51 ± 0.17 1.02 ± 0.10 -1.09 ± 0.07 -1.28 ± 0.02 -1.10 ± 0.01 0.13 ± 0.01 0.32 ± 0.04 0.36 ± 0.02 1.12 ± 0.10 1.35 ± 0.05 0.60 ± 0.05 -1.73 ± 0.15 -1.84 ± 0.15 -3.69 ± 0.08 Table 10: Medical costs data (sorted by age) Cumulative loss of best linear model in hindsight 5.40 3.34 3.13 0.03 1.00 1.84 3.65 0.90 5.57 6.11 5.88 12.10 Cumulative loss of best linear model in hindsight 5.40 3.34 3.13 0.03 1.00 1.84 3.65 0.90 5.57 6.11 5.88 12.10 31 Group name Group size Baseline's regret Our algorithm's regret young middle old HighSchool&less College&more Male Female White Asian-Pac-Islander Amer-Indian-Eskimo Other Black always on 22792 16881 9858 22584 26947 33174 16357 42441 1519 471 406 4694 49531 37.40 ± 1.04 20.11 ± 1.11 22.99 ± 0.74 33.02 ± 1.21 28.67 ± 1.54 20.95 ± 0.86 18.82 ± 0.54 14.67 ± 0.76 5.82 ± 0.23 3.55 ± 0.12 3.28 ± 0.24 6.16 ± 0.39 18.25 ± 0.66 14.01 ± 0.41 14.93 ± 0.63 14.81 ± 0.75 14.38 ± 0.51 10.55 ± 1.08 -2.17 ± 0.77 5.19 ± 0.69 -17.42 ± 0.98 4.66 ± 0.21 3.48 ± 0.44 3.21 ± 0.24 2.79 ± 0.36 -18.51 ± 0.94 Table 11: Adult income data Group name Group size Baseline's regret Our algorithm's regret young middle old HighSchool&less College&more Male Female White Asian-Pac-Islander Amer-Indian-Eskimo Other Black always on 22792 16881 9858 22584 26947 33174 16357 42441 1519 471 406 4694 49531 6.28 ± 0.04 35.21 ± 0.08 30.22 ± 0.15 25.50 ± 0.27 27.44 ± 0.31 20.75 ± 0.32 10.25 ± 0.24 10.89 ± 0.28 4.39 ± 0.10 2.65 ± 0.30 2.72 ± 0.03 3.74 ± 0.90 9.45 ± 0.21 -4.93 ± 0.12 21.24 ± 0.38 21.56 ± 0.73 7.92 ± 0.62 11.16 ± 0.86 -10.28 ± 0.93 7.43 ± 0.50 -20.17 ± 0.98 4.29 ± 0.21 2.59 ± 0.32 2.55 ± 0.05 1.28 ± 0.97 -24.40 ± 0.91 Table 12: Adult income data (sorted by age) Cumulative loss of best linear model in hindsight 421.89 608.15 414.61 499.55 963.92 1171.06 314.32 1325.50 55.05 9.04 7.50 94.58 1506.92 Cumulative loss of best linear model in hindsight 421.89 608.15 414.61 499.55 963.92 1171.06 314.32 1325.50 55.05 9.04 7.50 94.58 1506.92 32 E Apple Tasting Model In the apple tasting model for binary classification (n = 1), we only see the label yt at the end of the t-th round if the prediction pt is to "accept", i.e.,pt = 1. We present results in a generalization of this model, introduced by Blum and Lykouris [2019], called the Pay-for-feedback model. In this model, the algorithm is allowed to pay the maximum possible loss of 1 at the end of the t-th round to see the label yt. The sum of all the payments is added to the regret expression to create a new objective that we wish to upper bound. For some notation - vt is the indicator variable that is set to 1 if we pay to view the label at the end of round t. This new objective is written down below - Groupwise Regret with Pay-for-feeback = (cid:32) E (cid:34) (cid:88) t gi(t)(l(pt, yt) + vt) (cid:35) − min f ∈Fi (cid:88) t (cid:33) gi(t)l(f (xt), yt) Blum and Lykouris [2019] introduce a blackbox method that converts any online algorithm with regret for group g upper bounded by O((cid:112)Tg) (other terms not dependent on Tg can multiply with this expression) into an algorithm with a corresponding bound in the pay-for-feedback model. This method is based upon splitting the time interval T into a number of equal length contiguous sub-intervals and randomly sampling a time step in each sub-interval for which it pays for feedback. Using this method on top of our algorithm, we derive the following corollary. Corollary 5. There exists an oracle efficient online classification algorithm in the pay-for-feedback model for concept classes with small separator sets (size s) with groupwise regret upper bounded by (cid:16) (cid:17) T 1/6(cid:112)Tgi((cid:112)s3/2 log |Fi| + (cid:112)log |G|) O (for group gi). 33
http://arxiv.org/abs/2310.04649v1
"2023-10-07T02:02:45"
"2023-10-07T02:02:45"
NPEFF: Non-Negative Per-Example Fisher Factorization
As deep learning models are deployed in more and more settings, it becomes increasingly important to be able to understand why they produce a given prediction, but interpretation of these models remains a challenge. In this paper, we introduce a novel interpretability method called NPEFF that is readily applicable to any end-to-end differentiable model. It operates on the principle that processing of a characteristic shared across different examples involves a specific subset of model parameters. We perform NPEFF by decomposing each example's Fisher information matrix as a non-negative sum of components. These components take the form of either non-negative vectors or rank-1 positive semi-definite matrices depending on whether we are using diagonal or low-rank Fisher representations, respectively. For the latter form, we introduce a novel and highly scalable algorithm. We demonstrate that components recovered by NPEFF have interpretable tunings through experiments on language and vision models. Using unique properties of NPEFF's parameter-space representations, we ran extensive experiments to verify that the connections between directions in parameters space and examples recovered by NPEFF actually reflect the model's processing. We further demonstrate NPEFF's ability to uncover the actual processing strategies used by a TRACR-compiled model. We further explore a potential application of NPEFF in uncovering and correcting flawed heuristics used by a model. We release our code to facilitate research using NPEFF.
[ "Michael Matena", "Colin Raffel" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04649v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04649v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 t c O 7 ] G L . s c [ 1 v 9 4 6 4 0 . 0 1 3 2 : v i X r a NPEFF: NON-NEGATIVE PER-EXAMPLE FISHER FACTORIZATION Michael Matena & Colin Raffel Department of Computer Science University of North Carolina at Chapel Hill {mmatena,craffel}@cs.unc.edu ABSTRACT As deep learning models are deployed in more and more settings, it becomes increasingly important to be able to understand why they produce a given pre- diction, but interpretation of these models remains a challenge. In this paper, we introduce a novel interpretability method called NPEFF that is readily applicable to any end-to-end differentiable model. It operates on the principle that process- ing of a characteristic shared across different examples involves a specific sub- set of model parameters. We perform NPEFF by decomposing each example's Fisher information matrix as a non-negative sum of components. These compo- nents take the form of either non-negative vectors or rank-1 positive semi-definite matrices depending on whether we are using diagonal or low-rank Fisher rep- resentations, respectively. For the latter form, we introduce a novel and highly scalable algorithm. We demonstrate that components recovered by NPEFF have interpretable tunings through experiments on language and vision models. Using unique properties of NPEFF's parameter-space representations, we ran extensive experiments to verify that the connections between directions in parameters space and examples recovered by NPEFF actually reflect the model's processing. We further demonstrate NPEFF's ability to uncover the actual processing strategies used by a TRACR-compiled model. We further explore a potential application of NPEFF in uncovering and correcting flawed heuristics used by a model. We release our code to faciliate research using NPEFF.1 1 INTRODUCTION Neural networks trained on large datasets have achieved human-level performance on many tasks. Unfortunately, these models do not provide any direct method to understand what they have learned or how they have solved the task (Smilkov et al., 2017; Dabkowski & Gal, 2017; Sundararajan et al., 2017). This lack of interpretability can hamper progress in developing new machine learning models and can act as a hindrance to their adoption by making it hard to trust that the model's predictions are based on sound principles (Li et al., 2022). In this work, we propose NPEFF (Non-Negative Per-Example Fisher Factorization), an inter- pretability method that makes use of the model's parameter space to produce representations of concepts. Our method can be used with any end-to-end differentiable model without requiring any customization to particular architectures. NPEFF extracts these concepts unsupervisedly given a set of examples. It also provides a theoretically principled way to produce guided changes in a given model's behavior by using these concept representations to directly alter a model's parameters. NPEFF operates on the hypothesis that a neural network's processing of inputs can be decomposed into a hierarchical set of abstract sub-computations. The computation performed by a model there- fore makes use of a fixed set of learned sub-computations, and its processing on any particular example involves a sparse subset of them. Whether a given sub-computation is used for a given example therefore depends on the abstract concepts that underlie the example. Across examples, we assume that each sub-computation will involve a consistent subset of parameters that perform 1https://github.com/mmatena/npeff_ref 1 a similar operation. Since the Fisher information matrix for each example relates perturbations in model parameters to changes in the model's predictive distribution, the sub-computations applied to an example become imprinted in it. NPEFF disentangles these sub-computations given a collection of per-example Fishers (PEFs) through a decomposition procedure. We provide two versions of NPEFF that operate on different representations of the PEF matrices: a diagonal approximation and an exact low-rank representa- tion. When using diagonal PEFs, our decomposition procedure becomes equivalent to non-negative matrix factorization (NMF) (Lee & Seung, 1999). In the low rank case, we represent each exam- ple's PEF matrix as a non-negative sum of rank-1 positive semi-definite matrices. To the best of our knowledge, this is a novel decomposition, and we introduce a scalable, multi-GPU algorithm for computing it. The output of an NEPFF decomposition provides a direct way to quantify the importance of each component to the model's processing of each example. Looking at the examples most influenced by a particular component provides a means to infer what concept or heuristic the component rep- resents. Furthermore, NPEFF generates a "pseudo-Fisher" matrix for each component that can be used to estimate the impact of parameter perturbations on their associated sub-computations. By constructing perturbations that selectively impact particular components, we can verify that the components reflect how the model actually processes examples. Overall, NPEFF provides a way to interpret a model's processing by extracting the computational sub-steps it uses. In our experiments on text and vision models, we find that these sub-steps of- ten corresponded to human-recognizable concepts by inspecting component top examples. Our parameter perturbation experiments demonstrate that the component pseudo-Fishers indeed reflect parameters important for their particular computational steps. We further ran experiments on a TRACR-compiled toy model implementing a known ground-truth algorithm and demonstrate that components align with sub-steps of the computation. We also explored a potential application of NPEFF's parameter perturbation to correcting faulty heuristics used by a model. Finally, we include experiments demonstrating the robustness of NPEFF to choices of hyperparameters. 2 NON-NEGATIVE PER-EXAMPLE FISHER FACTORIZATION (NPEFF) 2.1 FISHER INFORMATION Consider a classification model pθ(y|x) with parameters θ ∈ Rm that maps inputs x ∈ X to a softmax distribution over C labels. Given any example x ∈ X , we define the per-example Fisher (PEF) matrix as F (x) = Ey∼pθ(y|x)∇θ log pθ(y|x)∇θ log pθ(y|x)T . (1) The Fisher information matrix has an information geometric interpretation as a metric relating local perturbations in parameters to changes in the model's predictive distribution (Amari, 2016) DKL(pθ(y|x)∥pθ+δ(y|x)) ≈ 1 2 δT F (x)δ (2) as δ → 0, where DKL is the KL divergence. If we let aj(x) = (cid:112)pθ(yj|x)∇θ log pθ(yi|x), (cid:80)C then we can express the PEF as F (x) = j=1 aj(x)aj(x)T . We can thus represent the full PEF matrix using only Cm values, which we call its low-rank representation or LRM-PEF. Alternatively, we can use the diagonal of the PEF ma- trix as its representation, which we call the diagonal PEF or D-PEF (Kirkpatrick et al., 2017). In this case we have f (x) = Ey∼pθ(y|x) (∇θ log pθ(y|x))2 . (3) Unlike the LRM-PEF which is an exact representation, the D-PEF corresponds to the approximation F (x) ≈ Diag(f (x)). Generally, D-PEFs are more tractable to process than LRM-PEFs when the number of classes C is large. Sparsity Since the number of parameters m can be very large for real world models, storing D-PEFs or LRM-PEFs for a modestly sized data set can become intractable. Fortunately, we empir- ically observe that most of the entries of the PEFs for typical trained neural networks tend to be very 2 small in magnitude. This is to be expected from prior works on model pruning (Hoefler et al., 2021), which finds that most parameters are not important for the model's behavior (Frankle & Carbin, 2018). In our work, we fix some value K ∈ N and sparsify each PEF representation by using only the K values with the largest magnitudes. This significantly reduces the amount of required storage and compute with relatively little impact on the accuracy of the representations. Number of Classes For tasks with only a few classes, we can include the term for every class in equation 1 and equation 3 when computing the PEFs. However, this becomes prohibitively ex- pensive as the number of classes increases, requiring roughly the same amount of computation as required for a backwards pass for each class. For such tasks, we thus discard terms correspond to classes whose probabilities pθ(y|x) are below some threshold ε. 2.2 DECOMPOSITION Let D = {x1, . . . , xn} be a set of examples. Let Fi correspond to our representation of the Fisher matrix for the i-th example, i.e. Fi = (cid:80)C j=1 aj(xi)aj(xi)T if we are using LRM-PEFs or Fi = Diag(f (xi)) for D-PEFs. The decomposition central to NPEFF can be expressed as the non-convex optimization problem i=1 ∥Fi − (cid:80)r j=1 WijHj∥2 F minimize (cid:80)n subject to Wij ≥ 0, Hj ∈ H, (4) where H corresponds to a subset of m × m matrices and r is a hyperparameter denoting the number of components to learn. We choose this decomposition since we can interpret the Hj as a "pseudo- Fisher" for the j-th component, and the non-negative coefficients Wij allow us to see the contribu- tions of each component to the KL-divergence of a model's predictions following a perturbation of its parameters. For LRM-NPEFF, H is the set of rank-1 m × m-positive semi-definite (PSD) matrices. Any element j for some vector gj ∈ Rm. This decomposition can be of this Hj can be expressed as Hj = gjgT described as approximating a set of low-rank PSD matrices as non-negative combinations of a set of shared rank-1 PSD matrices. We present a multi-GPU algorithm performing this decomposition in appendix A. Importantly, this algorithm does not explicitly construct any m × m-matrix and instead uses a number of inner products between m-dimensional vectors that is independent of m itself. For D-NPEFF, H is the set of diagonal m × m-matrices with non-negative entries. Any element of this H can be expressed as Hj = Diag(hj) for some non-negative vector hj ∈ Rm ≥0. Solving equation 4 then reduces to the well-studied problem of non-negative matrix factorization (NMF) (Wang & Zhang, 2012). We used a multi-GPU implementation based on Boureima et al. (2022). Both variants of NPEFF produce a non-negative matrix W ∈ Rn×r that we call the coefficient ≥0 matrix. It defines the relationship between individual examples and components. Each entry Wij represents the contribution of the j-th component to the PEF of the i-th example. The coefficient matrix allows us to get a qualitative understanding of the sub-computation associated to each com- ponent. Given a component, we create a list of the examples sorted by the component's coefficient and look at the ones with the highest coefficients. Those top examples often display an interpretable pattern from which we can infer what processing the component represents. Both NPEFF variants also produce a collection of m-dimensional vectors that we refer to as the com- ponent pseudo-Fishers. Deferring to section 2.3 for further exposition, each component's pseudo- Fisher vector generates what can be interpreted as an analog of a Fisher information matrix for that component. We express these matrices as Hj = gjgT for an LRM-NPEFF pseudo-Fisher vec- j tor gj ∈ Rm. D-NPEFF generates Hj = Diag(hj) for the non-negative pseudo-Fisher vectors hj ∈ Rm ≥0. Preprocessing During initial experimentation, we found that using raw PEFs led to components tuned to outlier examples. We suspect that outlier examples tend to have PEFs with large magni- tudes, and thus their contributions dominate the loss during optimization. To rectify this, we normal- ized PEFs to have unit Frobenius norm before sparsification. This has the effect of de-emphasizing 3 examples for which the sparse approximation is poor; however, we expect any difference in the outcome to be minimal. Efficient computation of the Frobenius norm is described in appendix B. Our decomposition algorithms make use of a dense representation of the pseudo-Fisher vectors, and thus a naive implementation would require the use of rm floats to represent them. However, the sparsification of the PEFs leads to many parameters having few non-zero corresponding entries. We are able to greatly reduce the memory burden by pruning these entries across the PEFs and using a dimensionality of m′ < m. We suspect these positions do not contain enough effective "data-points" to contribute meaningfully to the factorization, so its validity should be minimally impacted. Coefficient Fitting Once we have computed the pseudo-Fisher vectors on a data set D, we can fit a coefficient matrix to PEFs created from another data set D′. Importantly, this allows us to see if the tunings of NPEFF components generalize to examples not used to generate them. Since both of the LRM-NPEFF and D-NPEFF decomposition algorithms operate by alternating between updating the coefficient matrix and updating the pseudo-Fisher vectors, we can fit coefficients to a fixed set of pseudo-Fishers by repeatedly only performing the coefficient matrix update step. By caching intermediates that do not depend on the coefficients, coefficient fitting can be performed far more efficiently than a full NPEFF decomposition. Components Set Expansion Having learned an NPEFF decomposition using a large, general set of examples, we can expand the set of components to create components specialized to another set of examples that are of particular interest. The process is similar to that of a regular NPEFF decomposition with the exception that a subset of component pseudo-Fishers are initialized using the existing decomposition. These are then frozen throughout the decomposition procedure. This leads to the frozen components capturing the general-purpose processing trends leaving the non- frozen components to capture processing specific to that set of examples. 2.3 GUIDED PERTURBATIONS Recall from equation 2 how PEF matrices can be used to relate perturbations of model parameters to changes in its predictive distribution for an example. Using the NPEFF decomposition, we can approximate a PEF matrix for example xi as Fi ≈ αi j=1 WijHj, where αi is the Frobenious norm of Fi. Plugging this into equation 2 gives us (cid:80)r DKL(pθ(y|xi)∥pθ+δ(y|xi)) ≈ αi 2 r (cid:88) j=1 WijδT Hjδ (5) for a parameter perturbation δ ∈ Rm. From this, our choice of calling Hj the "pseudo-Fisher matrix" for the j-component should be clear: it can be used to relate the disruption of the model's predictions on examples utilizing the component to perturbations of parameters. Furthermore, this justifies our choice of decomposition method since the uncovered factors can be readily interpreted in equation 5. The equation equation 5 provides a theoretically principled way to verify relationship between pa- rameters and examples uncovered by NPEFF. The goal is to find a perturbation δ ∈ Rm such that δT Hkδ is large when k = j for a chosen component j and is small otherwise. Once one is found, we can compare the KL-divergences between the perturbed and original models' predictions on examples to their coefficients for the j-th component. For LRM-NPEFF, recall that each pseudo-Fisher matrix Hk can be expressed as gkgT k for some vector gk ∈ Rm. Thus δT Hkδ = (gT k δ has a large mag- nitude for k = j and small magnitude otherwise. We found that simply using δ ∝ ±gj performed well, but the selectivity of the perturbation could be improved by taking the orthogonal rejection of ±gj onto a subset of the other components' pseudo-Fishers. Namely, we orthogonally reject ±gj onto gk if the magnitude of their cosine-similarities is below some threshold. The threshold is used to prevent similar components from interfering in the construction of the perturbation. We found a threshold of 0.35 to work well, which is what we used throughout our experiments. The construction of the perturbation for D-NPEFF is more involved and is presented in appendix C. k δ)2. We wish to find a δ ∈ Rm such that gT 4 3 EXPERIMENTS 3.1 COMPONENT TUNINGS AND PERTURBATIONS We ran LRM-NPEFF on two NLP models and ran D-NPEFF on a vision model. The NLP models were BERT-base fine-tuned on MNLI and QQP, respectively (Devlin et al., 2018). QQP is a binary classification task that aims to determine whether a pair of questions are duplicates of each other (Wang et al., 2018a). MNLI is a natural language inference (NLI) task that involves determining whether a given hypothesis is implied by, contradicted by, or neutral with respect to a given hypoth- esis (Williams et al., 2018). Thus, it has three classes. For the vision model, we used a ResNet-50 (He et al., 2016) trained on the ImageNet classification task (Russakovsky et al., 2015). ImageNet involves classifying an image as one of 1000 fine-grained classes. When learning the NPEFF components for QQP, we used 50k examples heldout from the canonical train split to produce PEFs. For the NLI model, we used 50k examples from the SNLI data set (Bowman et al., 2015). Like the MNLI data set used to train the model, SNLI is also an NLI task with the main difference being that SNLI examples come from a single domain while MNLI has examples from multiple domains. We chose to do this to get a better idea of how NPEFF uncovers heuristics when a model generalizes to new data sets. We used 20k examples from the train split of ImageNet 2012 to produce PEFs for the vision model. We ignored classes with a probability of less than 3e-3 when computing the PEFs for the vision model. We used 512 components when running NPEFF on the NLI and vision models, and we used 256 components for the QQP model. Once the NPEFF pseudo-Fishers were computed, we fit coefficients to PEFs from a heldout set of examples for each model. We used 50k SNLI examples for the NLI model, 40,430 examples from the QQP validation set for the QQP model, and 30k examples from the ImageNet validation set for the vision model. All of the component tunings and perturbations presented in this section are from these heldout sets. More details on the models and data sets used can be found in see appendix D. There, we also go into detail about the hyperparameters used when computing the PEFs and running NPEFF for these experiments. 3.1.1 COMPONENT TUNINGS COMPONENT 70: Which is the best dish tv connection in hyderabad? Which is the best dish tv connection in bangalore? COMPONENT 345: [P] Two men in the kitchen with a pot on the stove. [H] Two men cook a pot of soup in the kitchen. Which is the best eye hospital in kolkata? Which is the best eye hospital in pune? Where can i buy second hand books in hyderabad? Where can i buy second hand books in india? What is the best coaching center for gre in chennai? What is the best coaching center for gre in bangalore? [P] A young girl is eating as she sits at a table full of food. [H] A young girl is eating fruit at a table. [P] A child is looking at an exhibit. [H] A child looks at an exhibit of a monkey. [P] 3 men are working on a boat. [H] 3 men are working on a crab boat in alaska. Figure 1: Top examples for two language components. The examples presented are the ones with the 4 highest coefficients. (Left) QQP component. The model correctly predicts that these questions pairs are not duplicates. Despite asking for the same information, they differ in geographic location. (Right) The model correctly predicted "neutral" for these examples. The hypothesis is consistent with the premise but includes additional information that cannot be inferred from the premise. For all models, we found that most components appeared to have some potential interpretable tuning. We present the top examples of some components in fig. 1 for the NLP models and fig. 2 for the vision model. More examples of tuned component top examples are provided in appendix J. Some components for the NLP models appeared to be tuned to strategies of solving their respective tasks for specific types of examples. These were typically selective for one of the predictions, and the top examples all contained some common task-specific group of features. Other components appeared to be tuned for features not directly related to the task (e.g. existence of certain kinds of words). It was often the case that a component would use a combination of these two tuning styles. Many components for the vision model had tunings that included relatively low-level features such as color, shape, and spatial patterns. More abstract, high-level features also played in a role in the tunings of many components. These range from broad, coarse-grained attributes such as the 5 COMPONENT 36 COMPONENT 218 Figure 2: Top examples for two vision components. The top two rows for each component are the examples with the 8 highest coefficients. The bottom row for each component contains selected examples from the set of top 32 examples. (Left) The examples with the highest coefficients are all school buses. In general, examples with high coefficients have a yellow vehicle in them. (Right) The examples with the highest coefficients are all zebras. In general, examples with high coefficients have a striped animal in them. The specific type of animal does not seem important with fish, mollusks, lizards, and mammals being included. Figure 3: Histograms of the log2 ratios between top component examples and random examples for KL-divergence and PEF norm. general category of the image subject (e.g. animal, plant, vehicle, architecture, technology, etc.) to more specific, fine-grained attributes such as the fur patterns of dogs. Many of the components had tunings that included both low-level and high-level features. In those cases, the low-level features were often predictive of the higher level ones. 3.1.2 PERTURBATIONS For the LRM-NPEFF experiments on the NLI and QQP models, we used the perturbation method discussed in section 2.3. Perturbation vectors were scaled to have an L2 norm of 0.1 before applying them to the model parameters. We then measured the per-example KL-divergence of the perturbed model's predictions from the original model's predictions. To score the selectivity of the perturba- tion's impact on the top examples of a component, we calculated the ratio of the average of this KL-divergence for the component's top 128 examples to the average KL-divergence for a random subset of 10k examples. Since the sign of the perturbation is not determined by the method in sec- tion 2.3, we try both adding and subtracting the perturbation to the model parameters. The reported scores correspond to whichever has a higher KL-ratio. Details of the perturbation experiments for the D-NPEFF decomposition of the vision model can be found in appendix E. Looking at the expression equation 5 relating the KL-divergence of a model's prediction to a per- turbation of its parameters, we see that the KL-divergence is directly proportional to norm of the example's PEF. In contrast, the coefficients used to rank the top examples for a component are com- puted using normalized PEFs and thus are independent of their norms. To explore the impact of this confounding factor, we computed the ratio of the average PEF Frobenius norm of the top 128 examples for each component to the average norm of a random subset of 10k examples. Histograms of the KL-divergence and PEF norm ratios are presented in fig. 3. For all models, these histograms clearly show that the KL-divergence ratios tended to be significantly higher than the PEF 6 12.510.07.55.02.50.02.55.0Log_2 Ratio0204060CountQQPKLPEF Norm12.510.07.55.02.50.02.55.07.5Log_2 Ratio0204060CountNLIKLPEF Norm01234Log_2 Ratio051015CountVisionKLPEF Norm norm ratios. This supports our claim that the directions in parameter space uncovered by NPEFF are specifically important for their respective component top examples. Furthermore, this helps verify that the concepts and heuristics uncovered by NPEFF correspond to actual processing methods used by the model. 3.2 TOY MODEL WITH KNOWN GROUND TRUTH Since it is difficult to evaluate whether a method uncovers concepts actually used by a real-world model, we ran experiments using a synthetic task and transformer model compiled by TRACR (Lindner et al., 2023) that implements a RASP program (Weiss et al., 2021) This task simulates an extremely simplified NLI task. An example looks like [BOS] Q1 S1 O1 Q2 S2 O2, which is a concatenation of a premise and hypothesis. The Q1,Q2 tokens correspond to All or Some, and a Q S O segment can be thought of as the sentence [All/Some] [subject] [verb] [object]. The verb is assumed fixed and shared between the premise and hypothesis, so it is not explicitly represented. Subjects and objects are chosen from the same set of options containing a hierarchical structure so that we can have a is a subtype of relation between options. Each example is given a label of entails or neutral. Appendix H contains the RASP program solving this task. It is compiled by TRACR to an encoder-style Transformer (Vaswani et al., 2017) with 4 attention heads, a model dimension of 25, feedforward hidden dimension of 1320, and 23 layers with 23.5M params. Its output at the final sequence position forms the prediction for the example. We ran LRM-NPEFF on 1616 examples using either 32 or 128 components. Since we know how the model processes examples, we can programmatically search for components whose top examples all contain a concept used by the model. We found that 30/32 and 92/128 components had 128 top examples all containing at least one concept. See appendix H for details on this programmatic search along with a detailed breakdown of component tunings. Although caution should be used when extending these results to real-world models since organic processing might differ from TRACR's implementations, these results demonstrate that NPEFF is able to extract concepts actually used by a model in this setting. 3.3 HYPERPARAMETER EXPLORATION We explored the impact of various choices of hyperparameters on the LRM-NPEFF decomposition. The NLI model's LRM-NPEFF from section 3.1 was used as the baseline setting. To concisely compare component tunings, we used the cosine similarity of component coefficient vectors. Com- ponents with a high cosine similarity tended to have similar top examples. Sparsity We ran LRM-NPEFF keeping the top 16384, 65536, and 262144 values per PEF. We used 20k examples and 128 components. Given a pair of runs, we looked at each component from one of the runs and recorded its max cosine similarity with any component from the other run. If this value is high for most components in both directions for a pair of runs, then most of the concepts from one run have an analogous concept in the other. This metric had an average value of 0.77 when comparing the components from the 16384-value run against either of the other runs. The 65536-value run had an average of value of 0.76 and 0.80 when compared against 16384-value and 262144-value runs. The 262144-value run had an average of value of 0.77 and 0.80 when compared against 16384-value and 65536-value runs. Hence the sets of learned components tended to be fairly similar with no major qualitative difference being observed between their tunings. Information about how well the PEFs were approximated at different levels of sparsity can be found in appendix G. Number of Components We ran LRM-NPEFF using 32, 128, and 512 components. To compare a pair of runs A and B, suppose that run B has more components than run A. For each component i of run A, we found the subset of run B's components whose coefficient cosine similarity to that component i was greater than to any other of run A's components. For all pairs of runs, we found that every component from the smaller run had at least one corresponding component from the larger run. Qualitatively, we found that the groups of components from the larger run corresponding to each component from the smaller run had similar tunings. More precisely, these groups tended to be more fine-grained "splits" of the component from the smaller run. For example, a component 7 tuned to hypotheses containing a word that contradicts a word in the premise might have a split where the relevant words are colors and another split where they are "cat" and "dog". Number of Steps To explore the convergence of the coefficient matrix as the NPEFF learning algorithm progresses, we performed the decomposition for 1500 steps and saved the matrix every 50 steps. A graph of the average component coefficient cosine similarity with its final value across steps can be found in fig. 5. Notably, the average similarity exceeded 95% by 700 steps and 99% by 1100 steps. D-NPEFF vs. LRM-NPEFF We repeated the experiments of section 3.1 for the NLI and vision model but using D-NPEFF instead of LRM-NPEFF and vice-versa. For the NLI model, we found D- NPEFF to generate fewer components with readily interpretable tunings than LRM-NPEFF. While most of the LRM-NPEFF components appeared tuned, only about half of the D-NPEFF compo- nents appeared tuned. Furthermore, the perturbation of D-NPEFF components led to less selective changes in model predictions than for the LRM-NPEFF components with a median KL-ratio of 5.26 compared to 7.64. However, this might just be an artifact of the difference between the perturbation methods of the two flavors of NPEFF. The LRM-NPEFF results on the vision model were far worse than the D-NPEFF results. Far fewer components had interpretable tunings, and top examples of tuned components were significantly noisier. The selectivity of perturbations of the LRM-NPEFF components was also lower than for the D-NPEFF components with a median KL ratio of 2.45 compared to 4.81. We suspect that using a fixed number of non-zero entries led to examples with high rank PEFs having poor sparse approximations. Left to future work, possible methods to adapt LRM-NPEFF to tasks with many classes (and thus potentially high rank PEFs) include varying the number of kept entries with PEF rank and using a different low-rank approximation to the PEF instead of just using a subset of classes. 3.4 COMPARISON TO EXISTING INTERPRETABILITY METHODS While there are no existing unsupervised concept discovery algorithms directly comparable to NPEFF, we can adapt the methods of Ghorbani et al. (2019) to be a baseline. Ghorbani et al. (2019) learns concepts through k-means clustering of activation space representations of image segments. We compared NPEFF to a more generalized version of this operating directly on examples rather than image segments, which allowed us to run experiments on text tasks. We used the distance of an example's activations from its cluster's centroid to rank examples within a cluster. We ran this baseline for both the NLI and vision models. We used the encoder's final representation of the CLS token as the activations for the NLI model. For the vision model, we used the output of the global average pooling layer that immediately precedes the classification layer. Using the same sets of examples as in section 3.1, we learned 128 clusters for each model. Most of the top examples for the clusters displayed some human-interpretable tuning as ascertained through examination of their top examples. Top examples of some clusters are presented in appendix M. We used TCAV (Kim et al., 2018) to test whether a relationship existed between the top examples for a cluster/component and the prediction of at least one class for the NLI model. We found a statistically significant relationship existed for every k-means cluster and every LRM-NPEFF component. Details can be found in appendix I. Qualitatively, we found some similarities in the tunings of NPEFF and baseline components with NPEFF producing a more diverse set of tunings. To get a more quantitative comparison, we used the average max cosine-similarity metric from section 3.3 to compare tunings. Here, we used a vector of 0s and 1s indicating cluster membership as the "coefficients vector" for a k-means cluster. For the NLI model, we found that k-means clusters had an average max cosine similarity of 0.20 against the NPEFF components and a value of 0.19 in the opposite direction. Since NPEFF coefficients and cluster "coefficients" represent different types of quantities, we should note that this metric provides a cruder similarity measure than when comparing between NPEFF components. Nevertheless, we would expect differences in recovered concepts. The differences in recovered con- cepts highlights several advantages of NPEFF. The k-means baseline operates on activations from a single layer near the output of the model while NPEFF operates on PEFs containing information from the entire model. Hence NPEFF can pinpoint what part of the model performs certain com- 8 putations. In contrast, a full-model decomposition over activations becomes tricky when the total activation space does not have fixed dimension (e.g. the variable sequence length of transformers). The ability to make informed modifications to parameters to directly test whether the model actually uses a recovered concept is a further advantage unique to NPEFF. 3.5 EXAMPLE APPLICATION: FIXING FLAWED HEURISTICS We experimented using NPEFF with the NLI model to see what heuristics it uses when it makes incorrect predictions. To do so, we created a filtered set of PEFs corresponding to examples on which the model made an incorrect prediction. We then performed the components set expansion procedure to learn 64 components specialized to these examples. Finally, we fit coefficients to a non-filtered set of examples using the expanded NPEFFs. See appendix F for details on this process. The components in the expansion were more likely to have a high fraction of incorrect predictions in their top examples. More precisely, 41% of the expanded components had incorrect predictions for at least 50% of their top 16 examples compared to just 4.3% of the original components. Such components could generally be placed into one of three groups: correct heuristics with inconsistent labeling, completely wrong heuristics, or flawed heuristics. Since LRM-NPEFF connects compo- nents to directions in parameter space through their pseudo-Fishers, we can try to alter the model parameters to selectively fix components tuned to incorrect heuristics. We selected the subset of expanded components whose top 16 examples contained at least 8 incorrect predictions. The top examples of some these components are provided in appendix L. We then performed perturbations on these components using a similar methodology to section 3.1.2 but with a larger perturbation magnitude of 3e-1. Out of the 48 components deemed to correspond to incorrect heuristics, we found four components that increased the model's accuracy by at least 0.5% after being perturbed. While these results are promising, we emphasize that this method of fixing faulty heuristics using NPEFF is mostly a proof of concept. We leave improvements to this method such as incorporating loss gradient information to future work. 4 RELATED WORK Methods reliant on ranking or grouping examples are common in the interpretability literature. For example, the activation value of a single neuron is a frequently used metric to derive such rankings (Sajjad et al., 2022; Bolukbasi et al., 2021; Bau et al., 2017; Szegedy et al., 2013). Alternate methods include using agglomerative clustering on token-level BERT representations to find groups of rep- resentations corresponding to concepts (Dalvi et al., 2022), using supervised probing task to learn latent interpretable representations (Michael et al., 2020), and unsupervisedly finding interpretable directions in the latent space of a generative adversarial network (Voynov & Babenko, 2020). Kim et al. (2018) uses user-defined groups of examples to represent an abstract concept. Ghorbani et al. (2019) uses clustering of activation space representations of image segments to automatically learn concepts. Yeh et al. (2020) learns concepts by projecting activations at a given layer onto a set of learned vectors, setting the dot products below a threshold to zero, and then using a learned mapping back to activation space before being processed by the rest of the network. They add regularizers to encourage concepts to be coherent and unique. Representing a neural network as a set of sub-computations underlies some vision interpretability work. Zhang et al. (2018) learns an explanatory graph given a convolutional neural network. They create nodes corresponding to disentangled convolutional filters and assign edges based on the rela- tive spatial displacement of node activations between neighboring layers. For each example, Wang et al. (2018b) learns a scalar control gate for each channel in each layer of a convolutional network. They are fit using a loss that encourages the gates to be as sparse as possible while preserving the model's predictions on the example. Clustering of these per-example routing maps produces clusters that reflect input layout patterns. 5 CONCLUSION NPEFF presents a novel direction in model interpretability research. Applicable to any model with differentiable parameters, it automatically discovers concepts and heuristics used by a model. 9 NPEFF further grounds these in the model's parameter space and allows for their selective perturba- tions. In addition to being useful in verifying that these concepts and heuristics faithfully represent the model's processing, it opens up the possibility of modifying the model informed by this knowl- edge. In future work, we hope to further develop some of the applications of NPEFF explored in this paper as well as explore its viability in facilitating scientific discovery. REFERENCES Mart ́ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. {TensorFlow}: a system for {Large-Scale} machine learning. In 12th USENIX symposium on operating systems design and implementation (OSDI 16), pp. 265–283, 2016. Shun-ichi Amari. Information geometry and its applications, volume 194. Springer, 2016. David Bau, Bolei Zhou, Aditya Khosla, Aude Oliva, and Antonio Torralba. Network dissection: Quantifying interpretability of deep visual representations. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 6541–6549, 2017. Tolga Bolukbasi, Adam Pearce, Ann Yuan, Andy Coenen, Emily Reif, Fernanda Vi ́egas, and Martin Wattenberg. An interpretability illusion for bert. arXiv preprint arXiv:2104.07143, 2021. Ismael Boureima, Manish Bhattarai, Maksim Eren, Erik Skau, Philip Romero, Stephan Eidenbenz, and Boian Alexandrov. Distributed out-of-memory nmf of dense and sparse data on cpu/gpu architectures with automatic model selection for exascale data. arXiv preprint arXiv:2202.09518, 2022. Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. A large anno- tated corpus for learning natural language inference. arXiv preprint arXiv:1508.05326, 2015. Juan Jos ́e Burred. Detailed derivation of multiplicative update rules for nmf. Paris, France, 2014. Piotr Dabkowski and Yarin Gal. Real time image saliency for black box classifiers. Advances in neural information processing systems, 30, 2017. Fahim Dalvi, Abdul Rafae Khan, Firoj Alam, Nadir Durrani, Jia Xu, and Hassan Sajjad. Discovering latent concepts learned in bert. arXiv preprint arXiv:2205.07237, 2022. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. arXiv preprint arXiv:1803.03635, 2018. Amirata Ghorbani, James Wexler, James Y Zou, and Been Kim. Towards automatic concept-based explanations. Advances in Neural Information Processing Systems, 32, 2019. Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recog- nition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. Torsten Hoefler, Dan Alistarh, Tal Ben-Nun, Nikoli Dryden, and Alexandra Peste. Sparsity in deep learning: Pruning and growth for efficient inference and training in neural networks. J. Mach. Learn. Res., 22(241):1–124, 2021. Been Kim, Martin Wattenberg, Justin Gilmer, Carrie Cai, James Wexler, Fernanda Viegas, et al. Interpretability beyond feature attribution: Quantitative testing with concept activation vectors (tcav). In International conference on machine learning, pp. 2668–2677. PMLR, 2018. Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. 10 James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcom- ing catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521–3526, 2017. Daniel D Lee and H Sebastian Seung. Learning the parts of objects by non-negative matrix factor- ization. Nature, 401(6755):788–791, 1999. Xuhong Li, Haoyi Xiong, Xingjian Li, Xuanyu Wu, Xiao Zhang, Ji Liu, Jiang Bian, and Dejing Interpretable deep learning: Interpretation, interpretability, trustworthiness, and beyond. Dou. Knowledge and Information Systems, 64(12):3197–3234, 2022. David Lindner, J ́anos Kram ́ar, Matthew Rahtz, Thomas McGrath, and Vladimir Mikulik. Tracr: Compiled transformers as a laboratory for interpretability. arXiv preprint arXiv:2301.05062, 2023. Michael Matena and Colin Raffel. Merging models with fisher-weighted averaging. arXiv preprint arXiv:2111.09832, 2021. R Thomas McCoy, Junghyun Min, and Tal Linzen. Berts of a feather do not generalize together: Large variability in generalization across models with similar test set performance. arXiv preprint arXiv:1911.02969, 2019. Julian Michael, Jan A Botha, and Ian Tenney. Asking without telling: Exploring latent ontologies in contextual representations. arXiv preprint arXiv:2004.14513, 2020. Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y. Hassan Sajjad, Nadir Durrani, and Fahim Dalvi. Neuron-level interpretation of deep nlp models: A survey. Transactions of the Association for Computational Linguistics, 10:1285–1303, 2022. Daniel Smilkov, Nikhil Thorat, Been Kim, Fernanda Vi ́egas, and Martin Wattenberg. Smoothgrad: removing noise by adding noise. arXiv preprint arXiv:1706.03825, 2017. Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. In International conference on machine learning, pp. 3319–3328. PMLR, 2017. Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural informa- tion processing systems, 30, 2017. Andrey Voynov and Artem Babenko. Unsupervised discovery of interpretable directions in the gan latent space. In International conference on machine learning, pp. 9786–9796. PMLR, 2020. Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461, 2018a. Yu-Xiong Wang and Yu-Jin Zhang. Nonnegative matrix factorization: A comprehensive review. IEEE Transactions on knowledge and data engineering, 25(6):1336–1353, 2012. Yulong Wang, Hang Su, Bo Zhang, and Xiaolin Hu. Interpret neural networks by identifying crit- ical data routing paths. In proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8906–8914, 2018b. Gail Weiss, Yoav Goldberg, and Eran Yahav. Thinking like transformers. In International Confer- ence on Machine Learning, pp. 11080–11090. PMLR, 2021. 11 Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sen- tence understanding through inference. In Proceedings of the 2018 Conference of the North Amer- ican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 1112–1122. Association for Computational Linguistics, 2018. URL http://aclweb.org/anthology/N18-1101. Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, R ́emi Louf, Morgan Funtowicz, et al. Huggingface's transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771, 2019. Chih-Kuan Yeh, Been Kim, Sercan Arik, Chun-Liang Li, Tomas Pfister, and Pradeep Ravikumar. On completeness-aware concept-based explanations in deep neural networks. Advances in neural information processing systems, 33:20554–20565, 2020. Quanshi Zhang, Ruiming Cao, Feng Shi, Ying Nian Wu, and Song-Chun Zhu. Interpreting cnn knowledge via an explanatory graph. In Proceedings of the AAAI conference on artificial intelli- gence, volume 32, 2018. 12 A LRM-NPEFF DECOMPOSITION ALGORITHM Let D = {x1, . . . , xn} be a set of examples. Let us represent the set of LRM-PEFs via the rank-3 tensor A ∈ Rn×c×m, where n is the number of examples, c is the number of classes, and m is the number of parameters. The Fisher information matrix for the i-th example can be expressed as i Ai, where Ai ∈ Rc×m. While our implementation can handle using a different rank for each AT PEF (i.e. the number of rows of Ai varying with i), we assume a constant rank here for ease of presentation. The decomposition equation 4 becomes learning matrices W ∈ Rn×r and G ∈ Rr×m such that i=1 ∥Fi − (cid:80)r j=1 WijgjgT j ∥2 F (6) minimize (cid:80)n subject to Wij ≥ 0, where gj denotes the j-th row of G. To solve equation 6, we take a coordinate descent approach reminiscent of the multiplicative update algorithm for NMF where we alternate between updating the W and G matrices (Lee & Seung, 1999). Our W -update step is essentially a the W -update step from the multiplicative update NMF algorithm. For the G-update step, we perform a gradient descent step with a fixed learning rate. It is possible to perform both steps without having to explicitly construct and m × m-matrices and instead only perform inner products between m-dimensional vectors. The number of such inner products used in the algorithm is independent of m. We go over how to efficiently perform these steps and split the work amongst multiple GPUs in the following. A.1 W-UPDATE STEP Recall that the multiplicative update step in NMF involves computing non-negative numerator and denominator matrices N, D ∈ Rn×r. The matrix W is then updated via the element-wise rule Wij (cid:55)→ WijNij/Dij. Computing the numerator starts with computing the rank-3 tensor B ∈ Rn×c×r with elements given by Bijk = (cid:80)m l=1 AijlGkl. The numerator is then given element-wise by Nik = (cid:80)c ijk. The denominator is then given by D = W ((GGT ) ⊙ (GGT )), where ⊙ denotes the Hadamard product. j=1 B2 A.2 G-UPDATE STEP The gradient of the loss with respect to G consists of two terms T1, T2 ∈ Rr×m that are added together. The first term is given by T1 = 4((W T W ) ⊙ (GGT ))G. Computation of the second term starts by computing the rank-3 tensor B ∈ Rn×c×r as was done for the W -update step. The second term is then obtained element-wise as [T2]il = −4 (cid:80)n k=1 WjiβjkiAjkl. (cid:80)c j=1 A.3 MULTI-GPU IMPLEMENTATION DETAILS Our strategy for distributing work across multiple GPUs is similar to that of Boureima et al. (2022). We partition the last axis of the A tensor and columns of G across the GPUs. The W matrix is replicated across all GPUs. Two all-reduces are needed per step: when computing B and when computing GGT . If doing a G-update step immediately after a W -update step, we can cache copies of these matrices during the W -update step and use them for the G-update step. A.4 OTHER CONSIDERATIONS We initialized W using the uniform distribution on [0, 1]. We initialized G using a normal dis- rm. Since the PEFs were normalized tribution with zero mean and standard deviation of to roughly unit L2 norm, we chose this scaling so that the initial reconstructions would also have roughly unit L2 norms as well. 2/ √ √ After initialization, we found it crucial to freeze W and only train G for a bit before commencing joint training. This is because if the G is a poor fit for the W , the W update step will end up setting W to zero. Since the W update is multiplicative, it remains zero throughout the remainder of training if this happens. We suspect that this behavior can be explained due to the nature of the multiplicative update step. It can be shown that the multiplicative update step is equivalent to gradient descent with 13 a variable element-wise learning rate (Burred, 2014). Unlike traditional gradient descent that uses a small gradient step, the variable learning can become large. This makes it possible for the W to jump directly to zero or some similarly small value. If the loss is greater than the Frobenius norm of the PEFs, then setting W to zero will result in a lower loss. Hence, jumping to zero can decrease the loss in such cases. A.5 CONVERGENCE While we do not provide a proof of convergence of our LRM-NPEFF decomposition algorithm, we can make a heuristic argument for its convergence. Following the proof of convergence for regular multiplicative-update NMF (Lee & Seung, 1999), we can show that the loss will be non-increasing following the W -update step. For a sufficiently small step size, we can expect the gradient descent step from the G-update to not increase the loss as well. Since the loss is bounded from below by 0, it follows that the loss should eventually converge. When actually running LRM-NPEFF, we found the loss to be non-increasing with the rate of decrease decelerating as the number of steps increased. A.6 RUN TIME AND SCALING INFORMATION Typically, our LRM-NPEFF decomposition took between 1 to 8 hours depending on the problem size and number of GPUs used. We used a server with 4x A6000 GPUs; however, we often did not use all of the GPUs. Using the same set up as the NLI model in section 3.1, we report times per joint update step (i.e. a W -update followed by a G update) here. For a 512 component decomposition, we had a step time of 29156 ms on 2 GPUs and 15022 ms on 4 GPUs. For a 128 component decomposition, we had a step time of 14388 ms on 1 GPU and 6975 ms on 2 GPUs. For a 32 component decomposition, we had a step time of 3190 ms on 1 GPU and 1530 ms on 2 GPUs. Thus our implementation obtains a near linear speed up with increasing the number of GPUs. B COMPUTATION OF LRM-PEF FROBENIUS NORM Let us represent the PEF F ∈ Rm×m of an example as an LRM-PEF AT A, where A ∈ Rc×m. Using properties of the Frobenius norm, we see that ∥F ∥F = ∥AT A∥F = ∥AAT ∥F . (7) Since AAT only has c2 elements, its Frobenius norm can easily be evaluated. C D-NPEFF PERTURBATION METHOD We make use of a method based on the Fisher-weighted parameter averaging (FWPA) introduced by Matena & Raffel (2021) to construct a perturbation to selectively disrupt the processing represented by a D-NPEFF component. Let θ ∈ Rm denote the parameters of the original model. Let f ∈ Rm denote the diagonal of the Fisher information matrix of the original model over the entire data set. This is simply the expectation of the diagonal PEFs with respect to the data distribution. Let h ∈ Rm denote the pseudo-Fisher of the component we wish to perturb. Our FWPA-based perturbation method takes in the following hyperparameters: perturbation magnitude δ > 0, merging coefficient λ ∈ [0, 1], and sign-pattern s ∈ {−1, 1}m (discussed in the following paragraphs). The parameters φ ∈ Rm of the perturbed model are provided element-wise by φi = (1 − λ)fiθi + λhi(θi + siδ) (1 − λ)fi + λhi , (8) where we default to having φi = θi when both fi, hi are approximately zero. This can be interpreted as the Fisher-weighted merge of the original model with a corrupted version where each parameter has been shifted by a magnitude of δ. Intuitively, we expect the perturbed parameters to be closer to their original values when they are more important to the original model's behavior and farther away when more important for the given component. This has the effect of selectively altering the model's predictions for examples for which it uses the component's corresponding sub-computation. 14 Sign Pattern The need for the sign pattern hyperparameter arises from the fact that the expres- sion predicting the KL-divergence between perturbed and original predictions depends only on the element-wise square of the perturbation. Different choices of the sign pattern will result in different distributions over classes that all should have the same KL-divergence with the original predictive distribution. The invariance of the KL-divergences to the choice of sign pattern, however, can break down when we consider the finite perturbations used in practice instead of the infinitesimal pertur- bations of the theory. We use a heuristic method for choosing the sign pattern. First, we assume that we have some set of examples Dp = {x1, . . . , xl} whose predictions we wish to selectively perturb. This will typically be the top examples for a component. For each parameter, we want to move in the direction that increases the KL-divergence of the model's predictions on these examples the most. Hence, we use a sign vector given element-wise by si = sign ∂ ∂θi l (cid:88) j=1 DKL (sg [pθ(y|xj)] ∥pθ(y|xj)) , (9) where the sg is the stop-gradient operator. Other Hyperparameters Once we have chosen a sign pattern, we then find hyperparameters δ, λ such that the average KL-divergence for the chosen examples Dp fell in a predetermined range. We accomplished this via a randomized search heuristic. Recall that our goal is to find values δ > 0 and λ ∈ [0, 1] such that the average KL-divergence of the perturbed model's predictions belongs to some range [l1, l2]. Our heuristic is based on the assumption that the average KL-divergence increases with increasing δ and λ. This corresponds to the perturbed parameters becoming increasing dissimilar to the originals. We also assume that the user has specified some maximum value for hyperparameter δ, which we denote D. Hence δ ∈ (0, D]. We start by selecting initial values of δ and λ at random from their respective ranges. We evaluate the average KL-divergence for the perturbed model with these hyperparameter values. We pick one of δ or λ to change, alternating between iterations of the heuristic. If the KL-divergence is too high, we pick a value halfway between the current value of the hyperparameter and its minimum value. We evaluate using the new hyperparameters. If the KL-divergence is too low, we try again using a value a quarter of the way to the original value of the hyperparameter and its minimum value. We repeat this until we get a KL-divergence value either within the specified range or higher than the range. If it is in the range, we stop. Otherwise, we keep that value of the hyperparameter and repeat with the other hyperparameter. We perform an analogous algorithm when the KL-divergence is too high. D EXPERIMENTAL DETAILS D.1 QQP We fine-tuned the bert-base-uncased checkpoint from the Hugging Face repository (Wolf et al., 2019) on a data set derived from the train split of QQP. This data set was simply the train split with 50k examples held out. We trained the model using Adam (Kingma & Ba, 2014) with a learning rate of 1e-5 and batch size of 32 for 40k steps. The set of 50k examples held out from the train set were used to compute the LRM-PEFs used to learn the LRM-NPEFF decomposition. When creating the sparse approximations, we kept the 65,536 entries with the largest magnitudes for each LRM-PEF. We used the same sparsity when computing LRM-PEFs on the validation set. We performed LRM-NPEFF on the PEFs from the held out train set examples with 256 components. We pruned entries corresponding to parameters with fewer than 8 non-zero entries across all PEFs. After initialization, we trained only G for 100 steps before performing alternating updates between W and G. The latter stage updated each factor 1500 times. We used a learning rate of 3e-5 for the G-only stage of training and a learning rate of 3e-4 for the joint stage. 15 D.2 NLI We used the connectivity/feather berts 0 checkpoint from the Hugging Face repository as the model for our NLI experiments. This checkpoint was released as part of McCoy et al. (2019). It was fine-tuned on MNLI from the bert-base-uncased pretrained model. We used two disjoint sets of 50k examples each from the SNLI train split to compute LRM-PEFS. When creating the sparse approximations to these PEFs, we kept the 65,536 entries with the largest magnitudes for each LRM-PEF. We performed LRM-NPEFF on the PEFs from one of these sets using 512 components. We pruned entries corresponding to parameters with fewer than 14 non-zero entries across all PEFs. After initialization, we trained only G for 100 steps before performing alternating updates between W and G. The latter stage updated each factor 1500 times. We used a learning rate of 1e-4 for the G-only stage of training and a learning rate of 3e-4 for the joint stage. D.3 VISION We used a ResNet-50 (He et al., 2016) trained on the ImageNet classification task (Russakovsky et al., 2015), namely the imagenet pretrained weights of the ResNet50 class in TensorFlow (Abadi et al., 2016). We computed D-PEFs using 20k examples from the ImageNet train split and 30k examples from the ImageNet validation split. We only included terms with a probability of greater than 3e-3 when performing the expectation over classes when computing the D-PEFs. When creating the sparse approximations, we kept the 65,536 entries with the largest magnitudes for each D-PEF. We performed D-NPEFF on the PEFs from the train split using 512 components. We pruned entries corresponding to parameters with fewer than 6 non-zero entries across all PEFs. We ran NMF for 2500 steps on these D-PEFs to create the D-NPEFF decomposition. E VISION MODEL D-NPEFF PERTURBATION DETAILS We selected the top 128 examples for each component to compute the sign pattern. We selected the δ, λ hyperparameters such that their average KL-divergence of the top examples was between 0.25 and 0.35. The δ, λ selection process was repeated 6 times per component. For each run, we computed the ratio of the average KL-divergence for the top 128 examples of the component to the average KL-divergence across the entire set of 30k validation set examples for which we computed PEFs. We used the geometric mean of the KL-divergence ratios across these runs to get an average KL-divergence for each component. F COMPONENTS SET EXPANSION EXPERIMENT DETAILS Given a set of PEFs used to compute an NPEFF decomposition, we created another set of PEFs consisting of only the examples on which the model made an incorrect prediction. Expanding the set of NPEFF components on these examples is similar to computing an NPEFF decomposition, but some parameters are initialized non-randomly and some parameters are not updated during the learning process. Divide the set of components to a group consisting of the original components and another group consisting of the new components that will be learned. The pseudo-Fishers of the former group are initialized using their values from from original NPEFF decomposition and not updated during training. Their corresponding coefficients are initialized using their values from the original decom- position as well. We found that initializing these coefficients this way significantly increased the chance of the expansion learning meaningful components. The coefficients of the expanded com- ponents are initialized using the uniform distribution on [0, 1]. The rows of G corresponding to the expanded components are initialized using a normal distribution with zero mean and standard de- rm, where r is the sum of the number of original components and the number of 2/ viation of components in the expansion. √ √ 16 Computation of the expansion proceeds in two stages with an optional third stage at the end. First, all of the coefficients are frozen while the rows of G corresponding to the new components are updated. Then perform alternate updates on the columns of W corresponding to the new components and their corresponding rows of G. The optional final stage involves performing alternating updates on all of the columns of W and updating only the rows of G corresponding to the new components. For our experiment on the NLI model, we used a learning rate of 1e-3 during the first stage where we were only updating the columns of G corresponding to the new components. We performed a total of 250 updates during this state. In the other stages, we used a learning rate of 3e-3. We ran the second stage for 1000 updates of both NPEFF factors. We did not run the third stage. G QUALITY OF SPARSE APPROXIMATION When producing a sparse approximation to an LRM-PEF of the NLI model, we kept only 65,536 entries out of a total of about 330 million. Hence only around 0.02% of the sparse LRM-PEF's entries are non-zero. To determine the quality of these sparse representations, we computed the Frobenius distance between a dense PEF matrix and its sparse approximation over a set of 500 examples. These distances were then normalized by dividing them by the Frobenius norm of their corresponding dense PEF matrix. We then subtract the resultant value from 1 to get a score between 0 and 1 for each example. A score of 0 indicates that the sparse approximation captures no information about the dense PEF while a score of 1 indicates a perfect match. A histogram of these scores across examples can be found at fig. 4. When keeping 65,536 entries, there is a large peak at round 0.15 in the distribution. Higher scores become less likely with only a few greater than 0.4. Increasing the number of kept entries to 262,144 shifts the peak of the score distribution to between 0.2 and 0.25. These overall results indicate that although our sparse approximations are not particular close approximations, they capture a significant amount of information given their sparsity. Figure 4: Histogram of per-example values indicating the closeness of the sparse approximation to SNLI LRM-PEFs. A score of 0 indicates that the approximation is identically zero while a score of 1 indicates a perfect match. H SYNTHETIC TASK AND MODEL DETAILS H.1 TASK DETAILS The synthetic task can be thought of as an extremely simplified NLI task. An example looks like [BOS] Q1 S1 O1 Q2 S2 O2, which is a concatenation of a premise and hypothesis. The Q1,Q2 tokens correspond to All or Some, and a Q S O segment can be thought of as the sen- tence [All/Some] [subject] [verb] [object]. The verb is assumed fixed and shared between the premise and hypothesis, so it is not explicitly represented. Subjects and objects are chosen from the same set of options containing a hierarchical structure so that we can have a is a subtype of relation between options. Each example is given a label of entails or neutral. A couple of examples in "readable" form are: • All cows eat grass. Some bovines eat plants. =⇒ entails • Some seals eat fish. All mammals eat animals. =⇒ neutral 17 0.10.20.30.40.50.6Score0255075100CountQuality of Sparse LRM-PEF Approximations65k NNZ262k NNZ Figure 5: Average cosine similarities of component coefficients with their final values as the NPEFF decomposition progresses. The set of options for the subjects and objects was obtained from subtree of ImageNet classes rooted at the node with id n02913152. This node corresponded to the class "building, edifice". We did this purely to obtain a "natural-looking" hierarchy of items; the exact names of the items in their original context are not used by this task. Overall, this produced a set of 23 options. H.2 RASP PROGRAM RASP pseudo-code for solving the synthetic is presented in appendix H.2. The output at the last sequence position is the predicted label for the example. It solves the task with 100% accuracy. H.3 PROGRAMMATIC DETECTION OF TUNINGS Recall that each example will look like [BOS] Q1 S1 O1 Q2 S2 O2. For each example, we can create a set of boolean annotation depending on whether its tokens satisfy certain properties. These properties reflect the values of intermediate variables in the RASP program appendix H.2 that is implemented by the model. We then say a component is tuned to a particular property if its top 128 examples all possess that property. A breakdown of the number of components in each decomposition tuned for various properties can be found in table 1. I TCAV TCAV provides a means to test whether a model possesses conceptual sensitivity to a concept rep- resented by a group of examples (Kim et al., 2018). Given activations corresponding the conceptual group and activations correspondingly to examples not from the group, TCAV learns a binary linear classifier to distinguish between the two groups. This classifier can be expressed as a vector with the same dimension as the activations that is the normal vector of the oriented hyperplane forming the decision boundary of the classifier. This is called the group's concept activation vector (CAV). Then derivative of the log probability2 for each class with respect to the activations in the direction of the CAV is computed over a set of examples. The fraction of examples with a positive directional derivative is recorded for each class to create a score. This process can be repeated multiple times using a different set of random examples to represent the examples not containing the concept. A two sided t-test can then be performed for these scores to compute a p-value for the null hypothesis of a TCAV score of 0.5. For the TCAV experiments in this paper, we used the top 32 component/cluster examples to represent the conceptual groups. We used a random set of 128 examples to form the baseline group. We computed the TCAV for each run using a set of 5k examples. We performed 500 runs for each component/cluster. 2Note that Kim et al. (2018) uses logits while we use log probabilities. 18 0200400600800100012001400Step0.50.60.70.80.91.0Avg Cos Similarity 3 4 5 6 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 1 def is_subtype_of(sop_a, sop_b): 2 token_equals_b = {t: t == sop_b for t in all_token_ids} return sop_a == sop_b | reduce_or( t == sop_a & reduce_or(t == token_equals_b[s] for s in supertypes (t)) ) for t in item_tokens 7 8 def label_example(tokens): 9 # Align the hypothesis and premise. hypo_aligned = tokens prem_aligned = shift_by(SENTENCE_LEN, tokens) is_prem_subtype_of_hypo = is_subtype_of(prem_aligned, hypo_aligned) is_hypo_subtype_of_prem = is_subtype_of(hypo_aligned, prem_aligned) # Use the last sequence position for a computation space. is_s1_subtype_of_s2 = shift_by(1, is_prem_subtype_of_hypo) is_s2_subtype_of_s1 = shift_by(1, is_hypo_subtype_of_prem) is_o1_subtype_of_o2 = is_prem_subtype_of_hypo is_all = tokens == ALL_TOKEN_ID is_some = tokens == SOME_TOKEN_ID is_all_q1 = shift_by(2 * SENTENCE_LEN - Q_PREM_INDEX - 1, is_all) is_some_q1 = shift_by(2 * SENTENCE_LEN - Q_PREM_INDEX - 1, is_some) is_all_q2 = shift_by(2 * SENTENCE_LEN - Q_HYPO_INDEX - 1, is_all) is_some_q2 = shift_by(2 * SENTENCE_LEN - Q_HYPO_INDEX - 1, is_some) # The output at the last sequence position will be the label for the example. label = reduce_or( ((is_all_q1 & is_all_q2) & (is_s2_subset_of_s1 & is_o1_subset_of_o2)), ((is_some_q1 & is_some_q2) & (is_s1_subset_of_s2 & is_o1_subset_of_o2)), ((is_all_q1 & is_some_q2) & (is_s2_subset_of_s1 & is_o1_subset_of_o2)), ) return label Figure 6: RASP pseudo-code solving the synthetic NLI-like task. 19 Table 1: Number of components tuned to a particular concept from the TRACR model NPEFF runs. The concepts ending with item mean that the top 128 examples for that component satisfy the corresponding relation for some fixed item. The specific item can differ from component to com- ponent. Note that many components were tuned to combinations of the more elementary concepts that we searched for. Property 32 Comps Run 128 Comps Run o1 equals item o1 equals o2 o1 strict subtype of o2 o1 subtype of item o1 subtype of o2 o1 supertype of item o2 equals item o2 subtype of item o2 supertype of item q1 is all q1 is all and q2 is all q1 is all and q2 is some q1 is some q1 is some and q2 is all q1 is some and q2 is some q2 is all q2 is some s1 equals s2 20 0 0 2 1 0 5 0 0 0 1 1 0 1 1 0 0 0 30 8 4 1 0 1 34 2 2 7 3 8 9 2 2 8 1 1 For the LRM-PEF components and k-means clusters of the NLI model, every component had a p- value of less than 1e-23 for at least one class. Even with a Bonferroni correction of 1500, which is the number of runs times the number of classes, every component had a statistically significant TCAV scores using any reasonable threshold. J ADDITIONAL COMPONENT TUNINGS J.1 NLI Each of the sub-sections here corresponds to a single component. The top 6 examples per component are listed in descending order of component coefficient. J.1.1 COMPONENT 0 [LABEL] entailment [P] a brown dog is running though a river. [H] an animal running [PRED] entailment [COEFF] 36.0252 [LABEL] entailment [P] the brown dog is laying down on a blue sheet. [H] an animal is laying down. [PRED] entailment [COEFF] 33.5824 [LABEL] entailment [P] a small brown and black dog playing with a toy [H] an animal is playing. [PRED] entailment [COEFF] 33.4161 [LABEL] entailment [P] two dogs appear to be kissing with one another on flat ground. [H] animals are close together. [PRED] entailment [COEFF] 32.9659 20 [LABEL] entailment [P] a little brown dog is running in the snow. [H] an animal in snow. [PRED] entailment [COEFF] 29.5676 [LABEL] entailment [P] a brown dog is standing in the water. [H] an animal in the water [PRED] entailment [COEFF] 28.6355 J.1.2 COMPONENT 3 [LABEL] neutral [P] a woman is taking a picture with her camera. [H] a woman is taking a picture of a house. [PRED] neutral [COEFF] 21.7448 [LABEL] neutral [P] a woman is pushing a red stroller down a sidewalk. [H] a lady is pushing a stroller with three babies. [PRED] neutral [COEFF] 21.3761 [LABEL] neutral [P] 2 women wearing brightly colored clothes are sitting next to a dirt road on a rock having a conversation while they're watching the field. [H] 2 women sitting next to a dirt road, having a conversation about lunch last week. [COEFF] 20.1738 [PRED] neutral [LABEL] neutral [P] a man with a large camera is taking photographs. [H] man taking photographs of his family. [PRED] neutral [COEFF] 19.6292 [LABEL] neutral [P] a black dog runs on the beach. [H] a dog runs after a ball on the beach. [PRED] neutral [COEFF] 19.3897 [LABEL] neutral [P] a man is rock climbing under a large cliff. [H] a man is rock climbing to reach a rare plant. [PRED] neutral [COEFF] 19.1972 J.1.3 COMPONENT 8 [LABEL] contradiction [PRED] contradiction [COEFF] 24.7734 [P] two climbers attempting to climb a steep, snow - covered peak, nearing the top, where two other climbers await them. [H] the women are in the club singing [LABEL] contradiction [PRED] contradiction [COEFF] 21.3290 [P] man lays prostrate on the ground on his back possibly in exhaustion. [H] three men are playing basketball. [LABEL] contradiction [PRED] contradiction [COEFF] 20.5294 [P] three women are standing in a field with two men in wheelchairs and hats. [H] a group of men and women are in the office. [LABEL] contradiction [PRED] contradiction [COEFF] 19.4801 [P] man riding a mountain bike doing a jump in the air. [H] three women ride scooters in town. 21 [LABEL] contradiction [PRED] contradiction [COEFF] 17.6381 [P] group of kids wearing a blue and gray school uniform while playing. [H] the men are racing cars. [LABEL] contradiction [PRED] contradiction [COEFF] 16.9087 [P] a middle - eastern street vendor sells drinks to some young boys. [H] young boys are playing soccer. J.1.4 COMPONENT 17 [LABEL] entailment [P] gross couple kissing outdoors. [H] a couple is kissing. [PRED] entailment [COEFF] 7.6072 [LABEL] entailment [P] two people sitting beside a few small boats. [H] a couple is sitting. [PRED] entailment [COEFF] 7.3462 [LABEL] entailment [PRED] entailment [P] a bricklayer smoothing out concrete. [H] someone is smoothing concrete. [COEFF] 7.1038 [LABEL] entailment [P] laborers baling hay in a field. [H] people are working with hay. [PRED] entailment [COEFF] 6.6635 [LABEL] entailment [P] man in white facing body of water. [H] a man is near water [PRED] entailment [COEFF] 6.1639 [LABEL] entailment [P] a red cone on the side of a street. [H] an object is near an edge. [PRED] entailment [COEFF] 5.9790 J.2 VISION Each of the sub-sections here corresponds to a single component. The top 32 examples per compo- nent are listed with component coefficient decreasing in a row-major manner from left-to-right and top-to-bottom. 22 J.2.1 COMPONENT 29 J.2.2 COMPONENT 35 J.2.3 COMPONENT 171 23 J.2.4 COMPONENT 276 K INCONSISTENTLY LABELED QQP COMPONENTS K.0.1 COMPONENT 21 [LABEL] not duplicate [PRED] duplicate how do i become a travel writer? how do you become a travel writer? [COEFF] 82.3713 [LABEL] not duplicate [PRED] duplicate how do i become successful in my life? how can you be successful in your life? [COEFF] 70.3491 [LABEL] not duplicate [PRED] duplicate how do i make new friends in a new city? how do you make friends in a new city? [COEFF] 69.6145 [LABEL] not duplicate [PRED] duplicate how do i make my website for free? how do you make your own website for free? [COEFF] 61.7586 [LABEL] duplicate how can i write a blog post on quora? how do you write a blog on quora? [PRED] duplicate [COEFF] 56.2426 [LABEL] duplicate how do i raise my iq? how can you increase your iq? [PRED] duplicate [COEFF] 54.0405 [LABEL] not duplicate [PRED] duplicate what should i do to manage my time? how do you manage your time? [COEFF] 48.8949 [LABEL] duplicate how do i get rid of nightmares? how can you get rid of nightmares? [PRED] duplicate [COEFF] 46.0987 [LABEL] not duplicate [PRED] duplicate how can i get a simple mobile account number? how do you get a simple mobile account number? [COEFF] 45.2508 24 [LABEL] duplicate where can i find gold? where do you find gold? [PRED] not duplicate [COEFF] 43.9563 K.0.2 COMPONENT 31 [LABEL] not duplicate [PRED] duplicate what is your review of hindus? what is your review of hinduism? [COEFF] 43.9832 [LABEL] not duplicate [PRED] duplicate how do i convince my parents? how can i convince my parents? [COEFF] 39.8860 [LABEL] not duplicate [PRED] duplicate how do i get job in gulf countries? how do i get a job in gulf country? [COEFF] 32.3885 [LABEL] not duplicate [PRED] duplicate how is friction useful? how is friction helpful? [COEFF] 31.6596 [LABEL] duplicate how do i get into iit bombay? how to get into iit bombay? [PRED] duplicate [COEFF] 29.7447 [LABEL] not duplicate [PRED] duplicate what's the best way to read a technical book? what is the best way to read technical books? [COEFF] 28.4342 [LABEL] not duplicate [PRED] duplicate how do i record whatsapp call? how do i record a whatsapp video call? [COEFF] 27.7442 [LABEL] duplicate how can i found local business directories in australia? how can i find the local business directories in australia? [PRED] duplicate [COEFF] 24.3656 [LABEL] not duplicate [PRED] duplicate how do i get redeem code in google play? how do i get a redeem code for google play? [COEFF] 24.0160 [LABEL] not duplicate [PRED] duplicate s. what is the process to get a u. what is the process of getting a u. passport? s. passport? [COEFF] 23.8029 K.0.3 COMPONENT 36 [LABEL] not duplicate [PRED] duplicate how should i propose to my girlfriend? what is the best way to propose to your girlfriend? [COEFF] 178.0185 [LABEL] not duplicate [PRED] duplicate how do i switch my it job? what is the best way of switching my it job? [COEFF] 121.0942 25 [LABEL] not duplicate [PRED] duplicate how do i record my keyboard? what is the best way to record a keyboard? [COEFF] 109.5911 [LABEL] not duplicate [PRED] duplicate how should i kill myself? what is the easiest way to kill myself? [COEFF] 100.9345 [LABEL] not duplicate [PRED] duplicate how do you sell a car? what is the easiest way to sell a car? [COEFF] 98.8751 [LABEL] not duplicate [PRED] duplicate how do i kill spiders? what is the most effective way to kill a spider? [COEFF] 81.3841 [LABEL] duplicate how can i kill myself? what is the easiest way to kill myself? [PRED] duplicate [COEFF] 75.6287 [LABEL] not duplicate [PRED] duplicate how do you make money? what is the easiest way to make money? [COEFF] 69.2537 [LABEL] not duplicate [PRED] duplicate can i build a website on my own? what is the best way to build your own website? [COEFF] 67.5730 [LABEL] duplicate how do i build muscle? what is the best way to build muscle? [PRED] duplicate [COEFF] 63.1871 L NLI COMPONENTS WITH FAULTY HEURISTICS L.0.1 COMPONENT 18 [LABEL] neutral [P] a young child wearing a yellow striped t - shirt and blue shorts is playing along side the lake and rocks. [H] a young child is wearing a light yellow striped t - shirt. [PRED] entailment [COEFF] 16.0689 [LABEL] neutral [P] young white male child with blond - hair in a red shirt coloring with crayons outside with an adult. [H] a young white male child with blond - hair has a light red shirt. [PRED] entailment [COEFF] 15.6616 [LABEL] neutral [P] a young woman with blond - hair, wearing a short - sleeve gray shirt and blue jean shorts, prepares food for a barbecue. [H] a young woman has light blond - hair. [PRED] entailment [COEFF] 15.4342 [LABEL] neutral [P] a crowd of children in green t - shirts and people holding signs and purple balloons gathers next to a building. [H] a crowd of children has light green t - shirts. [PRED] entailment [COEFF] 14.5433 26 [LABEL] neutral [P] a female baseball player wearing a blue shirt slides into base, while another player in a white shirt wearing a catcher's mitt jumps. [H] a female baseball player is wearing a light blue shirt. [PRED] entailment [COEFF] 12.1538 [PRED] entailment [LABEL] neutral [P] in an outdoor location with spectators in the background, a young man in a karate uniform with a blue belt has his arm around the neck of a young woman in a karate uniform with a brown belt while she grips his arm with both hands. [H] a young man has a karate uniform with a light blue belt. [COEFF] 11.7806 [LABEL] neutral [P] an older man in a red sweatshirt stands in front of a group of children sitting on benches in front of him. [H] an older man in a light red sweatshirt stands. [PRED] entailment [COEFF] 8.8071 [LABEL] neutral [P] man in yellow behind the wheel of a tractor, hooked to a trailer and under an open sided roof, while others climb on the back. [H] a man in light yellow is behind the wheel of a tractor. [PRED] entailment [COEFF] 6.1237 L.0.2 COMPONENT 34 [LABEL] neutral [P] a man eating something with a spoon. [H] a man is eating ice cream. [PRED] contradiction [COEFF] 5.5193 [LABEL] neutral [P] a man selling many wicker chairs is pulling a cart of them through the street. [H] a man is selling blue chairs. [PRED] contradiction [COEFF] 3.9719 [LABEL] neutral [P] a man with a green shirt is holding a plant. [H] a man is delivering flowers. [PRED] contradiction [COEFF] 3.6611 [LABEL] neutral [P] a man eating a pink candy bunny. [H] he eats a gertrude hawk easter bunny. [PRED] contradiction [COEFF] 3.6228 [LABEL] neutral [P] two ladies selling their wares in an open market. [H] two ladies sell their bakes goods at a farmer's market. [PRED] contradiction [COEFF] 3.5730 [LABEL] neutral [P] an older gentleman dressed completely in white is eating from a white bowl while sitting in a large overstuffed chair. [H] an older gentleman is eating cereal. [PRED] contradiction [COEFF] 3.5390 [LABEL] neutral [P] a man wearing a red costume stands near others. [H] the man is wearing a dog costume. [PRED] contradiction [COEFF] 3.5027 [LABEL] contradiction [PRED] contradiction [COEFF] 3.4998 [P] a donkey carting greens and two people on a street. [H] a donkey is carting fruits. 27 L.0.3 COMPONENT 62 [LABEL] neutral [P] a person on a blue bench under a blue blanket. [H] a person is resting. [PRED] entailment [COEFF] 2.9606 [LABEL] neutral [P] a boy wearing khaki pants and a sports team jersey is jumping down the stairs outside. [H] a boy is excited. [PRED] entailment [COEFF] 2.8245 [PRED] entailment [LABEL] neutral [P] an athletic man waterskis on a lake. [H] a fit man is having fun. [COEFF] 2.8070 [LABEL] entailment [P] 2 girls in metal chairs are laughing together. [H] two girls are having fun. [PRED] entailment [COEFF] 2.7448 [LABEL] entailment [P] man in white shirt and shorts browses an item stand. [H] a man is browsing for goods. [PRED] entailment [COEFF] 2.3667 [LABEL] neutral [P] a gymnast in a competition is looking on with a questioning look on her face. [H] a gymnast is confused about something. [PRED] entailment [COEFF] 2.2851 [LABEL] entailment [P] a little girl with ponytails laughs near a plastic castle play set. [H] a girl enjoys herself. [PRED] entailment [COEFF] 2.2077 [LABEL] neutral [P] a woman standing in a red bikini on a outdoor sand volleyball court. [PRED] entailment [COEFF] 2.1743 [H] a woman is playing sports. M K-MEANS CLUSTERS TOP EXAMPLES M.1 NLI M.1.1 COMPONENT 1 [LABEL] entailment [P] Two chinese men looking at papers on a table. [H] Some people are looking at papers. [PRED] entailment [COEFF] -0.0486 [LABEL] entailment [P] Many people riding bikes on a path while another person is walking toward them. [H] Some people are riding bikes. [PRED] entailment [COEFF] -0.0575 [LABEL] entailment [P] A group of young people are in a garage [H] Some people are in a garage. [PRED] entailment [COEFF] -0.0581 28 [LABEL] entailment [P] A girl in a green shirt and a girl in a yellow shirt standing by water. [H] Some girls are standing by water. [PRED] entailment [COEFF] -0.0591 [LABEL] entailment [P] Three young people planting flowers and covering the area with a tarp. [H] Some people are planting flowers. [PRED] entailment [COEFF] -0.0614 [LABEL] entailment [PRED] entailment [P] A girl in a blue blouse and a girl in a green shirt sewing. [H] Some people are sewing. [COEFF] -0.0628 M.1.2 COMPONENT 4 [LABEL] neutral [P] A person is riding a bike in front of brick buildings. [H] A person is riding a red bike [PRED] neutral [COEFF] -0.0800 [LABEL] neutral [P] A firefighter dressed in gear looking puzzled. [H] A firefighter dressed in red gear looking puzzled. [PRED] neutral [COEFF] -0.0806 [LABEL] neutral [P] A truck - driver is working on his truck. [H] A truck driver works on his red truck. [PRED] neutral [COEFF] -0.0824 [LABEL] neutral [P] A young boy is sitting on a beach filling a water bottle with sand. [H] A young boy is filling a red water bottle with sand. [COEFF] -0.0854 [PRED] neutral [LABEL] neutral [P] Two girls sitting on a chair being sketched. [H] Two girls sitting on a green chair are being sketched. [PRED] neutral [COEFF] -0.0882 [LABEL] neutral [P] Three female dancers are doing dance moves on stage of an auditorium. [COEFF] -0.0892 [PRED] neutral [H] Three female dancers, all dressed in blue, are doing dance moves in an auditorium. M.1.3 COMPONENT 28 [LABEL] contradiction [PRED] contradiction [COEFF] -0.0535 [P] Two water polo players wrestle for the ball while a goal keeper watches in front of a goal with an angry birds advertisement on the back of the net. [H] There is no goalkeeper in the waterpolo match. [LABEL] contradiction [PRED] contradiction [COEFF] -0.0623 [P] Two people one person dressed in yellow and green with black boots and the other person have on white jacket and brown pants standing on the lake side with birds approaching them [H] There are no birds at the lake. 29 [LABEL] contradiction [PRED] contradiction [COEFF] -0.0668 [P] People wearing glasses and shades are walking, while a man in a black shirt with the word " qualified " on it is facing them. [H] There are no glasses [LABEL] contradiction [PRED] contradiction [COEFF] -0.0671 [P] A family posing with a bride in a white dress at a wedding. [H] The bride does not have a family. [LABEL] contradiction [PRED] contradiction [COEFF] -0.0693 [P] A man plays guitar in the kitchen while a woman adjusts the dials on a dishwasher. [H] Nobody is using the dishwasher. [LABEL] contradiction [PRED] contradiction [COEFF] -0.0700 [P] At a party, an entertainer provides amusement to children in the form of balloon animals. [H] There are no children at this party. M.2 VISION Each of the sub-sections here corresponds to a single cluster. The top 32 examples per cluster are listed with distance to cluster centroid increasing in a row-major manner from left-to-right and top- to-bottom. M.2.1 COMPONENT 6 M.2.2 COMPONENT 19 30 M.2.3 COMPONENT 20 31
http://arxiv.org/abs/2310.04632v2
"2023-10-31T22:53:02"
"2023-10-07T00:56:49"
Automatic Anonymization of Swiss Federal Supreme Court Rulings
Releasing court decisions to the public relies on proper anonymization to protect all involved parties, where necessary. The Swiss Federal Supreme Court relies on an existing system that combines different traditional computational methods with human experts. In this work, we enhance the existing anonymization software using a large dataset annotated with entities to be anonymized. We compared BERT-based models with models pre-trained on in-domain data. Our results show that using in-domain data to pre-train the models further improves the F1-score by more than 5\% compared to existing models. Our work demonstrates that combining existing anonymization methods, such as regular expressions, with machine learning can further reduce manual labor and enhance automatic suggestions.
[ "Joel Niklaus", "Robin Mamié", "Matthias Stürmer", "Daniel Brunner", "Marcel Gygli" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04632v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04632v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CL", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CL", "cs.AI", "cs.LG", "68T50", "I.2" ]
Automatic Anonymization of Swiss Federal Supreme Court Rulings Joel Niklaus1,2,3 ∗ Robin Mamié4 ∗ Matthias Stürmer1,2 Daniel Brunner4 Marcel Gygli2 1University of Bern 2Bern University of Applied Sciences 3Stanford University 4Swiss Federal Supreme Court Abstract Releasing court decisions to the public relies on proper anonymization to protect all involved parties, where necessary. The Swiss Federal Supreme Court relies on an existing system that combines different traditional computational methods with human experts. In this work, we enhance the existing anonymization soft- ware using a large dataset annotated with en- tities to be anonymized. We compared BERT- based models with models pre-trained on in- domain data. Our results show that using in- domain data to pre-train the models further im- proves the F1-score by more than 5% compared to existing models. Our work demonstrates that combining existing anonymization meth- ods, such as regular expressions, with machine learning can further reduce manual labor and enhance automatic suggestions. 1 Introduction The Swiss Federal Supreme Court (SFSC) is the highest judicial authority in Switzerland. It is the fi- nal arbiter in legal disputes and ensures the uniform application of federal law throughout the country. It consists of several divisions specialized in differ- ent areas of law, including civil, criminal, admin- istrative, and social security matters (Glaser et al., 2021). In a year, the SFSC roughly handles 7K cases and publishes its rulings. In this process, per- sonal information must be anonymized from the rulings in order to protect involved parties. In the traditional setting, court rulings are anonymized by skilled experts. This task is highly complex, as the removal/anonymization of a word is dependent on the context it is written in. For example, Zuerich needs to be removed if it is part of the name of the legal entity "Zurich Insurance Group", but not if it is a reference to the city. At the SFSC, experts are ∗ Equal contribution. already supported in their work through an applica- tion called Anom2 (see Figure 1). Anom2 provides access to various methods and algorithms for find- ing and replacing text entities (e.g., with regular expressions). The aim of this work is to enhance the capabilities of Anom2 with Machine Learning capabilities that provide the user with more sug- gestions that need to be anonymized. Our results show that this approach allows users to find more elements that require anonymization. 2 Related Work identifying elements that might For require anonymization, a process called Named Entity Recognition (NER) is employed. Traditionally, NER recognizes and categorizes text parts ac- cording to a set of semantic categories like Lo- cation (LOC), Organization (ORG), or Person (PER) (Benikova et al., 2014). As these classes are not enough for the anonymization of court cases (Leitner et al., 2020) suggested expanding this list to seven coarse and 19 fine-grained classes, including entities such as Judge (RR), or Lawyer (AN). Using this dataset, Darji et al. (2023) fine- tuned GermanBERT (Chan et al., 2020), clearly outperforming a BiLSTM-CRF+ model. Similar approaches have been applied and tested in other languages, such as Romanian (Pais et al., 2021), Greek (Angelidis et al., 2018), Portuguese (Luz de Araujo et al., 2018), and multilingually (de Gibert et al., 2022; Niklaus et al., 2023a). Domain-specific pretraining has flourished in the legal domain recently. Chalkidis et al. (2020) pretrained LegalBERT on EU and UK legislation, ECHR and US cases, and US contracts. Zheng et al. (2021) pretrained CaseHoldBERT on US case law, while Henderson et al. (2022) trained PoL-BERT on the 256 GB Pile of Law corpus. Niklaus and Giofré (2022) pretrained Longformer (Beltagy et al., 2020) models using the Replaced 3 2 0 2 t c O 1 3 ] L C . s c [ 2 v 2 3 6 4 0 . 0 1 3 2 : v i X r a Figure 1: Main window of Anom2. Anonymizations are configured on the left, and the anonymized court ruling appears on the right. The system highlights completed anonymizations in gold and the current setting in yellow. Token Detection (RTD) task on the Pile of Law. Hua et al. (2022) used RTD to pretrain Reformer (Kitaev et al., 2020) models on 6 GB of US case law. Finally, Niklaus et al. (2023b) released a large multilingual legal corpus and trained various le- gal models. We continue pretraining the German, French, and Italian models for 800K and 300K steps more for base and large models, respectively. Rasiah et al. (2023) pretrain models on Swiss legal data, termed Legal-Swiss-RoBERTa. Document anonymization has a long tradition in the medical domain, where personal data need to be removed from documents. Initially, this task was handled using methods such as semantic lex- icons (Ruch et al., 2000) or regular expressions to replace text occurrences. Recently, this has been expanded to include BERT-style models as well (Mao and Liu, 2019). In the legal domain, Glaser et al. (2021) worked on 1400 anonymized German rulings. Using already anonymized rul- ings, they trained different Recurrent Neural Net- works (RNN) using BERT embeddings. Using this approach, they achieved a maximum of 68.9% pre- cision and 79.1% recall rates. Garat and Wonsever (2022) performed similar work on 80K documents from Uruguayan courts. Our work specifically tackles court decisions by the SFSC. We compare the generic cased mBERT model (Devlin et al., 2019) with models pre-trained on in-domain data (such as Legal-Swiss-RoBERTa-base (Rasiah et al., 2023)). We also investigate monolingual model performance in the three languages of the SFSC rulings: German, French, and Italian. Much prior work used SFSC cases as data for their research because of wide availability in three languages, giving good coverage of the most impor- tant Swiss case law. Niklaus et al. (2021, 2022) in- troduced and studied judgment prediction on SFSC rulings. Brugger et al. (2023) investigated and im- proved multilingual sentence boundary detection in the legal domain using SFSC decisions. Chris- ten et al. (2023) studied negation scope resolution and Nyffenegger et al. (2023) investigated how easily LLMs can re-identify persons occurring in anonymized SFSC decisions. Rasiah et al. (2023) created a large benchmark of ten text classification tasks, two text generation tasks, an information retrieval, and a citation extraction task. 3 Dataset We used 119156 rulings (77262 German, 40099 French, 6795 Italian) Supreme court decisions and split them into sentences using Spacy (Honnibal et al., 2020). We prepared the decisions for NER based on the manual labels from the paralegals who performed manual anonymizations. The his- tograms in Figure 2 illustrate the distribution of four key measures, namely, Number of Tokens, Anonymized Tokens, Entities, and Anonymized Entities, in three languages: German (de), French (fr), and Italian (it). Different color schemes for each language enhance the visual interpretability of the plots. Measures concerning tokens and en- tities exhibit a long-tailed distribution, signifying a concentration of instances at the lower end of the value spectrum. Specifically, the distribution of Number of Tokens and Number of Entities is exam- ined within a 10 to 100,000 range, capturing their broad spread. In contrast, anonymized tokens and entities are evaluated within a 1 to 10,000 range, reflecting their constrained distribution. (a) Token Distribution (b) Anonymized Token Distribution (c) Entity Distribution (d) Anonymized Entity Distribution Figure 2: Histograms illustrating the distribution of (anonymized) tokens and entities across the three languages. 4 Legal Pretraining To improve the SFSC anonymization system, we pretrained legal-specific models on diverse legal text in German, French, and Italian. (a) We warm-start (initialize) our models from the original XLM-R checkpoints (base or large) of Conneau and Lample (2019). Model recycling is a standard process followed by many (Wei et al., 2021; Ouyang et al., 2022) to benefit from starting from an available "well-trained" PLM, rather from scratch (random). XLM-R was trained on 2.5 TB of cleaned CommonCrawl data in 100 languages. (b) We train a new tokenizer of 32K BPEs on the training subsets to better cover legal language. However, we reuse the original XLM-R embed- dings for all lexically overlapping tokens (Pfeiffer et al., 2021), i.e., we warm-start word embeddings for tokens that already exist in the original XLM-R vocabulary, and use random ones for the rest. (c) We continue pretraining our monolingual mod- els on our pretraining corpus with batches of 512 samples for an additional 1M/500K steps for the base/large model. We do initial warm-up steps for the first 5% of the total training steps with a lin- early increasing learning rate up to 1e−4, and then follow a cosine decay scheduling, following recent trends. For half of the warm-up phase (2.5%), the Transformer encoder is frozen, and only the embed- dings, shared between input and output (MLM), are updated. We also use an increased 20/30% mask- ing rate for base/large models respectively, where also 100% of the predictions are based on masked tokens, compared to Devlin et al. (2019)1, based on the findings of Wettig et al. (2023). (d) We consider mixed cased models, i.e., both upper- and lowercase letters covered, similar to recently developed large PLMs (Conneau and Lam- ple, 2019; Raffel et al., 2020; Brown et al., 2020). (e) This leaves us with two models for each lan- guage (base and large). Additionally, we consider the multilingual legal models pretrained by Niklaus et al. (2023b) and the Swiss legal models pretrained by Rasiah et al. (2023). 5 Anonymization System The SFSC employs an anonymization system, Anom2, to assist paralegals in anonymizing rul- 1Devlin et al. (2019) – and much follow-up work – used a 15% masking ratio, and a recipe of 80/10/10% of predictions made across masked/randomly-replaced/original tokens. Table 1: Evaluation Results. Best results per setup are in bold. Model Multilingual Models bert-base-multilingual-cased Legal-XLM-RoBERTa-base Legal-Swiss-RoBERTa-base Monolingual Models bert-base-german-cased Legal-German-RoBERTa-base dbmdz/bert-base-french-europeana-cased Legal-French-RoBERTa-base dbmdz/bert-base-italian-cased Legal-Italian-RoBERTa-base Normal Uniformizing Precision Recall F1-Score Precision Recall F1-Score 90.72 94.84 92.26 95.14 95.40 95.86 95.45 93.49 94.16 83.76 81.98 92.57 80.00 80.09 81.84 83.48 80.21 80.59 87.10 87.94 92.42 86.92 87.07 88.30 89.06 86.35 86.85 85.85 89.93 83.13 91.49 89.20 88.92 88.77 76.71 84.03 94.95 86.85 94.85 85.86 84.97 89.14 89.17 83.85 84.06 90.17 88.36 88.60 88.58 87.03 89.03 88.97 80.12 84.05 ings for public access. The main UI is shown in Figure 1. Upon loading a ruling, the application auto-identifies terms requiring anonymization and lists them on the left, along with replacement text. The search function allows direct term marking for anonymization. Anom2 uses different algorithms for the search for text that needs to be anonymized: Conventional is based on a statistical analysis of the loaded ruling. Using polyglot2 an initial set of named entities is detected. Using the specific knowledge of the format, the rubrum is dynami- cally detected, allowing for the labelling of impor- tant names and addresses. BERT performs the recognition of entities to be anonymized using a BERT (Devlin et al., 2019) model fine-tuned for NER. Entity recognition is performed on the sentence level, as the rulings are often too long for the model. This approach could lead to inconsistencies in recognition, as a term identified in one sentence might not be identified in another. This is solved in post-processing, where any identified term is automatically anonymized in the whole document. Legal-Swiss-RoBERTa-base works analogously to the BERT method, but uses a fine-tuned Legal- Swiss-RoBERTa-base (Rasiah et al., 2023) model. 6 Experimental Setup We used the following hyperparameters for all eval- uated models: batch size of 64, learning rate of 5e-5, and weight decay of 0.01. We employed the seqeval metric for evaluation. We set the maximum sequence length to 192 tokens, which we deter- 2See: https://polyglot.readthedocs.io mined to be the optimal trade-off between average sentence size and training time for computational efficiency. We used early stopping based on the F1-score of the validation set, which constitutes 10% of the entire dataset, following an 80-10-10 split for the training, validation, and test sets, re- spectively. Training ceases once the F1-score on the validation set starts to decline. Due to resource constraints (we only had two Tesla T4 GPUs) we could only run one random seed per model. We define and configure two special parameters: 1) TruncationStrideRatio: We set this parameter to 0.5. When a sentence exceeds 192 tokens, we truncate it using a specific overlap strategy. The overlap consists of half of the previous snippet and half of the next snippet. 2) NonAnonymizedSentencesRatioToAnonymized- Sentences: We set the ratio at 1.5, including only 150% of sentences without anonymization exam- ples compared to those with examples. This mini- mizes data redundancy and maximizes utility. 7 Results Table 1 presents a comprehensive evaluation of various BERT and RoBERTa-based models on two different conditions: Normal and Uniformiz- ing. For the Normal condition, in the multilingual setting, Legal-XLM-RoBERTa-base exhibits the highest Precision at 94.84%, while Legal-Swiss- RoBERTa-base demonstrates superior Recall and F1-Score values, achieving 92.57% and 92.42% respectively. With Uniformizing, we describe the process of forcing the model to replace all occur- rences of a detected term across the whole docu- ment. This approach leads to better Recall, but reduces Precision. In the Uniformized case, again Legal-XLM-RoBERTa-base shows highest Preci- sion, while mBERT achieves highest Recall and F1-Score. The improved Recall and F1-Score in the Normal condition show that pre-training on legal data can improve the performance of models. We observe similar behavior for the monolingual mod- els. All models pre-trained on legal data achieve a higher F1-Score than generic monolingual models. 8 Discussion We pretrained models on Swiss legal data and per- formed a detailed comparison of legal and generic models, both multilingually and monolingually in the ruling anonymization task. Our experiments indicate that pretraining on legal data improves the performance of models significantly compared to generic multi- or monolingual models. To reduce errors in sentence splitting, we sug- gest future work to use legal specific sentence split- ters (Brugger et al., 2023). Due to computational constraints we only experimented with base size encoder models. Future work may expand this by also testing larger models. Acknowledgements We greatly appreciate Google's generous support of TPUs v3-8 machines for pretraining the mod- els. This work has been partially supported by the Swiss National Research Programme "Digital Transformation" (NRP-77) grant number 187477. References I. Angelidis, Ilias Chalkidis, and M. Koubarakis. 2018. Named Entity Recognition, Linking and Generation for Greek Legislation. In JURIX. Iz Beltagy, Matthew E Peters, and Arman Cohan. 2020. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150. Darina Benikova, Chris Biemann, and Marc Reznicek. 2014. NoSta-D Named Entity Annotation for Ger- In Proceedings of man: Guidelines and Dataset. the Ninth International Conference on Language Resources and Evaluation (LREC'14), pages 2524– 2531, Reykjavik, Iceland. European Language Re- sources Association (ELRA). Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Ma- teusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. In Ad- Language models are few-shot learners. vances in Neural Information Processing Systems, volume 33, pages 1877–1901. Curran Associates, Inc. Tobias Brugger, Matthias Stürmer, and Joel Niklaus. MultiLegalSBD: A Multilingual Le- Sentence Boundary Detection Dataset. 2023. gal ArXiv:2305.01211 [cs]. Ilias Chalkidis, Manos Fergadiotis, Prodromos Malaka- siotis, Nikolaos Aletras, and Ion Androutsopoulos. 2020. LEGAL-BERT: The Muppets straight out of Law School. In Findings of the Association for Com- putational Linguistics: EMNLP 2020, pages 2898– 2904. Branden Chan, Stefan Schweter, and Timo Möller. 2020. German's Next Language Model. arXiv:2010.10906 [cs]. ArXiv: 2010.10906. Ramona Christen, Anastassia Shaitarova, Matthias Stürmer, and Joel Niklaus. 2023. Resolving Legalese: A Multilingual Exploration of Negation Scope Reso- lution in Legal Documents. Alexis Conneau and Guillaume Lample. 2019. Cross- lingual Language Model Pretraining. In Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc. Harshil Darji, Jelena Mitrovi ́c, and Michael Gran- itzer. 2023. German BERT Model for Legal Named Entity Recognition:. In Proceedings of the 15th International Conference on Agents and Artifi- cial Intelligence, pages 723–728, Lisbon, Portugal. SCITEPRESS - Science and Technology Publica- tions. Ona de Gibert, A García-Pablos, Montse Cuadros, Spanish datasets for and Maite Melero. 2022. sensitive entity detection in the legal domain. In Proceedings of the Thirteenth International Con- ference on Language Resources and Evaluation (LREC'22), Marseille, France, june. European Lan- guage Resource Association (ELRA). Dataset URL: https://tinyurl.com/mv65cp66. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language under- standing. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Tech- nologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota. Association for Computational Linguistics. Diego Garat and Dina Wonsever. 2022. Automatic Cu- ration of Court Documents: Anonymizing Personal Data. Information, 13(1):27. Ingo Glaser, Tom Schamberger, and Florian Matthes. 2021. Anonymization of german legal court rulings. In Proceedings of the Eighteenth International Con- ference on Artificial Intelligence and Law, pages 205– 209, São Paulo Brazil. ACM. Peter Henderson, Mark S. Krass, Lucia Zheng, Neel Guha, Christopher D. Manning, Dan Jurafsky, and Daniel E. Ho. 2022. Pile of Law: Learning Responsi- ble Data Filtering from the Law and a 256GB Open- Source Legal Dataset. ArXiv:2207.00220 [cs]. Matthew Honnibal, Ines Montani, Sofie Van Lan- deghem, and Adriane Boyd. 2020. spaCy: Industrial- strength Natural Language Processing in Python. Wenyue Hua, Yuchen Zhang, Zhe Chen, Josie Li, and Melanie Weber. 2022. LegalRelectra: Mixed-domain Language Modeling for Long-range Legal Text Com- prehension. ArXiv:2212.08204 [cs]. Nikita Kitaev, Łukasz Kaiser, and Anselm Levskaya. Reformer: The Efficient Transformer. 2020. arXiv:2001.04451 [cs, stat]. ArXiv: 2001.04451. Elena Leitner, Georg Rehm, and Julián Moreno- Schneider. 2020. A Dataset of German Le- gal Documents for Named Entity Recognition. arXiv:2003.13016 [cs]. ArXiv: 2003.13016. Pedro Henrique Luz de Araujo, Teófilo E. de Campos, Renato R. R. de Oliveira, Matheus Stauffer, Samuel Couto, and Paulo Bermejo. 2018. LeNER-Br: A Dataset for Named Entity Recognition in Brazilian Legal Text. In Computational Processing of the Por- tuguese Language, Lecture Notes in Computer Sci- ence, pages 313–323, Cham. Springer International Publishing. Jihang Mao and Wanli Liu. 2019. Hadoken: a BERT- CRF Model for Medical Document Anonymization. In Proceedings of the Iberian Languages Evaluation Forum co-located with 35th Conference of the Span- ish Society for Natural Language Processing, Iber- LEF@SEPLN 2019, Bilbao, Spain, September 24th, 2019, volume 2421 of CEUR Workshop Proceedings, pages 720–726. CEUR-WS.org. Joel Niklaus, Ilias Chalkidis, and Matthias Stürmer. 2021. Swiss-Judgment-Prediction: A Multilingual Legal Judgment Prediction Benchmark. In Proceed- ings of the Natural Legal Language Processing Work- shop 2021, pages 19–35, Punta Cana, Dominican Republic. Association for Computational Linguistics. Joel Niklaus and Daniele Giofré. 2022. BudgetLong- former: Can we Cheaply Pretrain a SotA Legal Lan- guage Model From Scratch? ArXiv:2211.17135 [cs]. Joel Niklaus, Veton Matoshi, Pooja Rani, Andrea Galassi, Matthias Stürmer, and Ilias Chalkidis. 2023a. Lextreme: A multi-lingual and multi-task benchmark for the legal domain. Joel Niklaus, Veton Matoshi, Matthias Stürmer, Il- ias Chalkidis, and Daniel E. Ho. 2023b. Multi- LegalPile: A 689GB Multilingual Legal Corpus. ArXiv:2306.02069 [cs]. Joel Niklaus, Matthias Stürmer, and Ilias Chalkidis. 2022. An Empirical Study on Cross-X Transfer for Legal Judgment Prediction. In Proceedings of the 2nd Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics and the 12th International Joint Conference on Natural Lan- guage Processing (Volume 1: Long Papers), pages 32–46, Online only. Association for Computational Linguistics. Alex Nyffenegger, Matthias Stürmer, and Joel Niklaus. 2023. Assessing Re- Identification Capabilities of Large Language Mod- els. ArXiv:2308.11103 [cs]. Anonymity at Risk? Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Car- roll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. 2022. Training language models to follow instructions with human feedback. Vasile Pais, Maria Mitrofan, Carol Luca Gasan, Vlad Coneschi, and Alexandru Ianov. 2021. Named Entity Recognition in the Romanian Legal Domain. In Pro- ceedings of the Natural Legal Language Processing Workshop 2021, pages 9–18, Punta Cana, Dominican Republic. Association for Computational Linguistics. Jonas Pfeiffer, Ivan Vuli ́c, Iryna Gurevych, and Sebas- tian Ruder. 2021. UNKs everywhere: Adapting mul- tilingual language models to new scripts. In Proceed- ings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 10186–10203, Online and Punta Cana, Dominican Republic. Asso- ciation for Computational Linguistics. Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the Lim- its of Transfer Learning with a Unified Text-to-Text Transformer. Journal of Machine Learning Research, 21(140):1–67. Vishvaksenan Rasiah, Ronja Stern, Veton Matoshi, Matthias Stürmer, Ilias Chalkidis, Daniel E. Ho, and Joel Niklaus. 2023. SCALE: Scaling up the Com- plexity for Advanced Language Model Evaluation. ArXiv:2306.09237 [cs]. P. Ruch, R. H. Baud, A. M. Rassinoux, P. Bouillon, and G. Robert. 2000. Medical document anonymiza- tion with a semantic lexicon. Proceedings. AMIA Symposium, pages 729–733. Jason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, An- drew M. Dai, and Quoc V. Le. 2021. Finetuned language models are zero-shot learners. CoRR, abs/2109.01652. Alexander Wettig, Tianyu Gao, Zexuan Zhong, and Danqi Chen. 2023. Should you mask 15% in masked In Proceedings of the 17th language modeling? Conference of the European Chapter of the Asso- ciation for Computational Linguistics, pages 2985– 3000, Dubrovnik, Croatia. Association for Computa- tional Linguistics. Lucia Zheng, Neel Guha, Brandon R. Anderson, Pe- ter Henderson, and Daniel E. Ho. 2021. When Does Pretraining Help? Assessing Self-Supervised Learning for Law and the CaseHOLD Dataset. arXiv:2104.08671 [cs]. ArXiv: 2104.08671 version: 3.
http://arxiv.org/abs/2310.19805v1
"2023-10-07T00:02:05"
"2023-10-07T00:02:05"
SERA:Sample Efficient Reward Augmentation in offline-to-online Reinforcement Learning
A prospective application of offline reinforcement learning (RL) involves initializing a pre-trained policy using existing static datasets for subsequent online fine-tuning. However, direct fine-tuning of the offline pre-trained policy often results in sub-optimal performance. A primary reason is that offline conservative methods diminish the agent's capability of exploration, thereby impacting online fine-tuning performance. To enhance exploration during online fine-tuning and thus enhance the overall online fine-tuning performance, we introduce a generalized reward augmentation framework called Sample Efficient Reward Augmentation (SERA). SERA aims to improve the performance of online fine-tuning by designing intrinsic rewards that encourage the agent to explore. Specifically, it implicitly implements State Marginal Matching (SMM) and penalizes out-of-distribution (OOD) state actions, thus encouraging agents to cover the target state density, and achieving better online fine-tuning results. Additionally, SERA can be effortlessly plugged into various RL algorithms to improve online fine-tuning and ensure sustained asymptotic improvement, showing the versatility as well as the effectiveness of SERA. Moreover, extensive experimental results will demonstrate that when conducting offline-to-online problems, SERA consistently and effectively enhances the performance of various offline algorithms.
[ "Ziqi Zhang", "Xiao Xiong", "Zifeng Zhuang", "Jinxin Liu", "Donglin Wang" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.19805v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.19805v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI" ]
Under review as a conference paper at ICLR 2024 SERA: SAMPLE EFFICIENT REWARD AUGMENTATION IN OFFLINE-TO-ONLINE REINFORCEMENT LEARNING 2 Zhejiang University. Ziqi Zhang1∗ Xiao Xiong3∗ Zifeng Zhuang12 1 Westlake University. 3 University of Cambridge. 4 Institute of Advanced Technology, Westlake Institute for Advanced Study. {zhangziqi,zhuangzifeng,liujinxin,wangdonglin}@westlake.edu.cn {xx842}@cam.ac.uk Jinxin Liu12 Donglin Wang14† 3 2 0 2 t c O 7 ] G L . s c [ 1 v 5 0 8 9 1 . 0 1 3 2 : v i X r a ABSTRACT A prospective application of offline reinforcement learning (RL) involves initial- izing a pre-trained policy using existing static datasets for subsequent online fine- tuning. However, direct fine-tuning of the offline pre-trained policy often results in sub-optimal performance. A primary reason is that offline conservative meth- ods diminish the agent's capability of exploration, thereby impacting online fine- tuning performance. To enhance exploration during online fine-tuning and thus enhance the overall online fine-tuning performance, we introduce a generalized reward augmentation framework called Sample Efficient Reward Augmentation (SERA). SERA aims to improve the performance of online fine-tuning by design- ing intrinsic rewards that encourage the agent to explore. Specifically, it implic- itly implements State Marginal Matching (SMM) and penalizes out-of-distribution (OOD) state actions, thus encouraging agents to cover the target state density, and achieving better online fine-tuning results. Additionally, SERA can be effortlessly plugged into various RL algorithms to improve online fine-tuning and ensure sus- tained asymptotic improvement, showing the versatility as well as the effective- ness of SERA. Moreover, extensive experimental results will demonstrate that when conducting offline-to-online problems, SERA consistently and effectively enhances the performance of various offline algorithms. 1 INTRODUCTION Offline reinforcement learning (RL) holds a natural advantage over online RL in that it can be completely trained using pre-existing static datasets, obviating the necessity to in- teract with the environment for the collection of new trajectories (Levine et al., 2020). Nev- ertheless, offline RL faces limitations due to its reliance on static offline datasets, and such paradigm can only learn similar or slightly better performance than behavioral policy. Consequently, it becomes imperative to ad- dress these limitations by enhancing the per- formance of the offline policy through the process of online fine-tuning (Fujimoto & Gu, 2021; Kostrikov et al., 2021; Wu et al., 2022; Mark et al., 2023). Figure 1: Demonstration of SERA. (blue) Cal-QL with SERA. (black) Cal-QL only. (green) CQL with SERA, (red) CQL only. SERA improves online fine- tuning by augmenting online rewards with offline pre-trained networks. Drawing inspiration from modern machine learning, which leverages pre-training followed by fine- tuning on downstream tasks (Brown et al., 2020; Touvron et al., 2023), it seems plausible to elevate ∗Equal contribution. †Corresponding author: Donglin Wang (wangdonglin@westlake.edu.cn) 1 Offline Pre-trainingOnline Fine-TruniningRreturnCal-QL-SERACal-QL baslineCQL-SERACQL baselineoffline dataCal-QL,CQL,AWAC,TD3+BC, etcOffline Pre-trainReward Augmentation InitializationData CollectionOnlineInteractionraug(s,a)=r(s,a)+rSERA(s,a) Under review as a conference paper at ICLR 2024 the performance of offline policies through the process of online fine-tuning. However, previous studies demonstrate that offline pre-trained policy tends to exhibit worse fine-tuning performance due to effects of conservative offline approaches on agent's exploration.1 (Nakamoto et al., 2023) . Typically, there are two kinds of conservative approaches in offline RL. The first approach involves conducting offline RL with a conservative critic, entailing the penalization of value estimates for out- of-distribution (OOD) state-action pairs (Kumar et al., 2020a). The second approach employs offline RL with policy regression, imposing constraints on action predictions within the action support Wu et al. (2022); Fujimoto et al. (2019a); Fujimoto & Gu (2021). However, both of these approaches negatively impact the agent's exploration. Specifically, conservative critics tend to underestimate the value of the offline buffer in comparison to the ground truth returns, consequently affecting the agent's exploration capabilities. As for the regularized policy, it constrains its predictions within the action support or closely aligns them with the behavior policies, resulting in a reduction of exploratory behavior. Therefore, the pivotal factor for the success of offline-to-online RL lies in preserving the policy's exploratory nature while concurrently motivating agents to explore truly valuable spaces. And, to encourage policies exploring the true high-value observation space during online fine-tuning, previous SOTA methods employ a calibration process to align the value estimation with the true return, ultimately reducing the bias in the value estimation of the online buffers Nakamoto et al. (2023). Nonetheless, this approach still relies on the presence of a policy 2 with powerful exploration capabilities. Hence, it seems evident that irrespective of the refinements made to the offline-to-online algorithm, the pivotal element for its success lies in the preservation or even augmentation of the model's exploratory capacity. Thus, can we improve the effectiveness of offline-to-online by solely focusing on promoting explora- tion within the observation space? The answer to this question is most likely Yes, because as long as an agent uniformly cover the obser- vation space fast enough, it can recover its true value estimate of the samples rapidly while collecting a more diverse data thus mitigating (Luo et al., 2023) the shortcomings of the various explorations of the conservative policy. Based on such insight, we propose a generalized offline-to-online frame- work called Sample Efficient Reward Augmentation (SERA), that encouraging offline pre-trained policy to explore by designing intrinsic reward (As shown in Figure 1). Compared to existing reg- ularized methods, SERA is a pure reward augmentation framework thus it has a natural advantage that can be flexibly plugged into various algorithms. Besides, SERA computing Q conditioned state entropy as the intrinsic reward, thus SERA not only implicitly benefits from the theoretical guar- antee of State Marginal Matching (SMM) (Lee et al., 2020) to encourage agent exploring but also benefits from VCSE (Kim et al., 2023) to eliminate the biased exploration caused by maximizing no-conditioned state entropy. Meanwhile, it is worth noting that SERA differs from VCSE firstly because SERA makes full use of the offline pre-trained Q as an intrinsic reward condition, which is unbiased in the early online process (VCSE calculates intrinsic rewards by conditioning on a randomly initialized value function), and therefore reduces the error in the value-conditioned esti- mation. Anther reason is that Q conditioned intrinsic reward can efficiently address the limitation of V conditioned intrinsic reward, which has been fully discussed in section 4.2. To summarize, our contribution can be summarized as follows: • Firstly, we propose a generalized reward augmentation framework that can be plugged into various offline algorithms to conduct offline-to-online setting and improve their online fine- tuning performance. • Secondly, 1) We find the most suitable scenario to make full use of the advantage of value conditional state entropy maximization. 2) We compute the intrinsic reward by Q con- ditioned state entropy rather than V conditioned state entropy and thus can decrease the biased exploration without considering the imbalance distribution of value space of deci- sion makings. 1In this paper, Conservation Offline methods includes conservative critic method CQL (Kumar et al., 2020b) and other policy-constraint methods like BCQ (Fujimoto et al., 2019b) 2CQL has two variants includes CQL-DQN and CQL-SAC. Among them, CQL-SAC is based on Soft- Actor-Critic (SAC). SAC (Haarnoja et al., 2018) is maximum entropy policy with highly exploratory. 2 Under review as a conference paper at ICLR 2024 2 RELATED WORK Offline RL. The notorious challenge within offline RL pertains to the mitigation of out-of- distribution (OOD) predictions, which are a consequence of the distributional shift between the behavior policy and the training policy (Fujimoto et al., 2019b). To effectively address this issue, 1) conservative policy-based model-free methods adopt the following approaches: Adding policy regularization (Fujimoto et al., 2019a; Kumar et al., 2019; Wu et al., 2019; Liu et al., 2023b), or implicit policy constraints (Peng et al., 2019; Siegel et al., 2020; Zhou et al., 2020; Chen et al., 2022; Wu et al., 2022; Liu et al., 2023b;a; Zhuang et al., 2023). 2) And, conservative critic-based model-free methods penalize the value estimation of OOD state-actions via conducting pessimistic Q function (Kumar et al., 2020a) or uncertainty estimation (An et al., 2021; Bai et al., 2022; Reza- eifar et al., 2022; Wu et al., 2021) or implicitly regularizing the bellman equation (Kumar et al., 2020b; Liu et al., 2022). In terms of the model-base offline RL, it similarly train agent with distri- bution regularization (Hishinuma & Senda, 2021; Yang et al., 2022; Zhang et al., 2022), uncertainty estimation (Yu et al., 2020; Kidambi et al., 2020; Lu et al., 2022), and value conservation (Yu et al., 2021). In our research, due to the remarkable sampling efficiency and outstanding performance of model-free algorithms in both offline and online RL settings, we select Conservative Q-learning (CQL) and Calibrated Q-Learning (Cal-QL) as our primary baseline methods. And, to conduct a thorough assessment of the effectiveness of our proposed approaches, we have also expanded our evaluation to encompass a diverse set of other model-free algorithms, including SAC (Haarnoja et al., 2018), Implicit Q-learning (IQL)(Kostrikov et al., 2021), TD3+BC(Fujimoto & Gu, 2021), and AWAC(Nair et al., 2021). Offline-to-Online and Online Exploration. Prior research has demonstrated that offline RL methods offer the potential to expedite online training, a process that involves incorporating of- fline datasets into online replay buffers (Nair et al., 2021; Vecerik et al., 2018; Todd Hester & et al., 2017) or initializing the pre-trained policy to conduct online fine-tuning (Kostrikov et al., 2021; Beeson & Montana, 2022). However, there exhibits worse performance when directly fine-tuning the offline pre-trained policy, and such an issue can be solved by pre-training with pessimistic Q function and fine-tuning with exploratory methods (Wu et al., 2022; Mark et al., 2023; Nakamoto et al., 2023). Significantly, our approach SERA differs from these methods in that it enhances online fine-tuning solely by augmenting online exploration. Importantly, this approach can be broadly ap- plied across various model-free algorithms. In terms of exploration, recent advances in the studies of exploration can obviously improve the online RL sample efficiency, among that, remarkable re- searches include injecting noise into state actions(Lillicrap et al., 2019) or designing intrinsic reward by counting visitation or errors from predictive models (Badia et al., 2020; Sekar et al., 2020; Whit- ney et al., 2021). In particular, the approaches most related to our study are to utilize state entropy as an intrinsic reward (Kim et al., 2023; Seo et al., 2021). 3 PRELIMINARY AND PROBLEM FORMULATION 3.1 PRELIMINARY We consider RL as a Markov decision Process (MDP) tuple i.e., M = (S, A, r, T, p(s0), γ). Specif- ically, p(s0) denotes the initial state distribution, S denotes the observation space, A denotes the actions space, r : S × A → R denotes the reward function, T : S × A → S is the transition function, and γ ∈ [0, 1] is the discount factor. The goal of RL is to find or obtain an optimal pol- icy π∗ : S → A to maximize the accumulated discounted return i.e., π∗ ← arg maxπ R(τ ) = (cid:80) (st,at)∼π(τ ) r(st, at) × γt, where τ = {s0, a0, r0, * * * , sT , aT , rT } is the rollout trajectory. We also define Q function by Qπ(s, a) = Eτ ∼π(τ )[(cid:80)T t=0 γtrt|s0 = s, a0 = a], and value function by V (s) = Ea∼π(a|s)[Q(s, a)]. Furthermore, in offline-to-online RL problem setting, the agent has to access the static datasets Doffline = {(s, a, r, s′) ∼ dD(s)πβ(*|s)r(s, a)T (s′|s, a)} for pretraining, followed by fine-tuning with the online replay buffer Donline. In this work, we mainly consider improving model-free offline-to-online RL. Model-free Offline RL. Typically, model-free RL algorithms are based on dynamic program- Specifi- ming that alternately trains for policy improvement as well as policy evaluation. 3 Under review as a conference paper at ICLR 2024 MQ(s, a)], where Bπ cally, Q-network is used to optimize the policy during policy improvement i.e. GMQ = Es∼D,a∼π(*|s)[Q(s, a)], and policy evaluation is conducted by the Bellman equa- arg maxπ tion iteration i.e., J (Q) = E(s,a,s′)∼D[Q − Bπ MQ(s, a) = r(s, a) + γEs∼D[Q(s′, π(*|s′))]. In particular, model-free offline RL aims to learn from the static RL datasets Doffline := {(s, a, r, s′)} collected by behavior policy πβ without access to the environment for collecting new trajectories, therefore, it always suffer from the out-of-distribution (OOD) issues. Specifically, model-free algorithms train the Q function by one step bellman equation i.e., J (Q) = E(s,a,s′)∼D[Q − Bπ MQ(s, a) = r(s, a) + γQ(s′, π(*|s′)), but if (s′, π(*|s′) /∈ Doffline then the overestimation of OOD state actions will cause extrapolation error and learned biased Q further affect π. Previous studies have extensively studied such a problem, such that CQL was proposed to penalty the OOD state actions by conservative term (Equation 1), and IQL implicitly learns Q function with expected regression without explicit access to the value estimation of OOD state-actions. MQ(s, a)] which requires computing Bπ J (Q) = E(s,a,s′)∼D[Q(s, a) − Bπ MQ(s, a)] + E(s,a,s′)∼D[−Q(s, a) + Q(s′, π(s′))]. (1) If the state density ρ(s) s.t. s ∈ S is unknown, we can use State Entropy as Intrinsic Reward. non-parametric entropy estimator to approximate the state entropy(Seo et al., 2021). Specifically, given N i.i.d samples {si}, the k-nearest neighbors (KNN) entropy estimator can be defined as3: ˆH k N (S) = 1 N N (cid:88) i=1 log N * ||si − sknn ||ds 2 * n i k * Γ( ds 2 + 1) ds 2 ˆπ ∝ 1 N N (cid:88) i=1 log ||si − sknn i ||. (2) 3.2 STATE ENTROPY MAXIMIZATION OFFLINE-TO-ONLINE RL PROBLEM FORMULATION In a standard offline-to-online RL problem, it totally has two training stages including offline pre-training and online fine-tuning. Specifically, we first use the offline methods to pre-train the policy πθ on a static dataset Doffline consists of samples {(s, a, r, s′) ∼ p(s0)πβ(*|s)r(s, a)T (s′|s, a)} which is collected by rollout behavioral policy πbeta in the environment with the same M, and then further fine-tune the pre-trained policy πθ in the same environment with M so as to enhance the performance of this pre-trained πθ. Thus, the goal of offline-to-online RL is to first pre- train πθ on Doffline, followed by the online phase to obtain the optimal policy π∗ with the smallest interactions. Figure 2: The Demonstration of Offline-to- Online State Marginal Matching (SMM). Definition 1 (Critic Conditioned State Entropy) The state-critic joint entropy can be defined as H(s, Q) = Es∼p(s)[− log p(s, Qπ(π(s), s))]. Additionally, the marginal entropy can be calculated by H(Q) = Es∼ρ(s) [− log p(Q(s, π(s)))]. Thus, we can define the critic conditioned entropy as H(s|Q) = Es∼ρ(s)[− log p(s|Qπ(s, π(s)))] which measures the amount of information needed to describe the result of S when the value of Qπ(s, π(s)) is given, where ρ(s) is the state density. Definition of Marginal State distribution. We refer Lee et al. to define the state marginal distribution as Equation 3. Furthermore, we define the state density as p∗(s) and the state distribution of current empirical policy as ρπ(s). (2020) ρ(s) = Es0∼p(s0),at∼πθ(*|st),st+1∼p(*|st,at)[ 1 T T (cid:88) t=1 1(st = s)]. (3) Implicitly State Marginal Matching (SMM) via State Entropy Maximization. Given the target state density p∗(s) and the offline initialized empirical state marginal distribution ρπ(s). If we want the current distribution to be transformed to the target state density, we just have to minimize 3ds is the dimension of state and Γ is the gamma function, nˆπ ∝ 3.14. 4 (a) Offline State Distribution(b) Online State DistributionState Entropy MaxmizationState densityOffline state distributionHigher frequency states need decreasingOffline State Distribution Match State DensityLower frequency states need increasing Under review as a conference paper at ICLR 2024 DKL(ρ(s)||p∗(s)), where DKL denotes the KL divergence4. min DKL(ρπ(s)||ρ∗(s)) ≜ max Es∼ρπ(s)[log p∗(s) + Hπ[s]]. (4) Meanwhile, as shown in Equation. 4, we can minimize DKL(ρπ(s)||p∗(s)) by maximizing Es∼p∗(s)[log p∗(s) + Hπ[s]]. Therefore, we can design p∗(s) − log(ρπ(s)) as intrinsic reward to encourage agent covering p∗. However, the real p∗ can't be accessed, and any methods for p∗ approximation are biased, therefore, we conduct implicitly optimization to realize SMM,i.e., max Es∼ρ(s)[Hπ[s]]. Furthermore, we will explain why such a method can realize implicitly SMM. As shown in Figure 2 the first reason is that increasing Es∼ρ(s)[Hπ[s]] makes state distribution more homogeneous, thus down-exploring overly densely distributed states while encouraging exploration of under-explored states. Another reason is that maximizing Es∼ρ(s)[Hπ[s]] has positive effect to encourage agents covering p∗(s) (See Appendix for specific mathematical analysis). Implicitly Conditional SMM in Offline-to-Online RL. Only maximize Es∼ρ(s)[Hπ[s]] will bias the agent's exploration (Kim et al., 2023). Furthermore, such an issue can be solved and refined by maximizing critic conditioned entropy, i.e., using E[Hπ[s| min({Qπ i (s, a)}i∈[0,*** ,N ])] rather Es∼ρ(s)[Hπ[s]] to compute intrinsic reward (section 4). Based on this method, we propose our method SERA, and we will demonstrate its advantage over maximizing state entropy (Seo et al., 2021) or value conditioned state entropy (Kim et al., 2023) in section 4. 4 SAMPLE EFFICIENCY REWARD AUGMENTATION 4.1 METHODOLOGY In this section, we propose Sample Efficient Reward Augmentation (SERA), a simple reward aug- mentation method for model-free offline RL algorithms to conduct offline-to-online RL. Reward Augmentation by SERA. When fine-tuning the offline pre-trained policy in an online environment with access to the online replay buffer, we utilize Equation 5 to augment the reward. rmod(s, a)(s,a)∼Donline = λ * Tanh(H(s|min(Qφ1 (s, a), Qφ2(s, a)))) (cid:125) (cid:124) (cid:123)(cid:122) raug +r(s, a). (5) where Tanh see 5, and φ1 and φ2 are the params of double Q Networks. Additionally, we can't attend the state density ρπ(s), thus we refer to VCSE (Kim et al., 2023) using KSG distribution esti- mator to compute the Q conditioned intrinsic reward, i.e., raug(s, a)(s,a)∼Donline = HKSG(S|Q) = HKSG(S, Q) − HKSG(Q), and the concrete form of intrinsic reward can be described as: raug(s, a)(s,a)∼Doffline = 1 ds where ˆQ(s, a) = min(Qφ1(s, a), Qφ2 (s, a)), and xknn i φ(nv(i)+1)+log 2*max(||si −sknn i is the nx(i)-th nearest neighbor of xi. ||, || ˆQ(s, a)− ˆQ(s, a)knn||). (6) Training Objective. We have introduced reward augmentation into the online fine-tuning process. Now we will present our training objective when conducting offline-to-online with SERA. As SERA is a plugged reward augmentation method, the main difference between the baselines and SEAR- augmented methods is the reward augmentation. Thus there is no change to the training objectives of Cal-QL and CQL. Specifically, regarding the training objective, we update Cal-QL's Q Network using Equation 7, and we update CQL's Q Network using Equation 1: J (Q) = E(s,a)∼D[Q(s, a) − Bπ MQ(s, a)] + Es∼D,a∼π[max(Q(s, a), V μ(s))] − E(s,a)∼D[Q(s, a)]. (7) Meanwhile, their policies are updated by Equation 8: J (πθ) = Es∼D[−Q(s, πθ(s)) + α log(πθ(s))]. (8) 4Kullback-Leible (KL) divergence can be denoted by DKL(p||q) := Ex∼p(x)[log p(x) q(x) ]. KL divergence can be used to estimate the distance between p(x) and q(x). 5Tanh: Hyperbolic Tangent Function, Tanh(x) = ex−e−x ex+e−x , Tanh(x) ∈ (−1, 1). We use this formulation to control the scale of intrinsic reward raug. 5 Under review as a conference paper at ICLR 2024 Significantly, in addition to testing SERA on Cal-QL and CQL, we also conduct evaluation with other model-free algorithms. Notably, when scaling up SERA to work with these other algorithms, no additional modifications to these algorithms are required. 4.2 IMPLEMENTATION AND ANALYSIS OF SERA Algorithm 1 Framework for Sample-Efficient Reward Augmentation (SERA) Sample mini batch doffline from Doffline dtrain = doffline 1: Require: Critics: {Qφ1 , Qφ2 }, Policy: πθ, offline replay buffer: Doffline, online replay buffer: Donline, 2: if Offline then 3: 4: 5: else 6: 7: 8: Modifying rewards by rmod(s, a) = r(s, a) + raug(s, a) Obtain the training batch dtrain = doffline ∩ donline 9: 10: end if 11: Learn policy with dtrain using selected RL algorithms. Sample mini-batch donline from Donline and doffine from Doffline Set augmented reward raug = 1 ds φ(nv(i) + 1) + log 2 * max(||si − sknn ||, || ˆQ(s, a) − ˆQ(s, a)knn||), i Implementation. We will describe how to integrate SERA into various algorithms. As shown in Algorithm 2, SERA augments reward in the online replay buffer by calculating the Q conditional state entropy which is highly compatible with Q-ensemble or double-Q RL algorithms. For algo- rithms that do not employ Q-ensemble or double Q, it is still possible to use SERA; however, they may not benefit from the advantages associated with Q-ensemble, as clarified in the following sec- tion. When it comes to the hyper-parameters of SERA, setting λ in Equation 5 to 1 is generally sufficient to improve the performance of various baselines on most tasks. However, it is important to note that SERA's effectiveness is influenced by the number of k-nearest neighbor (KNN) clusters, as we have demonstrated in our ablation study. Additionally, for parameters unrelated to SERA, such as those of other algorithms used in conjunction with SERA, it is not necessary to adjust the original parameters of these algorithms (see more details in the appendix). Advantages of Q Condition over V Condition. Differing from Kim et al. (2023), SERA condi- tions its intrinsic reward on min(Qφ1(s, a), Qφ2 (s, a)) rather than V (s). In comparison to VCSE, SERA's advantage lies in its consideration of transitions. For example, assuming that there exist two transitions T1 = (s, a1, s1) and T2 = (s, a2, s2), since T1 and T2 have the same current observation, they will yield the same value conditioned intrinsic reward − log(s|V (s)). This can introduce bias in the value learning process especially when current observation corresponds to a substantial num- ber of valuable decisions and a limited number of low-value decisions. This is because low-value decisions can still receive relatively high intrinsic rewards based on the higher value expectations V (s) for the current state, subsequently influencing the agent's decision-making. However, if we condition intrinsic reward on Q(s, a), it can take into account the decision-making simultaneously. Why SERA Can Implicitly Penalize OOD State Action? Model-free RL algorithms always suf- fer from extrapolation error (see discussion in section 3.1). Moreover, the value network exhibits significant variance in value estimations for the set of observations that are accessed less frequently, which, in turn, impacts reward calculating. SERA provides a remedy for this issue. Specifically, when computing intrinsic rewards with Equation.5, state-action with a higher value but greater vari- ance in the value estimate will be assigned a lower value estimate. Consequently, the current state action will be grouped into states with lower values, implicitly penalizing the OOD state actions. 5 EXPERIMENTS AND EVALUATION The primary objectives of our experimental evaluation are as follows: 1) We aim to investigate whether and how well SERA can facilitate offline-to-online RL. Initially, we compare the perfor- mance of Cal-QL-SERA and CQL-SERA with several other state-of-the-art fine-tuning methods on a variety of offline RL benchmark tasks from D4RL by examining their fine-tuning curves and fine- tuned performance. 2) We also study the scalability of SERA on various model-free algorithms to 6 Under review as a conference paper at ICLR 2024 improve their sample efficiency. 3) Additionally, we conduct various experiments to demonstrate the performance difference or relationship between SERA and various exploration methods including SE, VCSE, and SAC. 4) Finally, we perform ablation studies to understand the feasibility of SERA. To begin with the presentation of our main results, we will first introduce our tasks and baselines. Task and Datasets We experiment with 8 tasks from mujoco (Brockman et al., 2016) and Antmaze in D4RL (Fu et al., 2021). Specifi- cally, during the offline pre-training stage, we conducted the offline training on D4RL and then fine-tuned the pretrained agent on the cor- responding Gym-mujoco or Antmaze environ- ments. The selected tasks cover various aspects of RL challenges, including reward delay and high-dimensional continuous control. Specifically: (1) In the Antmaze tasks, the goal is to control a quadruped robot to reach the final goal. Notably, this agent does not receive an immediate reward for its current decision but instead only receives a reward of +1 upon successfully reaching the goal or terminating. This setup presents a form of reward delay, making these tasks adapt to evaluate the long horizontal decision-making capability of algorithms. (2) In Gym-locomotion tasks, the aim is to increase the agent's locomotion, which is different from Antmaze domain in that tasks of Gym- mujoco involve high-dimensional decision-making spaces. Also, the agent in Gym-mujoco has the potential to obtain rewards in real time. Figure 3: Examples of our selected tasks from Gym- Mujoco and Antmaze domains. Baselines for Comparison. For convenience, we name any algorithm Alg paired with SERA as Alg-SERA. Now we introduce our baselines. We primarily compare CQL-SERA and Cal-QL-SERA to CQL (Kumar et al., 2020a) and Cal-QL (Nakamoto et al., 2023). We also verify that SERA can be broadly plugged into various model-free algorithms including SAC (Haarnoja et al., 2018), IQL (Kostrikov et al., 2021), TD3+BC (Fujimoto & Gu, 2021), and AWAC (Nair et al., 2021), thus improving their online fine-tuning performance. In particular, Cal-QL is the recent state-of-the-art (SOTA) offline-to-online RL algorithm that has been adequately compared to multiple offline-to- online methods(O3F (Mark et al., 2023), ODT (Zheng et al., 2022), and mentioned baselines), and demonstrated obvious advantages. 5.1 MAIN RESULTS Figure 4: Online fine-tuning curve on 8 selected tasks. We tested SERA by comparing Cal-QL- SERA, CQL-SERA to Cal-QL, CQL on selected tasks in the Gym-mujoco and Antmaze domains, and then reported the average return curves over 50 times of evaluation. As shown in this Figure, SERA can improve Cal-QL and CQL's offline fine-tuning sample efficiency and achieves better performance than baseline (CQL and Cal-QL without SERA) over all selected tasks. We first present the results of the comparison between CQL-SERA, Cal-QL-SERA, CQL, and Cal- QL, including the online fine-tuning training curves shown in Figure 4, as well as the results after 7 Cal-QL-baselineCal-QL-SERACQL-baselineCQL-SERA0.00.20.40.60.81.0Environment Steps1e60.00.20.40.60.81.0Normalized D4RL Scoreantmaze-large-diverse0.00.20.40.60.81.0Environment Steps1e60.00.20.40.60.81.0antmaze-large-play0.00.20.40.60.81.0Environment Steps1e60.50.60.70.80.91.0antmaze-medium-diverse0.00.20.40.60.81.0Environment Steps1e60.50.60.70.80.91.0antmaze-medium-play0.00.20.40.60.81.0Environment Steps1e60.30.40.50.60.70.8Normalized D4RL Scorehopper-medium0.00.20.40.60.81.0Environment Steps1e60.60.81.01.21.41.6ant-medium0.00.20.40.60.81.0Environment Steps1e60.20.40.60.81.01.2halfcheetah-medium0.00.20.40.60.81.0Environment Steps1e60.50.70.91.11.31.5walker2d-medium Under review as a conference paper at ICLR 2024 online fine-tuning displayed in Table 4. We then extend our comparison to more Alg-SERA and Alg in Figure 5. Finally, we analyze the performance differences and relationships between SERA and other exploration methods, as illustrated in Figure 6. Can SERA improve offline-to-online RL? As shown in Figure. 4, SERA can improve the online fine-tuning sample efficiency, characterized by faster convergence rates. We can also observe from Table 1 that SERA maintains the online fine-tuning asymptotic performance for both CQL and Cal- QL with CQL-SERA and Cal-QL-SERA achieving the best fine-tuning results on 7 out of 8 tasks). Specifically, when considering the performance after online fine-tuning, SERA yields an average improvement of 9.3% for CQL and 11.8% for Cal-QL in Gym-mujoco domain. In the antmaze domain, SERA brings about an average improvement of 2.7% for CQL and 2.9% for Cal-QL, thus improving the online fine-tuning performance. It's worth noting that, CQL-SERA performs better than Cal-QL-SERA and Cal-QL on average on all tasks, which not only reflects the advantages of SERA in offline-to-online RL but also supports our view that offline-to-online performance can be improved solely from the perspective of encouraging agent's exploration. Task antmaze-large-diverse antmaze-large-play antmaze-medium-diverse antmaze-medium-play halfcheetah-medium walker2d-meidum hopper-medium ant-medium Average Fine-tuned IQL AWAC TD3+BC CQL CQL+SERA Cal-QL Cal-QL+SERA 59 51 92 94 57 93 67 113 78 91 89 98 98 71 125 57 122 94 91 94 100 99 47 95 65 107 87 00 00 00 00 67 91 101 121 48 95 91 100 98 90 123 61 135 99 95 90 98 97 46 80 55 96 82 00 00 00 00 49 82 55 43 57 Table 1: Normalized score after online fine-tuning. We report the online fine-tuned normalized return. SERA obviously improves the performance of CQL and Cal-QL. In particular, CQL-SERA (mean score of 99) is the best out of the 8 selected baselines. Notably, part of Antmaze's baseline results are quoted from existing studies. Among them, AWAC's results are quoted from Kostrikov et al. (2021) and CQL's results are quoted from Nakamoto et al. (2023). Can SERA be plugged into various model-free algorithms? To answer the second question, we conduct comparative experiments to test our SERA on various model-free algorithms including TD3+BC, AWAC, IQL, SAC. Importantly, since our SERA is a plugged reward augmentation algo- rithm, it does not require any additional modifications (i.e., we simply incorporate SERA to modify the reward when training on those algorithms). As shown in Figure.5, when SERA is plugged in, al- most all algorithms gain performance improvements during online fine-tuning, showing that SERA can be applied effectively to a wide range of RL algorithms beyond the scope of CQL or Cal-QL. Figure 5: Performance of Alg-SERA. We test SERA with AWAC, TD3+BC, and IQL on selected Gym-mujoco tasks, SERA can obviously improve the performance of these algorithms. SERA and various Exploration methods in offline-to-online. In this section, we will demon- strate the connection between SERA and several related exploration methods including SAC, VCSE, SE. Among that, SAC, a previous SOTA max-entropy online framework, has competitive perfor- mance on a range of continuous control benchmark tasks. Different from SERA, SAC encourages the agent's exploration by maximizing policy entropy. We observe that when SAC is plugged with SERA, it will enhance SAC's performance on selected continuous control tasks, as depicted in Fig- ure 6(a), SAC-SERA performs better than SAC over selected Gym-mujoco locomotion tasks. Fur- thermore, we conduct experiments to compare SERA with other state entropy maximization methods 8 AWAC-baselineAWAC-SERATD3+BC-baselineTD3+BC-SERAIQL-baselineIQL-SERA0.00.20.40.60.81.0Environment Steps1e60.50.70.91.11.31.5Normalized D4RL Scoreant-medium0.00.20.40.60.81.0Environment Steps1e60.40.50.60.70.8halfcheetah-medium0.00.20.40.60.81.0Environment Steps1e60.30.50.70.91.1hopper-medium0.00.20.40.60.81.0Environment Steps1e60.50.70.91.11.3walker2d-medium Under review as a conference paper at ICLR 2024 including SE, VCSE, while testing these exploration methods on IQL. As shown in Figure 6 (b), the training curves of SE and VCSE do not change significantly during online fine-tuning, indicating that these two exploration methods do not outperform SERA. Meanwhile, these empirical results align with our expectations because this performance difference provides evidence that Q condition intrinsic reward outperforms V -conditioned rewards, thus further supporting our claim: Q condition helps mitigate bias when conducting value condition to compute the intrinsic reward. Figure 6: Performance comparison for variety exploration Methods. (a) Online fine-tuning per- formance difference between SAC and SAC-SERA. (b) Online fine-tuning performance difference between SERA, VCSE and SE with IQL. SERA performs the best over selected algorithms. 5.2 ABLATIONS We now focus on quantifying the impact of SERA on the performance of online finetuning. Thus we mainly study the effect of Equation.13's hyperparameter, as shown in section 4. The state en- tropy is approximated via KSG estimator, where the number of state clusters serves as a crucial hyperparameter. As shown in Figure.4, the performance can indeed be influenced by the number of state clusters, and a trade-off exists among the sizes of these state clusters. For instance, the optimal cluster settings of walker2d and hopper are saturated around 20 and 10, respectively. In contrast, a task like antmaze-large-diverse requires a larger number of clusters (about 25). We consider the main reason is that different tasks require varying degrees of exploration, and thus need different cluster settings. Therefore, our SERA proves to be valid and versatile. Figure 7: In this experiment, we evaluate the performance difference that arises when varying the number of state clusters. We assess SERA by configuring different sizes of k-nearest neighbor (KNN) clusters and subsequently observe the impact of these parameter settings on online fine- tuning, and it can be observed from this Figure that the choice of KNN cluster settings exerts a notable influence on SERA's performance. 6 CONCLUSIONS In this study, we proposed a pluggable reward augmentation method called SERA, designed to improve offline-to-online performance. Specifically, our approach implicitly benefits from the guar- antee of SMM and penalizing OOD state actions and can obviously and broadly be plugged into var- ious model-free algorithms and improve their online fine-tuning performance. Beyond such remark- able performance improvement, we also presented and analyzed other contributions of SERA:1) We identified the optimal scenario for value condition state entropy. 2) We highlighted the bias of value-conditioned state entropy while proposing that Q-conditioned state entropy has a natural advantage in that it can lower biased exploration caused by value-conditioned reward. Furthermore, we conducted a series of ablation studies to prove the effectiveness of our reward function. 9 0.00.20.40.60.81.0Environment Steps1e60.00.20.40.60.81.0Normalized D4RL Scorewalker2d-mediumSAC-baselineSAC-SERA0.00.20.40.60.81.0Environment Steps1e60.20.40.60.81.0Normalized D4RL Scorehalfcheetah-mediumSAC-baselineSAC-SERA0.00.20.40.60.81.0Environment Steps1e60.20.40.60.81.0walker2d-mediumIQL-SERAIQL-VCSEIQL-SE0.00.20.40.60.81.0Environment Steps1e60.20.40.60.81.0hopper-mediumIQL-SERAIQL-VCSEIQL-SE0.00.20.40.60.81.0Environment Steps1e60.00.20.40.60.81.0Normalized D4RL Scoreantmaze-large-diversenum k=10num k=25num k=55num k=85num k=1000.00.20.40.60.81.0Environment Steps1e60.00.20.40.60.81.0antmaze-large-playnum k=10num k=25num k=55num k=85num k=1000.00.20.40.60.81.0Environment Steps1e60.00.20.40.60.81.0hopper-mediumnum k=10num k=20num k=50num k=85num k=1000.00.20.40.60.81.0Environment Steps1e60.00.20.40.60.81.0walker2d-mediumnum k=10num k=20num k=50num k=85num k=100 Under review as a conference paper at ICLR 2024 REFERENCES Gaon An, Seungyong Moon, Jang-Hyun Kim, and Hyun Oh Song. Uncertainty-based of- fline reinforcement learning with diversified q-ensemble. In Marc'Aurelio Ranzato, Alina Beygelzimer, Yann N. Dauphin, Percy Liang, and Jennifer Wortman Vaughan (eds.), Ad- vances in Neural Information Processing Systems 34: Annual Conference on Neural In- formation Processing Systems 2021, NeurIPS 2021, December 6-14, 2021, virtual, pp. 7436–7447, 2021. URL https://proceedings.neurips.cc/paper/2021/hash/ 3d3d286a8d153a4a58156d0e02d8570c-Abstract.html. Adri`a Puigdom`enech Badia, Pablo Sprechmann, Alex Vitvitskyi, Daniel Guo, Bilal Piot, Steven Kapturowski, Olivier Tieleman, Mart ́ın Arjovsky, Alexander Pritzel, Andew Bolt, and Charles Blundell. Never give up: Learning directed exploration strategies, 2020. Chenjia Bai, Lingxiao Wang, Zhuoran Yang, Zhihong Deng, Animesh Garg, Peng Liu, and Zhaoran Wang. Pessimistic bootstrapping for uncertainty-driven offline reinforcement learning, 2022. Alex Beeson and Giovanni Montana. Improving td3-bc: Relaxed policy constraint for offline learn- ing and stable online fine-tuning, 2022. Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016. Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhari- wal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners, 2020. Xi Chen, Ali Ghadirzadeh, Tianhe Yu, Yuan Gao, Jianhao Wang, Wenzhe Li, Bin Liang, Chelsea Finn, and Chongjie Zhang. Latent-variable advantage-weighted policy optimization for offline rl, 2022. Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, and Sergey Levine. D4rl: Datasets for deep data-driven reinforcement learning, 2021. Scott Fujimoto and Shixiang Shane Gu. A minimalist approach to offline reinforcement learning, 2021. Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, Cali- fornia, USA, volume 97 of Proceedings of Machine Learning Research, pp. 2052–2062. PMLR, 2019a. URL http://proceedings.mlr.press/v97/fujimoto19a.html. Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration, 2019b. Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor, 2018. Toru Hishinuma and Kei Senda. Weighted model estimation for offline model-based reinforcement learning. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan (eds.), Advances in Neural Information Processing Systems, volume 34, pp. 17789–17800. Cur- ran Associates, Inc., 2021. URL https://proceedings.neurips.cc/paper_files/ paper/2021/file/949694a5059302e7283073b502f094d7-Paper.pdf. Rahul Kidambi, Aravind Rajeswaran, Praneeth Netrapalli, and Thorsten Joachims. Morel: Model- In Hugo Larochelle, Marc'Aurelio Ranzato, Raia Had- based offline reinforcement learning. sell, Maria-Florina Balcan, and Hsuan-Tien Lin (eds.), Advances in Neural Information Process- ing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. URL https://proceedings.neurips.cc/ paper/2020/hash/f7efa4f864ae9b88d43527f4b14f750f-Abstract.html. 10 Under review as a conference paper at ICLR 2024 Dongyoung Kim, Jinwoo Shin, Pieter Abbeel, and Younggyo Seo. Accelerating reinforcement learning with value-conditional state entropy exploration, 2023. Ilya Kostrikov, Ashvin Nair, and Sergey Levine. Offline reinforcement learning with implicit q- learning, 2021. Aviral Kumar, Justin Fu, Matthew Soh, George Tucker, and Sergey Levine. Stabilizing off- policy q-learning via bootstrapping error reduction. In Hanna M. Wallach, Hugo Larochelle, Alina Beygelzimer, Florence d'Alch ́e-Buc, Emily B. Fox, and Roman Garnett (eds.), Ad- vances in Neural Information Processing Systems 32: Annual Conference on Neural Informa- tion Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pp. 11761–11771, 2019. URL https://proceedings.neurips.cc/paper/2019/ hash/c2073ffa77b5357a498057413bb09d3a-Abstract.html. Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative q-learning for offline reinforcement learning. In Hugo Larochelle, Marc'Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin (eds.), Advances in Neural Information Processing Systems 33: An- nual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6- 12, 2020, virtual, 2020a. URL https://proceedings.neurips.cc/paper/2020/ hash/0d2b2061826a5df3221116a5085a6052-Abstract.html. Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative q-learning for offline reinforcement learning, 2020b. Lisa Lee, Benjamin Eysenbach, Emilio Parisotto, Eric Xing, Sergey Levine, and Ruslan Salakhut- dinov. Efficient exploration via state marginal matching, 2020. Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tuto- rial, review, and perspectives on open problems, 2020. Timothy P. Lillicrap, Jonathan J. Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning, 2019. Jinxin Liu, Hongyin Zhang, and Donglin Wang. Dara: Dynamics-aware reward augmentation in offline reinforcement learning. arXiv preprint arXiv:2203.06662, 2022. Jinxin Liu, Hongyin Zhang, Zifeng Zhuang, Yachen Kang, Donglin Wang, and Bin Wang. Design from policies: Conservative test-time adaptation for offline policy optimization. arXiv preprint arXiv:2306.14479, 2023a. Jinxin Liu, Ziqi Zhang, Zhenyu Wei, Zifeng Zhuang, Yachen Kang, Sibo Gai, and Donglin Wang. Beyond OOD state actions: Supported cross-domain offline reinforcement learning. CoRR, abs/2306.12755, 2023b. doi: 10.48550/arXiv.2306.12755. URL https://doi.org/10. 48550/arXiv.2306.12755. Cong Lu, Philip J. Ball, Jack Parker-Holder, Michael A. Osborne, and Stephen J. Roberts. Revisiting design choices in offline model-based reinforcement learning, 2022. Yicheng Luo, Jackie Kay, Edward Grefenstette, and Marc Peter Deisenroth. Finetuning from offline reinforcement learning: Challenges, trade-offs and practical solutions, 2023. Max Sobol Mark, Ali Ghadirzadeh, Xi Chen, and Chelsea Finn. Fine-tuning offline policies with optimistic action selection, 2023. URL https://openreview.net/forum?id= 2x8EKbGU51k. Ashvin Nair, Abhishek Gupta, Murtaza Dalal, and Sergey Levine. Awac: Accelerating online rein- forcement learning with offline datasets, 2021. Mitsuhiko Nakamoto, Yuexiang Zhai, Anikait Singh, Max Sobol Mark, Yi Ma, Chelsea Finn, Aviral Kumar, and Sergey Levine. Cal-ql: Calibrated offline rl pre-training for efficient online fine- tuning, 2023. Xue Bin Peng, Aviral Kumar, Grace Zhang, and Sergey Levine. Advantage-weighted regression: Simple and scalable off-policy reinforcement learning, 2019. 11 Under review as a conference paper at ICLR 2024 Shideh Rezaeifar, Robert Dadashi, Nino Vieillard, L ́eonard Hussenot, Olivier Bachem, Olivier In Thirty- Pietquin, and Matthieu Geist. Offline reinforcement learning as anti-exploration. Sixth AAAI Conference on Artificial Intelligence, AAAI 2022, Thirty-Fourth Conference on In- novative Applications of Artificial Intelligence, IAAI 2022, The Twelveth Symposium on Edu- cational Advances in Artificial Intelligence, EAAI 2022 Virtual Event, February 22 - March 1, 2022, pp. 8106–8114. AAAI Press, 2022. doi: 10.1609/aaai.v36i7.20783. URL https: //doi.org/10.1609/aaai.v36i7.20783. Ramanan Sekar, Oleh Rybkin, Kostas Daniilidis, Pieter Abbeel, Danijar Hafner, and Deepak Pathak. Planning to explore via self-supervised world models, 2020. Younggyo Seo, Lili Chen, Jinwoo Shin, Honglak Lee, Pieter Abbeel, and Kimin Lee. State entropy maximization with random encoders for efficient exploration, 2021. Noah Y. Siegel, Jost Tobias Springenberg, Felix Berkenkamp, Abbas Abdolmaleki, Michael Ne- unert, Thomas Lampe, Roland Hafner, Nicolas Heess, and Martin Riedmiller. Keep doing what worked: Behavioral modelling priors for offline reinforcement learning, 2020. Matej Vecer ́ık Todd Hester and Olivier Pietquin et al. Deep q-learning from demonstrations. In AAAI Conference on Artificial Intelligence, 2017. URL https://api.semanticscholar.org/ CorpusID:10208474. Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timoth ́ee Lacroix, Baptiste Rozi`ere, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Ar- mand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models, 2023. Mel Vecerik, Todd Hester, Jonathan Scholz, Fumin Wang, Olivier Pietquin, Bilal Piot, Nicolas Heess, Thomas Roth ̈orl, Thomas Lampe, and Martin Riedmiller. Leveraging demonstrations for deep reinforcement learning on robotics problems with sparse rewards, 2018. William F. Whitney, Michael Bloesch, Jost Tobias Springenberg, Abbas Abdolmaleki, Kyunghyun Cho, and Martin Riedmiller. Decoupled exploration and exploitation policies for sample-efficient reinforcement learning, 2021. Jialong Wu, Haixu Wu, Zihan Qiu, Sup- In NeurIPS, reinforcement URL http://papers.nips.cc/paper_files/paper/2022/hash/ ported 2022. caa934a507a952698d54efb24845fc4b-Abstract-Conference.html. and Mingsheng Long. Jianmin Wang, optimization learning. offline policy for Yifan Wu, George Tucker, and Ofir Nachum. Behavior regularized offline reinforcement learning, 2019. Yue Wu, Shuangfei Zhai, Nitish Srivastava, Joshua M. Susskind, Jian Zhang, Ruslan Salakhutdinov, and Hanlin Goh. Uncertainty weighted actor-critic for offline reinforcement learning. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pp. 11319–11328. PMLR, 2021. URL http://proceedings.mlr. press/v139/wu21i.html. Shentao Yang, Yihao Feng, Shujian Zhang, and Mingyuan Zhou. Regularizing a model-based pol- icy stationary distribution to stabilize offline reinforcement learning. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesv ́ari, Gang Niu, and Sivan Sabato (eds.), International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, vol- ume 162 of Proceedings of Machine Learning Research, pp. 24980–25006. PMLR, 2022. URL https://proceedings.mlr.press/v162/yang22b.html. Tianhe Yu, Garrett Thomas, Lantao Yu, Stefano Ermon, James Y. Zou, Sergey Levine, Chelsea Finn, and Tengyu Ma. MOPO: model-based offline policy optimization. In Hugo Larochelle, Marc'Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan- Tien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Con- ference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. URL https://proceedings.neurips.cc/paper/2020/hash/ a322852ce0df73e204b7e67cbbef0d0a-Abstract.html. 12 Under review as a conference paper at ICLR 2024 Tianhe Yu, Aviral Kumar, Rafael Rafailov, Aravind Rajeswaran, Sergey Levine, and Chelsea Finn. COMBO: conservative offline model-based policy optimization. In Marc'Aurelio Ran- zato, Alina Beygelzimer, Yann N. Dauphin, Percy Liang, and Jennifer Wortman Vaughan (eds.), Advances in Neural Information Processing Systems 34: Annual Conference on Neu- ral Information Processing Systems 2021, NeurIPS 2021, December 6-14, 2021, virtual, pp. 28954–28967, 2021. URL https://proceedings.neurips.cc/paper/2021/ hash/f29a179746902e331572c483c45e5086-Abstract.html. Wenjia Zhang, Haoran Xu, Haoyi Niu, Peng Cheng, Ming Li, Heming Zhang, Guyue Zhou, and In Karen Liu, Xianyuan Zhan. Discriminator-guided model-based offline imitation learning. Dana Kulic, and Jeffrey Ichnowski (eds.), Conference on Robot Learning, CoRL 2022, 14-18 December 2022, Auckland, New Zealand, volume 205 of Proceedings of Machine Learning Re- search, pp. 1266–1276. PMLR, 2022. URL https://proceedings.mlr.press/v205/ zhang23c.html. Qinqing Zheng, Amy Zhang, and Aditya Grover. Online decision transformer, 2022. Wenxuan Zhou, Sujay Bajracharya, and David Held. PLAS: latent action space for offline rein- In Jens Kober, Fabio Ramos, and Claire J. Tomlin (eds.), 4th Conference forcement learning. on Robot Learning, CoRL 2020, 16-18 November 2020, Virtual Event / Cambridge, MA, USA, volume 155 of Proceedings of Machine Learning Research, pp. 1719–1735. PMLR, 2020. URL https://proceedings.mlr.press/v155/zhou21b.html. Zifeng Zhuang, Kun Lei, Jinxin Liu, Donglin Wang, and Yilang Guo. Behavior proximal policy optimization. arXiv preprint arXiv:2302.11312, 2023. 13 Under review as a conference paper at ICLR 2024 CONTENTS 1 Introduction 2 Related Work 3 Preliminary and Problem Formulation 3.1 Preliminary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 State Entropy Maximization Offline-to-Online RL Problem Formulation . . . . . . 4 Sample Efficiency Reward Augmentation 4.1 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Implementation and Analysis of SERA . . . . . . . . . . . . . . . . . . . . . . . . 5 Experiments and Evaluation 5.1 Main results . 5.2 Ablations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Conclusions A Ethical Claim B Theoretical Analysis B.1 Analysis of implicit State Marginal Matching. . . . . . . . . . . . . . . . . . . . . C Implantation Details C.1 SERA implantation . C.2 Codebase . . . . . . . . C.3 Our Hyper-parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.3.1 Hyper-parameter of SERA . . . . . . . . . . . . . . . . . . . . . . . . . . C.3.2 Hyper-parameter of Baselines . . . . . . . . . . . . . . . . . . . . . . . . D Extended Experiments D.1 Trend of State Entropy Changing . . . . . . . . . . . . . . . . . . . . . . . . . . . D.2 Visualization of State Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . D.3 Pretrained Q vs. Random Q . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 3 3 3 4 5 5 6 6 7 9 9 15 15 15 18 18 18 19 19 19 21 21 22 23 14 Under review as a conference paper at ICLR 2024 A ETHICAL CLAIM Despite the potential of offline RL to learn from the static datasets without the necessity to access the online environment, the offline method does not guarantee the optimal policy. Therefore, online fine- tuning is essential for policy improvement. In this study, we propose a novel and versatile reward augmentation framework, named Sample Efficient Reward Augmentation (SERA) which can be seamlessly plugged into various model-free algorithms. We believe our approach is constructive and will enhance the sample efficiency of offline-to-online RL. Additionally, given that SERA is an integrated algorithm, we also believe it can broadly and readily benefit existing algorithms. B THEORETICAL ANALYSIS In this section, we provide the supplementary mathematical analysis for SERA. B.1 ANALYSIS OF IMPLICIT STATE MARGINAL MATCHING. Stage Marginal Matching (SMM). Given the empirical state distribution ρπ(s) under current empirical policy π and target density p∗(s), the optimization of min DKL(ρπ(s)||p∗(s)) is equivalent to Equation 9. min DKL(ρπ(s)||p∗(s)) ≜ max Es∼ρπ(s)[log p∗(s) + Hπ[s]]. (9) In section 3.2, due to the absence of an explicit definition for p∗, we propose Implicit SMM. the concept of implicit SMM, i.e., min DKL(ρπ(s)||p∗(s)) ≈ max Es∼ρπ(s)[Hπ[s]]. Here we will provide a complementary analysis to assess the feasibility of this method. Why does implicit SMM encourage covering the target density? We commence our analysis by expressing max Es∼ρπ(s)[Hπ(s)] in an alternative form: max Es∼ρπ(s)[Hπ(s)] = max Es∼ρπ(s)[− log ρπ(s)] (cid:90) = max −ρπ(s) log ρπ(s)ds s∼dom(ρπ) (cid:90) = max s∼dom(ρπ) (cid:90) = max s∼dom(ρπ) (cid:90) = min s∼dom(ρπ) −ρπ(s) log( ρπ(s) p∗(s) × p∗(s))ds −ρπ(s)(log p∗(s) + log ρπ(s) p∗(s) )ds ρπ(s) log p∗(s) + ρπ(s) log ρπ(s) p∗(s) ds where dom(ρπ) donates the domain of state space under function ρπ. Subsequently, we employ a logarithmic inequality, i.e. 1 − 1 x ≤ log x ≤ x − 1, to further derive the aforementioned expression: (cid:90) min s∼dom(ρπ) ρπ(s) log p∗(s) + ρπ(s) log ρπ(s) p∗(s) (cid:90) ds ≥ min s∼dom(ρπ) (cid:90) = 2 − max ρπ(s) − ρπ(s) p∗(s) + ρπ(s) − p∗(s)ds ≥ 2 − max s∼dom(ρπ(s)) (cid:90) s∼dom(ρπ(s)) ρπ(s) p∗(s) 1 p∗(s) + p∗(s)ds + p∗(s)ds It is worth noting that, given that p∗(s) is the fixed target state density and p∗(s) ∈ [0, 1] for all p∗(s) + p∗(s)) > 0. Therefore, the process of maximising Es∼ρπ(s)[H[s]] s ∈ dom(p∗), we have ( is equivalent to maximizing (cid:82) p∗(s) + p∗(s)ds. This leads the domain of ρπ(s)(which is initially smaller than the domain of p∗(s) due to limited state exploration at the beginning of state entropy maximization) to cover the domain of p∗(s). s∼dom(ρπ(s)) 1 1 15 Under review as a conference paper at ICLR 2024 Trade off between ρπ and p∗ when maximizing entropy. We further derivate Equation B.1 and obtained : max Es∼ρπ(s)[Hπ(s)] = max Es∼ρπ(s)[− log ρπ(s)] (cid:90) = max −ρπ(s) log ρπ(s)ds s∼dom(ρπ) (cid:90) = max s∼dom(ρπ) (cid:90) = max s∼dom(ρπ) −ρπ(s) log( ρπ(s) p∗(s) × p∗(s))ds −ρπ(s) log p∗(s) − ρπ(s) log ρπ(s) p∗(s) ds (cid:90) = min ρπ(s) log p∗(s) ds + max (cid:90) s∼dom(ρπ) (cid:123)(cid:122) term.1 (cid:124) (cid:125) (cid:124) s∼dom(ρπ) −ρπ(s) log (cid:123)(cid:122) term.2 ds ρπ(s) p∗(s) (cid:125) Analysis term.1: We further derive term1, in particular d1 denotes domain that ρπ ≤ p∗(s) ∀s ∈ d1 and d2 denotes domain that ρπ ≥ p∗(s) ∀s ∈ d2 s.t. dom(ρπ) = d1 ∪ d2: At first, Jterm1 = max (cid:90) s∼dom(ρπ) ρπ(s) log 1 p∗(s) ds (cid:90) ≥ ρπ(s) log s∼dom(ρπ) = DKL(ρπ(s)||p∗(s)) ρπ(s) p∗(s) ds meanwhile, we study Jterm1 − DKL(ρπ(s)||p∗(s)). Jterm1 − DKL(ρπ(s)||p∗(s)) (cid:90) = s∼dom(ρπ) ρπ(s) log 1 p∗(s) − ρπ log (cid:90) = ρπ(s) log ρπ(s) p∗(s) 1 ρπ(s) ds ds s∼dom(ρπ) (cid:90) ≤ ρπ(s)[ 1 ρπ(s) − 1]ds (1 − ρπ(s))ds s∼dom(ρπ) (cid:90) = (10) (11) s∼dom(ρπ) ≤ (cid:90) ds s∼dom(ρπ) Therefore, Jterm1 ≤ (DKL(ρπ(s)||p∗(s)) + (cid:82) maximizing the KL divergence between ρπ(s) and p∗(s), then push ρπ(s) away from p∗(s). s∼dom(ρπ) ds) and minimizing term1 is equivalent to Analysis term.2: We can observe that term.2 is a form of KL deivergence: Jterm2 = max (cid:90) −ρπ(s) log ρπ(s) p∗(s) s∼dom(ρπ) = min DKL(ρπ(s)||p∗(s)), (12) Thus, optimizeing term.2 is equiv to minimize the KL divergence between p∗(s) and ρπ(s), thereby driving ρπ approaching p∗(s). 16 Under review as a conference paper at ICLR 2024 Analysis Summary: In conclusion, based on the Analysis term.1 and Analysis term.2, it can be deduced that the optimization of term 1 makes ρπ(s) away from p∗(s), whereas the optimization of Term 2 facilitates the convergence of ρπ(s) towards p∗(s). Therefore, these two objectives represent a trade-off, offering the advantage of encouraging the agent to approach the target distribution while maintaining its capacity for exploration. 17 Under review as a conference paper at ICLR 2024 C IMPLANTATION DETAILS C.1 SERA IMPLANTATION In SERA framework, we modify our reward as rmod(s, a)(s,a)∼Donline = λ * Tanh(H(s|min(Qφ1 (s, a), Qφ2(s, a)))) (cid:125) (cid:124) (cid:123)(cid:122) raug +r(s, a). (13) To calculate the intrinsic reward raug for the online replay buffer Donline, we use the KSG estimator, as defined in Equation 14, to estimate the conditional state density of the empirical dataset Donline raug(s, a)(s,a)∼Doffline = 1 ds φ(nv(i)+1)+log 2*max(||si−sknn i ||, || ˆQ(s, a)− ˆQ(s, a)knn||). (14) Given that the majority of our selected baselines are implemented using the double Q({Qφ1 , Qφ2}), the offline pre-trained double Q can be readily utilized for the computation of intrinsic rewards. C.2 CODEBASE implementation is based on Cal-QL:https://github.com/nakamotoo/Cal-QL, Our VCSE:https://sites.google.com/view/rl-vcse, and SE:methodologies. Addition- ally, we have included our source code in the supplementary material for reference. Readers can refer to our pseudocode (see Algorithm 2) for a comprehensive understanding of the implementa- tion details. ˆQ see 6. Algorithm 2 Framework for Sample-Efficient Reward Augmentation (SERA) Sample mini batch doffline from Doffline dtrain = doffline 1: Require: Critics: {Qφ1 , Qφ2 }, Policy: πθ, offline replay buffer: Doffline, online replay buffer: Donline, 2: if Offline then 3: 4: 5: else 6: 7: 8: Modifying rewards by rmod(s, a) = r(s, a) + raug(s, a) Obtain the training batch dtrain = doffline ∩ donline 9: 10: end if 11: Learn policy with dtrain using selected RL algorithms. Sample mini-batch donline from Donline and doffine from Doffline Set augmented reward raug = 1 ds φ(nv(i) + 1) + log 2 * max(||si − sknn ||, || ˆQ(s, a) − ˆQ(s, a)knn||), i 6where φ1 and φ2 are the params of double Q Networks and ˆQ(s, a) = min(Qφ1 (s, a), Qφ2 (s, a)), and xknn i is the nx(i)-th nearest neighbor of xi. 18 Under review as a conference paper at ICLR 2024 C.3 OUR HYPER-PARAMETER C.3.1 HYPER-PARAMETER OF SERA SERA. The K-nearest neighbors (KNN) for SERA are configured as follows: [0, 10, 15, 25, 50, 85, 100, 110], and the parameter λ in Equation 13 is set to 1. C.3.2 HYPER-PARAMETER OF BASELINES In the context of these algorithms, we conducted tests related to AWAC and IQL using the repository available at https://github.com/tinkoff-ai/CORL, while tests related to Cal-QL and CQL were performed using the repository accessible at https://github.com/nakamotoo/ Cal-QL. The following five tables present fundamental but critical hyperparameter settings for five baseline algorithms. Table 2: Hyper-parameters of AWAC. Hyperparameter offline pre-train iterations offline pre-train iterations Buffer size Batch size learning rate γ awac τ awac λ Value 1e6 1e6 20000000 256 3e−4 0.99 5e-3 1.0 Actor Architecture Critic Architecture 4× Layers MLP (hidden dim 256) 4× Layers MLP (hidden dim 256) Table 3: Hyper-parameters of IQL. Hyperparameter offline pre-train iterations offline pre-train iterations Batch size learning rate of π learning rate of V learning rate of Q γ IQL τ β (Inverse Temperature) Value 1e6 1e6 256 3e−4 3e−4 3e−4 0.99 0.7 # Coefficient for asymmetric loss 3.0# small beta → BC, big beta → maximizing Q Actor Architecture Critic Architecture 4× Layers MLP (hidden dim 256) 4× Layers MLP (hidden dim 256) 19 Under review as a conference paper at ICLR 2024 Table 4: Hyper-parameters of TD3+BC. Hyperparameter offline pre-train iterations offline pre-train iterations learning rate of π learning rate of Q γ Batch size TD3 alpha Value 1e6 1e6 1e−4 3e−4 0.99 256 2.5 Actor Architecture Critic Architecture 4× Layers MLP (hidden dim 256) 4× Layers MLP (hidden dim 256) Table 5: Hyper-parameters of Cal-QL. We only provide the basic setting, for more detail setting, please directly refer to https://nakamotoo.github.io/projects/Cal-QL Hyperparameter offline pre-train iterations offline pre-train iterations learning rate of π learning rate of Q γ Batch size Value 1e6 1e6 1e−4 3e−4 0.99 256 Actor Architecture Critic Architecture 4× Layers MLP (hidden dim 256) 4× Layers MLP (hidden dim 256) Table 6: Hyper-parameters of CQL. CQL uses Cal-QL's code-base, and we only need to remove Cal-QL's calibration loss when deploying CQL. Hyperparameter offline pre-train iterations offline pre-train iterations learning rate of π learning rate of Q γ Batch size Value 1e6 1e6 1e−4 3e−4 0.99 256 Actor Architecture Critic Architecture 4× Layers MLP (hidden dim 256) 4× Layers MLP (hidden dim 256) 20 Under review as a conference paper at ICLR 2024 D EXTENDED EXPERIMENTS D.1 TREND OF STATE ENTROPY CHANGING If the state density ρ(s) s.t. s ∈ S is unknown, we can use State Entropy as Intrinsic Reward. non-parametric entropy estimator to approximate the state entropy(Seo et al., 2021). Specifically, given N i.i.d samples {si}, the k-nearest neighbors (knn) entropy estimator can be defined as7: ˆH k N (S) = 1 N N (cid:88) i=1 log N * ||si − sknn ||ds 2 * ˆn i k * Γ( ds 2 + 1) ds 2 ˆπ ∝ 1 N N (cid:88) i=1 log ||si − sknn i ||. (15) Visualization of State Entropy Changing. In this experiment, for each training step, we select the buffer and randomly sample 5000 instances to approximate the entropy using Equation 10. and then plot the trend of approximated state entropy. For the majority of the tasks, the state entropy of AWAC-SERA was either progressively greater than or consistently exceeded that of AWAC-base. This indicates that SERA effectively enhances the agent's exploratory tendencies, enabling them cover much more observation region. Figure 8: The Changing of Approximated Entropy along with increasing training steps. We found that the approximated state entropy in the buffer collected by AWAC using SERA was greater in the later stages of online finetuning. 7ds is the dimension of state and Γ is the gamma function, ˆnˆπ ∝ 3.14. 21 AWAC-SERAAWAC1.01.21.41.61.82.0Environment Steps1e63337414549Approximated Entropy Valueant-medium1.01.21.41.61.82.0Environment Steps1e63235384144halfcheetah-medium1.01.21.41.61.82.0Environment Steps1e62730333639hopper-medium1.01.21.41.61.82.0Environment Steps1e62530354045walker-medium Under review as a conference paper at ICLR 2024 D.2 VISUALIZATION OF STATE DISTRIBUTION Visualization of State Distribution. In this experiment, we aim to illustrate the exploratory be- havior of agents with AWAC and AWAC-SERA algorithms in different tasks. Specifically, we project the accumulated observations onto a two-dimensional plane and then depict these 2D projec- tions. The extent of an agent's exploration is gauged by the projection area which can be calculated by multiplying the maximum range in the x-direction with that in the y-direction. Notably, the computed maximum area for the SERA distribution in both 'walker2d' and the 'hopper' task are approximately 119 and 375, respectively. These values significantly surpass the baseline measure- ments of 81 and 64, corroborating the effectiveness of SERA. Figure 9: State Distribution. We employ Principal Component Analysis (PCA) to project the states in the buffer at different stages of the AWAC and AWAC-SERA onto a 2D plane, subsequently visualizing it. Given the established conditions depicted in Figure 10, it can be inferred that SERA motivates the agent towards exploring richer samples. 22 43210123432101234ant-finetuned2.50.02.55.07.510.012.515.017.542024ant-offline202468101214432101234ant-sera-finetuned2024632101234hopper-finetuned2024432101234hopper-offline321012321012345hopper-sera-finetuned32101234432101234halfcheetah-finetuned3210123442024halfcheetah-offline321012343210123halfcheetah-sera-finetuned202442024walker2d-finetuned2024642024walker2d-offline5051064202468walker2d-sera-finetuned Under review as a conference paper at ICLR 2024 D.3 PRETRAINED Q VS. RANDOM Q Pre-trained Q condition versus un-pre trained Q condition. To validate the statement in our main paper that intrinsic reward computation is influenced by the initialization of Q, we conducted experiments comparing the effects of pre-trained initialized Q and from-scratch8 trained Q during intrinsic reward calculation. Our findings indicate that intrinsic rewards based on offline-initialized Q generally outperform those derived from a from-scratch trained Q across most tasks. Figure 10: Offline Pre-trained Q condition vs. Randomly initialized Q condition. In the majority of our selected Gym-Mujoco tasks, the use of offline-initialized intrinsic reward conditions yielded better performance and higher sample efficiency. To provide clarity, AWAC-base means AWAC algorithm without any modification, AWAC-SERA signifies AWAC with SERA augmentation, and AWAC-SERA (scratch) denotes AWAC with SERA where the computation of reward conditions sat- isfying note 8 . 8We use from-scratch Q to compute intrinsic reward, while continuing to utilize the offline-initialized Q for conducting online fine-tuning. 23 AWAC-baselineAWAC-SERAAWAC-SERA(scratch)0.00.20.40.60.81.0Environment Steps1e60.70.91.11.31.5Normalized D4RL Scoreant-medium0.00.20.40.60.81.0Environment Steps1e60.30.40.50.60.7halfcheetah-medium0.00.20.40.60.81.0Environment Steps1e60.60.81.01.21.4walker2d-medium0.00.20.40.60.81.0Environment Steps1e60.60.70.80.91.0hopper-medium
http://arxiv.org/abs/2310.04627v1
"2023-10-06T23:46:33"
"2023-10-06T23:46:33"
Profit: Benchmarking Personalization and Robustness Trade-off in Federated Prompt Tuning
In many applications of federated learning (FL), clients desire models that are personalized using their local data, yet are also robust in the sense that they retain general global knowledge. However, the presence of data heterogeneity across clients induces a fundamental trade-off between personalization (i.e., adaptation to a local distribution) and robustness (i.e., not forgetting previously learned general knowledge). It is critical to understand how to navigate this personalization vs robustness trade-off when designing federated systems, which are increasingly moving towards a paradigm of fine-tuning large foundation models. Due to limited computational and communication capabilities in most federated settings, this foundation model fine-tuning must be done using parameter-efficient fine-tuning (PEFT) approaches. While some recent work has studied federated approaches to PEFT, the personalization vs robustness trade-off of federated PEFT has been largely unexplored. In this work, we take a step towards bridging this gap by benchmarking fundamental FL algorithms -- FedAvg and FedSGD plus personalization (via client local fine-tuning) -- applied to one of the most ubiquitous PEFT approaches to large language models (LLMs) -- prompt tuning -- in a multitude of hyperparameter settings under varying levels of data heterogeneity. Our results show that federated-trained prompts can be surprisingly robust when using a small learning rate with many local epochs for personalization, especially when using an adaptive optimizer as the client optimizer during federated training. We also demonstrate that simple approaches such as adding regularization and interpolating two prompts are effective in improving the personalization vs robustness trade-off in computation-limited settings with few local updates allowed for personalization.
[ "Liam Collins", "Shanshan Wu", "Sewoong Oh", "Khe Chai Sim" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04627v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04627v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 t c O 6 ] G L . s c [ 1 v 7 2 6 4 0 . 0 1 3 2 : v i X r a Profit: Benchmarking Personalization and Robustness Trade-off in Federated Prompt Tuning Liam Collins∗, Shanshan Wu†, Sewoong Oh†,‡, Khe Chai Sim† liamc@utexas.edu {shanshanw, sewoongo, khechai}@google.com Abstract In many applications of federated learning (FL), clients desire models that are personalized using their local data, yet are also robust in the sense that they retain general global knowledge. However, the presence of data heterogeneity across clients induces a fundamental trade-off between personalization (i.e., adaptation to a local distribution) and robustness (i.e., not forgetting previously learned general knowledge). It is critical to understand how to navigate this personalization vs robustness trade-off when designing federated systems, which are increasingly moving towards a paradigm of fine-tuning large foundation models. Due to limited computational and communication capabilities in most federated settings, this foundation model fine-tuning must be done using parameter-efficient fine-tuning (PEFT) approaches. While some recent work has studied federated approaches to PEFT, the personalization vs robustness trade-off of federated PEFT has been largely unexplored. In this work, we take a step towards bridging this gap by benchmarking fundamental FL algorithms – FedAvg and FedSGD plus personalization (via client local fine-tuning) – applied to one of the most ubiquitous PEFT approaches to large language models (LLMs) – prompt tuning – in a multitude of hyperparameter settings under varying levels of data heterogeneity. Our results show that federated-trained prompts can be surprisingly robust when using a small learning rate with many local epochs for personalization, especially when using an adaptive optimizer as the client optimizer during federated training. We also demonstrate that simple approaches such as adding regularization and interpolating two prompts are effective in improving the personalization vs robustness trade-off in computation-limited settings with few local updates allowed for personalization. 1 Introduction Federated learning (FL) is a framework that enables distributed clients to collaboratively train machine learning models in a privacy-preserving manner [25, 34, 44, 67]. Unlike traditional server-side distributed training, in FL, each client (e.g., a mobile device)'s local data may follow a distinct distribution. This data heterogeneity motivates the development of personalized FL: the goal is to learn client-specific models that work well for each client's own data. Among all the personalized FL approaches [e.g., 6, 54, 59, 66], one of the simplest methods is fine-tuning a global model on each client's local data to produce a personalized model [24, 68]. Despite its simplicity, fine-tuning a FedAvg (Federated Averaging [44, 47])-trained global model has connections to meta learning [5, 24] and representation learning [12], and has been shown to work well over on-device data [50, 60]. Most of the existing FL personalization benchmarks (e.g., [6, 42, 66]) focus on training ∗The University of Texas at Austin, work done while an intern at Google †Google ‡The University of Washington 1 small-sized models (e.g., in the order of 10M parameters) from scratch. In this paper, we con- sider prompt tuning a pre-trained large language model (LLM) (specifically, an 8B parame- ter version of the PaLM model [10]) in the federated setting. As shown in Figure 1, similar to the setup considered in [72], during FedAvg training, the PaLM-8B model is kept frozen, and only the soft prompt part is tuned and com- municated between the server and clients; and dur- ing the personalization phase, each client will fine- tune the soft prompt locally to create a personal- ized soft prompt. Prompt tuning [32] is one of the standard parameter-efficient fine-tuning (PEFT) al- gorithms [14, 37] proposed for LLMs. Considering the potential communication and memory limitations in the FL settings, PEFT is more suitable than full- model fine-tuning; besides, PEFT is shown to be capable of matching full-model fine-tuning in many scenarios [21, 32]. To create a federated dataset, similar to [69], we partition a large-scale instruction tuning dataset based on the task types. We create datasets with three different heterogeneity levels (see Figure 2 for an overview of our setup). Figure 1: In each training round, only the soft prompts are updated and communicated between server and clients. Our contributions are summarized below: • We run comprehensive experiments to study the trade-off between personalization (adaptation to the clients' local distributions) and robustness (not forgetting the previously learned knowledge obtained during the FL training) over different FL training algorithms (variants of FedAvg and FedSGD) and different data heterogeneity levels (high/medium/low). To our knowledge, we are the first to study this trade-off in the setting of FL personalization and LLM prompt tuning. • We observe that for federated prompt tuning, it is important to use an adaptive optimizer (e.g., Adam [27]) as the client optimizer1 in FedAvg (even though the server optimizer already uses adaptive optimizer). This is unlike the previously proposed adaptive FedAvg algorithm [47] (which uses adaptive optimizer at the server, and vanilla SGD at the clients). Our hypothesis is that the loss surface is very flat relative to the large scale of the learned soft prompt, so using an adaptive optimizer at the clients are crucial in making enough progress during training (see Section 4 Observation 3a). • We observe that during the personalization stage (i.e., during the local prompt fine-tuning stage), reducing the learning rate improves the personalization vs robustness trade-off, but it necessitates running many steps to reach the best personalization performance. We find that simple methods such as adding l2 regularization and/or model averaging are effective to achieve the best of both worlds: better personalization vs robustness trade-off in fewer local tuning steps (see Figure 6). 1Note that the resulting algorithm is still a stateless algorithm. A stateless algorithm means that the client does not maintain states locally and reuse them in the next participating round [25, 59, 66]. In our setting, it means that clients do not store Adam optimizer state (estimates of moments). Stateful algorithms (e.g., SCAFFOLD [26]) can perform poorly with low clients participating rate (see Section 5.1 of [47]). 2 Server aggregates soft prompts from clients, and broadcasts the aggregated prompt in the next roundPaLM-8B **Frozen**Tuned soft promptPaLM-8B **Frozen**Tuned soft promptPaLM-8B **Frozen**Tuned soft prompt...... 2 Related Works Federated PEFT of pre-trained LLMs. A number of works have begun to explore PEFT in the federated settings. Some have studied federated prompt tuning on vision tasks, without evaluating personalization [8, 18, 71]. Other works have benchmarked federated PEFT on language tasks, but again did not consider personalization [3, 4, 69, 73]. To our knowledge, all studies of federated PEFT that consider personalization focus on the vision modality [17, 33, 39, 52, 72]. Outside of PEFT, [20, 55, 63] studied federated full-model fine-tuning of BERT models, which are at least an order of magnitude smaller than modern LLMs. Multiple works have noticed that initializing full-model federated training from a pre-trained model can mitigate the effects of data heterogeneity [7, 45, 63]. Like our work, [45] also noticed the importance of using adaptive optimizers when running federated fine-tuning, but they only considered full-model fine-tuning starting from small models. Other works have analyzed the effect of differential privacy on federated training of language models via initialization with [36] or by distillation from a pre-trained LLM [57] . Personalization in FL. A long line of work within federated learning has developed techniques for personalizing models to each client [11, 13, 15, 19, 35, 40, 41, 49, 51, 53]. We defer readers to the recent FL personalization benchmarks [6, 42, 66] and the references therein for a more detailed discussion of the related work. In this paper, we focus on one of the simplest personalization approaches: each client fine-tunes a model locally to get the personalized model [5, 9, 12, 24, 68]. In particular, we are interested in studying the personalization and robustness trade-off. To our knowledge, we are the first to study this trade-off in the setting of federated prompt tuning for LLMs. Robustness to catastrophic forgetting during fine-tuning. Robustness can have different definitions, e.g., robustness to attacks [35, 61] and outliers [30]. In this paper, we focus on a special type, that is, robustness to forgetting about the global knowledge learned by FedAvg when each client fine-tunes the global prompt locally to get a personalized prompt. This is connected to the robustness to distribution shift or out-of-distribution data in the literature, see, e.g., [1, 22, 23, 29, 56, 64, 65], where the main difference is that in our experiments, the in-distribution and out-of-distribution have a special connection unique to the FL setting: a client's local distribution vs all clients' joint distribution. Catastrophic forgetting [43] has been studied for decades. Many proposed methods (e.g., [28, 48]) may not directly fit the FL setting due to privacy or computation constraint. [50] considers a production FL scenario, and proposes to let each client to decide whether to accept the personalized model based on validation data metric. This is orthogonal to the robust fine-tuning methods we experiment with in Figure 6, where we tried two simple robust fine-tuning methods (regularization and model averaging [22, 64, 65]) that do not modify model architecture. We leave the investigation of more complicated robust fine-tuning methods (e.g., [23, 56]) to future work. 3 Experimental Setup In this section we detail the framework we use to empirically evaluate federated-trained prompts. Datasets. We construct three federated datasets from Super-NaturalInstructions (SNI) [62]. SNI is a collection of 1761 diverse NLP tasks belonging to one of 76 task types. Task types include both text classification and generation types, with Translation, Question Answering, and Question Generation being the most popular. Tasks have on average ∼3000 (query, target) pairs, called instances. For example, the instances of a translation task may be pairs of English to French translations of text snippets from a particular corpus. This hierarchical structure (task type → task 3 Figure 2: Overview of our experimental setup. We partition and split the raw SNI dataset into three federated datasets: train (used for training a global prompt), validation (used for hyperparameter tuning), and test (used for learning and evaluating the personalized prompts). We experiment with three versions (high/medium/low heterogeneity) of training data. In the test data, each client has three local datasets: a local train set (used for locally fine-tuning the global prompt to produce the personalized prompt) and local and global eval sets (used for evaluating the personalized prompt over the local and global distributions, respectively). The global eval set is shared across all clients, and is formed by sampling from all test clients' local eval sets. See Section 3 for more details. Table 1: Dataset statistics. All partitions have 3520 training clients and all federated experiments sample 32 training clients/round. Per-client statistics are the mean total instances and unique tasks and task types found in each training client's dataset (rounded to the nearest integer) ± standard deviation across training clients. There are 326 test and validation clients each (the same for all partitions), and each test and validation client has approximately 1200 instances. Partition # train clients Clients/round Instances/client Tasks/client Task types/client HHF-SNI MHF-SNI LHF-SNI 3520 3520 3520 32 32 32 1201 ± 17.6 1201 ± 17.6 1201 ± 0.4 1 ± 0.8 118 ± 111.2 640 ± 10.8 1 ± 0 1 ± 0 50 ± 1.8 → instance) allows for partitioning the instances into clients with controllable heterogeneity level. We partition the instances into clients by first splitting them into training, validation, and test sets according to task type. We randomly select 7 task types each for testing and validation2. Then, we partition the test and validation data into clients by ordering the instances in each task type by task, then breaking these lists into evenly-sized chunks of adjacent instances and designating each chunk to a client. As a result, each client's instances belong to a single task type, and typically a single task. Next, we construct three distinct partitions of the training data. First, we construct a high heterogeneity partition in exactly the same manner as we partition the validation and test data. We do the same for a medium heterogeneity partition, except that we shuffle the instances within each task type before dividing them into client chunks, so that each client may have instances from many tasks of the same type. Lastly, we construct a low heterogeneity partition by shuffling the entire dataset before dividing it into client chunks, thus each client has instances from many 2The test task types are Irony Detection, Text Completion, Explanation, Overlap Extraction, Question Generation, Dialogue Act Recognition, and Gender Classification. 4 Raw SNI dataFederated TrainFederated ValidationFederated TestPre-trained PaLM-8BGlobal promptPersonalized prompts partition and splithyperparameter tuningprompt tuning (algos: FedAvg, FedSGD, ...)initializeevaluate and report metrics3 partitions (high/medium/low-heterogeneity) for Federated Traineach client fine-tunes the prompt locallyglobal eval metric (out-of-distribution robustness) each client in Federated Test has 3 datasetslocal trainlocal evalglobal eval (shared across all clients)local eval metric (in-distribution personalization) Figure 3: For each of the three training dataset partitions (HHF-SNI, MHF-SNI, LHF-SNI) and each metadata category (Task Type, Task, Source, Domain, Reasoning, Input Language, and Output Language), we plot the average across clients of the Kullback-Leibler (KL) divergences between the client's metadata category distribution and the global metadata category distribution, in log scale. Among a variety of meta-data categories, clients on average have distributions of this meta-data category that differ from the global distribution to an extent that we would expect from high, medium and low-heterogeneity partitions (the larger the heterogeneity, the greater the difference between client and global distributions). tasks of many types. All of each training clients' instances are used in federated training, and the same validation and test sets are used for all three partitions. We call these three partitions High Heterogeneity Federated SNI (HHF-SNI), Medium HF-SNI (MHF-SNI), and Low HF-SNI (LHF-SNI), respectively, and provide dataset statistics that verify heterogeneity levels in Table 1 and Figure 3. Model and metric. We use the 8 billion-parameter version of the original PaLM [10], which was trained on 780 billion tokens from sources including social media and Wikipedia3. Following [62], we use ROUGE-L [38] to measure similarity between predicted and target sequences, with scores in [0, 1] and larger scores indicating greater similarity. Experimental procedure. We execute a two-stage experimental procedure. In Stage 1, we run federated learning on the training clients to learn global prompt parameters (see Appendix A for more details on prompt tuning). In Stage 2, we evaluate the quality of these global parameters by using them to initialize local training (personalization) on each test client. In particular, each test client independently trains a soft prompt on their training set starting from the federated-trained global prompt. As this local training progresses we record the prompt's scores on the corresponding client's test data and on a global test dataset compiled across all of the test clients' test datasets. The local scores serve as the personalization metric, while the global scores serve as the robustness metric. We hyperparameter tune in Stage 1 by evaluating the global prompt on a global validation dataset collected from all the validation clients, and in Stage 2 by running personalization on the validation clients. Figure 2 depicts this procedure in detail. 3We choose this model to minimize data leakage, since it was released prior to the release of SNI. Nevertheless, there could still be overlap between its training data and the sources used by SNI. 5 HHF-SNIMHF-SNILHF-SNI101100Avg KL divergence of client distribution with globalDifference between client metadata distributions with global metadata distributionTask TypeTaskSourceDomainReasoningInput LanguageOutput Language Baselines and hyperparameters. We study a generalized version of FedAvg proposed in [47] that allows for adaptive server and client optimizers1. As in [47], we find that using an adaptive server optimizer, in our case Adam, improves over SGD, so all our experiments use Adam on the server side. For the client optimizer1, we experiment with both Adam and SGD, referring to these versions of FedAvg as FedAvg(Adam) and FedAvg(SGD), respectively. Both algorithms make 16 local updates with batch size 32 on 32 sampled clients per round for 300 rounds, and the Adam optimizer is re-initialized from scratch at the start of each selected client's local training round. We also consider FedSGD, in which 32 clients per round send the gradient of the global prompt estimated on 32 instances directly back to the server, and the server updates the global model using Adam. We execute FedSGD for 4800 rounds so that FedSGD processes the same total number of instances as the FedAvg methods. In Appendix C, we explore a version of FedSGD that multiplies the batch size (rather than the number of communication rounds) by 16 in order to see the same number of instances as FedAvg, noting that this gave significantly worse results. We also run Centralized training with Adam and batch size 1024 (same effective batch size as FedSGD) for 4800 rounds. All algorithms optimize prompts of length 10 (tuned in {5, 10, 20}) with embedding dimension 4096. We tune learning rates, the Adam epsilon parameter, and the weight decay parameter during federated training. For personalization, we run Adam and tune its learning rate based on the number of epochs available. We evaluate on 32 test clients, each with training and test sets of 256 and 128 instances, respectively, and a global test set of 2048 instances. Additional details are provided in Appendix C. 4 Results Next, we share personalization (i.e., the local score obtained by evaluating a client's personalized model on this client's local data) vs robustness (i.e., the global score obtained by evaluating the same personalized model over the global test set) curves during personalization. Each point in each plot is the mean (local score, global score) across clients during a personalization epoch, averaged over two-end-to-end trials with distinct random seeds4. These results admit a number of observations. Additional results and details are provided in Appendix C. Observation 1: Choice of personalization learning rate induces computation vs robustness trade-off. Figure 4(Left) plots global and local scores during personaliztion with varying learning rates starting from a prompt pre-trained on HHF-SNI with FedAvg(Adam). These results show that the personalization vs robustness trade-off is heavily dependent on the personalization learning rate. In particular, higher global scores can be maintained by personalizing with smaller learning rates, but at the cost of requiring more epochs to reach the maximal local scores. Specifically, with learning rate 10−0.5, the average local score reaches 0.32 within 10 epochs and the average global score drops to 0.15, and with learning rate 10−2, 64 epochs are required to reach average local score 0.32, but the average global score does not drop below 0.19. In effect, this induces a computation vs robustness trade-off: more robustness necessitates more computation. This motivates us to consider two distinct regimes for personalization: (1) High Computation, in which each client executes 100 epochs of personalization, and (2) Low Computation, in which each client executes 10 epochs of personalization, with learning rates tuned to achieve the best local score (0.32) with minimal drop in global score for each regime. We use regime (1) to compare different pre-training algorithms, as this allows the best performance for each algorithm (Observations 2 and 4Our observations are consistent across random seeds; see results for individual seeds in Appendix C. 6 Figure 4: (Left) Global and local scores during personalization with varying learning rates from a prompt trained on HHF-SNI by FedAvg(Adam). All runs besides those with the largest two learning rates are run for 100 epochs, and otherwise 20 epochs. (Center) Global and local scores during 100 epochs (high computation) of personalization starting from FedAvg(Adam) and Centralized- pre-trained prompts and random initializations (with evaluations every 4 epochs), plus global and local scores with no prompt and few-shot (engineered) prompts. (Right) Global prompt norm, average gradient norm across clients, and norm of prompt change on consecutive rounds during FedAvg(Adam) and FedAvg(SGD) training. All norms are Frobenius. 3). Then, we conclude by showing the more severe forgetting in regime (2) can be mitigated by incorporating a number of heuristics (Observation 4). Observation 2: Benefit of FL pre-training. Figure 4(Center) considers the High Compu- tation regime and shows global vs local score curves for prompts pre-trained with FedAvg(Adam) and centralized training, along with prompts initialized by sampling from a Gaussian distribution ("Random Gaussian") and by sampling 10 token embeddings from the PaLM token embedding matrix ("Random Word") [16]. FedAvg(Adam) yields the best personalization vs robustness trade-off, espe- cially compared to the random initializations. Surprisingly, FedAvg(Adam) outperforms centralized training, although centralized training achieves smaller training loss (see Appendix C), as expected due to possible objective inconsistency for FedAvg [58]. FedAvg(Adam) also outperforms both No Prompt and Few-shot Prompts, which are constructed using instructional examples according to the best procedure reported in [62]; please see Appendix C for details. Observation 3a: Importance of adaptive client optimizer1. Figure 5 compares prompts trained with FedAvg(Adam), FedAvg(SGD), and FedSGD during personalization in the High Computation regime. FedAvg(Adam) outperforms FedAvg(SGD) on all three training partitions, It is well-known that adaptive highlighting the benefit of using an adaptive client optimizer5. optimization enhances full-model transformer training [31, 46, 70], but to our knowledge this has not yet been observed for prompt tuning. Based on Figure 4, we conjecture that Adam's benefit stems from prompt tuning's flat loss landscape relative to prompt scale. For both FedAvg(Adam) and FedAvg(SGD), gradient norms are three orders of magnitude smaller than prompt norms throughout training. This means that the SGD updates are relatively insignificant, unlike the Adam updates that have normalized gradient and a momentum term that scales with the prompt norm. Thus, FedAvg(SGD) has smaller prompt changes than FedAvg(Adam), despite having a client learning 5Often, the client optimizer in FL is SGD, motivated by the added memory cost of Adam [47]. However, this cost is linear in the number of trainable parameters, so it is small for prompt tuning – recall we use a prompt length of 10 tokens with embedding dimension 4096, for a total of only 40960 trainable parameters. 7 0.200.220.240.260.280.300.32Mean Local Score0.140.150.160.170.180.190.20Mean Global ScoreFedAvg(Adam): Personalization Learning Ratelr=1e-0.5, eval every 1 epochlr=1e-1, eval every 1 epochlr=1e-1.5, eval every 2 epochslr=1e-2, eval every 4 epochslr=1e-3, eval every 4 epochslr=1e-4, eval every 4 epochs0.000.050.100.150.200.250.30Mean Local Score0.100.120.140.160.180.20Mean Global ScoreFL vs Non-FL ApproachesFedAvg(Adam)CentralizedRandom-GaussianRandom-WordFew-shot PromptNo Prompt050100150200250300Communication rounds101100101102103ValueTraining Metrics on HHF-SNIAlgorithmFedAvg(Adam)FedAvg(SGD)MetricPrompt NormGradient NormNorm of Prompt Change Figure 5: High Computation regime: scores evaluated every 4 epochs during 100 epochs of personalization starting from prompts pre-trained by FedAvg(Adam), FedAvg(SGD) and FedSGD on (Left) HHF-SNI, (Center) MHF-SNI, and (Right) LHF-SNI. Figure 6: Low Computation regime: scores evaluated every epoch during 10 epochs of personalization with robust-l2 regularization with parameter λ, and possibly model averaging, starting from prompts trained by FedAvg(Adam) on (Left) HHF-SNI, (Center) MHF-SNI, and (Right) LHF-SNI. rate 100x larger (see Table 3). Observation 3b: Importance of multiple local updates. Figure 5 also shows that Fe- dAvg(Adam) outperforms FedSGD, especially with lower training data heterogeneity. Multiple recent works have noticed the superiority of FedAvg-trained models as initializations for personalization compared to FedSGD-trained models [5, 12, 24], but these works did not consider the robustness to forgetting after personalization (nor prompt tuning). In contrast, here we observe that the improvement due to FedAvg is mostly due to higher global scores. Since we use Adam as the server optimizer for FedSGD, the improvement of FedAvg(Adam) cannot be due to its updates being adaptive, but must be due to making multiple of them between communication. Observation 4: Personalization-robustness trade-off can be improved by personal- ization heuristics. Figure 6 considers the Low Computation regime, in which each test client only executes 10 personalization epochs on its training set of 256 instances. Here, we evaluate two heuristics to improve the personalization vs robustness trade-off: (1) l2 regularization and (2) model averaging [22, 64, 65]. Let Pglob be the global prompt resulting from federated training, Pi be the 8 0.200.220.240.260.280.300.32Mean Local Score0.160.170.180.190.200.21Mean Global ScoreHigh Heterogeneity (HHF-SNI)FedAvg(Adam)FedAvg(SGD)FedSGD0.200.220.240.260.280.300.32Mean Local Score0.160.170.180.190.200.21Mean Global ScoreMedium Heterogeneity (MHF-SNI)FedAvg(Adam)FedAvg(SGD)FedSGD0.200.220.240.260.280.300.32Mean Local Score0.160.170.180.190.200.21Mean Global ScoreLow Heterogeneity (LHF-SNI)FedAvg(Adam)FedAvg(SGD)FedSGD0.200.220.240.260.280.300.32Mean Local Score0.1800.1850.1900.1950.2000.2050.2100.215Mean Global ScoreHHF-SNI=0=104=103Model Averaging, =0Model Averaging, =1030.200.220.240.260.280.300.32Mean Local Score0.1800.1850.1900.1950.2000.2050.2100.215Mean Global ScoreMHF-SNI=0=104=103Model Averaging, =0Model Averaging, =1030.200.220.240.260.280.300.32Mean Local Score0.1800.1850.1900.1950.2000.2050.2100.215Mean Global ScoreLHF-SNI=0=104=103Model Averaging, =0Model Averaging, =103 prompt the Client i personalizes, and Pi,10 be the prompt resulting from 10 epochs of personalization to Client i. For (1), we add l2 regularization with parameter λ to the loss that penalizes the distance of the personalized prompt from the global prompt, specifically λ is added to the loss. For (2), we first run full personalization, then compute final client-specific prompts by interpolating the global and personalized prompts as 2 ∥Pi − Pglob∥2 F Pi,10,α = αPi,10 + (1 − α)Pglob for α ∈ {0, 0.1, 0.2, ..., 1}. Each point for "Model Averaging" in each plot in Figure 6 corresponds to the mean (local, global) scores across client prompts {Pi,10,α}i for a particular value of α, with increasing α moving from left to right in each plot. Figure 6 shows that both l2 regularization and model averaging, as well as their combination ("Model Averaging, λ = 10−3"), improve the personalization-robustness trade-off for FedAvg(Adam)-trained prompts. 5 Conclusion Our benchmarking experiments evince the effectiveness of FL as a prompt pre-training mechanism, the importance of using adaptive optimizers for prompt tuning, and the superiority of FedAvg over FedSGD for prompt tuning. We also demonstrate that simple approaches such as reducing the personalization learning rate, adding l2 regularization, and model averaging can improve the personalization vs robustness trade-off for federated-trained prompts. Important open questions stemming from our results include why Adam is superior to SGD for the client optimizer for prompt tuning and why making multiple local updates per round (i.e. FedAvg-style training) leads to more generalizable prompts then making only one update per round (FedSGD), even though both methods see the same total amount of data. Furthermore, our work is limited to exploring simple FL algorithms, without privacy guarantees, on a single model (PaLM-8B). Studying how the personalization-robustness trade-off can be further improved by leveraging more sophisticated personalized FL algorithms, how model size affects the personalization-robustness trade-off, and how to characterize the privacy-utility trade-off for federated prompt tuning also remains as essential future work. Acknowledgements We are grateful to Sean Augenstein, Eugene Bagdasaryan, Zachary Charles, Krishna Pillutla and Zheng Xu for helpful discussions and comments. References [1] Anders Andreassen, Yasaman Bahri, Behnam Neyshabur, and Rebecca Roelofs. The evolution of out-of-distribution robustness throughout fine-tuning. arXiv preprint arXiv:2106.15831, 2021. [2] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. [3] Dongqi Cai, Yaozong Wu, Shangguang Wang, Felix Xiaozhu Lin, and Mengwei Xu. Fedadapter: Efficient federated learning for modern nlp. arXiv preprint arXiv:2205.10162, 2022. 9 [4] Dongqi Cai, Yaozong Wu, Haitao Yuan, Shangguang Wang, Felix Xiaozhu Lin, and Mengwei Xu. Aug-fedprompt: Practical few-shot federated nlp with data-augmented prompts. arXiv preprint arXiv:2212.00192, 2022. [5] Zachary Charles, Nicole Mitchell, Krishna Pillutla, Michael Reneer, and Zachary Garrett. Towards federated foundation models: Scalable dataset pipelines for group-structured learning. arXiv preprint arXiv:2307.09619, 2023. [6] Daoyuan Chen, Dawei Gao, Weirui Kuang, Yaliang Li, and Bolin Ding. pfl-bench: A compre- hensive benchmark for personalized federated learning. In NeurIPS Datasets and Benchmarks track, 2022. [7] Hong-You Chen, Cheng-Hao Tu, Ziwei Li, Han-Wei Shen, and Wei-Lun Chao. On pre-training for federated learning. arXiv preprint arXiv:2206.11488, 2022. [8] Jinyu Chen, Wenchao Xu, Song Guo, Junxiao Wang, Jie Zhang, and Haozhao Wang. Fedtune: A deep dive into efficient federated fine-tuning with pre-trained transformers. arXiv preprint arXiv:2211.08025, 2022. [9] Gary Cheng, Karan Chadha, and John Duchi. Fine-tuning is fine in federated learning. arXiv preprint arXiv:2108.07313, 3, 2021. [10] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022. [11] Liam Collins, Hamed Hassani, Aryan Mokhtari, and Sanjay Shakkottai. Exploiting shared representations for personalized federated learning. In International conference on machine learning, pages 2089–2099. PMLR, 2021. [12] Liam Collins, Hamed Hassani, Aryan Mokhtari, and Sanjay Shakkottai. Fedavg with fine tuning: Local updates lead to representation learning. Advances in Neural Information Processing Systems, 35:10572–10586, 2022. [13] Yuyang Deng, Mohammad Mahdi Kamani, and Mehrdad Mahdavi. Adaptive personalized federated learning. arXiv preprint arXiv:2003.13461, 2020. [14] Ning Ding, Yujia Qin, Guang Yang, Fuchao Wei, Zonghan Yang, Yusheng Su, Shengding Hu, Yulin Chen, Chi-Min Chan, Weize Chen, et al. Delta tuning: A comprehensive study of parameter efficient methods for pre-trained language models. arXiv preprint arXiv:2203.06904, 2022. [15] Alireza Fallah, Aryan Mokhtari, and Asuman Ozdaglar. Personalized federated learning with theoretical guarantees: A model-agnostic meta-learning approach. Advances in Neural Information Processing Systems, 33:3557–3568, 2020. [16] Yuxian Gu, Xu Han, Zhiyuan Liu, and Minlie Huang. Ppt: Pre-trained prompt tuning for few-shot learning. arXiv preprint arXiv:2109.04332, 2021. [17] Tao Guo, Song Guo, and Junxiao Wang. pfedprompt: Learning personalized prompt for vision-language models in federated learning. In Proceedings of the ACM Web Conference 2023, pages 1364–1374, 2023. 10 [18] Tao Guo, Song Guo, Junxiao Wang, Xueyang Tang, and Wenchao Xu. Promptfl: Let federated participants cooperatively learn prompts instead of models-federated learning in age of foundation model. IEEE Transactions on Mobile Computing, 2023. [19] Filip Hanzely and Peter Richtárik. Federated learning of a mixture of global and local models. arXiv preprint arXiv:2002.05516, 2020. [20] Agrin Hilmkil, Sebastian Callh, Matteo Barbieri, Leon René Sütfeld, Edvin Listo Zec, and Olof Mogren. Scaling federated learning for fine-tuning of large language models. In International Conference on Applications of Natural Language to Information Systems, pages 15–23. Springer, 2021. [21] Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. Lora: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685, 2021. [22] Gabriel Ilharco, Mitchell Wortsman, Samir Yitzhak Gadre, Shuran Song, Hannaneh Hajishirzi, Simon Kornblith, Ali Farhadi, and Ludwig Schmidt. Patching open-vocabulary models by interpolating weights. Advances in Neural Information Processing Systems, 35:29262–29277, 2022. [23] Liangze Jiang and Tao Lin. Test-time robust personalization for federated learning. In International Conference on Learning Representations, 2023. [24] Yihan Jiang, Jakub Konečn`y, Keith Rush, and Sreeram Kannan. Improving federated learning personalization via model agnostic meta learning. arXiv preprint arXiv:1909.12488, 2019. [25] Peter Kairouz, H Brendan McMahan, Brendan Avent, Aurélien Bellet, Mehdi Bennis, Arjun Nitin Bhagoji, Kallista Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, et al. Advances and open problems in federated learning. Foundations and Trends in Machine Learning, 14(1–2):1–210, 2021. [26] Sai Praneeth Karimireddy, Satyen Kale, Mehryar Mohri, Sashank Reddi, Sebastian Stich, and Ananda Theertha Suresh. Scaffold: Stochastic controlled averaging for federated learning. In International Conference on Machine Learning, 2020. [27] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. [28] James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521–3526, 2017. [29] Ananya Kumar, Aditi Raghunathan, Robbie Jones, Tengyu Ma, and Percy Liang. Fine-tuning can distort pretrained features and underperform out-of-distribution. In International Conference on Learning Representations, 2022. [30] Achintya Kundu, Pengqian Yu, Laura Wynter, and Shiau Hong Lim. Robustness and per- In 2022 IEEE sonalization in federated learning: A unified approach via regularization. International Conference on Edge Computing and Communications (EDGE), pages 1–11, 2022. doi: 10.1109/EDGE55608.2022.00014. 11 [31] Frederik Kunstner, Jacques Chen, Jonathan Wilder Lavington, and Mark Schmidt. Noise is not the main factor behind the gap between sgd and adam on transformers, but sign descent might be. arXiv preprint arXiv:2304.13960, 2023. [32] Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. arXiv preprint arXiv:2104.08691, 2021. [33] Guanghao Li, Wansen Wu, Yan Sun, Li Shen, Baoyuan Wu, and Dacheng Tao. Visual prompt based personalized federated learning. arXiv preprint arXiv:2303.08678, 2023. [34] Tian Li, Anit Kumar Sahu, Ameet Talwalkar, and Virginia Smith. Federated learning: Chal- lenges, methods, and future directions. IEEE Signal Processing Magazine, 37(3):50–60, 2020. [35] Tian Li, Shengyuan Hu, Ahmad Beirami, and Virginia Smith. Ditto: Fair and robust federated learning through personalization. In International Conference on Machine Learning, pages 6357–6368. PMLR, 2021. [36] Xuechen Li, Florian Tramer, Percy Liang, and Tatsunori Hashimoto. Large language models can be strong differentially private learners. arXiv preprint arXiv:2110.05679, 2021. [37] Vladislav Lialin, Vijeta Deshpande, and Anna Rumshisky. Scaling down to scale up: A guide to parameter-efficient fine-tuning. arXiv preprint arXiv:2303.15647, 2023. [38] Chin-Yew Lin. ROUGE: A package for automatic evaluation of summaries. In Text Summariza- tion Branches Out, pages 74–81, Barcelona, Spain, July 2004. Association for Computational Linguistics. URL https://aclanthology.org/W04-1013. [39] Wang Lu, Xixu Hu, Jindong Wang, and Xing Xie. Fedclip: Fast generalization and personaliza- tion for clip in federated learning. arXiv preprint arXiv:2302.13485, 2023. [40] Yishay Mansour, Mehryar Mohri, Jae Ro, and Ananda Theertha Suresh. Three approaches for personalization with applications to federated learning. arXiv preprint arXiv:2002.10619, 2020. [41] Othmane Marfoq, Giovanni Neglia, Richard Vidal, and Laetitia Kameni. Personalized federated learning through local memorization. In International Conference on Machine Learning, pages 15070–15092. PMLR, 2022. [42] Koji Matsuda, Yuya Sasaki, Chuan Xiao, and Makoto Onizuka. An empirical study of personal- ized federated learning. arXiv preprint arXiv:2206.13190, 2022. [43] Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation, volume 24, pages 109–165. Elsevier, 1989. [44] Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. In Artificial Communication-efficient learning of deep networks from decentralized data. intelligence and statistics, pages 1273–1282. PMLR, 2017. [45] John Nguyen, Kshitiz Malik, Maziar Sanjabi, and Michael Rabbat. Where to begin? exploring the impact of pre-training and initialization in federated learning. arXiv preprint arXiv:2206.15387, 2022. [46] Yan Pan and Yuanzhi Li. Toward understanding why adam converges faster than sgd for transformers. arXiv preprint arXiv:2306.00204, 2023. 12 [47] Sashank J. Reddi, Zachary Charles, Manzil Zaheer, Zachary Garrett, Keith Rush, Jakub Konečný, Sanjiv Kumar, and Hugh Brendan McMahan. Adaptive federated optimization. In International Conference on Learning Representations, 2021. [48] David Rolnick, Arun Ahuja, Jonathan Schwarz, Timothy Lillicrap, and Gregory Wayne. Expe- rience replay for continual learning. Advances in Neural Information Processing Systems, 32, 2019. [49] Aviv Shamsian, Aviv Navon, Ethan Fetaya, and Gal Chechik. Personalized federated learning using hypernetworks. In International Conference on Machine Learning, pages 9489–9502. PMLR, 2021. [50] Khe Chai Sim, Angad Chandorkar, Fan Gao, Mason Chua, Tsendsuren Munkhdalai, and Françoise Beaufays. Robust continuous on-device personalization for automatic speech recogni- tion. In Interspeech, pages 1284–1288, 2021. [51] Karan Singhal, Hakim Sidahmed, Zachary Garrett, Shanshan Wu, John Rush, and Sushant Prakash. Federated reconstruction: Partially local federated learning. Advances in Neural Information Processing Systems, 34:11220–11232, 2021. [52] Shangchao Su, Mingzhao Yang, Bin Li, and Xiangyang Xue. Cross-domain federated adaptive prompt tuning for clip. arXiv preprint arXiv:2211.07864, 2022. [53] Canh T Dinh, Nguyen Tran, and Josh Nguyen. Personalized federated learning with moreau envelopes. Advances in Neural Information Processing Systems, 33:21394–21405, 2020. [54] Alysa Ziying Tan, Han Yu, Lizhen Cui, and Qiang Yang. Towards personalized federated learning. IEEE Transactions on Neural Networks and Learning Systems, 2022. [55] Yuanyishu Tian, Yao Wan, Lingjuan Lyu, Dezhong Yao, Hai Jin, and Lichao Sun. Fedbert: When federated learning meets pre-training. ACM Transactions on Intelligent Systems and Technology (TIST), 13(4):1–26, 2022. [56] Dustin Tran, Jeremiah Liu, Michael W Dusenberry, Du Phan, Mark Collier, Jie Ren, Kehang Han, Zi Wang, Zelda Mariet, Huiyi Hu, et al. Plex: Towards reliability using pretrained large model extensions. arXiv preprint arXiv:2207.07411, 2022. [57] Boxin Wang, Yibo Jacky Zhang, Yuan Cao, Bo Li, H Brendan McMahan, Sewoong Oh, Zheng Xu, and Manzil Zaheer. Can public large language models help private cross-device federated learning? arXiv preprint arXiv:2305.12132, 2023. [58] Jianyu Wang, Qinghua Liu, Hao Liang, Gauri Joshi, and H Vincent Poor. Tackling the objective inconsistency problem in heterogeneous federated optimization. Advances in neural information processing systems, 33:7611–7623, 2020. [59] Jianyu Wang, Zachary Charles, Zheng Xu, Gauri Joshi, H Brendan McMahan, Maruan Al- Shedivat, Galen Andrew, Salman Avestimehr, Katharine Daly, Deepesh Data, et al. A field guide to federated optimization. arXiv preprint arXiv:2107.06917, 2021. [60] Kangkang Wang, Rajiv Mathews, Chloé Kiddon, Hubert Eichner, Françoise Beaufays, and Daniel Ramage. Federated evaluation of on-device personalization. arXiv preprint arXiv:1910.10252, 2019. 13 [61] Xiaoyang Wang, Han Zhao, Klara Nahrstedt, and Oluwasanmi O Koyejo. Robust and personal- ized federated learning with spurious features: an adversarial approach. 2021. [62] Yizhong Wang, Swaroop Mishra, Pegah Alipoormolabashi, Yeganeh Kordi, Amirreza Mirzaei, Anjana Arunkumar, Arjun Ashok, Arut Selvan Dhanasekaran, Atharva Naik, David Stap, et al. Super-naturalinstructions: Generalization via declarative instructions on 1600+ nlp tasks. arXiv preprint arXiv:2204.07705, 2022. [63] Orion Weller, Marc Marone, Vladimir Braverman, Dawn Lawrie, and Benjamin Van Durme. Pretrained models for multilingual federated learning. arXiv preprint arXiv:2206.02291, 2022. [64] Mitchell Wortsman, Gabriel Ilharco, Samir Ya Gadre, Rebecca Roelofs, Raphael Gontijo-Lopes, Ari S Morcos, Hongseok Namkoong, Ali Farhadi, Yair Carmon, Simon Kornblith, et al. Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time. In International Conference on Machine Learning, pages 23965–23998. PMLR, 2022. [65] Mitchell Wortsman, Gabriel Ilharco, Jong Wook Kim, Mike Li, Simon Kornblith, Rebecca Roelofs, Raphael Gontijo Lopes, Hannaneh Hajishirzi, Ali Farhadi, Hongseok Namkoong, et al. Robust fine-tuning of zero-shot models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 7959–7971, 2022. [66] Shanshan Wu, Tian Li, Zachary Charles, Yu Xiao, Ziyu Liu, Zheng Xu, and Virginia Smith. Motley: Benchmarking heterogeneity and personalization in federated learning. In NeurIPS Workshop on Federated Learning, 2022. [67] Qiang Yang, Yang Liu, Tianjian Chen, and Yongxin Tong. Federated machine learning: Concept and applications. ACM Transactions on Intelligent Systems and Technology (TIST), 10(2):1–19, 2019. [68] Tao Yu, Eugene Bagdasaryan, and Vitaly Shmatikov. Salvaging federated learning by local adaptation. arXiv preprint arXiv:2002.04758, 2020. [69] Jianyi Zhang, Saeed Vahidian, Martin Kuo, Chunyuan Li, Ruiyi Zhang, Guoyin Wang, and Yiran Chen. Towards building the federated gpt: Federated instruction tuning. arXiv preprint arXiv:2305.05644, 2023. [70] Jingzhao Zhang, Sai Praneeth Karimireddy, Andreas Veit, Seungyeon Kim, Sashank Reddi, Sanjiv Kumar, and Suvrit Sra. Why are adaptive methods good for attention models? Advances in Neural Information Processing Systems, 33:15383–15393, 2020. [71] Tuo Zhang, Tiantian Feng, Samiul Alam, Mi Zhang, Shrikanth S Narayanan, and Salman Avestimehr. Gpt-fl: Generative pre-trained model-assisted federated learning. arXiv preprint arXiv:2306.02210, 2023. [72] Xuechen Zhang, Mingchen Li, Xiangyu Chang, Jiasi Chen, Amit K Roy-Chowdhury, Ananda Theertha Suresh, and Samet Oymak. Fedyolo: Augmenting federated learning with pretrained transformers. arXiv preprint arXiv:2307.04905, 2023. [73] Haodong Zhao, Wei Du, Fangqi Li, Peixuan Li, and Gongshen Liu. Fedprompt: Communication- efficient and privacy-preserving prompt tuning in federated learning. In ICASSP 2023-2023 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 1–5. IEEE, 2023. 14 A Formal Problem Setup Federated prompt tuning. We consider a federated learning scenario consisting of n clients that communicate with a central server. For every i ∈ [n], Client i has a dataset Di := {(xi,j, yi,j)}mi j=1 consisting of mi query-target pairs (xi,j, yi,j), where each query xi,j and target yi,j is a variable-length text sequence. All clients also have a copy of a language model with parameters θ, a tokenizer τ mapping text to a list of one-hot encodings of tokens, and a token embedding matrix E ∈ Re×v, where e is the embedding dimension and v is the vocabulary size. When provided an input x, the language model computes the conditional distribution of tokenized targets given the embedding of the tokenized input query, namely Pθ(τ (Y )|Eτ (x)), in order to generate text predictions. A natural idea to more accurately estimate the conditional distribution of τ (Y ) is to add text (a prompt) p to the input query that provides information about the relationship between inputs and targets for each task at hand, such as instructions or examples of gold-standard (x, y) pairs. In other words, the idea is that Pθ(τ (Y )|Eτ ([p, x])) ≡ Pθ(τ (Y )|[Eτ (p), Eτ (x)]) should be a more accurate estimation of the true conditional distribution of Y given x for carefully chosen p. This approach is known as in-context learning or prompt engineering and has led to many successful adaptations of LLMs [2]. However, these discrete text prompts cannot be easily optimized, and restricting the embedded prompt Eτ (p) to columns in E limits the information it can convey about the relationship between Y and X. Prompt tuning [32] addresses these concerns by optimizing a "soft" prompt in embedding space. For some number of tokens k, prompt tuning aims to learn a matrix P ∈ Re×k that conditions the model for more accurate predictions when prepended to the embedding of the input text tokens, In this case, the gradient of the loss of i.e. Pθ(τ (Y )|[P, Eτ (x)]) with respect to P can be easily computed via backpropagation, and we can optimize P with standard gradient-based methods. This loss is the cross-entropy loss, in particular, the loss as a function of P for Client i in our federated setting is: the new model is given by Pθ(τ (Y )|[P, Eτ (x)]). Li(P ) := − 1 mi mi(cid:88) j=1 log(Pθ(τ (yi,j)|[P, Eτ (xi,j)])) (1) (cid:80)n During federated training, the server aims to minimize the average loss across clients, namely i=1 Li(P ), and towards this end can apply standard Federated Learning algorithms such L(P ) := 1 n as FedAvg and FedSGD. Importantly, only the prompt embedding matrix P must be communicated between server and clients, as depicted in Figure 1. i Personalization and robustness. Due to the heterogeneity of the client datasets D1, . . . , Dn, the global prompt Pglob found by running federated learning on L(P ) may not perform well on each client's local data. This can be addressed by personalizing Pglob to each client. Formally, we consider a new set of ntest clients with datasets Dn+1, . . . , Dn+ntest that are split into training and test sets, for all i = n + 1, . . . , n + ntest. During personalization, Client i updates i.e. Di = Dtrain ∪ Dtest i Pglob using its local training dataset Dtrain to obtain a prompt Pi. The level of personalization . However, it is also of interest to know how robust achieved by this prompt is evaluated using Dtest i Pglob is to personalization, as we do not want Pi to have forgotten all of the global information it acquired during federated training. So, Pi is also evaluated on a global test dataset compiled across all client test datasets Dtest to obtain a robustness score. These local personalization and robustness scores are ultimately aggregated across clients and used for final evaluation of the federated algorithm used to obtain Pglob. n , . . . , Dtest n+ntest i 15 Table 2: Training learning rates. All learning rates were tuned in {0.01, 0.1, 1, 10} and chosen based on the global validation score they led to during training. The resulting values are shown here, as (server learning rate, client learning rate) if applicable. Centralized training used Adam with learning rate 1, tuned in the same set. Algorithm HHF-SNI MHF-SNI LHF-SNI FedAvg(Adam) - prompt length 10 FedAvg(SGD) - prompt length 10 FedSGD - prompt length 10 FedSGD-LB - prompt length 10 (1, 0.1) (1, 10) 1 0.01 (0.1, 1) (0.1, 10) 1 0.1 (0.1, 1) (1, 10) 1 0.1 B Additional Dataset Details Of the 76 total task types in SNI, we excluded three types (Punctuation Error Detection, Paper Review, Speaker Relation Classification) because they did not have a sufficient amount of data for one client and one type, Mathematics, because the PaLM tokenizer cannot properly interpret numerical text input. The data was split into train/validation/test sets by randomly selecting 10% of the remaining task types each for validation and testing, and designating the rest for training. The test task types are [Irony Detection, Mathematics, Text Completion, Explanation, Overlap Extraction, Question Generation, Dialogue Act Recognition, Gender Classification] and the validation types are [Answer Verification, Information Extraction, Dialogue Generation, Commonsense Classification, Word Relation Classification, Answerability Classification, Sentence Ordering]. There are 326 total test clients and 326 total validation clients, although we only use 32 test clients, sampled uniformly from the full set of 326 test clients, in our results. C Further Experiments and Details Hyperparameters. In all training runs, we initialized the prompts by sampling each element i.i.d. from N (0, 0.25), noting that results from [32] showed that prompt initialization does not significantly affect performance at the model scale we consider (∼ 1010 parameters). We tried prompt lengths of 5, 10, and 20, and saw that length 10 generally outperformed length 5, but there was no improvement going from length 10 to length 20, (see Figure 10) so we used length 10 for all other runs. We tuned client and server learning rates in {10−2, 10−1, 100, 101} using the global validation set separately for each algorithm and each of the three training partitions, plus centralized. The resulting learning rates are found in Table 3. We tuned weight decay parameter in {0, 10−2}, and Adam epsilon parameter in {10−8, 10−6, 10−4} on HHF-SNI and the centralized dataset, and observed that no weight decay and Adam ε = 10−8 worked best in all cases. We used β1 = 0.99 and β2 = 0.999 for Adam. In each trial, we used the prompt that achieved the highest global validation score during training for personalization. Regarding model and evaluation parameters, we set the maximum input query length to 1024 tokens and output length to 128 tokens for training and 10 tokens for evaluation, and the decoding temperature to 0, following [62]. For examples with multiple targets, we take the max score over targets, again following [62]. C.1 Additional results In this section we provide additional empirical results. Unless otherwise noted, all experiments run personalization with Adam on a dataset of size 256. 16 Table 3: Adam personalization learning rates. Personalization learning rates were tuned in {10−3, 10−2, 10−1.5, 10−1}. Algorithm HHF-SNI MHF-SNI LHF-SNI FedAvg(Adam) - High Computation 10−2 FedAvg(Adam) - Low Computation 10−1 FedAvg(SGD) - High Computation 10−2 FedAvg(SGD) - Low Computation 10−1 FedSGD - High Computation 10−1.5 FedSGD - Low Computation 10−1 FedSGD-LB - High Computation 10−3 Centralized - High Computation 10−2 Random-Gaussian - High Computation 10−2 Random-Word - High Computation 10−2 10−2 10−1 10−3 10−2 10−2 10−1 10−3 10−2 10−2 10−2 10−2 10−1 10−2 10−1 10−2 10−1 10−3 10−2 10−2 10−2 Figure 7: Mean global and local scores across test clients during personalization with varying learning rates from a prompt trained on HHF-SNI by FedSGD. All runs besides those with the largest two learning rates are run for 100 epochs, and otherwise 20 epochs. Role of personalization learning rate with FedSGD-trained prompts. In Figure 7 we verify that using a smaller personalization learning rate improves the personalization-robustness trade-off for FedSGD-trained prompts, just like we observed for FedAvg(Adam)-trained prompts in Figure 4(Left). Again, increased robustness (higher global scores) comes at the cost of additional personalization epochs required to reach high local scores. Variation across training runs. In Figures 8 and 9 we plot versions of Figure 5 with different random seeds for training. In each case the takeaway is the same as Observations 3a,b: FedAvg(Adam) outperforms FedAvg(SGD), and FedAvg(Adam) generally outperforms FedSGD, especially when trained on low-heterogeneity data and especially in terms of global scores. The one case in which FedSGD yields a better personalization-robustness tradeoff is on HHF-SNI (high heterogeneity) with seed 0 (Figure 8) due to higher local scores for FedSGD. SGD as personalization optimizer. One may suspect that the improvement of FedAvg(Adam) over FedAvg(SGD) in the previous results is due to FedAvg(Adam) using the same client optimizer as the personalization optimizer (Adam). However, Figure 10 we show that the relative performance 17 0.220.240.260.280.300.32Mean Local Score0.1700.1750.1800.1850.1900.195Mean Global ScoreFedSGD: Personalization Learning Ratelr=1e-0.5, eval every 1 epochlr=1e-1, eval every 1 epochlr=1e-1.5, eval every 2 epochslr=1e-2, eval every 4 epochslr=1e-3, eval every 4 epochslr=1e-4, eval every 4 epochs Figure 8: Version of Figure 5 with random seed 0. Mean global and local scores across test clients evaluated every 4 epochs during 100 epochs of personalization (High Computation regime) starting from prompts pre-trained by FedAvg(Adam), FedAvg(SGD) and FedSGD with random seed 0 on (Left) HHF-SNI, (Center) MHF-SNI, and (Right) LHF-SNI. Figure 9: Version of Figure 5 with random seed 1. Mean global and local scores across test clients evaluated every 4 epochs during 100 epochs of personalization (High Computation regime) starting from prompts pre-trained by FedAvg(Adam), FedAvg(SGD) and FedSGD with random seed 1 on (Left) HHF-SNI, (Center) MHF-SNI, and (Right) LHF-SNI. 18 0.180.200.220.240.260.280.300.320.34Mean Local Score0.160.170.180.190.200.210.22Mean Global ScoreHHF-SNI -- Seed 0FedAvg(Adam)FedAvg(SGD)FedSGD0.180.200.220.240.260.280.300.320.34Mean Local Score0.160.170.180.190.200.210.22Mean Global ScoreMHF-SNI -- Seed 0FedAvg(Adam)FedAvg(SGD)FedSGD0.180.200.220.240.260.280.300.320.34Mean Local Score0.160.170.180.190.200.210.22Mean Global ScoreLHF-SNI -- Seed 0FedAvg(Adam)FedAvg(SGD)FedSGD0.180.200.220.240.260.280.300.320.34Mean Local Score0.160.170.180.190.200.210.22Mean Global ScoreHHF-SNI -- Seed 1FedAvg(Adam)FedAvg(SGD)FedSGD0.180.200.220.240.260.280.300.320.34Mean Local Score0.160.170.180.190.200.210.22Mean Global ScoreMHF-SNI -- Seed 1FedAvg(Adam)FedAvg(SGD)FedSGD0.180.200.220.240.260.280.300.320.34Mean Local Score0.160.170.180.190.200.210.22Mean Global ScoreLHF-SNI -- Seed 1FedAvg(Adam)FedAvg(SGD)FedSGD Figure 10: Personalization with SGD. Mean global and local scores across test clients evaluated every epoch during 10 epochs of personalization with SGD, starting from prompts pre-trained by FedAvg(Adam) and FedAvg(SGD) on HHF-SNI. Figure 11: Impact of fewer personalization instances. Global and local scores during personalization on either 256 or 64 instances (examples) starting from prompts pre-trained on (left) HHF-SNI, (center) MHF-SNI, and (right) LHF-SNI. For 256 instances, 100 epochs are executed, and for 64 instances, 224 epochs are executed (High Computation regime). of FedAvg(Adam) and FedAvg(SGD) does not change when SGD is used as the personalization optimizer rather than Adam. Impact of fewer personalization samples. In Figure 11 we plot results from personalization with varying number of of examples per client, namely 64 and 256. With only 64 samples, late in training overfitting to the training set occurs to extent that even local scores decrease. Further, the best local score for 64 examples is smaller than the best local score for 256 examples by about 0.01-0.02 for each heterogeneity level. However, fewer local samples reduces local scores more so than global scores, and early in training the personalization-robustness trade-off is roughly equivalent to that with 256 examples. In Figure 12, we compare the personalization vs robustness trade-off for FedAvg(Adam), Fe- dAvg(SGD), and FedSGD-trained prompts with few instances (64) in the Low Computation rage (30 epochs). Note that this is more updates than the previously studied Low Computation cases, which ran for 10 epochs, but the total amount of computation is actually less because we are here running 19 0.200.220.240.260.280.300.32Mean Local Score0.120.140.160.180.20Mean Global ScoreP13n with SGD, 256 samples, 10 epochsFedAvg(Adam), p13n_lr=10FedAvg(SGD), p13n_lr=100FedAvg(SGD), p13n_lr=10FedAvg(SGD), p13n_lr=1FedAvg(SGD), p13n_lr=0.10.200.220.240.260.280.300.32Mean Local Score0.170.180.190.200.21Mean Global ScoreHigh Heterogeneity (HHF-SNI), FedAvg(Adam)256 examples, eval every 4 epochs64 examples, eval every 16 epochs0.200.220.240.260.280.300.32Mean Local Score0.170.180.190.200.21Mean Global ScoreMedium Heterogeneity (MHF-SNI), FedAvg(Adam)256 examples, eval every 4 epochs64 examples, eval every 16 epochs0.200.220.240.260.280.300.32Mean Local Score0.170.180.190.200.21Mean Global ScoreLow Heterogeneity (LHF-SNI), FedAvg(Adam)256 examples, eval every 4 epochs64 examples, eval every 16 epochs Figure 12: Low computation, 64 instances. Mean global and local scores across test clients evaluated every 3 epochs during personalization with 30 total epochs of 64 instances (samples) per epoch, from prompts pre-trained on (left) HHF-SNI, (center) MHF-SNI, and (right) LHF-SNI. epochs of 64 instances rather than 256 instances in the previous case. The relative ordering of performance among the three FL algorithms stays the same, with the exception of FedSGD arguably slightly outperforming FedAVg(Adam) in the heterogeneity case. Variants of FedSGD. In all previous experiments we have used the version of FedSGD that has the same client batch size (32) and number of active clients per round (32) as the FedAvg variants we experiment with, but executes 16x more communication rounds than the FedAvg variants (4800 rounds vs 1600 rounds) so that it sees the same total number of instances (since the FedAvg variants make 16 local updates per client per round, whereas FedSGD makes effectively only 1). Now, we experiment with a different version of FedSGD that multiplies the client batch size by 16 rather than the number of communication rounds. In particular, this version, which we call FedSGD-LargeBatch, uses a client batch size of 512, and samples 32 clients per round for 300 rounds. Like the other FL algorithms, it uses Adam as its server optimizer. Figure 13 shows that the original version of FedSGD with many rounds (referred to here as FedSGD-MR) far outperforms FedSGD-LB, implying that it is advantageous to do more updates with noisier gradients.rather thank fewer updates with less noisy gradients. Role of prompt length. In Figures 14, 15 and 16 we explore the effect of changing the prompt length for FedAvg(Adam), FedSGD and FedSGD-LB, respectively, in the High Computation personalization regime with 100 epochs of 256 samples. Prompt length 10 seems to be the sweet spot, as prompt length 5 gives the worst personalization vs robustness trade-off in all cases besides FedSGD-LB on HHF-SNI, and prompt length 20 provides clear improvement over prompt length 10 only in one case (FedSGD-LB on LHF-SNI), and can sometimes do significantly worse (as in the FedAvg(Adam) cases). The takeaway is similar to that in [32]: increasing the number of tokens in soft prompts improves performance up to some number of tokens, but beyond this there is no benefit to further increasing the prompt length. Variation in client performance. Thus far all of our results have been mean scores across 32 test clients. Now, we investigate the variation in performance across clients. In Figure 17, we plot each of the 32 test clients' scores pre- and post-personalization in the Low Computation regime with 10 epochs of personalization on 256 instances, starting from prompts trained by FedAvg(Adam) on HHF-SNI. With the exception of one outlying client, the width of the range of local scores is roughly equivalent before and after personalization, while there is a large variance in global scores 20 0.200.220.240.260.280.300.32Mean Local Score0.150.160.170.180.190.200.21Mean Global ScoreHHF-SNI, 64 samples, 30 epochsFedAvg(Adam)FedAvg(SGD)FedSGD0.200.220.240.260.280.300.32Mean Local Score0.150.160.170.180.190.200.21Mean Global ScoreMHF-SNI, 64 samples, 30 epochsFedAvg(Adam)FedAvg(SGD)FedSGD0.200.220.240.260.280.300.32Mean Local Score0.150.160.170.180.190.200.21Mean Global ScoreLHF-SNI, 64 samples, 30 epochsFedAvg(Adam)FedAvg(SGD)FedSGD Figure 13: FedSGD with many rounds vs large batch size. Mean global and local scores across test clients during personalization starting from prompts pre-trained by FedSGD with many rounds (FedSGD-MR, referred to as FedSGD in all other experiments) and FedSGD with large batch size (FedSGD-LB) on (left) HHF-SNI, (center) MHF-SNI, and (right) LHF-SNI. Figure 14: Role of prompt length – FedAvg(Adam). Mean global and local scores evalutated every 4 epochs during 100 epochs of personalization on 256 instances starting from prompts of varying lengths pre-trained by FedAvg(Adam) on (left) HHF-SNI, (center) MHF-SNI, and (right) LHF-SNI. Figure 15: Role of prompt length – FedSGD. Mean global and local scores evalutated every 4 epochs during 100 epochs of personalization on 256 instances starting from prompts of varying lengths pre-trained by FedSGD on (left) HHF-SNI, (center) MHF-SNI, and (right) LHF-SNI. 21 0.200.220.240.260.280.300.32Mean Local Score0.140.160.180.20Mean Global ScoreHigh Heterogeneity (HHF-SNI)FedSGD-MRFedSGD-LB0.200.220.240.260.280.300.32Mean Local Score0.140.160.180.20Mean Global ScoreMedium Heterogeneity (MHF-SNI)FedSGD-MRFedSGD-LB0.200.220.240.260.280.300.32Mean Local Score0.140.160.180.20Mean Global ScoreLow Heterogeneity (LHF-SNI)FedSGD-MRFedSGD-LB0.200.220.240.260.280.300.32Mean Local Score0.170.180.190.200.21Mean Global ScoreHHF-SNI, FedAvg(Adam)Prompt length 5Prompt length 10Prompt length 200.200.220.240.260.280.300.32Mean Local Score0.170.180.190.200.21Mean Global ScoreMHF-SNI, FedAvg(Adam)Prompt length 5Prompt length 10Prompt length 200.200.220.240.260.280.300.32Mean Local Score0.170.180.190.200.21Mean Global ScoreLHF-SNI, FedAvg(Adam)Prompt length 5Prompt length 10Prompt length 200.200.220.240.260.280.300.32Mean Local Score0.170.180.190.200.21Mean Global ScoreHHF-SNI, FedSGDPrompt length 5Prompt length 10Prompt length 200.200.220.240.260.280.300.32Mean Local Score0.170.180.190.200.21Mean Global ScoreMHF-SNI, FedSGDPrompt length 5Prompt length 10Prompt length 200.200.220.240.260.280.300.32Mean Local Score0.170.180.190.200.21Mean Global ScoreLHF-SNI, FedSGDPrompt length 5Prompt length 10Prompt length 20 Figure 16: Role of prompt length – FedSGD-LB. Mean global and local scores evalutated every 4 epochs during 100 epochs of personalization on 256 instances starting from prompts of varying lengths pre-trained by FedSGD-LB on (left) HHF-SNI, (center) MHF-SNI, and (right) LHF-SNI. Figure 17: Per-client global and local scores before and after personalization (p13n) consisting of 10 epochs on 256 examples from prompts pre-trained by FedAvg(Adam) on HHF-SNI. 22 0.180.200.220.240.260.280.300.32Mean Local Score0.120.140.160.180.20Mean Global ScoreHHF-SNI, FedSGD-LBPrompt length 5Prompt length 10Prompt length 200.180.200.220.240.260.280.300.32Mean Local Score0.120.140.160.180.20Mean Global ScoreMHF-SNI, FedSGD-LBPrompt length 5Prompt length 10Prompt length 200.180.200.220.240.260.280.300.32Mean Local Score0.120.140.160.180.20Mean Global ScoreLHF-SNI, FedSGD-LBPrompt length 5Prompt length 10Prompt length 200.00.10.20.30.40.50.60.7Local Score0.140.160.180.200.22Global ScoreHHF-SNI, FedAvg(Adam) client scores pre-, post-p13n w/ 256 samples, 10 epochsPre-P13nPost-P13n Figure 18: Global and local score 90th and 10th percentiles across test clients during personalization with 100 epochs of 256 instances from prompts pre-trained on (left) HHF-SNI, (center) MHF-SNI, and (right) LHF-SNI. Scores are evaluated every 4 epochs. post-personalization. In Figure 18, we plot 90th and 10th percentile client global and local scores during personaliza- tion in the High Computation regime with 100 epochs of 256 instances from prompts trained by FedAvg(Adam), FedAvg(SGD), and FedSGD. That is, instead of each point representing (mean local score, mean global score) across clients during some personalization epoch, they instead represent (90th percentile local score, 90th percentile global score) across clients during some personalization epoch (and likewise for the 10th percentile). This yields a number of takeaways: 1) The worst local scores are roughly the same for all algorithms and during all personalization epochs, indicating that there are some very hard clients; 2) for all algorithms, the worst global scores drop significantly during personalization; 3) in contrast, the best global scores do not change much during personalization, and the best local scores increase significantly. C.2 Additional personalization heuristics Figure 19 shows the same results as Figure 6 plus results for three additional personalization approaches: • Freeze First. Recall that P is a matrix of size prompt length (in tokens) by embedding dimension, where here the prompt length is 10. For "Freeze First", we freeze the first 8 rows (tokens) and only update the last two rows of Pi (starting from Pglob) during personalization. • Freeze Last. Likewise, for "Freeze Last", we only update the first two rows of Pi. Neither "Freeze First" nor "Freeze Last" confer any improvement to the personalization-robustness trade-off. • Local/Global Genie. These scores are the scores of a genie that knows the whether the personalized or global prompt will result in a prediction with larger score for a particular input and target, and uses the prompt with higher score for that input. It is equivalent to running inference twice for every input, once with the personalized prompt and once with the global prompt, and recording the max score among the two predictions, given the target. This is not a realistic personalization method because in practice the target is unknown. Nevertheless, we find it to be a valuable measure of the combined capabilities of personalized and global prompts, i.e. the combined information between the personalized and global prompts. The very strong performance of this genie suggests that personalization-robustness trade-offs can 23 0.10.20.30.40.5Mean Local Score0.140.150.160.170.180.190.200.210.22Mean Global ScoreHHF-SNI, 90th and 10th percentile client scoresFedAvg(Adam) - 90th%FedAvg(Adam) - 10th%FedAvg(SGD) - 90th%FedAvg(SGD) - 10th%FedSGD - 90th%FedSGD - 10th%0.10.20.30.40.5Mean Local Score0.140.150.160.170.180.190.200.210.22Mean Global ScoreMHF-SNI, 90th and 10th percentile client scoresFedAvg(Adam) - 90th%FedAvg(Adam) - 10th%FedAvg(SGD) - 90th%FedAvg(SGD) - 10th%FedSGD - 90th%FedSGD - 10th%0.10.20.30.40.5Mean Local Score0.140.150.160.170.180.190.200.210.22Mean Global ScoreLHF-SNI, 90th and 10th percentile client scoresFedAvg(Adam) - 90th%FedAvg(Adam) - 10th%FedAvg(SGD) - 90th%FedAvg(SGD) - 10th%FedSGD - 90th%FedSGD - 10th% Figure 19: Additional personalization heuristics – Low Computation. Mean local and global scores during 10 epochs of personalization with various heuristics starting from prompts trained by FedAvg(Adam) on (Left) HHF-SNI, (Center) MHF-SNI, and (Right) LHF-SNI. be drastically improved by appropriately selecting whether to use the personalized prompt or global prompt for every input query (in fact, there would no longer be a trade-off – both personalized and global scores would increase). To train the personalized prompt, we we run vanilla personalization (i.e. λ = 0 in Figure 19). 24 0.200.220.240.260.280.300.320.34Mean Local Score0.180.190.200.210.220.230.24Mean Global ScoreHHF-SNI=0=104=103Model Averaging, =0Model Averaging, =103Freeze FirstFreeze LastLocal/Global Genie0.200.220.240.260.280.300.320.34Mean Local Score0.180.190.200.210.220.230.24Mean Global ScoreMHF-SNI=0=104=103Model Averaging, =0Model Averaging, =103Freeze FirstFreeze LastLocal/Global Genie0.200.220.240.260.280.300.320.34Mean Local Score0.180.190.200.210.220.230.24Mean Global ScoreLHF-SNI=0=104=103Model Averaging, =0Model Averaging, =103Freeze FirstFreeze LastLocal/Global Genie
http://arxiv.org/abs/2310.04625v1
"2023-10-06T23:37:24"
"2023-10-06T23:37:24"
Copy Suppression: Comprehensively Understanding an Attention Head
We present a single attention head in GPT-2 Small that has one main role across the entire training distribution. If components in earlier layers predict a certain token, and this token appears earlier in the context, the head suppresses it: we call this copy suppression. Attention Head 10.7 (L10H7) suppresses naive copying behavior which improves overall model calibration. This explains why multiple prior works studying certain narrow tasks found negative heads that systematically favored the wrong answer. We uncover the mechanism that the Negative Heads use for copy suppression with weights-based evidence and are able to explain 76.9% of the impact of L10H7 in GPT-2 Small. To the best of our knowledge, this is the most comprehensive description of the complete role of a component in a language model to date. One major effect of copy suppression is its role in self-repair. Self-repair refers to how ablating crucial model components results in downstream neural network parts compensating for this ablation. Copy suppression leads to self-repair: if an initial overconfident copier is ablated, then there is nothing to suppress. We show that self-repair is implemented by several mechanisms, one of which is copy suppression, which explains 39% of the behavior in a narrow task. Interactive visualisations of the copy suppression phenomena may be seen at our web app https://copy-suppression.streamlit.app/
[ "Callum McDougall", "Arthur Conmy", "Cody Rushing", "Thomas McGrath", "Neel Nanda" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04625v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04625v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.CL" ]
Preprint. Under review. COPY SUPPRESSION: COMPREHENSIVELY UNDERSTANDING AN ATTENTION HEAD Callum McDougall1,†, Arthur Conmy1,†, Cody Rushing2,†, Thomas McGrath1,∗, Neel Nanda3 1Independent. 2University of Texas at Austin. 3Google DeepMind. †Joint contribution. Correspondence to cal.s.mcdougall@gmail.com and neelnanda@google.com ABSTRACT We present a single attention head in GPT-2 Small that has one main role across the entire training distribution. If components in earlier layers predict a certain token, and this token appears earlier in the context, the head suppresses it: we call this copy suppression. Attention Head 10.7 (L10H7) suppresses naive copying behavior which improves overall model calibration. This explains why multiple prior works studying certain narrow tasks found negative heads that systematically favored the wrong answer. We uncover the mechanism that the Negative Heads use for copy suppression with weights-based evidence and are able to explain 76.9% of the impact of L10H7 in GPT-2 Small. To the best of our knowledge, this is the most comprehensive description of the complete role of a component in a language model to date. One major effect of copy suppression is its role in self-repair. Self-repair refers to how ablating crucial model components results in downstream neural network parts compensating for this ablation. Copy suppres- sion leads to self-repair: if an initial overconfident copier is ablated, then there is nothing to suppress. We show that self-repair is implemented by several mecha- nisms, one of which is copy suppression, which explains 39% of the behavior in a narrow task. Interactive visualizations of the copy suppression phenomena may be seen at our web app https://copy-suppression.streamlit.app/. 1 INTRODUCTION 3 2 0 2 t c O 6 ] G L . s c [ 1 v 5 2 6 4 0 . 0 1 3 2 : v i X r a Figure 1: L10H7's copy suppression mechanism (Steps 1-3 are described below and the mechanism _∗Work partially done at Google DeepMind is examined in Section 3). 1 " love"" and"" war"... All's fair in ' love'Layer 10Head 71.Prior copying2. Attention3. Suppression ' love'?The main role of head L10H7 in GPT-2 Smallis copy suppression.+key ' war'+ ' war'++++=Correct predictionqueryoutput Preprint. Under review. Mechanistic interpretability research aims to reverse engineer neural networks into the algorithms that network components implement (Olah, 2022). A central focus of this research effort is the search for explanations for the behavior of model components, such as circuits (Cammarata et al., 2020; Elhage et al., 2021), neurons (Radford et al., 2017; Bau et al., 2017; Gurnee et al., 2023) and attention heads (Voita et al., 2019; Olsson et al., 2022). However, difficulties in understanding machine learning models has often limited the breadth of these explanations or the complexity of the components involved (R ̈auker et al., 2023). In this work we explain how "Negative Heads" (which include 'negative name mover heads' from Wang et al. (2023) and 'anti-induction heads' from Olsson et al. (2022)) function on the natural language training distribution in GPT-2 Small. Previous work found that Negative Heads system- atically write against the correct completion on narrow datasets, and we explain these observations as instances of copy suppression. Copy suppression accounts for a majority of the head's behavior and reduces the model's overall loss. To the best of our knowledge, our explanation is the most comprehensive account of the function of a component in a large language model (Section 5 reviews related literature). We define Negative Heads as attention heads which primarily reduce the model's confidence in particular token completions. We show that the main role of Negative Heads in GPT-2 Small is copy suppression (Figure 1), which is defined by three steps: 1. Prior copying. Language model components in early layers directly predict that the next token is one that already appears in context, e.g that the prefix "All's fair in love and" is completed with " love". 2. Attention. Copy suppression heads detect the prediction of a copied token and attend back to the previous instance of this token (" love"). 3. Suppression. Copy suppression heads write directly to the model's output to decrease the logits on the copied token. By lowering incorrect logits, steps 1–3 can increase the probability on correct completions (e.g " war") and decrease model loss.1 Our central claim is that at least 76.9% of the role of attention head L10H7 on GPT-2 Small's training distribution is copy suppression. However, we do not explain precisely when or how much copy suppression is activated in different contexts. Neverthe- less, to the best of our knowledge, there is no prior work which has explained the main role of any component in a large language model in terms of its input stimulus and specific downstream effect across a whole training distribution. Explaining language models components across wide distributions in mechanistic detail may be important for engineering safe AI systems. While interpreting parts of language models on narrow distributions (Hanna et al., 2023; Heimersheim & Janiak, 2023; Wang et al., 2023) may be easier than finding complete explanations, researchers can be misled by hypotheses about model components that do not generalize (Bolukbasi et al., 2021). Mechanistically understanding models could fix problems that arise from opaque training processes, as mechanisms can predict behavior on off- distribution and adversarial inputs rather than merely those that arise in training (Mu & Andreas, 2020; Goh et al., 2021; Carter et al., 2019). Mechanistic interpretability research is difficult to automate and scale (R ̈auker et al., 2023), and understanding negative and backup heads2 could be crucial for further progress. Many approaches to automating interpretability use ablations - removing a neural network component and measuring the effect of this intervention (Conmy et al., 2023; Wu et al., 2023; Bills et al., 2023; Chan et al., 2022). Ideally, ablations would provide accurate measures of the importance of model components on given tasks, but negative and backup components complicate this assumption. Firstly, negative components may be ignored by attribution methods that only find the positive components that complete tasks. This means that these attribution methods will not find faithful explanations (Jacovi & Goldberg, 2020) of model behavior. Secondly, backup components may counteract the effects of ablations and hence cause unreliable importance measurements. 1We recommend using our web app https://copy-suppression.streamlit.app/ to under- stand L10H7's behavior interactively. 2We define backup heads (see Section 4) as attention heads that respond to the ablation of a head by imitating that original behavior. 2 Preprint. Under review. Prompt ... Millions of Adobe users picked easy-to- guess Adobe passwords ... tourist area in Beijing. A university in ... Beijing Northeastern ... successfully stopped cocaine and co- ... caine alcohol ... Source token Incorrect com- pletion Correct completion " Adobe" " Adobe" " passwords" " Beijing" " Beijing" " Northeastern" " cocaine" " cocaine" " alcohol" Table 1: Dataset examples of copy suppression, in cases where copy suppression behaviour de- creases loss by suppressing an incorrect completion. In this work we rigorously reverse-engineer attention head L10H7 in GPT-2 Small to show that its main role on the training distribution is copy suppression. We do not know why language models form copy suppression components, but in Appendices A and D we discuss ongoing research into some hypotheses. Appendix B provides evidence that copy suppression occurs in models trained without dropout. Our main contributions are: 1. Finding the main role of an attention head in an LLM on an entire training distribution (Section 2), and verifying this hypothesis (Section 3.3). 2. Using novel weights-based arguments to explain the role of language model components (Section 3). 3. Applying our mechanistic understanding to the practically important self-repair phe- nomenon, finding that copy suppression explains 39% of self-repair in one setting (Sec- tion 4). 2 NEGATIVE HEADS COPY SUPPRESS In this section we show that Negative Head L10H7 suppresses copying across GPT-2 Small's training distribution. We show that copy suppression explains most of L10H7's role in the model, and defer evaluation of our mechanistic understanding to Section 3.3. We use the logit lens (nostalgebraist, 2020) technique to measure what intermediate model components predict, and use mean ablation to delete internal model activations. 2.1 BEHAVIORAL RESULTS We can find where L10H7 has the largest impact by looking at the OpenWebText3 examples where mean ablating L10H7's effect on model outputs increases loss. Specifically, we sampled from the top 5% of completions where L10H7 had greatest effect as these accounted for half of the attention head's loss reducing effect across the dataset. 80% of the sampled completions were examples of copy suppression when we operationalized the three qualitative copy suppression steps from Section 1 by three corresponding conditions: 1. The model's predictions at the input to L10H7 included a token which appeared in context as one of the top 10 most confident completions (as measured by the logit lens); 2. The source token was one of the top 2 tokens in context that L10H7 attended to most; 3. The 10 tokens that L10H7 decreased logits for the most included the source token. Examples can be found in the Table 1. These results and more can also be explored on our interactive web app (https://copy-suppression.streamlit.app/). 2.2 HOW DOES L10H7 AFFECT THE LOSS? To investigate the relative importance of the direct and indirect effect of L10H7 on the model's loss, we decompose its effect into a set of different paths (Elhage et al., 2021; Goldowsky-Dill et al., 3OpenWebText (Gokaslan et al., 2019) is an open source replication of GPT-2's pretraining distribution. 3 Preprint. Under review. 2023), and measure the effect of ablating certain paths. We measure the effect on model's loss as well as the KL divergence to the model's clean predictions. Results can be seen in Figure 2. Fortunately, we find that most of L10H7's effect on loss was via the direct path to the final logits. This suggests that a) explaining the direct path from L10H7 to outputs would explain the main role of the attention head in the model and b) KL divergence is correlated with the increase in loss of ablated outputs. Our goal is to show that our copy suppression mechanism faithfully reflects L10H7's behaviour (Section 3.3) and therefore in the rest of our main text, we focus on minimizing KL divergence, which we discuss further in Section 3.3.1. Figure 2: Loss effect of L10H7 via different paths. Grey paths denote ablated paths. Figure 3: Distribution of ranks of di- agonal elements of Eqn. (2). 3 HOW NEGATIVE HEADS COPY SUPPRESS In this section, we show that copy suppression explains 76.9% of L10H7's behavior on OpenWeb- Text. To reach this conclusion, we perform the following set of experiments: 1. In Section 3.1, we analyse the OV circuit, and show that the head suppresses the prediction of 84.70% of tokens which it attends to. 2. In Section 3.2, we analyse the QK circuit, and show that the head attends to the token which the model is currently predicting across 95.72% of the model's vocabulary. 3. In Section 3.3, we define a form of ablation (CSPA) which deletes all of L10H7's function- ality except 1. and 2., and preserves 76.9% of its effect. In step 3 we project L10H7's outputs onto the unembedding vectors, but apply a filtering operation (that is weaker than a weights-based projection) to the QK circuit, as described in Section 3.3.1. We also performed an ablation that involved projecting the query vectors onto unembedding vec- tors present in the residual stream (Appendix N), but found that this did not recover as much KL divergence, likely due to issues discussed in Section 4. In Section 3.1-3.2 we use MLP0(WE) rather than WE as the model's 'effective embedding' as we discuss in Appendix I and compare with other works. 3.1 OV CIRCUIT To understand L10H7's output, we study the simple setting where the attention head i) only at- tends to a single source token and ii) the source token position only contains information about one token. We can then look at what effect L10H7 has on the model's logits for each token in the vo- cabulary. This motivates studying L10H7's OV circuit (Elhage et al., 2021), with MLP0 included: WU W L10H7 OV MLP0(WE) ∈ Rnvocab×nvocab (1). The OV circuit (1) studies the impact that L10H7 has on all output tokens, given it attended to the effective embedding of a particular input token. The ith column of (1) is the vector of logits added at 4 +0.0016+0.01020.00300.0032NoneIndirect pathsDirect path3.033.0323.0343.0363.0383.043.0423.04400.0050.010.0150.02Ablating different paths from L10H7LossKL Divergence151015≥20020406080100Query and Key Inputs:Q = MLP 0 (W E )K = MLP 0 (W E )Q = W U K = MLP 0 (W E )Distribution of token ranks in QK circuitToken rankPercentage of Model Vocabulary Preprint. Under review. any destination token which attends to the ith token in the model's vocabulary (ignoring layernorm scaling). If L10H7 is suppressing the tokens that it attends to, then the diagonal elements of (1)) will consistently be the most negative elements in their columns. This is what we find: 84.70% of the tokens in GPT-2 Small's vocabulary have their diagonal elements as one of the top 10 most negative values in their columns, and 98.86% of tokens had diagonal elements in the bottom 5%. This suggests that L10H7 is copy suppressing almost all of the tokens in the model's vocabulary. This effect can also be seen in practice. We filtered for (source, destination token) pairs in Open- WebText where attention in L10H7 was large, and found that in 78.24% of these cases the source was among the 10 most suppressed tokens from the direct effect of L10H7 (full experimental details in Appendix F). This indicates that our weights-based analysis of L10H7's OV circuit does actually tell us about how the head behaves on real prompts. 3.2 QK CIRCUIT Having understood L10H7's outputs in a controlled setting, we need to understand when the head is activated by studying its attention patterns. In a similar manner to Section 3.1 we study L10H7's attention in the simple setting where i) the query input is equal to the unembedding vector for a single token and ii) the key input is the MLP0 output for another single token, i.e we study the QK circuit WU W L10H7 QK MLP0(WE) ∈ Rnvocab×nvocab (Eqn. (2)).4 Copy suppression (Section 1) suggests that L10H7 has large attention when i) a token is confidently predicted at the query position and ii) that token appeared in the context so is one of the key vectors. Therefore we expect the largest elements of each row of Eqn. (2) to be the diagonal elements of this matrix. Indeed, in Figure 3 (orange bars) we find that 95.72% of diagonal values in this matrix were the largest in their respective rows. However, this result alone doesn't imply that copying (the first step of the three copy suppression steps in Section 1) explains L10H7's attention. This is because GPT-2 Small uses the same matrix for embeddings and unembeddings, so L10H7 could simply be matching similar vectors at query and keyside (for example, in a 'same matching' QK matrix (Elhage et al., 2021)) Therefore in Figure 3 (blue bars) we also compare to a baseline where both query and keys are effective embeddings,5 and find that the ranks of the diagonal elements in their rows are much smaller, which provides evidence that W L10H7 QK is not merely a 'same matching' matrix. We also verify the copy suppression attention pattern further in Appendix M.1. However, one limitation of our analysis of the QK circuit is that this idealised setup does not completely faithfully represent L10H7's real functioning (Appendices M.2, M.3 and N). Figure 4: Illustration of three different kinds of ablation: just OV, just QK, and CSPA. 4We ignore bias terms in the key and query parts (as we find that they do not change results much in Appendix M). Our experimental setup allows us to ignore LayerNorm (Appendix H). 5i.e in Eqn. (2) we replace the WU term with MLP0(WE). 5 QK AblationCopy Suppression Preserving Ablation(CSPA)Both OV and QK ablations.OV AblationProject each result vector along the unembedding vector for that token (and take only the negative components)." and"" war" " love" " love"?+ " love"? " in"?Mean ablate all vectors, except from source tokens which are most strongly predicted at the destination token." love"" in"" and"" war" " love" " love"?+" in"" love"" and"" war" " love" " love"?+" in"" love" " love"? Preprint. Under review. 3.3 HOW MUCH OF L10H7'S BEHAVIOR HAVE WE EXPLAINED? In this section, we perform an ablation which deletes all functionality of L10H7's OV and QK circuits, except for the mechanisms described in Section 3.1 and 3.2 respectively, with the goal of seeing how much functionality we can remove without damaging performance. We refer to this as Copy Suppression-Preserving Ablation (CSPA). In the Section 3.3.1 section we explain exactly how each part of CSPA works, and in the Section 3.3.2 section we present the ablation results. 3.3.1 METHODOLOGY CSPA consists of both an OV ablation and a QK ablation. OV ablation. The output of an attention head at a given destination token D can be written as a sum of result vectors from each source token S, weighted by the attention probabilities from D to S (Elhage et al., 2021). We can project each of these vectors onto the unembedding vector for the corresponding source token S. We only keep the negative components.6 QK ablation. We mean ablate the result vectors from each source token S, except for the top 5% of source tokens which are predicted with highest probability at the destination token D (as measured with the logit lens). As an example of how the OV and QK ablations work in practice, consider the opening example "All's fair in love and war". In this case the destination token D is " and". The token "love" is highly predicted to follow D (as measured with the logit lens), and also appears as a source token S, and so we would take the result vector from S and project it onto the unembedding vector for " love", mean-ablating everything else. This captures how L10H7 suppresses the " love" prediction. Ablation metric. After performing an ablation, we can measure the amount of L10H7's behavior that we have explained by comparing the ablation to a baseline that mean ablates L10H7's direct effect. Formally, if the model's output token distribution on a prompt is π and the distribution under an ablation Abl is πAbl, then we measure the KL divergence DKL(π||πAbl). We average these values over OpenWebText for both ablations we use, defining DCSPA for CSPA and DMA for the mean ablation baseline. Finally, we define the effect explained as 1 − (cid:0)DCSPA/DMA We choose KL divergence for several reasons, including how 0 has a natural interpretation as the ablated and clean distributions being identical – in other words, 100% of the head's effect being explained by the part we preserve. Ssee Appendix J for limitations, comparison and baselines. (cid:1) (Eqn. (3)). 3.3.2 RESULTS CSPA explains 76.9% of L10H7's behavior. Since the QK and OV ablations are modular, we can apply either of them independently and measure the effect recovered. We find that performing only the OV ablation leads to 81.1% effect explained, and only using QK leads to 95.2% effect explained. To visualize the performance of CSPA, we group each OpenWebText completion into one of 100 percentiles, ordered by the effect that mean ablation of L10H7 has on the out- put's KL divergence from the model. The re- sults are shown in Figure 5, where we find that CSPA preserves a larger percentage of KL divergence in the cases where mean abla- tion is most destructive: in the maximal per- centile, CSPA explained 88.1% of L10H7's effect. Figure 5: We plot (DMA, DCSPA) for each per- centile of our OpenWebText data (with percentiles given by the values of DMA). 6In Figure 17) we show the results when we also keep positive components. 6 00.050.10.150.20.2500.050.10.150.20.25D MA D CSPA KL divergence of CSPA vs. clean predictionsClean predictionsMean ablationCSPA Preprint. Under review. 4 COPY SUPPRESSION AND SELF-REPAIR Self-repair refers to how some neural network components compensate for other components that have been perturbed earlier in the forward pass (McGrath et al., 2023). Copy suppressing compo- nents self-repair: if perturbing specific model components causes them to stop outputting an unem- bedding, copy suppression is deactivated. In this section, we show that copy suppression explains 39% of self-repair in one setting (Section 4.1). However Section 4.2 gives weights-based evidence that self-repair relies on more than just copy suppression, and finds that the unembedding direction in the residual stream does not have a large effect on self-repair. 4.1 VISUALIZING SELF-REPAIR In this section we use the narrow Indirect Object Identification (IOI; Wang et al. (2023)) task to study self-repair, as this was studied in the GPT-2 Small model, and was the first known example of self-repair. However, understanding self-repair is also important for interpreting larger models with different architectures (McGrath et al., 2023). We give a short introduction to IOI in points i)-iii) below. Non-essential further details can be found in Wang et al. (2023). i) The IOI task consists of sentences such as 'When John and Mary went to the store, Mary gave a bottle of milk to' which are completed with the indirect object (IO) ' John'. ii) The task is performed by an end-to-end circuit. The final components are mainly three attention heads called Name Mover Heads that copy the IO to the model's output.7 iii) We can measure the extent to which IOI occurs by measuring the logit difference metric, which is equal to the difference between the ' John' and ' Mary' logits in the above example. To visualize self-repair under an ablation of the three Name Mover Heads, for every attention head downstream of the Name Mover Heads we measure its original contribution to logit difference (xc), as well as its contribution to logit difference post-ablation (yc). We then plot all these (xc, yc) pairs in Figure 6. In Figure 6, the higher the points are above the y = x line, the more they contribute to self-repair. This motivates a way to measure self-repair: if we let C denote the set of components downstream of Name Mover Heads and take c ∈ C, then the proportion of self-repair that a component c explains is (yc − xc)/ (cid:80) i∈C(yi − xi) (Eqn. (4)). The sum of the proportions of self-repair explained by Negative Heads L10H7 and L11H10 is 39%. This proportion is almost entirely copy suppression since Appendix P shows that the Negative Heads in the IOI task are entirely modulated by Name Mover Heads. However, Figure 6 indicates another form of self-repair in the heads on the right side of the figure: these heads do not have large negative effects in clean forward passes, but then begin contributing to the logit difference post-ablation. We found that these backup heads on the right hand side use a qualitatively different mechanism for self-repair than (copy suppressing) negative heads, which we summarise behaviorally in Table 2. Head Type Response to Name Movers predicting T Negative Backup More attention to T Less attention to T Effect of attending to T Decrease logits on T Increase logits on T Table 2: Qualitative differences between Negative and Backup Heads. To justify the description in Table 2, we analyze how Name Movers determine the attention patterns of self-repairing heads. We study Q-composition between a Name Mover's OV matrix WOV and the QK matrix WQK of downstream heads by calculating MLP0(WE)⊤W ⊤ OV WQKMLP0(WE) and find that backup heads attend less to names when Name Movers copy them, and negative heads attend more (Figure 7)8. Combining this result with the prior results that i) backup heads copy names (Wang et al., 2023) and ii) negative heads have negative-copying OV matrices (Section 3.1), this explains self-repair at a high-level in IOI: when the Backup/Negative heads attend more/less to 7The negative heads copy suppress this prediction, but not enough to change the model's top prediction. 8The technical details of the experiment can be found at Appendix O 7 Preprint. Under review. Figure 6: Ablating the Name Mover Heads in Layer 9 causes a change in the direct effects of all the downstream heads. Plotting the Clean Logit Difference vs the Post-Intervention Logit Difference for each head highlights the heads above the y = x line which perform self-repair. Figure 7: Relationship between Name Mover and self-repair heads: red edges denote less, and blue edges denote more, attention to names due to the Name Movers. Figure 8: Intervening in the IO unembedding in- put into self-repairing heads shows that the unem- bedding direction doesn't completely describe the backup effect. a token T upon the Name Mover's ablation, they copy more/suppress less of T , increasing the logit difference and thus self-repairing. 4.2 COMPLICATING THE STORY: COMPONENT INTERVENTION EXPERIMENTS Copy suppression explains self-repair in negative heads via the importance of the unembedding direction (Section 3.2). Ideally, the unembedding direction would also help understand backup heads. However, we present two pieces of evidence to highlight how the unembedding only explains part of the self-repair in GPT-2 Small, including showing that our understanding of Negative Heads on the IOI task also requires understanding more than simply the unembedding directions. First, we intervened on the output of the Name Movers and L10H7,9 and edited the resulting changes into the queries of downstream heads. The intervention, shown in Figure 8, was either a projection onto or away from the IO unembedding WU [IO]10. We also froze the Layer Norm scaling factor equal to the value on the original forward pass. To interpret Figure 8, note that for most backup heads, projecting away from WU [IO] does not change the heads' logit differences much, suggesting that the unembedding direction isn't very causally important for self-repair in backup heads. As 9We also ablate the output of L10H7 due to self-repair that occurs between L11H10 and L10H7, as explained in Appendix C. 10By 'away from', we mean removing the unembedding direction from the head output, so the resultant vector is orthogonal to the unembedding direction. 8 L10H0L10H10L11H2L10H7L11H10L10H2L10H6−2−1012−2−1012Components:Backup HeadNegative HeadMLPOther Headsy=xLogit Difference Self-Repair in IOIClean Logit DifferencePost-Intervention Logit DifferenceL10H2L10H10L10H6L10H7L11H10L11H2L10H2L10H10L10H7L11H10L11H2−2.5−2−1.5−1−0.500.51−2.5−2−1.5−1−0.500.51Project:away from W U [IO]onto W U [IO]Self-repairing attention heads under projection interventionsPre-intervention logit differencePost-intervention logit difference Preprint. Under review. such, there must be important information in the WU [IO]-perpendicular direction that controls self- repair. To complement this analysis, we also broke the attention score (a quadratic function of query and key inputs) down into terms and again found the importance of the perpendicular direction (Appendix L). Beyond this, intervening in the queries of self-repair heads reflects that the perpendicular direction is particularly important in the Backup Heads (Appendix R). Ultimately, we conclude that while Name Mover Heads modulate Negative Heads' copy suppression, this is only partly through the unembedding direction. Further, backup heads do not seem to depend on the unembedding direction. 5 RELATED WORK Explanations of neural network components in post-hoc language model interpretability include explanations of neurons, attention heads and circuits. Related work includes the automated approach by Bills et al. (2023) and manual explanations found by Voita et al. (2023) who both find suppression neurons. More comprehensive explanations are found in Gurnee et al. (2023) (contextual neurons). Attention heads correlated with previous tokens (Vig, 2019) and rare words (Voita et al., 2019) have been analyzed. Circuits have been found on narrow distributions (Wang et al., 2023) and induction heads (Elhage et al., 2021) are the most general circuits found in language models, but they have only been explained in as much detail as our work in toy models. Chan et al. (2022)'s loss recovered metric inspired our loss recovered analysis. Iterative inference. Greff et al. (2017) propose that neural networks layers iteratively update fea- ture representations rather than recomputing them, in an analysis specific to LSTMs and Highway Networks. Several works have found that transformer language model predictions are iteratively refined (Dar et al., 2022; nostalgebraist, 2020; Belrose et al., 2023; Halawi et al., 2023) in the sense that the state after intermediate layers forms a partial approximation to the final output, though no connections have yet been made to Negative Heads. 6 CONCLUSION In summary, in this work we firstly introduced copy suppression, a description of the main role of an attention head across GPT-2 Small's training distribution. Secondly, we applied weights- based arguments using QK and OV circuits to mechanistically verify our hypotheses about copy suppression. Finally, we showed how our comprehensive analysis has applications to open problems in ablation-based interpretability (Section 4). Two limitations of our work include our understanding of the query inputs to self-repair heads, and the transferability of our results to different models. In both Section 3.2 and 4 we found that copy suppression and self-repair rely on more than simply unembedding directions, and we hope that future work can fully explain this observation. Further, while we show that some of our insights generalize to large models (Appendix A and B), we don't have a mechanistic understanding of copy suppression in these cases. Despite this, our work shows that it is possible to explain LLM components across broad distributions with a high level of detail. For this reason, we think that our insights will be extremely useful for future interpretability research. 9 Preprint. Under review. AUTHOR CONTRIBUTIONS Callum McDougall and Arthur Conmy identified the copy suppression motif and wrote Sections 1-3, running all experiments in these sections. Cody Rushing independently identified copy suppression in backup behavior, and wrote Section 4. Neel Nanda was the main supervisor for this project, and both Neel and Thomas McGrath provided guidance and advice at all stages in the project. ACKNOWLEDGMENTS Marius Hobbhahn, Tom Lieberum, Connor Kissane, Joseph Bloom, Martin Wattenberg, John Merullo, Joseph Miller, Jett Janiak, Jake Mendel, Oskar Hollinsworth, Adam Jermyn and Atticus Geiger all provided useful feedback on a draft of this work. This work was generously supported by funding and mentorship from the summer 2023 SERI MATS program. Callum and Arthur would like to thank the London Initiative for Safe AI for providing a great working space for the research. Cody Rushing's work was supported by the Center for AI Safety Compute Cluster. Any opinions, findings, mistakes, conclusions or recommendations in this material are our own and do not neces- sarily reflect the views of our sponsors or employers. REFERENCES David Bau, Bolei Zhou, Aditya Khosla, Aude Oliva, and Antonio Torralba. Network dissection: Quantifying interpretability of deep visual representations, 2017. 2 Nora Belrose, Zach Furman, Logan Smith, Danny Halawi, Igor Ostrovsky, Lev McKinney, Stella Biderman, and Jacob Steinhardt. Eliciting latent predictions from transformers with the tuned lens, 2023. 9 Steven Bills, Nick Cammarata, Dan Mossing, Henk Tillman, Leo Gao, Gabriel Goh, Ilya Sutskever, Jan Leike, Jeff Wu, and William Saunders. Language models can explain neurons in language models. https://openaipublic.blob.core.windows.net/ neuron-explainer/paper/index.html, 2023. 2, 9 Tolga Bolukbasi, Adam Pearce, Ann Yuan, Andy Coenen, Emily Reif, Fernanda Vi ́egas, and Martin Wattenberg. An interpretability illusion for bert. arXiv preprint arXiv:2104.07143, 2021. 2 Nick Cammarata, Shan Carter, Gabriel Goh, Chris Olah, Michael Petrov, Ludwig Schubert, Chelsea Voss, Ben Egan, and Swee Kiat Lim. Thread: Circuits. 2020. doi: 10.23915/distill.00024. https://distill.pub/2020/circuits. 2 Shan Carter, Zan Armstrong, Ludwig Schubert, Ian Johnson, and Chris Olah. Activation atlas. Distill, 4(3):e15, 2019. 2 Lawrence Chan, Adria Garriga-Alonso, Nix Goldowsky-Dill, Ryan Greenblatt, Jenny Ni- Causal scrub- tishinskaya, Ansh Radhakrishnan, Buck Shlegeris, and Nate Thomas. bing: A method for rigorously testing interpretability hypotheses. Alignment Forum, 2022. URL https://www.alignmentforum.org/posts/JvZhhzycHu2Yd57RN/ causal-scrubbing-a-method-for-rigorously-testing. 2, 9 Arthur Conmy, Augustine N. Mavor-Parker, Aengus Lynch, Stefan Heimersheim, and Adri`a Garriga-Alonso. Towards automated circuit discovery for mechanistic interpretability, 2023. 2 Guy Dar, Mor Geva, Ankit Gupta, and Jonathan Berant. Analyzing transformers in embedding space. arXiv preprint arXiv:2209.02535, 2022. 9 Nelson Elhage, Neel Nanda, Catherine Olsson, Tom Henighan, Nicholas Joseph, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, Tom Conerly, Nova DasSarma, Dawn Drain, Deep Gan- guli, Zac Hatfield-Dodds, Danny Hernandez, Andy Jones, Jackson Kernion, Liane Lovitt, Kamal Ndousse, Dario Amodei, Tom Brown, Jack Clark, Jared Kaplan, Sam McCandlish, and Chris Olah. A mathematical framework for transformer circuits. Transformer Circuits Thread, 2021. URL https://transformer-circuits.pub/2021/framework/index.html. 2, 3, 4, 5, 6, 9, 17, 25, 26, 28 10 Preprint. Under review. Gabriel Goh, Nick Cammarata, Chelsea Voss, Shan Carter, Michael Petrov, Ludwig Schubert, Alec Radford, and Chris Olah. Multimodal neurons in artificial neural networks. Distill, 6(3):e30, 2021. 2 Aaron Gokaslan, Vanya Cohen, Ellie Pavlick, and Stefanie Tellex. Openwebtext corpus, 2019. URL https://Skylion007.github.io/OpenWebTextCorpus. 3 Nicholas Goldowsky-Dill, Chris MacLeod, Lucas Sato, and Aryaman Arora. Localizing model behavior with path patching, 2023. 3 Klaus Greff, Rupesh K. Srivastava, and J ̈urgen Schmidhuber. Highway and residual networks learn unrolled iterative estimation, 2017. 9 Wes Gurnee, Neel Nanda, Matthew Pauly, Katherine Harvey, Dmitrii Troitskii, and Dimitris Bertsi- mas. Finding neurons in a haystack: Case studies with sparse probing, 2023. 2, 9 Danny Halawi, Jean-Stanislas Denain, and Jacob Steinhardt. Overthinking the truth: Understanding how language models process false demonstrations, 2023. 9 Michael Hanna, Ollie Liu, and Alexandre Variengien. How does gpt-2 compute greater-than?: In- terpreting mathematical abilities in a pre-trained language model, 2023. 2, 17 Stefan Heimersheim and Jett Janiak. a in 4-layer strings attention-only //www.alignmentforum.org/posts/u6KXXmKFbXfWzoAXn/ a-circuit-for-python-docstrings-in-a-4-layer-attention-only. 2 URL A transformer, circuit 2023. for Python doc- https: Mengting Hu, Zhen Zhang, Shiwan Zhao, Minlie Huang, and Bingzhe Wu. Uncertainty in natural language processing: Sources, quantification, and applications, 2023. 15 Alon Jacovi and Yoav Goldberg. Towards faithfully interpretable nlp systems: How should we define and evaluate faithfulness?, 2020. 2 Thomas McGrath, Matthew Rahtz, Janos Kramar, Vladimir Mikulik, and Shane Legg. The hydra effect: Emergent self-repair in language model computations, 2023. 7, 28 Jesse Mu and Jacob Andreas. Compositional explanations of neurons. CoRR, abs/2006.14032, 2020. URL https://arxiv.org/abs/2006.14032. 2 Neel Nanda and Joseph Bloom. Transformerlens, 2022. URL https://github.com/ neelnanda-io/TransformerLens. 17 nostalgebraist. interpreting gpt: the logit lens, 2020. URL https://www.lesswrong.com/ posts/AcKRB8wDpdaN6v6ru/interpreting-gpt-the-logit-lens. 3, 9, 28 Chris Olah. Mechanistic interpretability, variables, and the importance of interpretable bases. https://www.transformer-circuits.pub/2022/mech-interp-essay, 2022. 2 Catherine Olsson, Nelson Elhage, Neel Nanda, Nicholas Joseph, Nova DasSarma, Tom Henighan, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, et al. In-context learn- ing and induction heads, 2022. URL https://transformer-circuits.pub/2022/ in-context-learning-and-induction-heads/index.html. 2, 12, 27, 28 Alec Radford, Rafal Jozefowicz, and Ilya Sutskever. Learning to generate reviews and discovering sentiment, 2017. 2 Tilman R ̈auker, Anson Ho, Stephen Casper, and Dylan Hadfield-Menell. Toward transparent ai: A survey on interpreting the inner structures of deep neural networks, 2023. 2 Jesse Vig. A multiscale visualization of attention in the transformer model. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pp. 37–42. Association for Computational Linguistics, 2019. doi: 10.18653/v1/P19-3007. URL https://aclanthology.org/P19-3007. 9 11 Preprint. Under review. Elena Voita, David Talbot, Fedor Moiseev, Rico Sennrich, and Ivan Titov. Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned, 2019. 2, 9 Elena Voita, Javier Ferrando, and Christoforos Nalmpantis. Neurons in large language models: Dead, n-gram, positional, 2023. 9 Kevin Ro Wang, Alexandre Variengien, Arthur Conmy, Buck Shlegeris, and Jacob Steinhardt. Interpretability in the wild: a circuit for indirect object identification in GPT-2 small. In The Eleventh International Conference on Learning Representations, 2023. URL https: //openreview.net/forum?id=NpsVSN6o4ul. 2, 7, 9, 17, 21, 28 Zhengxuan Wu, Atticus Geiger, Christopher Potts, and Noah D. Goodman. Interpretability at scale: Identifying causal mechanisms in alpaca, 2023. 2 A ANTI-INDUCTION As one example of behaviors which copy-suppression seems to explain outside the context of IOI, we present the phenomenon of anti-induction. Olsson et al. (2022) refer to 'anti-copying prefix search' heads, which we call anti-induction heads in the rest of this section. Attention heads have been discovered in large models which identify repeating prefixes and suppressing the prediction of the token which followed the first instance of the prefix, in other words the opposite of the induction pattern (Olsson et al., 2022). Analysis across different model architectures revealed a strong cor- relation between attention heads' copying scores on random sequences of repeated tokens (i.e. the induction task) and their copy-suppression scores on the IOI task, in the quadrant where both scores were positive. For example, head L10H7 in GPT-2 Small ranked higher than all other attention heads in both copy-suppression and negative induction score. Figure 9: Anti-induction and copy suppression on the IOI task compared. Importantly, since the induction task involves a repeated sequence of random tokens, this graph strongly suggests that the negative behavior displayed by certain heads on the IOI task is not task- dependent. We believe this holds a generalisable lesson for mechanistic interpretability - certain components can appear to be using task-specific algorithms, but are actually implementing a more general pattern of behaviour. 12 −0.500.511.522.5−0.500.511.5Model ClassGPTPythiaSoLUAnti-Induction Scores (repeated random tokens) vs Copy-Suppression Scores (IOI)Copy-Suppression ScoreAnti-Induction ScoreGPT2-Small, L10H7 Preprint. Under review. Figure 10: Repeating the experiment in Section 3.2 (with WEE keyside and WU queryside) on GPT-2 Medium. B COPY SUPPRESSION IN OTHER MODELS We have performed the experiment in Section 3.2 on all heads in GPT-2 Medium: Figure 10. We found that the two heads most prominently recovered were 2/3 of the most negative heads on the IOI task in GPT-2 Medium (Figure 11). We also find instances of copy suppression (though weaker) in the Pythia models that were trained without dropout and without tied embeddings (Figure 9). C L11H10 In Section 2.2 we showed that the majority of L10H7's effect on loss is via its direct effect. In this appendix we show that we can explain up to half of L10H7's indirect effect by considering the indirect through L11H10, the second Negative Head in GPT-2 Small. We repeat the same method- ology as in the indirect path experiment in Figure 2, but also controlling for the path from L10H7 to L11H10 by not mean ablating this connection. We show the results in Figure 12. The indirect path through L11H10 is special because both Negative Heads perform copy suppres- sion, which is a self-repair mechanism: once a predicted token is suppressed, it is no longer pre- dicted, and therefore does not activate future copy suppression components. This means that ab- lating head L10H7 will often result in it being backed up by head L11H10. In an experiment that ablates the effect of L10H7 on L11H10 but not on the final model output, we would expect exces- sive copy suppression to take place since i) L10H7 will have a direct copy suppression effect, and ii) L11H10 will copy suppress more than in normal situations, since its input from L10H7 has been ab- lated. Indeed the loss increase is roughly twice as large in the normal indirect effect case compared to when we control for the effect through L11H10 (Figure 12). However, surprisingly there is little effect on KL Divergence. D ENTROPY AND CALIBRATION A naive picture of attention heads is that they should all reduce the model's entropy (because the purpose of a transformer is to reduce entropy by concentrating probability mass in the few most 13 Preprint. Under review. Figure 11: Finding the direct logit attribution for different heads in GPT-2 Medium on the IOI task. The scale ignores the Layer Norm scaling factor Figure 12: Loss effect of L10H7 via different paths. Grey paths denote ablated paths. 14 +0.0008+0.00160.00300.0032NoneIndirect paths(except L11H10)Indirect paths(all)3.033.0323.0343.0363.0383.043.0423.04400.0050.010.0150.02Ablating different paths from L10H7LossKL Divergence Preprint. Under review. (a) Entropy contribution per head. L10H7 increases entropy (as do other negative heads like L11H10); most other heads decrease it. (b) Marginal effect on overconfidence metric per head. L10H7 decreases overconfidence; most other heads increase it. Figure 13: Effect of attention heads on entropy & calibration. Figure 14: Illustration of the calibration curve, and overconfidence metric. likely next tokens). We can calculate a head's direct contribution to entropy by measuring (1) the entropy of the final logits, and (2) the entropy of the final logits with the head's output subtracted. In both cases, the negative head L10H7 stands out the most, and the other negative heads L11H10 and L8H10 are noticeable. We can also examine each attention head's effect on the model's calibration. Hu et al. (2023) use calibration curves to visualise the model's degree of calibration. From this curve, we can define an overconfidence metric, calculated by subtracting the perfect calibration curve from the model's actual calibration curve, and taking the normalized L2 inner product between this curve and the curve we get from a perfectly overconfident model (which only ever makes predictions of absolute certainty). The L2 inner product can be viewed as a measure of similarity of functions, so this metric should tell us in some sense how overconfident our model is: the value will be 1 when the model is perfectly overconfident, and 0 when the model is perfectly calibrated. Figure 14 illustrates these concepts. We can then measure the change in overconfidence metric from ablating the direct effect of an attention head, and reverse the sign to give us the head's direct effect on overconfidence. This is shown in the figure below, with the change shown relative to the model's original overconfidence (with no ablations). Again, we see that head L10H7 stands out, as do the other two negative heads. Interestingly, removing the direct effect of head L10H7 is enough to push the model from net over- confident to net under-confident. 15 05101086420−0.06−0.04−0.020.000.020.040.06Marginal contribution to entropyHeadLayer05101086420−100%−50%0%50%100%Marginal effect on overconfidence metricHeadLayerEmpiricalaccuracyModel's mean predicted probabilityPerfectcalibrationCharacteristic overconfidence curveConvolved integralfor measuring overconfidence?÷?= Preprint. Under review. What are we to interpret from these results? It is valuable for a model to not be over-confident, because the cross-entropy loss will be high for a model which makes high-confidence incorrect pre- dictions. One possible role for negative heads is that they are reducing the model's overconfidence, causing it to make fewer errors of this form. However, it is also possible that this result is merely incidental, and not directly related to the reason these heads form. For example, another theory is that negative heads form to suppress early naive copying behaviour by the model, and in this case they would be better understood as copy-suppression heads rather than "calibration heads". See Appendix E for more discussion of this. E WHY DO NEGATIVE HEADS FORM? SOME SPECULATIVE THEORIES This paper aimed to mechanistically explain what heads like L10H7 do, rather than to provide an explanation for why they form. We hope to address this in subsequent research. Here, we present three possible theories, present some evidence for/against them, and discuss how we might test them. • Reducing model overconfidence. – Theory: Predicting a token with extremely high confidence has diminishing returns, because once the logprobs are close to zero, any further increase in logits won't de- crease the loss if the prediction is correct, but it will increase loss if the prediction is incorrect. It seems possible that negative heads form to prevent this kind of behaivour. – Evidence: The results on calibration and entropy in Appendix D provide some evi- dence for this (although these results aren't incompatible with other theories in this table). – Tests: Examine the sequences for which this head decreases the loss by the most (particularly for checkpointed models, just as the negative head is forming). Are these cases where the incorrect token was being predicted with such high probability that it is in this "diminishing returns" window? • Suppressing naive copying. – Theory: Most words in the English language have what we might term the "update property" - the probability of seeing them later in a prompt positively updates when they appear. Early heads might learn to naively copy these words, and negative heads could form to suppress this naive behaviour. – Evidence: The "All's fair in love and love" prompt is a clear example of this, and provides some evidence for this theory. – Tests: Look at checkpointed models, and see if negative heads form concurrently with the emergence of copying behaviour by other heads. • Suppressing next-token copying for tied embeddings. – Theory: When the embedding and unembedding matrices are tied, the direct path WU WE will have large diagonal elements, which results in a prediction that the cur- rent token will be copied to the next sequence position. Negative heads could suppress this effect. – Evidence: This wouldn't explain why negative heads appear in models without tied embeddings (although it might explain why the strongest negative heads we found were in GPT-2 Small, and the Stanford GPT models, which all have tied embeddings). – Tests: Look at attention patterns of the negative head early in training (for check- pointed models, with tied embeddings). See if tokens usually self-attend. While discussing these theories, it is also important to draw a distinction between the reason a head forms during training, and the primary way this head decreases loss on the fully trained model - these two may not be the same. For instance, the head seems to also perform semantic copy suppression (see Appendix K), but it's entirely possible that this behaviour emerged after the head formed, and isn't related to the reason it formed in the first place. F EXPERIMENT DETAILS FOR OV-CIRCUIT IN PRACTICE We ran a forward pass on a sample of OpenWebText where we i) filtered for all (source, destination) token pairs where the attention from destination to source is above some threshold (we chose 10%), ii) measured the direct logit attribution of the information moved from each of these source tokens 16 Preprint. Under review. to the corresponding destination token and finally iii) performed the same analysis as we did in Section 3.1 - measuring the rank of the source token amongst all tokens. We found that the results approximately matched our dynamic analysis (with slightly more noise): the proportion of (source, destination) token pairs where the source token was in the top 10 most suppressed tokens was 78.24% (which is close to the static analysis result of 84.70%). G FUNCTION WORDS In Section 3.1 we found that a large fraction of the tokens which failed to be suppressed were function words. The list of least copy suppressed tokens are: [' of', ' Of', ' that', ' their', ' most', ' as', ' this', ' for', ' the', ' in', ' to', ' a', 'Their', ' Its', 'When', ' The', ' its', ' these', 'The', 'Of', ' it', ' nevertheless', ' an', '<|endoftext|>, 'Its', ' have', ' some', ' By']. Sampling randomly from the 3724 tokens other than 92.59% that are copy suppressed, many are also connectives (and rarely nouns): [' plainly', ' utterly', ' enhance', ' obtaining', ' entire', ' Before', 'eering', '.)', ' holding', ' unnamed']. It is notable that this result is compatible with all three theories which we presented in the previous section. • Reducing model overconfidence. The unembedding vectors for function words tend to have smaller magnitude than the average token in GPT-2 Small. This might lead to less confident predictions for function words than for other kinds of tokens. • Suppressing naive copying. There would be no reason to naively copy function words, be- cause function words don't have this "update property" - seeing them in a prompts shouldn't positively update the probability of seeing them later. So there is no naive copying which needs to be suppressed. • Suppressing next-token copying for tied embeddings. Since function words' unembed- ding vectors have smaller magnitudes, the diagonal elements of WU WE are small anyway, so there is no risk of next-token copying of function words. H MODEL AND EXPERIMENT DETAILS All of our experiments were performed with Transformer Lens (Nanda & Bloom, 2022). We note that we enable all weight processing options,11 which means that transformer weight matrices are rewritten so that the internal components are different and simpler (though the output probabilities are identical). For example, our Layer Norm functions only apply normalization, with no centering or rescaling (this particular detail significantly simplifies our Logit Lens experiments). I EFFECTIVE EMBEDDING Effective embedding definition and motivation. GPT-2 Small uses the same matrix in its embedding and unembedding layers, which may change how it learns certain tasks.12 Prior research on GPT-2 Small has found the counter-intuitive result that at the stage of a circuit where the input token's value is needed, the output of MLP0 is often more important for token predictions than the model's embedding layer (Wang et al., 2023; Hanna et al., 2023). To account for this, we define the effective embedding. The effective embedding is purely a function of the input token, with no leakage from other tokens in the prompt, as the attention is ablated. Why choose to extend the embedding up to MLP0 rather than another component in the model? This is because if we run forward passes with GPT-2 Small where we delete WE from the residual stream just after MLP0 has been added to the residual stream, cross entropy loss decreases.13 Indeed, we took a sample of 3000 documents of at least 1024 tokens from OpenWebText, took the loss on their first 1024 positions, and calculated the average loss. The result was 3.047 for GPT-2 and 3.044 when we subtracted WE. 11That are described here: https://github.com/neelnanda-io/TransformerLens/blob/ main/further_comments.md#weight-processing 12As a concrete example, Elhage et al. (2021) show that a zero-layer transformer with tied embeddings cannot perfectly model bigrams in natural language. 13Thanks to Ryan Greenblatt for originally finding this result. 17 Preprint. Under review. Figure 15: Log densities of dataset examples with loss change due to CSPA (x axis) and KL di- vergence due to CSPA (y axis). The x axis range is between −1 and +1 standard deviation of loss changes due to CSPA, and the y axis range is between 0 and +1 standard deviation of CSPA KL. J CSPA METRIC CHOICE J.1 MOTIVATING KL DIVERGENCE To measure the effect of an ablation, we primarily focused on the KL divergence DKL(P ||Q) = (cid:80) i pi log pi/qi, where P was the clean distribution and Q was the distribution after our ablation had been applied. Conveniently, a KL Divergence of 0 corresponds to perfect recovery of model behavior, and it is linear in the log-probabilities log qi obtained after CSPA. There are flaws with the KL divergence metric. For example, if the correct token probability is very small, and a head has the effect of changing the logits for this token (but not enough to meaningfully change the probability), this will affect loss but not KL divergence. Our copy suppression preserving ablation on L10H7 will not preserve situations like these, because it filters for cases where the suppressed token already has high probability. Failing to preserve these situations won't change how much KL divergence we can explain, but it will reduce the amount of loss we explain. Indeed, the fact that the loss results appear worse than the KL divergence results is evidence that this is happening to some extent.Indeed empirically, we find that density of points with KL Divergence close to 0 but larger change in loss is greater than the opposite (change in loss close to 0 but KL larger) in Figure 15, as even using two standard deviations of change on the x axis leads to more spread acrosss that axis. In Appendix J.2 we present results on loss metrics to complement our KL divergence results, and we compare these metrics to baselines in Appendix J.3. J.2 COMPARING KL DIVERGENCE AND LOSS In Figure 2, we use two different metrics to capture the effect and importance of different model components. Firstly, the amount by which ablating these components changes the average cross- entropy loss of the model on OpenWebText. Secondly, the KL Divergence of the ablated distribution to the model's ordinary distribution, again on OpenWebText. In essence, the first of these captures how useful the head is for the model, and the second captures how much the head affects the model's output (good or bad). In Section 3.3 we only reported the recovered effect from KL divergence. We can also compute analogous quantities to Eqn. (3) for loss, in two different ways. Following the ablation metric definition in Section 3.3.1, suppose at one token completion GPT- 2 Small usually has loss L, though if we ablate of L10H7's direct effect has loss LAbl. Then we could either measure LAbl − L and try and minimise the average of these values over the dataset, or we could instead minimize |LAbl − L|. Either way, we can compare CSPA (Abl = CSPA) to the baseline of mean ablation (Abl = MA), by a similar ratio calculation as Eqn. (3). We get 82% effect recovered for the net loss effect and 45% effect recovered for the absolute change in loss. Despite these differing point values, the same visualisation method as Section 3.3.2) can be used to see 18 -0.0756-0.0665-0.0574-0.0484-0.0393-0.0302-0.0212-0.0121-0.0030.0060.01510.02420.03330.04230.05140.06050.06950.000150.00060.001040.001490.001940.002380.002830.003280.003720.004170.004620.005060.005510.005960.00640.006850.0073−10−8−6−4Log Density of Points in CSPA RangesCSPA Loss - Model LossCSPA KL Preprint. Under review. (a) Average change in loss effect. (b) Absolute change in loss effect recovered. Figure 16: Studying CSPA under metrics other than KL Divergence. Figure 17: Calculating CSPA (with KL divergence) for all Layer 9-11 heads in GPT-2 Small. where Copy Suppression is not explaining L10H7 behavior well (see Figure 16). We find that the absolute change in loss captures the majority of the model's (73.3%) in the most extreme change in loss percentile (Figure 16b, far right), which shows that the heavy tail of cases where L10H7 is not very useful for the model is likely the reason for the poor performance by the absolute change in loss metric. Also, surprisingly Figure 16a's symmetry about x = 0 shows that there are almost as many com- pletions on which L10H7 is harmful as there are useful cases. We observed that this pattern holds on a random sample of OpenWebText for almost all Layer 9-11 heads, as most of these heads have harmful direct effect on more than 25% of completions, and a couple of heads (L8H10 and L9H5) are harmful on the majority of token completions (though their average direct effect is beneficial). J.3 DOES EQN. (3) ACCURATELY MEASURE THE EFFECT EXPLAINED? If Eqn. (3) is a good measure of the copy suppression mechanism, it should be smaller for heads in GPT-2 Small that aren't negative heads. We computed the CSPA value for all heads in Layers 9-11 in Figure 17.14 We also ran two forms of this experiment: one where we projected OV-circuit outputs onto the unembeddings (right), and one where we only kept the negative components of OV-circuit outputs (left). While we find that CSPA recovers more KL divergence L10H7 than all other heads, we also find that the QK and OV ablations (Section 3.3.1) lead to large (> 50%) KL divergence recovered for 14All attention heads in Layers 0-8 have small direct effects: the average increase in loss under mean ablation of these direct effects is less than 0.05 for all these heads, besides 8.10. However heads in later layers have much larger direct effects, e.g 10/12 attention heads in Layer 10 (including L10H7) have direct effect more than 0.05. 19 −0.8−0.6−0.4−0.200.20.40.6−0.8−0.6−0.4−0.200.20.4Change in loss from ablation (relative to clean model)Change in loss under mean ablationChange in loss under CSPANo interventionFull ablation00.10.20.30.40.50.60.700.10.20.30.40.50.60.7Absolute change in loss from ablationAbsolute change in loss under mean ablationAbsolute change in loss under CSPANo interventionFull ablation Preprint. Under review. many other heads, too. In Appendix N we describe a more destructive intervention which recovers 25% of L10H7's KL divergence naively and 61% when adjusted. K SEMANTIC SIMILARITY 42.00% of (source, destination) pairs had the source token in the top 10 most suppressed tokens, but not the most suppressed. When we inspect these cases, we find a common theme: the most suppressed token is often semantically related to the source token. For our purposes, we define semantically related as an equivalence relation on tokens, where if tokens S and T are related via any of the following: • Capitalization (e.g. " pier" and " Pier" are related), • Prepended spaces (e.g. " token" and "token" are related), • Pluralization (e.g. " device" and " devices" are related), • Sharing the same morphological root (e.g. "drive", "driver", "driving" are all related) • Tokenization (e.g. " Berkeley" and "keley" are related, because the non-space version "Berkeley" is tokenized into ["Ber", "keley"]). We codify these rules, and find that in 90% of the aforementioned cases, the most suppressed token is semantically related to the source token. Although part of this is explained by the high cosine similarity between semantically related tokens, this isn't the whole story (on this set of examples, the average cosine similarity between the source token and the semantically related most suppressed token was 0.520). We speculate that the copy suppression algorithm is better thought of as semantic copy suppression, i.e. all tokens semantically related to the source token are suppressed, rather than pure copy suppression (where only the source token is suppressed). The figure below presents some OpenWebText examples of copy suppression occurring for semantically related tokens. Prompt ...America's private prisons ... the biggest private prison - ... ...SteamVR (formerly known as OpenVR), Valve's alternate VR reality ... ...Berkeley to offer course ... university of Berkeley California ... ...Wrap up the salmon fillets in the foil, carefully wrapping sealing ... Source token Incorrect com- pletion Correct completion Form of semantic similarity " prisons" " prison" "-" Pluralization "VR" " VR" " reality" Prepended space "keley" " Berkeley" " California" Tokenization " Wrap" " wrapping" " sealing" Verb conjugation & capitalization Table 3: Dataset examples of copy suppression, with semantic similarity. L BREAKING DOWN THE ATTENTION SCORE BILINEAR FORM In Section 4, we observed that Negative Heads attend to IO rather than S1 due to the outputs of the Name Mover heads. We can use QK circuit analysis (Section 3.2) in order to understand what parts of L10H7's query and key inputs cause attention to IO rather than S1. As a gentle introduction to our methodology in this section, if an attention score was computed from an incoming residual stream vector q at queryside and k at queryside, then mirroring Eqn. (2) we could decompose the attention score s = q⊤W L10H7 QK k 20 (5) Preprint. Under review. (a) (b) Figure 18: Decomposing the bilinear attention score. 18a: decomposing by all model components. 18b: decomposing by all model components, and further by terms in the MLP0 direction (keyside) and terms in the IO unembedding direction (queryside). Terms involving name movers and MLP0 are highlighted. into the query component from each residual stream component15 (e.g MLP9, the attention heads in layer 9, ...) so s = q⊤ QK k + * * * . We could then further decompose the keyside input in each of these terms. QK k + q⊤ MLP9W L10H7 L9H0W L10H7 However, in this appendix we're actually interested in the difference between how the model attends to IO compared to S, so we decompose the attention score difference ∆s := q⊤W L10H7 QK kIO − q⊤W L10H7 QK kS1 = q⊤W L10H7 QK (kIO − kS1). (6) Since ∆s is in identical form to Equation (5) when we take k = kIO − kS1, we can decompose both the query inputs and key inputs of ∆s. We also take q from the END position in the IOI task. Under this decomposition, we find that the most contributions are from L9H6 and L9H9 queryside and MLP0 keyside (Figure 18a), which agrees with our analysis throughout the paper. Further, we can test the hypotheses in Section 3.1 and Section 3.2 that copy suppression is modu- lated by an unembedding vector in the residual stream, by further breaking up each of the attention scores in Figure 18a into 4 further components, for the queryside components parallel and perpen- dicular to the unembedding direction, as well as the keyside components parallel and perpendicular to the MLP0 direction (Figure 18b). Unfortunately the direction perpendicular to IO is slightly more important than the parallel direction, for both name movers. This supports the argument in Section 4 that self-repair is more general than the simplest possible form of copy suppression described in Section 3.2. M L10H7'S QK-CIRCUIT M.1 DETAILS ON THE QK-CIRCUIT EXPERIMENTS (FIGURE 3). We normalize the query and key inputs to norm Actually, key and query biases don't affect results much so we remove them for simplicity of Eqn. (2). Results when we uses these biases can be found in Figure 19a, which seem identical to the main text figure except a tiny difference in the Rank 1-2 bar heights. Additionally, the median ranks for other attention heads do not show the same patterns as Figure 3: for example, Duplicate Token Heads (Wang et al., 2023) have a 'matching' QK circuit that has much higher median ranks when the dmodel to simulate the effect of Layer Norm. √ 15As in Eqn. (2), we found that the query and key biases did not have a large effect on the attention score difference computed here. 21 00.050.10.15Q = L9H9, K = MLP 7 Q = L9H6, K = MLP 2 Q = L9H9, K = MLP 5 Q = L9H9, K = MLP 3 Q = L9H9, K = MLP 6 Q = L9H9, K = MLP 2 Q = L9H9, K = L0H1Q = L9H9, K = MLP 1 Q = L9H6, K = MLP 0 Q = L9H9, K = MLP 0 Contribution proportion00.050.1Q = L9H6, K = MLP 1 , q ⊥ W U [IO], k ⊥ MLP 0 Q = L9H9, K = MLP 7 , q ⊥ W U [IO], k ∥ MLP 0 Q = L9H6, K = MLP 9 , q ⊥ W U [IO], k ⊥ MLP 0 Q = L9H9, K = MLP 9 , q ⊥ W U [IO], k ∥ MLP 0 Q = L9H9, K = MLP 9 , q ⊥ W U [IO], k ⊥ MLP 0 Q = L9H9, K = MLP 1 , q ⊥ W U [IO], k ⊥ MLP 0 Q = L9H6, K = MLP 0 , q ∥ W U [IO], k ∥ MLP 0 Q = L9H6, K = MLP 0 , q ⊥ W U [IO], k ∥ MLP 0 Q = L9H9, K = MLP 0 , q ∥ W U [IO], k ∥ MLP 0 Q = L9H9, K = MLP 0 , q ⊥ W U [IO], k ∥ MLP 0 Contribution proportion Preprint. Under review. (a) Figure 3 but including biases before multiply- ing query and key vectors. (b) Studying the number of Top-1 tokens for L3H0, a Duplicate Token Head. Figure 19: Repeating Figure 3 while adding biases (Figure 19a) and looking at Top-1 statistics for a different head (Figure 19b). queryside lookup table is the effective embedding (Figure 19b). Additionally, most other attention heads are different to copy suppression heads and duplicate token heads, as e.g for Name Mover Heads across all key and queryside lookup tables the best median rank is 561. M.2 MAKING A MORE FAITHFUL KEYSIDE APPROXIMATION Is our minimal mechanism for Negative Heads faithful to the computation that occurs on forward passes on dataset examples? To test this, we firstly select some important key tokens which we will measure faithfulness on. We look at the top 5% of token completions where L10H7 was most useful (as in Section 2) and select the top two non-BOS tokens in context that have maximal attention paid to them. We then project L10H7's key input onto a component parallel to the effective embedding for the key tokens, and calculate the change in attention paid to the selected key tokens. The resulting distribution of changes in attention can be found in Figure 20. We find that the median attention change is −0.09, with lower quartile −0.19. Since the average at- tention amongst these samples is 0.21, this suggests that the effective embedding does not faithfully capture the model's attention. To use a more faithful embedding of keyside tokens, we run a forward pass where we set all attention weights to tokens other than BOS and the current token to 0. We then measure the state of the resid- ual stream before input to Head L10H7, which we call the context-free residual state. Repeating the experiment used to generate Figure 20 but using the context-free residual state rather than the effective embedding, we find a more faithful approximation of L10H7's keyside input as Figure 21 shows that the median change in L10H7's attention weights is −0.06 which is closer to 0. M.3 MAKING A MORE FAITHFUL QUERYSIDE APPROXIMATION We perform a similar intervention to the components on the input to the model's query circuit. We study the top 5% of token completions where L10H7 has most important effect. For the two key tokens with highest attention weight in each of these prompts, we project the query vector onto the unembedding vector for that key token. We then recompute attention probabilities and calculate how much this differs from the unmodified model. We find that again our approximation still causes a lot of attention decrease in many cases (Figure 22). There is a component of the queryside input perpendicular to the unembedding direction that is im- portant for L10H7's attention. This component seems more important for L10H7s attention when the unembedding direction is more important, by performing an identical experiment to the experi- 22 151015≥20020406080100Query and Key Inputs:Q = MLP 0 (W E )K = MLP 0 (W E )Q = W U K = MLP 0 (W E )Token ranks in QK circuit (inc. bias)Token rankPercentage of Model VocabularyW E MLP 0 (W E )W U W U MLP 0 (W E )W E 110100100010000CountL3H0: number of top ranks tokensKeyside lookup tableQueryside lookup table5 / 5025710 / 502579 / 5025741 / 5025721904 / 5025739 / 50257493 / 50257289 / 50257630 / 50257 Preprint. Under review. Figure 20: Change in attention on tokens when projecting key vectors onto the effective embedding for tokens. Figure 21: Change in attention on tokens when projecting key vectors onto the context free residual state. 23 Preprint. Under review. Figure 22: Change in attention on tokens when projecting query vectors onto the unembedding vectors for particular tokens. Figure 23: Correlation between change in attention on tokens when projecting onto the component parallel to the unembedding and (x-axis) and also projecting onto the component perpendicular to the unembedding (y-axis). ment that produced Figure 22 except projecting onto the perpendicular direction, and then measuring the correlation between the attention change for both of these interventions on each prompt, shown in Figure 23. The correlation shows that it's unlikely that there's a fundamentally different reason why L10H7 attends to tokens other than copy suppression, as if this was the case it would be likely that some points would be in the (very negative x value, close-to-0 y value) region. This does not happen often. We're not sure what this perpendicular component represents. Section 4.2 dives deeper into this perpendicular component in the IOI case study, and Appendix L further shows that the model parts that output large unembedding vectors (the Name Mover heads) are also the parts that output the important perpendicular component. N CSPA WITH QUERY PROJECTIONS In this appendix, we design a similar ablation to CSPA, except we compute L10H7's attention pattern by only using information about the unembeddings in the residual stream, and the exact key tokens present in context, and we also do not perform any OV interventions. This means that together we only study how confident predictions in the residual stream are, as well as which types of tokens are more likely to be copy suppressed. 24 Preprint. Under review. A simple baseline. The simplest query projection intervention is to recalculate the attention score on each key token T by solely using the residual stream component in the direction WU [T ]. Sadly, this intervention results in only 25% of KL divergence recovered. Improving the baseline. Observing the starkest failure cases of the simple baseline, we often see that this intervention neglects cases where a proper noun and similar words are copy sup- pressed: the model attended most to a capitalized word in context 9x times as frequently as oc- curred in this ablation. To remedy these problems, we performed two changes. 1) Following Appendix K, when we compute the attention score back to a token T , we don't just project onto the unembedding vector WU [T ], but instead take all T ∗ that are semantically similar to T , and project onto the subspace spanned by all those vectors. 2) we learnt a scaling and bias factor for every token in GPT-2 Small's vocabulary, such that we multiply the attention score back to a to- ken T by the scaling factor and then add the bias term. We never train on the test set we eval- uate on, and for more details see our Github https://github.com/callummcdougall/ SERI-MATS-2023-Streamlit-pages. With this setup, we recover 61% of KL divergence. Limitations. This setup may recover more KL divergence than the 25% of the initial baseline, but clearly shows that L10H7 has other important functions. However, observing the cases where this intervention has at least 0.1 KL divergence to the original model (57/6000 cases), we find that in 39/57 of the cases the model had greatest attention to a capitalized word, which is far above the base rate in natural language. This suggests that the failure cases are due to our projection not detecting cases where the model should copy suppress a token, rather than L10H7 performing an entirely different task to copy suppression. O WEIGHTS-BASED EVIDENCE FOR SELF-REPAIR IN IOI In this section, we provide evidence for how the attention heads in GPT-2 Small compose to perform self-repair. As shown in Elhage et al. (2021), attention heads across in different layers can compose via the residual stream. Copy Suppression qualitatively explains the mechanism behind the self-repair performed in the Neg- ative Heads: ablating the upstream Name Mover Heads reduces copying of the indirect object (IO) token, causing less attention to that token (Appendix P). In this section, we show that the opposite effect arises in backup heads: ablation indirectly cause more attention to the IO token, as the Name Mover Heads outputs prevent backup heads from attending to the IO token. To reach this conclusion, we conduct a weights-based analysis of self-repair in GPT-2 Small. Specif- ically, we can capture the reactivity of downstream heads to Name Mover Heads by looking at how much the OV matrix WOV of the Name Mover Heads causes Q-composition (Elhage et al., 2021) with the QK matrix WQK of a downstream QK-head. To this end, we define M := MLP0(WE)⊤W T OV WQKMLP0(WE) ∈ Rnvocab×nvocab . (7) Figure 24: A graph of the Median Token Ranks between the Name Mover Heads (on the OV side) and Layer 10 and 11 Heads (on the QK side). There are nnames = 141 names. 25 1128613996727911416565138743011714111983341384573391112140128138112926713418277136106341231411276363138103601061110271231411393760131103741161128L10H0L10H1L10H2L10H3L10H4L10H5L10H6L10H7L10H8L10H9L10H10L10H11L11H0L11H1L11H2L11H3L11H4L11H5L11H6L11H7L11H8L11H9L11H10L11H11L10H0L9H6L9H9050100Median RankMedian Token Ranks in Q-Composition QK circuitQK HeadOV Head Preprint. Under review. Figure 25: Measuring attention paid to names when editing the input Negative Heads receive from Name Mover Heads. M is an extension to the setup in Section 3.216.17 We studied this composition over the nnames = 141 name tokens in GPT-2 Small's vocabulary by studying the Rnnames×nnames submatrix of M correspond- ing to these names. For every (Name Mover Head, QK-head) pair, we take the submatrix and mea- sure the median of the list of ranks of each diagonal element in its column. This measures whether QK-heads attend to names that have been copied by Name Movers (median close to 1), or avoid attending to these names (median close to nnames = 141). Figure 24 shows the results. These ranks reflect qualitatively different mechanisms in which self-repair can occur (Table 2). In the main text Figure 8, we colour edges with a similar blue-red scale as Figure 25. P NEGATIVE HEADS' SELF-REPAIR IN IOI We edited the input that the Negative Heads receive from the Name Mover heads by replacing it with an activation from the ABC distribution. We then measured the difference between the attention that the negative head paid to the IO token compared to the S token. We found that the Negative Heads now attended equally to the IO and the S1 token, as the average IO attention minus S1 attention was just 0.08 for Head L10H7 and 0.0006 for Head L11H10 (Figure 25). Since Negative Heads are just copying heads (Section 3.1), this fully explains copy suppression. Q UNIVERSALITY OF IOI SELF-REPAIR Since Negative Heads exist across distributions and models, we also expect that IOI self-repair potentially exists universally as well. Initial investigations across other models about self-repair in the IOI task highlight similarities to the phenomena we observe here but with some subtleties in the specifics. For instance, one head in Stanford GPT-2 Small E wrote 'less against' the correct token upon the ablation of earlier Name Mover Heads; however, it is distinct from the copy suppression heads in GPT-2 Small in that it attended to both the IO and S2 tokens equally on a clean run. R AMPLIFYING QUERY SIGNALS INTO SELF-REPAIR HEADS As a part of our exploration into how self-repair heads respond to signals in the residual stream, we noticed that the output of the name mover heads was extremely important for the queries of the self-repair heads. We wanted to decompose the signal down into subcomponents to determine which parts were meaningful - in particular, we were curious if the IO unembedding direction of the name mover head's output was important. 16This is similar to how Elhage et al. (2021) test the 'same matching' induction head QK circuit with a K-composition path through a Previous Token Head 17As in Section 3.2 we ignore query and key biases as they have little effect. 26 Preprint. Under review. Figure 26: Observing the change in attention scores of Negative Heads upon scaling the presence of the IO unembedding in the query To do this, we intervened on the query-side component of a self-repair head by: 1. Making a copy of the residual stream before the self-repair head, and adding a scaled vector s⃗v (where ⃗v is a vector and s is some scaling) to this copy (before the LayerNorm) 2. Replacing the query component of the head with the query that results from the head read- ing in this copied residual stream into the query 3. Varying the scaling s while repeatedly observing the new attention patterns of the self- repair of the head Figure 26 shows a specific instance in which the vector is the output of head L9H9. We add scaled versions of the output into the residual streams of the Negative Heads which produce their queries (before LayerNorm). Additionally, we do an analogous operation with the projection of L9H9 onto the IO unembeddings, as well as the projection of L9H9 away from the IO unembeddings. We observe that the Negative Heads have a positive slope across all of the IO subgraphs. In par- ticular, this still holds while using just the projection of L9H9 onto the IO unembedding direction: this implies that the greater the presence of the IO unembedding in the query of the negative name mover head, the greater the neagtive head attends to the IO token. The result still holds whether or not we add the vector before or after LayerNorm, or whether or not we freeze LayerNorm. Unfortunately, this same trend does not hold for backup heads. In particular, it seems that while we expect a predictable 'negative' slope of all the subgraphs (as the L9H9 output causes the backup heads to attend less to the IO token), this trend does not hold for the projection of L9H9 onto the IO unembedding. This provides additional evidence for the claim that the unembeding component is not the full story of all of self-repair. GLOSSARY Anti-induction Anti-induction heads are our name for 'anti-copying prefix search' heads (Olsson et al., 2022). See Appendix A. Backup heads are attention heads that are characterised by responding to the ablation of a head by imitating the original behavior, studied in the IOI task in Section 4. 27 Preprint. Under review. Copy Suppression is a mechanism in a language models determined by the three steps naive copy- ing, attention and suppression, as described in Section 1. Copy suppression-preserving ablation (CSPA) refers to our ablation that deletes all functionality of attention head 10.7 except the copy suppression mechanism (Section 3.3.1). Direct Logit Attribution is defined in https://www.neelnanda.io/ mechanistic-interpretability/glossary. Effective embedding is what models use to identify tokens at different positions after the first trans- former layer. We define this as MLP0(WE), and discuss the choice in Appendix I. Eqn. (1) is defined in Section 3.1 and is our OV circuit expression. Eqn. (2) is defined in Section 3.2 and is our QK circuit expression. Eqn. (3) is defined in Section 3.3.1 and measures how well ablations preserve L10H7's functional- ity. Eqn. (4) is defined in Section 4.1 and measures how much self-repair a component c explains. IOI is a task that language models perform to predict that ' John' completes the sentence 'When John and Mary went to the store, Mary gave a bottle of milk to' (Wang et al., 2023). Logit difference is described in point iii) in Section 4.1. Logit Lens We can measure which output predictions different internal components push for by applying the Logit Lens method (nostalgebraist, 2020). Given model activations, such as the state of the residual stream or the output of an attention head, we can multiply these activations by GPT-2 Small's unembedding matrix. This measures the direct effect (ie not mediated by any downstream layers) that this model component has on the output logits for each possible token in the model's vocabulary (sometimes called direct logit attribution). The Logit Lens method allows us to refer to the model's predictions at a given point in the network. Mean ablation refers to replacing the output of a machine learning model component with the mean output of that component over some distribution. Name Mover Heads are heads that attend to (and copy) IO rather than S in the IOI task. Negative Head are attention heads in transformer language models which which primarily reduce the model's confidence in particular token completions. This is a qualitative definition. These heads tend to be rare since the majority of attention heads in models positively copy tokens (Elhage et al., 2021; Olsson et al., 2022). Self-repair refers to how some neural network components compensate for other components that have been perturbed earlier in the forward pass (McGrath et al., 2023). 28
http://arxiv.org/abs/2310.04622v1
"2023-10-06T23:13:40"
"2023-10-06T23:13:40"
FluxGAN: A Physics-Aware Generative Adversarial Network Model for Generating Microstructures That Maintain Target Heat Flux
We propose a physics-aware generative adversarial network model, FluxGAN, capable of simultaneously generating high-quality images of large microstructures and description of their thermal properties. During the training phase, the model learns about the relationship between the local structural features and the physical processes, such as the heat flux in the microstructures, due to external temperature gradients. Once trained, the model generates new structural and associated heat flux environments, bypassing the computationally expensive modeling. Our model provides a cost effective and efficient approach over conventional modeling techniques, such as the finite element method (FEM), for describing the thermal properties of microstructures. The conventional approach requires computational modeling that scales with the size of the microstructure model, therefore limiting the simulation to a given size, resolution, and complexity of the model. In contrast, the FluxGAN model uses synthesis-by-part approach and generates arbitrary large size images at low computational cost. We demonstrate that the model can be utilized to generate designs of thermal sprayed coatings that satisfies target thermal properties. Furthermore, the model is capable of generating coating microstructures and physical processes in three-dimensional (3D) domain after being trained on two-dimensional (2D) examples. Our approach has the potential to transform the design and optimization of thermal sprayed coatings for various applications, including high-temperature and long-duration operation of gas turbines for aircraft or ground-based power generators.
[ "Artem K. Pimachev", "Manoj Settipalli", "Sanghamitra Neogi" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04622v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04622v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cond-mat.dis-nn", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cond-mat.dis-nn", "cs.LG" ]
FluxGAN: A Physics-Aware Generative Adversarial Network Model for Generating Microstructures That Maintain Target Heat Flux Artem K. Pimachev,1 Manoj Settipalli,1 and Sanghamitra Neogi1, ∗ 1Ann and H.J. Smead Aerospace Engineering Sciences, University of Colorado Boulder, Boulder, CO 80303, USA (Dated: October 10, 2023) We propose a physics-aware generative adversarial network model, FluxGAN, capable of simul- taneously generating high-quality images of large microstructures and description of their thermal properties. During the training phase, the model learns about the relationship between the local structural features and the physical processes, such as the heat flux in the microstructures, due to external temperature gradients. Once trained, the model generates new structural and associated heat flux environments, bypassing the computationally expensive modeling. Our model provides a cost effective and efficient approach over conventional modeling techniques, such as the finite element method (FEM), for describing the thermal properties of microstructures. The conventional approach requires computational modeling that scales with the size of the microstructure model, therefore limiting the simulation to a given size, resolution, and complexity of the model. In contrast, the FluxGAN model uses synthesis-by-part approach and generates arbitrary large size images at low computational cost. We demonstrate that the model can be utilized to generate designs of thermal sprayed coatings that satisfies target thermal properties. Furthermore, the model is capable of gen- erating coating microstructures and physical processes in three-dimensional (3D) domain after being trained on two-dimensional (2D) examples. Our approach has the potential to transform the design and optimization of thermal sprayed coatings for various applications, including high-temperature and long-duration operation of gas turbines for aircraft or ground-based power generators. INTRODUCTION In recent years, machine learning techniques, such as generative adversarial networks (GANs), are increasingly being used to explain deterministic multiphysics phenom- ena where the underlying physical model is complex or unknown. Physics-informed generative adversarial net- works have been proposed for solving forward, inverse, and mixed stochastic problems using data from a lim- ited number of scattered measurements [1]. Instead of relying solely on data for training, this approach en- coded the governing physical laws in the GAN archi- tecture in the form of stochastic differential equations. FluidGAN has been proposed for learning and predict- ing time-dependent convective flow coupled with energy transport [2]. StressGAN model was developed to gener- ate mechanical stress distributions for various complex cases of geometry, load, and boundary conditions [3]. The model was shown to predict more accurate high- resolution stress distributions than a convolutional neu- In parallel, GANs have shown re- ral network model. markable progress for creating high-resolution synthetic images, visually similar to their real counterparts, sup- ported by revolutionary advents in the graphical data do- main. Until recently, training such model required enor- mous amount of training images and was highly unstable. GANs have been shown to be highly effective in generat- ing realistic microstructural data that can be used to aug- ment limited experimental data or simulate microstruc- tures that are challenging to obtain experimentally [4, 5]. ∗ sanghamitra.neogi@colorado.edu The style-based GAN (StyleGAN2) architecture [6], im- plemented the style transfer approach [7] with the adap- tive discriminator augmentation (ADA) [8] mechanism, and demonstrated that high-quality images can be gen- erated with limited training data. In this study, we propose a new FluxGAN model that simultaneously generates high-quality microstruc- tural images and high-resolution description of thermal properties of these microstructures. We adopt the Style- GAN2 architecture to develop the model and train the model using images that include both microstructural information and the associated physical (i.e., thermal) phenomena. We demonstrate the capabilities of our ap- proach for the analysis and design of microstructure- controlled thermal properties of thermal sprayed coat- ings. The thermal sprayed coatings exhibit highly di- verse structural environments, including pores with dif- ferent shapes and sizes, and varied size grains aligned at different crystallographic orientations. The microstruc- tural features strongly affect interface-sensitive material properties, such as thermal diffusivity. Additionally, the structural features could change and evolve due to sinter- ing in high temperature environments. The presence of microstructural features is often quantified by the poros- (pore volume)/(total volume)×100 %. ity parameter: The variation of thermal properties of coatings has com- monly been described in relation with porosity, using phenomenological models [9]. However, global param- eter (e.g. porosity) based models may not accurately capture the physics of heat transfer across various mi- crostructural features and feature interfaces. The com- plexity of structural features and their evolution makes it highly challenging to characterize the physical properties 3 2 0 2 t c O 6 ] n n - s i d . t a m - d n o c [ 1 v 2 2 6 4 0 . 0 1 3 2 : v i X r a of these coatings, especially after aging, using existing experimental and numerical approaches. Our proposed FluxGAN model provides highly accu- rate prediction of thermal phenomena in coatings with different microstructures that include different porosities, grain sizes, and crystallographic orientations. We use a small number of two-dimensional (2D) images of niobium thermal sprayed coatings, obtained with backscatter elec- tron (BSE) imaging technique, as the 'true' image of the coating microstructures. We compute the thermal prop- erties of the microstructures using the image-based finite element method (FEM). We train the FluxGAN model using superimposed images that include both microstruc- tural and thermal property data. The FluxGAN model combines the physical properties predicted by FEM and the GAN architecture, for generating diverse microstruc- tures with desired thermal properties. We use separate FEM simulations to validate the generated thermal data. The model uses synthesis-by-part approach and generates images of arbitrary size patch by patch, which requires constant memory usage. In contrast, the FEM memory usage and computational time scales with the image size. The combination of image-based FEM and GAN models offers a promising solution to overcome the limitations of traditional experimental and numerical methods. Our model provides a cost effective and efficient approach for describing the microstructure-controlled thermal proper- ties of thermal sprayed coatings. The model establishes a direct relationship between structural features and ther- mal properties of coatings, which could be utilized to better control and optimize their thermal properties. We demonstrate that our model can be used to design ther- mal sprayed coatings that can maintain tailored heat flux that meets application-specific requirements. Our ap- proach has the potential to transform the design and op- timization of thermal sprayed coatings for various indus- trial applications, including high-temperature and long- duration operation of gas turbines for aircraft or ground- based power generators. METHODS Model Overview Figure 1(i) shows the overview of our physics-informed FluxGAN model. The model includes a training and a generation phase. We train the model with images that include information about structural as well as thermal properties of the microstructure. We obtain the 2D struc- tural images, as shown in Fig. 1(a), using backscatter electron (BSE) imaging and simulate the thermal prop- erties using FEM techniques. Figure 1(e) shows the spa- tial distribution of heat flux, Q(x, y), generated in the microstructure, due to the application of temperature gradient along the top-to-bottom direction. Figure 1(c) and (d) show the graphical domain representation of the heat flux components, Qx and Qy, respectively. We 2 create RGB images by superimposing the experimental structural images and the heat flux maps, as shown in Fig. 1(b). We provide the RGB images as input to the FluxGAN model. The model identifies the different fea- tures of the RGB training images, referred to as styles, in an unsupervised manner. The styles not only classify structural features but are strongly associated with heat flux patterns of the RGB images. In the unguided gener- ation phase, the FluxGAN model requires minimal input from the user and generates a new image corresponding to the input. An example input is shown in Fig. 1(f). The input specifies the overall height and width of the image and the spatial map of styles to be included. The spatial map includes the number of styles that can be identified in the image (styles 1 and 2), the locations for regions with styles 1 and 2 (anchors), and the merging function that can be applied to obtain smooth interfaces between the regions. Figure 1(g) shows a representative microstructure, generated by the FluxGAN model. The generated image includes structural features that corre- spond to styles 1 and 2 as specified by the user input. The image also includes information about the heat flux that will be observed if the microstructure is subjected to temperature gradients along the top-to-bottom image di- rection. Thus, the FluxGAN model directly generates de- signs of representative microstructures and correspond- ing physical properties from a minimal user input. The model can even generate designs of new classes of struc- tures that are not present in original experimental im- ages. For example, different designs can be created by combining different styles, varying the positions of the styles in two-dimensional (2D) or three-dimensional (3D) spatial domains. Additionally, the model offers guided assignment of styles in the generated microstructures, based on the specifications of the input image. For ex- ample, given a known heat flux distribution in the heat source or sink region as input, the model allows for in- verse design of microstructures that satisfies the target heat flux condition. We describe the different compo- nents of the FluxGAN model in the following sections. We demonstrate the effectiveness of the FluxGAN model by using single phase niobium (Nb) thermal spray coat- ings as an example. However, our model can be broadly applied to different materials and structures to assess how well they satisfy target physical properties. The conventional approach for designing new coatings, as outlined in Fig. 1(ii), typically iterates through the fol- lowing steps: (1) fabrication of coatings, (2) experimen- tal characterization, (3) developing computational mod- els based on experimental images, (4) physical property calculation, and repeat (1-4) till the fabricated structures satisfy target physical properties. Our FluxGAN model provides an expedited approach to inform the design of new microstructures that satisfy target physical proper- In this ties, bypassing the expensive iterative process. study, we have chosen the styles in an arbitrary man- ner. However, the styles can be associated with specific physical conditions. For example, the different spray in- 3 FIG. 1. Overview of FluxGAN model and its advantage over conventional approach: (i) The model includes a training and a generation phase. We train the model with (b) superimposed RGB images that include (a) experimental structural images and (c,d) heat flux data, simulated with FEM techniques. The model classifies the distinct features of the RGB images and assigns them as different styles. Once trained, the model generates images based on user input. (f) Spatial map of different styles as input. (g) The model generates new structural image superimposed with associated heat flux, that satisfies target thermal properties. (ii) In contrast, conventional design approach follows an expensive and iterative cycle until microstructures with target physical properties are obtained. tervals in a thermal spray process could result in different structural features. The different features can also be as- sociated with diverse environmental conditions, such as high temperatures or corrosion. As styles are strongly associated with the heat flux, physical meaning of styles can be regions of high or low thermal conductance and temperature hot spots, etc. A FluxGAN model aware of the relationship between the styles and synthesis or en- vironmental conditions can offer great practical advan- tage. For example, the styles in generated images can inform strategies to synthesize microstructures with tar- get functionalities and also, provide information about the reliability of microstructure in diverse environmental conditions. 4 sentative of materials properties or processing conditions. However, some features may appear due to difference in lighting conditions during imaging. Note that the Flux- GAN model identifies the different styles of the train- ing images in an unsupervised manner. To ensure that the microstructure images only include 'true' features, we preprocess the grayscale BSE images and remove fea- tures that appear due to irregular image brightness. The preprocessing is an essential step since our goal is to de- velop a model that can relate 'true' structural features with the corresponding physical properties. First, we ob- tain the pixel intensity distribution of the BSE images, by counting the number of pixels that has a given inten- sity in the range between 0 and 255. Figure 2(a) shows that the coating region of the images have intensities ≥ 50 in this scale. The appearance of the distinct peaks can be attributed to different lighting conditions during imaging. We scale the intensities to values in the range between 0 and 1. We then shift the mean of the dis- tribution to 0.5 using a power transformation. Finally, we rescale the pixel intensity distribution of the coating region to be in the range from 50 to 255. Figure 2(b) shows the pixel intensity distribution after the transfor- mation. The intensity values below 50 represent pores or air regions where the coating material is not present. Augmentation of Training Set Our experimental dataset is limited to nine BSE im- ages, as shown in Fig. 2. However, the GAN models require enormous amount of training images to gener- ate high-resolution images as output. Extensive efforts are ongoing to develop models that can create high qual- ity images with limited training data [10, 11]. Recent approaches, such as StyleGAN2 [6], require a smaller training set, however, still require substantial number of training images. We implement different strategies to augment the training dataset. We apply rotation and re- flection operations on the raw images and add the new images to the dataset. The new images include addi- tional variations of structural features that impact the thermal properties. We thus obtain a diverse set of im- ages to train the FluxGAN model. However, it is es- sential that the new images include features that are consistent with the physical conditions displayed by the original images. This constraint imposes restrictions on the type of operations we could perform to create new images. For example, all experimental images of Fig. 2 (and also, Fig. 3(i)) show that the images have flatter bottom surfaces and uneven top surfaces. These features appear because the thermal spray coatings are fabricated on top of substrates. We only apply horizontal flip trans- formations but do not apply any vertical flip operations to maintain similar layer-like features in the new images. Additionally, when the droplets of melted material are sprayed in a regular interval, the material solidifies and forms layers in the top-to-bottom direction. As can be FIG. 2. Experimental images of coating microstruc- tures: (i) Raw BSE images of niobium thermal spray coat- ings. (ii) Magnified image of microstructure shows a wide variety of structural features, such as flat splats and porosi- ties due to conditions during the synthesis process. TRAINING PHASE Processing of Experimental Images Figure 2 shows the 2D experimental BSE images of the Nb thermal spray coatings that we use to demon- strate the performance of the FluxGAN model. The dimension of each image is 112μm × 160μm (410px × 587px). Three distinct regions can be visually identified from the images: the gray middle region that shows the presence of the coating microstructure, the top and bot- tom dark regions where no coating material is present and the two interface regions between the gray coating and the dark regions. We assume that the dark regions of the images represent presence of air. We show a magni- fied version of a representative coating microstructure in Fig. 2(ii). As can be noted, the microstructure includes distinct features, such as flat splats and globular and in- terfacial porosities. In addition to these features, a wide variety of small features can also be noted that are repre- seen from Fig. 2(ii), the layers are highly uneven. This is because the sprayed material might solidify at different rates in the sprayed microstructures during fabrication. Highly anisotropic features may appear when droplets of melted material are sprayed over already solidified splats. To ensure that the new images retain such characteris- tics, we apply only small angular rotations between -2.5 to +2.5 degrees, with 11 incremental steps. We set the top and bottom air regions to be 80 pixels wide and add extra space as needed so that the coating region stays within the image boundary, as shown in Fig. 3(ii). The augmented dataset contains a total of 198 (9 original × 11 rotated × 2 flipped) superimposed images. Computation of Thermal Properties We compute the thermal properties of the coating mi- crostructures using image-based FEM techniques, as im- plemented in COMSOL software [12]. We assume that the heat conduction direction is along the top-to-bottom direction of the coatings. We convert the microstructure images to masks by assigning all pixels with intensities < 50 to black color, representing air, and the pixels with intensities ≥ 50 to grey color, representing niobium. Fig- ure 1(a) and (e) show an experimental image and the corresponding masked image, respectively. We use the masked images as input for image-based FEM simula- tions. We import the masked images to COMSOL and use the built-in function, im(x, y) = {0, 1}, to mark dif- ferent regions within each image. The discrete values cor- respond to black and gray regions of the images, respec- tively. This creates rectangular simulation domains that have same dimensions as the input images. We use the image function, im(x, y), and the thermal conductivity values of air and Nb, to define spatially resolved thermal conductivities, κlocal(x, y), in the rectangular simulation domain: κlocal(x, y) = (cid:40) κAir, κNb, if im(x, y) = 0 if im(x, y) = 1 (1) We choose thermal conductivity of niobium (κNb = 54 Wm−1K−1) for all grey pixels and thermal conductiv- ity of air (κAir = 0.1 Wm−1K−1) for all black pixels. We also define the local densities, ρlocal(x, y), and local specific heat capacities, Cp, local(x, y), using similar equa- tions as Eq. 1. We choose ρAir,Nb = {1.225, 8570} Kgm-3 and C Air, Nb = {1008, 260} JKg-1K-1, respectively. How- p ever, the heat flux distribution is primarily determined by the local thermal conductivities, as expected. The thermal properties of porous materials are commonly calculated using effective models, such as the Maxwell- Eucken model [9]. These models only take the porosity of the structure into account and do not consider the distribution of pores and their shapes to calculate ther- mal properties. Instead, we compute the heat flux in the coatings using image-based FEM and Fourier's law: 5 FIG. 3. Preparation of training images: (i) BSE image. Pixel intensity distribution of BSE images (a) before and (b) after image processing; Histogram shows the number of pixel counts for different pixel intensity in a monochrome channel. Heat flux along components, (c) Qx, and (d) Qy, for applied temperature gradients. Top horizontal axes labels show heat flux values and the bottom labels show graphical domain en- coding for the monochrome channels. Three channel repre- sentations of (ii) structural and (iii-iv) heat flux data. The bottom label values of (b-d) are used as color scheme of im- ages (ii-iv). The three channels are superimposed to create RGB images. (v) Tiles extracted from RGB images are used as training images. q = −dzκlocal∇T . Here, q is the heat flux along the temperature gradient ∇T and dz=1m is the thickness along z direction. We only discuss the heat flux in the 2D x − y plane of the coatings and report the values of Q = q/dz, in units of Wm−2. We find that the heat flux and the resulting effective thermal conductivity can be significantly different for two coatings with the same porosity but different pore distributions. Such variability cannot be captured by the effective models. We assume that both the top and the bottom no- material regions are made of low thermal conductivity material, i.e., air. We model the top region as heat source with temperature equal to 700K and the bottom region as heat sink with temperature 300K. Thus, we simulate an applied temperature bias of 400 K along the top-to- bottom direction of the coatings, for all BSE masked im- ages. We model the lateral boundaries of the simulation cells as perfect insulators. We define a rectangular grid for the FEM simulations of dimension, py × px. Here px and py are the number of pixels along the x and the y directions of the images. We use an adaptive meshing scheme and carry out five refinements in COMSOL to identify a mesh grid that minimizes the L2 norm of the squared error. The image function im is defined on the grid and assigns the local material properties accordingly. We compute heat flux, q, using these adaptive nodes and element shape functions. For each image, we iteratively solve for q that satisfies the boundary conditions and lo- cal thermal conductivities. We assume dz = 1m in our calculations, thus, Q have the same values as q, but dif- ferent units. We refer to Q(x, y) as heat flux in the sub- sequent discussion. Q(x, y)'s are defined on a rectangular grid of the same resolution as the input masked image. However, the grid is different for each image, depending on the original resolution of the experimental image and the applied transformations as described in the 'Augmen- tation of Training Set' section. The associated heat flux also vary significantly, as can be expected. We show the components of heat flux along x and y directions in Fig. 3(c,d), respectively. The labels of the top horizontal axes show the heat flux values. We trans- form Qx and Qy to represent them in the graphical do- main. We linearly scale Qx and Qy such that the mid- dle 98% of the distribution falls in the range from 0 to 255. We assign the left and the right 1% of heat flux distribution to values of 0 and 255, respectively. We transform the Q values using the following equations: Qx = Qx/106 × 173 + 127; Qy = Qy/106 × 153 + 255. We obtain these equations by assigning the bounds of the middle 98% of the Q-distributions to graphical en- coding values. The bottom axes labels of Fig. 3 (c,d) correspond to the graphical domain encoding for the monochrome channels. Note that the FEM simulation domains have horizontal reflection symmetry. We lever- age this aspect and obtain results for 99 additional im- ages by horizontally reflecting the FEM-generated heat flux Q(x, y) [W/m2]. In the reflected images, the (x, y) values are flipped horizontally and the magnitudes of Qx change sign, however, the magnitudes of Qy stays the same. Thus, we obtain data for 198 images from the 99 FEM calculations. 6 FIG. 4. Schematic of the FluxGAN model workflow. Model architecture consists of (i) a generator, and (ii) a dis- criminator. (iii) Large-size images are generated by learning spatially extensible representations living in a latent space. Images in the first and the second columns are produced by varying global latent and styles respectively. Top, middle, and bottom images correspond to the green, red, and blue boxed regions in the implicit image (i), respectively. Preparation of Training Images We superimpose structural images and the correspond- ing heat flux maps into three-channel RGB images. The R, G, and B channels are the graphical encoding of Qy, Qx, and the structural images, as shown in Fig. 3(d), (c) and (b), respectively. We train the FluxGAN model on the relationship between the structural features of the coatings and the associated thermal properties. To this end, we create a training set by uniformly sampling over- lapping square tiles of size 17.4μm × 17.4μm (64px × 64px) from the RGB images. We split each RGB image into 19 × 13 overlapping tiles and create a training set that includes 48,906 (= 198 × 19 × 13) RGB images. Fig- ure 3(v) shows representative square tiles included in the training set. Each image is represented by an array of numbers. The dimension of the array is the height times the width of the tile, times the number of channels in the image: 64px × 64px × 3. The array elements are pixel intensities in the range from 0 to 255, that correspond to the graphical encoding of the heat flux maps and the structural images. Unsupervised Learning of Styles We train the FluxGAN model using square 64px × 64px RGB patches, as discussed in the previous section. GAN models can learn from small patches and success- fully generate new large-size images. However, the re- construction of large scale holistic images can be chal- lenging. For example, techniques such as consecutive im- age outpainting can result in discontinuous and repetitive structures [13, 14]. Several models have been proposed recently that can generate large images but they fail to maintain a global coherence in the generated images [15– 17]. The recently proposed InfinityGAN approach has shown a superior ability to generate holistic large-size im- ages after being trained on small patches [18]. The gener- ated images show a great diversity and continuity along all spatial directions. We implement the InfinityGAN approach in our FluxGAN model to generate large coat- ing images, learning from small patches. The approach generates large holistic images, also known as implicit im- ages, with diverse local features. The InfinityGAN archi- tecture adopts functionality from StyleGAN2 [6], which the FluxGAN model leverages to learn the different styles or the textures of the images, in an unsupervised man- ner. InfinityGAN synthesizes images of arbitrarily large- size by learning spatially extensible representations liv- ing in a latent space. The latent space is encoded by a global latent vector that guides the holistic layout of the infinite-pixel image, and a local latent tensor that expresses structural variations of small region patches. We show a schematic of the FluxGAN model workflow in Fig. 4. The model consists of a generator that learns to generate plausible images (Fig. 4(i)), and a discrimina- tor that learns to distinguish the generated fake images from real images (Fig. 4(ii)). The generator consists of two modules, a structure and a texture synthesizer. The structure synthesizer is a neural implicit function [19– 22], that takes three sets of inputs: a global latent vari- able, a local latent variable and a continuous coordinate that samples the sub-regions of the implicit image. The texture synthesizer is a fully convolutional StyleGAN2 model [6], with all positional information removed. In addition to the same three inputs, a set of randomized noises are provided as input to the texture synthesizer, to model variations of fine-grained texture within the lo- cal structural representations. A mapping layer projects global latent onto a texture style vector, and the tex- 7 FIG. 5. Representative input maps and output images of the FluxGAN model. The first column shows input maps and the second and the third columns show two repre- sentative images generated by the model for each input map, respectively. Increasing the number of styles and varying their spatial arrangement affects both the overall appearance and the local diversity of the generated images. ture style is injected into all pixels in each layer of the global image via feature modulation. Similar to Infinity- GAN, the model uses 256 and 512 dimensions for local and global latent vectors, respectively, for unsupervised learning of structure and texture variations. We use coor- dinate grid to specify the location of the local structural patches to be sampled. We use sine functions with pe- riod T = 56 to sample both x and y directions of the local latents. Our training dataset includes 64px × 64px RGB image tiles, as mentioned previously. However, the model does not know the positioning of these 64px×64px tiles in the global image. To address the issue, the model uses smaller 37px × 37px patches and learns to coordi- nate the patches relative to each other, during training. We use the same architecture of the discriminator as im- plemented in StyleGAN2. The schematic of the discrim- inator workflow is shown in Fig. 4(ii). The discriminator compares generated 37px × 37px patches with those in- cluded in the training set images. We assess the quality of images created by the model during training and find that the model achieved the smallest value of the Fr ́echet inception distance (FID) metric [23] of 2.64 after 660,000 training steps. Figure 4(iii) shows representative output images that are generated based on single-style input maps. The in- put maps determine the different latent variables and drive the generation of the environments. Since the in- puts are single-style maps, the model uses a single latent vector and generates all the regions of the microstructure. We vary the latent vector and compare the generated im- ages, to examine the information encoded in the latent space. We obtain three sets of global latent vectors by using different random sampling from a unit Gaussian distribution. We use the three different latent vectors and keep all other variables (e.g., coordinates and styles) fixed, to obtain the three images shown in the first col- umn of Fig. 4(iii). The structural environments of the images vary significantly when we change the global la- tent variables. The images show different regions of the coatings, such as the microstructure or the surface and air regions. Together the top surface, material, and bot- tom surface images constitute the large coating images. The images are representative of the regions marked with green, red, and blue boxes in Fig. 4(i). It is interesting to note that the the heat flux patterns across the im- ages appear similar in magnitude, especially in regions away from the pores. For each choice of the global la- tent, we vary the styles and obtain the images shown in the second column of Fig. 4(iii). The structural envi- ronments remain very similar between the set of images shown in each row, however, the magnitudes of the heat flux are varied. This result implies that the global latent variables encode the environment (e.g., structure) and the styles are highly related to the physical phenomenon of interest (e.g., heat flux maps). This insight can offer great practical advantage. For example, styles can inform changes of heating conditions or reveal strategies to de- sign structural features such that heat flux can be guided away from sensitive regions of the microstructures. Thus, FluxGAN model trained on style-based descriptions of- fers great practical advantage for designing microstruc- tures that satisfy target thermal properties. 8 FIG. 6. Comparison of structural features of generated (blue) and experimental images (red). We show the mean dependency (solid lines) and the range (shaded regions) for the chord-length distribution and the two-point correlation functions, in the second and the third column, respectively. GENERATION PHASE Unguided Generation Figure 5 shows representative inputs (first column) and the corresponding images generated as output of the model (second and third column). The model input specifies the overall height and width of the image, the types and the number of styles, the spatial positioning of styles, and merging functions to obtain smooth interfaces between the regions. We show visual representations of the four input maps with different spatial arrangements of styles, in the first column of Fig. 5(i-iv). The input maps include one, two, three, and six randomly chosen styles, respectively. Note that the number of styles de- termines the global latent variables, and consequently, the overall appearance of the generated coating images, which is consistent with InfinityGAN spatial style fusion implementation. The images shown in the second and the third column of Fig. 5(i-iv) highlight the structural diversity in generated images for same input maps. We select 540 1024px × 1024px images generated with single- style and 50 512px × 512px images generated with each multi-style input map, and validate against experimen- tal images using the procedure discussed in the following section. Although we show structural images in Fig. 5, the model outputs are RGB images that contain both structural and heat flux information. We only show the structural channel for the ease of discussion. Validation of Structural Information We compare the structural features of the generated images with those of the experimental BSE images. We analyze three features: pore size distribution, chord- length distribution, and two-point correlation functions. Figure 6(i-iv) shows the comparison between the fea- tures of the experimental images and the images gen- erated from one, two, three and six styles input maps, respectively. The first column shows the density of pores of given area, defined by the ratio between the number of pores with the specific area and the total number of pores. We calculate the pore sizes by counting the num- ber of black pixels inside each pore. The presence of the black pores enclosed within the gray material region can be particularly noted from the experimental image shown in Fig. 2(ii). The smallest pore is of size 1px × 1px ∼ 0.07μm2. This size pores are the highest in number in the coatings as can be noted from Fig. 6(a,d,g). This could be a systematic artifact of the images. Overall, the density of different size pores in all four classes of images match with those in the experimental images. This im- plies that the model is able to produce the anisotropic pore distributions characteristic of the original thermal spray coatings shown in the BSE images. The porous coatings include numerous interfaces between the mate- rial phases and the pore phases. If an imaginary line is drawn in the porous medium, the line will intersect multiple material-pore interfaces. The lengths between these intersections are referred to as chord lengths in the respective phases. The chord length distribution func- tion is then defined by the probability of finding a chord of given length in one of the phases [24, 25]. These func- tions provide a quantitative measure of the structure of the porous media. The second column of Fig. 6 shows the comparison of the chord-length distributions in material phases of experimental (red lines) and generated images (blue lines). The solid and the dashed lines represent the chord-length distributions in the x and y direction, respectively. The results show that there is higher prob- ability of finding longer chords in the x direction com- pared to the y direction in the images. This corresponds to the presence of layer-like features that can be noted from the experimental images, as shown in Fig. 2. The layer-like structures form along the vertical (y) direction when the droplets of melted material are sprayed in a regular interval during the thermal spray process. We show the comparison between the spatial two-point cor- relation functions in the third column of Fig. 6. The spatial correlation function between two points r1 and r2 is defined as ⟨f (x + r1)f (x + r2)⟩ [25, 26], where and ⟨..⟩ indicates a volume average over the spatial coordinate x = (x, y). The characteristic function f (x) is either zero 9 FIG. 7. Comparison of generated heat flux (blue) and (i) Full size generated image with FEM results (red). single-style input map. Average generated heat flux (blue) along (a) horizontal and (b) and vertical directions, and com- pared to FEM results (red). Selected red boxed region is en- larged for comparison between (ii) generated and (iii) FEM results. (iv) (a) Structural and (b-c) heat flux pixel intensity distributions of 540 similarly generated images. or one if the point lies in the material or the pore phase. We note a close match between the two-point correla- tion functions for all four cases. The result for the image generated with the six-style-input map is the closest to the one observed in BSE images. This can be attributed to the higher diversity of microstructures present in the images generated with six-style-input maps. Heat Flux Data Validation 10 We validate the heat flux of the generated coatings against values computed with FEM for the same mi- crostructures. It is essential that the structural envi- ronments and the applied heating conditions of the FEM models are similar to those of the generated coatings. As we illustrate in the above sections, we generate coat- ings with input maps that include spatial arrangement of random choice of styles. The styles are closely asso- ciated with the heat flux patterns in different regions of the coatings. The coatings generated with different in- put maps not only show highly variable heat flux in the microstructures but also different heating conditions in the surface regions. The heating conditions in coatings generated with arbitrarily chosen input maps may not be consistent with the fixed heating conditions imposed in the FEM models. As we discuss in the "Computation of Thermal Properties" section, we simulate a temperature bias of 400K to compute heat flux in all the BSE masks using FEM. To maintain similar heating conditions in generated structures and the FEM models, we provide only single-style-maps as input and generate coating im- ages. We find that the trained FluxGAN model is able to generate full coating images that include material and air regions from sufficiently large (1024px × 1024px) single- style-maps. We show an example generated microstruc- ture and the associated heat flux in Fig. 7(i). The yellow vector arrows represent the resultant of the horizontal (Qx) and the vertical (Qy) heat flux components. We produce masked images from the generated structural channel and compute the heat flux through the masked images using FEM calculations. We compute the average heat flux along the horizontal and the vertical directions of the coatings from the Qx and Qy values of the 1024 pixels of the square image. We show the comparison be- tween the average generated (blue) and FEM-obtained (red) heat flux along the horizontal and the vertical direc- tions, in Fig. 7(i)(a) and (b), respectively. The generated heat flux is in good agreement with FEM results, with mean absolute errors (MAE) of 0.009-0.012 MW/m2 for Qx and 0.013-0.020 MW/m2 for Qy components, respec- tively. Note that the average Qx is approximately zero and the average Qy is always negative. The Qy compo- nents have a dominant contribution to the overall heat flux, since we assume that the temperature gradient is applied along top-to-bottom (negative y) direction. We show an enlarged image of the 100px × 100px red boxed section within the large 1024px × 1024px in Fig. 7 (ii). The corresponding masked image and the FEM result in shown in Fig. 7 (iii). The close match between the heat flux patterns can be particularly noted from the two im- ages. We analyze 540 1024px × 1024px images generated with single-style-input maps. We show the pixel intensity distributions for the three channels in these 540 generated images in Fig. 7(iv). The distributions show high diver- sity and are consistent with those in the training set, see Fig. 3(b-d). FIG. 8. Image outpainting with holistic heat flux dis- tribution as input. (i) Bottom air region (green box) is sup- plied as input. (ii) Outpainted image (left) and corresponding FEM results (right). (iii) Interface region of (ii). (iv) (a) Hor- izontal and (b) vertical averages of generated (blue) heat flux in input region, compared to input (green) and FEM results (red). MAEs for ML-INPUT (blue) and ML-FEM (red) com- parisons reported for microstructure shown in (ii). MAEs averaged over seven systems are shown in parentheses Guided Generation Here, we illustrate how our FluxGAN model provides an expedited approach to design new coatings with tar- get thermal properties. In the conventional approach for designing new coatings, one typically fabricates the coat- ings and then estimates the physical properties using ex- periments or computational modelling. The process is repeated till the fabricated microstructures satisfy tar- get physical properties, as we outline in Fig. 1(ii). In contrast, the FluxGAN model directly guides the inverse design of coatings that satisfy target thermal properties. Given a target thermal property, the model generates rational designs of new microstructures that satisfy the properties. We demonstrate the targeted generation ap- proach in Fig. 8. We provide the model with the de- scription of physical phenomena in a particular region, e.g., the heat flux near the heat sink, indicated by the green boxes in the images of Fig. 8(i). The model in- put is a single 80px × 587px RGB image that we extract from one of the 410px × 587px images. The input im- age only contain information about the heat flux in the boxed air region where no material is present, referred to as Q INPUT. The model uses outpaintaing technique to generate the microstructure, the top air region, and the associated heat flux (Q ML) throughout the large 400px × 587px size images. We show the resulting images in Fig. 8(i-ii). The model uses GAN inversion [27–32] to find the latent variables that match the input image and conditional coordination to independently generate spa- tially consistent micro-patches [17]. Note that the model is capable of generating different coating images shown in Fig. 8(i-ii), when supplied with the same input image. This is possible by selecting different latent variables dur- ing outpainting procedure. Finally, we calculate the heat flux associated with the generated microstructures using FEM, Q FEM, for the same temperature bias of 400 K. We show an outpainted image and the corresponding FEM results for the masked image in the left and the right columns of Fig. 8(ii), re- spectively. We show the comparison between Q INPUT (green), Q ML (blue) and Q FEM (red) in Fig. 8(iv). Figure 8 (iv)(a) and (b) show the average horizontal and vertical heat flux, computed from the Qx and Qy values of the 80 and 587 pixels of the input region, respectively. The shaded regions represent the range of heat flux val- ues observed in all seven generated images. The MAEs represent the average absolute distance between the two plotted dependencies. The FluxGAN generated heat flux match with Q INPUT and FEM results, with great accu- racy. The errors range from 0.003 to 0.01 MW/m2 for all the results, or around 2% of the average heat flux value in the input region. The Qy components have a domi- nant contribution to the overall heat flux, compared to Qx. This is expected since we assume that the temper- ature gradient is applied along top-to-bottom (y) direc- tion. The Qy ML values show larger deviation at the boundaries since the FluxGAN model is unaware of in- 11 (i) Input image. FIG. 9. Image outpainting with artificially constructed heat flux distribution as input. (ii) Example outpainted images (left) and corresponding FEM results (right). (iii) Interface region of representative image shown in (ii). (iv) (a) Horizontal and (b) vertical averages of generated (blue) heat flux in input region, compared to input (green) and FEM results (red). MAEs for ML-INPUT (blue) and ML-FEM (red) comparisons reported for bottom microstructure of (ii). Average MAEs of the three systems are shown in parentheses. sulating boundary conditions while the FEM results are obtained using this restriction. We marked three points of interest in the interface region with magenta circles, as shown in Fig. 8(iii). These points represent the lo- cation of the cusps at the bottom material-air interface and are next to dips at the surfaces. They are closest to the heat sink, as can be noted by following the thin green line that marks the top boundary of the input re- gion. The heat flux arrows at this locations (Fig. 8(iii)) indicate that the heat is being guided sideways from the cusps, with the magnitudes being the highest among all values in the bottom air region (Fig. 8 (iv)(b)). Such characteristic heat flux patterns are associated with the different color environments around these points in all the input green boxed regions of Fig. 8(i). Consequently, similar cusp points can be noted from all generated mi- crostructures of Fig. 8(i) and (ii). The common presence of these points in all generated microstructures refer to the fact that they all are rational designs that satisfy the target input heat flux. To further challenge the FluxGAN model, we test its ability to generate images for an artificially constructed input. We construct the input image by periodically ex- tending the red-boxed 80px × 80px region marked in the top panel of Fig. 9(i). The full panel shows the result- ing input image of size 80px × 587px. We show three outpainted images and the corresponding FEM results in Fig. 9(ii). We show the comparison of the average horizontal and vertical heat flux, computed from the Qx and Qy values of the 80 and 587 pixels of the input re- gion, in Fig. 9(iv)(a) and (b), respectively. The shaded regions represent the range of heat flux values observed in three different images. The periodic nature of heat flux can be particularly visible from the average vertical heat flux, shown in Fig. 9(iv)(b). The FluxGAN gener- ated heat flux match with Q INPUT and FEM results, with great accuracy. The MAEs of the FluxGAN results range from 0.002 to 0.011 MW/m2 when compared with the INPUT and from 0.007 to 0.012 MW/m2 when com- pared with the FEM results, respectively. Average verti- cal heat flux agrees with the FEM results in the input re- gion within 3% error margin. These results demonstrate that the model is able to generate rational microstruc- tures that best fit the criterion imposed by the input im- age. Note that the generated microstructures are highly diverse away from the periodic input region and do not show any visible repetitions. The diversity of generated images indicates that the model provides multiple designs of microstructures to satisfy target conditions. Extension to Three-Dimensional Domain Although our study primarily focuses on 2D mi- crostructures, here we discuss how we can leverage the FluxGAN model to generate 3D microstructures with high structural diversity. GANs can be trained to gener- ate 3D volumes, which are useful for design optimization 12 and detailed analysis of structural features and physi- cal processes [4, 33, 34]. These models can be used for rapid generation of complex 3D structures over conven- tional approaches. A recent article used a bounded ran- dom walk algorithm to generate an interface, followed by seeding of random size particles to produce a two-phase material, resulting in large 128px × 10000px images. The images were used to train SliceGAN [33] algorithm and output 3D configurations. However, the lack of diversity in such approach allows the generator to trick the dis- criminators, resulting in unrealistic 3D representations. We demonstrate that this issue can be resolved by train- ing the GAN models with images that include both struc- tural and physical phenomena information. We propose a combined approach that implements both the FluxGAN and the SliceGAN algorithms to generate complex 3D microstructures and associated heat flux environments with high diversity. The SliceGAN approach generates a volume by assimilating 2D slices, each of which is re- fined to match the training set images. However, a large number of diverse 2D images is required for successful training, especially to generate complex, anisotropic 3D materials with high density of interfaces. We leverage the FluxGAN model to generate two large 64px × 320000px images (17.4μm × 8.7cm coatings) for the surface and the material regions. We make random selections of 64px × 64px patches from the generated images and pass them to two perpendicular discriminators of SliceGAN. Fig- ure 10(i) and (ii) show two perpendicular RGB slices for the surface and the material regions, respectively. Note that the heat flux components (red and green channels) are continuous across the two perpendicular slices and the blue channel produces matching structure in both the perpendicular planes. X , Q⊥ The objective of the generator of the SliceGAN model is to generate realistic volumes in which the 2D slices along X and Y directions pass the discriminator test. Note that the outputs from the generator include infor- mation in five channels: [BSE, QX , QY , Q⊥ Y ]. The first channel contains structural information as learned from the experimental BSE images. The other two sets of channels include heat flux data. (QX , QY ) and (Q⊥ X , Q⊥ Y ) refer to the heat flux components of the two per- pendicular slices, represented in graphical domain. The generated information is passed to the two discrimina- tors. Each of the two perpendicular discriminators re- ceive three-channel RGB images and share a common structural channel (BSE). However, each discriminator receives a separate set of heat flux data, (QX , QY ) or (Q⊥ Y ). The model assimilates 64 slices in each of two perpendicular directions to produce 64 × 64 × 64 voxel volumes, as shown in Fig. 10(iii) and (iv). For the generated 3D microstructures, we obtain the heat flux along the Z-direction, QZ, by averaging the ver- tical heat flux components QY and Q⊥ Y obtained from both discriminators. The resulting volumes have a four- channel representation: X , QZ]. Finally, the SliceGAN model outputs two representative 3D con- [BSE, QX , Q⊥ X , Q⊥ 13 FIG. 10. Microstructure representation in 3D domain. Two discriminators are implemented to test perpendicular RGB image slices for (i) surface and (ii) material regions. Representative volumes generated for (iii) surface and (iv) material regions with superimposed heat flux. (v) Two representative 3D microstructures generated by combined FluxGAN-SliceGAN approach. figurations of size 64 × 400 × 400 voxels using the gen- erated volumes, as shown in Fig. 10(v). The resultant microstructures shows great structural diversity in both the surface landscape as well as the cross section of inner material region, which are not accessible in the experi- mental and training images. The combined FluxGAN- SliceGAN approach shows remarkable ability to infer 3D representation of microstructure and associated physical phenomenon from a single 2D image. We attribute the high quality of the representation to both large size of the training image and the heat flux data included in the image channels. SUMMARY AND OUTLOOK We propose a generative ML model, FluxGAN, capa- ble of generating arbitrary large images of microstruc- tures and associated heat flux data. The model gener- ates the information about heat flux that will be observed within the microstructures and the outside heat source or sink regions, if temperature gradients are applied ex- ternally. We train the model with RGB images in which the different color channels contain graphical domain rep- resentation of structural information from experimental images and heat flux data obtained from FEM calcula- tions. In these images, the information about the struc- tural features are superimposed with heat flux patterns that correspond to the structural features. During train- ing, the model learns about the different combinations of structural features and heat flux patterns, referred to as styles, in an unsupervised manner. Once trained, the model generates large images for given inputs maps that specify spatial distribution of styles to be included in the output images. The generated microstructures show high diversity and include structural features that have char- acteristics similar to those present in the experimental images. We compare the generated heat flux with the results from separate FEM analyses on the correspond- ing generated microstructures. The FluxGAN generated heat flux show good agreement with FEM results. Fur- thermore, we demonstrate that the image generation can be guided by providing partial information to the model. We provide the model with the heat flux near the bot- tom heat sink region. The model shows remarkable abil- ity to generate large microstructures, heat source regions and associated heat flux that are consistent with the in- put. The generated heat flux values lie within 3% of those obtained with separate FEM simulations. Thus, our FluxGAN model offers an expedited approach for in- verse design of microstructures with target thermal prop- erties. The images show high structural diversity as well. We illustrate that the FluxGAN generated images can be leveraged to produce complex 3D microstructures, in combination with the SliceGAN architecture. We gen- erate 0.1 meter long continuous and structurally diverse 2D structural images and their associated heat flux envi- ronment, to construct the 3D representations. In conclusion, FluxGAN offers fast, inexpensive, and reliable approach for design and analysis of 2D and 3D microstructures. The model is capable of generating ar- bitrary large environments with constant computation cost. This aspect is particularly advantageous over the FEM approach where memory usage scales linearly with the number of degrees of freedom. Our approach is gen- eral and can be extended to any continuous physical phe- nomena represented in graphical domain. The ability of the model to render arbitrary large environments while trained on small size patches offers great practical ad- vantage. For example, the model will be highly effective in providing description of physical phenomena at the micro-meso or even macro scale, or guiding characteriza- tion and fabrication of complex devices, such as micro- electronic chips with extreme design points. DATA AVAILABILITY The authors declare that the data supporting the find- ings of this study are available within the paper and its Supplementary Information files. ACKNOWLEDGEMENTS We are indebted to Dr. M. R. Kracum for providing us with the two-dimensional backscatter electron images of the niobium thermal sprayed coatings, sharing valuable insights regarding the outstanding challenges of thermal spray coatings, and several helpful discussions. We grate- fully acknowledge funding from the research partnership initiative between the College of Engineering & Applied Science at the University of Colorado Boulder and the DOE-Sandia National Laboratories, Albuquerque, NM. This work utilized the Summit supercomputer, which is supported by the National Science Foundation (awards ACI-1532235 and ACI-1532236), the University of Col- 14 orado Boulder, and Colorado State University. The Sum- mit supercomputer is a joint effort of the University of Colorado Boulder and Colorado State University. AUTHOR CONTRIBUTIONS A.K.P and M.S. contributed to the acquisition and the analysis of data and the creation of new scripts used in the study. S.N. contributed to the conception and the design of the work, the interpretation of data, drafting and revision of the article. COMPETING INTERESTS The authors declare no competing interests. [1] L. Yang, D. Zhang, and G. E. Karniadakis, Physics- informed generative adversarial networks for stochastic differential equations, SIAM Journal on Scientific Com- puting 42, A292 (2020). [2] C. Jiang and A. B. Farimani, Deep learning convective flow using conditional generative adversarial networks, arXiv preprint arXiv:2005.06422 (2020). [3] H. Jiang, Z. Nie, R. Yeo, A. B. Farimani, and L. B. Kara, StressGAN: A generative deep learning model for two-dimensional stress distribution prediction, Journal of Applied Mechanics 88 (2021). [4] T. Hsu, W. K. Epting, H. Kim, H. W. Abernathy, G. A. Hackett, A. D. Rollett, P. A. Salvador, and E. A. Holm, Microstructure generation via generative adversarial net- work for heterogeneous, topologically complex 3d mate- rials, Jom 73, 90 (2021). [5] P. C. Nguyen, N. N. Vlassis, B. Bahmani, W. Sun, H. Udaykumar, and S. S. Baek, Synthesizing controlled microstructures of porous media using generative adver- sarial networks and reinforcement learning, Scientific re- ports 12, 9034 (2022). [6] T. Karras, S. Laine, and T. Aila, A style-based gener- ator architecture for generative adversarial networks, in Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (2019) pp. 4401–4410. [7] X. Huang and S. Belongie, Arbitrary style transfer in real-time with adaptive instance normalization, in Pro- ceedings of the IEEE international conference on com- puter vision (2017) pp. 1501–1510. [8] T. Karras, M. Aittala, J. Hellsten, S. Laine, J. Lehti- nen, and T. Aila, Training generative adversarial net- works with limited data, Advances in neural information processing systems 33, 12104 (2020). [9] J. Wang, J. K. Carson, M. F. North, and D. J. Cleland, A new approach to modelling the effective thermal conduc- tivity of heterogeneous materials, International journal of heat and mass transfer 49, 3075 (2006). [10] S. Gurumurthy, R. Kiran Sarvadevabhatla, and R. Venkatesh Babu, Deligan: Generative adversarial networks for diverse and limited data, in Proceedings of the IEEE conference on computer vision and pattern recognition (2017) pp. 166–174. [11] I. Gulrajani, F. Ahmed, M. Arjovsky, V. Dumoulin, and A. C. Courville, Improved training of wasserstein gans, Advances in neural information processing systems 30 (2017). [12] C. Multiphysics, Introduction to comsol multiphysics®, COMSOL Multiphysics, Burlington, MA, accessed Feb 9, 32 (1998). [13] R. Abdal, Y. Qin, and P. Wonka, Image2StyleGAN++: How to edit the embedded images?, in Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (2020) pp. 8296–8305. [14] A. Liu, R. Tucker, V. Jampani, A. Makadia, N. Snavely, and A. Kanazawa, Infinite Nature: Perpetual view gener- ation of natural scenes from a single image, in Proceedings of the IEEE/CVF International Conference on Computer Vision (2021) pp. 14458–14467. [15] T. R. Shaham, T. Dekel, and T. Michaeli, SinGAN: Learning a generative model from a single natural im- age, in Proceedings of the IEEE/CVF international con- ference on computer vision (2019) pp. 4570–4580. [16] A. Shocher, S. Bagon, P. Isola, and M. Irani, InGAN: Capturing and retargeting the" dna" of a natural image, in Proceedings of the IEEE/CVF International Confer- ence on Computer Vision (2019) pp. 4492–4501. [17] C. H. Lin, C.-C. Chang, Y.-S. Chen, D.-C. Juan, W. Wei, and H.-T. Chen, COCO-GAN: Generation by parts via conditional coordinating, in Proceedings of the IEEE/CVF international conference on computer vision (2019) pp. 4512–4521. [18] C. H. Lin, H.-Y. Lee, Y.-C. Cheng, S. Tulyakov, and M.-H. Yang, InfinityGAN: Towards infinite-pixel image synthesis, arXiv preprint arXiv:2104.03963 (2021). [19] J. J. Park, P. Florence, J. Straub, R. Newcombe, and S. Lovegrove, DeepSDF: Learning continuous signed dis- tance functions for shape representation, in Proceedings of the IEEE/CVF conference on computer vision and pat- tern recognition (2019) pp. 165–174. [20] L. Mescheder, M. Oechsle, M. Niemeyer, S. Nowozin, and A. Geiger, Occupancy Networks: Learning 3d reconstruc- tion in function space, in Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (2019) pp. 4460–4470. [21] B. Mildenhall, P. P. Srinivasan, M. Tancik, J. T. Bar- ron, R. Ramamoorthi, and R. Ng, NERF: Representing scenes as neural radiance fields for view synthesis, Com- munications of the ACM 65, 99 (2021). [22] Y. Chen, S. Liu, and X. Wang, Learning continuous im- age representation with local implicit image function, in Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (2021) pp. 8628–8638. [23] M. Heusel, H. Ramsauer, T. Unterthiner, B. Nessler, and S. Hochreiter, GANs trained by a two time-scale update rule converge to a local nash equilibrium, Advances in neural information processing systems 30 (2017). [24] S. Torquato and B. Lu, Chord-length distribution func- tion for two-phase random media, Physical Review E 47, 2950 (1993). [25] S. Torquato, Random heterogeneous materials (Springer., 2013). [26] J. G. Berryman and S. C. Blair, Use of digital image anal- ysis to estimate fluid permeability of porous materials: Application of two-point correlation functions, Journal of applied Physics 60, 1930 (1986). [27] A. Creswell and A. A. Bharath, Inverting the generator of a generative adversarial network, IEEE transactions on neural networks and learning systems 30, 1967 (2018). [28] F. Ma, U. Ayaz, and S. Karaman, Invertibility of convo- lutional generative networks from partial measurements, Advances in Neural Information Processing Systems 31 (2018). [29] R. Abdal, Y. Qin, and P. Wonka, Image2StyleGAN: How to embed images into the StyleGAN latent space?, in Proceedings of the IEEE/CVF international conference on computer vision (2019) pp. 4432–4441. [30] D. Bau, H. Strobelt, W. Peebles, J. Wulff, B. Zhou, J.-Y. Zhu, and A. Torralba, Semantic photo manip- ulation with a generative image prior, arXiv preprint arXiv:2005.07727 (2020). [31] J. Zhu, Y. Shen, D. Zhao, and B. Zhou, In-domain GAN inversion for real image editing, in European conference on computer vision (Springer, 2020) pp. 592–608. [32] Y.-C. Cheng, C. H. Lin, H.-Y. Lee, J. Ren, S. Tulyakov, and M.-H. Yang, InOut: Diverse image outpainting via gan inversion, in Proceedings of the IEEE/CVF Confer- ence on Computer Vision and Pattern Recognition (2022) pp. 11431–11440. [33] S. Kench and S. J. Cooper, Generating three-dimensional structures from a two-dimensional slice with generative adversarial network-based dimensionality expansion, Na- ture Machine Intelligence 3, 299 (2021). [34] A. Henkes and H. Wessels, Three-dimensional mi- crostructure generation using generative adversarial neu- 15 ral networks in the context of continuum micromechanics, Computer Methods in Applied Mechanics and Engineer- ing 400, 115497 (2022). SUPPLEMENTARY MATERIALS i i=1 (cid:113) Q2 |QM L |/(H × W ), i − QF EM Here we discuss and compare computational costs as- sociated with ML model generation and FEM validation. We generate a set of images using periodically extended 80×587 pixels input image discussed in section Guided Generation. We build a progression of input images ex- tending the length by up to 6 times. The resulting out- painted images have the sizes 400px × (N×587)px, with N=1,2,3,4,5,6. We demonstrate convergence of FEM val- idation mean absolute error (MAE) for the 400px × 3522px outpainted image in Fig. 11(i). We show MAE for x + Q2 y, the total heat flux magnitude, namely, Q = MAE=(cid:80)H×W where Qi is the total heat flux magnitude at a given pixel, H and W are the height and width of an image. MAE converges quickly with the number of degrees of freedom (DoF) used for FEM calculation and saturates bellow 0.05MW/m2 after 1 million DoF. For the further calculations we fix DoF around that value. We also show calculation time (red solid line) and memory usage (green solid line) for FEM validation step. We observe their lin- ear scaling with DoF. For comparison, the generation time (red dashed line) and memory usage (green dashed line) are also shown for ML model. In Fig. 11(ii) we com- pare ML generation and FEM calculation costs. Both FEM (red solid line) and ML (red dashed line) have sim- ilar linear time scaling with image size for the DoF fixed around 1 million. However, the memory usage is signifi- cantly higher for FEM (green solid line) compared to ML (green dashed line). We also show that MAE (blue solid line) stays consistently small (bellow 0.05MW/m2) for all image sizes. The highest time cost is associated with la- tent inversion (black dashed line). The low memory costs associated with ML are due to patch-by-path generation approach, where each patch (37px × 37px) is generated independently to produce large scale images. The time costs for ML generation shown here are for generating one patch at a time. This can be improved significantly since the model is capable of generating patches in batches, allowing for the highly parallelized output. 16 FIG. 11. Supplementary Materials Computation and generation costs. (i) MAE and computational costs as a function of number of degrees of freedom for 400px × 3522px image. MAEs are calculated for the magnitude of heat flux. For the time (red) and memory (green) axes solid lines correspond to FEM, dashed lines correspond to ML. (ii) MAE and computational costs as a function of image length. Color lines show time (red) and memory (green) costs of FEM validation (solid) and ML generation (dashed). MAEs for heat flux magnitude are shown in blue. Latent inversion time cost is shown in black dashed line.
http://arxiv.org/abs/2310.04621v1
"2023-10-06T23:11:26"
"2023-10-06T23:11:26"
Model Compression in Practice: Lessons Learned from Practitioners Creating On-device Machine Learning Experiences
On-device machine learning (ML) promises to improve the privacy, responsiveness, and proliferation of new, intelligent user experiences by moving ML computation onto everyday personal devices. However, today's large ML models must be drastically compressed to run efficiently on-device, a hurtle that requires deep, yet currently niche expertise. To engage the broader human-centered ML community in on-device ML experiences, we present the results from an interview study with 30 experts at Apple that specialize in producing efficient models. We compile tacit knowledge that experts have developed through practical experience with model compression across different hardware platforms. Our findings offer pragmatic considerations missing from prior work, covering the design process, trade-offs, and technical strategies that go into creating efficient models. Finally, we distill design recommendations for tooling to help ease the difficulty of this work and bring on-device ML into to more widespread practice.
[ "Fred Hohman", "Mary Beth Kery", "Donghao Ren", "Dominik Moritz" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04621v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04621v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.HC", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.HC", "cs.AI", "cs.LG" ]
Model Compression in Practice: Lessons Learned from Practitioners Creating On-device Machine Learning Experiences Fred Hohman Apple Seattle, WA, USA fredhohman@apple.com Mary Beth Kery Apple Pittsburgh, PA, USA mkery@apple.com Donghao Ren Apple Seattle, WA, USA donghao@apple.com Dominik Moritz Apple Pittsburgh, PA, USA domoritz@apple.com 3 2 0 2 t c O 6 ] C H . s c [ 1 v 1 2 6 4 0 . 0 1 3 2 : v i X r a ABSTRACT On-device machine learning (ML) promises to improve the privacy, responsiveness, and proliferation of new, intelligent user experi- ences by moving ML computation onto everyday personal devices. However, today's large ML models must be drastically compressed to run efficiently on-device, a hurtle that requires deep, yet cur- rently niche expertise. To engage the broader human-centered ML community in on-device ML experiences, we present the results from an interview study with 30 experts at Apple that specialize in producing efficient models. We compile tacit knowledge that experts have developed through practical experience with model compression across different hardware platforms. Our findings of- fer pragmatic considerations missing from prior work, covering the design process, trade-offs, and technical strategies that go into creating efficient models. Finally, we distill design recommenda- tions for tooling to help ease the difficulty of this work and bring on-device ML into to more widespread practice. CCS CONCEPTS • Human-centered computing → Interactive systems and tools; • Computing methodologies → Machine learning; Artifi- cial intelligence. KEYWORDS Efficient machine learning, machine learning model compression, on-device machine learning, interview study, interactive systems, design directions 1 INTRODUCTION Most modern machine learning (ML) models in production today occupy cloud servers of exceedingly more computational capacity and power than the device in your pocket. Yet for delivering intel- ligent user experiences, there is good reason to shift ML models onto our everyday personal computing devices. On-device ML is the practice of storing, training, and running ML models on an individual's device, such as a smartphone, tablet, or wearable. However, as today's state-of-the-art models grow larger and larger in size (e.g., into the billions of parameters) [27, 87, 98, 121], efficiency remains the biggest barrier to on-device ML [7, 22]. An arbitrary ML model placed on a mobile device can easily con- sume every available resource of the device, whether it be compute, memory, or battery. Creating efficient, on-device models brings new challenges to the ML development process. In this paper we argue that research in efficient machine learning over the past decade has matured to the degree to where practi- tioners have an (albeit rapidly evolving) set of techniques to make on-device ML a reality. The key idea is to shrink, optimize, and compress models, while simultaneously maintaining their accuracy. To achieve this, practitioners develop strategies for how to best apply model compression techniques to minimize the amount of computational resources needed. Product designers, tool-builders, and ML practitioners today should be considering the benefits of on-device ML for their users: First, on-device models can be an enormous win for personal privacy. While the industry standard practice today is to send a user's (encrypted) data over a network to a commercially-owned server for ML inference, on-device ML cuts out the need for a server such that a user's personal data never leaves their device. Beyond inference, pre-trained models can be fine-tuned on-device to adapt and personalize to an individual user's preferences, while keeping those preferences private and local [8, 47, 52]. Second, models on-device enable intelligent user experiences where they would not be possible otherwise. For example, compu- tational photography models within mobile cameras run inference at high frame rates (e.g., 30 frames per second), which would not be possible if relying on the availability of a distant server. Third, by going offline, on-device ML can create not only faster but also more portable experiences. Since no data is sent over a net- work, users can still interact with ML-powered features in situations without internet access or cellular service. This has the potential to broaden access of AI/ML features in more geographic regions, including rural and remote areas [92]. By forgoing a network en- tirely, ML-powered features can run faster and remain responsive by alleviating network latency in an "offline" mode [22]. Lastly, removing the reliance on servers for ML inference has economic and environmental impact. On-device ML cuts out the cost of server, which may help individuals, non-profits, or smaller tech firms that previously could not afford server upkeep to now deliver ML-powered features to their users. By reducing society's reliance on external servers, on-device ML may help reduce the high carbon footprint of the cloud [62]. In this paper, we seek to help the broader community adopt on-device ML by filling a crucial gap: while efficient ML research and algorithmic advances have progressed [23, 33, 84, 116, 120], there currently exists little pragmatic guidance [65] in literature, online, in books, or otherwise, for newcomers wanting to create on-device ML users experiences. To curate pragmatic guidance, we interviewed 30 industry ML practitioners (research scientists, ML engineers, and product managers) who are uniquely experienced with designing, developing, and deploying on-device ML at scale. We capture the hard-won knowledge, insights, and tricks-of-the- trade that are traditionally omitted from technical ML publications to illustrate the current state-of-the-art. We also profile how indus- try practitioners adapt cutting-edge ML research into intelligent experiences running on peoples' everyday devices. We contribute: • Tacit knowledge that 30 expert practitioners have de- veloped around the design process, trade-offs, and strate- gies that go into deploying efficient on-device ML. Many decisions around optimization and compression strategy stem directly from user experience and product design. • A characterization of the key challenges practitioners face when creating efficient models. Example challenges in- clude the tension between optimizing performance against model accuracy, and the necessity to work with hardware- level details. • Distilled design recommendations for interactive in- terfaces, tooling, and systems that show promise to help practitioners optimize models and ultimately proliferate on-device ML experiences. We conclude by discussing where the broader human-centered AI/ML research, design, and practitioner communities can engage in efficient, on-device ML. We hope the results from this deep dive into a nascent area of ML user experience design helps spotlight its interdisciplinary importance and inspires others to contribute. 2 RELATED WORK IN HUMAN-CENTERED ML AND MODEL OPTIMIZATION Over the past decade, interview studies from human-computer in- teraction (HCI) have played an important role in capturing how AI/ML plays out in real-world practice [4, 6, 10, 41, 55, 80, 114]. In- terviews with practitioners are uniquely suited to capture the kinds of process-oriented insight, stories, and tricks-of-the-trade that are traditionally omitted from technical ML publications. Interviews also crucially give the broader public access to learn from AI/ML work that otherwise happens behind closed doors. In this paper, we aim to share new ideas for designing powerful on-device ML ex- periences, based on extensive product experience that is currently held by few. To situate our work in the broader landscape of HCI + ML research, we cover other interviews studies within diverse disciplines of AI/ML research, including user experience design, best practices for development, and interactive systems and tools. 2.1 User Experience Design for AI/ML Notably, much of what the research community knows today about designing effective user experiences (UX) for AI/ML has been taught through the hard-won experience of real designers. For example, Yang et al. interviewed 13 UX practitioners with 4+ years of experi- ence working on AI/ML products, to capture designers' strategies for working with AI/ML [114]. Zdanowska et al. interviewed both product teams and UX designers to explore how design collabora- tion happens during AI/ML product development [117]. Windl et al. interviewed another 20 interaction designers to learn how designers adapt their their innovation process for AI/ML experiences [106]. Again with experienced UX + AI/ML designers, Yildirim et al. con- ducted workshops around AI/ML innovation and found that de- signers are more impactful when allowed to design entire services- rather than fitting AI/ML into specific user-interfaces for existing Fred Hohman, Mary Beth Kery, Donghao Ren, and Dominik Moritz products [115]. Meanwhile, leading technology companies have distilled design wisdom from their own product teams into AI/ML design guidelines as public, educational resources [108]. Examples include Apple's Human Interface Guidelines on Machine Learn- ing [2], Microsoft's Human-AI Guidelines [6], Google's People + AI Guidebook [3], and IBM's Design for AI resources [1]. This body of work emphasizes that designing with machine learning requires new approaches from designers [1, 3, 6, 106, 113, 115]. Our paper contributes to this conversation by illustrating how power and performance issues of moving ML models on-device create real, tangible UX constraints for designers (for example, see Table 2)-and offering concrete design strategies for creating effective user experiences around those constraints (for example, see Section 5.4). 2.2 Profiling Best Practices for Building AI/ML Regarding the engineering of AI/ML development, practitioner stories inform best-practices and new research agendas. Amershi et al. interview and survey AI/ML practitioners at Microsoft to gather best practices for production ML development and outline core differences between ML development and conventional soft- ware engineering [4]. Researchers have studied how AI/ML teams collaborate across diverse technical roles [68, 70, 118], or adopt new technology like AutoML [99–101]. Sambasivan et al. used interviews to profile organizational struggles between balancing modeling work with data quality work [80]. Holstein et al. found key mismatches between academic AI/ML fairness concepts and the kinds of real fairness issues product teams grapple with [41]. Many other aspects of AI fairness, accountability, transparency, and ethics (FATE) have been found to be fundamentally sociotech- nical issues where design decisions and process have enormous impact [20, 42, 45, 58, 59, 61, 75, 79]. From a practical perspective within the ML community, existing work highlights the hidden technical debt within ML systems that incur massive amounts of engineering maintenance [83]. Some these ideas can be traced back before the proliferation of ML [36]. More recently, related to our work is a recent technical survey on efficient methods for natural language processing (NLP) [94] that aims to inspire new technical methods for efficiency in the age of ever-scaling language models; however, its primary focus is to only organize existing techniques specific to NLP applications. In our work, we profile on-device ML holistically, including its impact on product design, organization-level coordination, and best-practices for ML teams. 2.3 Interactive Systems for AI/ML Development Extensive prior work in HCI, visualization, and ML has focused on interactive systems and tools to help ML practitioners overcome key challenges in their work. Examples include tools for: neural net- work architecture visualization and debugging [107], visualization for large ML dataset exploration [30, 31] and data iteration [40], model evaluation for classification tasks [5, 34, 76], visual ana- lytics for deep learning interpretability [39], fairness evaluation for finding disproportionately underperforming subpopulations of Model Compression in Practice data [11, 15], reliable error analysis and evaluation for NLP mod- els [77, 78, 110], interactive visualization for counterfactual genera- tion [105, 111], and interaction techniques to enhance ML and data science environments [69], such as computational notebooks [50] and other composable, shareable interfaces [14]. Today, on-device and efficient machine learning has little tooling available outside of code libraries to run compression algorithms (see applications within popular ML toolkits in Section 2.6). Our results from inter- viewing 30 experts provide strong designs recommendations for interactive tooling opportunities that would make on-device ML more achievable for everyone. 2.4 On-device Inference versus On-device Training It is worthwhile to note a distinction between on-device inference and on-device training. On-device ML inference refers to running an ML model on any device with limited compute resources, such as limited compute, memory, or power. These models are pretrained, where learning happened offline on a different device or server. On- device ML training refers to either training a model from scratch, or fine-tuning a model for a few iterations, on a user's device. While work in on-device ML encompasses both paradigms, in our paper we focus on the far more common use case of model inference (deploying pretrained models on a user's device), and leave on- device training for future work. Although on-device inference and training share many of the same core challenges around efficiency, training on-device models is generally considered harder, since training usually requires far more resources [123]. Thus, we do not attempt to cover the added complexities of on-device training in this work. For a survey on the current research and challenges around on-device learning instead, see: [23, 57, 64, 123]. 2.5 Edge Computing In recent literature, the challenges of on-device ML are often dis- cussed in the context of edge computing [16, 64, 123]. Edge com- puting typically refers to small embedded hardware, wearables, or internet-of-things (IoT) devices where at least some computation is performed on-device (the "edges" of a network) rather than by a central server [64]. In our research, we interview ML practitioners deploying to a variety of consumer devices, including edge hard- ware. We do not distinguish between device type except for where practices slightly differ for edge hardware, as in Section 5.4.4. 2.6 Existing Compression Resources Beyond academic surveys detailing different compression tech- niques [17, 19, 21], most practical guidance for model optimization is found within online tutorials and documentation for popular ML libraries. Examples include TensorFlow's model optimization toolkit and blog post on quantization-aware training method [89, 90]; Py- Torch's experimental support for quantization [72], sparsity [73], and it's accompanying examples [74]; Google's quantization ex- tension to Keras called QKeras [29]; Microsoft's Neural Network Intelligence package and tool [60]; Intel's Neural Compressor li- brary [48]; and Apple's DNIKit [104]. Other examples that target specific hardware include speeding up inference on FPGAs [24] and compressing Core ML models to run on Apple platforms [7]. In terms of other community efforts, the appropriately named TinyML community has sprung up around this topic, which has published a book [103] and hosts community events and meetups for like- minded practitioners. 2.7 Compressing Large Language Models and Foundation Models Within the past couple of years, model compression has garnered intense interest due to the public proliferation of large language models (LLMs) and foundation models [12]. LLMs have moved be- yond the research community and captured public interest and concern [63, 86], as they have demonstrate new ways to inter- act with computers via natural language. The catch is that these models, by definition, are the largest in the world (e.g., billions of parameters [27, 98]). For all the reasons already mentioned, there is immense interest and activity of moving LLMs on-device-and progress is moving fast. The number of empirical works for com- pressing LLMs from this year alone would be difficult to track. However, we note that the same overall approaches for efficient machine learning that we discuss in this work (detailed in Section 3) are the same techniques being applied to LLMs. For interested read- ers in learning about the latest results for compressing LLMs, we refer to the follow surveys: [95, 112, 122]. 3 A PRIMER ON MODEL COMPRESSION TECHNIQUES To familiarize readers with model optimization in general, here we give a primer on common ML compression techniques. This background will help ground the study results and provide context for the remainder of the paper. Model compression is a class of techniques used in on-device ML that optimizes varying components of a model to minimize their re- quired computational resources. While it is not important to know every detail of every technique, it is useful to understand of the vari- ety of techniques, how they work at a high-level, and how they can be combined together. In fact, some of the biggest savings can come from effectively combining multiple techniques [35]. This overview contains a brief description of each technique, and includes illustra- tions to build visual intuition. We only attempt to cover techniques mentioned by practitioners in our study. Each technique below is truly a family of techniques, each with many nuanced variations. For an in-depth review of the technical descriptions of compression techniques, see the following surveys: [17, 19, 21]. 3.1 Quantization Convert the inputs, outputs, weights, and/or activations of a model from high-precision representations (e.g., fp32) to lower-precision representations (e.g., fp16, int32, int16, int8, and even int2). At a high-level, this coarsens a model. For a detailed survey of quantization-specific techniques and their variations, see [26]. 3.2 Palettization (Weight Clustering) Map the weights of a model to a discrete set of precomputed (or learned) values [18, 109]. Inspired by an artist's palette, the idea is to map many similar values to one average or approximate value, then use those new values for computing inference. In this way, palettization is similar in spirit to algorithmic memoization, or more simply, a dictionary or a look-up table. Palettization can make a model smaller but does not make a model faster since it incurs look-up time. 3.3 Pruning (Sparsity or Network Sparsity) Remove the least-important parts of a neural network to make it smaller [38]. The motivation here is that modern ML networks are much more dense than is actually needed. Since networks can contain millions of parameters, removing some or many parameters may not impact the final accuracy. Pruning is a large family of techniques and strategies. For a detailed overview see [38]. 3.3.1 Unstructured Pruning. A model may have neurons or weights that do not highly affect a model's decision [26]. In unstructured pruning, the least important neurons or weights can be aggres- sively removed without affecting model accuracy [38]. Unstruc- tured pruning has been shown to shrink a model by 10–100x its original size [38]. The major downside is that this leads to sparse matrix operations, which is a type of math that is slow on most hard- ware. So although pruned models are small, they may be nearly as slow as the full-sized model [26]. Structured Pruning. Similar to unstructured pruning, the 3.3.2 least important neurons or weights are identified, however, in- stead of removing (or zero-ing out) individual values, structured pruning removes entire structural elements, like channels or filters. Since structured pruning removes much bigger chunks of a model, less pruning will be possible without serious degradation in model accuracy [26]. However, by respecting the structure of the model, these pruned models maintain dense matrix operations, which make them fast on most hardware [38]. 3.4 Distillation Train a smaller model to mimic a larger model. Given a large (teacher) model that is already highly accurate at a task, the idea is to transfer the "knowledge," or learned features, to a smaller (student) model by having the smaller model replicate the larger model's output. Extending this further, given a newly trained stu- dent model, one can then apply other compression techniques to Fred Hohman, Mary Beth Kery, Donghao Ren, and Dominik Moritz the student model for further optimization [26, 71]. For a survey of distillation techniques see [32]. 3.5 Efficient Neural Architectures Some model architectures are specifically designed to be small and efficient. One of the most prominent examples in recent years is MobileNets [46, 81], with others like ShuffleNets [119], or Effi- cientNets [88]. All of these examples are designed to improve the efficiency of convolutions, which are vital to fitting computer vision models on-device [19]. Efficient architectures can be compressed with techniques like quantization or pruning, to create an even smaller model [19]. 3.6 Dynamic Models When thinking about ML applications, most people think of a single model with fixed inputs and outputs. Dynamic models differ in that they take into account the the differing prediction difficulty of each data instance. In other words, based on the individual data point to run inference on, a model may adapt its preprocessing steps, computational path, or model choice all together [124]. While many types of dynamic models exist, we only discuss a selection of techniques that are mentioned later on. 3.6.1 Early Exit Models. Allow for completing a prediction without the need to pass through the full model. Motivated by the fact that some data points are easier to predict than others, early exit models run intermediate feature representations through additional output layers to check if the prediction is sufficiently correct. For example, one way to determine whether or not to early exit or continue through a network is to check its prediction confidence: if a model is already confident about the current prediction, early exit, and if not, continue to the next prediction layer. At a high-level, these are models with checks throughout an architecture, such that inference can complete at any check before the final output. 3.6.2 Gated Models. Train a smaller, approximate model whose prediction decides whether or not to invoke a larger model. Similar to early exit models, some data points are easier to predict than others. A fast, smaller model gates a larger model, for example by again using the confidence of the initial prediction. At a high-level, these are systems of models that decide whether or not to spend extra compute if a prediction is still unknown. 4 INTERVIEW STUDY METHODOLOGY 4.1 Study Protocol To capture emerging practices around efficient machine learning, we conducted semi-structured interviews [13, 51] with 30 ML prac- titioners at Apple to study how they approach model compression in their own projects. Our interview questions are outlined in Ap- pendix A. We gave participants ample time to flexibility speak to their specific work and express other topics beyond our question set that they felt were important to doing good efficient machine learning work [51]. The interviews took place between March and Model Compression in Practice July 2022 with each conversation lasting from 45 minutes to 1 hour. For all interviews, one researcher lead the interview questions, while another took detailed notes. Where a participant approved, we also recorded conversations to refer back to during analysis. No compensation was given, since all participants were salaried employees. At the end of the study, we briefed participants and their teams on our results. Our study protocol was approved by an internal IRB. 4.2 Participants and Recruitment As discussed in Section 2, in-depth interview studies with ML practitioners are uniquely suited to capture experts' tacit knowl- edge for the purpose of generating new publicly-available guid- ance [4, 6, 10, 41, 55, 80, 114]. Our organization is one of the few places in the world that contains a concentration of efficient ma- chine learning experts, so we first reached out to known experts. We then used a snowball sampling strategy to reach a broader net- work of people involved in efficient machine learning at Apple, including other compression experts, ML practitioners who own a production model but are not compression experts themselves, and tooling engineers who build frameworks for model compres- sion. To balance different perspectives, we sought practitioners working on ML for different domains (e.g., vision, text, and sensor data) and different use cases. As the study evolved, we also chose new participants to help fill-in our biggest areas of uncertainty. Our participants, listed in Table 1, include ML research scientists, engineers, and managers spanning a wide breadth of application domains. A natural saturation occurred when participants began to repeat know-how we had already recorded and began to only suggest participants we had already included. 4.3 Qualitative Data Analysis The first two authors conducted an iterative thematic analysis method to group common motivations, challenges, and best prac- tices of model compression into categories [28]. As we conducted more interviews, we continually discussed and updated these cat- egories to reflect our new findings. Each participant's data and transcripts were independently reviewed and manually coded by the first two authors at least twice using inductive coding [91]. In total, we spent 30+ hours interviewing participants and collected 23,500+ words of additional notes outside of the audio transcripts. The final categories were split into two main sections: Section 5 "Study Results" and Section 6 "Design Opportunities for Efficient Machine Learning Interface." The composition of these two sec- tions was formed by ordering major categories and hierarchically grouping within categories when relevant. 4.4 Methodological Limitations While we found that learning from expert practitioners was tremen- dously valuable, any interview study has limits for generalizabil- ity. Interview studies suffer from smaller population samples than other methods, for example, a survey. We chose to hold in-depth exploratory conversations with each participant-which a survey cannot support as well [51]. On the other hand, we did not directly observe participants conducting their efficient machine learning work, which limits the specificity of our findings. It was not pos- sible to observe participant's direct work or model artifacts due to the sensitivity of their work. Another concern is bias from a participant's role in the domain [13], as well as the power dynamics between interviewer and interviewees [54]. This study was con- ducted solely within one organization, therefore practitioners may hold organization-specific beliefs and practices [82]. Despite our conscious efforts to recruit across ML application domains, we no- ticed a skew towards vision-based applications on images, video, and 3D scene data. This makes sense from an industry perspec- tive, as computer vision applications typically rely on exceptionally large ML models. Lastly, these interviews were conducted prior to the public rise of LLMs in late 2022 [63]. As discussed in subsec- tion 2.7, the same overall approaches for efficient machine learning are currently being applied to LLMs and other foundation model modalities. Taking these limitations together, we caution readers to not consider the advice we detail from participants universally gen- eralizable. However it is with confidence that we share the rich pragmatic advice, guidance, and experience these 30 experts have to offer. 5 STUDY RESULTS 5.1 Participants and Emergent Personas We summarize our participants in Table 1. Of the 30 people we interviewed, participants had an average of 7.1 (max 12) years experience with ML. Participants had 4.1 (max 10) years on average experience with efficient ML. Our participants had diverse breadth of expertise across domains and mapped roughly to four roles: 6 ML Managers, 4 Research Scientists, 13 ML Engineers, and 7 Software Engineers. For the purpose of understanding practitioners roles relative to efficient machine learning, we found three distinct personas emerged that best describe our participants: • Compression Experts (E1–E13 in Table 1): Seasoned research scientists and experienced engineers that lead on- device ML initiatives, develop new compression techniques, and consult on machine learning optimization efforts. Given the amount of experience these people have, they often manage or lead teams. Example: An ML research scientist who has a PhD in model compression and is developing novel techniques for model optimization. • Machine Learning Practitioners (P1–P11 in Table 1): ML engineers and data scientists that build and deploy models on-device where certain optimization budgets must be met. These people use compression as a means to an end rather than solely studying efficient machine learning. Example: An ML engineer needs to get a model's size under 1MB while maintaining high accuracy. • Tooling Engineers (T1–T6 in Table 1): Engineers and developers that focus on building frameworks, infrastruc- ture, and tools for efficient machine learning. Example: A software engineer that builds and maintains an organization- wide tool to help others compute efficiency metrics. Throughout the paper, we use representative quotes from partic- ipants to illustrate the main findings from the study. Fred Hohman, Mary Beth Kery, Donghao Ren, and Dominik Moritz Table 1: A summary of the 30 participants from the interview study. Participants are grouped by three emergent personas: Compression Experts (E), ML Practitioners (P), and Toolkit Engineers (T). Participants indicated the number of years they have spent working on machine learning (light blue squares), and of those years how many have been spent working on model compression and optimization specifically (dark blue squares). ID Experience (Compression / ML Years) Job Title (Manager ✓) ML Application Compression Expert E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 E13 10/12 7/12 5/12 5/10 9/9 6/8 5/8 2/8 5/6 5/6 5/5 5/5 3/5 ML Practitioner P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 6/10 4/10 3/10 4/9 5/8 1/6 1/6 2/5 3/4 3/4 1/4 Tooling Engineer T1 T2 T3 T4 T5 T6 5/10 3/6 2/6 4/4 3/3 2/2 ML Manager (✓) ML Manager (✓) ML Manager (✓) ML Engineer (✓) Research Scientist ML Engineer (✓) ML Engineer (✓) ML Manager (✓) ML Engineer (✓) Research Scientist ML Engineer Research Scientist ML Engineer Efficient ML research 3D computer vision Efficient ML research 3D computer vision Efficient ML research Efficient computer vision 3D computer vision Efficient ML research Efficient computer vision Efficient ML research Efficient ML research 3D computer vision 3D computer vision ML Manager (✓) ML Engineer Research Scientist (✓) ML Engineer Software Engineer ML Engineer ML Engineer ML Engineer ML Engineer ML Engineer Software Engineer (✓) Multi-modal ML Efficient computer vision Machine translation ML sensing Machine translation Computer vision Multi-modal ML Multi-modal ML ML fairness ML hardware 3D computer vision ML Manager (✓) Software Engineer Software Engineer Software Engineer Software Engineer Software Engineer Efficient ML tooling Efficient ML tooling ML fairness Efficient ML algorithms Efficient ML algorithms Efficient ML tooling 5.2 The State of Efficient Machine Learning Creating an efficient machine learning model is a "large design and constrained optimization problem" [E5], where practitioners have to weigh decisions between many model performance metrics, such as model storage size, inference latency, power usage, device tempera- ture, and model behavioral metrics such accuracy, precision, recall, and others. To many readers, this characterization may sound like a job for an automated optimization algorithm. However, a crucial finding of our results is that automation is not yet possible, do to the degree of both ML and product design human expertise that goes into creating on-device applications. Experts emphasized there is no single solution, "silver bullet" [E12], "turnkey solution" [E5], or "golden recipe" [E7] for successfully building efficient machine learn- ing models. Partially, this is due to the rapidly moving-target of new state-of-the-art model architectures and new ML applications that may require a custom approach. "[Compression] works super well sometimes, but some- times totally fails. Each project is too dependent, recipes tend to only work in some situations." - P2, P6, P7 Model Compression in Practice Table 2: Key aspects of on-device ML efficiency that impact user experience. User Perceivable Metrics Negative User Impact Model storage size Modern deep learning models can easily grow to gigabytes. Devices have finite storage, so a model must not occupy so much space that it interferes with a user storing their own content. Power usage Users expect their devices to have long battery lives, but a resource-intensive model can quickly drain a battery. Addressing battery drain is particularly challenging for older devices with lower battery capacity and health. Device temperature ML models that consume lots of computational power at once can heat up a user's device to where it is uncomfortably warm to the touch. Heat can also trigger thermal throttling, where the device slows down to avoid over-heating. Inference latency Taking a long time to run inference can be frustrating for a user waiting on the result, and can make the experience feel unresponsive. FPS (frames per second) A special case of inference latency. When processing live inputs (e.g., video), this latency can create delays that makes the output appear choppy or unresponsive. All metrics: model tested dur- ing high device resource load Resources are shared. A user's device may be running many things simultaneously, including multiple ML models. A single model that demands too many resources will slow everything down. The expertise for creating efficient ML models is currently held by a relatively small subset of ML practitioners, where "knowledge is handed-down from the few who know how to do it successfully," [E3]. These people are referred to as artisans and "based on earlier experience, know it's possible" [P10] to create efficient models. Re- ducing a model's size by half, or by an order of magnitude, takes additional time and considerations [E7]. "It's like black magic or the dark arts, but you will get better with time," [E7]. Readers may recognize these "dark arts" or "artisan" language from earlier days of contemporary ML [37, 69] before any real widespread knowledge base was established. We hope these study results support growing such a knowledge-base for efficient machine learning, and it's role within a holistic ML process: "[Efficient machine learning] means a lot of things to different people. Specific techniques on models weights help reduce size, but to get an efficient model comes from more careful design of the loss function, the system, which parts should and should not be modeled with ML." - E5 In practice, building efficient ML models describes the process of either building a new model from scratch or modifying an existing model to shrink it enough to fit performance constraints, such as model size, latency, power consumption, and even heat [P3]. Newcomers often gravitate towards the latest model compression techniques from literature as a first-step, while experts who consult on these projects encourage taking a step back to consider the entire data and model lifecycle: "Don't do [model compression] blindly. Don't do [model compression] in a rush," [T1]. "Philosophically, [you] need to look at whole problem, not as an afterthought," [E3]. In addition to barriers of overall experience, efficient ML work differs perhaps most significantly in how much it requires a deep understanding of hardware details. Low-level hardware details are not something that typical ML or software engineering usually needs to consider. "[ML engineers] feel a bit intimated, and people don't feel like they understand this stuff well," [T2]. To this end, we think there is rich opportunity to help share and inform practice. Our interview study results characterize how practitioners design on-device machine learning experiences (5.3), decide model budgets (5.4), invest in compression (5.5), and evaluate compressed models to balance accuracy versus performance and avoid compression artifacts (5.6). We conclude with distilled design recommendations for tooling that could address the challenges practitioners face and bring efficient machine learning practices mainstream (Section 6). Throughout the results we highlight sum- marized takeaway strategies in call-out boxes. 5.3 The Metrics of Efficient, On-Device Models For many practitioners we spoke to, efficient machine learning is of immediate importance to their work in developing new product features. Efficiency is a deciding point on which features get ap- proved to ship to users, so efficient ML enables user experiences that otherwise simply could not exist [T5, P3, E12, P2, E9]. "Who cares if we can detect X if your model takes too much space? It will never make it to engineering requirements." - P3 As an umbrella term, efficiency encompasses many metrics. Com- mon metrics that practitioners linked to user experience are sum- marized in Table 2. Some may be familiar with metrics commonly considered in ML workflows, such as latency and model storage size. Other metrics may come as more foreign to an ML engineer accustomed to deploying their model on a far-off server, e.g., device temperature. When a user is holding and carrying around a device all day, metrics like heat and battery life impact are crucial. The prioritization of efficiency metrics depends on the model type and its intended usage. While different practitioners we spoke to were focused on optimizing different aspects of efficiency, they all had a shared concept of a model budget. Figure 1: Practitioners start with a feasibility model (A), which is a model of any size that demonstrates that the ML task works. Next, an architecture search looks for a smaller model that is equivalent to (A) and suitable for devices (B). A team decides a budget based on how much more efficient model (B) must be to deploy. Practitioners use techniques to compress their model (B) to reach the budget (C). 5.4 Deciding Model Budget A model budget encompasses thresholds for speed, accuracy, size, or the amount of any specific resource a model is allowed to consume. Model budgets are created individually per model, and are based as much in product and UX design as they are in device constraints. 5.4.1 Budgeting by Technical Feasibility. For new and novel ML applications, it is simply unknown on the onset how computational intensive a model might be. Practitioners refer to reported metrics from related ML research and an organization's other models to sketch out an initial budget: "At the beginning of the design, [we do a] 'back of envelope calculation' of where things need to be as honest as possible to what's realistic. At the beginning, you're more focused on accuracy. Over time there is refinement." - E7 A common refinement practice is outlined in Figure 1. First, ML engineers will work on a "feasibility" model simply to see if the ML task "is possible at all" [P3]. Once the feasibility model works at sufficient accuracy (Figure 1A), engineers work on an architecture search to find a smaller, more efficient model that achieves the accuracy goal (Figure 1B) [P3, E7]. Next, the budget is refined based on the potential to shrink the model using compression: "given [an] accuracy goal, what is the biggest percentage reduction possible?" [E11]. Some teams do this reduction estimation on their own, while others bring in ML compression experts [T5]. Since the compressed- model budget (Figure 1C) is often estimated before engineers embark on model compression, the budget remains open to refinement, subject to product design constraints. Ultimately if an ML-powered feature requires a strict model budget, the model will not ship until engineers have found a way to reach those thresholds [P3]. 5.4.2 Budgeting by User's Experience of Model. Many aspects of budgeting come directly out of product feature design for where, when, and how often a model will be running. One-Time, Real-Time, or All the Time? Latency budget is almost always a per-feature UX decision dependent on how a user perceives the model output and how often the model needs to run. For example, when tagging people in a new photo, the model needs to work fast enough that users do not notice a delay. Models on-device remove the wait on network response times, which make these latency budgets easier to achieve [P2]. Fred Hohman, Mary Beth Kery, Donghao Ren, and Dominik Moritz Models that only need to run once generally have a looser re- source budget than continuous models. For models running in real-time, only a few milliseconds per evaluation may be the maxi- mum budget [P1]. This is most crucial in real-time scenarios where the user can perceive the model working, which often occurs in live video applications [E13]. A user will notice if their video feed appears choppy or a background filter appears delayed. Latency budget needs to be as low as possible. Equally, if not more, strict latency budgets are given to models that need to run all the time, i.e., "always-on". Always-on models are continuously using the device's resources, so they are required to be as quick and lightweight as possible. Some always-on models require a timely response to the user, for example, an always-on model that listens for a user to trigger a voice-assistant. User Opt-In or Background Task? There are some appli- cations where a ML model is the main enabling technology. For example, if the user explicitly asks a voice assistant for help or uses an app to translate languages. If a user explicitly presses a button to trigger a model, the user is in control of when the model runs (and does not run). Product designers will allow models a bigger budget for power and compute resources when the user explicitly opts-in [E11, E7, P2]. It is also a common scenario to have mod- els running support functions in the background. Similar to any other background task, these models require a strict budget to stay unobtrusive: "If the user will never perceive the model, we still want the memory footprint to be inconspicuous so it doesn't interfere with them using their device." - E7 Can it Wait for a User to Sleep? Many devices today will download and install their routine updates at nighttime, or when- ever the device's user sleeps and has their device connected to power. Updates are intensive computational tasks that can be dis- ruptive to normal device function, thus it is conventional to wait until a user is not actively using their device. By the same logic, scheduling a model to run overnight is a good option if the model's output is not something needed immediately (e.g., updating tags of a photo library). If the user's device is plugged in, this also alleviates the concern of a model draining the battery. Disruption to the user is minimized, so overnight models are also free to take a longer time with a bigger resource budget [E13, P3]. Strategy #1: First estimate the accuracy and latency of the original model architecture you want to run on-device. Then estimate how often the model needs to run (less often is "eas- ier") and what it needs to deliver (less accurate is "easier") to budget the worst-case performance that will be acceptable for your user experience. The gap between your starting esti- mate and worst-case budget will tell you how feasible your on-device ML plan is. 5.4.3 Top-down Budget by Application & Device. As illustrated in Figure 2, an application or device has finite resources-and ML models are only one component of a system. For this reason, major budget allocation is typically decided by people with far reaching views and ownership in an organization [E1, P1, T1, P9]: Model AModel BModel CArchitecture SearchCompressionModel Size Model Compression in Practice Figure 2: Models needs to share space with the rest of an application. Model budget typically reflects how "valuable" a model is compared to all other features of the application. " [The product lead] looks at budget for whole feature and allocates budget to individual models from there. There are dozens of algorithms. [Each model] gets budget based on priority, practicality, and executive decisions on what is the most important algorithms to give space/time to." - T1 The difficulty of hitting budget can vary enormously depend- ing on the model. Thus negotiation over budget allocations can continue and evolve until late in development [P1]. Size Budget. Any one application should not take up too much disk space on a device. The challenge is that as more and more new features make use of ML, there are more models to fit in the same amount of storage: "Because of [neural networks], and the rising popu- larity of huge transformer models, compression be- comes more and more important." - E9 Power Budget. A model's power budget is a measure of how much it is permitted to drain a device's battery life. Power consumption of a model can be tricky to estimate, and should be measured empirically on the target device for the most reliable estimate [E6, T4, P9]. Once again, real-time or always-on models require much stricter power budgets, because they continuously draw power. Instead of measuring power at one moment of exe- cution, these continuous models can be thought of in terms of the total percentage or total minutes of battery they consume in a day [E6, P3, E7]. Thermal Throttling. Closely related to power consumption is device temperature. In the words of E7: "ship high-quality ML models that don't melt the user's device." By melting, E7 refers to both a device that is uncomfortably warm to the touch, and a device that has been forced into thermal mitigation. Thermal mitigation, or thermal throttling, is when a device slows down processing to protect itself from overheating. Hot and slow devices is a terrible user experience that must be avoided. Thus, memory and power budgets must be set according to thermal measurements [E6, E7, E4, E1, E2]: "Heat throttling is everyone's budget!" [E4]. Multiple Models in Concert. A development team may measure the power, latency, or memory load of a single model as they de- velop it, but testing a single model in isolation is insufficient in situations where multiple models are powering an app or expe- rience at the same time [E6, E13, E10]. Multiple models running simultaneously will affect the overall memory pressure experienced by device at any moment, and thus the latency of each model as well as total power consumption. For these situations, teams need to experimentally test models running in concert to get accurate measures of total consumption, and experimentally refine their budget for each individual model from there [E13, E10]: "You could use too much memory, and that's a no-go. You don't know that until you test on device. [The memory bound] is not something you can compute ahead. There are multiple models happening at once, so until they are all put together you can't see exactly what the memory is going to be on a process." - E13 Strategy #2: Budget a model's resources by it's value-add to your overall experience. For a reliable estimate, run your model on the actual target devices early and often during model optimization. Measure compute usage, memory pres- sure, battery consumption, heat, and your model's storage size relative to the overall application. Run the model alone and in realistic, high-load scenarios where many process are run- ning simultaneously to find out if your model is too resource greedy. Remember to not be a bad citizen: an ML feature that does not respect the resource needs of the overall device will result in a poor user experience. 5.4.4 Edge, IoT, and Low-power Devices. Devices like laptops, tablets, and mobile phones have far more memory and power resources than smaller, low-power "edge" devices, such as wearables or IoT devices. For edge devices, budget is tight enough that even the bytes of the modeling code text itself can matter [E11]. For these devices, an expert recommended avoiding neural networks all together due to their high cost, and approximate the same accuracy as much as possible using the lowest profile conventional machine learning algorithms, such as decision trees [E11]. 5.4.5 Gating & Variable-Budget Options. There may be features where it is not (yet) technically possible to fit the ML component entirely on device. One option is gating, where only some inference is done on-device: A small simplified model lives on-device and is only highly accurate for common inputs. If the small model detects complex or uncertain inputs, it invokes a high-powered ML model that uses more resources, or it sends the harder input to an external model on a server (see background Section 3.6.2) [E11]. Another option is variable budgeting. Product teams may be able to keep essential parts of a feature running smoothly under intermittent network availability by dynamically changing whether it uses higher-accuracy models or lower-accuracy models. Similarly, product teams can also choose to lower ML accuracy when needed to keep a feature running under high-device memory load: "So people think about model compression as static resources, but the actual resources on device are dy- namic based on what's running. So it's useful to be able to on-the-fly change how much resources your model is uses." - E10 For any model, there will be some size and efficiency budget at which the model can be shrunk without any noticeable difference to the user. Below that threshold, accuracy degradation may degrade UX. A budget must balance the best model accuracy with the lowest possible resource footprint. Application budgetML ModelsAll Other Features140 MB Total Strategy #3: On-device ML does not need to be all-or-nothing. If current compression techniques cannot fit your ML feature on-device, try breaking the feature down into subtasks. Del- egate smaller subtask models to live on-device and delegate larger ML workloads to a server. Prioritize on-device ML for feature subtasks that will help preserve your user's privacy and keep critical functionality responsive in the absence of a network connection. 5.5 Considerations for Investing in Compression Participants strongly emphasized that model compression is an investment. Compression techniques can take intensive engineer- ing effort to apply-and do not always work. There are many cir- cumstances that can cause one compression technique to generate enormous savings in one model, and completely fail to produce any savings in a different model, potentially after weeks of wasted engineering effort. While this work is not an exact science, we detail general tips and guidance from practitioners. Note that most of these techniques assume the model to compress is a neural network. 5.5.1 Maximize Architecture Savings First. As shown in Figure 1, practitioners often start optimizing a model by finding a smaller architecture first. "If you're running a common ResNet, look at strides, layer widths, number of layers" [T5]. Participants also recommended neural architectures designed for device efficiency [E13, P5, E3, E11, T6], such as MobileNet [46]. Some applications do not need a heavy neural network; instead it might be possible, and even beneficial, to convert into a simpler decision tree or SVM [P3]. Architecture savings are seen as a more reliable first approach before attempting compression [E13, E1]: "If you're trying to reduce the size, model compression is effective, but more like a last resort. If you have a model that is just overkill, [compression] can shave off 20-40%, but just changing architecture to something smaller will have way bigger impact." - E11 Due to the high training cost of some models, participants dis- cussed manual architecture selection (as opposed to auto-ML solu- tions that automate various stages of ML development) based on their expertise: "It's really trial and error by hand monitoring the hardware usage [and] identifying bottlenecks," [E2] 5.5.2 Check the Architecture Against the Hardware. A critical caveat to architecture optimizations is that it is easy to be fooled. A com- mon mistake is to trust that academic efficiency results will be reproducible: "Just because you read a paper, don't expect what is "ef- ficient" in a paper to exactly work in practice," [E7]. The issue is that at the lowest level of computation, different hardware optimizes for different operations. Efficiency measures reported in papers are only reliable for the specific hardware set they were run on. Even for specialized accelerator hardware designed for ML models and neural networks, the hardware will likely only support certain types of operations. Since hardware cannot be altered at the same pace as software, the latest neural layer architectures from papers Fred Hohman, Mary Beth Kery, Donghao Ren, and Dominik Moritz may not be possible to run efficiently on-device. Practitioners em- phasized the need to adapt their neural architecture to better fit the hardware [T5, E7, P9]. 5.5.3 Test Against a Range of Hardware. In conventional machine learning work, and more generally much of modern software engi- neering, it is not required to know the details of the hardware that code will run on. In efficient machine learning, hardware may be one of the greatest challenges when working in on-device machine learning: "You must consider different layers of abstraction of a model from code to hardware. This can be hard for developers to understand." - E6 To further complicate matters, many times practitioners are not considering a single specific hardware implementation, but rather a class of hardware. Classes of hardware include platforms such as mobile phones, smartwatches, tablets, computers, and others. Con- sider a practitioner building a model for a smartphone. There are many types of smartphones, and versions of existing smartphones each with their own memory and compute details. Hardware also changes over time, and practitioners may need to consider older versions of hardware that have already been shipped. In the same way that front-end developers build responsive UIs and applications for multiple screensizes, so too do ML practitioners now need to optimize and test multiple hardware implementations specific to a set of devices [E6]. Strategy #4: If starting from scratch, chose a model architec- ture specifically designed for mobile devices, but be aware that an architecture may not perform as-advertised due to implementation differences in hardware. It is crucial to pro- file models on your physical target hardware-and for every hardware version you aim to support. Older devices usually have fewer compute resources for your model. 5.5.4 Accuracy v. Effort Trade-Off. Practitioners we spoke with had a sense of "accuracy v. effort" [E6] or "risk v. reward" [E13] for some of the most common compression approaches. As a general heuristic, compression techniques that need little-to-no retraining will be cheaper to apply-but at the cost of steeper model accuracy degradation. Since some of these models take days to train, involv- ing complex compression logic in the training process is costly. Practitioners must consider cost in money, time, and effort that implementing a specific compression technique could take. ($) Post-training Quantization. Quantizing a model's weights after the model has been trained was widely considered the first go-to compression technique for many applications. "So quantization is a big one. You can usually quan- tize to 8-bit integers without losing accuracy. This isn't always the case. You do need to be careful where you apply quantization. But generally it's a pretty generic technique across different hardware. You can usually cut from fp32 to fp16 and can get speed up by going to integers." - E4 Since weight quantization can be done without additional train- ing, it is considered cheap. 10/30 participants discussed using this Model Compression in Practice approach [E6, P8, E9, T3, T5, T1, E13, E7, T2, T2]. Although post- training quantization is considered "easy" [E9] as far as ML com- pression techniques go, practitioners emphasized that it still often takes complex code to implement and there are many algorithm variations [26] to experiment with [T5]. For models that need high accuracy, post-training quantization may not be enough to hit bud- get without unacceptable accuracy degradation [E9, E4, E13, E5]. ($$) Compression with Fine Tuning. When model accuracy goes down after quantization or pruning, fine tuning can help recover accuracy [26, 38]. Fine tuning a model costs training time, but is necessary in many situations to recover accuracy. Pruning tech- niques almost always require fine-tuning on the pruned model [38]. 6/30 participants discussed successfully utilizing this approach [P8, T3, T1, E8, E13, E10]. ($$$+) Compression-aware Training. Though it introduces ad- ditional complexity to model training, compression can be ap- proached as yet another optimization that a model needs to learn during training. 11/30 participants discussed having experience with quantization learned during training [E6, E9, T5, E3, E5, E7, E10, E1, E12, T2, P10]. This approach is generally considered best-in- class and often required when designing always-on ML experiences that require low latency, e.g., real-time computational photography models. Practitioners advised training-aware compression when the model needs to be compressed significantly to meet budget while keeping high accuracy: "If you want to go to lower bit quantization, such as 4 or below, it's almost impossible to use post-training quantization because the difference in accuracy gets way too big. So for this level of compression you need to do training-aware compression." - E9 Practitioners had less experience with learned sparsity tech- niques, calling learned sparsity "high risk high reward" [E13] be- cause it is much harder to control than post-training sparsity tech- niques. Although training-aware compression is considered the best form of compression for the greatest model shrinkage with the least accuracy degradation [26], a major drawback is that is must be planned for with initial model training: "Not starting early with compression is a dead end," [E3]. Practitioners use their experience and early testing to judge how much compression a model will need. For example, large vi- sion models may start far exceeding their size and power budgets, and require heavy compression to meet budget. In these scenar- ios, training-aware compression is likely necessary, which requires planning ahead: "It has to be done from day 0, not day 100," [E7]. For other applications, practitioners suggest estimating how much compression will be feasible with simple post-training quan- tization. To estimate quantization savings before training a model, first initialize the ML model architecture with random weights, then quantize, and test the model's speed and size on-device. Even a coarse estimate may be worth getting a sense of the magnitude of savings from quantization [E13]: "[It] gives you a sense of how much quantization is going to help at all before you go through expensive training step." - T5 If post-training techniques like quantization produce results that are too far from budget goals, teams can then pivot to training- aware approaches. Strategy #5: Before you heavily invest in a particular com- pression technique, start with a cheap estimate of how much savings you might expect to gain. For example, initialize a mobile-friendly architecture with random weights, then quan- tize it. Profile this "stand-in" compressed model on-device and compare its efficiency to your budget. If it meets budget, then quantization may be enough. If it is far off budget (such is the case with many real-time computer vision models), consider more intensive training-aware compression techniques. 5.5.5 Determine if a Model is Memory Bound or Compute Bound. Another useful strategy is to consider ahead which metrics are likely to be the biggest issue for a model type [T5]. A model is memory bound if the size of the model or the size of the data is the biggest issue. A model is compute bound if the speed/latency of the model is the biggest issue. For instance, "Computer vision tends to be memory bound and not compute bound. It's fast but the data sizes are massive" [T5]. Participants also suggest going layer-by-layer to identify bottlenecks since individual layers can be either memory or compute bound individually [E2]. If memory-bound, architecture changes, sparsity techniques, or Palettization techniques can help reduce size on-device. If the data size is causing the memory issue, reducing data resolution for model processing can help [E8], e.g., reducing video data from 1080p to 720p. On-disk storage is considered the easiest memory savings to get from model compression [E13]. If compute-bound, techniques like quantization can help speed up and simplify complex matrix math. Quantization can also save memory since smaller numbers help keep computation in cache memory [E12]. Cache locality is a common latency bottleneck to check [E6, E12], that also helps with power problems: "Latency is easier than power to improve. You can check cache locality, moving data takes a lot of power so that's a big one to check." - [E6] 5.6 Evaluating Compressed Models: Efficiency, Accuracy, and Artifacts The goal of model compression is to reduce a model's size while preserving its accuracy, or what some refer to as "acceptable accu- racy degradation" [E8]. In general, past a certain point, shrinking a model will likely degrade its accuracy. In literature, there are examples showing that compression can actually improve accuracy, by acting as a model regularizer and forcing the model to general- ize better [53, 93]. This phenomenon is sometimes referred to as Occam's Hill [38]: as light compression is applied, there can be an slight accuracy bump as the model is forced to generalize; however, as one increases the compression strength the model becomes too general to properly work and accuracy quickly drops. While these results have been observed on academic benchmarks, practitioners said that their models tend to generalize quite well already, so most often they see little improvement from the regularizer effect of compression [E8, E1]. In addition, many practitioners start with Fred Hohman, Mary Beth Kery, Donghao Ren, and Dominik Moritz ranges. You tend to lose resolution in the output where one branch dominates the range, and you lose the range of the lesser branch. You need additional care to check that they have the same range tracking during the forward quantization pass." - E6 For quantization, practitioners advise a "gut check" to ensure the quantized weights and activations match the ranges of the original model, or else accuracy will be badly degraded [E6]. 5.6.3 Robust, End-to-end Data Evaluation. Since the amount of success in model optimization varies significantly by architecture and task, "without a clear evaluation strategy you won't know if you're making things better or worse," [E11]. Some ML-powered experiences are composed of multiple models working together. Participants said they first test models individually to ensure they work standalone, then evaluate the multi-model systems to test compound effects [E10]. Practitioners said the curve visualizations (Figure 3) are often the output of evaluation pipelines. Many teams do extensive model evaluation, error, and failure analysis [T2, E12, P11, P6, P7, E10, T4]. "We cannot assume compres- sion doesn't change model behavior, so we look at confusion matrices and instances where model gets it wrong" [E12]. In one project that P11, P6, and P7 worked on together where small mistakes could lead to a poor user experience, they built "unit tests" for different curated testing datasets to monitor their accuracy over time. E6 also emphasized using unit tests of data to observe how single in- stances move through the model to both understand how much computational change occurs after compression and make the nec- essary adjustments to the model code. "Data so influential to hitting accuracy targets" [E3]. Strategy #6: Compression can degrade the accuracy of a model and change its behavior in unpredictable ways. It is essential to create a robust evaluation pipeline (e.g., defining metrics, curating test sets) before you start optimizing your model, so that you can reliably observe shifts in model error afterwards. To prevent degradation from a failed optimiza- tion, compare optimized models with varying amounts of compression to your original model, inspecting the metrics, subpopulation behaviors, and internals, such as weights and activations, to ensure they are within expected ranges. 5.6.4 Model Compression Artifacts. As with other types of media, such as image, audio, and video data, if too much compression is applied it can produce compression artifacts: noticeable distortions in the media (Figure 4). For example, compressing an image too much can produce blurry and blocky shapes over the subject matter; compressing audio can change the sound quality and waveform of the music. Multiple participants describe scenarios where their model had artifacts, although they did not borrow this language from other types of media: "Compressing like 90% can make things unstable with strange side effects. It's hard to figure out when you compress too much." - E13 It is tempting to think of accuracy degradation as the only ML artifact; however, there are more subtle, even sinister implications Figure 3: A common chart used for model comparison and selection, where the y-axis is a model behavioral metric (e.g., accuracy) and the x-axis is any number of performance met- rics (e.g., latency or power consumption). Each blue dot rep- resents one model trained with different architectures or compression schemes, and the red line indicates the accu- racy budget threshold. Practitioners look for the "knee in the curve" across charts: choosing a model above the accuracy threshold that minimizes latency and power consumption. In these charts, the selected model is colored red. very large models they need to shrink models past the point of observing accuracy boosts from compression. Thus, we focus this discussion on the much more common scenario where practitioners must wrestle with accuracy degradation. 5.6.1 The Trade-off Curve Visualization. To empirically compare multiple compressed models and select the one that satisfies budget requirements, practitioners typically plot a model behavioral metric (e.g., accuracy) on the y-axis against any performance metric (e.g., model size, model latency, or power consumption) on the x-axis [96, 97]. This is illustrated in Figure 3. Each dot represents a model architecture and compression pair. These charts are called multiple names throughout different teams, including the trade-off curve, the an accuracy Pareto curve, or the tuning curve. P3 described a scenario when optimizing over 6,000 small models. In their application, the ML model was already on the order of kilo- bytes; therefore, they could retrain many new models quickly. Com- paring thousands of models in parallel, they plotted the F1-score on the y-axis against the model size on the x-axis. This arrangement formed the usual curve. Teams then filtered out models that do not satisfy their budgets, and ultimately selected a single models in the "knee" of the curve that has the best balance between what metrics they care about (e.g., Pareto optimal). 5.6.2 Compounding Changes Degrade Accuracy. A common chal- lenge with maintaining accuracy is that model compression tech- niques can compound in unintended ways. In some scenarios, small optimizations throughout a model build on one another, so by the time a data input reaches the end of a network, its prediction is totally off. In ML this phenomenon is similar to the concept of ex- ploding/vanishing gradients [9, 67]. The effect of this compounding error is not obvious to spot in beginning [E9]. "When you have addition that takes two quantized values to a quantized output, it's not easy to check that the range of the inputs are the same as the output Latency (ms)Accuracy (%)0123450255075100Power consumption (mw)0246810 Model Compression in Practice Figure 4: Illustrative examples of compression artifacts in images and audio, but what do machine learning model arti- facts look like and how do we identify them? depending on what a model is used for. For example, where some subpopulation of data is underrepresented in a dataset, e.g., at the tail of a distribution, it could be that ML compression techniques removes this tail, amplifying existing biases. Examples of this have been observed empirically in the few publications investigating robustness and evaluation of compressed models [25, 43, 44, 56, 66]. One specific compression artifact example story was told from multiple participants. In the case of an object detection model that needed to run at a high frame rate, during development teams no- ticed one day that the bounding boxes were jittering in their demo. This finding was surprising, since the metrics from their most re- cent model iteration were reporting no changes, but "there were some weird side-effects" [T5]. It was not until someone debugging the problem realized that they had applied quantization through- out the neural network, including the final prediction layer. This coarsening of the data at the output produced correct bounding boxes, but resulted in a poor user experience. Another participant had seen this before, and remarked if the output of a model is "fine grain, don't quantize" [T1]. Generalizing from this example, one learning that teams have found is that when a model's prediction needs to be continuous, smooth, or user-perceivable at a high frame rate, it is best not to compress the final output layer [21]. Participants told us that other modeling tasks can to be harder to optimize than classification [E5]. "Regression models have been an absolute nightmare to compress" [E7]. Anytime the output needs to be a continuous or floating point value, then compression techniques like quantization can produce artifacts [E12]. 5.6.5 Demoing User Experiences. ML-powered experiences can be dependent upon multiple models working in concert, and the "best way to test compound [model] effects is having end-to-end evalua- tion" [E10]. Another strategy to catch artifacts is testing models "as close to the metal as possible," i.e., loading the models on-device and building demo applications to run outside of lab environments. "Since different hardware are not bit-wise accurate, metrics won't capture these changes" [E12]. Another practitioner told us "user ex- perience differences are the really important cases to isolate" [P5]. To find these user experience changes, teams have prioritized building demo applications where different models, e.g., a baseline model and a compressed model, can be dynamically toggled back and forth for testing [T4]. Some of these demos toggle between a model run- ning on-device and a model running on a server [E12]. Interactive and live demos like these allow for ML teams to get feedback from other product stakeholders [E10]. They are particularly helpful for designers to get an overall "feel" of a model: interacting with a model in its intended environment to understand its capabilities and limitations [T4]: "Get [the experience] in hands of people as fast as possible." - T4 This notion of the "feel" of a model was described multiple times. If an "ML engineer retrains [the model] and says it's better, we still need see if it feels better," [T4]. To try and attribute the feel of a model to actionable development steps, practitioners show debug- ging modes on-device to observe live, real-time charts of a model's prediction and confidence, to help find edge cases and drill into specific errors that metrics may or may not capture [P11, P6, P7]. Strategy #7: Despite all the effort to create criteria and met- rics to quantitatively measure and benchmark your model, your evaluation pipeline may not capture every aspect of your model's performance and behavior. Even if your model passes evaluation, move it on-device, in the intended environment in which it will run, and get it in the hands of users to demo. There is no other way to capture the feel of an ML-powered user experience. 6 DESIGN OPPORTUNITIES FOR EFFICIENT MACHINE LEARNING TOOLS AND INTERFACES Given the unique challenges to efficient on-device ML, where can human-centered ML researchers, practitioners, and designers start to engage? As efficient machine learning techniques are driven for- ward by advances in hardware engineering and ML research, there remains a major barrier in practically applying these techniques for real-world ML features and user experiences. Tools influence what is possible: "there is a gap between what is possible with machine learning and what [tools] are being used," [E4]. Currently, the tooling for efficient on-device ML is underdeveloped, "homegrown and ad- hoc," [E9]. Moreover, current tools focus on individual algorithms (subsection 2.6) instead of the holistic process: "this a newer area, many tools are specific to a project and tend to be prototypes to prove feasibility," [E9]. As we have demonstrated in this paper, there is considerable design planning, experimentation, and strategy that experts use to make on-device ML a reality. Proper tools could help guide and educate practitioners to develop these skills: "Tooling is education products disguised as software. Better tools make it easy to do correct things and harder to do incorrect things." - T2 OriginalCompressedImagesAudioML Model? We next share interdisciplinary HCI + ML research directions for supporting practitioners. While the space of tooling opportunities is wide and will evolve over time, we provide a few actionable recommendations for future tools and interfaces that are ready for development today. 6.1 Developing Intuition for Compression Although modern libraries for machine learning make it easier than ever develop models, that does not mean a practitioner know how to best train, evaluate, and deploy models. Machine learning is an inherently iterative and and empirical practice [69], and developing intuition for how models learn and behave is a major competitive advantage over blindly tweaking hyper-parameters. Interactive playgrounds that provide a safe environment where practitioners can quickly build and test their ideas could be a great onboarding experience for learning about efficient ML and model compression. Existing examples include TensorFlow Playground [85] for small neural networks, CNN Explainer [102] for convolutional neural networks, and GANLab [49] for generative additive models. An efficient ML playground could allow practitioners to learn about and build intuition about different compression techniques [E12], model architectures [E7], and their effect on hardware combinations [P9]. For example, comparing two compression techniques and inspecting their impact on metrics such as power, latency, and model size. 6.2 Comparing Models Across Compression Schemes A common scenario in efficient model development is considering the trade-off between accuracy and performance, as discussed in Section 5.6. While conventional ML development requires model comparison between architectures and hyper-parameters, the ad- ditional optimization metrics that practitioners must navigate add additional complexity in efficient machine learning [T5]. Both ac- curacy and performance encompass numerous metrics to balance between. Better tooling to support model comparison could help practitioners compare a feasibility, or baseline model, against dif- ferent compressed models to select the best model possible. 6.3 Finding Model Bottlenecks for Targeted Compression In Section 5.5.5 and Section 5.6.4, practitioners discuss analyzing a model layer-by-layer. Targeted compression is the practice of se- lectively optimizing certain components of a model, for example, larger layers in a neural network. Practitioners described the op- erations that go into targeted compression. Currently the process is tedious, manual, and time-consuming, where "you must go layer by layer, operation by operation," [P11, P6, P7]. There exists a space of interfaces that could help practitioners look inside their models, by mapping metrics to specific layers of a network [T5], finding the performance bottlenecks in a network [E5], comparing the input and output of these bottleneck layers [E9], and selectively optimizing them. Targeted compression tooling may also ease the difficulty of thinking on the hardware level. For example, once an on-device Fred Hohman, Mary Beth Kery, Donghao Ren, and Dominik Moritz model that is written in Python is compiled onto specialized hard- ware, many of the operations look far more low-level than Python code. To complicate matters, low-level hardware operations may not have a one-to-one mapping back to the original Python code, due to optimizations in the compilation process. Better tools could help practitioners perform analytics on their models to find bottlenecks while helping navigate between different layers of abstraction. 6.4 Evaluating Multi-model ML Systems It is often assumed that model evaluation is done on a single model, isolated in a "lab environment." In practice, this is not the case. Not only are models integrated into a larger app or codebase, many modern ML-powered experiences are the result of multiple mod- els working together. This makes evaluation when models are ar- ranged in chains, where the outputs of one model are the inputs of another [E10]. If you compress one model, how does that impact downstream models? Recalling the concept of compounding error discussed in Section 5.6, small errors introduced in earlier models can compound to produce bigger errors by the end of a model chain [E10]. E3 emphasized this challenge, saying that the future of ML driven user experiences will be accomplished through multi-model systems. When multiple models are running simultaneously, each can be evaluated individually, but also must be considered as a whole, which makes it "super hard to reason about," [E3]. Future tools that generalize and can evaluate multi-model machine learn- ing systems will have a big impact in helping practitioners build, debug, and make sense of large data-driven applications. 6.5 Easier Testing on Hardware Environments One recommendation repeated again and again by practitioners in this study was to measure model performance on device. The performance of one model will like differ across different hardware [T4]. However, testing on real hardware can be a major barrier. Due the variety of mobile devices and different versions of hardware, it can be hard to build for multiple hardware implementations simultaneously. The average ML developer (outside of a hardware company) may not have access to all versions of all devices their users might have. When it comes to future tooling opportunities, E6 says it best, "the tools need to expose and take care of the cases for different hardware to maximize the hardware efficiency." 6.6 Automating (Some) Compression Experiments While many of the practitioners we interviewed discussed creating efficient models as an human-in-the-loop iteration process, there are opportunities to automate applying different compression schemes and present results to developers. An apt analogy is what AutoML is to hyperparameter searching: instead of sequentially trying dif- ferent compression schemes, perform a grid search and parallelize many different tests simultaneously. P3 is excited by tools that could automate certain parts of a model, perform some analysis to figure out which techniques work and which do not, and finally present a summary of experiments make suggestions for the best fit compression schemes. However, we do not expect the process of creating efficient models to be completely automated. Throughout our study, experts made it clear that successful model compression Model Compression in Practice is an iterative development process, but leveraging the strengths of automation where appropriate suggests rich mixed-initiative approaches to creating efficient models. 7 LIMITATIONS & VALIDITY Optimizing and creating efficient models to run on mobile devices is still relatively new, and best practices are evolving alongside the rapid pace of ML research. Thus we expect not all the practices mentioned in this paper will stand the test of time. As discussed in Section 4, studying experts from a single organization naturally limits the perspective of this paper, therefore we also expect cer- tain details of our findings may not generalize. Nonetheless, we believe that the high-level strategies for on-device ML shared in this work-including budget design, strategies for investing in model op- timization, and proper compression evaluation-will generalize to be useful for many different kinds of devices, domains, and ML user experiences. We are eager to watch how this interdisciplinary area of research progress in the future and reflect back on the practices outlined in this work to see which have remained, been removed, or reinvented. 8 CONCLUSION In this research we illustrated some of the pragmatic design consid- erations that go into efficient on-device machine learning. While this paper is far less technical than related work from the ML litera- ture, we feel the interdisciplinary bridge to UX and product design aspects are critical to bringing on-device ML into more approach- able and popular practice. Through the results of this study, we are able to spotlight the holistic, end-to-end considerations that world- experts in model compression have developed from bridging ML research into real-life deployments of on-device ML experiences. ACKNOWLEDGMENTS We thank our participants at Apple for generously sharing their time and knowledge. We also thank the many colleagues that have given their feedback on the paper. Specifically, we thank Kayur Patel who sparked early ideas for this line of research, as well as Mohammad Rastegari, Sachin Mehta, and Yannick Assogba for their advisement on this work. REFERENCES [1] 2019. Design for AI. IBM (2019). https://www.ibm.com/design/ai/ [2] 2019. Human interface guidelines: Machine learning. Apple Human Inter- face Guidelines (2019). https://developer.apple.com/design/human-interface- guidelines/technologies/machine-learning/introduction [3] 2019. People + AI guidebook. Google (2019). https://pair.withgoogle.com/ guidebook/ [4] Saleema Amershi, Andrew Begel, Christian Bird, Robert DeLine, Harald Gall, Ece Kamar, Nachiappan Nagappan, Besmira Nushi, and Thomas Zimmermann. 2019. Software engineering for machine learning: A case study. In 2019 IEEE/ACM 41st International Conference on Software Engineering: Software Engineering in Practice. IEEE, 291–300. https://doi.org/10.1109/icse-seip.2019.00042 [5] Saleema Amershi, Max Chickering, Steven M Drucker, Bongshin Lee, Patrice Simard, and Jina Suh. 2015. Modeltracker: Redesigning performance analysis tools for machine learning. In Proceedings of the 33rd Annual ACM Conference on Human Factors in Computing Systems. 337–346. [6] Saleema Amershi, Dan Weld, Mihaela Vorvoreanu, Adam Fourney, Besmira Nushi, Penny Collisson, Jina Suh, Shamsi Iqbal, Paul N Bennett, Kori Inkpen, et al. 2019. Guidelines for human-AI interaction. In Proceedings of the 2019 CHI Conference on Human Factors in Computing Systems. 1–13. https://doi.org/10. 1145/3290605.3300233 [7] Apple. 2023. Optimizing models - Core ML Tools overview. https://coremltools. readme.io/docs [8] Apple. 2023. Personalizing a model with on-device updates. https: //developer.apple.com/documentation/coreml/model_personalization/ personalizing_a_model_with_on-device_updates [9] Yoshua Bengio, Patrice Simard, and Paolo Frasconi. 1994. Learning long-term dependencies with gradient descent is difficult. IEEE Transactions on Neural Networks 5, 2 (1994), 157–166. [10] Umang Bhatt, Alice Xiang, Shubham Sharma, Adrian Weller, Ankur Taly, Yunhan Jia, Joydeep Ghosh, Ruchir Puri, José MF Moura, and Peter Ecker- sley. 2020. Explainable machine learning in deployment. In Proceedings of the 2020 Conference on Fairness, Accountability, and Transparency. 648–657. https://doi.org/10.1145/3351095.3375624 [11] Sarah Bird, Miro Dudík, Richard Edgar, Brandon Horn, Roman Lutz, Vanessa Milan, Mehrnoosh Sameki, Hanna Wallach, and Kathleen Walker. 2020. Fair- learn: A toolkit for assessing and improving fairness in AI. Microsoft, Tech. Rep. MSR-TR-2020-32 (2020). [12] Rishi Bommasani, Drew A Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, et al. 2021. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258 (2021). [13] Carolyn Boyce and Palena Neale. 2006. Conducting in-depth interviews: A guide for designing and conducting in-depth interviews for evaluation input. Vol. 2. Pathfinder International Watertown, MA. [14] Alex Bäuerle, Ángel Alexander Cabrera, Fred Hohman, Megan Maher, David Koski, Xavier Suau, Titus Barik, and Dominik Moritz. 2022. Symphony: Composing interactive interfaces for machine learning. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems. ACM. https: //doi.org/10.1145/3491102.3502102 [16] [15] Ángel Cabrera, Will Epperson, Fred Hohman, Minsuk Kahng, Jamie Morgen- stern, and Duen Horng Chau. 2019. FairVis: Visual analytics for discovering intersectional bias in machine learning. IEEE Conference on Visual Analytics Science and Technology (2019). https://doi.org/10.1109/VAST47406.2019.8986948 Jiasi Chen and Xukan Ran. 2019. Deep learning with edge computing: A review. Proc. IEEE 107, 8 (2019), 1655–1674. https://doi.org/10.1109/jproc.2019.2921977 [17] Yu Cheng, Duo Wang, Pan Zhou, and Tao Zhang. 2018. Model compression and acceleration for deep neural networks: The principles, progress, and challenges. IEEE Signal Processing Magazine 35, 1 (2018), 126–136. https://doi.org/10.1109/ msp.2017.2765695 [18] Minsik Cho, Keivan A. Vahid, Saurabh Adya, and Mohammad Rastegari. 2022. Differentiable k-means clustering layer for neural network compression. In International Conference on Learning Representations. https://arxiv.org/abs/ 2108.12659 [19] Tejalal Choudhary, Vipul Mishra, Anurag Goswami, and Jagannathan Saranga- pani. 2020. A comprehensive survey on model compression and acceleration. Artificial Intelligence Review 53, 7 (2020), 5113–5155. https://doi.org/10.1007/ s10462-020-09816-7 [20] Fernando Delgado, Stephen Yang, Michael Madaio, and Qian Yang. 2021. Stake- holder participation in AI: Beyond "add diverse stakeholders and stir". arXiv (2021). [21] Lei Deng, Guoqi Li, Song Han, Luping Shi, and Yuan Xie. 2020. Model compres- sion and hardware acceleration for neural networks: A comprehensive survey. Proc. IEEE 108, 4 (2020), 485–532. https://doi.org/10.1109/jproc.2020.2976475 [22] Google Developers. Accessed 2022. Why on-device machine learning? https: //developers.google.com/learn/topics/on-device-ml/learn-more [23] Sauptik Dhar, Junyao Guo, Jiayi Liu, Samarth Tripathi, Unmesh Kurup, and Mohak Shah. 2021. A survey of on-device machine learning: An algorithms and learning theory perspective. ACM Transactions on Internet of Things 2, 3 (2021), 1–49. https://doi.org/10.1145/3450494 [24] Farah Fahim, Benjamin Hawks, Christian Herwig, James Hirschauer, Sergo Jindariani, Nhan Tran, Luca P Carloni, Giuseppe Di Guglielmo, Philip Harris, Jeffrey Krupa, et al. 2021. hls4ml: An open-source codesign workflow to em- power scientific low-power machine learning devices. (2021). arXiv:2103.05579 [25] Trevor Gale, Erich Elsen, and Sara Hooker. 2019. The state of sparsity in deep neural networks. arXiv preprint arXiv:1902.09574 (2019). [26] Amir Gholami, Sehoon Kim, Zhen Dong, Zhewei Yao, Michael W Mahoney, and Kurt Keutzer. 2021. A survey of quantization methods for efficient neural network inference. arXiv (2021). arXiv:2103.13630 [27] Charlie Giattino, Edouard Mathieu, Veronika Samborska, Julia Broden, and Our World in Data (2022). Max Roser. 2022. https://ourworldindata.org/artificial-intelligence. intelligence. Artificial [28] Graham R Gibbs. 2007. Thematic coding and categorizing. Analyzing Qualitative Data 703 (2007), 38–56. [29] Google. 2019. QKeras. https://github.com/google/qkeras [30] Google. 2021. Facets. https://pair-code.github.io/facets/ [31] Google. 2021. Know Your Data. https://knowyourdata.withgoogle.com/ [32] Jianping Gou, Baosheng Yu, Stephen J Maybank, and Dacheng Tao. 2021. Knowl- edge distillation: A survey. International Journal of Computer Vision 129, 6 (2021), 1789–1819. https://doi.org/10.1007/s11263-021-01453-z [33] Renjie Gu, Chaoyue Niu, Fan Wu, Guihai Chen, Chun Hu, Chengfei Lyu, and Zhihua Wu. 2021. From server-based to client-based machine learning: A comprehensive survey. Comput. Surveys 54, 1 (2021), 1–36. https://doi.org/10. 1145/3424660 Jochen Görtler, Fred Hohman, Dominik Moritz, Kanit Wongsuphasawat, Dong- hao Ren, Rahul Nair, Marc Kirchner, and Kayur Patel. 2022. Neo: Generalizing confusion matrix visualization to hierarchical and multi-output labels. In Pro- ceedings of the SIGCHI Conference on Human Factors in Computing Systems. ACM. https://doi.org/10.1145/3491102.3501823 [34] [35] Song Han, Huizi Mao, and William J Dally. 2016. Deep compression: Com- pressing deep neural networks with pruning, trained quantization and huffman coding. (2016). [36] David J Hand. 1998. Data mining: Statistics and more? The American Statistician 52, 2 (1998), 112–118. [37] Charles Hill, Rachel Bellamy, Thomas Erickson, and Margaret Burnett. 2016. Trials and tribulations of developers of intelligent systems: A field study. In 2016 IEEE Symposium on Visual Languages and Human-Centric Computing. IEEE, 162–170. https://doi.org/10.1109/vlhcc.2016.7739680 [38] Torsten Hoefler, Dan Alistarh, Tal Ben-Nun, Nikoli Dryden, and Alexandra Peste. 2021. Sparsity in deep learning: Pruning and growth for efficient inference and training in neural networks. Journal of Machine Learning Research 22, 241 (2021), 1–124. [39] Fred Hohman, Minsuk Kahng, Robert Pienta, and Duen Horng Chau. 2018. Visual analytics in deep learning: An interrogative survey for the next frontiers. IEEE Transactions on Visualization and Computer Graphics (2018). https://doi. org/10.1109/TVCG.2018.2843369 [40] Fred Hohman, Kanit Wongsuphasawat, Mary Beth Kery, and Kayur Patel. 2020. Understanding and visualizing data iteration in machine learning. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems. ACM. https: //doi.org/10.1145/3313831.3376177 [41] Kenneth Holstein, Jennifer Wortman Vaughan, Hal Daumé III, Miro Dudik, and Hanna Wallach. 2019. Improving fairness in machine learning systems: What do industry practitioners need?. In Proceedings of the 2019 CHI Conference on Human Factors in Computing Systems. 1–16. https://doi.org/10.1145/3290605.3300830 [42] Sungsoo Ray Hong, Jessica Hullman, and Enrico Bertini. 2020. Human factors in model interpretability: Industry practices, challenges, and needs. Proceedings of the ACM on Human-Computer Interaction 4, CSCW1 (2020), 1–26. [43] Sara Hooker, Aaron Courville, Gregory Clark, Yann Dauphin, and Andrea Frome. 2019. What do compressed deep neural networks forget? arXiv preprint arXiv:1911.05248 (2019). [44] Sara Hooker, Nyalleng Moorosi, Gregory Clark, Samy Bengio, and Emily Denton. 2020. Characterising bias in compressed models. arXiv (2020). arXiv:2010.03058 [45] Aspen Hopkins and Serena Booth. 2021. Machine learning practices outside big tech: How resource constraints challenge responsible development. In Pro- ceedings of the 2021 AAAI/ACM Conference on AI, Ethics, and Society. 134–145. [46] Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. 2017. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv abs/1704.04861 (2017). arXiv:1704.04861 [47] Rui Hu, Yuanxiong Guo, Hongning Li, Qingqi Pei, and Yanmin Gong. 2020. Personalized federated learning with differential privacy. IEEE Internet of Things Journal 7, 10 (2020), 9530–9539. Intel. 2020. Neural Compressor. https://github.com/intel/neural-compressor [48] [49] Minsuk Kahng, Nikhil Thorat, Duen Horng Polo Chau, Fernanda B Viégas, and Martin Wattenberg. 2018. Gan lab: Understanding complex deep generative mod- els using interactive visual experimentation. IEEE Transactions on Visualization and Computer Graphics 25, 1 (2018), 1–11. https://poloclub.github.io/ganlab/ [50] Mary Beth Kery, Donghao Ren, Fred Hohman, Dominik Moritz, Kanit Wong- suphasawat, and Kayur Patel. 2020. mage: Fluid moves between code and graphical work in computational notebooks. In Proceedings of the ACM Sympo- sium on User Interface Software and Technology. ACM. https://doi.org/10.1145/ 3379337.3415842 [52] [51] Eleanor Knott, Aliya Hamid Rao, Kate Summers, and Chana Teeger. 2022. In- terviews in the social sciences. Nature Reviews Methods Primers 2, 1 (2022), 1–15. Jakub Konečn`y, H Brendan McMahan, Felix X Yu, Peter Richtárik, Ananda Theertha Suresh, and Dave Bacon. 2016. Federated learning: Strategies for improving communication efficiency. arXiv preprint arXiv:1610.05492 (2016). [53] Aditya Kusupati, Vivek Ramanujan, Raghav Somani, Mitchell Wortsman, Pra- teek Jain, Sham Kakade, and Ali Farhadi. 2020. Soft threshold weight repa- rameterization for learnable sparsity. In International Conference on Machine Learning. PMLR, 5544–5555. [54] Steinar Kvale. 2006. Dominance through interviews and dialogues. Qualitative Inquiry 12, 3 (2006), 480–500. Fred Hohman, Mary Beth Kery, Donghao Ren, and Dominik Moritz [55] Q Vera Liao, Daniel Gruen, and Sarah Miller. 2020. Questioning the AI: Informing design practices for explainable AI user experiences. In Proceedings of the 2020 CHI Conference on Human Factors in Computing Systems. 1–15. https://doi.org/ 10.1145/3313831.3376590 [56] Lucas Liebenwein, Cenk Baykal, Brandon Carter, David Gifford, and Daniela Rus. 2021. Lost in pruning: The effects of pruning neural networks beyond test accuracy. Proceedings of Machine Learning and Systems 3 (2021), 93–138. [57] Wei Yang Bryan Lim, Nguyen Cong Luong, Dinh Thai Hoang, Yutao Jiao, Ying- Chang Liang, Qiang Yang, Dusit Niyato, and Chunyan Miao. 2020. Federated learning in mobile edge networks: A comprehensive survey. IEEE Communica- tions Surveys & Tutorials 22, 3 (2020), 2031–2063. https://doi.org/10.1109/comst. 2020.2986024 [58] Michael Madaio, Lisa Egede, Hariharan Subramonyam, Jennifer Wort- man Vaughan, and Hanna Wallach. 2022. Assessing the fairness of AI systems: AI practitioners' processes, challenges, and needs for support. Proceedings of the ACM on Human-Computer Interaction 6, CSCW1 (2022), 1–26. [59] Michael A Madaio, Luke Stark, Jennifer Wortman Vaughan, and Hanna Wallach. 2020. Co-designing checklists to understand organizational challenges and opportunities around fairness in AI. In Proceedings of the 2020 CHI Conference on Human Factors in Computing Systems. 1–14. [60] Microsoft. 2021. Neural network intelligence. https://github.com/microsoft/nni [61] Ceena Modarres, Mark Ibrahim, Melissa Louie, and John Paisley. 2018. Towards explainable deep learning for credit lending: A case study. arXiv (2018). [62] Steven Gonzalez Monserrate. 2022. The cloud is material: On the environmental impacts of computation and data storage. MIT Case Studies in Social and Ethical Responsibilities of Computing Winter 2022 (Jan 2022). https://doi.org/10.21428/ 2c646de5.031d4553 [63] Rajiv Movva, Sidhika Balachandar, Kenny Peng, Gabriel Agostini, Nikhil Garg, and Emma Pierson. 2023. Large language models shape and are shaped by society: A survey of arXiv publication patterns. arXiv preprint arXiv:2307.10700 (2023). [64] MG Sarwar Murshed, Christopher Murphy, Daqing Hou, Nazar Khan, Ganesh Ananthanarayanan, and Faraz Hussain. 2021. Machine learning at the network edge: A survey. Comput. Surveys 54, 8 (2021), 1–37. https://doi.org/10.1145/ 3469029 [65] NVIDIA. 2023. NVIDIA deep learning TensorRT documentation - optimiz- ing TensorRT performance. https://docs.nvidia.com/deeplearning/tensorrt/ developer-guide/index.html [66] Kelechi Ogueji, Orevaoghene Ahia, Gbemileke Onilude, Sebastian Gehrmann, Sara Hooker, and Julia Kreutzer. 2022. Intriguing properties of compression on multilingual models. arXiv preprint arXiv:2211.02738 (2022). [67] Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. 2013. On the difficulty of training recurrent neural networks. In International Conference on Machine Learning. PMLR, 1310–1318. [68] Samir Passi and Steven J Jackson. 2018. Trust in data science: Collaboration, translation, and accountability in corporate data science projects. Proceedings of the ACM on Human-Computer Interaction 2, CSCW (2018), 1–28. [69] Kayur Patel, James Fogarty, James A Landay, and Beverly Harrison. 2008. In- vestigating statistical machine learning as a tool for software development. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems. 667–676. https://doi.org/10.1145/1357054.1357160 [70] David Piorkowski, Soya Park, April Yi Wang, Dakuo Wang, Michael Muller, and Felix Portnoy. 2021. How ai developers overcome communication challenges in a multidisciplinary team: A case study. Proceedings of the ACM on Human- Computer Interaction 5, CSCW1 (2021), 1–25. [71] Antonio Polino, Razvan Pascanu, and Dan Alistarh. 2018. Model compression via distillation and quantization. arXiv (2018). arXiv:1802.05668 [72] PyTorch. 2018. Quantization. https://pytorch.org/docs/stable/quantization.html [73] PyTorch. 2019. Sparisty. https://pytorch.org/docs/stable/sparse.html [74] PyTorch. 2023. PyTorch Examples. https://pytorch.org/tutorials/ [75] Bogdana Rakova, Jingying Yang, Henriette Cramer, and Rumman Chowdhury. 2021. Where responsible AI meets reality: Practitioner perspectives on en- ablers for shifting organizational practices. Proceedings of the ACM on Human- Computer Interaction 5, CSCW1 (2021), 1–23. [76] Donghao Ren, Saleema Amershi, Bongshin Lee, Jina Suh, and Jason D Williams. 2016. Squares: Supporting interactive performance analysis for multiclass classifiers. IEEE Rransactions on Visualization and Computer Graphics 23, 1 (2016), 61–70. [77] Marco Tulio Ribeiro and Scott Lundberg. 2022. Adaptive testing and debugging of NLP models. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). 3253–3267. [78] Marco Tulio Ribeiro, Tongshuang Wu, Carlos Guestrin, and Sameer Singh. 2020. Beyond accuracy: Behavioral testing of NLP models with CheckList. Association for Computational Linguistics (2020). [79] Samantha Robertson, Tonya Nguyen, and Niloufar Salehi. 2021. Modeling assumptions clash with the real world: Transparency, equity, and community challenges for student assignment algorithms. In Proceedings of the 2021 CHI Conference on Human Factors in Computing Systems. 1–14. Model Compression in Practice [80] Nithya Sambasivan, Shivani Kapania, Hannah Highfill, Diana Akrong, Praveen Paritosh, and Lora M Aroyo. 2021. "Everyone wants to do the model work, not the data work": Data cascades in high-stakes AI. In Proceedings of the 2021 CHI Conference on Human Factors in Computing Systems. 1–15. https: //doi.org/10.1145/3411764.3445518 [81] Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang- Chieh Chen. 2018. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and pattern Recognition. 4510–4520. https://doi.org/10.1109/cvpr.2018.00474 [82] Edgar H Schein. 1990. Organizational culture. Vol. 45. American Psychological Association. [83] David Sculley, Gary Holt, Daniel Golovin, Eugene Davydov, Todd Phillips, Dietmar Ebner, Vinay Chaudhary, Michael Young, Jean-Francois Crespo, and Dan Dennison. 2015. Hidden technical debt in machine learning systems. Advances in Neural Information Processing Systems 28 (2015). [84] Abhishek Sehgal and Nasser Kehtarnavaz. 2019. Guidelines and benchmarks for deployment of deep learning models on smartphones as real-time apps. Machine Learning and Knowledge Extraction 1, 1 (2019), 450–465. [85] Daniel Smilkov, Shan Carter, D Sculley, Fernanda B Viegas, and Martin Wat- tenberg. 2016. Direct-manipulation visualization of deep networks. In ICML Workshop on Vis for Deep Learning. Irene Solaiman, Zeerak Talat, William Agnew, Lama Ahmad, Dylan Baker, Su Lin Blodgett, Hal Daumé III, Jesse Dodge, Ellie Evans, Sara Hooker, et al. 2023. Evaluating the social impact of generative AI systems in systems and cociety. arXiv preprint arXiv:2306.05949 (2023). [87] Stanford. 2023. The AI index report: Measuring trends in artificial intelligence. [86] https://aiindex.stanford.edu/report/ [88] Mingxing Tan and Quoc Le. 2019. Efficientnet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning. PMLR, 6105–6114. arXiv:1905.11946 [89] TensorFlow. 2018. Introducing the Model Optimization Toolkit for Tensor- Flow. https://blog.tensorflow.org/2018/09/introducing-model-optimization- toolkit.html [90] TensorFlow. 2020. training with TensorFlow https: Model Optimization Toolkit //blog.tensorflow.org/2020/04/quantization-aware-training-with-tensorflow- model-optimization-toolkit.html - performance with accuracy. Quantization aware [91] David R Thomas. 2003. A general inductive approach for qualitative data analysis. American Journal of Evaluation 27, 2 (2003), 237–246. [92] Nenad Tomašev, Julien Cornebise, Frank Hutter, Shakir Mohamed, Angela Picciariello, Bec Connelly, Danielle CM Belgrave, Daphne Ezer, Fanny Cachat van der Haert, Frank Mugisha, et al. 2020. AI for social good: Unlocking the opportunity for positive impact. Nature Communications 11, 1 (2020), 2468. [93] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. 2021. Training data-efficient image transformers & distillation through attention. In International Conference on Machine Learning. PMLR, 10347–10357. [109] [105] [103] Pete Warden and Daniel Situnayake. 2019. Tinyml: Machine learning with tensorflow lite on arduino and ultra-low-power microcontrollers. O'Reilly Media. [104] David; Sarabia Miguel; Sivakumar Niv; Arawjo Ian; Joshi Aparna; Doumbouya Moussa; Suau Xavier; Zappella Luca; Apostoloff Nicholas Welsh, Megan Ma- her; Koski. 2023. Data and Network Introspection Kit. https://github.com/apple/ dnikit James Wexler, Mahima Pushkarna, Tolga Bolukbasi, Martin Wattenberg, Fer- nanda Viégas, and Jimbo Wilson. 2019. The what-if tool: Interactive probing of machine learning models. IEEE Transactions on Visualization and Computer Graphics 26, 1 (2019), 56–65. [106] Maximiliane Windl, Sebastian S Feger, Lara Zijlstra, Albrecht Schmidt, and Pawel W Wozniak. 2022. 'It is not always discovery time': Four pragmatic approaches in designing AI systems. In CHI Conference on Human Factors in Computing Systems. 1–12. [107] Kanit Wongsuphasawat, Daniel Smilkov, James Wexler, Jimbo Wilson, Dande- lion Mane, Doug Fritz, Dilip Krishnan, Fernanda B Viégas, and Martin Watten- berg. 2017. Visualizing dataflow graphs of deep learning models in tensorflow. IEEE Transactions on Visualization and Computer Graphics 24, 1 (2017), 1–12. [108] Austin P. Wright, Zijie J. Wang, Haekyu Park, Grace Guo, Fabian Sperrle, Men- natallah El-Assady, Alex Endert, Daniel Keim, and Duen Horng Chau. 2020. A comparative analysis of industry human-AI interaction guidelines. Workshop on Trust and Expertise in Visual Analytics at IEEE VIS (2020). Junru Wu, Yue Wang, Zhenyu Wu, Zhangyang Wang, Ashok Veeraraghavan, and Yingyan Lin. 2018. Deep k-means: Re-training and parameter sharing with harder cluster assignments for compressing deep convolutions. In International Conference on Machine Learning. PMLR, 5363–5372. [110] Tongshuang Wu, Marco Tulio Ribeiro, Jeffrey Heer, and Daniel S Weld. 2019. Errudite: Scalable, reproducible, and testable error analysis. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics. 747–763. [111] Tongshuang Wu, Marco Tulio Ribeiro, Jeffrey Heer, and Daniel S Weld. 2021. Polyjuice: Generating counterfactuals for explaining, evaluating, and improving models. Association for Computational Linguistics (2021). [112] Canwen Xu and Julian McAuley. 2023. A survey on model compression and ac- celeration for pretrained language models. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 37. 10566–10575. [113] Qian Yang. 2018. Machine learning as a UX design material: How can we imagine beyond automation, recommenders, and reminders?. In AAAI Spring Symposium Series. [114] Qian Yang, Alex Scuito, John Zimmerman, Jodi Forlizzi, and Aaron Steinfeld. 2018. Investigating how experienced UX designers effectively work with ma- chine learning. In Proceedings of the 2018 Designing Interactive Systems Confer- ence. 585–596. [115] Nur Yildirim, Alex Kass, Teresa Tung, Connor Upton, Donnacha Costello, Robert Giusti, Sinem Lacin, Sara Lovic, James M O'Neill, Rudi O'Reilly Meehan, et al. 2022. How experienced designers of enterprise applications engage AI as a design material. In CHI Conference on Human Factors in Computing Systems. 1–13. [94] Marcos Treviso, Tianchu Ji, Ji-Ung Lee, Betty van Aken, Qingqing Cao, Manuel R Ciosici, Michael Hassid, Kenneth Heafield, Sara Hooker, Pedro H Martins, et al. 2022. Efficient methods for natural language processing: A survey. arXiv (2022). [95] Marcos Treviso, Ji-Ung Lee, Tianchu Ji, Betty van Aken, Qingqing Cao, Manuel R Ciosici, Michael Hassid, Kenneth Heafield, Sara Hooker, Colin Raffel, et al. 2023. Efficient methods for natural language processing: A survey. Transactions of the Association for Computational Linguistics 11 (2023), 826–860. [96] Pavan Kumar Anasosalu Vasu, James Gabriel, Jeff Zhu, Oncel Tuzel, and Anurag Ranjan. 2023. FastViT: A fast hybrid vision transformer using structural repa- rameterization. arXiv preprint arXiv:2303.14189 (2023). [97] Pavan Kumar Anasosalu Vasu, James Gabriel, Jeff Zhu, Oncel Tuzel, and Anurag Ranjan. 2023. An improved one millisecond mobile backbone. (2023). [98] Pablo Villalobos, Jaime Sevilla, Tamay Besiroglu, Lennart Heim, Anson Ho, and Marius Hobbhahn. 2022. Machine learning model sizes and the parameter gap. arXiv:2207.02852 [cs.LG] [99] Dakuo Wang, Josh Andres, Justin D Weisz, Erick Oduor, and Casey Dugan. 2021. Autods: Towards human-centered automation of data science. In Proceedings of the 2021 CHI Conference on Human Factors in Computing Systems. 1–12. [100] Dakuo Wang, Q Vera Liao, Yunfeng Zhang, Udayan Khurana, Horst Samulowitz, Soya Park, Michael Muller, and Lisa Amini. 2021. How much automation does a data scientist want? arXiv (2021). [101] Dakuo Wang, Justin D Weisz, Michael Muller, Parikshit Ram, Werner Geyer, Casey Dugan, Yla Tausczik, Horst Samulowitz, and Alexander Gray. 2019. Human-AI collaboration in data science: Exploring data scientists' percep- tions of automated AI. Proceedings of the ACM on Human-Computer Interaction 3, CSCW (2019), 1–24. [102] Zijie J. Wang, Robert Turko, Omar Shaikh, Haekyu Park, Nilaksh Das, Fred Hohman, Minsuk Kahng, and Duen Horng (Polo) Chau. 2021. CNN explainer: Learning convolutional neural networks with interactive visualization. In IEEE Transactions on Visualization and Computer Graphics. IEEE. https://doi.org/10. 1109/TVCG.2020.3030418 [116] Marwa Zamzam, Tallal Elshabrawy, and Mohamed Ashour. 2019. Resource management using machine learning in mobile edge computing: A survey. In 2019 Ninth International Conference on Intelligent Computing and Information Systems. IEEE, 112–117. https://doi.org/10.1109/icicis46948.2019.9014733 [117] Sabah Zdanowska and Alex S Taylor. 2022. A study of UX practitioners roles in designing real-world, enterprise ML systems. In CHI Conference on Human Factors in Computing Systems. 1–15. [118] Amy X Zhang, Michael Muller, and Dakuo Wang. 2020. How do data science workers collaborate? Roles, workflows, and tools. Proceedings of the ACM on Human-Computer Interaction 4, CSCW1 (2020), 1–23. [119] Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun. 2018. Shufflenet: An extremely efficient convolutional neural network for mobile devices. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 6848–6856. https://doi.org/10.1109/cvpr.2018.00716 [120] Tianming Zhao, Yucheng Xie, Yan Wang, Jerry Cheng, Xiaonan Guo, Bin Hu, and Yingying Chen. 2022. A survey of deep learning on mobile devices: Applications, optimizations, challenges, and research opportunities. Proc. IEEE 110, 3 (2022), 334–354. https://doi.org/10.1109/jproc.2022.3153408 [121] Wayne Xin Zhao, Kun Zhou, Junyi Li, Tianyi Tang, Xiaolei Wang, Yupeng Hou, Yingqian Min, Beichen Zhang, Junjie Zhang, Zican Dong, et al. 2023. A survey of large language models. arXiv preprint arXiv:2303.18223 (2023). [122] Ce Zhou, Qian Li, Chen Li, Jun Yu, Yixin Liu, Guangjing Wang, Kai Zhang, Cheng Ji, Qiben Yan, Lifang He, et al. 2023. A comprehensive survey on pre- trained foundation models: A history from BERT to ChatGPT. arXiv preprint arXiv:2302.09419 (2023). [123] Zhi Zhou, Xu Chen, En Li, Liekang Zeng, Ke Luo, and Junshan Zhang. 2019. Edge intelligence: Paving the last mile of artificial intelligence with edge computing. Proc. IEEE 107, 8 (2019), 1738–1762. https://doi.org/10.1109/jproc.2019.2918951 [124] Mingjian Zhu, Kai Han, Enhua Wu, Qiulin Zhang, Ying Nie, Zhenzhong Lan, and Yunhe Wang. 2021. Dynamic resolution network. Advances in Neural Information Processing Systems 34 (2021), 27319–27330. arXiv:2106.02898 Fred Hohman, Mary Beth Kery, Donghao Ren, and Dominik Moritz A INTERVIEW QUESTIONS The list of questions prepared for each interview participant. Background ML Information Q1. What is your team? Q2. What is your role? Q3. How many years of ML experience do you have? Q4. How many years of efficient ML experience do you have? General Compression Questions Q5. Describe the overall use case for model compression in your work. What are your main motivations to use model compression? Why do you care about model compression? Q6. Model compression details: Q6.1 Which model compression techniques do you use, and why? Are there trade offs or preferences? Q6.2 Do you do compression as a final step or as a part of the training process? Q6.3 In your experience, are there any pitfalls people applying compression should be aware of? Q6.4 How did you figure out your budgets and how did you satisfy them? Q7. Do you compare compressed models against baseline models? If so, how, and what do you look for, e.g., power and performance, other metrics, or user experience changes? Compression Tooling Questions Q8. What tools or visualizations do you use in your compression work? Please be specific, e.g., specific charts, views, or metrics. How do you use these tools? Q9. What do you like about these tools? Q10. What features or future tools would help you conduct better model compression work?
http://arxiv.org/abs/2310.04617v1
"2023-10-06T22:37:34"
"2023-10-06T22:37:34"
SlotGNN: Unsupervised Discovery of Multi-Object Representations and Visual Dynamics
Learning multi-object dynamics from visual data using unsupervised techniques is challenging due to the need for robust, object representations that can be learned through robot interactions. This paper presents a novel framework with two new architectures: SlotTransport for discovering object representations from RGB images and SlotGNN for predicting their collective dynamics from RGB images and robot interactions. Our SlotTransport architecture is based on slot attention for unsupervised object discovery and uses a feature transport mechanism to maintain temporal alignment in object-centric representations. This enables the discovery of slots that consistently reflect the composition of multi-object scenes. These slots robustly bind to distinct objects, even under heavy occlusion or absence. Our SlotGNN, a novel unsupervised graph-based dynamics model, predicts the future state of multi-object scenes. SlotGNN learns a graph representation of the scene using the discovered slots from SlotTransport and performs relational and spatial reasoning to predict the future appearance of each slot conditioned on robot actions. We demonstrate the effectiveness of SlotTransport in learning object-centric features that accurately encode both visual and positional information. Further, we highlight the accuracy of SlotGNN in downstream robotic tasks, including challenging multi-object rearrangement and long-horizon prediction. Finally, our unsupervised approach proves effective in the real world. With only minimal additional data, our framework robustly predicts slots and their corresponding dynamics in real-world control tasks.
[ "Alireza Rezazadeh", "Athreyi Badithela", "Karthik Desingh", "Changhyun Choi" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04617v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04617v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.RO", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.RO", "cs.AI", "cs.CV", "cs.LG" ]
SlotGNN: Unsupervised Discovery of Multi-Object Representations and Visual Dynamics Alireza Rezazadeh1, Athreyi Badithela2, Karthik Desingh2∗, Changhyun Choi1∗ 3 2 0 2 t c O 6 ] O R . s c [ 1 v 7 1 6 4 0 . 0 1 3 2 : v i X r a Abstract-Learning multi-object dynamics from visual data using unsupervised techniques is challenging due to the need for robust, object representations that can be learned through robot interactions. This paper presents a novel framework with two new architectures: SlotTransport for discovering object rep- resentations from RGB images and SlotGNN for predicting their collective dynamics from RGB images and robot interactions. Our SlotTransport architecture is based on slot attention for unsupervised object discovery and uses a feature transport mech- anism to maintain temporal alignment in object-centric represen- tations. This enables the discovery of slots that consistently reflect the composition of multi-object scenes. These slots robustly bind to distinct objects, even under heavy occlusion or absence. Our SlotGNN, a novel unsupervised graph-based dynamics model, predicts the future state of multi-object scenes. SlotGNN learns a graph representation of the scene using the discovered slots from SlotTransport and performs relational and spatial reasoning to predict the future appearance of each slot conditioned on robot actions. We demonstrate the effectiveness of SlotTransport in learning object-centric features that accurately encode both information. Further, we highlight the visual and positional accuracy of SlotGNN in downstream robotic tasks, including challenging multi-object rearrangement and long-horizon predic- tion. Finally, our unsupervised approach proves effective in the real world. With only minimal additional data, our framework robustly predicts slots and their corresponding dynamics in real- world control tasks. Our project page: bit.ly/slotgnn. I. INTRODUCTION Studies suggest that the human visual system identifies con- ceptually distinct visual features, indexes their locations [1], and utilizes this information as the foundation for higher-level cognitive processes, such as comprehending and interacting effectively with the world [2]. A similar principle guides many robotic systems for goal-directed motor planning. In multi- object manipulation, early approaches aimed to directly project the image observation into a unified lower-dimensional space to infer the dynamics [3], [4]. However, such strategies do not reflect the inherent structure of a multi-object system and lack object-level predictions. This limitation not only impedes the model's ability to learn object interactions but also results in inaccurate dynamics predictions. Addressing this limitation, recent methods build dynamics models by decomposing the observation into object-specific lower-dimensional latents and subsequently learning dynamics within these "object-centric" representations [5], [6], [7], [8], [7]. For multi-object systems, 1 Department of Electrical and Computer Engineering, University of Minnesota, Minneapolis, MN 55414 USA (rezaz003@umn.edu, cchoi@umn.edu). 2 Department of Computer Science and Engineering, University of Minnesota, Minneapolis, MN 55414 USA (kdesingh@umn.edu, badit004@umn.edu). ∗ Equal contributions. Fig. 1. Overview of our unsupervised framework. (a) We introduce SlotTransport to identify temporally-aligned, object-centric slots, that each consistently represents a unique visual element. (b) We introduce SlotGNN, a graph-based model that learns scene dynamics from slots and predicts future states based on the robot's action. (c) Our unsupervised approach facilitates planning to transition from an initial state to a goal image without requiring extensive ground-truth supervision. recent studies emphasize the effectiveness of learning object- centric representations to enhance the accuracy and sample efficiency of dynamic models [5], [6]. This category of models follows a natural formulation by first learning to represent a scene as a set of object-centric features and then learning the dynamics among them. In robotics, unsupervised learning of object dynamics is a key challenge particularly given its significance in model- based action planning for real-world applications. Neverthe- less, the majority of existing methods of learning multi-object dynamics heavily rely on ground-truth information, including object pose [9], [10], [6] and segmentation masks [6], [5]. This substantially restricts the applicability of such solutions in real- world settings where comprehensive ground-truth information is often unavailable. To address this challenge, our work focuses on discovering unsupervised object representations in multi-object scenarios and harnessing these representations to understand their dynamics. Our primary contributions include: (1) We introduce SlotTransport for unsupervised object dis- covery, a novel architecture that refines object-centric rep- resentation learning through slot attention [11]. Utilizing a feature transport mechanism, SlotTransport ensures temporal alignment of the object-centric representations. The discovered slots capture scene composition, each depicting a visual entity in a multi-object scene, such as objects, the background, and the robot. Notably, each slot maintains a consistent association with a distinct object, even when it's occluded or absent. (2) We propose SlotGNN, a novel unsupervised graph-based model for predicting multi-object scene dynamics from object- centric representations. SlotGNN uses slots identified by Slot- Transport to synthesize the scene's future appearance based on the robot's actions. With the temporal alignment from t(a) Discovering Unsupervised Object Representations(b) Learning Dynamicsgoalinitial(c) Planning... Fig. 2. SlotTransport: Unsupervised Multi-Object Discovery. From an RGB image, fslot identifies object-centric slots z1:K . Through slot attention [11], slots bind to visual features, and fdec produces feature maps Φi and masks Mi. Temporal alignment is ensured by transporting slot features between source and target images. frec reconstructs each object slot Ri T , which together compose the target image. The model is trained using only reconstruction error. During inference, objects are reconstructed from a single image using learned slots. SlotTransport, the scene transforms into a graph where each node consistently represents a slot, and edges capture the slot interactions. SlotGNN performs relational reasoning on the graph and learns to project the future appearance of each slot. (3) We examine the dynamics learned with SlotGNN in challenging downstream robotic tasks. We employ SlotGNN for challenging goal-directed multi-object rearrangement using pushing actions and long-horizon dynamics prediction. (4) Demonstrating the real-world applications of our unsu- pervised approach, we successfully transfer SlotTransport and SlotGNN, initially trained in simulation, to the real robot by collecting a minimal dataset of just 20 real robot demonstra- tions (5% of the amount of simulated training data). Our results demonstrate the robustness of our unsupervised framework, particularly in downstream robotic applications and real-world scenarios. Our approach consistently predicts accurate multi-object representations and their corresponding dynamics. Throughout this paper, we will use the terms 'slots' and 'object-centric representations' interchangeably. Unsupervised Object-centric Representation: Our work builds on learning object-centric representations using slot attention [11]. Slot attention interfaces with visual outputs to generate a set of slots. For robotics applications, ensuring temporal consistency in these slots is vital for accurate scene dynamics understanding. This consistency is essential for formulating a planning objective or training loss. Thus, we explicitly incorporate a feature transport mechanism in our SlotTransport to maintain consistency across image pairs from different observation timesteps inspired by [17]. While slot attention has been recently adopted for object localization and behavior cloning [18], the experiments were limited to basic untextured objects and did not consider learning dynamics that is required for online planning. On another front, while keypoint-based methods such as [19] learned unsupervised multi-object dynamics, they face difficulties han- dling occlusions-a common challenge in robotics. In contrast, our SlotTransport reliably handles occlusions and consistently associates slots with specific objects. II. RELATED WORK III. METHODS Learning Multi-object Dynamics Model: Early models for graph-based dynamics, such as Interaction Networks (IN) [9], [10] and follow-up adaptations [12], [13], [14], represent a multi-object system with a graph where each node is an object ground-truth state (e.g., position, velocity, mass, friction). These models rely on explicit state information. However, for real-world robotic scenarios, obtaining ground-truth state data is infeasible. Recent methods explored learning object representations. Each object is mapped to a lower-dimensional, object-centric representation. The representations are typically a combination of explicit ground-truth states, like position, bounding box, and mask, combined with implicit visual fea- tures [15], [7], [16], [6], [5]. However, the primary assumption of the ground-truth state supervision limits their application in the real world. In contrast, our work introduces an unsu- pervised framework for learning multi-object scene dynamics based on discovering unsupervised slots. This eliminates the need for explicit ground-truth state supervision. Our framework has two main components: (1) SlotTransport: An unsupervised multi-object discovery model that efficiently extracts robust and temporally consistent object-centric representation slots from multi-object scenes. (2) SlotGNN: Building on top of the slot discovery, this unsupervised graph-based model learns the dynamics of the object-centric representations. Importantly, SlotGNN is condi- tioned on the robot's action which enables applications such as model-based action planning. A. SlotTransport: Unsupervised Multi-Object Discovery The SlotTransport's role is to map the image to underlying object-centric representations. A detailed architecture of Slot- Transport is shown in Fig. 2. We build on the slot attention [11] to extract slots from image frames while ensuring temporal alignment of the slots. Given an RGB image I, a convolutional encoder fenc augmented with positional embeddings, maps the image to an intermediate representation of W ∈ Rh×w×c. I!I"+Position Embeddingf#$%Slot-attn...z!"z#"Target Slots(K,d)W&M'(Φ'(M')Φ')......f*+,-M"#:%SlotTransport:TargetSourceΦ'←&0ΣR')R'(f*+,-...z(&z)&Source Slots(K,d)M&(Φ&(M&)Φ&)......M!#:%1−M&'$1−M('$Φ&'+M('$Φ('f2#%f2#%Target Slots Features and Masksf3#%i=Ki=KPer-slot Reconstruction(H×W×3)4I"Target(H×W×3)Source Slots Features and MasksShared WeightsShared Weights Fig. 3. SlotGNN: Unsupervised Multi-Object Dynamics. (a) SlotGNN predicts slot changes ∆zt i after applying a pushing action at. Using SlotTransport's slots (fslot), a graph Gt is formed with slots as nodes and slot interactions as edges. Edges and nodes are updated via fedge and fnode, resulting in next . The next image ˆIt+1 is then reconstructed. (b) With a sequence of robot actions, SlotGNN projects future multi-object dynamics and timestep slots zt+1 synthesizes future scenes. (c) SlotGNN also facilitates goal-directed planning to optimize actions towards a desired goal. i Using the slot attention [11], slots z1:K ∈ Rd are derived that uniquely represent distinct portions of W. We recognize that our ultimate goal of learning dynamics in an object-centric latent space requires temporal consistency of the slots. To explicitly enforce this, we introduce the transport mechanism in SlotTransport to establish temporal alignment in slots. Inspired by [17], this mechanism transports slot features between a pair of source and target images (IS, IT ) sampled from a given scene. 1:K, zT T ) * (1 − Mi For each image, slots are extracted as (zS 1:K). First, using a single convolutional decoder fdec, we decode each T ) ∈ Rh×w×m and an alpha S , Φ1:K slot into a feature map (Φ1:K T ) ∈ Rh×w. These alpha masks serve as S , M1:K mask (M1:K mixture weights to inpaint each slot's feature map from the target image onto the source image (see Fig. 2). We produce a transported feature map ΦT ←S by nullifying the source feature map outside the slot's predicted mask for both the target and S) * Φi source (1 − Mi S, followed by overlaying the T .Φi masked target feature map Mi T . Finally, a convolutional reconstruction module frec reconstructs each slot as an RGB T ∈ Rh×w×3 based on the transported feature map. image Ri The reconstructed slots together reconstructed target image ˆIT . The transport mechanism in SlotTransport enforces tempo- ral alignment between image pairs during training. Notably, the learned slots through SlotTransport consistently register to a unique object even under heavy occlusion or absence of an object. During inference, SlotTransport can discover and reconstruct slots from a single image by directly reconstruct- ing the extracted per-slot features and masks. SlotTransport ensures that each slot's feature map aligns well with its mask for learning consistent object representation across time. Im- portantly, this temporal alignment is achieved without adding additional learnable parameters; the same fslot and fdec are used when processing both source and target images. B. SlotGNN: Unsupervised Multi-Object Dynamics The main purpose of SlotGNN is to learn the dynamics and model interactions between the visual elements in a multi- object scene, such as the robot, objects, and the background. It does so using a graph-based representation, where each object- centric slot corresponds to a node in the graph. Crucially, SlotGNN enables learning unsupervised multi-object dynam- ics, eliminating the need for supervised trajectory labels that require access to the system's ground-truth state. This feature becomes essential in real-world scenarios where obtaining accurate ground-truth data is challenging or impractical. Refer to the detailed architecture illustrated in Fig. 3-a. Given an image It with its associated slots zt 1:K discovered through SlotTransport, we construct a fully connected graph Gt = (V, E). Each node vi ∈ V in the graph represents a slot, and each edge eij ∈ E represents the interaction between the pair of slots zi, zj. For each node, we associate an embedding ni which is initialized with the slot representations zi. The edge embeddings, representing interactions, are initialized based on augmenting the connected slots representations. To process the information in the graph representation, SlotGNN employs a message-passing neural network architecture [20], [10] to update node and edge embeddings. Incoming infor- mation from neighboring nodes is aggregated to update each node's state, capturing the dynamics and interactions in the scene. The message-passing operation in the graph consists of two primary steps (see 3). First, the edge embeddings, eij, are updated based on their connecting node embeddings: e′ ij ← fedge(eij, ni, nj). Secondly, the node embeddings are updated using the updated edge embeddings associated with them and k ← fnode(nk, (cid:80) the robot action: n′ ik, at). Here, fedge and fnode are multi-layer perception update functions for edges and nodes, respectively. N (k) denotes the neighbors of node k, which in the context of a fully connected graph is all other nodes. To condition on external action, the robot action at ∈ R4, characterized as a point-to-point push vector in image coordinates, is integrated as an input to fnode in SlotGNN. This ensures the learned dynamics are conditioned on the robot's action and can be used for planning in the downstream robotics control task. i∈N (k) e′ Current ImageSlots tI!...z"!z#!...e"#!ijf&'(&Σf*+'&...Δ̂z,-Δ̂z.-f/01-edge embedge updateaggregatenode update2M!$%%2Φ!$%%2M!$%&2Φ!$%&......2M!$%%:&...̂z,-5,̂z.-5,Future Slots t+1f678a!9I!$%Per-slot Feature and MaskR!$%&R!$%%f;78ΣPer-slot ReconstructionAction-Conditioned Future ReconSlotGNN...z,<z.<Slots ta"...̂z,-5,̂z.-5,Slots t+1a#......̂z,-5=̂z.-5=Slots t+hSlotGNNa$%#(b) Long-horizon Rollout...z,-z.-Slots ta!∗...̂z,-5,̂z.-5,Slots t+1......̂z,(̂z.(Goal Slots t+ha!'$%#∗(c) Control...̂z,-5=̂z.-5=Slots t+hL(a)G!...z,-z.-SlotGNNSlotGNNSlotGNNSlotGNN Fig. 4. Visualizations of per-slot masks and reconstructions. SlotTransport exhibits superior performance in accuracy and consistency of object-centric representation, even under occlusion, compared to the SlotAttention baseline [11]. We also showcase predicted segments from SAM [21]. After message-passing, the updated node embeddings are the evolution of slots ∆ˆzt+1 used to predict in the next timestep conditioned on the action at. This allows for the roll- out of the dynamics into the future and enables synthesizing the future appearance of the scene. i C. Training SlotTransport and SlotGNN SlotTransport is trained using only the image reconstruc- tion error for supervision. The image reconstruction loss Lrec(IT , ˆIT ), is defined using a pixel-wise Mean Squared Error (MSE) between the target and reconstructed images. In Fig. 2, modules with learnable parameters are distinctly highlighted in blue. Once SlotTransport is trained, it supervises the training of SlotGNN to learn visual dynamics. 1:K , ˆzt+1 We use a slot prediction MSE loss to train SlotGNN, Lslot(zt+1 1:K ). This loss reduces the distance between the slots directly predicted from the next timestep image using SlotTransport zt+1 1:K and slots from the single-step dynamics with SlotGNN ˆzt+1 1:K , as visualized in Fig. 3-a (modules with leanable parameters are highlighted in blue). Importantly, em- ploying a per-slot prediction loss requires temporal alignment that is ensured through SlotTransport. Furthermore, we use the single-step slot dynamics to reconstruct the image and also minimize the image reconstruction MSE loss Lrec(It+1, ˆIt+1). D. Long-Horizon Multi-Object Dynamics Rollout Given only an initial image frame I0 and a sequence of robot pushing actions a0:h, SlotGNN can predict ˆI1:h by recurrently running on the previous step's prediction. As shown in Fig. the single-step dynamics predictions are cascaded to 3-b, predict slots over extended future horizons. This capability for accurate dynamics rollout is possible due to the temporal alignment achieved with SlotTransport. Furthermore, for any arbitrary future timestep, frec can synthesize an image of the scene from the predicted slots. E. Goal-Directed Planning Learning the scene dynamics facilitates goal-directed se- quential action planning for multi-object manipulation. As shown in Fig. 3-c, with SlotGNN, we optimize robot actions to align a scene's state with a target goal image. This is Fig. 5. Examples of single-step dynamics prediction using SlotGNN. Given the current scene image and the robot's pushing action, our model precisely predicts the future state of each slot and synthesizes the future scene image. pivotal when the robot interacts with several objects to reach a desired state. Given a scene image, we sample possible action sequences over a planning horizon h ≥ 1 and forecast the slot representation ˆzt+h 1:K by rolling the dynamics. Using Model- predictive control (MPC) [22], the optimal action sequence is chosen by minimizing the slot loss Lslot(zT 1:K), which quantifies the variance between predicted slots and the goal image slots. 1:K, zG IV. EXPERIMENTS We structure our experiments around: (1) How accurately and consistently do slots extracted by SlotTransport represent each visual element in the scene? (2) How effective is Slot- GNN in predicting multi-object scene dynamics? (3) How well does our framework apply to downstream robotic tasks? A. Data Simulation: Using Mujoco [23], [24], we simulate a multi- object tabletop scene with YCB objects [25] and a UR5e robot with a cylindrical end-effector. The robot performs planar pushing action, captured by an RGB camera. The data is formatted as image-action tuples (It, at, It+1) containing pre- and post-action images, and action vectors in the image coordinates. We generate ∼ 750 episodes ×20 steps of random pushes for a given subset of objects. SlotTransport is trained by randomly sampling target and source images across all episodes. We then use the learned SlotTransport to discover slots and train SlotGNN on the image-action tuples. Evalua- tions on SlotTransport are done with five objects using images from a top-view camera. Experiments involving single-step dynamics, long-horizon predictions, and object rearrangements are on scenes with three objects with an angled camera. Real-world: We use a UR5e robot with a custom-printed cylindrical end-effector and an RGB camera. We collect data ∼ 20 episodes ×40 steps of random pushes for subsets of 3 real YCB objects. Models trained in the simulation for the same object subset are retrained on this real-world data. B. Baselines We evaluate our approach against various methods: Object Discovery: Our SlotTransport, is compared with the original slot attention approach [11]. We follow the implemen- tation of this baseline by excluding the transport mechanism introduced in our SlotTransport during training. Furthermore, we compare our approach with the off-the-shelf SAM [21]. SlotTransport (Ours)SlotAttentionSAMImage (GT)ReconPred MasksPred SlotsReconI!,#I!"#SlotsPredGTI!,I!"# TABLE I Object discovery performance measured as visual quality (MSE and LPIPS) and mask consistency (mIoU) (MSE and LPIPS values are scaled ×10−2). Method MSE ↓ LPIPS ↓ mIoU (%) ↑ SlotTransport (Ours) SlotAttention [11] SAM [21] 0.17 ± 0.06 0.43 ± 0.17 N.A. 1.29 ± 0.46 4.79 ± 0.32 N.A. 93.4 ± 0.7 50.5 ± 16.2 86.9 ± 8.5 TABLE II Single-step dynamics prediction accuracy measured as visual quality (MSE) and mask consistency (mIoU). Method Supervision MSE ↓ mIoU (%) ↑ SlotGNN (Ours) SlotMLP KINet [19] ForwGNN [6] Img Img Img GT State 0.14 ± 0.05 0.32 ± 0.09 1.86 ± 0.09 0.50 ± 0.14 86.9 ± 2.9 72.6 ± 1.1 N.A. N.A. identifies all distinct visual elements, and predicts an accurate mask for each-even under heavy occlusion. However, as seen in Fig. 4, the SlotAttention baseline overlooks the spam object occluded by the power drill. Moreover, SlotTransport delineates clear boundaries for each slot and accurately recon- structs their appearance. In contrast, the SlotAttention baseline presents indistinct, blurred object masks and reconstructions. We further show that relying on off-the-shelf segmentation methods, such as SAM [21], is not optimal for learning object representations. This is primarily due to SAM's tendency to over-segment textured objects (e.g., backgrounds) and under- segment cluttered objects. Table I summarizes the quantitative evaluation of both the visual quality of reconstructed slots and the precision of slot masks. SlotTransport distinctly outperforms the SlotAttention baseline by achieving significantly better visual fidelity, mea- sured in MSE and LPIPS. Furthermore, object masks produced by SlotTransport demonstrate superior alignment with ground- truth masks derived from simulated data. In contrast, SlotAt- tention often struggles to align slots accurately to cluttered objects, as shown in Fig 4. This limitation is evident in the lower mIoU for SlotAttention compared to SlotTransport. B. Dynamics Prediction Performance the current Figure 5 illustrates the single-step dynamics prediction of SlotGNN. By taking as input image and the intended robot's pushing action vector, our model accurately predicts the future scene. It does so by predicting the future state of each slot, based on the learned multi-object dynamics of the scene. The quantitative results presented in Table II highlight the accuracy of SlotGNN in single-step dynamics prediction. In single-step dynamics prediction, SlotGNN out- performs all other baselines, including the SlotMLP variant and the unsupervised keypoint dynamics KINet [19]. It's worth noting that while ForwGNN does rely on ground-truth state information for supervision, it still falls short in MSE com- pared to SlotGNN, which utilizes image-based supervision. This further highlights the robustness of the detected slots Fig. 6. Long-horizon slot dynamics prediction: SlotGNN has more stability compared to SlotMLP. We also show keypoints detected with KINet [19]. Fig. 7. (a) Long-horizon dynamics rollout error. SlotGNN exhibits robust dy- namics predictions as the timestep increases. (b) Planning results: Comparing the distance to the goal image between SlotGNN and SlotMLP. Fig. 8. Qualitative results on control. Each row shows the action sequence (highlighted in green) optimized to maximize scene similarity to goal image. Multi-Object Dynamics: For action-conditioned graph-based dynamics, we consider ForwGNN [6], which uses supervision of ground-truth object masks. The scene graph's nodes are embedded with the ground-truth object positions and masks to directly reconstruct the future image. We also compare with KINet [19], an unsupervised model that determines dynamics by identifying a set of keypoints from the scene image. Lastly, we compare with the SlotMLP variant. While it utilizes slots from SlotTransport, it models dynamics with MLPs rather than the graph-based approach of SlotGNN. Evaluation Metrics: We compute pixel-wise mean squared error (MSE) and Learned Perceptual Image Patch Similarity (LPIPS) [26] to measure the accuracy of the slots in recon- structing the scene composition. Additionally, to quantify the quality and consistency of the slot masks, we compute the mean Intersection over Union (IoU) for slot masks produced by SlotTransport, SlotAttention, and SAM, comparing them against the ground-truth masks from simulation. A. Object Discovery Performance V. RESULTS Figure 4 showcases the slot masks and slot reconstructions. In a scene with five objects, SlotTransport qualitatively outper- forms the SlotAttention baseline [11]. SlotTransport accurately GTSlotGNN (Ours)SlotMLPKINett = 0t = 1t = 15t = 35(a)(b)initialgoalt = 1t = T Fig. 9. Real-world control using SlotTransport and SlotGNN: The top row shows objects being rearranged to align with a goal image. In the bottom row, objects are persistently displaced from their goal positions, the robot comes up with a sequence of actions to push the objects back to their desired locations. Please visit our project page for videos and more examples: bit.ly/slotgnn. are compared in Fig. 7 which emphasizes the effectiveness of a graph-based model in learning object-centric dynamics. D. Real-World Experiments Demonstrating the real-world applicability of our unsuper- vised approach, we successfully transfer SlotTransport and SlotGNN, initially trained in simulation, to the real robot by collecting a minimal dataset of just 20 real robot demonstra- tions (5% of the amount of simulated training data). SlotTrans- port retains its accuracy in the real environment as shown in Fig 10. The slots discovered from the real mutli-object scene, clearly distinguish all the scene elements even under occlusion. For the real-world control, we experiment with two tasks as shown in Fig. 9. The first scenario, presented in the top row, involves rearranging objects to achieve a predetermined goal image. The bottom row showcases a more dynamic scenario where objects are continuously displaced from their target positions by a human with a grabber stick. In response, our robot, using SlotTransport and SlotGNN, finds a sequence of actions to restore the objects to their intended locations. VI. CONCLUSION This work addresses the challenges of unsupervised learning for multi-object dynamics through visual observations. We present SlotTransport, a novel approach based on slot attention for unsupervised object discovery, ensuring temporal consis- tency in object-centric representations. Alongside this, we introduce SlotGNN, an unsupervised graph-based dynamics model for predicting the future states of multi-object scenes using the slots. Both methods have proven effective in complex robotic control tasks and long-horizon dynamics prediction. Importantly, we demonstrate that our unsupervised approach, using SlotTransport and SlotGNN, successfully transfers to real-world settings and enables object discovery and dynamic modeling solely from RGB images. For limitations, one key aspect we recognize is that our slot discovery process currently necessitates pre-determining the number of slots. In our exper- iments, we predefined the slot count equal to the anticipated number of elements in the scene. Developing a more adaptive mechanism that automatically determines the required slot count could be a promising future research direction. Fig. 10. Real-world object slot discovery with SlotTransport. Our unsuper- vised framework transfers to real settings and discovers accurate object-centric representations that reflect the positional and visual features of the objects. in SlotTransport in representing objects enabling SlotGNN to learn accurate multi-object dynamics. As illustrated in Fig. 6, SlotGNN excels in predicting stable long-horizon dynamics compared with SlotMLP. Al- though the scenes reconstructed with SlotGNN may diverge from the ground-truth due to cumulative prediction errors, it yields physically plausible future scenes. In contrast, SlotMLP struggles to retain the coherence slots over time. Given that both SlotGNN and SlotMLP use slots by SlotTransport, the difference in their long-horizon predictions can be attributed to the graph-based model's enhanced ability to capture multi- object dynamics. In Fig. 6, unsupervised keypoints detected by KINet [19] are also shown. KINet requires stable keypoint- object correspondences to learn multi-object dynamics. This stability is compromised when a robot enters or exits the frame or introduces object occlusions (see the pink keypoint in the last column of Fig. 6). A quantitative summary of the long- horizon rollout outcomes can be found in Fig. 7-a. C. Planning with SlotGNN Fig. 8 shows our method's application in control tasks. In a challenging object rearrangement scenario, the robot plans an action sequence using SlotTransport and SlotGNN. Through accurate multi-object dynamics projections, the robot effec- tively aligns objects to a desired configuration using just the RGB image. The planning performance of slot-based models initialgoalt = 1t = Tgoalt = 1t = TDiscovered SlotsPred MasksImage [18] N. Heravi, A. Wahid, C. Lynch, P. Florence, T. Armstrong, J. Tomp- son, P. Sermanet, J. Bohg, and D. Dwibedi, "Visuomotor control in multi-object scenes using object-aware representations," in 2023 IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2023, pp. 9515–9522. [19] A. Rezazadeh and C. Choi, "Kinet: Unsupervised forward models for robotic pushing manipulation," IEEE Robotics and Automation Letters, 2023. [20] J. Gilmer, S. S. Schoenholz, P. F. Riley, O. Vinyals, and G. E. Dahl, "Neural message passing for quantum chemistry," in International conference on machine learning. PMLR, 2017, pp. 1263–1272. [21] A. Kirillov, E. Mintun, N. Ravi, H. Mao, C. Rolland, L. Gustafson, T. Xiao, S. Whitehead, A. C. Berg, W.-Y. Lo et al., "Segment anything," arXiv preprint arXiv:2304.02643, 2023. [22] E. Camacho and C. Alba, Model Predictive Control, ser. Advanced Textbooks in Control and Signal Processing. Springer London, 2013. [23] E. Todorov, T. Erez, and Y. Tassa, "Mujoco: A physics engine for model-based control," in 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems. IEEE, 2012, pp. 5026–5033. [24] Y. Zhu, J. Wong, A. Mandlekar, R. Mart ́ın-Mart ́ın, A. Joshi, S. Nasiriany, and Y. Zhu, "robosuite: A modular simulation framework and benchmark for robot learning," in arXiv preprint arXiv:2009.12293, 2020. [25] B. Calli, A. Singh, A. Walsman, S. Srinivasa, P. Abbeel, and A. M. Dollar, "The ycb object and model set: Towards common benchmarks for manipulation research," in 2015 international conference on advanced robotics (ICAR). IEEE, 2015, pp. 510–517. [26] R. Zhang, P. Isola, A. A. Efros, E. Shechtman, and O. Wang, "The unreasonable effectiveness of deep features as a perceptual metric," in Proceedings of the IEEE conference on computer vision and pattern recognition, 2018, pp. 586–595. VII. ACKNOWLEDGEMENT We thank Carl Winge for the help with the robot setup, Chahyon Ku for providing helpful feedback on our initial draft, and all other members of the Robotics Perception and Manipulation Lab for their insightful discussions. This project is partially funded by the UROP Program at the University of Minnesota and the MnDRIVE UMII (University of Minnesota Informatics Institute) Seed Award. This project was also supported in part by the Sony Research Award Program and NSF Award 2143730 REFERENCES [1] Z. Pylyshyn, "The role of location indexes in spatial perception: A sketch of the finst spatial-index model," Cognition, vol. 32, no. 1, pp. 65–97, 1989. [2] D. Marr, Vision: A computational investigation into the human repre- sentation and processing of visual information. MIT press, 2010. [3] C. Finn and S. Levine, "Deep visual foresight for planning robot motion," in 2017 IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2017, pp. 2786–2793. [4] P. Agrawal, A. Nair, P. Abbeel, J. Malik, and S. Levine, "Learning to poke by poking: Experiential learning of intuitive physics," arXiv preprint arXiv:1606.07419, 2016. [5] D. Driess, Z. Huang, Y. Li, R. Tedrake, and M. Toussaint, "Learning multi-object dynamics with compositional neural radiance fields," in Conference on Robot Learning. PMLR, 2023, pp. 1755–1768. [6] Y. Ye, D. Gandhi, A. Gupta, and S. Tulsiani, "Object-centric forward modeling for model predictive control," in Conference on Robot Learn- ing. PMLR, 2020, pp. 100–109. [7] H. Qi, X. Wang, D. Pathak, Y. Ma, and J. Malik, "Learning long- term visual dynamics with region proposal interaction networks," arXiv preprint arXiv:2008.02265, 2020. [8] M. Minderer, C. Sun, R. Villegas, F. Cole, K. Murphy, and H. Lee, "Unsupervised learning of object structure and dynamics from videos," arXiv preprint arXiv:1906.07889, 2019. [9] P. W. Battaglia, R. Pascanu, M. Lai, D. Rezende, and K. Kavukcuoglu, "Interaction networks for learning about objects, relations and physics," arXiv preprint arXiv:1612.00222, 2016. [10] A. Sanchez-Gonzalez, N. Heess, J. T. Springenberg, J. Merel, M. Ried- miller, R. Hadsell, and P. Battaglia, "Graph networks as learnable physics engines for inference and control," in International Conference on Machine Learning. PMLR, 2018, pp. 4470–4479. [11] F. Locatello, D. Weissenborn, T. Unterthiner, A. Mahendran, G. Heigold, J. Uszkoreit, A. Dosovitskiy, and T. Kipf, "Object-centric learning with slot attention," Advances in Neural Information Processing Systems, vol. 33, pp. 11 525–11 538, 2020. [12] T. Kipf, E. Fetaya, K.-C. Wang, M. Welling, and R. Zemel, "Neural relational inference for interacting systems," in International Conference on Machine Learning. PMLR, 2018, pp. 2688–2697. [13] Y. Li, J. Wu, J.-Y. Zhu, J. B. Tenenbaum, A. Torralba, and R. Tedrake, "Propagation networks for model-based control under partial observa- tion," in ICRA, 2019. [14] A. Sanchez-Gonzalez, J. Godwin, T. Pfaff, R. Ying, J. Leskovec, and P. Battaglia, "Learning to simulate complex physics with graph networks," in International conference on machine learning. PMLR, 2020, pp. 8459–8468. [15] W. Yuan, C. Paxton, K. Desingh, and D. Fox, "Sornet: Spatial object- centric representations for sequential manipulation," in Conference on Robot Learning. PMLR, 2022, pp. 148–157. [16] N. Watters, D. Zoran, T. Weber, P. Battaglia, R. Pascanu, and A. Tac- chetti, "Visual interaction networks: Learning a physics simulator from video," Advances in neural information processing systems, vol. 30, pp. 4539–4547, 2017. [17] T. Kulkarni, A. Gupta, C. Ionescu, S. Borgeaud, M. Reynolds, A. Zis- serman, and V. Mnih, "Unsupervised learning of object keypoints for perception and control," arXiv preprint arXiv:1906.11883, 2019.
http://arxiv.org/abs/2310.04612v1
"2023-10-06T22:07:49"
"2023-10-06T22:07:49"
A Topological Perspective on Demystifying GNN-Based Link Prediction Performance
Graph Neural Networks (GNNs) have shown great promise in learning node embeddings for link prediction (LP). While numerous studies aim to improve the overall LP performance of GNNs, none have explored its varying performance across different nodes and its underlying reasons. To this end, we aim to demystify which nodes will perform better from the perspective of their local topology. Despite the widespread belief that low-degree nodes exhibit poorer LP performance, our empirical findings provide nuances to this viewpoint and prompt us to propose a better metric, Topological Concentration (TC), based on the intersection of the local subgraph of each node with the ones of its neighbors. We empirically demonstrate that TC has a higher correlation with LP performance than other node-level topological metrics like degree and subgraph density, offering a better way to identify low-performing nodes than using cold-start. With TC, we discover a novel topological distribution shift issue in which newly joined neighbors of a node tend to become less interactive with that node's existing neighbors, compromising the generalizability of node embeddings for LP at testing time. To make the computation of TC scalable, We further propose Approximated Topological Concentration (ATC) and theoretically/empirically justify its efficacy in approximating TC and reducing the computation complexity. Given the positive correlation between node TC and its LP performance, we explore the potential of boosting LP performance via enhancing TC by re-weighting edges in the message-passing and discuss its effectiveness with limitations. Our code is publicly available at https://github.com/YuWVandy/Topo_LP_GNN.
[ "Yu Wang", "Tong Zhao", "Yuying Zhao", "Yunchao Liu", "Xueqi Cheng", "Neil Shah", "Tyler Derr" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04612v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04612v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.SI" ]
3 2 0 2 t c O 6 ] G L . s c [ 1 v 2 1 6 4 0 . 0 1 3 2 : v i X r a Preprint A TOPOLOGICAL PERSPECTIVE ON DEMYSTIFYING GNN-BASED LINK PREDICTION PERFORMANCE Yu Wang1, Tong Zhao2, Yuying Zhao1, Yunchao Liu1, Xueqi Cheng1, Neil Shah2, Tyler Derr1 1Vanderbilt University {yu.wang.1,yuying.zhao,yunchao.liu,xueqi.cheng,tyler.derr}@vanderbilt.edu {tzhao,nshah}@snap.com 2Snap Inc. ABSTRACT Graph Neural Networks (GNNs) have shown great promise in learning node em- beddings for link prediction (LP). While numerous studies aim to improve the overall LP performance of GNNs, none have explored its varying performance across different nodes and its underlying reasons. To this end, we aim to demys- tify which nodes will perform better from the perspective of their local topology. Despite the widespread belief that low-degree nodes exhibit poorer LP perfor- mance, our empirical findings provide nuances to this viewpoint and prompt us to propose a better metric, Topological Concentration (TC), based on the intersec- tion of the local subgraph of each node with the ones of its neighbors. We empiri- cally demonstrate that TC has a higher correlation with LP performance than other node-level topological metrics like degree and subgraph density, offering a better way to identify low-performing nodes than using cold-start. With TC, we discover a novel topological distribution shift issue in which newly joined neighbors of a node tend to become less interactive with that node's existing neighbors, compro- mising the generalizability of node embeddings for LP at testing time. To make the computation of TC scalable, We further propose Approximated Topological Con- centration (ATC) and theoretically/empirically justify its efficacy in approximat- ing TC and reducing the computation complexity. Given the positive correlation between node TC and its LP performance, we explore the potential of boosting LP performance via enhancing TC by re-weighting edges in the message-passing and discuss its effectiveness with limitations. Our code is publicly available at https://github.com/YuWVandy/Topo_LP_GNN. 1 INTRODUCTION Recent years have witnessed unprecedented success in applying link prediction (LP) in real-world applications (Tian et al., 2022; Rozemberczki et al., 2022). Compared with heuristic-based (Liben- Nowell & Kleinberg, 2003) and shallow embedding-based LP approaches (Grover & Leskovec, 2016), GNN-based ones (Zhang & Chen, 2018; Chamberlain et al., 2022) have achieved state-of- the-art (SOTA) performance; these methods first learn node/subgraph embeddings by applying linear transformations with message-passing and a decoder/pooling layer to predict link scores/subgraph class. While existing works are dedicated to boosting overall LP performance by more expressive message-passing or data augmentation, it is heavily under-explored whether different nodes within a graph would obtain embeddings of different quality and have varying LP performance. Previous works have explored GNNs' varying performance across nodes, considering factors like local topology (e.g., degree and homophily/heterophily) (Tang et al., 2020; Mao et al., 2023), feature quality (Taguchi et al., 2021), and class quantity (Zhao et al., 2021a). While these studies have provided significant insights, their focus has primarily remained on node/graph-level tasks, leaving the realm of LP unexplored. A more profound examination of the node-varying LP performance can enhance our comprehension of network dynamics (Liben-Nowell & Kleinberg, 2003), facilitate the timely detection of nodes with ill-topology (Lika et al., 2014), and pave the way for customized data- driven strategies to elevate specific nodes' LP performance. Recognizing the criticality of studying the node-varying LP performance and the apparent gap in the existing literature, we ask: Can we propose a metric that measures GNNs' varying LP performance across different nodes? 1 Preprint Figure 1: Average LP performance of nodes across different degree groups based on DegreeTr(i.e., node degree by training edges) on Collab/Citation2. In (a)-(b), Performance@10 does not increase as the node degree increases. In (c)-(d), cold-start (few/lower-degree) nodes do not perform worse than their higher-degree counterparts. Detailed experimental setting is included in Appendix E To answer a related question in the node classification task, prior works observed that GNNs perform better on high-degree nodes than low-degree nodes (Tang et al., 2020; Liu et al., 2021). Similarly, the persistent cold-start issue in the general LP domain and recommender systems (Leroy et al., 2010; Hao et al., 2021; Li et al., 2021) indicates that nodes with zero-to-low degrees lag behind their high- degree counterparts. However, as surprisingly shown in Figure 1(a)-(b), GNN-based LP on these two large-scale social networks does not exhibit a consistent performance trend as the node degree increases. For example, the performance@10 on Collab under all evaluation metrics decreases as the node degree increases, while on Citation2, performance@10 first increases and then decreases. This counter-intuitive observation indicates the weak correlation between the node degree and LP performance, which motivates us to design a more correlated metric to answer the above question. Following (Zhang & Chen, 2018) that the link formation between each pair of nodes depends on the interaction between their local subgraphs, we probe the relation between the local subgraphs around each node (i.e., its computation tree) and its GNN-based LP performance. Specifically, we propose Topological Concentration (TC) and its scalable version, Approximated Topological Concentration (ATC), to measure the topological interaction between the local subgraph of each node and the local subgraphs of the neighbors of that node. Our empirical observations show that TC offers a superior characterization of node LP performance in GNNs, leading to 82.10% more correlation with LP performance and roughly 200% increase in the performance gap between the identified under-performed nodes and their counterparts than degree. Moreover, with TC, we discover a novel topological distribution shift (TDS) in which newly joined neighbors of a node tend to become less interactive with that node's existing neighbors. This TDS would compromise the generalizability of the learned node embeddings in LP at the testing time. Given the closer correlation between TC and LP performance, we reweigh the edges in message-passing to enhance TC and discuss its efficacy/limitations in boosting LP performance. Our contributions are summarized as follows: • We propose Topological Concentration (TC) and demonstrate it leads to 82.10% more correlation with LP performance and roughly 200% increase in the performance gap between the identified under-performed nodes and their counterparts than node degree, shedding new insights on cold- start issues. We further propose Approximated Topological Concentration (ATC) and demonstrate it maintains high correlations to the LP performance similar to TC while significantly reducing the computation complexity. • We uncover a novel Topological Distribution Shift (TDS) issue according to TC and demonstrate its negative impact at the node/graph level for link prediction at the testing time. Moreover, we discover that different nodes within the same graph can have varying amounts of TDS. • We design a TC inspired message-passing where a node aggregates more from neighbors who are better connected within its computational tree, which can enhance the node's weighted TC. We observe this empirically boosts LP performance and lastly discuss its noncausal limitations. 2 Preprint 2 RELATED WORK Varying Performance of GNNs on Node/Graph Classification. GNNs' efficacy in classifica- tion differs across nodes/graphs with varying label quantity (e.g., imbalanced node/graph classifica- tion (Zhao et al., 2021a; Wang et al., 2022)) and varying topology quality (e.g., long-tailed (Tang et al., 2020; Liu et al., 2021)/heterophily node classification (Zhu et al., 2020; Mao et al., 2023)). To enhance GNNs' performance for the disadvantaged nodes/graphs in these two varying conditions, previous works either apply data augmentations to derive additional supervision (Wang et al., 2021; Zhao et al., 2022) or design expressive graph convolutions to mitigate structural bias (Zhu et al., 2021). However, none of them tackle the varying performance of nodes in LP. We fill this gap by studying the relationship between node LP performance and its local topology. GNN-based LP and Node-Centric Evaluation. GNN-based LP works by first learning node em- beddings/subgraph embeddings through linear transformation and message-passing, and then ap- plying the scoring function to predict link probability/subgraph class (Zhang & Chen, 2018; Shiao et al., 2022; Guo et al., 2023; Dong et al., 2022). It has achieved new SOTA performance owing to using the neural network to extract task-related information and the message-passing to encode the topological properties (e.g., common neighbors) (Yun et al., 2021; Chamberlain et al., 2022). Existing GNN-based LP baselines evaluate performance by computing the average rank of each link against the randomly sampled negative links (Hu et al., 2020). However, because these sam- pled negative links only count a tiny portion of the quadratic node pairs, this evaluation contains positional bias (Li et al., 2023). In view of this issue, we leverage the node-centric evaluation met- rics (Precision/F1/NDCG/Recall/HitsN @K) that are frequently used in recommender systems (Gori et al., 2007; He et al., 2020) and rank each node against all other nodes in predicting the incoming neighbors. Detailed definitions of these evaluation metrics are provided in Appendix B. Varying Performance of GNNs on LP. Although no efforts have been investigated into the node- varying performance in GNN-based LP, prior work has studied the underlying causes for varying performance in the general LP setting. For example, the cold-start issue (Leroy et al., 2010; Hao et al., 2020; Li et al., 2021; Hao et al., 2021) is a long-standing problem that newly landed entities with insufficient interactions (nodes with few-to-no degrees) tend to have lower LP performance. However, this problem is investigated solely from the conventional LP approaches that are different from GNNs, and Figure 1(c)-(d) has already raised concern over the validity of this claim. Only two previous studies in recommender systems (Li et al., 2021; Rahmani et al., 2022) have investigated the relationship of node LP performance with its degree, and both claimed that users/nodes with higher activity levels/degrees tend to possess better recommendation performance than their less active counterparts. However, we follow (Wang & Derr, 2022) and theoretically discover that some node-centric evaluation metrics have degree-related bias in Appendix C.2, implying that the GNNs' varying LP performance could be partially attributed to the choice of evaluation metrics. To mitigate this bias, we employ a full spectrum of evaluation metrics and find that degree is not so correlated with the node LP performance. This motivates us to devise a better topological metric than degree. 3 TOPOLOGICAL CONCENTRATION 3.1 NOTATIONS Let G = (V, E, X) be an attributed graph, where V = {vi}n i=1 is the set of n nodes (i.e., n = |V|) and E ⊆ V × V is the set of m observed training edges (i.e., m = |E|) with eij denoting the edge between the node vi and vj, and X ∈ Rn×d represents the node feature matrix. The observed adjacency matrix of the graph is denoted as A ∈ {0, 1}n×n with Aij = 1 if an observed edge exists between node vi and vj and Aij = 0 otherwise. The diagonal matrix of node degree is notated as D ∈ Zn×n with the degree of node vi being di = Dii = (cid:80)n j=1 Aij. For the LP task, edges are usually divided into three groups notated as T = {Tr, Val, Te}, i.e., training, validation, and testing sets, respectively. We denote N t i , t ∈ T as node vi's 1-hop neighbors according to edge group t. Furthermore, we denote the set of nodes that have at least one path of length k to node i based on observed training edges as Hk is not necessarily empty since neighbors that are k1-hops away from vi could also have paths of length k2 reaching vi. We collect vi's neighbors at all different hops away until K to form the K-hop computation tree centered on vi as S K k=1. We summarize all notations in Table 2 in Appendix A. i and naturally H1 i . Note that Hk1 i ∩ Hk2 i = {Hk i = N tr i }K i 3 Preprint Figure 2: (a)-(b): vi's Topological Concentration: we calculate the average intersection between vi's computation tree and each of vi's neighbor's computation tree. The intersection between two computation trees is the ratio of the observed intersections to all possible intersections. (c)-(d): two specifications of TC, corresponding to social and e-commerce networks. A higher triangle/square- based concentration indicates more triangles/squares are formed among v0's local subgraph. 3.2 TOPOLOGICAL CONCENTRATION: INTUITION AND FORMALIZATION 0 shares no neighbors with v′ As the link formation between a node pair heavily depends on the intersection between their lo- cal subgraphs (Zhang & Chen, 2018; Chamberlain et al., 2022), we similarly hypothesize the pre- dictability of a node's neighbors relates to the intersection between this node's subgraph and the subgraphs of that node's neighbors, e.g., the prediction of the links {(i, jk)}2 k=0 in Figure 2(a) de- pends on the intersection between S K }2 and {S K k=0. A higher intersection leads to higher LP jk i performance. For example, in Figure 2(c)-(d), v0 neighbors closely interact with themselves while 0 neighbors do not, posing different topological conditions for the LP on v0 and v′ v′ 0. From graph heuristics perspective, v0 shares common neighbors v1, v2, v3 with its incoming validation neighbors v4, v5 while v′ 5. From the message-passing perspective, the prop- agated embeddings of v0 and v4, v5 share common components since they all aggregate {vk}3 k=1 embeddings while v′ k=1. When the subgraph (i.e., computation tree) surrounding a node increasingly overlaps with the subgraphs of its neighbors, more paths originating from that node are likely to loop nearby and eventually return to it, resulting in a more dense/concentrated local topology for that node. Inspired by this observation, we introduce Topological Concentration to measure the average level of intersection among these local subgraphs as follows: Definition 1. Topological Concentration (TC): The Topological Concentration C K,t vi ∈ V is defined as the average intersection between vi's K-hop computation tree (S K computation trees of each of vi's type t neighbors: 5 do not share any common embeddings among {v′ for node i ) and the 0 and v′ 4, v′ 4, v′ k}3 i C K,t i = Evj ∼N t i I(S K i , S K j ) = Evj ∼N t i (cid:80)K k1=1 (cid:80)K k1=1 (cid:80)K k2=1βk1+k2−2|Hk1 k2=1 βk1+k2−2g(|Hk1 i ∩ Hk2 j | |, |Hk2 j |) i (cid:80)K (1) i , S K ∀vi ∈ V, ∀t ∈ T , where I(S K j ) quantifies the intersection between the K-hop computation trees around vi and vj, and is decomposed into the ratio of the observed intersections |Hk1 i ∩ Hk2 j | to the total possible intersections g(Hk1 j ) between neighbors that are k1 and k2 hops away as i shown in Figure 2(b). βk1+k2−2 accounts for the exponential discounting effect as the hop increases. The normalization term g is a function of the size of the computation trees of node vi, vj (Fu et al., 2022). Although computation trees only consist of edges from the training set, vi's neighbors N t i in Eq. (1) could come from training/validation/testing sets, and we term the corresponding TC as TCTr, TCVal, TCTe and their values as C K,Tr , C K,Te . We verify the correlation between TC and the i node LP performance in Section 3.3. , C K,Val i , Hk2 i 4 Preprint Figure 3: (a)/(d): The average LP Performance of nodes on Collab/Citation2 monotonically in- creases as the Train-TC increases. (b)/(c): TCTr mostly achieves the highest Pearson Correlation with LP performance on Citeseer/Vole than DegreeTr and Subgraph Density metrics. (e): LP perfor- mance is positively correlated to TCTr across different network datasets. 3.3 TOPOLOGICAL CONCENTRATION: OBSERVATION AND ANALYSIS In this section, we draw three empirical observations to delve into the role of TC in GNN-based LP. For all experiments, we evaluate datasets with only the topology information using LightGCN and those also having node features using GCN/SAGE (Kipf & Welling, 2016; Hamilton et al., 2017; He et al., 2020)1. Detailed experimental settings are described in Appendix E. Please note that while the findings illustrated in this section are limited to the presented datasets due to page limitation, more comprehensive results are included in Appendix F. Obs. 1. TC correlates to LP performance more than other node topological properties. In Fig- ure 3 (a)/(d), we group nodes in Collab/Citation2 based on their TCTr and visualize the average per- formance of each group. Unlike Figure 1(a)/(b), where there is no apparent relationship between the performance and the node degree, the performance almost monotonically increases as the node TCTr increases regardless of the evaluation metrics. This demonstrates the capability of TCTr in charac- terizing the quality of nodes' local topology for their LP performance. Moreover, we quantitatively compare the Pearson Correlation of the node LP performance with TCTr and other commonly used node local topological properties, DegreeTr (i.e., the number of training edges incident to a node) and SubGraph Density (i.e., the density of the 1-hop training subgraph centering around a node). As shown in Figure 3(b)/(c), TCTr almost achieves the highest Pearson Correlation with the node LP performance across every evaluation metric than the other two topological properties except for the precision metric. This is due to the degree-related evaluation bias implicitly encoded in the precision metric, i.e., even for the untrained link predictor, the precision of a node still increases linearly as its degree increases, as proved in Theorem 3. Note that the node's 1-hop Subgraph Density equals its local clustering coefficient (LCC), and one previous work (Pan et al., 2022) has observed its correlation with node LP performance. To justify the advantages of TCTr over LCC, we provide a concrete example in Appendix D. Additionally, Figure 3(e) shows that TCTr also positively corre- lated with LP performance across various networks, depicting a preliminary benchmark for GNNs' LP performance at the graph level (Palowitch et al., 2022). The LightGCN architecture exhibits a steeper slope than GCN, as it relies exclusively on network topology without leveraging node fea- tures and thus is more sensitive to changes in the purely topological metric, TC. The deviation of Collab under both GCN and LightGCN baselines from the primary linear trend might be attributed to the duplicated edges in the network that create the illusion of a higher train-TC (Hu et al., 2020). 1Due to GPU memory limitation, we choose SAGE for Citation2. 5 Preprint (a)/(d): The average LP performance of nodes with extremely low TCTr on Col- Figure 4: lab/Citation2 almost monotonically increases as TCTr increases. (b)/(e): Cold-Start nodes identified by owning lower DegreeTr surprisingly perform better than their non-cold-start counterparts (Blue curves). In contrast, Non-concentrated nodes identified by owning lower TCTr in most cases perform worse than their concentrated counterparts (Red curves). (c)/(f): As node DegreeTr increases, the ratio of nodes owning higher TCTr increases first and then decreases, corresponding to the observed first-increase-and-then-decrease performance trend in Figure 1(c)/(d). Obs. 2. TC better identifies low-performing nodes than degree, and Cold-start nodes may not necessarily have lower LP performance. As previously shown in Figure 1(c)/(d), when the node degree is at the very low regime, we do not observe a strict positive relationship between node DegreeTr and its LP performance. For example, the node Recall/MRR/NDCG@10 in Collab decreases as DegreeTr increases and HitsN /F1/Precision@10 first increases and then decreases. These contradicting observations fa- cilitate our hypothesis that the degree might not fully capture the local topology in characterizing the lower performance of cold-start nodes. Conversely, in Figure 4(a)/(d) on Collab/Citation2, nodes with lower TCTr almost always have worse LP performance under all evaluation metrics except when TCTr is between [0, 0.02). For this extreme case, we ascribe it to the distribution shift as nodes with extremely low TCTr generally have a decent TCTe (shown in Figure 20) and sustain a reasonable LP performance. We thoroughly investigate this distribution shift issue in Obs. 3. Furthermore, we adjust the DegreeTr from 1 to 10 to divide nodes into 'Cold-Start/Non-Cold-Start' groups and adjust TCTr from 0.01 to 0.1 to divide nodes into 'Concentrated/Non-Concentrated' groups. We com- pare their average LP performance on Collab/Citation2 in Figure 4(b)/(e). Intriguingly, Cold-Start nodes identified via lower DegreeTr always perform better than their Non-Cold-Start counterparts with higher DegreeTr across all DegreeTr thresholds. This brings nuances into the conventional un- derstanding that nodes with a weaker topology (lower degree) would yield inferior performance. In contrast, with our defined TcTr metric, Non-concentrated nodes (lower TcTr) generally underperform by a noticeable margin than their concentrated counterparts (higher TCTr). We further visualize the relation between DegreeTr and TCTr in Figure 4(c)/(f). When node DegreeTr increases from 1 to 4, the ratio of nodes owning higher TCTr also increases because these newly landed nodes start interactions and create their initial topological context. Since we have already observed the positive correlation of TCTr to nodes' LP performance previously, the LP performance for some evaluation metrics also increases as the DegreeTr initially increases from 0 to 4 observed in Figure 1(c)/(d). When DegreeTr increases further beyond 5, the ratio of nodes owning higher TCTr gradually decreases, leading to the decreasing performance observed in the later stage of Fig- ure 1(c)/(d). This decreasing TrainTr is because, for high DegreeTr nodes, their neighbors are likely to lie in different communities and share fewer connections among themselves. For example, in social networks, high-activity users usually possess diverse relations in different online communi- ties, and their interacted people are likely from significantly different domains and hence share less common social relations themselves (Zhao et al., 2021b). 6 Preprint Obs. 3. Topological Distribution Shift compromises the LP performance at testing time, and TC can measure its negative impact at both graph and node level. In real-world LP scenarios, new nodes continuously join the network and form new links with existing nodes, making the whole network evolve dynamically (Ma et al., 2020; Rossi et al., 2020). Here, we discover a new Topo- logical Distribution Shift (TDS) issue, i.e., as time goes on, the newly joined neighbors of a node become less interactive with that node's old neighbors. Since the edges serving message-passing and providing supervision only come from the training set, TDS would compromise the capability of the learned node embeddings for predicting links in the testing set. As verified in Figure 5(a), the performance gap between validation and testing sets on Collab where edges are split according to time is much more significant than the one on Cora/Citeseer where edges are split randomly. Note that the significantly higher performance on predicting training edges among all these three datasets is because they have already been used in the training phase (Wang et al., 2023), and this distribu- tion shift is different from TDS. As TC essentially measures the interaction level among neighbors of a particular node, we further visualize the distribution of the difference between TCVal and TCTe in Figure 5(b). We observe a slight shift towards the right on Collab rather than on Cora/Citeseer, demonstrating nodes' testing neighbors become less interactive with their training neighbors than their validation neighbors. Figure 4(c) further demonstrates the influence of this shift at the node level by visualizing the relationship between TDS and the performance gap. We can see that as the strength of such shift increases (evidenced by the larger difference between TCVal and TCTest), the performance gap also increases. This suggests that nodes within the same graph display vary- ing TDS levels. As one potential application, we can devise adaptive data valuation techniques to selectively retain or remove stale edges for individual nodes in LP. Figure 5: (a) HitsN @10 of predicting training/validation/testing edges on Cora/Citeseer/Collab. The gap between validation and testing performance is much bigger on Collab than on Cora/Citeseer. (b) Compared with Cora/Citeseer where edges are randomly split, the distribution of the difference between TCVal and TCTe shifts slightly right on Collab where edges are split according to time, in- dicating the interaction between training and testing neighbors become less than the one between training and validation neighbors. (c) As the gap between TCVal and TCTe increases for different nodes, their corresponding performance gap also increases, demonstrating TDS varies among dif- ferent nodes even within the same graph. 3.4 TOPOLOGICAL CONCENTRATION: COMPUTATIONAL COMPLEXITY AND OPTIMIZATION k=1 (cid:80)K Calculating TC following Eq. (1) involves counting the intersection between two neighboring sets that are different hops away from the centering nodes in two computation trees. Assuming the average degree of the network is (cid:98)d, the time complexity of computing C K,t for all nodes in the network is O(|E| (cid:80)K k=1 min( (cid:98)dk1, (cid:98)dk2)) = O(K 2|E||V|) ≈ O(K 2|V|2) for sparse networks, which increases quadratically as the size of the network increases and is hence challenging for large- scale networks. To handle this issue, we propagate the randomly initialized Gaussian embeddings in the latent space to approximate TC in the topological space and propose Approximated Topological Concentration as follows: Definition 2. Approximated Topological Concentration (ATC): Approximated topological con- centration (cid:101)C K,t for vi ∈ V is the average similarity between vi and its neighbors' embeddings initialized from Gaussian Random Projection (Chen et al., 2019) followed by row-normalized graph diffusion (cid:101)Ak (Gasteiger et al., 2019), with φ as the similarity metric function: i i (cid:101)C K,t i = Evj ∼N t i αk (cid:101)AkR, R ∼ N (0d, Σd) (2) φ(Ni, Nj), N = K (cid:88) k=1 7 Preprint Theorem 1. Assuming g(|Hk1 i i similarity metric (He et al., 2020), then node vi's 1-layer Topological Concentration C 1,t i correlated with the mean value of the 1-layer Approximated Topological Concentration μ j | in Eq. (1) and let φ be the dot-product based is linear as: j |) = |Hk1 |, |Hk2 ||Hk2 (cid:101)CK,t i C 1,t i ≈ d−1μE vj ∼N t i (E1 j )⊤E1 i = d−1μ (cid:101)C1,t i , (3) where E1 ∈ Rn×d denotes the node embeddings after 1-layer SAGE-style message-passing and d is the embedding dimension. The full proof is in Appendix C. This theorem bridges the gap between TC defined in the topological space and ATC defined in the latent space, which theoretically justifies the effectiveness of this approximation. Computationally, obtaining node embeddings N in Eq. (2) is free from optimization, and the graph diffusion can be efficiently executed via power iteration, which reduces the complexity to O(Kd(|E| + |V|)). Note that although we only demonstrate the approximation power for the case of 1-layer message-passing, we empirically verify the efficacy for higher-layer message-passing in the following. Here, we compare TC and ATC under various number of hops in terms of their computational time and their correlation with LP performance in Figure 6. As the number of hops increases, the running time for computing TC increases exponentially (especially for large-scale datasets like Collab, we are only affordable to compute its Train-TC up to 3 hops) while ATC stays roughly the same. This aligns with the quadratic/linear time complexity O(K 2|V|2)/O(Kd(|E| + |V|)) we derived earlier for TC/ATC. Moreover, ATC achieves a similar level of correlation to TC at all different hops. For both TC and ATC, their correlations to LP performance increase as the number of hops K used in Eq. (1)-Eq. (2) increases. This is because larger K enables us to capture intersections among larger subgraphs and hence accounts for more common neighbor signals (Chamberlain et al., 2022). Figure 6: ATC maintains a similar level of correlation to TC while significantly reducing the com- putational time. Using TC computed with higher hops of neighbors leads to a higher correlation. 4 TOPOLOGICAL CONCENTRATION: BOOSTING GNNS' LP PERFORMANCE From the aforementioned observations, TC consistently exhibits a stronger correlation with GNNs' LP performance than other commonly used node topological metrics. This insight motivates us to explore the potential of boosting GNNs' LP performance via enhancing TCTr. Specifically, we pro- pose to vary the edge weight used in message-passing by aggregating more information from neigh- bors that contribute more to TCTr. We theoretically and empirically show that using this way could enhance 1-layer TCTr in Theorem 4 and Figure 7(a). Since neighbors owning more connections with the whole neighborhood have higher LP scores with the average neighborhood embeddings, we update the adjacency matrix used for message-passing as: (cid:101)Aτ ij =    ij + γ (cid:101)Aτ −1 0, exp(gΘg (Nτ −1 j=1 exp(gΘg (Nτ −1 ,Hτ −1 )) j ,Hτ −1 j i i (cid:80)n , )) ifAij = 1 ifAij = 0 , ∀vi, vj ∈ V, (4) where Hτ −1 = fΘf ( (cid:101)Aτ −1, X) is the node embeddings obtained from GNN model fΘf , Nτ −1 = (cid:101)AHτ −1 is the average neighborhood embeddings by performing one more SAGE-style propagation, γ is the weight coefficient, (cid:101)A0 = (cid:101)A, and gΘg is the link predictor. The detailed algorithm is presented in Appendix G. Note that this edge reweighting strategy directly operates on the original adjacency matrix and hence shares the same time/space complexity as the conventional message- passing O(Ld(|E + V|)) with L being the number of message-passing layers. 8 Preprint Table 1: Results on LP benchmarks. Xrw denotes weighted message-passing added to baseline X. Baseline Cora Collab Hits@100 Hits@100 Hits@100 Hits@50 Pubmed Citeseer Citation2 MRR Reptile Vole Hits@100 Hits@100 70.63±0.67 65.96±2.12 69.35±1.02 49.52±0.52 84.42±0.05 65.52±2.73 73.84±0.98 GCN GCNrw 75.98±1.28 74.40±1.13 68.87±0.99 52.85±0.14 85.34±0.30 70.79±2.00 74.50±0.84 74.27±2.08 61.57±3.28 66.25±1.08 50.01±0.50 80.44±0.10 72.59±3.19 80.55±1.59 SAGE SAGErw 74.62±2.30 69.89±1.66 66.77±0.69 52.59±0.37 80.61±0.10 74.35±3.20 81.27±0.96 NCN NCNrw 87.95±1.30 91.86±0.82 76.51±1.41 54.16±0.24 87.73±1.41 90.93±0.83 76.20±1.55 54.43±0.17 88.64±0.14 68.37±3.57 66.10±1.13 73.81±4.71 67.32±0.81 – Note that for Citation2, due to memory limitation, we directly take the result from the original NCN paper (Wang et al., 2023). Specifically, we equip three baselines, GCN/SAGE/NCN, with our designed edge reweighting strat- egy and present their LP performance in Table 1. Appendix E thoroughly describes the experimental settings. For GCN and SAGE, equipping with our proposed edge reweighting strategy enhances their LP performance in most cases. This demonstrates that by pushing up the TCTR of the whole graph, the LP performance can be boosted to a certain level, which also verified by the increasing TC shown in Figure 7(a). We hypothesize that neighbors connecting more to the overall neighborhood likely have greater interactions with incoming neighbors. Thus, aggregating more information from them inherently captures the common neighbor signals of these incoming neighbors. Meanwhile, as NCN already explicitly accounts for this common neighbor signal in its decoder, the performance gains from our strategy are relatively modest. Furthermore, the positive trend observed in Figure 7(b) ver- ifies that the larger enhancement in node TCTr leads to a larger performance boost in its HitsN @10. However, we note that LP performance is evaluated on the incoming testing neighbors rather than training neighbors, so TCTR is more of a correlated metric than causal. To illustrate, consider an extreme case where a node vi has training neighbors forming a complete graph with no connection to its incoming neighbors. In such a scenario, even if we achieve the maximum TCTR = 1 and a significantly high training performance, it still hardly generalizes to predicting testing links. This could be reflected in the inconsistent trend in Figure 21/22 in Appendix F.8. In addition, Figure 7(c) verifies the assumption made in Theorem 4 and in the reweighting model design that nodes with larger TCTr have higher average embedding similarity to their neighbors. Figure 7: (a) Change of Hits@50 and Reweighted TC along the training process in SAGE. (b) Nodes with enhanced TCTr exhibit a surge in performance. (c) Embedding similarity during LightGCN training increases faster and higher for nodes with higher TCTr. 5 CONCLUSION Although many recent works have achieved unprecedented success in enhancing link prediction (LP) performance with GNNs, demystifying the varying levels of embedding quality and LP performance across different nodes within the graph is heavily under-explored yet fundamental. In this work, we take the lead in understanding the nodes' varying performance from the perspective of their local topology. In view of the connection between link formation and the subgraph interaction, we propose Topological Concentration (TC) to characterize the node LP performance and demonstrate its superiority in leading higher correlation and identifying more low-performing nodes than other common node topological properties. Moreover, we discover a novel topological distribution shift (TDS) issue by observing the changing LP performance over time and demonstrate the capability of using TC to measure this distribution shift. Our work offers the community strong insights into which local topology enables nodes to have better LP performance with GNNs. Moving forward, we plan to investigate the causal relationship between TC and LP performance. Additionally, we aim to utilize TC for data valuation to select consistently crucial edges in dynamic link prediction. 9 Preprint REFERENCES Benjamin Paul Chamberlain, Sergey Shirobokov, Emanuele Rossi, Fabrizio Frasca, Thomas Markovich, Nils Hammerla, Michael M Bronstein, and Max Hansmire. Graph neural networks for link prediction with subgraph sketching. arXiv preprint arXiv:2209.15486, 2022. Haochen Chen, Syed Fahad Sultan, Yingtao Tian, Muhao Chen, and Steven Skiena. Fast and ac- curate network embeddings via very sparse random projection. In Proceedings of the 28th ACM international conference on information and knowledge management, pp. 399–408, 2019. Huiyuan Chen, Lan Wang, Yusan Lin, Chin-Chia Michael Yeh, Fei Wang, and Hao Yang. Structured graph convolutional networks with stochastic masks for recommender systems. In Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 614–623, 2021. Kaiwen Dong, Yijun Tian, Zhichun Guo, Yang Yang, and Nitesh Chawla. Fakeedge: Alleviate dataset shift in link prediction. In Learning on Graphs Conference, pp. 56–1. PMLR, 2022. Hao-Ming Fu, Patrick Poirson, Kwot Sin Lee, and Chen Wang. Revisiting neighborhood-based link prediction for collaborative filtering. In Companion Proceedings of the Web Conference 2022, pp. 1009–1018, 2022. Johannes Gasteiger, Stefan Weissenberger, and Stephan G ̈unnemann. Diffusion improves graph learning. Advances in neural information processing systems, 32, 2019. Marco Gori, Augusto Pucci, V Roma, and I Siena. Itemrank: A random-walk based scoring algo- rithm for recommender engines. In IJCAI, volume 7, pp. 2766–2771, 2007. Aditya Grover and Jure Leskovec. node2vec: Scalable feature learning for networks. In Proceedings of the 22nd ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 855–864, 2016. Zhichun Guo, William Shiao, Shichang Zhang, Yozen Liu, Nitesh V Chawla, Neil Shah, and Tong Zhao. Linkless link prediction via relational distillation. In International Conference on Machine Learning, pp. 12012–12033. PMLR, 2023. Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. Advances in neural information processing systems, 30, 2017. Bowen Hao, Jing Zhang, Hongzhi Yin, Cuiping Li, and Hong Chen. Pre-training graph neural net- works for cold-start users and items representation. In Proceedings of the 14th ACM International Conference on Web Search and Data Mining, pp. 265–273, 2021. Yu Hao, Xin Cao, Yixiang Fang, Xike Xie, and Sibo Wang. Inductive link prediction for nodes having only attribute information. arXiv preprint arXiv:2007.08053, 2020. Xiangnan He, Kuan Deng, Xiang Wang, Yan Li, Yongdong Zhang, and Meng Wang. Lightgcn: Simplifying and powering graph convolution network for recommendation. In Proceedings of the 43rd International ACM SIGIR conference on research and development in Information Retrieval, pp. 639–648, 2020. Weihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong, Hongyu Ren, Bowen Liu, Michele Catasta, and Jure Leskovec. Open graph benchmark: Datasets for machine learning on graphs. Advances in neural information processing systems, 33:22118–22133, 2020. Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional net- works. arXiv preprint arXiv:1609.02907, 2016. Sang Gyu Kwak and Jong Hae Kim. Central limit theorem: the cornerstone of modern statistics. Korean journal of anesthesiology, 70(2):144–156, 2017. Vincent Leroy, B Barla Cambazoglu, and Francesco Bonchi. Cold start link prediction. In Pro- ceedings of the 16th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 393–402, 2010. 10 Preprint Juanhui Li, Harry Shomer, Haitao Mao, Shenglai Zeng, Yao Ma, Neil Shah, Jiliang Tang, and Dawei Yin. Evaluating graph neural networks for link prediction: Current pitfalls and new benchmark- ing. arXiv preprint arXiv:2306.10453, 2023. Yunqi Li, Hanxiong Chen, Zuohui Fu, Yingqiang Ge, and Yongfeng Zhang. User-oriented fairness in recommendation. In Proceedings of the Web Conference 2021, pp. 624–632, 2021. David Liben-Nowell and Jon Kleinberg. The link prediction problem for social networks. In Pro- ceedings of the twelfth international conference on Information and knowledge management, pp. 556–559, 2003. Blerina Lika, Kostas Kolomvatsos, and Stathes Hadjiefthymiades. Facing the cold start problem in recommender systems. Expert systems with applications, 41(4):2065–2073, 2014. Zemin Liu, Trung-Kien Nguyen, and Yuan Fang. Tail-gnn: Tail-node graph neural networks. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pp. 1109–1119, 2021. Yao Ma, Ziyi Guo, Zhaocun Ren, Jiliang Tang, and Dawei Yin. Streaming graph neural networks. In Proceedings of the 43rd international ACM SIGIR conference on research and development in information retrieval, pp. 719–728, 2020. Haitao Mao, Zhikai Chen, Wei Jin, Haoyu Han, Yao Ma, Tong Zhao, Neil Shah, and Jiliang Tang. Demystifying structural disparity in graph neural networks: Can one size fit all? arXiv preprint arXiv:2306.01323, 2023. John Palowitch, Anton Tsitsulin, Brandon Mayer, and Bryan Perozzi. Graphworld: Fake graphs bring real insights for gnns. In Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pp. 3691–3701, 2022. Liming Pan, Cheng Shi, and Ivan Dokmani ́c. Neural link prediction with walk pooling. In Interna- tional Conference on Learning Representations, 2022. Hossein A Rahmani, Mohammadmehdi Naghiaei, Mahdi Dehghan, and Mohammad Aliannejadi. Experiments on generalizability of user-oriented fairness in recommender systems. In Proceed- ings of the 45th International ACM SIGIR Conference on Research and Development in Informa- tion Retrieval, pp. 2755–2764, 2022. Emanuele Rossi, Ben Chamberlain, Fabrizio Frasca, Davide Eynard, Federico Monti, and Michael Bronstein. Temporal graph networks for deep learning on dynamic graphs. arXiv preprint arXiv:2006.10637, 2020. Ryan A. Rossi and Nesreen K. Ahmed. The network data repository with interactive graph analytics and visualization. In AAAI, 2015. URL https://networkrepository.com. Benedek Rozemberczki, Charles Tapley Hoyt, Anna Gogleva, Piotr Grabowski, Klas Karis, Andrej Lamov, Andriy Nikolov, Sebastian Nilsson, Michael Ughetto, Yu Wang, et al. Chemicalx: A deep learning library for drug pair scoring. In Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pp. 3819–3828, 2022. MN Sanders. Characteristic function of the central chi-squared distribution, 2009. William Shiao, Zhichun Guo, Tong Zhao, Evangelos E Papalexakis, Yozen Liu, and Neil Shah. Link prediction with non-contrastive learning. In The Eleventh International Conference on Learning Representations, 2022. Hibiki Taguchi, Xin Liu, and Tsuyoshi Murata. Graph convolutional networks for graphs containing missing features. Future Generation Computer Systems, 117:155–168, 2021. Xianfeng Tang, Huaxiu Yao, Yiwei Sun, Yiqi Wang, Jiliang Tang, Charu Aggarwal, Prasenjit Mitra, and Suhang Wang. Investigating and mitigating degree-related biases in graph convoltuional net- works. In Proceedings of the 29th ACM International Conference on Information & Knowledge Management, pp. 1435–1444, 2020. 11 Preprint Y Tian, C Zhang, Z Guo, C Huang, R Metoyer, and N Chawla. Reciperec: A heterogeneous graph learning model for recipe recommendation. In Proceedings of the Thirty-First International Joint Conference on Artificial Intelligence. International Joint Conferences on Artificial Intelligence Organization., 2022. Xiyuan Wang, Haotong Yang, and Muhan Zhang. Neural common neighbor with completion for link prediction. arXiv preprint arXiv:2302.00890, 2023. Yiwei Wang, Wei Wang, Yuxuan Liang, Yujun Cai, and Bryan Hooi. Mixup for node and graph classification. In Proceedings of the Web Conference 2021, pp. 3663–3674, 2021. Yu Wang and Tyler Derr. Degree-related bias in link prediction. In 2022 IEEE International Con- ference on Data Mining Workshops (ICDMW), pp. 757–758. IEEE, 2022. Yu Wang, Yuying Zhao, Neil Shah, and Tyler Derr. Imbalanced graph classification via graph-of- graph neural networks. In Proceedings of the 31st ACM International Conference on Information & Knowledge Management, pp. 2067–2076, 2022. Seongjun Yun, Seoyoon Kim, Junhyun Lee, Jaewoo Kang, and Hyunwoo J Kim. Neo-gnns: Neigh- borhood overlap-aware graph neural networks for link prediction. Advances in Neural Information Processing Systems, 34:13683–13694, 2021. Muhan Zhang and Yixin Chen. Link prediction based on graph neural networks. Advances in neural information processing systems, 31, 2018. Tianxiang Zhao, Xiang Zhang, and Suhang Wang. Graphsmote: Imbalanced node classification on graphs with graph neural networks. In Proceedings of the 14th ACM international conference on web search and data mining, pp. 833–841, 2021a. Tong Zhao, Gang Liu, Daheng Wang, Wenhao Yu, and Meng Jiang. Learning from counterfactual links for link prediction. In International Conference on Machine Learning, pp. 26911–26926. PMLR, 2022. Xiangyu Zhao, Haochen Liu, Wenqi Fan, Hui Liu, Jiliang Tang, Chong Wang, Ming Chen, Xudong Zheng, Xiaobing Liu, and Xiwang Yang. Autoemb: Automated embedding dimensionality search in streaming recommendations. In 2021 IEEE International Conference on Data Mining (ICDM), pp. 896–905. IEEE, 2021b. Jiong Zhu, Yujun Yan, Lingxiao Zhao, Mark Heimann, Leman Akoglu, and Danai Koutra. Beyond homophily in graph neural networks: Current limitations and effective designs. Advances in Neural Information Processing Systems, 33:7793–7804, 2020. Jiong Zhu, Ryan A Rossi, Anup Rao, Tung Mai, Nedim Lipka, Nesreen K Ahmed, and Danai In Proceedings of the AAAI conference on Koutra. Graph neural networks with heterophily. artificial intelligence, volume 35, pp. 11168–11176, 2021. 12 14 15 15 15 16 16 17 19 20 21 21 21 21 21 23 24 25 26 26 26 27 35 Preprint Appendix Table of Contents A Notations B Link-centric and Node-centric Evaluation Metrics . . B.1 Link-Centric Evaluation . . B.2 Node-Centric Evaluation . . . . . . . . . . . . . . . . . . . . . C Proof of Theorems . C.1 Approximation power of ATC for TC . . C.2 Degree-related Bias of Evaluation Metrics . C.3 Reweighting by LP Score Enhance 1-layer TC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D Example demonstrating the advantages of TC over LCC E Datasets and Experimental Settings E.1 Dataset Introduction and Statistics . . E.2 Hyperparameter Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F Additional Results . . F.1 Link prediction performance grouped by TCTe . . . . F.2 Link prediction performance grouped by TCTr . . . . F.3 Link prediction performance grouped by DegreeTe . . . F.4 Link prediction performance grouped by DegreeTr . . . . F.5 Relation between LP performance and TC at Graph-level . F.6 Relation between TCTr and TCTe . . . . F.7 Correlation of the performance with TC and Degree . . . F.8 Difference in TC vs Difference in Performance before/after applying reweighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G Edge Reweighting Algorithm 13 Preprint A NOTATIONS This section summarizes all notations used throughout this paper. Table 2: Notations used throughout this paper. Notations G = (V, E, X) m, n vi, eij A (cid:101)A (cid:98)A (cid:101)At D (cid:98)d T = {Tr, Val, Te} DegreeTr/Val/Te TCTr/Val/Te N t i Hk i i = {Hk S K C K,t i k=1 i }K \ (cid:101)C K,t i Ek i Rij gΘg (cid:101)Ei, (cid:98)Ei HG LP (A)TC TDS β αk μ L γ Definitions or Descriptions Graph with node set V, edge set E and node feature X Number of nodes m = |V| and number of edges n = |E| Node vi and the edge eij between node vi and vj Adjacency matrix Aij = 1 indicates an edge eij between vi, vj Row-based normalized graph adjacency matrix (cid:101)A = D−1A GCN-based normalized graph adjacency matrix (cid:98)A = D−0.5AD−0.5 Updated adjacency matrix at iteration t Diagonal degree matrix Dii = (cid:80)n j=1 Aij Average degree of the network Set of Training/Validation/Testing edge groups Degree based on Training/Validation/Testing Edges Topological Concentration quantifying intersection with Training/Validation/Testing neighbors Node vi's 1-hop neighbors of type t, t ∈ T Nodes having at least one path of length k to vi based on training edges E Tr K-hop computational tree centered on the node vi (Approximated) Topological concentration for node vi considering the intersection among K-hop computational trees among its type t neighbors. Embedding of the node vi after kth-layer message-passing Sample from gaussian random variable N (0, 1/d) Link predictor parameterized by Θg Predicted and ground-truth neighbors of node vi Hypergeometric distribution Link Prediction (Approxminated) Topological Concentration Topological Distribution Shift Exponential discounting effect as the hop increases Weighted coefficient of layer k in computing ATC Mean of the distribution Number of message-passing layers Coefficients measuring the contribution of updating adjacency matrix 14 Preprint B LINK-CENTRIC AND NODE-CENTRIC EVALUATION METRICS In addition to the conventional link-centric evaluation metrics used in this work, node-centric evalu- ation metrics are also used to mitigate the positional bias caused by the tiny portion of the sampled negative links. We introduce their mathematical definition respectively as follows: B.1 LINK-CENTRIC EVALUATION Following (Hu et al., 2020), we rank the prediction score of each link among a set of randomly sampled negative node pairs and calculate the link-centric evaluation metric Hits@K as the ratio of positive edges that are ranked at K th-place or above. Note that this evaluation may cause bias as the sampled negative links only count a tiny portion of the quadratic node pairs (Li et al., 2023). Hereafter, we introduce the node-centric evaluation metrics and specifically denote the node-level Hit ratio as HitsN @K to differentiate it from the link-centric evaluation metric Hits@K. B.2 NODE-CENTRIC EVALUATION For each node vi ∈ V, the model predicts the link formation score between vi and every other node, and selects the top-K nodes to form the potential candidates (cid:101)Ei. Since the ground-truth candidates for node vi is N Te (hereafter, we notate as (cid:98)Ei), we can compute the Recall(R), Precision(P), F1, i NDCG(N), MRR and HitsN of vi as follows: R@Ki = | (cid:101)Ei ∩ (cid:98)Ei| | (cid:98)Ei| , P@Ki = | (cid:101)Ei ∩ (cid:98)Ei| K F1@Ki = 2| (cid:101)Ei ∩ (cid:98)Ei| K + | (cid:98)Ei| , N@Ki = (cid:80)K 1[vφk i ∈( (cid:101)Ei∩ (cid:98)Ei)] k=1 (cid:80)K k=1 log2(k+1) 1 log2(k+1) MRR@Ki = 1 minv∈( (cid:101)Ei∩ (cid:98)Ei) Rankv , HitsN @Ki = 1[| (cid:98)Ei ∩ (cid:101)Ei| > 0], (5) (6) (7) where φk i denotes vi's kth preferred node according to the ranking of the link prediction score, Rankv is the ranking of the node v and 1 is the indicator function equating 0 if the intersection between (cid:98)E i ∩ (cid:101)Ei is empty otherwise 1. The final performance of each dataset is averaged across each node: X@K = Evi∈V X@Ki, X ∈ {R, P, F1, N, MRR, HitsN } (8) Because for each node, the predicted neighbors will be compared against all the other nodes, there is no evaluation bias compared with the link-centric evaluation, where only a set of randomly selected negative node pairs are used. 15 Preprint C PROOF OF THEOREMS C.1 APPROXIMATION POWER OF ATC FOR TC Theorem 1. Assuming g(|Hk1 i i similarity metric (He et al., 2020), then node vi's 1-layer Topological Concentration C 1,t i correlated with the mean value of the 1-layer Approximated Topological Concentration μ j | in Eq. (1) and let φ be the dot-product based is linear as: j |) = |Hk1 |, |Hk2 ||Hk2 (cid:101)CK,t i C 1,t i ≈ d−1μE vj ∼N t i (E1 j )⊤E1 i = d−1μ (cid:101)C1,t i , (9) where E1 ∈ Rn×d denotes the node embeddings after 1-layer SAGE-style message-passing over the node embeddings R ∼ N (0d, Σd) and χ is the approximation error. Proof. Assuming without loss of generalizability that the row-normalized adjacency matrix (cid:101)A = D−1A is used in aggregating neighborhood embeddings. We focus on a randomly selected node Ei ∈ Rd, ∀vi ∈ V and its 1-layer ATC given by Eq. (2) is: (cid:101)C 1,t i = Evj ∼N t i (E1 j )⊤E1 i = Evj ∼N t i = Evj ∼N t i j ( (cid:101)AR)i ( (cid:101)AR)⊤ 1 j ||N tr i | |N tr (cid:88) ( vm∈N tr j (cid:88) Rm)⊤( (cid:88) Rn) vn∈N tr i (Rm)⊤Rn = Evj ∼N t i 1 j ||N tr i | |N tr = Evj ∼N t i 1 i ||H1 j | |H1 ( (vm,vn)∈N tr j ×N tr i (cid:88) (Rm)⊤Rn + (cid:88) (Rk)⊤Rk ), (vm,vn)∈N tr vm̸=vn j ×N tr i , (cid:125) (cid:123)(cid:122) (cid:124) Non-common neighbor embedding pairs vk∈N tr (cid:124) j ∩N tr i (cid:123)(cid:122) Common neighbor embedding pairs (cid:125) (10) Note that the first term is the dot product between any pair of two non-common neighbor embed- dings, which is essentially the dot product between two independent samples from the same mul- tivariate Gaussian distribution (note that here we do not perform any training optimization, so the embeddings of different nodes are completely independent) and by central limit theorem (Kwak & Kim, 2017) approaches the standard Gaussian distribution with 0 as the mean, i.e., μ(Rm)⊤Rn = 0. In contrast, the second term is the dot product between any Gaussian-distributed sample and it- self, which can be essentially characterized as the sum of squares of d independent standard normal random variables and hence follows the chi-squared distribution with d degrees of freedom, i.e., (Rk)⊤Rk ∼ χ2 ≤ z) = P N (0,1)(z) and hence limd→∞ χ2 d = N (d, 2d), i.e., μ(Rk)⊤Rk = d. Then we obtain the mean value of Evj ∼N t d (Sanders, 2009). By Central Limit Theorem, limd→∞ P ( χ2 j )⊤E1 i : d−d √ 2d (E1 i μ (cid:101)C1,t i = μE vj ∼N t i (E1 j )⊤E1 i ≈ Evj ∼N t i 1 i ||H1 j | |H1 (μ(cid:80) (vm,vn)∈N tr vm̸=vn j ×N tr i , (Rm)⊤Rn + μ(cid:80) vk ∈N tr j (Rk)⊤Rk ) ∩N tr i ≈ Evj ∈N t i d|N tr |H1 i ∩ N tr j | i ||H1 j | = Evj ∈N t i d|H1 |H1 i ∩ H1 j | i ||H1 j | = dC 1,t i . (11) The second approximation holds since we set d to be at least 64 for all experiments in this paper. We next perform Monte-Carlo Simulation to verify that by setting d = 64, the obtained distribution is very similar to the Gaussian distribution. Assuming without loss of generality that the embedding dimension is 64 with the mean vector μ = 064 ∈ R64 and the identity covariance matrix Σ64 = I ∈ R64×64, we randomly sample 1000 embeddings from N (μ, Σ). 16 Preprint We visualize the distributions of the inner product between the pair of non-common neighbor em- beddings, i.e., the first term in Eq. (10) (Rm)⊤Rn, vm ̸= vn, and the pair of common neighbor embeddings, i.e., the second term in Eq. (10) (Rk)⊤Rk, vk ∈ N tr in Figure 8. We can see that the distribution of the dot product between the pair of non-common neighbor embeddings be- haves like a Gaussian distribution centering around 0. In contrast, the distribution of the dot product between the pair of common neighbor embeddings behaves like a chi-square distribution of degree 64, which also centers around 64, and this in turn verifies the Gaussian approximation. Note that the correctness of the first approximation in Eq. (11) relies on the assumption that the average of the inverse of the node's neighbors should be the same across all nodes. Although it cannot be theoreti- cally satisfied, we still empirically verify the positive correlation between TC and the link prediction performance shown in Figure 3. j ∩ N tr i The above derivation bridges the gap between the Topological Concentration (TC) defined in the topological space and the Approximated Topological Concentration (ATC) defined in the latent space, which theoretically justifies the approximation efficacy of ATC. Figure 8: The distribution of the inner product between common neighbor pairs is statistically higher than that between non-common neighbor pairs. C.2 DEGREE-RELATED BIAS OF EVALUATION METRICS One previous work (Wang & Derr, 2022) has empirically shown the degree-related bias of evaluation metrics used in link prediction models. Following that, we go one step further and theoretically derive the concrete format of the evaluation bias in this section. We leverage an untrained link prediction model to study the bias. This avoids any potential supervision signal from training over observed links and enables us to study the evaluation bias exclusively. Since two nodes with the same degree may end up with different performances, i.e., X@Ki ̸= X@Kj, di = dj, we model X@K|d as a random variable and expect to find the relationship between its expectation and the node degree d, i.e., f : E(X@K|d) = f (d). Following many existing ranking works (He et al., 2020; Chen et al., 2021), we assume without loss of generalizability that the link predictor P ranking the predicted neighbors based on their embedding similarity with embeddings noted as E, then we have: Lemma 1. For any untrained embedding-based link predictor P, given the existing k − 1 pre- dicted neighbors for the node vi ∈ V, the kth predicted neighbor is generated by randomly selecting a node without replacement from the remaining nodes with equal opportunities, i.e., P (vφk = v|{vφ1 , vφ2 }) = , ..., vφk−1 1 N −(k−1) . i i i i Without any training, Lemma 1 trivially holds since embeddings of all nodes are the same, which trivially leads to the following theorem: Theorem 2. Given the untrained embedding-based link predictor P, the size of the intersection between any node's predicted list (cid:101)Ei and its ground-truth list (cid:98)Ei follows a hypergeometric distribu- tion: | (cid:101)Ei ∩ (cid:98)Ei| ∼ HG(|V|, K, | (cid:98)Ei|) where |V| is the population size (the whole node space), K is 17 Preprint the number of trials and | (cid:98)Ei| is the number of successful states (the number of node's ground-truth neighbors). }K Proof. Given the ground-truth node neighbors (cid:98)Ei, the predicted neighbors (cid:101)Ei = {vφk k=1 is formed by selecting one node at a time without replacement K times from the whole node space V. Since can be classified into one of two mutually exclusive categories (cid:98)Ei or V\ (cid:98)Ei any selected node vφk and by Lemma 1, we know that for any untrained link predictor, each unselected node has an equal opportunity to be selected in every new trial, we conclude that | (cid:101)Ei ∩ (cid:98)Ei| ∼ HG(|V|, K, | (cid:98)Ei|) and by default E(| (cid:101)Ei ∩ (cid:98)Ei|) = | (cid:101)Ei| | (cid:98)Ei| |V| = K | (cid:98)Ei| |V| . i i Furthermore, we present Theorem 3 to state the relationships between the LP performance under each evaluation metric and the node degree: Theorem 3. Given that | (cid:101)Ei ∩ (cid:98)Ei| follows hyper-geometric distribution, we have: E(R@Ki|d) = K N , ∂E(R@K|d) ∂d = 0, E(P@K|di) = αd N , ∂E(P@K|d) ∂d = α N , E(F1@K|d) = 2K N αd K + αd , ∂E(F1@K|d) ∂d = 2αK 2 N 1 (K + αd)2 , E(N@K|d) = αd N , ∂E(N@K|d) ∂d = α N . E(R@Ki|d) = E( | (cid:101)Ei ∩ (cid:98)Ei| | (cid:98)Ei| ) = E(| (cid:101)Ei ∩ (cid:98)Ei|) | (cid:98)Ei| = | (cid:98)Ei| |V| K | (cid:98)Ei| = K N E(P@Ki|d) = E( | (cid:101)Ei ∩ (cid:98)Ei| K ) = E(| (cid:101)Ei ∩ (cid:98)Ei|) K = | (cid:98)Ei| |V| K K = αd N E(F1@Ki|d) = E( 2| (cid:101)Ei ∩ (cid:98)Ei| K + | (cid:98)Ei| ) = 2E(| (cid:101)Ei ∩ (cid:98)Ei|) K + αd = 2K N αd K + αd Proof. E(N@Ki|d) = E( (cid:80)K 1[vφk ∈( (cid:101)Ei∩ (cid:98)Ei)] log2(k+1) k=1 (cid:80)K k=1 log2(k + 1) ) = E((cid:80)K k=1 (cid:80)K k=1 1[vφk ∈( (cid:101)Ei∩ (cid:98)Ei)] log2(k+1) 1 log2(k+1) ) (12) (13) (14) (15) (16) (17) (18) (19) To calculate the numerator DCG, i.e., E((cid:80)K diction procedure as 1) randomly select K nodes from the whole node space V; 2) calculate | (cid:101)Ei ∩ (cid:98)Ei|, i.e., how many nodes among the selected nodes (cid:101)Ei are in the ground-truth neighborhood list (cid:98)Ei; 3) randomly select | (cid:101)Ei ∩ (cid:98)Ei| slots to position nodes in (cid:101)Ei ∩ (cid:98)Ei and calculate DCG. The above steps can be mathematically formulated as: ) in Eq. (19), we model the link pre- 1[vφk ∈( (cid:101)Ei∩ (cid:98)Ei)] log2(k+1) k=1 K (cid:88) i=0 C(N − αd, K − i)C(αd, i) C(N, K) C(K,i) (cid:88) j=1 18 p(O(K,i) j ) K (cid:88) k=1 1[O(K,i) jk = 1] log2(k + 1) , (20) Preprint where O(K,i) ∈ {0, 1}C(K,i)×K represents all C(K, i) possible positional indices of putting i nodes into K candidate slots. Specifically O(K,i) ∈ {0, 1}K indicates the jth positional configuration of i nodes where O(K,i) jk = 1 if an node is positioned at kth slot and O(K,i) jk = 0 otherwise. Since our link predictor has no bias in positioning nodes in the K slots by Lemma 1, we have p(O(K,i) and Eq. (20) can be transformed as: ) = 1 C(K,i) j j K (cid:88) i=0 C(N − αd, K − i)C(αd, i) C(N, K) 1 C(K, i) C(K,i) (cid:88) K (cid:88) j=1 k=1 1[O(K,i) jk = 1] log2(k + 1) . (21) We know that only when the kth slot is positioned a node can we have O(K,i) jk = 1 and among the total C(K, i) selections, every candidate slot k ∈ {1, 2, ..., K} would be selected C(K − 1, i − 1) times to position a node, which hence leads to: C(K,i) (cid:88) K (cid:88) j=1 k=1 1[O(K,i) jk = 1] log2(k + 1) = K (cid:88) k=1 C(K − 1, i − 1) log2(k + 1) . We then substitute Eq. (22) into Eq. (21) as: K (cid:88) i=0 C(N − αd, K − i)C(αd, i) C(N, K) 1 C(K, i) K (cid:88) k=1 C(K − 1, i − 1) log2(k + 1) = K (cid:88) i=0 C(N − αd, K − i)C(αd, i) C(N, K) C(K − 1, i − 1) C(K, i) K (cid:88) k=1 1 log2(k + 1) . Further substituting Eq. (23) into Eq. (19), we finally get: E(N@K|di) = = = K (cid:88) i=0 K (cid:88) i=0 C(N − αd, K − i)C(αd, i) C(N, K) C(K − 1, i − 1) C(K, i) C(N − αd, K − i)C(αd, i) C(N, K) (K−1)! (i−1)!(K−i)! K! i!(K−i)! 1 K K (cid:88) i i=0 (cid:124) C(N − αd, K − i)C(αd, i) C(N, K) (cid:123)(cid:122) E(| (cid:101)Ei∩ (cid:98)Ei|) (cid:125) = 1 K αd N ∗ K = αd N (22) (23) (24) Based on Theorem 3, Precision, F1, and NDCG increase as node degree increases even when no observed links are used to train the link predictor, which informs the degree-related evaluation bias and causes the illusion that high-degree nodes are more advantageous than low-degree ones observed in some previous works (Li et al., 2021; Rahmani et al., 2022). C.3 REWEIGHTING BY LP SCORE ENHANCE 1-LAYER TC Theorem 4. Taking the normalization term g(|H1 i | and also assume that that higher link prediction score Sij between vi and its neighbor vj corresponds to more number of connections between vj and the neighborhood N Tr | > |N 1,Tr k , i.e., Sij > Sik → |N 1,Tr |, ∀vj, vk ∈ N Tr,1 j |) = |H1 , then we have: ∩ N 1,Tr i ∩ N 1,Tr i i |, |H1 j i i (cid:98)C 1,Tr i = (cid:88) vj ∼N Tr i Sij|H1 i ∩ H1 j | |H1 i | ≥ E vj ∼N Tr i |H1 i ∩ H1 j | |H1 i | = C 1,Tr i (25) 19 Preprint Proof. By definition, we have H1 as: i = N 1,Tr i , then the computation of 1-layer TCTr is transformed C 1,Tr i = E vj ∼N Tr i I(S 1 i , S 1 j ) = E vj ∼N Tr i |N Tr i ∩ N Tr j |N Tr i | | = 1 |N Tr i | E vj ∼N Tr i (|N Tr i ∩ N Tr j |). (26) On the other hand, we also transform weighted TC as: (cid:98)C 1,Tr i = 1 |N Tr i | (cid:88) vj ∼N Tr i (Sij|N Tr i ∩ N Tr j |). By the relation that: Sij > Sik → |N 1,Tr j ∩ N 1,Tr i | > |N 1,Tr k ∩ N 1,Tr i |, ∀vj, vk ∈ N Tr,1 i , Then we have: i ≥ C 1,Tr (cid:98)C 1,Tr i (27) (28) (29) Moreover, we include Figure 9 to illustrate the idea of enhancing TC via assigning higher weights to edges connecting neighbors that have higher connections to the whole neighborhoods. We can see in this case, weighted TC in Figure 9(a) is naturally higher than the one in Figure 9(b) Figure 9: (a) Increase the weight of neighbors that have more connections with the whole neigh- borhood while (b) increase the weight of neighbors that have fewer connections with the whole neighborhood. (a) would increase the weighted TC while (b) would not D EXAMPLE DEMONSTRATING THE ADVANTAGES OF TC OVER LCC According to the definition of local clustering coefficient (LCC) and TC, we respectively calculate their values for node v1 in Figure 10. v2, v3, v4 do not have any connec- tion among themselves, indicating node v1 prefer inter- acting with nodes coming from significantly different do- main/community. Subsequently, the incoming neighbors v5, v6 of v1 are likely to also come from other communi- ties and hence share no connections with v2, v3, v4, which leads to the ill topological condition for predicting links of v1. However, in this case, the clustering coefficient still maintains 0.5 because of the connections between v1 and v2/v3/v4, which cannot precisely capture the ill-topology of v1 in this case. Conversely, our TCTr equals 0, reflect- ing the ill topological condition of v1. 20 Figure 10: Comparison of TC and LCC Preprint E DATASETS AND EXPERIMENTAL SETTINGS This section introduces datasets and experimental settings used in this paper. E.1 DATASET INTRODUCTION AND STATISTICS We use five widely employed datasets for evaluating the link prediction task, including four citation networks: Cora, Citeseer, Pubmed, and Citation2, and 1 human social network Collab. We further introduce two real-world animal social networks, Reptile and Vole, based on animal interactions. • Cora/Citeseer/Pubmed: Following (Zhao et al., 2022; Chamberlain et al., 2022; Wang et al., 2023), we randomly split edges into 70%/10%/20% so that there is no topological distribution shift in these datasets. We use Hits@100 to evaluate the final performance. • Collab/Citation2: We leverage the default edge splitting from OGBL (Hu et al., 2020). These two datasets mimic the real-life link prediction scenario where testing edges later joined in the network than validation edges and further than training edges. This would cause the topological distribution shift observed in the Obs.3 of Section 3.3. For Collab, different from (Chamberlain et al., 2022; Wang et al., 2023), our setting does not allow validation edges to join the network for message-passing when evaluating link prediction performance. Therefore, the edges used for message-passing and supervision come from edges in the training set. • Reptile/Vole: we obtain the dataset from Network Repository (Rossi & Ahmed, 2015). To con- struct this network, a bipartite network was first constructed based on burrow use - an edge connecting a tortoise node to a burrow node indicated a burrow used by the individual. Social networks of desert tortoises were then constructed by the bipartite network into a single-mode projection of tortoise nodes. Node features are initialized by a trainable embedding layer, and we leverage the same edge splitting 70%/10%/20% as Cora/Citeseer/Pubmed for training/evaluation. Table 3: Statistic of datasets used for evaluating link prediction. Network Domain Citation Network Social Network Animal Network Dataset Cora Citeseer Pubmed Citation2 Collab Reptile Vole # Nodes 2,708 3,327 18,717 2,927,963 235,868 787 1480 # Edges 5,278 4,676 44,327 30,561,187 1,285,465 1232 3935 Split Type Random Random Random Time Time Random Random Metric Hits@100 Hits@100 Hits@100 MRR Hits@50 Hits@100 Hits@100 Split Ratio 70/10/20% 70/10/20% 70/10/20% Default Default 70/10/20% 70/10/20% E.2 HYPERPARAMETER DETAILS For all experiments, we select the best configuration on validation edges and report the model per- formance on testing edges. The search space for the hyperparameters of the GCN/SAGE/LightGCN baselines and their augmented variants GCNrw/SAGErw are: graph convolutional layer {1, 2, 3}, hidden dimension of graph encoder {64, 128, 256}, the learning rate of the encoder and predic- tor {0.001, 0.005, 0.01}, dropout {0.2, 0.5, 0.8}, training epoch {50, 100, 500, 1000}, batch size {256, 1152, 64 ∗ 1024} (Hu et al., 2020; Chamberlain et al., 2022; Wang et al., 2023), weights the update interval τ ∈ {1, 2, 10, 20, 50}, warm up epochs T warm ∈ α ∈ {0.5, 1, 2, 3, 4}, {1, 2, 5, 10, 30, 50}. For baseline NCN2, we directly run their code using their default best- performing configurations on Cora/Citeseer/Pubmed/Collab but for Citation2, due to memory lim- itation, we directly take the result from the original paper. We use cosine similarity metric as the similarity function φ in computing ATC. F ADDITIONAL RESULTS To demonstrate that the observations made previously in Section 3 can also generalize to other datasets, here we present the comprehensive results on all datasets we study in this paper as follows. F.1 LINK PREDICTION PERFORMANCE GROUPED BY TCTe 2https://github.com/GraphPKU/NeuralCommonNeighbor 21 Preprint Figure 11: LP performance grouped by TCTe for all nodes Figure 12: LP performance grouped by TCTe for low TCTe nodes 22 Preprint F.2 LINK PREDICTION PERFORMANCE GROUPED BY TCTr Figure 13: LP performance grouped by TCTr for all nodes Figure 14: LP performance grouped by TCTr for low TCTr nodes 23 Preprint F.3 LINK PREDICTION PERFORMANCE GROUPED BY DEGREETe Figure 15: LP performance grouped by DegreeTe for all nodes Figure 16: LP performance grouped by DegreeTe for low Test-Degree nodes 24 Preprint F.4 LINK PREDICTION PERFORMANCE GROUPED BY DEGREETr Figure 17: LP performance grouped by DegreeTr for all nodes Figure 18: LP performance grouped by DegreeTr for low DegreeTr nodes 25 Preprint F.5 RELATION BETWEEN LP PERFORMANCE AND TC AT GRAPH-LEVEL Figure 19: Relation between LP performance and TC at Graph-level F.6 RELATION BETWEEN TCTr AND TCTe Figure 20: Relation between TCTr and TCTe on Collab/Citation2 F.7 CORRELATION OF THE PERFORMANCE WITH TC AND DEGREE Here we present the comprehensive correlation of the performance with TCTr/TCVal/TCTe and DegreeTr. As the performance is evaluated under different K, we further define the absolute av- erage/the typical average correlation across different K values to reflect the absolute correlation strength/the consistency of the correlation average: Absolute Avg.X@K = 1 4 (cid:88) k∈{5,10,20,50} |X@k|, Basic Avg.X@K = 1 4 (cid:88) X@k k∈{5,10,20,50} 26 Preprint F.8 DIFFERENCE IN TC VS DIFFERENCE IN PERFORMANCE BEFORE/AFTER APPLYING REWEIGHTING Figure 21: Relation between TCTr and TCTe on Collab Figure 22: Relation between TCTr and TCTe on Collab 27 Preprint Table 4: The correlation between TCTr/TCVal/TCTe/DegreeTr and the GCN's LP performance on Collab. We note that the formal definitions of Absolute Avg. and Basic Avg. are provided in Section and they represent the average absolute and simple average correlation, respectively, across the range of @K for the given metric; these are also then calculated overall. @10 @20 @50 Absolute Avg. Basic Avg. TCTr TCVal TCTe DegreeTr DegreeVal DegreeTe Subgraph Density @5 Metric Precision 0.2252 0.1925 0.1353 0.0578 0.2601 0.2364 0.1733 0.0790 F1 0.2279 0.2427 0.2375 0.2206 NDCG 0.2296 0.2358 0.2156 0.1754 Recall HitsN 0.2057 0.1800 0.1328 0.0717 0.2044 MRR Precision 0.2573 0.2832 0.2788 0.2387 0.2425 0.2901 0.2991 0.2641 F1 0.2066 0.2330 0.2521 0.2624 NDCG 0.1742 0.2179 0.2428 0.2514 Recall HitsN 0.2445 0.2674 0.2720 0.2620 0.2350 MRR Precision 0.5184 0.5437 0.5107 0.4127 0.5858 0.6311 0.5964 0.4799 F1 0.5443 0.6282 0.6706 0.6902 NDCG 0.5644 0.6753 0.7324 0.7533 Recall HitsN 0.5272 0.5816 0.5924 0.5720 0.5085 MRR Precision -0.1261 -0.0829 0.0006 0.1440 F1 -0.1997 -0.1663 -0.0813 0.0812 NDCG -0.1822 -0.2017 -0.1985 -0.1750 -0.2183 -0.2288 -0.2118 -0.1681 Recall HitsN -0.1395 -0.1164 -0.0658 0.0055 -0.1349 MRR Precision 0.0047 0.0472 0.1117 0.2141 -0.0823 -0.0469 0.0200 0.1416 F1 NDCG -0.0608 -0.0803 -0.0838 -0.0736 -0.1203 -0.1296 -0.1269 -0.1100 Recall HitsN -0.0063 0.0171 0.0481 0.0848 -0.0108 MRR Precision 0.1075 0.1833 0.2924 0.4617 -0.0669 0.0043 0.1249 0.3375 F1 -0.034 -0.0723 -0.0814 -0.0668 NDCG -0.1678 -0.1856 -0.187 -0.1724 Recall HitsN 0.0785 0.1103 0.1407 0.1718 0.0727 MRR Precision 0.2199 0.1646 0.0875 -0.0073 0.2806 0.2259 0.1353 0.0161 F1 0.2811 0.2891 0.2748 0.2491 NDCG 0.2911 0.2783 0.2399 0.1834 Recall HitsN 0.2265 0.1842 0.1196 0.0423 0.2331 MRR 28 0.1527 0.1872 0.2322 0.2141 0.1476 0.2044 0.1867 0.2645 0.2740 0.2385 0.2216 0.2615 0.2350 0.2520 0.4964 0.5733 0.6333 0.6814 0.5683 0.5085 0.5905 0.0884 0.1321 0.1894 0.2068 0.0818 -0.1349 0.1397 0.0944 0.0727 0.0746 0.1217 0.0391 -0.0108 0.0805 0.2612 0.1334 0.0636 0.1782 0.1253 0.0727 0.1524 0.1198 0.1645 0.2735 0.2482 0.1432 0.2331 0.1898 0.1527 0.1872 0.2322 0.2141 0.1476 0.2044 0.1867 0.2645 0.2740 0.2385 0.2216 0.2615 0.2350 0.2520 0.4964 0.5733 0.6333 0.6814 0.5683 0.5085 0.5905 -0.0161 -0.0915 -0.1894 -0.2068 -0.0791 -0.1349 -0.1166 0.0944 0.0081 -0.0746 -0.1217 0.0359 -0.0108 -0.0116 0.2612 0.1000 -0.0636 -0.1782 0.1253 0.0727 0.0489 0.1162 0.1645 0.2735 0.2482 0.1432 0.2331 0.1891 Preprint Table 5: The correlation between TCTr/TCVal/TCTe/DegreeTr and the GCN's LP performance on Citation2. We note that the formal definitions of Absolute Avg. and Basic Avg. are provided in Section and they represent the average absolute and simple average correlation, respectively, across the range of @K for the given metric; these are also then calculated overall. @10 @20 @50 Absolute Avg. Basic Avg. TCTr TCVal TCTe DegreeTr DegreeVal DegreeTe Subgraph Density @5 Metric Precision 0.0839 0.1312 0.1784 0.2157 0.0849 0.1323 0.1795 0.2165 F1 0.0773 0.1164 0.1585 0.2012 NDCG 0.0860 0.1346 0.1845 0.2265 Recall HitsN 0.0840 0.1314 0.1791 0.2182 0.1229 MRR Precision 0.0575 0.0868 0.1200 0.1479 0.0581 0.0874 0.1206 0.1484 F1 0.0545 0.0790 0.1078 0.1377 NDCG 0.0586 0.0884 0.1231 0.1540 Recall HitsN 0.0574 0.0870 0.1206 0.1500 0.0846 MRR Precision 0.1797 0.2541 0.3313 0.3996 0.1812 0.2558 0.3328 0.4008 F1 0.1706 0.2365 0.3071 0.3825 NDCG 0.1829 0.2599 0.3401 0.4141 Recall HitsN 0.1797 0.2550 0.3331 0.4048 0.2512 MRR Precision -0.0288 -0.0406 -0.0536 -0.0689 F1 -0.0295 -0.0415 -0.0546 -0.0699 NDCG -0.0285 -0.0394 -0.0522 -0.0692 -0.0305 -0.0436 -0.0589 -0.0791 Recall HitsN -0.0289 -0.0408 -0.0540 -0.0708 -0.0421 MRR Precision 0.0161 0.0229 0.0300 0.0393 0.0156 0.0220 0.0289 0.0381 F1 0.0150 0.0199 0.0248 0.0305 NDCG 0.0150 0.0203 0.0252 0.0301 Recall HitsN 0.0161 0.0232 0.0300 0.0384 0.0234 MRR Precision 0.0060 0.0113 0.0190 0.0364 F1 -0.0009 0.0047 0.0128 0.0314 NDCG -0.0086 -0.0113 -0.0147 -0.0185 -0.0135 -0.0185 -0.0251 -0.0344 Recall HitsN 0.0051 0.0081 0.0120 0.0159 0.0104 MRR Precision 0.0809 0.1217 0.1607 0.1916 0.0823 0.1231 0.1621 0.1926 F1 0.0761 0.1111 0.1476 0.1853 NDCG 0.0842 0.1268 0.1691 0.2063 Recall HitsN 0.0811 0.1219 0.1618 0.1956 0.1144 MRR 29 0.1523 0.1533 0.1384 0.1579 0.1532 0.1229 0.1510 0.1031 0.1036 0.0948 0.1060 0.1038 0.0846 0.1022 0.2912 0.2927 0.2742 0.2993 0.2932 0.2512 0.2901 0.0480 0.0489 0.0473 0.0530 0.0486 -0.0421 0.0492 0.0271 0.0262 0.0226 0.0227 0.0269 0.0234 0.0251 0.0182 0.0125 0.0133 0.0229 0.0103 0.0104 0.0154 0.1387 0.1400 0.1300 0.1466 0.1401 0.1144 0.1391 0.1523 0.1533 0.1384 0.1579 0.1532 0.1229 0.1510 0.1031 0.1036 0.0948 0.1060 0.1038 0.0846 0.1022 0.2912 0.2927 0.2742 0.2993 0.2932 0.2512 0.2901 -0.0480 -0.0489 -0.0473 -0.0530 -0.0486 -0.0421 0.0492 0.0271 0.0262 0.0226 0.0227 0.0269 0.0234 0.0251 0.0182 0.0120 -0.0133 -0.0229 0.0103 0.0104 0.0009 0.1387 0.1400 0.1300 0.1466 0.1401 0.1144 0.1391 Preprint Table 6: The correlation between TCTr/TCVal/TCTe/DegreeTr and the GCN's LP performance on Cora. We note that the formal definitions of Absolute Avg. and Basic Avg. are provided in Sec- tion and they represent the average absolute and simple average correlation, respectively, across the range of @K for the given metric; these are also then calculated overall. @10 @20 @50 Absolute Avg. Basic Avg. TCTr TCVal TCTe DegreeTr DegreeVal DegreeTe Subgraph Density @5 Metric Precision 0.0985 0.1046 0.1238 0.1571 0.0989 0.1042 0.1239 0.1597 F1 0.0933 0.0990 0.1088 0.1306 NDCG 0.1020 0.1042 0.1162 0.1568 Recall HitsN 0.0961 0.1000 0.1226 0.1617 0.0869 MRR Precision 0.0342 0.0456 0.0840 0.0903 0.0296 0.0406 0.0820 0.0907 F1 0.0215 0.0259 0.0446 0.0526 NDCG 0.0257 0.0322 0.0724 0.0841 Recall HitsN 0.0331 0.0413 0.0742 0.0932 0.0291 MRR Precision 0.4694 0.4702 0.4667 0.3977 0.4952 0.4964 0.4948 0.4216 F1 0.4970 0.5239 0.5551 0.5759 NDCG 0.4941 0.5109 0.5448 0.5347 Recall HitsN 0.4749 0.4909 0.5130 0.4866 0.4920 MRR Precision 0.0751 0.0970 0.1701 0.3268 F1 -0.0039 0.0237 0.0938 0.2549 NDCG -0.0156 -0.0276 -0.0283 -0.0191 -0.0432 -0.0547 -0.0568 -0.0529 Recall HitsN 0.0656 0.0650 0.0862 0.1135 0.0307 MRR Precision 0.0433 0.0623 0.1138 0.2248 -0.0230 0.0012 0.0508 0.1634 F1 NDCG -0.0235 -0.0336 -0.0369 -0.0361 -0.0570 -0.0648 -0.0689 -0.0784 Recall HitsN 0.0253 0.0222 0.0308 0.0431 0.0144 MRR Precision 0.1669 0.2104 0.3046 0.4890 0.0537 0.1111 0.2127 0.4149 F1 0.0004 -0.0104 -0.0082 0.0060 NDCG -0.0599 -0.0702 -0.0760 -0.0781 Recall HitsN 0.1406 0.1487 0.1624 0.1865 0.1116 MRR Precision 0.0794 0.0900 0.0796 0.0381 0.1088 0.1189 0.1066 0.0580 F1 0.1157 0.1378 0.1543 0.1674 NDCG 0.1330 0.1690 0.2015 0.2272 Recall HitsN 0.0851 0.1109 0.1257 0.1385 0.0976 MRR 30 0.1210 0.1217 0.1079 0.1198 0.1201 0.0869 0.1181 0.0635 0.0607 0.0362 0.0536 0.0605 0.0291 0.0549 0.4510 0.4770 0.5380 0.5211 0.4914 0.4920 0.4957 0.1673 0.0941 0.0227 0.0519 0.0826 0.0307 0.0837 0.1111 0.0596 0.0325 0.0673 0.0304 0.0144 0.0602 0.2927 0.1981 0.0063 0.0711 0.1596 0.1116 0.1455 0.0718 0.0981 0.1438 0.1827 0.1151 0.0976 0.1223 0.1210 0.1217 0.1079 0.1198 0.1201 0.0869 0.1181 0.0635 0.0607 0.0362 0.0536 0.0605 0.0291 0.0549 0.4510 0.4770 0.5380 0.5211 0.4914 0.4920 0.4957 0.1673 0.0921 -0.0227 -0.0519 0.0826 0.0307 0.0837 0.1111 0.0481 -0.0325 -0.0673 0.0304 0.0144 0.0179 0.2927 0.1981 -0.0031 -0.0711 0.1596 0.1116 0.1153 0.0718 0.0981 0.1438 0.1827 0.1151 0.0976 0.1223 Preprint Table 7: The correlation between TCTr/TCVal/TCTe/DegreeTr and the GCN's LP performance on Citeseer. We note that the formal definitions of Absolute Avg. and Basic Avg. are provided in Section and they represent the average absolute and simple average correlation, respectively, across the range of @K for the given metric; these are also then calculated overall. @5 @10 @20 @50 Absolute Avg. Basic Avg. TCTr TCVal TCTe DegreeTr DegreeVal DegreeTe Subgraph Density Metric Precision 0.3330 0.3735 0.3898 0.3830 F1 0.3324 0.3803 0.4056 0.4049 NDCG 0.2831 0.3226 0.3570 0.3879 0.3001 0.3481 0.3920 0.4295 Recall HitsN 0.3386 0.3901 0.4287 0.4603 0.3194 MRR Precision 0.2796 0.2962 0.3224 0.3229 F1 0.2756 0.2947 0.3291 0.3365 NDCG 0.2508 0.2662 0.2929 0.3118 0.2491 0.2585 0.2928 0.3086 Recall HitsN 0.2801 0.3049 0.338 0.3496 0.2763 MRR Precision 0.6786 0.698 0.6745 0.6220 F1 0.7157 0.7385 0.7207 0.6678 NDCG 0.7037 0.7540 0.7946 0.8300 0.7299 0.7797 0.8258 0.8588 Recall HitsN 0.7127 0.7595 0.7979 0.8216 0.7070 MRR Precision 0.2472 0.3523 0.4591 0.5861 F1 0.1867 0.2727 0.3872 0.5408 NDCG 0.1303 0.1645 0.2022 0.2475 0.1144 0.1532 0.2047 0.2591 Recall HitsN 0.2538 0.3181 0.3581 0.3886 0.2227 MRR Precision 0.1431 0.1866 0.2255 0.277 0.1147 0.1582 0.2053 0.2693 F1 NDCG 0.0845 0.1014 0.1194 0.1429 0.0693 0.0880 0.1113 0.1411 Recall HitsN 0.1438 0.1683 0.1857 0.2148 0.1366 MRR Precision 0.3052 0.4412 0.5704 0.7223 F1 0.1919 0.3133 0.4639 0.6597 NDCG 0.0949 0.1220 0.1548 0.1975 0.0323 0.0562 0.0909 0.1314 Recall HitsN 0.2745 0.3258 0.3378 0.3369 0.2444 MRR Precision 0.1559 0.1412 0.1168 0.0858 0.1867 0.1699 0.1420 0.1035 F1 NDCG 0.2006 0.2097 0.2176 0.2235 0.2218 0.2289 0.2411 0.2491 Recall HitsN 0.1768 0.1799 0.1982 0.2097 0.1759 MRR 31 0.3698 0.3808 0.3377 0.3674 0.4044 0.3194 0.3720 0.3053 0.3090 0.2804 0.2773 0.3182 0.2763 0.2980 0.6683 0.7107 0.7706 0.7986 0.7729 0.7070 0.7442 0.4112 0.3469 0.1861 0.1829 0.3297 0.2227 0.2913 0.2081 0.1869 0.1121 0.1024 0.1782 0.1366 0.1575 0.5098 0.4072 0.1423 0.0777 0.3188 0.2444 0.2911 0.1249 0.1505 0.2129 0.2352 0.1912 0.1759 0.1829 0.3698 0.3808 0.3377 0.3674 0.4044 0.3194 0.3720 0.3053 0.3090 0.2804 0.2773 0.3182 0.2763 0.2980 0.6683 0.7107 0.7706 0.7986 0.7729 0.7070 0.7442 0.4112 0.3469 0.1861 0.1829 0.3297 0.2227 0.2913 0.2081 0.1869 0.1121 0.1024 0.1782 0.1366 0.1575 0.5098 0.4072 0.1423 0.0777 0.3188 0.2444 0.2911 0.1249 0.1505 0.2129 0.2352 0.1912 0.1759 0.1829 Preprint Table 8: The correlation between TCTr/TCVal/TCTe/DegreeTr and the GCN's LP performance on Pubmed. We note that the formal definitions of Absolute Avg. and Basic Avg. are provided in Section and they represent the average absolute and simple average correlation, respectively, across the range of @K for the given metric; these are also then calculated overall. @10 @20 @50 Absolute Avg. Basic Avg. TCTr TCVal TCTe DegreeTr DegreeVal DegreeTe Subgraph Density @5 Metric Precision 0.1981 0.2358 0.2681 0.2924 0.1690 0.2216 0.2652 0.2961 F1 0.1195 0.1379 0.1600 0.1831 NDCG 0.0917 0.1142 0.1336 0.1397 Recall HitsN 0.1932 0.2267 0.2485 0.2513 0.1920 MRR Precision 0.1769 0.2180 0.2653 0.3134 0.1253 0.1815 0.2462 0.3092 F1 0.0780 0.0846 0.1046 0.1303 NDCG 0.0417 0.0503 0.0672 0.0804 Recall HitsN 0.1627 0.1882 0.2068 0.2077 0.1607 MRR Precision 0.3769 0.3989 0.4078 0.3909 0.4011 0.4258 0.4329 0.4088 F1 0.3902 0.4231 0.4547 0.4870 NDCG 0.3809 0.4080 0.4286 0.4335 Recall HitsN 0.3923 0.4247 0.4463 0.4436 0.4097 MRR Precision 0.2433 0.3108 0.3761 0.4849 0.1019 0.1970 0.2987 0.4456 F1 0.0477 0.0366 0.0441 0.0715 NDCG -0.0402 -0.0386 -0.0385 -0.0357 Recall HitsN 0.2080 0.2404 0.2504 0.2612 0.2051 MRR Precision 0.1823 0.2290 0.2849 0.3681 0.0676 0.1368 0.2220 0.3359 F1 0.0293 0.0164 0.0221 0.0407 NDCG -0.0429 -0.0466 -0.0459 -0.0476 Recall HitsN 0.1536 0.1749 0.1831 0.1872 0.1573 MRR Precision 0.3073 0.3898 0.4719 0.6133 0.1251 0.2423 0.3716 0.5624 F1 0.0588 0.0406 0.0480 0.0821 NDCG -0.0537 -0.0565 -0.0605 -0.0575 Recall HitsN 0.2615 0.2966 0.3030 0.3099 0.2556 MRR Precision 0.1002 0.0746 0.0414 -0.0146 0.1732 0.1319 0.0792 0.0030 F1 0.2146 0.2307 0.2357 0.2344 NDCG 0.2475 0.2547 0.2540 0.2428 Recall HitsN 0.1343 0.1330 0.1338 0.1288 0.1430 MRR 32 0.2486 0.2380 0.1501 0.1198 0.2299 0.1920 0.1973 0.2434 0.2156 0.0994 0.0599 0.1914 0.1607 0.1619 0.3936 0.4172 0.4388 0.4128 0.4267 0.4097 0.4178 0.3538 0.2608 0.0500 0.0383 0.2400 0.2051 0.1886 0.2661 0.1906 0.0271 0.0458 0.1747 0.1573 0.1408 0.4456 0.3254 0.0574 0.0571 0.2928 0.2556 0.2356 0.0577 0.0968 0.2289 0.2498 0.1325 0.1430 0.1531 0.2486 0.2380 0.1501 0.1198 0.2299 0.1920 0.1973 0.2434 0.2156 0.0994 0.0599 0.1914 0.1607 0.1619 0.3936 0.4172 0.4388 0.4128 0.4267 0.4097 0.4178 0.3538 0.2608 0.0500 -0.0383 0.2400 0.2051 0.1733 0.2661 0.1906 0.0271 -0.0458 0.1747 0.1573 0.1225 0.4456 0.3254 0.0574 -0.0571 0.2928 0.2556 0.2128 0.0504 0.0968 0.2289 0.2498 0.1325 0.1430 0.1517 Preprint Table 9: The correlation between TCTr/TCVal/TCTe/DegreeTr and the GCN's LP performance on Vole. We note that the formal definitions of Absolute Avg. and Basic Avg. are provided in Sec- tion and they represent the average absolute and simple average correlation, respectively, across the range of @K for the given metric; these are also then calculated overall. @10 @20 @50 Absolute Avg. Basic Avg. TCTr TCVal TCTe DegreeTr DegreeVal DegreeTe Subgraph Density @5 Metric Precision 0.2725 0.2710 0.2648 0.2287 0.2985 0.2981 0.2869 0.2401 F1 0.2714 0.3012 0.3300 0.3497 NDCG 0.2946 0.3267 0.3677 0.3917 Recall HitsN 0.3113 0.3307 0.3694 0.3988 0.2721 MRR Precision 0.1375 0.1717 0.1847 0.1721 0.1233 0.1690 0.1871 0.1739 F1 0.0931 0.1201 0.1403 0.1479 NDCG 0.0825 0.1251 0.1570 0.1548 Recall HitsN 0.1347 0.1558 0.1815 0.1814 0.1219 MRR Precision 0.5547 0.4822 0.3937 0.2527 0.6498 0.5597 0.4449 0.2742 F1 0.7395 0.7712 0.7954 0.8030 NDCG 0.7325 0.7384 0.7367 0.6812 Recall HitsN 0.6470 0.6529 0.6452 0.6016 0.6950 MRR Precision 0.2103 0.2728 0.3620 0.4508 0.1387 0.2253 0.3391 0.4508 F1 0.0180 0.0352 0.0760 0.1222 NDCG 0.0238 0.0479 0.1111 0.1993 Recall HitsN 0.1688 0.1977 0.2551 0.2989 0.0512 MRR Precision 0.0312 0.0747 0.1182 0.1758 -0.0135 0.0414 0.0989 0.1685 F1 NDCG -0.0527 -0.0455 -0.0336 -0.0153 -0.0670 -0.0487 -0.0309 0.0059 Recall HitsN 0.0077 0.0180 0.0368 0.0599 -0.0215 MRR Precision 0.3731 0.5111 0.6562 0.8126 0.2040 0.3944 0.5926 0.7916 F1 0.0004 0.0257 0.0722 0.1330 NDCG -0.0942 -0.0697 -0.0301 0.0419 Recall HitsN 0.2320 0.2604 0.2731 0.2529 0.1642 MRR Precision 0.0744 0.0369 -0.0119 -0.0815 0.1372 0.0860 0.0187 -0.0689 F1 0.2205 0.2341 0.2398 0.2398 NDCG 0.2178 0.2366 0.2495 0.2545 Recall HitsN 0.1206 0.1493 0.1688 0.2138 0.2026 MRR 33 0.2593 0.2809 0.3131 0.3452 0.3526 0.2721 0.3102 0.1665 0.1633 0.1254 0.1299 0.1634 0.1219 0.1497 0.4208 0.4822 0.7773 0.7222 0.6367 0.6950 0.6078 0.3240 0.2885 0.0629 0.0955 0.2301 0.0512 0.2002 0.1000 0.0806 0.0368 0.0381 0.0306 -0.0215 0.0572 0.5883 0.4957 0.0578 0.0590 0.2546 0.1642 0.2911 0.0512 0.0777 0.2336 0.2396 0.1631 0.2026 0.1530 0.2593 0.2809 0.3131 0.3452 0.3526 0.2721 0.3102 0.1665 0.1633 0.1254 0.1299 0.1634 0.1219 0.1497 0.4208 0.4822 0.7773 0.7222 0.6367 0.6950 0.6078 0.3240 0.2885 0.0629 0.0955 0.2301 0.0512 0.2002 0.1000 0.0738 -0.0368 -0.0352 0.0306 -0.0215 0.0265 0.5883 0.4957 0.0578 -0.0380 0.2546 0.1642 0.2717 0.0045 0.0433 0.2336 0.2396 0.1631 0.2026 0.1368 Preprint Table 10: The correlation between TCTr/TCVal/TCTe/DegreeTr and the GCN's LP performance on Reptile. We note that the formal definitions of Absolute Avg. and Basic Avg. are provided in Section and they represent the average absolute and simple average correlation, respectively, across the range of @K for the given metric; these are also then calculated overall. @5 @10 @20 @50 Absolute Avg. Basic Avg. TCTr TCVal TCTe DegreeTr DegreeVal DegreeTe Subgraph Density Metric Precision 0.5189 0.5084 0.4977 0.5009 F1 0.5420 0.5307 0.5146 0.5090 NDCG 0.5298 0.5502 0.5636 0.5741 0.5097 0.5176 0.5343 0.5475 Recall HitsN 0.5208 0.5278 0.5407 0.5502 0.5300 MRR Precision 0.3994 0.4316 0.4550 0.4647 F1 0.3753 0.4250 0.4573 0.4670 NDCG 0.3183 0.3535 0.3790 0.3909 0.2670 0.3085 0.3525 0.3744 Recall HitsN 0.3213 0.3483 0.3675 0.3840 0.3666 MRR Precision 0.7083 0.7000 0.6739 0.6506 F1 0.7898 0.7629 0.7138 0.6678 NDCG 0.8475 0.8897 0.9029 0.9072 0.8573 0.8858 0.8931 0.8759 Recall HitsN 0.8276 0.8566 0.8604 0.8495 0.8163 MRR Precision 0.4998 0.5294 0.5664 0.5947 F1 0.5082 0.5411 0.5788 0.6017 NDCG 0.4247 0.4572 0.4914 0.5120 0.4338 0.4598 0.5201 0.5615 Recall HitsN 0.4998 0.5073 0.5391 0.5664 0.4369 MRR Precision 0.3185 0.3577 0.3797 0.3924 0.3022 0.3546 0.3840 0.3956 F1 NDCG 0.2285 0.2617 0.2858 0.2985 0.1997 0.2384 0.2830 0.3093 Recall HitsN 0.2729 0.2938 0.3165 0.3339 0.2677 MRR Precision 0.6833 0.7492 0.7935 0.8118 F1 0.5477 0.6726 0.7556 0.7968 NDCG 0.3062 0.3404 0.3676 0.3790 0.1840 0.2103 0.2429 0.2532 Recall HitsN 0.3940 0.3555 0.3381 0.3283 0.4468 MRR Precision 0.2482 0.2491 0.2211 0.2022 0.2943 0.2849 0.2420 0.2108 F1 NDCG 0.3560 0.3819 0.3792 0.3765 0.3588 0.3928 0.3777 0.3607 Recall HitsN 0.3440 0.3891 0.3837 0.3745 0.3510 MRR 34 0.5065 0.5241 0.5544 0.5273 0.5349 0.5300 0.5294 0.4377 0.4312 0.3604 0.3256 0.3553 0.3666 0.3820 0.6832 0.7336 0.8868 0.8780 0.8485 0.8163 0.8060 0.5476 0.5575 0.4713 0.4938 0.5282 0.4369 0.5197 0.3621 0.3591 0.2686 0.2576 0.3043 0.2677 0.3103 0.7595 0.6932 0.3483 0.2226 0.3540 0.4468 0.4755 0.2302 0.2580 0.3734 0.3725 0.3728 0.3510 0.3214 0.5065 0.5241 0.5544 0.5273 0.5349 0.5300 0.5294 0.4377 0.4312 0.3604 0.3256 0.3553 0.3666 0.3820 0.6832 0.7336 0.8868 0.8780 0.8485 0.8163 0.8060 0.5476 0.5575 0.4713 0.4938 0.5282 0.4369 0.5197 0.3621 0.3591 0.2686 0.2576 0.3043 0.2677 0.3103 0.7595 0.6932 0.3483 0.2226 0.3540 0.4468 0.4755 0.2302 0.2580 0.3734 0.3725 0.3728 0.3510 0.3214 Preprint G EDGE REWEIGHTING ALGORITHM Here we present our edge reweigting algorithm to enhance the link prediction performance by mod- ifying the graph adjacency matrix in message-passing. We normalize the adjacency matrix to get (cid:101)A and (cid:98)A as defined in the algorithm below. Algorithm 1: Edge Reweighting to Boost LP performance Input: The input training graph (A, X, E tr, D), graph encoder fΘf , link predictor gΘg , update interval ∆, training epochs T , warm up epochs T warm and weights γ for combining the original adjacency matrix and the updated adjacency matrix. 1 Compute the normalized adjacency matrices (cid:98)A = D−0.5AD−0.5, (cid:101)A = D−1A 2 (cid:101)A0 = (cid:101)A 3 for τ = 1, . . . , T do 4 5 6 7 8 9 10 11 12 13 14 15 if τ %∆ ̸= 0 and τ ≤ T warm then (cid:101)Aτ = (cid:101)Aτ −1 /* Message-passing and LP to update model parameters for mini-batch of edges E b ⊆ E tr do Sample negative edges E b,−, s.t., |E b,−| = |E b| Compute node embeddings Hτ = fΘτ −1 Compute link prediction scores Eτ Lb,τ = − 1 Update Θτ ( (cid:101)Aτ , X) (Hτ emn∈Eb,− log(1 − Eτ f ← Θτ −1 eij ∈Eb log Eτ g − ∇Θτ −1 |Eb| ((cid:80) g ← Θτ −1 ij = gΘτ −1 Lb,τ , Θτ ij + (cid:80) mn)) f − ∇Θτ −1 i , Hτ g f g f Lb,τ −1 j ), ∀(i, j) ∈ E b ∪ E tr /* Update adjacency matrix to enhance weighted TC if τ %∆ == 0 and τ > T warm then Compute node embeddings Hτ = fΘτ −1 Nτ = (cid:101)AHτ Compute the link prediction scores Sτ f ij = ( (cid:101)Aτ −1, X); then neighborhood embeddings (Nτ exp(gΘτ g j=1 exp(gΘτ g i ,Hτ (Nτ j )) i ,Hτ j )) (cid:80)n Update the adjacency matrix (cid:101)Aτ ← (cid:101)Aτ −1 + γSτ */ */ 16 Return: (cid:101)Aτ , fΘτ f , gΘτ g 35
http://arxiv.org/abs/2310.04610v2
"2023-10-11T23:15:43"
"2023-10-06T22:05:15"
DeepSpeed4Science Initiative: Enabling Large-Scale Scientific Discovery through Sophisticated AI System Technologies
In the upcoming decade, deep learning may revolutionize the natural sciences, enhancing our capacity to model and predict natural occurrences. This could herald a new era of scientific exploration, bringing significant advancements across sectors from drug development to renewable energy. To answer this call, we present DeepSpeed4Science initiative (deepspeed4science.ai) which aims to build unique capabilities through AI system technology innovations to help domain experts to unlock today's biggest science mysteries. By leveraging DeepSpeed's current technology pillars (training, inference and compression) as base technology enablers, DeepSpeed4Science will create a new set of AI system technologies tailored for accelerating scientific discoveries by addressing their unique complexity beyond the common technical approaches used for accelerating generic large language models (LLMs). In this paper, we showcase the early progress we made with DeepSpeed4Science in addressing two of the critical system challenges in structural biology research.
[ "Shuaiwen Leon Song", "Bonnie Kruft", "Minjia Zhang", "Conglong Li", "Shiyang Chen", "Chengming Zhang", "Masahiro Tanaka", "Xiaoxia Wu", "Jeff Rasley", "Ammar Ahmad Awan", "Connor Holmes", "Martin Cai", "Adam Ghanem", "Zhongzhu Zhou", "Yuxiong He", "Pete Luferenko", "Divya Kumar", "Jonathan Weyn", "Ruixiong Zhang", "Sylwester Klocek", "Volodymyr Vragov", "Mohammed AlQuraishi", "Gustaf Ahdritz", "Christina Floristean", "Cristina Negri", "Rao Kotamarthi", "Venkatram Vishwanath", "Arvind Ramanathan", "Sam Foreman", "Kyle Hippe", "Troy Arcomano", "Romit Maulik", "Maxim Zvyagin", "Alexander Brace", "Bin Zhang", "Cindy Orozco Bohorquez", "Austin Clyde", "Bharat Kale", "Danilo Perez-Rivera", "Heng Ma", "Carla M. Mann", "Michael Irvin", "J. Gregory Pauloski", "Logan Ward", "Valerie Hayot", "Murali Emani", "Zhen Xie", "Diangen Lin", "Maulik Shukla", "Ian Foster", "James J. Davis", "Michael E. Papka", "Thomas Brettin", "Prasanna Balaprakash", "Gina Tourassi", "John Gounley", "Heidi Hanson", "Thomas E Potok", "Massimiliano Lupo Pasini", "Kate Evans", "Dan Lu", "Dalton Lunga", "Junqi Yin", "Sajal Dash", "Feiyi Wang", "Mallikarjun Shankar", "Isaac Lyngaas", "Xiao Wang", "Guojing Cong", "Pei Zhang", "Ming Fan", "Siyan Liu", "Adolfy Hoisie", "Shinjae Yoo", "Yihui Ren", "William Tang", "Kyle Felker", "Alexey Svyatkovskiy", "Hang Liu", "Ashwin Aji", "Angela Dalton", "Michael Schulte", "Karl Schulz", "Yuntian Deng", "Weili Nie", "Josh Romero", "Christian Dallago", "Arash Vahdat", "Chaowei Xiao", "Thomas Gibbs", "Anima Anandkumar", "Rick Stevens" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04610v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04610v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.AI", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.AI", "cs.LG" ]
3 2 0 2 t c O 1 1 ] I A . s c [ 2 v 0 1 6 4 0 . 0 1 3 2 : v i X r a DeepSpeed4Science Initiative: Enabling Large-Scale Scientific Discovery through Sophisticated AI System Technologies Shuaiwen Leon Song1, Bonnie Kruft1, Minjia Zhang1, Conglong Li1, Shiyang Chen2, Chengming Zhang1, Masahiro Tanaka1, Xiaoxia Wu1, Jeff Rasley1, Ammar Ahmad Awan1, Connor Holmes1, Martin Cai1, Adam Ghanem3, Zhongzhu Zhou3, Yuxiong He1, Pete Luferenko1, Divya Kumar1, Jonathan Weyn1, Ruixiong Zhang1, Sylwester Klocek1, Volodymyr Vragov1, Mohammed AlQuraishi4, Gustaf Ahdritz5, Christina Floristean4, Cristina Negri6, Rao Kotamarthi6, Venkatram Vishwanath6, Arvind Ramanathan6, Sam Foreman6, Kyle Hippe6, Troy Arcomano6, Romit Maulik6, Maxim Zvyagin6, Alexander Brace6, Bin Zhang6, Cindy Orozco Bohorquez6, Austin Clyde6, Bharat Kale6, Danilo Perez-Rivera6, Heng Ma6, Carla M. Mann6, Michael Irvin6, J. Gregory Pauloski6, Logan Ward6, Valerie Hayot6, Murali Emani6, Zhen Xie6, Diangen Lin6, Maulik Shukla6, Ian Foster6, James J. Davis6, Michael E. Papka6, Thomas Brettin6, Prasanna Balaprakash8, Gina Tourassi8, John Gounley8, Heidi Hanson8, Thomas E Potok8, Massimiliano Lupo Pasini8, Kate Evans8, Dan Lu8, Dalton Lunga8, Junqi Yin8, Sajal Dash8, Feiyi Wang8, Mallikarjun Shankar8, Isaac Lyngaas8, Xiao Wang8, Guojing Cong8, Pei Zhang8, Ming Fan8, Siyan Liu8, Adolfy Hoisie9, Shinjae Yoo9, Yihui Ren9, William Tang10, Kyle Felker10, Alexey Svyatkovskiy10,1, Hang Liu2, Ashwin Aji11, Angela Dalton11, Michael Schulte11, Karl Schulz11, Yuntian Deng12, Weili Nie12, Josh Romero12, Christian Dallago12, Arash Vahdat12, Chaowei Xiao12, Thomas Gibbs12, Anima Anandkumar12, and Rick Stevens6,7 1Microsoft 2Rutgers University 3University of Sydney 4Columbia University 5Harvard University 6Argonne National Laboratory 7University of Chicago 8Oak Ridge National Laboratory 9Brookhaven National Laboratory 10Princeton University 11AMD 12NVIDIA 1 October 13, 2023 Abstract In the upcoming decade, deep learning may revolutionize the natural sciences, enhancing our capacity to model and predict natural occurrences. This could herald a new era of scientific exploration, bringing significant advancements across sectors from drug develop- ment to renewable energy. To answer this call, we present DeepSpeed4Science initiative (deepspeed4science.ai) which aims to build unique capabilities through AI system technol- ogy innovations to help domain experts to unlock today's biggest science mysteries. By leveraging DeepSpeed's current technology pillars (training, inference and compression) as base technology enablers, DeepSpeed4Science will create a new set of AI system technologies tailored for accelerating scientific discoveries by addressing their unique complexity beyond the common technical approaches used for accelerating generic large language models (LLMs). In this paper, we showcase the early progress we made with DeepSpeed4Science in addressing two of the critical system challenges in structural biology research. 1 Introduction In the next decade, deep learning may revolutionize the natural sciences, enhancing our capacity to model and predict natural occurrences. This could herald a new era of scientific exploration, bringing significant advancements across sectors from drug development to renewable energy. In line with Microsoft's mission to empower every person and every organization on the planet to achieve more, the DeepSpeed team at Microsoft is responding to this opportunity by launching a new initiative called DeepSpeed4Science, aiming to build unique capabilities through AI system technology innovations to help domain experts to unlock today's biggest science mysteries. The DeepSpeed system [1] is an industry leading open-source AI system framework, developed by Microsoft, that enables unprecedented scale and speed for deep learning training and inference on a wide range of AI hardware. Figure 1 demonstrates our basic approach to this new initiative. By leveraging DeepSpeed's current technology pillars (training, inference and compression) as base technology enablers, DeepSpeed4Science will create a new set of AI system technologies tailored for accelerating scientific discoveries by addressing their unique complexity beyond the common technical approaches used for accelerating generic large language models (LLMs). We work closely with internal and external teams who own AI-driven science models that represent key science missions, to identify and address general domain-specific AI system challenges. This includes climate science, drug design, biological understanding, molecular dynamics simulation, cancer diagnosis and surveillance, catalyst/material discovery, and other domains. Our long-term vision is to develop DeepSpeed4Science into a new platform and a unified repository for sharing advanced AI system technologies that support scientific discoveries. DeepSpeed4Science is designed to be inclusive, echoing Microsoft's AI for Good commitment. That is reflected in the initiative's support for a diverse group of signature science models, representing some of the most critical AI for science investments. In this paper, we showcase how DeepSpeed4Science helps address two of their critical system challenges in structural biology research: (1) eliminating memory explosion problems for scaling Evoformer-centric protein-structure prediction models, and (2) enabling very-long sequence support for better understanding the evolutionary landscape of pandemic-causing viruses. After the two showcases, we will give a brief overview of the current DeepSpeed4Science collaborators. 2 Figure 1: DeepSpeed4Science approach: developing a new set of AI system technologies that are beyond generic large language model support, tailored for accelerating scientific discoveries and addressing their complexity. 2 DS4Sci_EvoformerAttention: eliminating memory explo- sion problems for scaling Evoformer-centric structural biology models 2.1 Core Problem Description OpenFold [2] is a community reproduction of DeepMind's AlphaFold2 [3] that makes it possible to train or finetune AlphaFold2 on new datasets. Researchers have used it to retrain AlphaFold2 from scratch to produce new sets of model parameters, studied the early training phase of AlphaFold2, and developed new protein folding systems. While OpenFold does apply performance and memory optimizations using state-of-the-art system technologies, training AlphaFold2 from scratch is still computationally expensive. The model at the current stage is small in absolute terms, with just 93 million parameters, but it contains several custom attention variants that manifest unusually large activations. During the "finetuning" phase of a standard AlphaFold2 training run, the logit tensor produced in just one of these variants–one designed to attend over the deep protein MSAs fed to the model as input–is in excess of 12GB in half precision alone, dwarfing the peak memory requirements of comparably sized language models. Even with techniques like activation checkpointing and DeepSpeed ZeRO optimizations [4], this memory explosion problem heavily constrains the sequence lengths and MSA depths on which the model can be trained. Furthermore, approximation strategies can significantly affect the model accuracy and convergence, while still resulting in memory explosion, shown as the left bar (orange) in Figure 2. To address this common system challenge in structural biology research (e.g., protein 3 Figure 2: Peak memory requirement for training variants of the MSA attention kernels (with bias) with the maximum possible training sample dimension in OpenFold. (Left) The original OpenFold implementation with EvoformerAttention used in AlphaFold2. The memory explosion problems in training/inference these types of protein structure prediction models are common. Particularly, state-of-the-art FlashAttention cannot effectively support such science attention variants. (Right) A new solution from DeepSpeed4Science called DS4Sci_EvoformerAttention significantly reduces OpenFold's peak memory requirement for training by 13X without accuracy loss. structure prediction and equilibrium distribution prediction), DeepSpeed4Science is addressing this memory inefficiency problem by designing customized exact attention kernels for the attention variants (i.e., EvoformerAttention), which widely appear in this category of science models. Specifically, a set of highly memory-efficient DS4Sci_Evof ormerAttention kernels enabled by sophisticated fusion/tiling strategies and on-the-fly memory reduction methods, are created for the broader community as high-quality machine learning primitives. Incorporated into OpenFold, they provide a substantial speedup during training and dramatically reduce the model's peak memory requirement for training and inference. This allows OpenFold to be experimented with bigger and more complex models, and longer sequences, and trained on a wider spectrum of hardware. 2.2 Methodology The Evoformer-centric models such as OpenFold and others typically use four attention variants to process the 4D sequence tensors: MSA row-wise, MSA column-wise, and two kinds of Triangular. In particular, the input tensor is of shape (Nres, Nmsa, H, D), where Nmsa is the length of MSA sequences, Nres is the length of residue sequences, H is the number of attention heads, and D is the hidden dimension of the model. Figure 4 illustrates an example of MSA row-wise attention. The inputs consist of three projected tensors in shape (Nmsa, Nres, D), namely Q, K, and V , and a (Nres, Nres) bias matrix of residue pairs. In step 1, Q and K perform dot-product between every row vector along the D dimension, deriving the attention logits in shape (H, Nmsa, Nres, Nres) as the intermediate results. For simplicity, we only depict one head in the figure. Unlike language models such as GPT-3 [5], where D and H are considerably larger, Evoformer operates on a different scale. Specifically, MSA row-wise attention is typically designed with 8 heads, each having 8 features, while GPT-3 is configured with 96 heads and 128 features per head. However, MSA and residue sequence lengths can extend up to 5K 4 Figure 3: Peak memory requirement breakdown for training variants of the MSA attention kernels (with bias) with the maximum possible training sample dimension in OpenFold. (Left bar) the original OpenFold implementation with EvoformerAttention used in AlphaFold 2. The memory explosion problems in training/inference these types of protein structure prediction models are common. Particularly, FlashAttention cannot effectively support such science attention variants. (Right bar) Our DeepSpeed4Science-optimized solution significantly reduces the overall peak memory requirement. during training and inference, respectively, making the memory explosion for intermediate 2) memory footprint, and, similarly, results. MSA row-wise attention has the O(Nmsa ∗ Nres 2). In contrast, the for MSA column-wise attention, the memory footprint is O(Nres ∗ Nmsa memory footprint of language models is much smaller, approximately O(N 2). Figure 3 shows the breakdown of memory requirements per GPU. Existing techniques for long sequences cannot effectively address such memory explosion challenges in Evoformer's specialized attention for structural biology. For example, MSA row- wise attention and two Triangular attention apply a bias term to the attention logits, and the bias term's gradients are required during backward. As shown in step 2, the pair bias is derived by projecting the pair-wise representation and is used to adjust the attention logits based on the structure of residues to satisfy the spatial constraints. Take FlashAttention [6] as an example; it cannot integrate these backward-compatible bias terms directly. Furthermore, the bias requires appropriate broadcasting to match the shape of attention logits before adding. It thus also needs to be mirrored in backward computing. Recognizing these challenges, DeepSpeed4Science addresses this memory inefficiency problem by designing customized, exact attention kernels for these attention variants in EvoformerAttention and boosting the training/inference efficiency. Our customized highly memory-efficient DS4Sci_EvoformerAttention kernels fuses the four steps computation and calculates the attention logits in tiles. Specifically, in the forward kernel, each thread block computes a tile of (T ilex, T iley, T ilez) in the attention logit tensor. Each thread block loads the needed tiles from Q and K to perform the dot-product. The resultant tile is stored in registers and added with biases. Then, we perform softmax as step 3 and multiply V as step 4. We reduce the memory footprint by materializing only a subset of tiles in the 5 Figure 4: The example of MSA row-wise attention computation in OpenFold in four steps. The example shows the computation of one attention head, where the input Q, K, and V are 3D tensors and the pair bias is a matrix. Each attention head is associated with a 3D intermediate attention logit causing the memory explosion. We fuse four steps in one kernel to reduce peak memory usage. (Nmsa, Nres, Nres) tensor and not saving the whole tensor for backward. We perform steps 1-3 in the backward kernel to recompute the attention logits. The backward computation is similar to that of FlashAttention. In our kernels, we tune the tile size for better performance. Large tile size leads to more efficient memory access while incurring register spilling; We tune the tile size to be (64, 64, 1). The bias-adding needs to be effectively broadcasted to match the bias shape with the attention logits. For example, in MSA row-wise attention, the residue pair-wise representation in shape (Nmsa, Nres, D) is transformed to be the bias term in shape (H, Nmsa, Nres), while the attention logits tensor is of shape (H, Nmsa, Nres, Nres). To broadcast, the bias tensor will be repeated Nmsa times as the second dimension. Here, we cannot directly leverage the broadcast semantics in Pytorch because we use a fused CUDA kernel out of PyTorch. Besides, broadcasting in PyTorch requires the operation between two full tensors instead of tiles. Thus, we enabled on-the-fly broadcasting in the kernel; in particular, after calculating the attention logits after step 1. For example, a thread block loads a (T ilex, T iley) tile from the pair bias. The thread block for different heads with the same position of its tile in the attention logits will load the same bias tile. The loaded tile is added to the logits tile in registers. In backward, the gradient of the bias terms equals the gradient of attention logits. How- ever, we need to reverse the broadcast operation. That is, the gradients along the broadcast dimension need to be accumulated. Specifically, the shape of attention logits gradients is H, Nmsa, Nres, Nres and the bias gradient is computed similar to attn_grad.sum(0) in Pytorch. To reduce the memory footprint, we also fuse this operation into our kernel; otherwise, it needs the full attention logits gradient tensor. As described above, different thread blocks load the same bias tiles participants in the accumulation. Each thread block uses atomic-add operations when writing out its tile of gradients. To reduce the contention that multiple thread blocks are trying to write the same place, we schedule the thread block so that blocks executing on GPU's multiprocessors at the same wave write to different tiles. Furthermore, the accumulation could lead to potential accuracy issues due to the round-off error of low-precision arithmetic 6 operations, especially for bfloat16. Consequently, we convert the gradient to FP32 before adding and converting it back in another kernel if necessary. It also avoids using the slow atom.add.bf 16x2 instruction. For detailed DS4Sci_EvoformerAttention kernels source code release and tutorial, please visit our release blog. 3 DeepSpeed4Science Enables Very-Long Sequence Support via both Systematic and Algorithmic Approaches for Genome-scale Foundation Models 3.1 Core Problem Description GenSLMs [7], a 2022 ACM Gordon Bell award winning genome-scale language model from Argonne National Lab, can learn the evolutionary landscape of SARS-CoV-2 (COVID-19) genomes by adapting large language models (LLMs) for genomic data. It is designed to transform how new and emergent variants of pandemic-causing viruses, especially SARS-CoV-2, are identified and classified. GenSLM represents one of the first whole genome-scale foundation models which can generalize to other prediction tasks. A good understanding of the latent space can help GenSLMs tackle new domains beyond just viral sequences and expand their ability to model bacterial pathogens and even eukaryotic organisms, e.g., to understand things such as function, pathway membership, and evolutionary relationships. To achieve this scientific goal, GenSLMs and similar models require very long sequence support for both training and inference that is beyond generic LLMs' long-sequence strategies like FlashAttention. Through DeepSpeed4Science's new designs, scientists can now build and train models with significantly longer context windows, allowing them to explore relationships that were previously inaccessible. Despite the importance of supporting very long sequence lengths and efficient training for better understanding the genome latent space in models like GenSLMs, the existing large model training frameworks such as NVIDIA Megatron-LM [8] and old version of Megatron- DeepSpeed [9], and their corresponding parallelism choices do not have tailored optimizations for very long sequence training and inference. There are two main challenges with the existing frameworks. First, the existing parallelism approaches such as data, tensor, and pipeline parallelism cannot effectively address the scaling along the sequence dimension. Second, the existing large model training systems feature inferior training throughput when long sequences are required. For example, many scientists today use NVIDIA's Megatron-LM or the older version of Megatron-DeepSpeed to train their models. Megatron-DeepSpeed is the DeepSpeed version of NVIDIA's Megatron-LM. GenSLMs were previously trained with Megatron-DeepSpeed. However, the older version of Megatron-DeepSpeed misses many new acceleration opportunities including FlashAttention2 [10], new fused kernels and sequence parallelism. As shown in Figure 5, the maximum sequence lengths supported by the two state-of-the-art frameworks for the 33B GenSLM model are less than 60K, which is far from the requirements of the genome-scale foundation models. And even worse, they show very poor scalability in training. In this release, we are proud to introduce the new Megatron-DeepSpeed framework. We rebased and enabled DeepSpeed with the newest Megatron for long sequence support and other capabilities/optimizations. With the new Megatron-DeepSpeed, users can now train their large AI4Science models like GenSLMS with much longer sequences via a synergetic combination of our newly added memory optimization techniques on attention mask and position embedding, tensor parallelism, pipeline parallelism, sequence parallelism, ZeRO-style data parallelism and model state offloading. 7 Figure 5: Maximum sequence length support for the 33B GenSLM model. Figure 6: Attention mask operation. The key properties of our new Megatron-DeepSpeed and its design/optimizations released are as follows: • Enhancing Megatron-style sequence parallelism with our memory optimization techniques for attention mask and position embedding. • Rotary positional embedding, new fused kernels, and FlashAttention v1 and v2 are also enabled. • The overall training throughput is improved by up to 2x due to the newly enabled capability of processing larger batch sizes through the new Megatron-DeepSpeed framework. • An average of 13x longer sequence lengths are achieved compared to the state-of-the-art training frameworks, e.g., enabling training with sequences with over a million tokens. In the subsequent sections, we will provide a detailed discussion of rebasing efforts/achieve- ments, new Megatron-DeepSpeed core optimizations, experimental evaluation, and comparison analysis against the existing frameworks. 3.2 Rebase and Optimizations of Megatron-DeepSpeed Framework Megatron-DeepSpeed is a framework for training very large-scale LLMs. Since its release, the research community has adopted it for training various LLMs, including the BigScience BLOOM 176B model [11] and Argonne National Lab for GenSLMs. While containing a rich set of optimizations for training LLMs, new features and new demands are coming out rapidly such 8 that having a stable and up-to-date support of Megatron-DeepSpeed is critical for our community of users. For example, there have been more than 1300 new commits on the Megatron-LM side and 75 new commits from the DeepSpeed side since the original Megatron-DeepSpeed release. Therefore, incorporating these new changes and ensuring the robustness of the new framework becomes a fundamental requirement for our science collaborators who use this framework extensively. In this release, we have enabled the following capabilities: • We integrated several new features, including Megatron-style sequence parallelism, rotary positional embedding, FlashAttention v1 and v2, and new fused kernels from NVIDIA. • We included additional optimizations specially tailored for long sequence training, such as attention map optimization and position embedding partitioning (discussed next). • We fixed several conflicts during integration: (1) activation checkpointing where the new fine-grained partial checkpointing technique introduced by Megatron-LM was not compatible with DeepSpeed; (2) model checkpoint save/load when DeepSpeed was used with the newest Megatron-LM; and (3) major refactoring to DeepSpeed pipeline parallelism implementation for GPT models in order to work with the newest Megatron-LM. • We fully verified the performance and correctness of GPT pretraining after the rebasing. Even though the new Megatron-DeepSpeed has tensor, sequence, and pipeline parallelism, the maximum sequence length is still inadequate. Through profiling, we identified that attention mask and weights of position encoding are main memory bottlenecks. 3.3 Further Memory Optimizations in our New Megatron-DeepSpeed Based on the new rebase, we further enhance the Megatron-style sequence parallelism with our memory optimization techniques for attention mask and position embedding. 3.3.1 Memory-Efficient Generation of Attention Masks Attention mask allows models to only attend to the previous tokens (Figure 6). First, the reason why the attention mask is one of the main memory bottlenecks is because of its size: [s, s], where is the sequence length, making its memory complexity as O(s2). The size of the attention mask is over 10 GB when the sequence length (s) is larger than 50K (e.g., DNA sequences). Second, PyTorch pre-allocates at least 2X larger GPU memory when generating an attention mask. However, an attention mask is also very important when (1) users explicitly need it when there is no FlashAttention in their virtual environment; and (2) users may want to use customized attention masks to tune their models, not just using casual FlashAttention. As illustrated in Figure 7, our approach involves initially determining a sequence length threshold through extensive experimentation. This threshold is identified based on achieving optimal system performance while maintaining reasonable memory usage. If the sequence length is below this threshold, we proceed to directly generate an attention mask on the GPU. However, if the sequence length exceeds this threshold, we follow a process in which we initially generate it within CPU memory, perform the necessary operations, and subsequently transfer it to GPU memory. To prevent out-of-memory errors while ensuring consistently high performance, we then establish this threshold based on the underlying GPU hardware (e.g., 16K for A100 40G GPUs). 9 Figure 7: Generation strategy. Figure 8: Position embedding in Transformers. Table 1: Throughput comparison from the two frameworks on the 33B GenSLM dense model. Sequence New Megatron- Length DeepSpeed (TFLOPS) DeepSpeed (TFLOPS) Old Megatron- 2k 4k 8k 16k 32k 64k 128k 256k 25 (TP=32) 28 (TP=32) OOM OOM OOM OOM OOM OOM 68 (TP=32) 80 (TP=32) 86 (TP=32) 92 (TP=32) 100 (TP=32) 106 (TP=32) 119 (TP=32) 94 (TP=32) 3.3.2 Weights Parallelization of Position Embedding As shown in Figure 8, position embeddings are used to identify each token's position in the list of tokens. The size of weights of position embedding is [s, d], where s is sequence length and d is the hidden dimension; it is linearly scaled with the sequence length. In the original Megatron-LM's design, each GPU holds a replica of these weights. Training these weights will result in the same size of gradients and m times of the optimizer states (i.e., m is determined by PyTorch). For example, the overall memory consumption is approximately 10 GB per GPU when DNA sequence lengths are longer than 100K. As shown in Figure 9. Our method is to split weights across all GPUs when enabling sequence parallelism. Each GPU just needs to hold [s/p, d] partial weights. Thus, we reduce GPU memory consumption by p times, where p is the number of GPUs. 3.3.3 Algorithmic Support: Relative Position Embedding Some users may expect a model to achieve extrapolation at inference time for sequences that are longer than it saw during training. We would use relative position embedding [12] (e.g., attention with linear biases) to let users train large language models with shorter sequences, but the trained model can infer much longer sequences. 10 Figure 9: Memory overhead comparison between baseline and the optimized version via paral- lelizing position embedding. Figure 10: Maximum sequence lengths of 33B GenSLM models supported by different frameworks at different scales. The hardware profiled here are NVIDIA DGX nodes with eight 40G A100 GPUs per node. 3.4 Performance Improvement of Our New Megatron-DeepSpeed Framework In order to demonstrate the performance improvement from our new Megatron-DeepSpeed framework, we first show a range of performance comparisons between the old Megatron- DeepSpeed and the New Megatron-DeepSpeed in Table 1, when disabling ZeRO (zero_stage=0). The new Megatron-DeepSpeed is able to support much longer sequence lengths without triggering out-of-memory errors due to (1) Megatron-style sequence parallelism partitions the activation memory when sequence lengths are massive, (2) our enhanced memory optimization through memory-efficient attention mask generation and position embedding parallelization, and (3) FlashAttention V1 and V2 support, which reduces the memory consumption of the attention map calculation from quadratic to linear complexity with respect to the sequence length. The new Megatron-DeepSpeed can achieve higher TFLPOS because it includes new fused kernels from NVIDIA and supports larger batch sizes using our memory optimizations without triggering out-of-memory errors. 11 Figure 11: Maximum sequence lengths of 25B GenSLM models supported by different frameworks at different scales. The hardware profiled here are NVIDIA DGX nodes with eight 40G A100 GPUs per node. Figure 12: Scalability of the 33B GenSLM model. MDS, TP, SP stand for Megatron-DeepSpeed, tensor parallelism and sequence parallelism. 3.5 Max Sequence Length Capability Through our new Megatron-DeepSpeed framework, scientists can now train their large science models like GenSLMs with much longer sequences via a synergetic combination of our newly added memory optimization techniques on attention mask and position embedding, tensor parallelism, pipeline parallelism, sequence parallelism, ZeRO-style data parallelism and model state offloading. Figure 10 and 11 demonstrate that our new framework enables the longest sequence length for GenSLMs' 25B and 33B models by up to 12X and 14X, respectively, over the previous Megatron-DeepSpeed. In terms of supported sequence lengths, this new framework also significantly outperforms NVIDIA's Megatron-LM by up to 9.8X and 9.1X for the 25B and 33B models, respectively. For example, GenSLMs' 25B model can now be trained with a 512K sequence of nucleotides, compared to the Argonne team's original 42K sequence length on 64 GPUs. This drastically improves model quality and scientific discovery scope without additional accuracy loss. 3.6 Scalability Analysis We further show the scalability of new Megatron-DeepSpeed and what different optimizations entail in Figure 12 and 13. We make two observations. Firstly, when only tensor parallelism 12 Figure 13: Scalability of the 25B GenSLM model. MDS, TP, SP stand for Megatron-DeepSpeed, tensor parallelism and sequence parallelism. and sequence parallelism are used without position embedding optimization, the maximum length of the sequence this training system can support is about 50K, and continuing to increase GPUs will not allow the system to support longer sequences. Secondly, when enabling sequence parallelism, the maximum length of the sequence that can be supported varies within 4K. There are several reasons behind these observations. Firstly, during training, the majority of a device's memory is used for model state when the sequence length is small. However, as the sequence length increases, the activation memory and temporary buffers can grow significantly. For instance, GPT-style models require O(seq_length x n_layer x hidden_dim x batch_size) to store activations, and O(seq_length x seq_length) to store the attention map, and O(3 x seq_length x hidden_dim ) to train the position embedding. Secondly, the attention map is linearly proportional to the sequence length, while the latter has quadratic memory complexity. For a 25B parameter GPT model trained with a sequence length of 100K and a batch size of 1, the activation memory requires about 12 GB and the attention map requires at least 10 GB per device, both of which are non-trivial. By using techniques such as model parallelism, we can reduce the memory footprint by using aggregated device memory for activation memory from 480 GB to 12 GB. Finally, we also optimized the attention map's memory usage by avoiding allocating temporary buffers on the device, which reduces the peak memory consumption from 54 GB (Out of Memory) to 39 GB. Even if we only use casual flash attention (avoid generating attention map explicitly), the memory requirement for training position embedding is linearly scaled with sequence length, and the needed memory is over 10 GB when a sequence length is over 100K. For detailed new Megatron-DeepSpeed source code release and tutorial, please visit our release blog. 4 DeepSpeed4Science launch and key collaborators The new system technologies enabled by DeepSpeed4Science can empower AI-driven scientific discoveries using signature models that represent a wide spectrum of efforts pushing the boundaries of science. Currently, DeepSpeed4Science is honored to support several key science models from Microsoft Research AI4Science, Microsoft WebXT/Bing and U.S. DoE National Labs. 13 Figure 14: Scientific foundation model (SFM). Figure 15: ClimaX is the first foundation model designed to perform a wide variety of weather and climate modeling tasks. 4.1 Current Microsoft internal partnerships 4.1.1 Scientific Foundation Model (SFM), Microsoft Research AI4Science Scientific foundation model (SFM) (Figure 14) aims to create a unified large-scale foundation model to empower natural scientific discovery by supporting diverse inputs, multiple scientific domains (e.g., drugs, materials, biology, health, etc.) and computational tasks. The Deep- Speed4Science partnership will provide new training and inference technologies to empower the SFM team's continuous research on projects like Microsoft's new generative AI methods, such as Distributional Graphormer [13]. 4.1.2 ClimaX, Microsoft Research AI4Science Our changing climate is producing more frequent extreme weather events. To mitigate the negative effects, it is increasingly important to predict where these events will occur. ClimaX [14] (Figure 15) is the first foundation model designed to perform a wide variety of weather and climate modeling tasks. It can absorb many different datasets with different variables and resolutions, potentially improving weather forecasting. DeepSpeed4Science is creating new system supports and acceleration strategies for ClimaX for efficiently pretraining/finetuning bigger foundation models while handling very large high-resolution image data (e.g., tens to hundreds of petabytes) with long sequences. 4.1.3 Molecular Dynamics and Machine Learning Force Field, Microsoft Research AI4Science This project simulates the dynamics of large (million-atom) molecular systems with near ab initio accuracy using AI-powered force field models [15] while maintaining the efficiency and scalability of classical molecular dynamics. The simulations are efficient enough to generate trajectories 14 long enough to observe chemically significant events. Typically, millions or even billions of inference steps are required for this process. This poses a significant challenge in optimizing the inference speed of graph neural network (GNN)+ LLM models, for which DeepSpeed4Science will provide new acceleration strategies. 4.1.4 Weather from Microsoft Start, Microsoft WebXT/Bing Weather from Microsoft Start provides precise weather information to help users make better decisions for their lifestyles, health, jobs and activities–including accurate 10-day global weather forecasts updated multiple times every hour. Previously, Weather from Microsoft Start benefited from DeepSpeed technologies to accelerate their multi-GPU training environments [16]. Currently, DeepSpeed4Science is working with the WebXT weather team to further enhance Microsoft Weather services with cutting-edge features and improvements. 4.2 Current external collaborators DeepSpeed4Science's journey started with two pioneering LLM-based AI models for structural biology research: OpenFold [2] from Columbia University, an open-sourced high-fidelity protein structure prediction model; and GenSLMs [7] from Argonne National Laboratory, an award- winning genome-scale language model for learning the evolutionary landscape of SARS-CoV-2 (COVID-19) genomes. As the featured showcases for this release, they represent two common AI system challenges facing today's AI-driven structural biology research. We have discussed how DeepSpeed4Science empowered their scientific discovery in the previous sections. Additionally, DeepSpeed4Science has recently expanded its scope to support a more diverse range of science models. For example, in our work with Argonne on training a trillion-parameter science model on Aurora Exascale system, DeepSpeed4Science technologies will help them reach the performance requirements and scalability needed for this critical mission. Furthermore, by collaborating with Oak Ridge National Laboratory and National Cancer Institute (NCI) on cancer surveillance, DeepSpeed4Science will help enable high-fidelity extraction and classification of information from unstructured clinical texts for the MOSSAIC project. DeepSpeed4Science technologies will also be adopted by Brookhaven National Laboratory to support development of a large digital twin model for clean energy research by using LLMs to produce more realistic simulation data. You can find more detailed information about our external colleagues and their science missions at DeepSpeed4Science. 5 Conclusion We are very proud and excited to announce the DeepSpeed4Science initiative along with several R&D highlights and achievements. We are hosting our new initiative at https://deepspeed4science.ai/, including information about our external colleagues, and current and future DeepSpeed4Science technology releases. One of our high-level goals is to generalize AI system technologies that broadly address the major system pain points for large-scale scientific discoveries. We hope sci- entists around the world will enjoy the new capabilities unlocked by DeepSpeed4Science through open-sourced software. We are looking forward to better understanding the AI system design challenges that block scientists' discovery progress. We sincerely welcome your participation to help us build a promising AI4Science future. 15 Acknowledgment We thank members of Microsoft DeepSpeed Team for their help on this initial release of DeepSpeed4Science initiative. Our Founding Collaborators (in alphabetical order): Argonne National Laboratory: Rick Stevens, Cristina Negri, Rao Kotamarthi, Venkatram Vishwanath, Arvind Ramanathan, Sam Foreman, Kyle Hippe, Troy Arcomano, Romit Maulik, Maxim Zvyagin, Alexander Brace, Bin Zhang, Cindy Orozco Bohorquez, Austin Clyde, Bharat Kale, Danilo Perez-Rivera, Heng Ma, Carla M. Mann, Michael Irvin, J. Gregory Pauloski, Logan Ward, Valerie Hayot, Murali Emani, Zhen Xie, Diangen Lin, Maulik Shukla, Ian Foster, James J. Davis, Michael E. Papka, Thomas Brettin. AMD: Ashwin Aji, Angela Dalton, Michael Schulte, Karl Schulz. Brookhaven National Laboratory: Adolfy Hoisie, Shinjae Yoo, Yihui Ren. Columbia University OpenFold team: Mohammed AlQuraishi, Gustaf Ahdritz, Christina Floristean. Microsoft Research AI4Science team: Christopher Bishop, Bonnie Kruft, Max Welling, Tie-Yan Liu, Cristian Bodnar, Johannes Brandstetter, Wessel Bruinsma, Chan Cao, Yuan-Jyue Chen, Peggy Dai, Patrick Garvan, Liang He, Elizabeth Heider, PiPi Hu, Peiran Jin, Fusong Ju, Yatao Li, Chang Liu, Ana Lucic, Renqian Luo, Qi Meng, Frank Noe, Paris Perdikaris, Tao Qin, Bin Shao, Yu Shi, Wenlei Shi, Gregor Simm, Megan Stanley, Lixin Sun, Yue Wang, Tong Wang, Zun Wang, Lijun Wu, Yingce Xia, Leo Xia, Shufang Xie, Shuxin Zheng, Jianwei Zhu. Microsoft WebXT Weather team: Pete Luferenko, Divya Kumar, Jonathan Weyn, Ruixiong Zhang, Sylwester Klocek, Volodymyr Vragov. NVIDIA: Yuntian Deng, Weili Nie, Josh Romero, Christian Dallago, Arash Vahdat, Chaowei Xiao, Thomas Gibbs, Anima Anandkumar. Oak Ridge National Laboratory: Prasanna Balaprakash, Gina Tourassi, John Gounley, Heidi Hanson, Thomas E Potok, Massimiliano (Max) Lupo Pasini, Kate Evans, Dan Lu, Dalton Lunga, Junqi Yin, Sajal Dash , Feiyi Wang, Mallikarjun Shankar, Isaac Lyngaas, Xiao Wang, Guojing Cong, Pei Zhang, Ming Fan, Siyan Liu. Princeton University: William Tang, Kyle Felker, Alexey Svyatkovskiy (Microsoft liaison). Rutgers University: Hang Liu. References [1] Jeff Rasley, Samyam Rajbhandari, Olatunji Ruwase, and Yuxiong He. Deepspeed: System optimizations enable training deep learning models with over 100 billion parameters. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 3505–3506, 2020. [2] Gustaf Ahdritz, Nazim Bouatta, Sachin Kadyan, Qinghui Xia, William Gerecke, Timo- thy J O'Donnell, Daniel Berenberg, Ian Fisk, Niccolò Zanichelli, Bo Zhang, Arkadiusz Nowaczynski, Bei Wang, Marta M Stepniewska-Dziubinska, Shang Zhang, Adegoke Ojewole, Murat Efe Guney, Stella Biderman, Andrew M Watkins, Stephen Ra, Pablo Ribalta Lorenzo, Lucas Nivon, Brian Weitzner, Yih-En Andrew Ban, Peter K Sorger, Emad Mostaque, Zhao Zhang, Richard Bonneau, and Mohammed AlQuraishi. OpenFold: Retraining AlphaFold2 yields new insights into its learning mechanisms and capacity for generalization. bioRxiv, 2022. [3] John Jumper, Richard Evans, Alexander Pritzel, Tim Green, Michael Figurnov, Olaf Ronneberger, Kathryn Tunyasuvunakool, Russ Bates, Augustin Žídek, Anna Potapenko, 16 et al. Highly accurate protein structure prediction with alphafold. Nature, 596(7873):583– 589, 2021. [4] Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. Zero: Memory optimizations toward training trillion parameter models. In SC20: International Conference for High Performance Computing, Networking, Storage and Analysis, pages 1–16. IEEE, 2020. [5] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 1877–1901. Curran Associates, Inc., 2020. [6] Tri Dao, Dan Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. Flashattention: Fast and memory-efficient exact attention with io-awareness. Advances in Neural Information Processing Systems, 35:16344–16359, 2022. [7] Maxim Zvyagin, Alexander Brace, Kyle Hippe, Yuntian Deng, Bin Zhang, Cindy Orozco Bohorquez, Austin Clyde, Bharat Kale, Danilo Perez-Rivera, Heng Ma, Carla M. Mann, Michael Irvin, J. Gregory Pauloski, Logan Ward, Valerie Hayot, Murali Emani, Sam Foreman, Zhen Xie, Diangen Lin, Maulik Shukla, Weili Nie, Josh Romero, Christian Dallago, Arash Vahdat, Chaowei Xiao, Thomas Gibbs, Ian Foster, James J. Davis, Michael E. Papka, Thomas Brettin, Rick Stevens, Anima Anandkumar, Venkatram Vishwanath, and Arvind Ramanathan. Genslms: Genome-scale language models reveal sars-cov-2 evolutionary dynamics. bioRxiv, 2022. [8] NVIDIA. Megatron-LM. https://github.com/NVIDIA/Megatron-LM. [9] Microsoft. Megatron-DeepSpeed. Megatron-DeepSpeed. https://github.com/microsoft/ [10] Tri Dao. Flashattention-2: Faster attention with better parallelism and work partitioning. arXiv preprint arXiv:2307.08691, 2023. [11] Teven Le Scao, Angela Fan, Christopher Akiki, Ellie Pavlick, Suzana Ilić, Daniel Hesslow, Roman Castagné, Alexandra Sasha Luccioni, François Yvon, Matthias Gallé, et al. Bloom: A 176b-parameter open-access multilingual language model. arXiv preprint arXiv:2211.05100, 2022. [12] Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2021. [13] Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng, Guolin Ke, Di He, Yanming Shen, and Tie-Yan Liu. Do transformers really perform badly for graph representation? Advances in Neural Information Processing Systems, 34:28877–28888, 2021. 17 [14] Tung Nguyen, Johannes Brandstetter, Ashish Kapoor, Jayesh K Gupta, and Aditya Grover. Climax: A foundation model for weather and climate. arXiv preprint arXiv:2301.10343, 2023. [15] Tong Wang, Xinheng He, Mingyu Li, Yusong Wang, Zun Wang, Shaoning Li, Bin Shao, and Tie-Yan Liu. Ai2bmd: efficient characterization of protein dynamics with ab initio accuracy. bioRxiv, pages 2023–07, 2023. [16] Sylwester Klocek, Haiyu Dong, Matthew Dixon, Panashe Kanengoni, Najeeb Kazmi, Pete Luferenko, Zhongjian Lv, Shikhar Sharma, Jonathan Weyn, and Siqi Xiang. Ms-nowcasting: Operational precipitation nowcasting with convolutional lstms at microsoft weather. arXiv preprint arXiv:2111.09954, 2021. 18
http://arxiv.org/abs/2310.04607v1
"2023-10-06T21:55:57"
"2023-10-06T21:55:57"
A Comprehensive Performance Study of Large Language Models on Novel AI Accelerators
Artificial intelligence (AI) methods have become critical in scientific applications to help accelerate scientific discovery. Large language models (LLMs) are being considered as a promising approach to address some of the challenging problems because of their superior generalization capabilities across domains. The effectiveness of the models and the accuracy of the applications is contingent upon their efficient execution on the underlying hardware infrastructure. Specialized AI accelerator hardware systems have recently become available for accelerating AI applications. However, the comparative performance of these AI accelerators on large language models has not been previously studied. In this paper, we systematically study LLMs on multiple AI accelerators and GPUs and evaluate their performance characteristics for these models. We evaluate these systems with (i) a micro-benchmark using a core transformer block, (ii) a GPT- 2 model, and (iii) an LLM-driven science use case, GenSLM. We present our findings and analyses of the models' performance to better understand the intrinsic capabilities of AI accelerators. Furthermore, our analysis takes into account key factors such as sequence lengths, scaling behavior, sparsity, and sensitivity to gradient accumulation steps.
[ "Murali Emani", "Sam Foreman", "Varuni Sastry", "Zhen Xie", "Siddhisanket Raskar", "William Arnold", "Rajeev Thakur", "Venkatram Vishwanath", "Michael E. Papka" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04607v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04607v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.PF", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.PF", "cs.AI", "cs.AR", "cs.LG" ]
3 2 0 2 t c O 6 ] F P . s c [ 1 v 7 0 6 4 0 . 0 1 3 2 : v i X r a A Comprehensive Performance Study of Large Language Models on Novel AI Accelerators Murali Emani∗ memani@anl.gov Sam Foreman∗ foremans@anl.gov Varuni Sastry∗ vsastry@anl.gov Zhen Xie† zxie3@binghamton.edu Siddhisanket Raskar∗ sraskar@anl.gov William Arnold∗ arnoldw@anl.gov Rajeev Thakur∗ thakur@anl.gov Venkatram Vishwanath∗ venkat@anl.gov Michael E. Papka∗‡ papka@anl.gov ∗Argonne National Laboratory, Lemont, IL 60439, USA, †State University of New York, Binghamton, NY, 13092, USA, ‡University of Illinois, Chicago, IL 60637, USA Abstract-Artificial intelligence (AI) methods have become in scientific applications to help accelerate scientific critical discovery. Large language models (LLMs) are being considered as a promising approach to address some of the challenging prob- lems because of their superior generalization capabilities across domains. The effectiveness of the models and the accuracy of the applications is contingent upon their efficient execution on the underlying hardware infrastructure. Specialized AI accelerator hardware systems have recently become available for accelerating AI applications. However, the comparative performance of these AI accelerators on large language models has not been previously studied. In this paper, we systematically study LLMs on multiple AI accelerators and GPUs and evaluate their performance characteristics for these models. We evaluate these systems with (i) a micro-benchmark using a core transformer block, (ii) a GPT- 2 model, and (iii) an LLM-driven science use case, GenSLM. We present our findings and analyses of the models' performance to better understand the intrinsic capabilities of AI accelerators. Furthermore, our analysis takes into account key factors such as sequence lengths, scaling behavior, sparsity, and sensitivity to gradient accumulation steps. I. INTRODUCTION The incorporation of Artificial Intelligence (AI) for Science has gained increasing interest in scientific research institutes and supercomputing facilities, with the goal of accelerat- ing scientific discovery with novel approaches involving AI. This synergy has increased interest in the adoption of novel AI-driven techniques to help develop solutions to complex scientific problems such as protein-structure prediction [1], [2], cosmology parameter prediction [3], neutrino particle detection [4], drug design for precision medicine [5], genome- scale foundation model [6] and weather forecasting model [7]. Some of the most commonly used AI techniques include con- volutional neural networks, recurrent neural networks, graph neural networks, and large language models (LLMs). These techniques, with their unique architectural characteristics, have become invaluable to assist scientists in their research. Within the AI landscape, the domain of Natural language processing (NLP) has experienced a massive surge in growth. fostering the development of LLMs to use in various tasks such as ques- tion answering, text summarization, and language translation. These models are becoming increasingly critical in scientific machine learning applications. LLMs, such as Generative Pre-trained Transformers (GPT) GPT-3 [8], LLaMA [9], Llama 2 [10], and Bloom [11] have seen a massive improvement in their complexity along with the quality of results for these tasks. This growth has been driven in part by the rapid emergence of transformer-based models as the de-facto architecture for both traditional applications and a potent tool for scientific use cases. Transformer-based architectures have found a multitude of applications, from ac- celerating drug discovery to understanding genetic sequences. For example, GenSLM [6] provides an LLM-based foundation model to predict Sars-CoV2 variants of concern. Its strength lies in its capacity to inform the design of effective anti- viral drugs. The GensLM model is trained on an extensive dataset of over 110 million raw nucleotide sequences and with model scales between 25 million to 25 billion trainable parameters. However, training GPT-variant LLMs with large model parameters and longer sequence lengths necessitates specialized computing resources and innovative implementa- tion techniques and optimizations in the software stack. To address these requirements, AI accelerators, designed on non-traditional architectures, such as dataflow, have emerged. These accelerators are custom-built to efficiently support AI workloads with their powerful hardware compute engines and novel software optimizations. They are proven to effectively train several AI models, with a special focus on LLMs. With their unique system characteristics, these AI accelerators are empowered to tackle the challenges posed by LLMs. Besides their capability in training, these accelerators are able to run some of the largest GPT models, besides providing a suite of pre-trained GPT models [12], [13], [14], [15], [16], [17], [18], [19]. These models demonstrate the versatility and scalability of AI accelerators. With the increase in the size and complexity of LLMs, innovative training techniques have become critical, such as sparsity [20], [21], [22], [23], to further enhance the training of LLMs with billions of parameters. 1 TABLE I: Features of evaluated AI accelerators Feature Nvidia A100 System Size1 Memory (/node) Memory (/device) Interconnect Software Stack4 Precision5 Compute Units (/device) 64 (= 16 × 4) 160 GB 40 GB NVLink TF, PT, ONNX, MxNET, CUDA TF32, FP32, FP16, BF16 6912 Cores, Tensor Cores Cuda 432 SambaNova DataScale SN30 64 (= 8 × 8) 8 TB 1 TB Ethernet-based SambaFlowTM, PT, TF FP32, BF16, Int32, Int16, Int8 1280 PCUs Cerebras CS-2 2 (= 1 × 2) 1 TB 1 TB Ethernet-based PT, Cerebras SDK FP32, FP16, BF16, cbfloat 850,000 Cores Graphcore Bow- Pod64 64 (= 4 × 16) 3.6 GB/128 GB 2 900 MB/32 GB IPU Link TF, PT, ONNX, PopArt FP32, FP16 1472 cores Compute Habana Gaudi2 AMD MI250 8 (= 1 × 8) 768 GB 96 GB RoCE3 Synapse AI, TF and PT FP32, TF32, BF16, FP16, FP8 24 TPC + 2 MME 4 (= 1 × 4) 512 GB 128 GB AMD CDNA TF, PT, ROCm FP64, FP32, FP16, BF16, INT8, INT4 13312 cores, 208 compute units Evaluation of LLMs on diverse hardware platforms is of crucial importance to understand the capabilities and limita- tions of both traditional and non-traditional architectures. Prior work has studied LLMs on leadership class supercomputers [24] and with traditional deep learning benchmarks [25], [26] providing detailed insights into their capabilities. However, no comprehensive evaluation has been performed across a variety of AI accelerators, especially for LLMs. This paper aims to address this gap with a detailed performance evaluation of language models on multiple AI accelerators and is the first of its kind benchmarking study to our best knowledge. The major contributions of this paper are: • A systematic evaluation of LLMs on state-of-the-art AI accelerators. • Focus on a transformer block micro-benchmark that is a core component in GPT-based models. • Comprehensive evaluation of GPT-2 XL 1.5B parameter model to glean insights into model performance across all systems. • Porting and evaluation of a science application: GenSLM, a foundation model for gene sequencing. • Studying the impact of sequence lengths, sparsity, and gradient accumulation steps on model throughput. We present an overview of LLMs and the various AI accelerators in Section II, followed by details of the evaluated models, namely the transformer block micro-benchmark, GPT- 2 XL, and GenSLM application in Section III. We describe in Section IV the implementation of the LLMs on different AI accelerators. We present experimental results in Section V, followed by conclusions in Section VI. II. OVERVIEW OF LARGE LANGUAGE MODELS AND AI ACCELERATORS Large language models are a type of artificial intelligence system that use deep learning algorithms to process and 1Note: System Size is reported as Ndevices 2Reported as SRAM/DRAM for device and node memory 3RDMA over Converged Ethernet 4TF: TensorFlow, PT: PyTorch. 5We include the most commonly used floating precision data types. (cid:0)= Nnodes × devices node (cid:1). generate natural language text. These models have become increasingly popular in recent years due to their ability to perform a wide range of language-related tasks, such as ma- chine translation, text summarization, and question answering. The development of large language models has been driven by advances in deep learning techniques, particularly in the area of transformer models. These models use self-attention mechanisms to process text input, allowing them to capture complex patterns and relationships within language data. They are also pretrained on large datasets using unsupervised learn- ing techniques, such as masked language modeling and next- sentence prediction, which help them to learn a broad range of language features and structures. Fine-tuning on specific tasks further improves their performance and adaptability. One of the most well-known LLMs is the GPT (Genera- tive Pretrained Transformer) series, which was developed by OpenAI and is used to answer questions, translate languages, and generate text. These tasks are realized by generative pre- training of a language model on a diverse data corpus of unlabeled text, followed by discriminative fine-tuning on a specific task. Task-aware input transformations during fine- tuning help achieve effective transfer with minimal changes to the model architecture. Owing to the neural architectural differences, GPT models can broadly be classified into GPT [27] GPT-2 [28], GPT-3 [8], and more recently GPT-4 [29]. AI accelerators comprised of GPU-based systems and novel non-traditional AI hardware, such as dataflow architectures, have proven to boost the efficiency of diverse AI models. Below we describe the accelerators used in this study, while the configurations are listed in Table I. Nvidia A100: The A100 GPU consists of 6912 CUDA cores and 432 Tensor cores to accelerate parallel workloads. On a single DGX node, there are 4 A100 GPUs, interconnected with NVLink. We use a forked implementation of Microsoft's Megatron-DeepSpeed6 framework for our evaluations. In doing so, we can take full advantage of DeepSpeed's various optimizations and convenient features such as ZeRO offloading and automatic metric tracking (with communication + FLOP profiling). All experiments were conducted on the Polaris [31] 6Which is itself a fork of NVIDIA's original Megatron-LM [30] 2 supercomputer at the Argonne Leadership Computing Facility (ALCF) with 4 A100 GPUs and 40 GB memory per node. Cerebras CS-2: The Cerebras CS-2 is a wafer-scale deep learning accelerator comprising 850,000 processing cores, each providing 48KB of dedicated SRAM memory for an on- chip total of 40 GB and interconnected to optimize bandwidth and latency. The system has been scaled to two CS-2 wafer- scale engines nodes interconnected by the SwarmX fabric and with the MemoryX memory subsystem to enable large models. The wafer-scale cluster supports a weight streaming execution mode [32] where each model layer is loaded one by one. This feature enables users to run large language models in which each layer's weights fit in memory, but not the entire model. The software platform integrates popular machine learning frameworks such as PyTorch. With a single Cerebras CS-2, the largest model supported is the GPT-3 (175B parameter model) and the CS-2 can support sequence lengths up to 58k. SambaNova SN30: The SambaNova DataScale system uses the second-generation Reconfigurable Dataflow Unit (RDU) processor for optimal dataflow processing and acceleration. Each RDU has 1280 Pattern Compute Units (PCU) and 1 TB of off-chip memory. The system consists of eight nodes, each with eight RDUs interconnected to enable model and data parallelism. SambaFlow, its software stack, extracts, optimizes and maps dataflow graphs to the RDUs from the PyTorch machine learning framework. SN30 can train models up to 176 B parameters on 4 RDUs. Graphcore Bow Pod64: The Graphcore 22 petaflops Bow Pod64 system is the latest next-generation accelerator from Graphcore. It is a one-rack system consisting of 64 Bow-class IPUs with a custom interconnect. The Graphcore software stack includes the Poplar SDK and has support for TensorFlow and PyTorch. The Bow system currently supports GPT-3 175B parameter model with 256 IPUs. Habana Gaudi2: The Habana Gaudi2 processor features two Matrix Multiplication Engines (MME), 24 fully pro- grammable VLIW SIMD tensor processor cores, integrating 24 100 GbE ports of RDMA over Converged Ethernet (RoCE) into each processor chip to efficiently scale training. The Gaudi system consists of one HLS-2 server with eight Gaudi2 HL- 225H cards. The software stack comprises the SynapseAI stack and supports TensorFlow and PyTorch. It supports the existing deep learning optimization library DeepSpeed and the customized library Optimum Habana, which is the interface between the transformer library and Habana's Gaudi processor (HPU). On the Gaudi system, the largest model currently validated is the GPT-3 (175B parameter model) running on 384 Gaudi2 cards. AMD MI250: The AMD MI250 GPU is based on CDNA2 architecture and consists of 13,312 stream processors dis- tributed across 208 compute units coupled with 128 GB of dedicated HBM2e memory with 3.276 TB/s of memory bandwidth. It is able to achieve 362.1 TFlops of FP16 and 45.3 TFlops of FP32 peak performance. Each GPU, com- prising of two tiles, is connected to the host using PCIe Gen4 and uses InfiniBand for to inter-node communication. AMD ROCm open software platform supports the common DL stack, including Tensorflow and PyTorch, in addition to libraries such as rocBLAS, rocSPARSE, rocFFT, and RCCL (ROCm Collective Communication Library). III. EVALUATION In this work, we primarily focused on evaluating (i) trans- former benchmarks, (ii) the GPT 2-XL model, and (iii) a science application, GenSLM [6], a foundation model for genome sequencing. it (1) Transformer micro-benchmark: To evaluate the per- formance of a transformer benchmark on AI accelerators, several key factors must be considered. First, it is important to choose appropriate micro-benchmarks that reflect the workload of the transformer models being used. Once the suitable micro- is necessary to collect benchmarks have been selected, performance metrics, such as throughput, which can be done by measuring the number of input tokens processed per second to complete a certain number of iterations. Additionally, it is important to monitor the utilization of hardware resources, such as memory and compute units. Finally, it is recommended to compare the performance of traditional NVIDIA GPUs against other AI accelerators to gain a more comprehensive understanding of their strengths and weaknesses. By carefully evaluating these factors, it is possible to effectively predict the performance of transformer models on AI accelerators. A transformer block (Figure 1) is a widely recognized and established micro-benchmark for transformer models. The transformer block is an ideal choice for a micro-benchmark due to several reasons. First, it is a widely used building block in natural language processing tasks such as language modeling and text generation, making it a relevant benchmark for many LLM applications. Second, a transformer block is relatively simple and small in size compared to larger transformer models, which makes it easier to run and evaluate. This also allows for faster experimentation in evaluating new hardware architectures. Finally, the transformer block includes many of the key components of transformer models, including self-attention and feedforward layers, making it a suitable representative of transformer models in general. Overall, the transformer block is a well-established and widely accepted micro-benchmark, making it an excellent choice for evaluating the performance of LLM models. A transformer block consists of a multi-head self-attention layer followed by a feedforward neural network layer. The input to the transformer block is a sequence of tokens. In this work, the length of the input sequence we evaluated is 1024. To calculate the FLOPs of the transformer block, we need to consider the number of operations required for each layer. The self-attention layer requires O(n2d) FLOPs, where n is the sequence length and d is the hidden dimension. The feedforward neural network layer requires O(ndk) FLOPs, where k is the size of the hidden layer. Therefore, the total number of FLOPs for the transformer block is O(n2d + ndk). (2) GPT-2 XL: For this study, we used the GPT-2 XL 1.5B parameter model for pre-training experimentation to analyze 3 GenSLM GPT model with 13B parameters on Nvidia A100, SambaNova SN30, and a 25B GPT3-XL model on Cerebras CS-2. Fig. 1: GPT transformer block [33] how performant the accelerators are in running large language models. Though the evaluated systems can individually sup- port much larger models and varied configurations as stated in Section II, we chose GPT-2 XL because it can be easily implemented on each of the systems in a timely manner for a fair comparison. Also, the memory and compute requirements of a GPT-2-sized model fit well with the minimum unit of compute node on each of the systems; hence the insights gained here can be extended to help drive the decisions in choosing accelerators that can yield optimal performance for any given large transformer-based model architecture. The dataset used in this evaluation is Open Web Text (OWT) [34] which is an open-source version of the WebText corpus. It consists of 38 GB of text data from 8,013,769 documents, which constitute content extracted from URLs shared on Red- dit with at least three upvotes. For this model, we measured the model throughput across a scale of devices on each system. Additionally, we evaluated the impact of sequence lengths, gradient accumulation steps (GAS), and sparsity on the model performance. (3) GenSLM (Science Use Case): In addition to the bench- marks described above, we are also interested in evaluating how these models perform in real-world use cases. GenSLM [35], [6] is a genome-scale foundation model that can be generalized to other models. The goal of this model is to identify and classify different virus variants of concern, which can be then extended to gene or protein synthesis. It adapts GPT-based large language models with different parameters (25M-25B) with a 1.2B raw nucleotides dataset and is aimed at larger sequence lengths to help better capture the context and are generalizable to learn the evolution. Figure 2 shows the overview of the GenSLM model that takes SARS-CoV- 2 genomes (nucleotide sequences encoded at the codon level where every three nucleotides represent a codon) as input, which are fed to a series of transformer layers. The intermedi- ate layers learn the semantic embedding of individual codons, which can be mapped to 29 individual virus-encoded protein sequences. In this study, we focus on the evaluation of the Fig. 2: Overview of GenSLM models for predictive modeling of SARS-CoV-2 evolution [6] Metrics: Evaluating the performance of large language models goes beyond traditional metrics and includes consider- ations of computational efficiency and hardware utilization. As these models have grown in size and complexity, it is essential to assess their ability to process and generate text efficiently, especially considering the computational resources required for training and inference. Throughput is a key performance metric that measures the rate at which a large language model can process a given amount of input data. It is often quantified in terms of tokens or sentences processed per second. Higher throughput values indicate better efficiency and the ability to handle large-scale language processing tasks effectively. In this work, we present the throughput in the number of tokens per second across the evaluated systems. Hardware utilization is another important metric in eval- uating large language models, as it assesses how effectively the computational resources are utilized during model training and inference. It involves multiple design choices, such as model parallelism, memory management, and efficient data processing techniques. Profiling the models to extract hard- ware utilization across the evaluated systems is ongoing and will be included in the final version. IV. IMPLEMENTATION ON AI ACCELERATORS The implementations of the evaluated models on each of the systems vary due to different software stacks and scales. Here we describe the implementation details on each system for the three cases: transformer micro-benchmark, GPT-2 XL pre-training, and the GenSLM science application. A. Transformer micro-benchmark The evaluation of the transformer micro-benchmark in- volved a meticulous implementation process aimed at as- sessing the computational efficiency and performance char- acteristics of this kernel on different AI accelerators. The transformer micro-benchmark is designed to simulate the core 4 ACC AAC CAA CTT TCG ATC TCT TGT AGA ... ...L1LkSemantic embedding0.4 0.1 0.003 ... ... 0.8 ... 0.1 zTransformer layers + attentionInput sequenceX[N] \{i}p(Xi| X[N]\{i})TCG CGA CGT ... ... ACG ... CTTSRRTL... ... ...GenSLM operation in the transformer models, which is widely utilized in various natural language processing tasks. The transformer micro-benchmark utilizes a layer in a standardized GPT-2 XL model with an input sequence of 1024, ensuring consistent and comparable results across different platforms. The implemen- tation is carried out using the same deep learning framework, PyTorch, tailored to the unique capabilities of each platform. The workload is used to exploit parallelism and hardware- specific optimizations and to achieve optimal throughput and computational speed. Careful attention is paid to factors such as batch size to avoid bottlenecks and fully utilize the available hardware resources. We use batch sizes of 8, 16, 32, and 64 for different configurations. Performance metrics, such as TFLOPS, are collected to quantify the capabilities of each hardware platform in handling the demanding computations required by the transformer models. This evaluation provides valuable insights into the strengths and weaknesses of different hardware when dealing with transformer-based workloads. B. GPT-2 XL pre-training As part of the GPT-2 XL study, we pre-train the model on the OWT dataset [34] where the raw data is pre-processed and tokenized for a given sequence length. The details of the tokenization and model implementation for each of the systems are described below. Nvidia A100: We ran the models with varying micro- batch sizes, sequence lengths, and tensor-parallel degree on different node counts, up to 64 A100 GPUs. These are imple- mented with Megatron-DeepSpeed [36] using ZeRO Stage 1 with fp16 precision. In these experiments, flash attention flash-attn [37], [38] was enabled, which is known to relieve memory pressure and generally improve throughput. BPE-based tokenizer with a vocabulary size of was used. The sequence lengths up to 2k were used. Experiments with Nvidia's NeMo framework for generative AI [39] are part of planned future work. Cerebras CS-2: On the Cerebras CS-2 system, we ran the GPT-2 XL model implemented in the PyTorch framework with sequence lengths of 1024 and 2048 with a batch size of 112 on a single CS-2 engine. The implementation uses a custom GPT-2 tokenizer based on byte-level Byte-Pair- Encoding (BPE) with a vocab size of 50257. The model is trained using mixed precision and precision opt level [40] of 1 (default) and 2. It uses an AdamW optimizer with a weight decay rate of 0.011. The model is trained with both dense and sparse configurations. In the sparsity approach, all the weights of the dense layers are sparsified based on the degree provided. We ran the GPT-3 6.7B and GPT-3 30B models with various sparsity values. Here, a sparsity value of 0.3 means that 30% of weights are pruned. The impact of sparsity on model throughput and loss are discussed in Section V-B4. SambaNova SN30: We evaluated pre-training performance on the OWT dataset on the SambaNova next-generation datas- cale SN30, which has 8 RDUs per node and 8 tiles per RDU. We used the SN reference implementation of the GPT-1.5B model that fits on 4 tiles or half an RDU. This implementation is based on the PyTorch-based SambaFlow framework and uses mixed precision (16 bit(i.e. bf16) multipliers and 32- bit accumulators It uses a BPE-based GPT-2 tokenizer with a vocab size of 50260. We use data parallelism to scale across multiple tiles and nodes. We scale for a maximum of 8 nodes (which corresponds to 128 instances of data-parallel runs) with each instance having a micro-batch size of 16. Graphcore Bow Pod64: On the Bow Pod64, we leverage 64 IPUs to train the evaluated models. The GPT-2 XL 1.5B model implemented in the PyTorch framework can be model- sharded across 4 IPUs. As part of the data pre-processing, the implementation uses Nvidia's Megatron library for generating the training samples with a BPE tokenizer and a vocab size of 50272. The Poplar SDK uses the mapping on a Multiple Instruction Multiple Data (MIMD) fashion to leverage the IPUs and overlap computation and communication. We used a local batch size of 1 in FP16, combined with large gradient accumulation step values of 128 and 1024. Such large values help to minimize the communication overhead as it mimics a larger global batch size. We used a replication factor [41], of 1, 2, 4, and 16 to achieve better scaling, especially for smaller GAS values. Habana Gaudi2: We ran the GPT-2 XL model implemented in PyTorch with a sequence length of 1024 with a local batch size of 32 on each HPU device. The training of the GPT-2 XL model on Habana Gaudi2 represents a powerful and cutting- edge combination of software and hardware capabilities. The data format used in training is BF16. The training samples are generated using a BPE tokenizer. AMD MI250: On the AMD MI250 system, we evaluated the performance of GPT-2 with absolute position embeddings trained with a causal language modeling (CLM) objective on the OWT dataset for up to 8 GPUs. We leverage GPT-2 tokenizer based on byte-level Byte-Pair-Encoding. We used the reference PyTorch 2.0 implementation from Hugging Face to realize this. The performance is evaluated for sequence lengths of 1024 on batch sizes of 16 and 32 per GPU as well as GAS values of 1 and 4. C. GenSLM We implemented the GenSLM science application on Nvidia A100, SambaNova SN30, and Cerebras CS-2. The model is implemented using a PyTorch framework on all three systems. It uses the genomic sequence dataset and tokenizes it using a codon-level tokenizer that splits genomes into blocks of 3 nucleic acids. As the GenSLM application includes models with different number of model parameters ranging from 25M to 25B, we used two different model parameter sizes in this exercise. The SN30 implementation for GenSLM is based on the GPT-2 13B parameter model that uses a context length of 1024 with 44 layers, 64 attention heads, an embedding size of 4992, and a vocabulary size of 71. This GPT-2 13B parameter model with a batch size of 32 can be mapped within 4 tiles or equivalently half an RDU. The model used on Cerebras is a 5 (a) FP32 (b) FP16 (c) BF16 Fig. 3: Throughput evaluation of transformer micro-benchmark in the forward pass with various precision (a) FP32 (b) FP16 (c) BF16 Fig. 4: Throughput evaluation of transformer micro-benchmark in the backward pass with various precision GPT-3 XL, a 1.5B parameter model that has 24 hidden layers and 16 attention heads. The model uses a vocabulary size of 70 and an embedding size of 2048. The model is trained for the genomic sequences of sequence length 10240 and a local size of 27. The other model parameters are similar to the GPT- 2 XL implementation details as listed above. The GPT3-XL model is scaled across the two CS-2s to provide a global batch size of 54. On Nvidia A100, we use an identical GPT-2 13B model consisting of 40 layers of hidden dimension 5120 and 40 attention heads. V. RESULTS In this section, we present the experimental results for the three evaluation cases. We start with the transformer micro- benchmark evaluated with three precision in Section V-A. Next, we present the results of the GPT-2 XL 1.5B parameter model, with a focus on scalability in Section V-B1, GAS study in Section V-B3, sequence length analysis in Section V-B2, and sparsity studies in Section V-B4. Later, we detail our experimental results on the GenSLM model on three systems with models of three sizes: 1.5B, 13B, and 25B parameters in SectionV-C. A. Transformer micro-benchmark The results of the transformer micro-benchmark evaluation on a single NVIDIA A100 GPU, SambaNova SN30 RDU, Graphcore Bow IPU, Habana Gaudi2, and AMD MI2507 are 7Evaluation of transformer micro-benchmark on CS-2 is under progress. shown in Figure 3 and 4, which illustrate the throughput of forward and backward passes in three precision formats: FP32, FP16, and BF16. Mi250 has a higher memory bandwidth (3276.8 GB/s) compared with that (2,039 GB/s) of A100, the higher bandwidth might be used to improve the performance of single precision. But the total efficiency of MI250 is lower than A100. It is observed that NVIDIA A100 GPU demonstrates the baseline throughput, capitalizing on its advanced tensor cores and parallel processing capabilities. The throughput with FP16 and BF16 precision is ̃4x higher than FP32. A100 exhibits 2x theoretical performance for single precision compared to half precision. Additional performance improvement could arise due to a reduction in memory access using half-precision and this transformer is memory intensive kernel. SambaNova SN30, with its reconfigurable Dataflow architecture, exhibits impressive performance with BF16 precision, showcasing its potential for handling complex transformer workloads using the half-precision format. Due to the pipelined/fusion execu- tion on RDUs, there is naturally a warmup and cooldown phase as in any pipeline. More samples in a batch lead to longer steady-state behavior and higher effective throughput. Graph- core Bow IPU, powered by IPUs, demonstrates exceptional performance with FP32 and FP16 precision, highlighting its suitability for NLP tasks. Meanwhile, Habana Gaudi2 exhibits robust performance with all three formats, emphasizing its prowess in efficiently executing various transformer compu- tations. In the backward pass, we think it's due to higher 6 02040608163264Throughput (TFLOPs)Batch sizeForward Pass (FP32)A100MI250BOW IPUGaudi20204060808163264Throughput (TFLOPs)Batch sizeForward Pass (FP16)A100MI250BOW IPUGaudi20501001502008163264Throughput (TFLOPs)Batch sizeForward Pass (BF16)A100MI250SN30-RDUGaudi20204060801008163264Throuhgput (TFLOPs)Batch sizeBackward Pass (FP32)A100MI250BOW IPUGaudi202040608163264Throughput (TFLOPs)Batch sizeBackward Pass (FP16)A100MI250BOW IPUGaudi201002003008163264Throughput (TFLOPs)Batch sizeBackward Pass (BF16)A100MI250SN30-RDUGaudi2 utilization of hardware, and that brings higher throughput. AMD MI250, capitalizing on its dedicated Tensor Processing Core array, exhibited remarkable acceleration and consistent throughput in the backward pass. B. GPT-2 XL For this model, we present throughput for the pre-training of the different configurations of the number of devices as a scal- ing study. Later we discuss the sensitivity of sequence length and gradient accumulation steps on the model throughput. 1) Scaling study: Here we present our findings from scaling the GPT-2 XL model on the different systems. The number of devices used in the scaling study differs from one system to another due to the availability of resources. In particular, we used 64 Nvidia A100 GPUs, 2 CS-2 engines, 64 SambaNova SN30 RDUs, 64 Graphcore Bow IPUs, 4 AMD MI250 GPUs, and 64 Habana Gaudi2 HPUs. Figure 5 shows the impact of model throughput (in log scale) across an increasing number of devices. 8. It is to be noted that the precision used on each system is different and the batch sizes are tuned for this configuration on each system. The speedups across the number of devices on each eval- uated system along with the scaling efficiencies are listed in Table II. A striking observation from this study showed that the model trained on 16 SN30 RDUs, 2 CS-2s, and 16 IPUs outperformed the runs on 64 A100s.9 Additionally, Gaudi2 reported the highest scaling efficiency of 104%. This scaling behavior is due to the optimizations from the Synapse software stack that help minimize the overhead in the sharding of the model and data across multiple HPUS. This is followed by Bow Pod64 which attains scaling efficiency of 100%. The superlinear scaling is enabled by the use of the replicated tensor sharding – as the scale is increased, the pressure on DRAM I/O is reduced for weight loading and IPU-Links are leveraged to exchange shards of weight tensors. Additionally, Bow-IPU has 900 MB of SRAM and currently, it does not use DRAM for running this model hence, we would not be able to fit it into a single IPU due to the SRAM size limitation. We use 4 IPUs and run pipeline-parallel, with model layers distributed across the IPUs. Cerebras CS-2's scales at 95.7% efficiency, which demonstrates the efficiency of the weight streaming [42] technique with dedicated nodes, MemoryX for saving all model weights, and SwarmX to stream these weights to the compute engine. It is interesting to note that the SN30 and MI250 have scaling efficiencies around 80% which is higher than the A100 number at 75.8%. The results show that all the evaluated accelerators demon- strate increased throughput as the models are run across an increased number of devices. Though computationally expensive, models with a larger number of parameters can be trained better with more devices. As model sizes scale up in order of trillion parameters, it may not be feasible to run 8On Bow, replica size 4 is not supported with 32 IPUs mesh topology due to an address limitation TABLE II: Scaling behavior study with the GPT-2 XL model System Gaudi2 Bow Pod64 CS-2 SN30 MI250 A100 minimum #devices maximum #devices scaling efficiency 1 4 1 1 1 4 64 64 2 64 4 64 104% 100.1% 95.7% 82.6% 80% 75.8% speedup improve- ment 66.4x 16x 1.8x 52.8x 3.2x 12.1x them on increased device count, thereby stressing the need to implement new approaches to fit larger models on fewer devices with the goal of improving the time to train a model given a computational budget.10 2) Impact of sequence length: The need for scaling the sequence length in the large language model tasks has been highlighted in recent works [43] with scaling to more than 1B tokens. Large context lengths are extremely important in synthesizing genomic data as seen in the GenSLM science ap- plications. Hence we study the impact of scaling the sequence lengths for the GPT-2 model and present the results on Nvidia A100, SambaNova SN30, and Cerebras CS-2 and exclude others either due to limited support or a work in progress. For this study, we use the GPT-2 XL 1.5B parameter model on both A100 and Cerebras system and both the Cerebras CS- 2 and SambaNova SN30 use the GPT2-13B parameter model. As we can see from Table III, Nvidia A100 needs a minimum of 4 devices to fit a dataset of smaller sequence length. On the other hand, SambaNova SN30 and Cerebras CS-2, owing to their large local memory and compute architecture, can fit models with longer sequence lengths on a single compute device. SambaNova SN30 can fit a 13B parameter model with varying sizes of sequence lengths ranging from 1K to 64K, all on a single RDU. The results are presented when we run 8 instances of the model on a node in data parallel mode. We see a predictable decline in the throughput with an increase in the sequence length. Moreover, from a sequence length of 32k, the implementation uses segmented softmax implementation. We see a similar trend of sequence lengths impacting the throughput when the sequence length increases from 1K to 8K for the CS-2 system for a GPT-2 XL model. 3) Impact of gradient accumulation steps: Large language models, especially those with billions of parameters, consume a significant amount of memory during training. Gradient accumulation allows for the accumulation of gradients over multiple mini-batches before updating the model's weights. This reduces the memory requirements compared to updating the model after processing each individual mini-batch. This is particularly important when working with hardware with limited memory capacity. In this study, we studied the impact of increasing GAS values on the model performance. 9We aim to arrive at a fair comparison across the systems to the greatest 10Note that the A100 and IPU results begin at 4 devices, and CS-2 stops possible extent. after 2. 7 Fig. 5: GPT2-XL scaling study showing throughput in log scale with an increasing number of devices per accelerator with a sequence length 1K. (a) GAS study on Nvidia A100 & AMD MI250 (b) GAS study on SambaNova SN30 (c) GAS study on Graphcore Bow Pod16 IPUs Fig. 6: Impact of Gradient Accumulation Step (GAS) value on model throughput TABLE III: Impact of Sequence length on model throughput System (model Size) A100 (1.5B) CS-2 (1.5B) CS-2 (13B) SN30 (13B) Seq Length Devices 1024 2048 1024 2048 4096 8192 1024 2048 4096 8192 16384 32768 51200 1024 2048 4096 8192 16384 32768 65536 4 4 1 1 1 1 1 1 1 1 1 1 1 8 8 8 8 8 8 8 Throughput (tokens/s) 134,144 124,928 133,069 114,811 63,488 16,302 20,685 20,173 17,531 15,237 11,796 7537 5120 22,135 21,684 17,000 10,581 4936 5021 1880 Figure 6(a) shows the sensitivity of the model throughput on GAS values on the A100 and MI250 GPUs. For this study, we test performance for GAS values of 1 and 4 while we keep batch size and sequence length constant at 16 and 1024 respectively. We observe throughput improvement for larger GAS values before it saturates as the number of devices increases. We see that when the GAS value is increased from 1 to 4 on the GPT-2 XL model with micro-batch size 1 and tensor parallel degree 1, the model throughput is increased by 1.74x across 64 A100 GPUs. For MI250 GPUs, the model throughput is increased by 1.2x across 4 GPUs. The increased performance can be accounted for by the capacity to process more samples with increased GAS value. Also, for the A100 GPUs when we vary the GAS values from 1 through 32 for local batch size 32, we observed a 1.74x increase in the model throughput, thus confirming the source for this increase to larger GAS value at a relatively lower batch size. A detailed study on the trade-off between local batch size and GAS values for A100 and MI250s is a work in progress. Figure 6(b) presents the throughput in samples per second for GAS values 1, 4, 8, and 16 on the SambaNova SN30 system. Though these results are provided for 16 instances of model training that trains across a full 8 RDU node, we can see similar behavior when extended to a full 8 racks. We observe that the throughput gain is significant with increasing GAS values when coupled with a smaller local batch size. On the contrary, increasing the GAS values has 8 11010010001248163264Throughput in log-scaleNumber of DevicesSN30 (bs=32)Gaudi2 (bs=4)Bow Pod64 (bs=1)A100 (bs=32)CS-2 (bs=275)MI250 (bs=16)device countthroughput (samples/sec)0501001502002503001248163264MI250 (GAS=1)MI250 (GAS=4)A100 (GAS=1)A100 (GAS=4)100110120130140150160170180163264128256Throughput (samples/s)Local batch sizeGAS=1GAS=4GAS=8GAS=1640050060070080090010001100166412825651210242048Throughput (samples/s)GAS value less or no effect on the throughput, which saturates at larger local batch sizes. This observation can be attributed to the fact that at larger batch sizes, the additional task of loading the gradient in case of the backward pass computations is significantly time-consuming compared to the time saved by reducing the number of optimization steps. Figure 6(c) shows the sensitivity of the model throughput on GAS values on the Graphcore POD16. For this study, we consider a replication factor of 4 indicating that a single instance of the model (that is sharded over 4 IPUs) is replicated 4 times to span an entire POD16 system. The results can be extended to a full rack of POD64. As we can see, Graphcore can support very large GAS values ranging from 16 to 2048. This is made possible by processing multiple batches and aggregating gradients into accumulator tensors without increasing memory usage. The SambaNova SN30 can also technically support significantly large GAS values, though its impact on the model throughput is yet to be investigated. Cerebras gradient accumulation steps (GAS) are determined automatically by the Cerebras software stack to drive the best throughput given the requested global batch size and number of CS-2s. Given the limited user functionality to tune this parameter, we excluded CS-2 in this study. 4) Sensitivity of weight sparsity on model throughput: Spar- sity is important for training large language models primarily owing to several factors such as enhanced memory efficiency by storing only non-zero parameters, improved training speed due to a reduction of a number of parameters updated in each optimization step, and effective scalability. It also helps with faster inference as the computations are limited to non-zero weights. Here, we conducted a study of sensitivity of model sparsity on the throughput of the Cerebras CS-2. The sparsity degree reflects the percentage of weights that are pruned, in order to accelerate the training. From Figure 7 it can be observed that the model throughput increases from a dense model (s=0) to a highly sparse model (s=0.9). For the GPT-2 XL model, we observed a throughput speedup of 1.8x to 2x with extreme sparsity (s=0.9) when compared to a completely dense model (s=0) 11. Additionally, the sparsity degree has a higher impact on the throughput improvement with larger models. For the GPT-3 6.7B, a sparsity of 0.9 yields 2.1x over a dense model on 1 CS-2, and for GPT-3 30B, a sparsity of 0.9 yields 3.79x over a dense model on 1 CS-2. Further scaling out, this speedup factor is improved by 7.75x, and 15.49x for the 6.7B model on 8 and 16 CS-2s compared to 1 CS-2. This experiment demonstrated that model sparsity can significantly boost throughput and can potentially help to fit larger models on a relatively smaller number of devices.12 Additionally, Figure 8 shows the loss curves for a GPT- 3 model trained on 3B tokens, highlighting a 15% loss in the model accuracy with sparsity s=0.9 as compared to a dense model. During pre-training, there is a degradation in the training loss proportional to the sparsity value. However, 112-3x speedups with larger models 12The batch sizes used on CS-2s are the optimal ones for this model. dense finetuning of the model can recover such a gap, as past work by Cerebras on the sparse pre-training and dense fine-tuning framework has demonstrated. A 1.3B GPT-3XL model pre-trained with 75% sparsity resulting in no significant loss in downstream task accuracy while reducing 2.5x pre- training FLOPs [citation]. We are currently exploring the sparse pretraining dense finetuning technique [21] for large LLM models on CS-2. Studies assessing the impact of sparsity on training on the SambaNova SN30 with techniques developed [20] and Nvidia A100s are ongoing and will be included in the final version of the paper. Due to limited or no support of sparsity on the other systems, they were excluded from this study. Fig. 7: Effect of various sparsity levels (0, 0.6, 0.8, and 0.9) on model throughput on CS-2 Fig. 8: Loss curve for sparse model implementation on CS-2 C. GenSLM Table IV presents the throughput of the GenSLM model, measured in tokens per second, across Nvidia A100, Sam- baNova SN30, and Cerebras CS-2. We present the throughput with three model sizes: A100 and CS-2 with a 1.5B parameter model, A100, SN30, and CS-2 with a 13B parameter model, and CS-2 with 25B parameter model. In the case of A100, SN30, and CS-2, all implementations utilize the GPT-2 13B 9 Local batch sizeSpeedup over the dense 1.001.251.501.752.002.25135275135275s=0.6s=0.8s=0.9Effect of sparsity (s) on throughput TABLE IV: GenSLM model performance evaluation System Devices A100 (1.5B) CS-2 (1.5B) A100 (13B) SN30 (13B) CS-2 (13B) CS-2 (13B) CS-2 (25B) 4 2 8 8 1 1 1 Sequence Length 1024 10240 1024 1024 1024 10240 Throughput (to- kens/sec) 41,891.84 173,875.2 1150.20 6561.22 21,811.2 14,643.2 10240 5324.8 parameter model and are trained with a sequence length of 1024. Both A100 and the SN30 use a micro-batch size of 32, but since the SN30 can fit the 13B model of 32 micro-batch size on 4 tiles, it can accommodate 16 instances of the model in parallel over 8 devices13. Different batch sizes were used for SN30 and A100 for the same model used in Table III. Our observations reveal that when we consider the same number of compute units or devices, the SN30 demonstrates a remarkable 5.7x throughput improvement over the same number of A100s. We also find that a single Cerebras CS- 2 demonstrates a massive 19x speedup for the same model when compared to eight A100s. When we further compare the performance of the 1.5B parameter GenSLM model trained on Nvidia A100 and Cere- bras CS-2, an interesting trend emerges. The CS-2 exhibits the capability to handle sequence lengths that are ten times longer than those run on the A100 GPUs, all while achieving a noteworthy 2x speedup improvement over the A100s. This rigorous evaluation underscores the significant con- tribution of these accelerators in addressing large-scale real- world scientific applications. They play a pivotal role in accelerating the time to accuracy in the realm of large-scale scientific applications. D. Observations: This comprehensive benchmarking evaluation of one of the most pivotal AI workloads has yielded several noteworthy observations. Below, we present a few interesting and valuable insights. • The capacity to accommodate a sizable model within a single device is contingent upon the available computa- tional resources and memory capacity. Even with the us- age of powerful computational engines, the employment of innovative techniques aimed at minimizing memory consumption, particularly parameters such as weights and activations, is of paramount significance. • Facilitating the execution of open-source models and streamlining the extension of models from Hugging Face to leverage these AI accelerators for a are important plethora of emerging AI for science applications. • Achieving a fair comparison among AI accelerators presents notable challenges. Discrepancies arise from variations in local/micro-batch sizes, GAS values, the 13GenSLM runs on SN30 are not optimized at the time of writing this paper number of model replicas, and related factors. It is imperative to devise methodologies that facilitate a fair comparison. • Notably, increasing GAS values does not invariably trans- late to performance improvement beyond a certain thresh- old. This method, combined with a judicious choice of micro-batch size, enables for run at larger batch sizes. • Supporting longer sequence lengths is important to cap- ture context, handle long-range dependencies, and excel in a wide range of tasks. • With upcoming models with trillions of parameters and the requirement to cater to longer sequence lengths, hard- ware and software design must be tailored to maximize computational capabilities while simultaneously minimiz- ing memory usage. VI. CONCLUSIONS In this paper, we performed an extensive and comprehensive evaluation of generative AI models on non-traditional hard- ware with a focus on GPT models, an in-depth analysis of a core transformer block, and a science application (GenSLM). Additionally, we explored the scaling behavior of the GPT- 2 model to gain insights into its performance characteristics. One of our important observations is the memory limitations inherent to the hardware that restrict the feasibility of the size of models that can fit on a single device. It further requires a distributed implementation, such as data parallel, with an increased number of devices. A near-linear scaling is also observed with an increased number of devices. Furthermore, the adoption of optimizations, such as weight sparsity, helps effectively reduce the communication overhead in distributed implementations. We plan to continue this evaluation with a focus on longer sequence lengths and benchmark representative models for the emerging generative AI for science applications. We also would like to extend this comprehensive benchmarking study with larger models such as 175B parameter models and with generative models with distinct architectures such as Llama. It has been observed that to facilitate effective training of sig- nificantly larger models, such as trillion parameters in AI for science applications, leveraging non-traditional AI hardware would be pivotal. Optimizing other metrics besides model throughput, such as power consumption and I/O in training, particularly with increased computation and the utilization of larger data sets, will also be essential. VII. ACKNOWLEDGMENT This work was supported by the Argonne Leadership Com- puting Facility, a U.S. Department of Energy (DOE) Office of Science User Facility, and by Laboratory Directed Research and Development (LDRD) funding from Argonne National Laboratory, provided by the Director, Office of Science, of the U.S. DOE under Contract No. DE-AC02-06CH11357. We also extend our sincere thanks to the staff from Cerebras, SambaNova, Graphcore, and Habana who helped us to perform this study. 10 [21] V. Thangarasa, A. Gupta, W. Marshall, T. Li, K. Leong, D. DeCoste, S. Lie, and S. Saxena, "SPDF: Sparse pre-training and dense fine-tuning for large language models," arXiv preprint arXiv:2303.10464, 2023. [22] S. Saxena, V. Thangarasa, A. Gupta, and S. Lie, "Sparse iso-flop transformations for maximizing training efficiency," 2023. [Online]. Available: https://arxiv.org/abs/2303.11525 [23] S. Singh and A. Bhatele, "Exploiting sparsity in pruned neural networks to optimize large model training," 2023. [Online]. Available: https://arxiv.org/abs/2302.05045 [24] J. Yin, S. Dash, J. Gounley, F. Wang, and G. Tourassi, "Evaluation of pre-training large language models on leadership-class supercomputers," The Journal of Supercomputing, pp. 1–22, 06 2023. [25] M. Emani, Z. Xie, S. Raskar, V. Sastry, W. Arnold, B. Wilson, R. Thakur, V. Vishwanath, Z. Liu, M. E. Papka et al., "A comprehensive evaluation of novel AI accelerators for deep learning workloads," in Proceedings of PMBS Workshop 2022, 2022. [26] J. Yin, A. Tsaris, S. Dash, R. Miller, F. Wang, and M. A. Shankar, "Comparative evaluation of deep learning workloads for leadership- class systems," BenchCouncil Transactions on Benchmarks, Standards and Evaluations, vol. 1, no. 1, p. 100005, 2021. [Online]. Available: https://www.sciencedirect.com/science/article/pii/S2772485921000053 Radford, K. Narasimhan, Sutskever T. [27] A. et "Improving language understanding by generative pre- training," 2018. [Online]. Available: https://paperswithcode.com/paper/ improving-language-understanding-by Salimans, al., I. [28] A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, I. Sutskever et al., "Language models are unsupervised multitask learners," OpenAI blog, vol. 1, no. 8, p. 9, 2019. [29] OpenAI, "GPT-4 technical report," 2023. [Online]. Available: https: //arxiv.org/abs/2303.08774 [30] M. Shoeybi, M. Patwary, R. Puri, P. LeGresley, J. Casper, and B. Catan- zaro, "Megatron-LM: Training multi-billion parameter language models using model parallelism," ArXiv, vol. abs/1909.08053, 2019. [31] "Polaris supercomputing system," https://www.alcf.anl.gov/polaris, Au- gust 2023. [32] "Weight Streaming Mode," https://docs.cerebras.net/en/latest/wsc/ cerebras-basics/cerebras-execution-modes.html, August 2023. [33] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, "Attention is all you need," Advances in neural information processing systems, vol. 30, 2017. [34] A. Gokaslan and V. Cohen, "OpenWebText Corpus," http://Skylion007. github.io/OpenWebTextCorpus, 2019. [35] "GenSLMs: Genome-scale ramanathanlab/genslm, 2022. language models," https://github.com/ [36] D. Narayanan, M. Shoeybi, J. Casper, P. LeGresley, M. Patwary, V. Korthikanti, D. Vainbrand, P. Kashinkunti, J. Bernauer, B. Catanzaro, A. Phanishayee, and M. Zaharia, "Efficient large-scale language model training on GPU clusters using Megatron-LM," in Proceedings of SC'21, 2021. [37] T. Dao, D. Y. Fu, S. Ermon, A. Rudra, and C. Ré, "FlashAttention: Fast and memory-efficient exact attention with IO-awareness," in Advances in Neural Information Processing Systems, 2022. [38] T. Dao, "FlashAttention-2: Faster attention with better parallelism and work partitioning," 2023. [Online]. Available: https://arxiv.org/abs/2307. 08691 [39] "Nvidia NeMo Framework," https://developer.nvidia.com/nemo, 2023. [40] "Control numerical precision level," https://docs.cerebras.net/en/latest/ wsc/how_to_guides/cs-1-data-formats.html, August 2023. factor," Replication https://docs.graphcore.ai/projects/ [41] "IPU popart-user-guide/en/latest/glossary.html#term-Replication-factor, August 2023. [42] "Cerebras Weight Streaming," https://www.cerebras.net/blog/ September linear-scaling-made-possible-with-weight-streaming, 2022. [43] J. Ding, S. Ma, L. Dong, X. Zhang, S. Huang, W. Wang, N. Zheng, and F. Wei, "LongNet: Scaling transformers to 1,000,000,000 tokens," 2023. [Online]. Available: https://arxiv.org/abs/2307.02486 REFERENCES [1] J. Jumper, R. Evans, A. Pritzel, T. Green, M. Figurnov, O. Ronneberger, K. Tunyasuvunakool, R. Bates, A. Žídek, A. Potapenko et al., "Highly accurate protein structure prediction with AlphaFold," Nature, vol. 596, no. 7873, pp. 583–589, 2021. [2] K. Tunyasuvunakool, J. Adler, Z. Wu, T. Green, M. Zielinski, A. Žídek, A. Bridgland, A. Cowie, C. Meyer, A. Laydon et al., "Highly accurate protein structure prediction for the human proteome," Nature, vol. 596, no. 7873, pp. 590–596, 2021. [3] A. Mathuriya, D. Bard, P. Mendygral, L. Meadows, J. Arnemann, L. Shao, S. He, T. Kärnä, D. Moise, S. J. Pennycook, K. J. Maschhoff, J. Sewall, N. Kumar, S. Ho, M. F. Ringenburg, Prabhat, and V. W. Lee, "CosmoFlow: Using deep learning to learn the universe at scale," in Proceedings of the International Conference for High Performance Computing, Networking, Storage, and Analysis, SC 2018, Dallas, TX, USA, November 11-16, 2018. IEEE / ACM, 2018, pp. 65:1–65:11. [4] R. Acciarri, C. Adams, C. Andreopoulos, J. Asaadi, M. Babicz, C. Back- house, W. Badgett, L. Bagby, D. Barker, V. Basque et al., "Cosmic background removal with deep neural networks in SBND," arXiv preprint arXiv:2012.01301, 2020. CANDLE https://github.com/ECP- benchmarks," [5] "ECP CANDLE/Benchmarks. [6] M. Zvyagin, A. Brace, K. Hippe, Y. Deng, B. Zhang, C. O. Bohorquez, A. Clyde, B. Kale, D. Perez-Rivera, H. Ma et al., "GenSLMs: Genome- scale language models reveal SARS-CoV-2 evolutionary dynamics," bioRxiv, pp. 2022–10, 2022. [7] J. Pathak, S. Subramanian, P. Harrington, S. Raja, A. Chattopadhyay, M. Mardani, T. Kurth, D. Hall, Z. Li, K. Azizzadenesheli, P. Hassanzadeh, K. Kashinath, and A. Anandkumar, "FourCastNet: A global data-driven high-resolution weather model using adaptive Fourier neural operators," 2022. [Online]. Available: https://arxiv.org/ abs/2202.11214 [8] T. B. Brown, B. Mann, N. Ryder et al., "Language models are few-shot learners," 2020. [Online]. Available: https://arxiv.org/abs/2005.14165 [9] H. Touvron, T. Lavril, G. Izacard, X. Martinet, M.-A. Lachaux, T. Lacroix, B. Rozière, N. Goyal, E. Hambro, F. Azhar, A. Rodriguez, A. Joulin, E. Grave, and G. Lample, "Llama: Open and efficient foundation language models," 2023. [Online]. Available: https: //arxiv.org/abs/2302.13971 [10] H. Touvron, L. Martin, K. Stone, P. Albert, A. Almahairi, Y. Babaei, N. Bashlykov, S. Batra, P. Bhargava, S. Bhosale et al., "Llama 2: Open foundation and fine-tuned chat models," arXiv preprint arXiv:2307.09288, 2023. [11] T. L. Scao, A. Fan, C. Akiki, E. Pavlick, S. Ili ́c, D. Hesslow, R. Castagné, A. S. Luccioni, F. Yvon, M. Gallé et al., "Bloom: A 176b- parameter open-access multilingual language model," arXiv preprint arXiv:2211.05100, 2022. [12] "LLM on Sambanova Datascale," https://sambanova.ai/blog/ achieving-best-in-class-large-language-model-accuracy-in-low-resource-settings/, 2022. [13] "SambaNova Suite GPT," https://sambanova.ai/solutions/gpt/, 2023. [14] "Cerebras-GPT," https://www.cerebras.net/blog/ cerebras-gpt-a-family-of-open-compute-efficient-large-language-models/ /, 2023. [15] N. Dey, G. Gosal, Zhiming, Chen, H. Khachane, W. Marshall, R. Pathria, M. Tom, and J. Hestness, "Cerebras-GPT: Open compute- optimal language models trained on the cerebras wafer-scale cluster," 2023. [Online]. Available: https://arxiv.org/abs/2304.03208 [16] "Graphcore GPT-J," https://www.graphcore.ai/posts/ fine-tuned-gpt-j-a-cost-effective-alternative-to-gpt-4-for-nlp-tasks, 2023. [17] "Graphcore Model Garden," https://www.graphcore.ai/resources/ model-garden, 2023. Gaudi2 [18] "Habana GPT2," fine-tuning-gpt2-with-hugging-face-and-habana-gaudi/, 2023. https://developer.habana.ai/blog/ - [19] "Habana Gaudi2- Memory Efficient training," https://developer.habana. ai/blog/memory-efficient-training-on-habana-gaudi-with-deepspeed/, 2023. [20] V. Srinivasan, D. Gandhi, U. Thakker, and R. Prabhakar, "Training large language models efficiently with sparsity and dataflow," 2023. [Online]. Available: https://arxiv.org/abs/2304.05511 11
http://arxiv.org/abs/2310.04606v1
"2023-10-06T21:50:21"
"2023-10-06T21:50:21"
Robust Transfer Learning with Unreliable Source Data
This paper addresses challenges in robust transfer learning stemming from ambiguity in Bayes classifiers and weak transferable signals between the target and source distribution. We introduce a novel quantity called the ''ambiguity level'' that measures the discrepancy between the target and source regression functions, propose a simple transfer learning procedure, and establish a general theorem that shows how this new quantity is related to the transferability of learning in terms of risk improvements. Our proposed ''Transfer Around Boundary'' (TAB) model, with a threshold balancing the performance of target and source data, is shown to be both efficient and robust, improving classification while avoiding negative transfer. Moreover, we demonstrate the effectiveness of the TAB model on non-parametric classification and logistic regression tasks, achieving upper bounds which are optimal up to logarithmic factors. Simulation studies lend further support to the effectiveness of TAB. We also provide simple approaches to bound the excess misclassification error without the need for specialized knowledge in transfer learning.
[ "Jianqing Fan", "Cheng Gao", "Jason M. Klusowski" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04606v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04606v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "stat.ML", "@scheme": "http://arxiv.org/schemas/atom" }
[ "stat.ML", "cs.LG", "math.ST", "stat.TH" ]
3 2 0 2 t c O 6 ] L M . t a t s [ 1 v 6 0 6 4 0 . 0 1 3 2 : v i X r a Robust Transfer Learning with Unreliable Source Data∗ Jianqing Fan Cheng Gao Jason M. Klusowski Department of Operations Research and Financial Engineering Princeton University Abstract This paper addresses challenges in robust transfer learning stemming from ambiguity in Bayes classifiers and weak transferable signals between the target and source distri- bution. We introduce a novel quantity called the "ambiguity level" that measures the discrepancy between the target and source regression functions, propose a simple transfer learning procedure, and establish a general theorem that shows how this new quantity is related to the transferability of learning in terms of risk improvements. Our proposed "Transfer Around Boundary" (TAB) model, with a threshold balancing the performance of target and source data, is shown to be both efficient and robust, improving classifi- cation while avoiding negative transfer. Moreover, we demonstrate the effectiveness of the TAB model on non-parametric classification and logistic regression tasks, achieving upper bounds which are optimal up to logarithmic factors. Simulation studies lend fur- ther support to the effectiveness of TAB. We also provide simple approaches to bound the excess misclassification error without the need for specialized knowledge in transfer learning. 1. Introduction Previous experiences can offer valuable insights for learning new tasks. Human learners often transfer their existing knowledge gained from previous tasks to new and related ones. Transfer learning refers to statistical learning tasks where a portion of the training data is generated from a similar but non-identical distribution to the data distribution for which we seek to make inferences about. The objective is then to transfer knowledge from such source data to improve learning in the related target task. Such problems, where there is a divergence between the data-generating distributions, arise in many real application problems, including computer vision (Li et al. 2020; Tzeng et al. 2017), natural language processing (Ruder et al. 2019; Wang and Zheng 2015), speech recognition (Huang et al. 2013), and genre classification (Choi et al. 2017). See Storkey (2008), Pan and Yang (2010), and Weiss et al. (2016) for an ∗Fan is supported by ONR grant N00014-22-1-2340, and NSF grants DMS-2052926, DMS-2053832 and DMS-2210833. Klusowski is supported by NSF grants CAREER DMS-2239448, DMS-2054808, and HDR TRIPODS CCF1934924. 1 overview. Also, similar problems have been studied by both statisticians and many other com- munities under different names, including label noise (Frenay and Verleysen 2014; Scott et al. 2013; Cannings et al. 2020b; Blanchard et al. 2021; Reeve and Kaban 2019; Scott and Zhang 2019), domain adaptation (Scott 2018; Ben-David et al. 2010a,b; Mansour et al. 2009a), multi- task learning (Caruana 1997; Maurer et al. 2016), or distributional robustness (Sinha et al. 2018; Christiansen et al. 2020). We focus here on the transfer learning setting in the context of binary classification since it is not only fundamental in statistical learning and has been extensively investigated in diverse contexts, but also because it provides a framework that is particularly conducive to algorithms that seek to exploit relationships between the target and source distributions. For trans- fer learning theory of linear regression models, see Chen et al. (2013); Bastani (2020) under the setting of finite covariate dimensions or Gross and Tibshirani (2016); Ollier and Viallon (2017); Li et al. (2022) under the high-dimensional regime with lasso-based penalties. See also Tian and Feng (2022) for generalized linear models and Cai and Pu (2022) for non-parametric regression. To set up the framework, suppose that a labeled data sample (relatively small in size, typically) is drawn from the Q, the target distribution we wish to make statistical inferences about. Also, let P be the source distribution from which we wish to transfer knowledge. We suppose a labeled data sample (relatively large in size, typically) is drawn from P . The corresponding random pairs of Q and P distributions are denoted by (X, Y ) and (X P , Y P ) on Rd [0, 1] denote the target and source regression 0, 1 } functions, i.e. respectively. Let ηQ, ηP : Rd × { → ηQ(x) = Q(Y = 1 | X = x) and ηP (x) = P (Y P = 1 X P = x). | The key question is how much information or knowledge can be transferred from P to Q given observations from both distributions. Note that the Bayes classifier f ∗Q( minimizes the misclassification rate Q(Y excess risk of any empirical classifier ˆf as 1 2} = f (X)) over all classifiers. Therefore, we define the ) = 1 ηQ( ≥ { ) * * EQ( ˆf ) = Q(Y = ˆf (X)) − Q(Y = f ∗Q(X)). The aforementioned key question leads us to the task of constructing an empirical classifier that accelerates the convergence of excess risk to zero in expectation by utilizing labeled data samples from both Q and P . 1.1. Related Literature Recent research has aimed to bridge the gap between limited theoretical understanding and significant practical achievements in transfer learning for classification problems. To set up the problem, it is necessary to make some assumptions about the similarity between the target and source distributions, which are both useful for theory and practical implementation. Various approaches have been proposed and explored in the literature to measure this similarity, including divergence bounds, covariate shift, and label shift. Some methods focus on test error bounds that rely on measures of discrepancy between Q and P , such as modified total- variation or R ́enyi divergence, between the target and source distributions (Ben-David et al. 2010a,b; Mansour et al. 2009a,b; Germain et al. 2013; Cortes et al. 2019). This line of work produces distribution-free risk rates, primarily expressed in terms of nP alone, but the obtained 2 6 6 6 rates do not converge to zero with increasing sample size. In other words, these frameworks cannot produce a faster convergence of excess risk if their proposed divergences are non- negligible. Nonetheless, consistent classification is proved achievable regardless of a non- negligible divergence even when nQ = 0, provided that certain additional structures on the target and source distributions are present (Ben-David et al. 2010b). Two common additional structures include covariate shift and label shift (or posterior shift). Covariate shift (Gretton et al. 2008; Quionero-Candela et al. 2009; Kpotufe and Martinet 2018) considers scenarios where the conditional distributions of the response given the covari- ates are identical across Q and P or ηQ = ηP , but marginal distributions of covariates are different. Label shift, on the other hand, assumes an identical or similar target and source marginal distributions QX and PX , but the conditional probabilities ηQ and ηP differ. Most previous work in label shift can be divided into two branches. On one hand, some frameworks do not require identical Bayes classifiers, i.e., (ηP 0, but impose very specific relations between ηQ and ηP , such as the literature on label noise (Frenay and Verleysen 2014; Scott et al. 2013; Cannings et al. 2020b; Blanchard et al. 2021; Reeve and Kaban 2019; Natarajan et al. 2018; Scott and Zhang 2019). For instance, a com- mon assumption (Reeve and Kaban 2019; Natarajan et al. 2018) is that the Y P X P = x is equal to Y X = x up to a constant probability of label flipping, i.e., in our terminology 1/2)(ηQ 1/2) ≥ − − | | P (Y P = 1 Y = 0, X P = X = x) = π0 and P (Y P = 0 Y = 1, X P = X = x) = π1, | | − π0 − π1)ηQ + π0, which is (0, 1). Under this setting, ηP = (1 for some constants π0, π1 ∈ linear in ηQ. Given knowledge of the specific form of ηP , it is feasible to modify learning algorithms to efficiently infer the target Bayes classifier. In another special type of label shift problem, Maity et al. (2022) assumes that PX Y , which is convenient for estimating | the joint distribution of (X, Y ). However, all their proposed estimators are tailored to fit specific assumptions and may not be applicable to more general relations between ηQ and ηP . On the other hand, recent work such as Cai and Wei (2021) and Hanneke and Kpotufe (2019) have introduced more general label shift settings that impose relatively mild and general con- ditions on the relation between ηP and ηQ, in addition to assuming identical Bayes classifiers. Cai and Wei (2021) requires a lower-bounded signal strength of ηP relative to ηQ, besides the assumption of identical Bayes classifiers, i.e., Y = QX | ηP 1 2 − ηQ 1 2 − (cid:16) (cid:17)(cid:16) (cid:17) > 0, ηP (cid:12) (cid:12) (cid:12) 1 2 − Cγ ηQ 1 2 − γ , ≥ (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) for some positive γ and Cγ, and derive a faster risk convergence rate with the transfer exponent γ. The aforementioned approaches have limitations in that they rely on specific and often untestable assumptions. More importantly, they may not be effective in situations where both ambiguities of the source data hold, i.e., there are no strong relations between ηQ and ηP and discrepancies between the Bayes classifiers of the target and source domains still exist. The only other work of which we are aware that allows such general ambiguous source data is Reeve et al. (2021). Reeve et al. (2021) assumes that ηP can be well approximated by a set of regression functions g1(ηQ), . . . , gL∗(ηQ) that are no less informative than a linear transformation of ηQ. 3 1.2. Main Contribution In contrast to existing work, this paper considers a scenario where the Bayes classifiers can arbitrarily differ without imposing further conditions on the source and target distributions. We now introduce an important quantity for capturing the relative information transferred from the source data, which we refer to as the signal strength: s(x) := ηQ(x) sgn otherwise. (cid:0) Our main assumption involves measuring the ambiguity level of the source data based on the for small z: expected signal strength around the classification boundary ηP (x) | 0, ( (ηP (x) ηQ(x) x : × ≥ − − − 0, (cid:1) z , 1 2| 1 2 ) 1 2 { | 1 2| ≤ − } z ≤ ≤ (cid:27)(cid:21) ε(z), E(X,Y ) ∼ Q ηQ(X) 1 s(X) 1 2 − (cid:20)(cid:12) (cid:12) (cid:12) (cid:26) (cid:12) (cid:12) (cid:12) Cγ ≤ ηQ(X) (cid:12) (cid:12) (cid:12) 1 2 − γ , ηQ(X) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) 1 2 − (cid:12) (cid:12) (cid:12) given some constants γ, Cγ > 0. This quantity captures the inevitable risk from hard-to- classify boundary points, which have ηQ values too close to 1/2 and ηP and show weak signal relative to ηQ. The explicit form of ε(z) is provided for some special examples in Section 2.3. γ covers all of Ω, then ε(z) = 0 and the setting reduces to that of If s(x) Cai and Wei (2021) with a strong relative signal of ηP across the entire feature space Ω. ηQ(x) Cγ| 1/2 − ≥ | Given the measure above, we propose a simple but effective classifier that can surprisingly adapt to any level of ambiguity in the signal conveyed by ηP , named the Transfer Around Boundary (TAB) classifier, or the TAB model: ˆfT AB(x) = ˆηQ(x) 1 { ˆf P (x), ( , 1 2} ≥ ˆηQ(x) if − otherwise, | 1 2| ≥ τ, where ˆηQ is an estimate of ηQ obtained by the target data and ˆf P is a classifier obtained by the source data. To clarify our decision-making process, we rely on ˆηQ as the final prediction when it deviates from 1 2. Otherwise, we switch to the prediction made by the source data. In Section 3.1, we present two related general convergence theorems to showcase this clas- sifier, with a proper choice of τ > 0, utilizing both the relative signal of ηP and the ambiguity level ε(z) from the source data. The target data involved in this classifier is noteworthy for its dual role: not only does it provide an upper bound on the excess risk if the source data is unreliable, but it also helps to alleviate the risk caused by ambiguity in the source data. We then apply our general convergence results to non-parametric classification as well as logistic regression to illustrate the potential of our transfer learning method on parametric classification. The results for these two important cases show that our method is indeed nearly minimax optimal and our measure of the ambiguity level is effective, extending results in previous literature. Non-parametric Classification: Suppose that ηQ is β-smooth (Condition 2), margin as- sumption holds for ηQ with parameter α (Assumption 1), and strong density condition (Con- dition 3) holds for QX and PX. Let ΠN P denote the set of all such distribution pairs (Q, P ). At the moment, we consider the scenario where ηP is sufficiently smooth. Suppose that is a subset of ΠN P such that ηP is βP -smooth with βP ≥ γβ. Then, we show that the ΠN P S 4 minimax excess risk satisfies n− P (cid:18) . n− P (cid:18) β(1+α) 2γβ+d β 2β+d + ε cn− Q β(1+α) 2γβ+d + ε (cid:17)(cid:19) (cid:16) c log(nQ ∨ (cid:16) β(1+α) 2β+d n− Q ∧ . inf ˆf sup (Q,P ) ΠNP S ∈ EQ( ˆf ) E nP )n− Q β(1+α) 2β+d log1+α(nQ ∨ (cid:18) ∧ (cid:17)(cid:19) β(1+α) 2β+d nP )n− Q , (cid:19) for some constant c > 0 that is independent of α. β 2β+d With the optimal choice of τ , the upper bound we obtain using the TAB classifier with K-NN classifier components is optimal up to some logarithmic terms nP . This indicates that a necessary and sufficient condition for the source data to of nQ ∨ improve the excess risk rate is a large source data sample size such that nP ≫ z1+α. with a small ambiguity level ε(z) log(nQ ∨ 2γβ+d 2β+d Q , paired nP )n− Q ≍ n Additionally, we provide the optimal rate considering the "band-like" ambiguity con- dition between ηQ and ηP . A particularly interesting and realistic example is to assume In this case, the minimax optimal excess risk becomes that supx ηQ(x) ηP (x) ∆. ≪ β(1+α) 2β+d n− P Ω | ∈ + ∆1+α | ≤ β(1+α) 2β+d − ∧ n− Q (cid:18) require any smoothness condition on ηP in the band-like ambiguity case. (cid:19) , up to some logarithmic terms of nQ ∨ nP . Note that we do not Logistic Regression: If the covariates follow the standard normal random design (see (22) for a precise definition), and the target and source logistic regression coefficient pair (βQ, βP ) belongs to Θ(s, ∆) = (βQ, βP ) : { βQk0 ≤ k s, ∠(βQ, βP ) , ∆ } ≤ for some 0 show that the minimax optimal excess risk satisfies ∆ ≤ ≤ π/2, where ∠(βQ, βP ) denotes the angle between directions βQ and βP , we s log d nP + ∆2 s log d nQ ∧ . inf ˆf sup (Q,P ) ΠLR EQ( ˆf ) . E s log d nP + ∆2 s log d nQ ∧ log2(nQ ∨ nP ) . ∈ (cid:18) (cid:19) (cid:18) (cid:19) ≪ s log d nQ nQ and ∆ (cid:18) Thus, when nP ≫ , the source data improves the convergence rate of the excess risk. Importantly, we only assume a "small cone condition" between βQ and βP , in contrast to the "small contrast condition" in previous works (Li et al. 2022; Tian and Feng 2022), i.e., In addition, unlike the small contrast condition, which implicitly assumes sparsity patterns of βP through lq norms with q 1, our constructed parametric space does not impose any sparsity conditions on βP . In the setting without access to source data, our upper bound s log d 3 bound nQ obtained in Theorem 7 of Abramovich and Grinshtein (2019), assuming the same margin parameter α = 1. βP kq is small for some q is tighter than the ( s log d nQ βQ − [0, 1]. ≤ (cid:19) ∈ k ) 2 As evidenced by the above two examples, the TAB classifier maintains the performance of the target data against an unreliable source and enhances the performance, if the source data sample size is large and the ambiguity is relatively small, i.e., nP ≫ While the target excess risk provided by the target data, ≪ EQ( ˆf Q), has been extensively q EQ( ˆf P ) provided by studied in the literature, much less is known about the target excess risk the source data, which is one key component in deducing the excess risk bound. To fill this nQ and ∆ s log d nQ . 5 gap and gain better insight into the contribution of the source data, we present a general result EP ( ˆf P ), which can in Section 3.2 that provides a direct upper bound on be obtained through conventional theoretical analysis. Therefore, it is feasible to bound the excess risk using conventional statistical learning tools, without requiring specialized expertise in transfer learning. By providing such a general and accessible theoretical framework, our approach has the potential to make transfer learning more accessible. EQ( ˆf P ) in terms of 1.3. Notation and Organization k k k ∈ or ∞ [0, * * * x k , xd) Rd, we write kq for its lq norm. We write x We introduce some notation to be used throughout the paper. For any q ] and vector ∈ x x = (x1, k2 for the Euclidean norm of x, and, given r > 0, we write B(x, r) or Bd(x, r) for the closed Euclidean sphere of radius r centered at x. For two probability measures μ, ν on any general space, if μ is absolutely continuous with respect to ν, we write dμ dν for the Radon-Nikodyn derivative of μ with respect to ν. Write λ as the Lebesgue measure on Rd. Let a b denote the b and a ∧ minimum and maximum of a and b, respectively. Let an . bn denote bn| an| ≤ for some | constant c > 0 when n is large enough. Let an & bn denote c bn| an| ≥ for some constant | c for some constant c > 0 when bn| → c > 0 when n is large enough. Let an ≍ an| | n is large enough. Let an denote that an tends to infinity with n growing to infinity. an| → 0 when n is large enough. Let an ≫ / an| bn denote Let an ≪ 0 when n is large enough. Let be the maximum integer that is less equal than a for any real value a. Finally, we assume 00 = 0 for simplicity. n →∞ −→ ∞ bn| → a ⌋ ⌊ bn denote bn denote bn| ∨ c / / | | | | | | | We state our main working assumptions and measure of ambiguity, called the ambiguity level, in Section 2. We provide two general convergence results on the risk of transfer learning in Section 3.1. Section 3.2 presents an approach to bound the signal transfer risk, a crucial part of general convergence results, in terms of the excess risk rate studied in the conventional In Sections 4 and 5, we apply our results to non-parametric statistical learning literature. classification and logistic regression, respectively, and provide upper and lower bounds on the excess risk. In Section 6, we present simulation results for non-parametric classification and logistic regression, supporting the theoretical properties of our proposed method. 2. Model 2.1. Problem Formulation For two Borel-measurable distributions P and Q, both taking values in Rd two independent random samples, the source data DQ = nP ) } nQ→∞ . and the target data −→ ∞ Our goal is to improve the target data empirical classifier by transferring useful information from the source data. Consider the marginal probability distributions of X for the P and Q distributions, denoted by PX and QX respectively. Let ΩP := supp(PX) and Ω := supp(QX ) represent the support sets of PX and QX . The regression function for the source and target distributions are respectively defined as follows: { Q. Suppose that nP , we observe P DP = iid ∼ } , (XnQ, YnQ) 0, 1 , (X P } nP , Y P (X1, Y1), 1 , Y P (X P 1 ), iid ∼ × { * * * * * * { ηP (x) = P (Y P = 1 | X P = x), ηQ(x) = Q(Y = 1 X = x). | (1) 6 The goal of a classification model is to forecast the label Y based on the value X. The is evaluated by its misclassification rate with effectiveness of a decision rule f : Rd respect to the target distribution, which is defined as follows: → { 0, 1 } R(f ) := Q(Y = f (X)). 1 ηQ(x) The Bayes classifier (or Bayes estimator, Bayes decision rule) f ∗Q(x) = 1 is the 2 } minimizer of R(f ) over all Borel functions defined on Rd and taking values in 0, 1 . We } similarly define the Bayes decision rule for ηP that is f ∗P (x) = 1 . Since the Bayes decision rule f ∗Q(x) is a minimizer of the misclassification rate R(f ), the performance of any empirical classifier ˆf : Rd can be then measured by the excess risk (on the target distribution): ηP (x) → { 1 2} ≥ { 0, 1 ≥ } { { 1 2 − EQ( ˆf ) = R( ˆf ) − R(f ∗Q) = 2E(X,Y ) Q ηQ(X) 1 ˆf (X) = f ∗Q(X) . (2) ∼ n (cid:12) (cid:12) (cid:12) o(cid:21) (cid:20)(cid:12) (cid:12) The last equality is the dual representation of the excess risk (Gyorfi 1978). Given the excess (cid:12) risk defined in (2), the objective of transferring useful information from the source data can be reformulated as the task of constructing an empirical classifier that improves the excess risk, which is accomplished by utilizing labeled data samples drawn from both the target and source distributions. The rate at which the excess risk EQ( ˆf ) converges to zero depends on the assumptions made about the target and source distributions (Q, P ). In classification, a common assumption is the margin assumption (Audibert and Tsybakov 2007; Mammen and Tsybakov 2004). This assumption is used to measure the behavior of QX with respect to the distance between ηQ(X) and 1/2, which is essential for determining the convergence rate of the excess risk. Assumption 1 (Margin). There exists some constant α 1/2 we have QX(0 < ηQ(X) Cαtα. t) 0, Cα > 0 such that for any t > 0, ≥ | − | ≤ ≤ Instead of assuming identical Bayes classifiers for ηQ and ηP over x Ω as in some existing literature (Hanneke and Kpotufe 2019; Cai and Wei 2021), we allow them to differ. This is a realistic relaxation because, although the target and source distributions may have similar Bayes classifiers over a high probability region, they could still have slightly different decision boundaries. Therefore, it is crucial to assess the impact of an unreliable source distribution on the optimal rates of classification. ∈ 2.2. Source Data Ambiguity In this subsection, we provide a detailed discussion of the condition that characterizes the ambiguity of an unreliable source distribution. Here we introduce the signal strength func- tion, which measures the relative signal of ηP compared with ηQ. This function is crucial in capturing the efficacy of the source data for the classification task under Q. Definition 1 (Signal Strength). The signal strength of ηP relative to ηQ is defined as s(x) : = sgn ηQ(x) (cid:26) (cid:16) ηP (x) | 0, ( = , 1 2| − 1 2 − × (cid:17) ηP (x) 1 2 − (cid:16) ηQ(x) sgn otherwise, (cid:0) − (cid:17)(cid:27) 1 2 × (cid:1) 0 ∨ (ηP (x) 1 2 ) ≥ 0, − 7 6 6 for any x Ω. ∈ ≥ It is reasonable to consider the signal strength as non-zero only when (ηP (x) − 1/2) 0, indicating that the target and source data provide consistent information about the Bayes classification boundary. In this case, the source data ηP (x) is beneficial for classifying the target data, and the signal strength is measured by . Conversely, when | (ηP (x) 1/2) < 0, the source data does not provide useful information for classifying x in the target data, and the signal strength at x is zero. 1/2)(ηQ(x) 1/2)(ηQ(x) ηP (x) 1/2 − − − − | Next, we present the main working assumption that measures the ambiguity level of the source data, based on the signal strength. Assumption 2 (Ambiguity Level). For some given γ, Cγ > 0, there exists a continuous function ε(z; γ, Cγ) that is monotone increasing with z [0, 1/2] such that ∈ E(X,Y ) ∼ Q ηQ(X) 1 s(X) 1 2 − (cid:20)(cid:12) (cid:12) (cid:12) (cid:26) (cid:12) (cid:12) (cid:12) Cγ ≤ ηQ(X) (cid:12) (cid:12) (cid:12) 1 2 − γ , ηQ(X) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) 1 2 − (cid:12) (cid:12) (cid:12) We abbreviate ε(z; γ, Cγ) as ε(z) when there is no need to specify γ and Cγ. z ≤ ≤ (cid:27)(cid:21) ε(z; γ, Cγ). (3) The expression in the expectation operator of (3) can be divided into two factors. The first factor represents the distance between ηQ(X) and 1/2, which corresponds to the dual representation of the excess risk (2). The second factor is crucial for understanding transfer γ indicates a lack learning ambiguity. On one hand, the constraint s(X) Cγ| of strong signal from the source data relative to the target data. On the other hand, the z describes the hard-to-classify boundary points of the target constraint distribution. Therefore, our indicator precisely captures the challenging boundary region where classification becomes difficult using either the target or source data. As will be seen later, only the behavior around z = 0 matters for the asymptotics of transfer learning. ηQ(X) ηQ(X) | ≤ 1/2 1/2 − − ≤ | | The ambiguity level ε( ) allows for the presence of unreliable source data, as it accounts for situations where ηP may not consistently provide a strong signal compared to ηQ. Additionally, ) controls the ambiguity with respect to the distance from 1/2. The larger the ambiguity ε( level, the harder the classification task. Note that by the margin assumption, a trivial upper bound of the ambiguity level is ε(z) = Cαz1+α. * * 2.3. On the Ambiguity Level To help clarify the ambiguity level assumption, we provide some examples where explicit ) are available, with a proper choice of γ and Cγ. We defer formulas for the ambiguity level ε( the case of two logistic regression models across the target and source distributions to Section 5. * Example 1 (Perfect Source). Assume the condition of relative signal exponent proposed in Cai and Wei (2021), which amounts to ηQ(x) γ 1 2 | − x ∀ ∈ Ω. s(x) ≥ Cγ| 0. Then Assumption 2 holds with ε(z) ≡ Specifically, if ηP = ηQ, it is straightforward to set γ = 1 and ε( ) = 0. In this scenario, the Bayes classifiers are identical and ηP gives strong signal compared to ηQ over the whole support Ω, so the ambiguity level is set as zero. * 8 Example 2 (Strong Signal over Ω). Instead of having a strong signal over the entire region as in Example 1, here we have a strong signal over only a given region: s(x) Cγ| ≥ ηQ(x) γ 1 2 | − x ∀ ∈ ΩP . Then Assumption 2 holds by taking ε(z) E(X,Y ) ∼ Q ηQ(X) 1 ηQ(X) ≥ | (cid:26) i.e., the ambiguity level is controlled by the risk within the complement Ω/ΩP . This cor- responds to the common case where the source data is collected from a subpopulation with respect to the target distribution. (cid:20)(cid:12) (cid:12) (cid:12) (cid:27)(cid:21) − − (cid:12) (cid:12) (cid:12) 1 2 | ≤ z, X / ∈ ΩP , 1 2 Example 3 (Strong Signal with Imperfect Transfer). Suppose that the transfer signal is strong, but the Bayes classifiers may differ, i.e., ηP (x) (cid:12) (cid:12) (cid:12) ΩR := x ∈ (cid:26) Then Assumption 2 holds if 1 2 − Ω : (cid:12) (cid:12) (cid:12) (cid:16) Cγ ηQ(x) ≥ ηP (x) (cid:12) (cid:12) (cid:12) − 1 2 (cid:17)(cid:16) γ , 1 2 − (cid:12) (cid:12) (cid:12) ηQ(x) x ∀ ∈ Ω, 1 2 − < 0 = . ∅ (cid:27) (cid:17) ε(z) E(X,Y ) ∼ ≥ ηQ(X) Q 1 ηQ(X) 1 2 − 1 2 z, X ΩR . − ≤ ∈ (cid:26)(cid:12) (cid:12) In other words, the ambiguity level is determined by the risk associated with the region where (cid:12) different Bayes classifiers exist. A specific scenario that aligns with this example and utilizes γ = Cγ = 1 can be expressed as (cid:20)(cid:12) (cid:12) (cid:12) (cid:27)(cid:21) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) ηP (x) = ηQ(x)1 x / ∈ { ΩR} + 1 − ηQ(x) 1 x / ∈ { , ΩR} x ∀ ∈ Ω, where only the response values within ΩR are flipped. (cid:0) (cid:1) Example 4 (Band-like Ambiguity). A further noteworthy scenario is when the probability distribution ηP concentrates around a "band" that is centered on an informative curve with respect to ηQ, but with some small deviation. A related situation is studied in Reeve et al. (2021), where ηP is approximated by a linear transfer function of ηQ. Suppose that there exists some band error constant ∆ 0, which represents the deviation level, such that ≥ for any x ∈ Ω. Then Assumption 2 holds with s(x) ≥ Cγ ηQ(x) ∆, − 1 2 − γ (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) ε(z; γ, Cγ/2) = Cαz1+α (cid:16) (cid:17) ∧ 1+α γ CαC − γ 2 1+α γ 1+α γ ∆ . (cid:16) (cid:17) 9 (4) (5) 6 Notably, the case of ∆ = 0 degenerates into the perfect source scenario in Example 1. For the proof of the statement in Example 4, see Lemma E.1. For simplicity, we assume that (4) holds over the entire feature space Ω. Specifically, if we have − then the band-like ambiguity condition 4 holds with γ = Cγ = 1. This is common and meaningful in real-world applications where the regression function of the source distribution deviates slightly from ηQ. By (5), Assumption 2 holds in this special case with | ≤ ηP (x) ηQ(x) ∆, sup Ω | x ∈ (6) ε(z, 1, 1/2) = Cαz1+α (cid:16) 21+αCαC − γ (1+α) ∆1+α . (cid:17) ∧ (cid:16) (cid:17) 3. General Convergence Results 0 and γ, Cα, Cγ > 0, and ambiguity level ε( Let Π be any given subset of distributions (Q, P ) satisfying that Assumption 1 and 2 with parameter α ). Our analysis focuses on the performance of any classifier when the target and source distribution pair (Q, P ) belongs to Π. This framework captures the essential information in the source data and how it can be used to improve the convergence rate of the excess risk. ≥ * 3.1. Performance of the TAB model In preparation for the general result, it is necessary to define the risk learned by the source data over the region s(x) γ with strong signal strength. ηQ(x) 1/2 Cγ| ≥ − | Definition 2 (Signal Transfer Risk). Define the signal transfer risk of the classifier f with respect to parameters γ, Cγ > 0 as ξ(f ; γ, Cγ) := E(X,Y ) ∼ Q ηQ(X) 1 2 − 1 ˆf P (X) = f ∗Q(X), s(X) We abbreviate it as ξ(f ) when there is no need to specify γ and Cγ. (cid:20)(cid:12) (cid:12) (cid:12) (cid:26) (cid:12) (cid:12) (cid:12) Cγ ≥ ηQ(X) (cid:12) (cid:12) (cid:12) 1 2 − γ (cid:12) (cid:12) (cid:12) (cid:27)(cid:21) . (7) The signal transfer risk results from the classification of points belonging to the area where ≥ 1/2 Cγ| ηQ(x) γ. For simplicity, we assume the mild condition that sup(Q,P ) ∈ s(x) c n− P for some constant c > 0 to prevent a convergence rate faster than polynomial. Due to the strong signals offered by the source data within this area, it is intuitively expected that the signal transfer risk can be reduced with the aid of the source data sample − ̃Π | DP ξ( ˆf P ) & E { ≥ 1 2} ˆηQ(x) In this paper, the classifier derived from the target data is assumed to be a plug-in rule, of , where ˆηQ is an estimator of the regression function ηQ. By introducing the form 1 a novel strategy called the TAB model, the following result demonstrates a general approach to achieving a faster convergence rate of the excess risk. Theorem 1. Let ˆηQ be an estimate of the regression function ηQ and ˆf P be a classifier DP . Suppose there exist two nQ-sequences δQ, δf such that δ1+α c obtained by Q for some constant c > 0 and with probability at least 1 ∀ 2 Q & n− t > 0, δf , for any x Ω we have − ∈ DP . P sup (Q,P ) Π ∈ DQ | (cid:0) ˆηQ(x) ηQ(x) − X1:nQ t | | ≥ C1 exp ≤ (cid:1) 10 t δQ , (cid:17) (cid:17) − (cid:16) (cid:16) (8) 6 for some constant C1 > 0. Given the choice of τ & log(nQ ∨ ˆηQ(x) if − otherwise. 1 { ˆf P (x), ˆfT AB(x) = ˆηQ(x) 1 2} ≥ | , ( nP )δQ, the TAB classifier 1 2| ≥ τ, (9) satisfies sup (Q,P ) Π ∈ E( DQ, DP )EQ( ˆfT AB) . sup (Q,P ) Π ∈ DP ξ( ˆf P ) + ε(2τ ) E ! ∧ τ 1+α + δf . (10) We now explain every important term in the upper bound (10). • The term sup(Q,P ) DP ξ( ˆf P ) captures the risk transferred by the source data using a E classifier ˆf P , excluding the ambiguity component. It often exhibits a faster convergence rate than δ1+α and quantifies the benefits of transfer learning. ̃Π ∈ Q • The term ε(2τ ) quantifies the ambiguity level only when ηQ is close to 1/2. Thus, the target data not only establishes an upper bound on the excess risk but also plays a critical role in reducing the risk caused by ambiguity in the source data. • The threshold τ balances the classification ability of the target and source data by filtering out points easily classified with the target data. For τ = 0, our approach mirrors Audibert and Tsybakov (2007), achieving an asymptotically lower excess risk than δ1+α Q without source data. Alternatively, for τ = 1/2, only the source data is used to construct the classifier, which is often the case in domain adaptation when no target data is available. Our choice of τ between these extremes combines the advantages of the target and source data. • The final term δf represents the probability of the concentration inequality (8) failing due to extreme realizations of DQ. Generally, it is significantly smaller than the other terms that upper bound the excess risk. For instance, it decays exponentially with respect to nQ in non-parametric classification using K-NN estimators (See Lemma 9.1 of Cai and Wei (2021)). With the optimal choice of τ log(nQ ∨ in Audibert and Tsybakov (2007), up to some logarithmic terms. nP )δQ, our upper bound cannot be worse than the δ1+α ≍ Q Occasionally, the concentration of ˆηQ may not be exponential, as in (8). To overcome this limitation, the following theorem generalizes Theorem 1 to allow any type of concentration property of ˆηQ. Theorem 2. Let ˆηQ be an estimate of the regression function ηQ, and let ˆf P be a classifier obtained from ) such that for any (Q, P ) DP . Suppose that for some τ > 0, there exist functions δ( ∈ Π, the concentration property ), δQ( * * * * , , P DQ | (cid:0) ˆηQ(x) ηQ(x) τ | ≥ ≤ − δQ(nQ, τ ) (11) (cid:1) 11 holds for any x Ω∗ ∈ ⊂ Ω with Q(Ω∗) 1 − ≥ δ(nQ, τ ). Then the TAB classifier ˆfT AB(x) = satisfies ˆηQ(x) 1 { ˆf P (x), ( , 1 2} ≥ ˆηQ(x) if − otherwise. | 1 2| ≥ τ, (12) sup (Q,P ) Π ∈ E( DQ, DP )EQ( ˆfT AB) . sup (Q,P ) Π ∈ DP ξ( ˆf P ) + ε(2τ ) E ! ∧ τ 1+α + δQ(nQ, τ ) + δ(nQ, τ ). (13) The quantity δQ(nQ, τ ) in (11) controls the failure probability bound of the concentration inequality concerning In Theorem 1, it is further incorporated into the probability of extreme realizations of X1:nQ (8), and the subsequent concentration inequality for the failure probability related to Y1:nQ. To reduce the more general and abstract Theorem 2 to Theorem 1, it suffices to set δQ(nQ, τ ) = δf + C1 exp( Ω, where δf and C1 are the notations used in Theorem 1. (τ /δQ)2) and Ω∗ DQ. ≡ − Readers may be concerned that the exponential concentration (8) might not hold for all points over Ω. Indeed, this is particularly true when the support Ω is not compact, and the concentration inequalities only hold within a part of Ω with high probability. However, we can address this by adding a small failure probability with exponential concentration, i.e., 1 δ(nQ, τ ), to the risk bound given in (13). QX(Ω∗) − ≤ 3.2. Simple Approach to Bounding Signal Transfer Risk The majority of the existing literature focuses on bounding the target excess risk using only the target data. While the excess risk of a classifier ˆf P with respect to the source distribution, i.e., is well-studied, its signal transfer risk ξ( ˆf P ), given by (7), is less explored. 2E(X,Y ) ∼ P ηP (X) 1 2 − 1 ˆf P (X) = f ∗P (X) , o(cid:21) (cid:20)(cid:12) (cid:12) (cid:12) n (cid:12) (cid:12) (cid:12) To incorporate the vast literature of traditional statistical learning into our framework, we present a result that directly bounds the signal transfer risk ξ( ˆf P ) in terms of the excess risk of the source distribution. This result involves a more refined version of the signal transfer risk, and more significantly, does not rely on any concentration property often required by plug-in rules. Some additional assumptions are needed. Condition 1 ensures the boundedness of the . It ensures that PX is sufficiently large enough to learn every Radon-Nikodym derivative dQX dPX point in Ω relative to QX. Condition 1 (Absolutely Continuity). QX is absolutely continuous with respect to PX. More- over, there exists some constant M > 0 such that the Radon-Nikodym derivative satisfies dQX dPX M for any x (x) Ω. ≤ ∈ Denote all such marginal distribution pairs (QX, PX) that satisfy Condition 1 with param- eter M > 0 by (M). A 12 6 In other words, the source distribution provides enough coverage over the space Ω to enable It is worth noting that Condition 1 implicitly accurate learning of the target distribution. implies that Ω is a subset of ΩP . Now we are in a position to present the upper bound for the signal transfer risk with respect to the target distribution in terms of the source excess risk. Theorem 3. Define the source excess risk as εP := sup Π ∈ ∩A (Q,P ) (M ) E DP E(X,Y ) ∼ P Then, the signal transfer risk satisfies ηP (X) 1 2 − (cid:20)(cid:12) (cid:12) (cid:12) 1 ˆf P (X) = f ∗P (X) . n (cid:12) (cid:12) (cid:12) o(cid:21) sup Π ∈ ∩A (Q,P ) (M ) 1+α DP ξ( ˆf P ) E 2M 2γ − ≤ ( γ+α C 1MC − γ−1 γ+α α C − γ 1 γ εP , 1+α γ+α 1+α γ+α P ε , γ 1, ≥ γ < 1. Although the result may be sub-optimal when γ < 1 and additionally requires that (Q, P ) ∈ (M), Theorem 3 shows that the signal transfer risk can be bounded by the source excess A risk εP , and inherits the performance and possible consistency with respect to classification on the source data. As long as ˆf P learns the source distribution sufficiently well, the signal transfer risk will converges faster than the rate obtained with only the target data, namely, δ1+α Q . Theorem 3 only requires knowledge of conventional statistical learning techniques, which are widely studied and well-understood in the literature. Therefore, researchers and practi- tioners can easily apply our framework to a wide range of problems, without the need for specialized knowledge or expertise in transfer learning or related fields. Conventional theory on the excess risk can thus be applied to transfer learning. 4. Applications in Non-parametric Classification In this section, we aim to apply the general result of Theorem 1 to non-parametric clas- sification settings. Here we design the TAB classifier by combining plug-in rules over the target and source data, and obtain minimax optimal rates under non-parametric settings. See Audibert and Tsybakov (2007) for a comprehensive overview of theoretical properties of plug-in rules. We adopt K-nearest neighbor classifiers as plug-in rules for both ˆηQ and ˆηP . Our anal- ysis in this section then builds on prior work on rates for K-nearest neighbor classifica- tion (e.g. Hall et al. (2008); Samworth (2012); Gadat et al. (2016); Celisse and Mary-Huard (2018); Cannings et al. (2020a)). For a review of early work on the theoretical properties of the K-NN classifier, see Devroye et al. (1997). Also, in the literature of non-parametric classification, see Fan (1993) and Fan and Gijbels (1996) for local polynomial regression as an alternative to K-NN methods. If the classifier ˆf P ( is a general plug-in rule, we also provide an explicit upper bound for the signal transfer risk ξ( ˆf P ) based on the point-wise misclassification rate of ˆηP (x). See Appendix A.1 for the details of this bound and related results. ≥ { ) = 1 1 2} ˆηP ( ) * * 13 6 4.1. K-Nearest Neighbor TAB Classifier Given a query point x based on the Euclidean distances of the Xi's to x, i.e., ∈ Rd, we first reorder the target data pairs as (X(1), Y(1)), . . . , (X(nQ), Y(nQ)) X(1) − Then, we define the K-NN estimate ˆηQ kQ nearest neighbors of x in the target data: k x k2 ≤ * * * ≤ k X(nQ) − k2. x k (x) as the simple average of the response values of the ˆηQ kQ = 1 kQ kQ Y(i)(x). i=1 X kP (x) := k− P Similarly, we define the K-NN estimate ˆηP DP . Finally, we plug these estimates into the TAB K-NN classifier to obtain ˆηQ (x) kQ ˆηP kP (x) P ˆηQ (x) if kQ otherwise. ˆf N N T AB(x) = 1 2 | ≥ 1 1 ( − τ, | kP i=1 Y P 1 1 , 2} 1 , 2} ≥ ≥ { { (i)(x) for the source data pairs As for the threshold parameter, we choose τ log(nQ ∨ ≍ 1 2 nP )k− Q . Further elaboration on the rationale behind choosing τ , as well as the well-studied optimal selection of (kQ, kP ), can be found in Section 4.3. 4.2. Non-parametric Classification Setting We are now in a position to state the applications of our proposed TAB classifier in non- parametric classification under the finite dimension regime. In addition to the margin assump- tion and the ambiguity level assumption, this paper considers the non-parametric classification problem when the following smoothness condition holds. Condition 2 (Smoothness). For any β Rd g : Rd R satisfying, for any x, x′ → ∈ g(x) | for some constant Cβ > 0. We denote this class of functions by | ≤ − − k g(x′) x Cβk x′ β, (β, Cβ). H [0, 1], the (β, Cβ)-Holder is the class of functions ∈ Previous works, including Cai and Wei (2021) and Reeve et al. (2021), do not typically require any smoothness assumption for ηP . While this simplification is justified when ηP is closely related to ηQ, it may overlook valuable information from a sufficiently smooth ηP , leading to a phase-transition in the upper and lower bounds of the excess risk (for a detailed discussion, refer to Appendix A.2). In contrast, our approach considers the smoothness of both the target and source regression functions. Specifically, we assume that ηQ ∈ H (β, Cβ), ηP ∈ H (βP , CβP ). 14 This condition allows us to obtain a more refined upper bound that depends on the smoothness of both functions. Our next condition concerns the mass of the source and target distributions in the sense that the density functions with respect to QX and PX are bounded from zero and infinity. A similar condition has been imposed in (Audibert and Tsybakov 2007) and Cai and Wei (2021). We require that both QX and PX satisfy the following condition: Condition 3 (Strong Density). The marginal distribution QX is absolutely continuous with respect to the Lebesgue measure λ on its compact support (denoted by Ω). Furthermore, we have that dQX dλ (x) ∈ [μ−, μ+], λ(B(x, r) Ω) ∩ λ(B(x, r)) ≥ cμ, ∀ 0 < r < ru, x Ω, ∈ Denote the set of such marginal distributions QX by (μ+, μ−, cμ, rμ). S (μ) with positive parameters μ = Taking all the conditions above into account, we consider the subset of source and target distribution pairs in Π that satisfies Assumptions 1, 2 and Conditions 2, 3: Π : ηQ ΠN P := { (Q, P ) ∈ We further impose the mild assumption αβ (βP , CβP ), QX , PX ∈ S d to rule out the "super-fast" rates of convergence mentioned in Audibert and Tsybakov (2011). This is guaranteed to hold when ηQ equals 1/2 at an interior point of Ω (See Proposition 3.4 of Audibert and Tsybakov (2011)). In the following part of this section, we explore three types of additional conditions on the ∈ H ∈ H (μ) ≤ } . (β, Cβ), ηP space ΠN P and analyze the respective excess risks. 1. Band-like Ambiguity: We consider the scenario of band-like ambiguity described in Example 4. Define the focal parametric space as ΠN P BA := (Q, P ) (cid:26) ΠN P : s(x) Cγ ≥ ∈ Recall that in Example 4, we had shown that this implies ηQ(x) (cid:12) (cid:12) (cid:12) 1 2 − ∆, x ∀ ∈ − Ω . (cid:27) γ (cid:12) (cid:12) (cid:12) 1+α γ CαC − γ 2 1+α γ 1+α γ ∆ . ε(z; γ, Cγ/2) = Cαz1+α (cid:16) ∧ (cid:17) Furthermore, in this case, we set βP = 0, which means that no additional smoothness condition is imposed on ηP . Instead, we allow ηP to arbitrarily fluctuate within a small band whose width is measured by ∆. When ∆ = 0, our setting covers the one in Cai and Wei (2021). (cid:16) (cid:17) 2. Smooth Source: We add the condition βP ≥ γβ for scenarios where ηP is smooth. While the ambiguity level ε( ) is arbitrary, this condition ensures that points with strong signal strength have neighboring data points with strong signal strength of ηP as well, enhancing the classification of source data points with strong signal strength. Define ΠN P smoothness degree β, we set γ = 1. as the subset of ΠN P such that βP ≥ γβ. When ηQ and ηP share the same S * 15 3. Strong Signal with Imperfect Transfer: We consider the scenario in Example 3 where a strong signal strength exists but the direction may be reversed. This condition γ is smooth, which further ensures the ensures that the region s(x) Cγ| − availability of a sufficient number of neighboring source data points with the strong Ω : ηQ(x) = 1/2 signal. In fact, its boundary is a part of the decision boundary } whose smoothness is guaranteed by the smoothness of ηQ (see the proof of Theorem 4). ηQ(x) 1/2 ≤ ∈ x { | Define ΠN P I := (Q, P ) (cid:26) ∈ ΠN P : ηP is continuous, ηP (x) (cid:12) (cid:12) 1/2 (cid:12) 1 2 − Cγ ≥ ηQ(x) (cid:12) (cid:12) (cid:12) γ , 1 2 − x ∀ ∈ Ω . (cid:27) ΩR, i.e., (ηP (x) (cid:12) (cid:12) (cid:12) − (cid:12) (cid:12) (cid:12) 1 2 − (cid:12) (cid:12) (cid:12) It is worth noting that s(x) 1/2)(ηQ(x) ηQ(x) 0. Therefore, the ambiguity level Cγ| 1/2) γ if and only if x / ∈ − ≥ | − ≥ ε(z) = E(X,Y ) ∼ ηQ(X) Q 1 ηQ(X) 1 2 − (cid:12) (cid:12) (cid:12) (cid:26)(cid:12) (cid:12) (cid:12) (cid:20)(cid:12) (cid:12) (cid:12) z, X ΩR ∈ ≤ (cid:27)(cid:21) precisely captures the risk caused by different Bayes classifiers between the target and source data. We also let βP = 0 in this case, but assume that ηP is continuous to make sure that the region s(x) γ has a continuous boundary. | The analysis of the excess risk rate with respect to the wider class ΠN P is provided in ηQ(x) Cγ| 1/2 ≤ − Appendix A.2. 4.3. Optimal Rate of Excess Risk EQ( ˆf N N Before presenting the results regarding the optimal rate of selection. We choose the number of nearest neighbors as follows: T AB), we first discuss parameter kQ = 2β 2β+d Q cQn ⌊ , kP = ⌋ 2γβ 2γβ+d cP n P ⌊ ⌋ where cQ and cP are positive constants. This choice is motivated by previous work such as Gadat et al. (2016) and Cannings et al. (2020a), where similar choices are made in the context of nearest-neighbor methods. Notably, the choice of kP is similarly derived by seeing γβ as the "smoothness" parameter for the source data, and our choice coincides with the classical optimal choice when βP = γβ. In addition, we assume γ and β are known here for convenience. For adaptive and rate-optimal approaches to determining the number of nearest neighbors, see Lepski (1993); Reeve et al. (2021). As for the threshold in the TAB classifier ˆf N N T AB, we choose This choice is consistent with the concentration property of ˆηQ kQ , of which the "uncertainty" τ log(nQ ∨ ≍ 1 2 nP )k− Q . level δQ in (8) is proportional to k− definition of kQ, we see that 1 2 Q , since ˆηQ kQ is the average of kQ random variables. By the nP )n− Q β 2β+d . τ log(nQ ∨ ≍ Given a family of the target and source distributions, the next theorem gives a provable T AB, with the proper parameter upper bound on the excess risk of the TAB K-NN classifier ˆf N N choices. 16 Theorem 4 (Non-parametric Classification Upper Bound). Suppose that n d 2β+d Q exp( β(1+α) 2γβ+d n− P . Then the TAB K-NN classifier ˆf N N T AB(x) satisfies: 1. Band-like Ambiguity: cQn 2β 2β+d Q − ) . sup (Q,P ) ΠNP BA ∈ E( DQ, DP )EQ( ˆf N N T AB) . n− P (cid:18) β(1+α) 2γβ+d 1+α γ + ∆ log1+α(nQ ∨ nP )n− Q ∧ (cid:18) (cid:19) β(1+α) 2β+d . (14) 2. Smooth Source: sup (Q,P ) ΠNP S ∈ E( DQ, DP )EQ( ˆf N N T AB) . n− P (cid:18) β(1+α) 2γβ+d + ε(2τ ) log1+α(nQ ∨ nP )n− Q β(1+α) 2β+d ∧ (cid:19) (cid:18) 3. Strong Signal with Imperfect Transfer: sup (Q,P ) ΠNP I ∈ E( DQ, DP )EQ( ˆf N N T AB) . n− P (cid:18) β(1+α) 2γβ+d + ε(2τ ) log1+α(nQ ∨ nP )n− Q β(1+α) 2β+d ∧ (cid:19) (cid:18) (cid:19) (cid:19) (cid:19) . (15) . (16) Theorem 4 is obtained simply by verifying the conditions in Theorem 1, as demonstrated in Lemmas C.1 and C.2. We adopt a more refined and technical approach to analyze the signal transfer risk of plug-in rules (see Theorem 8) compared to Theorem 3. The mild d 2β+d Q condition n of Theorem 1. exp( 2β 2β+d Q β(1+α) 2γβ+d ) . n− P controls the failure probability δf in the terminology cQn − Our risk bounds reveal that transfer learning leads to faster convergence rates of excess risk when nP is large compared to nQ and the ambiguity level is small; specifically, ΠN P BA : nP ≫ : nP ≫ ΠN P S , ΠN P I 2γβ+d 2β+d Q 2γβ+d 2β+d Q n n , ∆ ≪ , ε(2τ ) γβ 2β+d ; n− Q τ 1+α. ≪ On the other hand, if nP is small compared to nQ, then the term n− dominates the upper Q bound, and reduces to the risk rate in the conventional setting with only target data and the strong density assumption (Audibert and Tsybakov 2007), up to logarithmic factors. β(1+α) 2β+d Remark 1. (a) When ∆ = 0 in (14), or ε( 0 in (16), our upper bound reduces to Theorem 2 of Cai and Wei (2021), up to logarithmic factors. Importantly, our method demonstrates robustness against a positive band error ∆, in constrast to the weighted K-NN estimator proposed in their work. We refer the reader to Figure 2 in Section 6 for a numerical comparison. (b) Our result (15) supplements these previous works (Cai and Wei 2021; Reeve et al. 2021) by allowing for an arbitrary type of ambiguity after imposing a smoothness condition on ηP . ≡ ) * We next provide lower bounds on the minimax excess risk, which show that the TAB K- NN classifier achieves the minimax optimal rates, even when we add the constraint Ω = ΩP . Throughout this paper, all lower bound results consider Π to be the set of distributions (Q, P ) that satisfy Assumption 1 and 2 with ambiguity level ε( ), without restricting to any given subset. * 17 Theorem 5 (Non-parametric Classification Lower Bound). Fix the parameters αβ set τ log(nQ ∨ ≍ nP )n− Q β 2β+d . We have that 1. Band-like Ambiguity: d and ≤ inf ˆf sup (Q,P ) ΠNP BA ∈ Ω=ΩP E( DQ, DP )EQ( ˆf N N T AB) & n− P (cid:18) β(1+α) 2γβ+d 1+α γ + ∆ β(1+α) 2β+d . n− Q ∧ (cid:19) (17) 2. Smooth Source: For some constant c > 0 that is independent of α, inf ˆf sup (Q,P ) ΠNP S ∈ Ω=ΩP E( DQ, DP )EQ( ˆf N N T AB) & n− P (cid:18) β(1+α) 2γβ+d + ε(cn− Q β 2β+d ) ∧ (cid:19) β(1+α) 2β+d . n− Q (18) 3. Strong Signal with Imperfect Transfer: For some constant c > 0 that is independent of α, inf ˆf sup (Q,P ) ΠNP I ∈ Ω=ΩP E( DQ, DP )EQ( ˆf N N T AB) & n− P (cid:18) β(1+α) 2γβ+d + ε(cn− Q β 2β+d ) ∧ (cid:19) β(1+α) 2β+d . n− Q (19) In the special case where supx optimal excess risk is long as β(1+α) 2β+d n− P (cid:18) Ω | ∈ + ∆1+α ∧ (cid:19) ηQ(x) ηP (x) ∆, we can determine that the minimax − n− Q β(1+α) 2β+d | ≤ , up to logarithmic factors of nQ ∨ nP . As nP ≫ nQ, ∆ ≪ β 2β+d , n− Q the classifier will benefit from the source data. The proof of Theorem 5 reveals that the condition (6), although slightly stronger than the band-like ambiguity condition (4), remains compatible with the lower bound construction as it ensures supx ηQ(x) ηP (x) ∆. Ω | ∈ − | ≤ 5. Applications in Logistic Regression Besides non-parametric classification, we also investigate the use of transfer learning in logistic regression models, which are a commonly used parametric approach in classification. Previous works such as Zheng et al. (2019) have studied the "data enriched model" for logistic regres- sion under a single-source setting, Abramovich and Grinshtein (2019) have explored sparse logistic regression in high-dimensional settings, and Tian and Feng (2022) have considered transfer learning in generalized linear models. Our goal is to reveal how incorporating an additional source logistic regression model with a different linear term coefficient can enhance the convergence of the excess misclassification rate. Suppose the source and target distributions are high-dimensional (d regression models given by Target data model: ηQ(x) = σ(βQ Source data model: ηP (x) = σ(βP T x) T x), 18 nQ→∞ −→ ∞ ) logistic (20) nP ) iid where two independent samples (X1, Y1), . . . , (XnQ, YnQ) iid ∼ ∼ P are observed. To simplify the theoretical analysis, we assume that the marginal distributions QX and PX are both N(0, Id), the d-dimension standard normal distribution. This marginal distribution is convenient when working with the restricted strong convexity condition (See Negahban et al. (2009)). 1 ), . . . , (X P Q and (X P nP , Y P 1 , Y P Let ∠(α, β) be the angle of two vectors α and β, in the range of 0 and π/2. Consider the following parametric space of the coefficient pair (βQ, βP ): Θ(s, ∆) = (βQ, βP ) : { βQk0 ≤ k s, ∠(βQ, βP ) , ∆ } ≤ for some s > 0 and ∆ [0, π/2]. The corresponding family of distribution pairs is then ∈ ΠLR = ΠLR(s, ∆, M) = { (Q, P ) : X, X P ηP (x) = σ(βT ∼ N(0, Id), ηQ(x) = σ(βT Qx), P x), (βQ, βP ) Θ(s, ∆) . } ∈ (21) (22) To ensure the control of the ambiguity level, we impose a constraint on the angle between βQ and βP in (21), which must be smaller than a constant ∆. Importantly, our constructed parametric space does not impose any sparsity conditions on βP . Given the family of logistic distribution pairs ΠLR, we show that ΠLR is a subset of the ∆2, provided that overall distribution pair space Π with α = 1 and ε(z, 1, m/π) . z2 βP k ≥ k larization terms to obtain ˆβQ and ˆβP , i.e., for some constant m > 0. See Lemma D.1 for a detailed proof. For model fitting, we minimize the negative Bernoulli likelihood function with lasso regu- βQk m k ∧ nQ i=1 n X nP ˆβQ = arg min Rp β ∈ ˆβP = arg min β Rp ∈ 1 nQ 1 nP log(1 + eX T i β) − YiX T i β log(1 + eX P i i=1 n X T β) − o T i X P Y P i + λQk β k1 + λP k β k1, β o (23) where λ then 1 { becomes ∗ ≍ σ( ˆβT q Qx) log d n∗ for 1 2} ≥ Q, P ∗ ∈ { ˆβT = 1 Qx } . The corresponding target and source plug-in classifiers are 0 } and 1 ˆβT P x { 0 } ≥ . Hence, the TAB logistic lasso classifier ≥ { ˆf LR T AB(x) = 1 1 ( ˆβT Qx ˆβT P x { { 0 0 , , } } ≥ ≥ σ( ˆβT Qx) if otherwise. | 1 2| ≥ τ, − By setting λQ, λP , and τ properly, the excess risk upper bound we obtain is given by the following theorem. Theorem 6. Assume that L 0 < m ≤ and nQ ∧ βQk2 ≤ k 1. Suppose that for some constant K > 0, we have dK & nQ∨ nP ≫ s log d. Let ˆβQ, ˆβP be obtained in (23) with βP k2 ≤ U for some constants L, U > 0 and nP s log d, log nP s log d , nQ ≫ m k ≤ λQ = cQ log d nQ s , λP = cP log d nP , r 19 for some constants cQ, cP ≥ (K + 1). The TAB lasso classifier with threshold p τ = cτ s log d nQ s log(nQ ∨ nP ), for some constant cτ > 0, satisfies DP )EQ( ˆf LR sup DQ, E( (Q,P ) ΠLR T AB) . ∈ s log d nP (cid:18) + ∆2 ∧ (cid:19) (cid:18) s log d nQ log2(nQ ∨ nP ) . (cid:19) (24) The term s log d nQ is the classical risk term with access to only the target data, and s log d nP is the risk term transferred by the source data with an additional term ∆2 measuring the angle discrepancy between βQ and βP . We see that knowledge from the source data can significantly improve the learning performance when nP is large and ∆ is small, namely, nP ≫ nQ, ∆ ≪ s s log d nQ . It is worth noting that the small angle condition between βQ and βP considered in this paper is a more general assumption than the contrast assumption in Tian and Feng (2022), which requires that βQ is sparse and the lq-norm of the difference between βQ and βP is small for some q [0, 1]. In contrast, our result is applicable to a broader class of parameter spaces, allowing for βP to not only be non-sparse, but also differ significantly in norm from βQ. ∈ We choose this τ to ensure that, with high probability, we have in turn, implies k ˆβQ − βQk2 . √sλQ. This, Qx) − σ(βT Qx) . √sλQ σ( ˆβT (cid:12) (cid:12) (cid:12) DP ξ(1 with high probability with respect to QX = N(0, Id). The proof of Theorem 6 then comes from ∆2 verifying that sup(Q,P ) ) ≍ ∈ in Lemma D.1. This indicates that even when βP is non-sparse, we can still obtain a reliable estimate of βP by incorporating a lasso regularizer, if in addition ∆ is sufficiently small (See Lemma D.3). + ∆2 in Theorem 2 and ε(z) ΠLR E ˆβT P x z2 ≍ ≥ ∧ } { 0 (cid:12) (cid:12) (cid:12) s log d nP Theorem 7 below shows that the upper bound (24) in Theorem 6 is optimal up to loga- rithmic factors of nQ ∨ Theorem 7. Suppose that s log d nP nP . nQ∨ inf ˆf sup (Q,P ) ΠLR ∈ . 1. We have that EQ( ˆf ) & E s log d nP (cid:18) + ∆2 ∧ (cid:19) s log d nQ . The derivation of the lower bound involves two terms. The term s log d represents the optimal convergence rate when the target and source distributions are identical, i.e., βP = βQ. The term ∆2 corresponds to the choice βP = (1, 0, 0, . . . , 0) in the lower bound construction, which imposes a sparsity constraint on βQ within a small cone. s log d nQ s log d nQ nP ∧ ∧ It is worth noting that traditional lower bounds, typically derived from Fano's lemma, only consider minimax rates with respect to a distance metric. To show our lower bound of EQ( ˆf ), we introduce a novel transformation that relates the excess risk to the excess risk E the angle difference of the linear coefficients. By applying Fano's lemma to this transformed quantity, we obtain the desired lower bound. We refer the reader to Lemma E.4 for a detailed explanation. 20 6. Simulation Studies As mentioned earlier, the TAB classifier offers benefits in scenarios where nP is large and the ambiguity level is small, and prevents negative transfer when the source data lacks sufficient information to aid the classification. In this section, we present simulation studies to demon- strate the practical benefits of transfer learning and the TAB classifier. We separately consider the non-parametric classification and logistic regression settings. 6.1. Non-parametric Classification Setting The setting we considered is as follows: d = 2, Ω = ΩP = [0, 1]2, QX = PX = Uniform([0, 1]2), the uniform distribution over the square. For the target regression function, let ηQ(x) = ηQ(x1, x2) = 1 10 sin(2π(x1 + x2)). We have α = β = 1 for some constants Cα and Cβ. Next, we consider two different non-parametric regression scenarios, by specifying the source regression function ηP with different types of ambiguity. 2 + 1 1. Band-like Ambiguity: For ∆ 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6 , γ } 0.5, 1 : } ∈ { ∈ { ηP (x) =   1 2 + 2 (cid:16) 1 2 2 − (cid:16) ηQ(x) 1 2 − ηQ(x) 1 2 − (cid:17) (cid:17) γ γ ∆, − + ∆, if ηQ(x) 1 2, if ηQ(x) < 1 2. ≥ Here, ηP concentrates around an informative curve with respect to ηQ with some ambi- guity ∆. In this case, we have s(x) ηQ(x) 1/2 ∆.  γ ≥ | − | − 2. Partially Flipped Sine Functions: For r 0.5, 1 : } { 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35 , γ } ∈ ∈ { ηP (x) = ηP (x1, x2) = 1 2 − 2 + 1 1 1 5 sin 5 sin   2π { (cid:16) 2π { } x1+x2 r r x1+x2 (cid:17) }− r 1 − if if 2x1 + 2x2} ∈ 2x1 + 2x2} ∈ { { [0, r], (r, 1], γ , γ , (cid:17) (cid:16) {  − ⌊ a ⌋ a } = a represents the fractional part of a real value a. The following where graph illustrates our setup of ηP . While keeping ηP continuous with βP = 1, the ratio parameter r creates an area where the Bayes classifier differs from the target distribution. The positive classification regimes are identical when r = 0 and completely opposite when r = 1. See Figure 1 for a visualization. In each scenario, we set nQ = 200 and nP = 1000, as a large nP is necessary to observe the benefits of transfer learning. Previous studies Cai and Wei (2021); Reeve et al. (2021) have shown that accuracy improves with increasing nP . We also generate 50000 independent test pairs from Q. For the TAB K-NN classifier, we choose kQ = and τ = 0.05. As mentioned before, β = 1. n ⌊ 2β 2β+d Q = 31, kP = ⌋ 2γβ 2γβ+d n P ⌊ , ⌋ We choose the simple K-NN classifiers on Q data and P -data as two benchmarks for comparison. Moreover, we add the K-NN classifier on the pooled data, combining both the target and source with the nearest-neighbor parameter k chosen by 5-fold cross-validation. We also consider the weighted K-NN classifiers proposed in Cai and Wei (2021) with their − 2β+d 2γβ+d indicated optimal weighting scheme wQ + wP = 1, wP /wQ = (nQ + n P (γ−1)β 2β+d . ) 21 η 0.6 0 0.5 1 1.5 ηQ 2 ηP x1 + x2 0.4 Figure 1: Illustration of ηP in the second simulation setup with γ = 1 and r = 0.4. Figure 2 shows that our TAB classifier is accurate when ∆ is small, as does K-NN on P - data. Furthermore, our TAB classifier outperforms K-NN on P -data, K-NN on pooled data, and the weighted K-NN by a significant margin for large ∆, demonstrating its ability to avoid negative transfer when the source data is unreliable. The pooling and weighting algorithm benchmarks improve the classification when ∆ is small; however, they tend to break down when ∆ is large. γ = 0.5 γ = 1 ) % ( y c a r u c c A 1 0.8 0.6 0.4 0.1 0.2 0.3 0.4 0.5 ∆ Q-KNN P -KNN TAB-KNN Pooled-KNN Weighted-KNN ) % ( y c a r u c c A 1 0.8 0.6 0.4 0.1 0.2 0.3 0.4 0.5 ∆ Figure 2: Accuracy of the TAB K-NN classifiers under the band-like ambiguity scenario. We experiment with different values of ∆ for a given γ = 0.5 and 1. Blue: TAB K-NN classifier; Red: K-NN classifier on only Q-data; Green: K-NN classifier on only P -data; Brown: K-NN classifer on pooled data. Additionally, Figure 3 shows that our TAB classifier improves the accuracy when the am- biguity level, depicted by r, is small. In addition, our TAB classifier significantly outperforms the other three benchmarks when the ambiguity level is too large to benefit from transfer learning, conserving the classification ability using only Q-data. 22 γ = 0.5 γ = 1 1 ) % ( y c a r u c c A 0.8 0.6 1 ) % ( y c a r u c c A 0.8 0.6 Q-KNN P -KNN TAB-KNN Pooled-KNN Weighted-KNN 0.4 0 0.1 0.3 0.4 0.2 r 0.4 0 0.1 0.3 0.4 0.2 r Figure 3: Accuracy of the TAB K-NN classifiers under the scenario with partially flipped sine functions. We experiment with different values of the ratio parameter r for a given γ = 0.5 and 1. Blue: TAB K-NN classifier; Red: K-NN classifier on only Q-data; Green: K-NN classifier on only P -data; Brown: K-NN classifer on pooled data. 6.2. Logistic Regression Setting We next consider the scenario where both ηQ and ηP follow the logistic models (20), where the parameters are estimated by (23). We set nQ = 200, nP = 500, QX = PX = N(0, Id), and simulate 50000 test data points. The linear coefficient is given by βQ = (0.5 1s, 0d − s), * βP = (1.5 1s, k √d βQk s − * tan ∆ 1d − s), * where 1s and 0s, respectively, denotes a vector of all 1s and a vector of all 0s with size s. Here, we set s = 10, which is small compared to d. For the source distribution, βP could be treated as a rotated version of 3βQ, with an angle of exactly ∆ between them. The range , which gradually approaches π/2. of ∆ is chosen in the set We simulate 50000 test data points for each value of ∆. The lasso regularization parameter is selected by 5-fold cross-validation and chosen to be the largest λ at which the MSE is within one standard error of the minimum MSE, namely, λ1se. 0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6 } { In addition to our proposed TAB classifier, we compare three benchmarks for performance: logistic regression with lasso penalty on Q-data, P -data, and pooled data. Figure 4 demon- strates that our TAB classifier achieves high accuracy when the angle between βQ and βP is small. Interestingly, as evidence of its robustness, our classifier retains some classification ability with the target data even when the angle is large, while the benchmark classifiers based on P -data and pooled data suffer from negative transfer. 7. Conclusion In this paper, we have proposed a new approach to transfer learning that is robust against an unreliable source distribution with arbitrary ambiguity in the source data. Our work 23 0.8 0.7 0.6 0.5 ) % ( y c a r u c c A Q-Lasso Logistic P -Lasso Logistic TAB-Lasso Logistic Pooled-Lasso Logistic 0.4 0 0.5 1 ∆ 1.5 2 Figure 4: Accuracy of the TAB logistic classifier with lasso penalty. We conduct experiments [0, π/2]. Blue: TAB logistic classifiers with lasso with difference choices of the angle ∆ penalty; Red: Logistic classifier with lasso penalty on only Q-data; Green: Logistic classifier with lasso penalty on only P -data; Brown: Logistic classifier with lasso penalty on pooled data. ∈ uses a different way of transferring the source data and, in particular, encompasses the non- parametric setting in Cai and Wei (2021) and Reeve et al. (2021) and parametric setting in Li et al. (2022). By introducing the ambiguity level, our approach enables us to understand the circumstances under which we can improve classification performance, given source data with potential ambiguity. Our proposed TAB classifier, with a threshold τ that balances the performance of both the target and source data, is shown to be both efficient and robust, as the excess risk improves for a reliable source distribution and avoids negative transfer with an unreliable source distribution. Furthermore, we provide simple approaches to bound the signal transfer risk, a key component of the excess risk in our general convergence result, in terms of the conventional excess risk extensively studied in the literature of statistical learning. We then demonstrate the power of our approach on specific classification tasks, with a focus on non-parametric classification and logistic regression settings. The upper bounds are shown to be optimal up to some logarithmic factors and are more general than previous work on transfer learning. Simulation studies provide numerical evidence for these two classification tasks. There are several promising avenues for future research that may build on the contributions of this paper. One potential direction is to consider an extension of the signal strength and ambiguity level that incorporates a translation parameter, i.e., sκ(x) := ηP (x) | 0, ( 1 2 − , κ | − ηQ(x) sgn otherwise. (cid:0) κ 1 2 − − × (ηP (x) 1 2) ≥ 0, − (cid:1) γ E(X,Y ) ∼ Q ηQ(X) 1 2 − 1 sκ(X) Cγ ≤ (cid:20)(cid:12) (cid:12) (cid:12) (cid:26) (cid:12) (cid:12) (cid:12) − ηQ(X) (cid:12) (cid:12) (cid:12) 1 2 (cid:12) (cid:12) x (cid:12) { ∈ Cγzγ ≤ ≤ (cid:27)(cid:21) Ω : ηQ(x) = 1 εκ(z; γ, Cγ). may be similar 2} This extension is natural since the decision boundary 24 { x Ω : ηP (x) = 1 to may be incurred due to the presence of an unknown κ, and an empirical risk minimization procedure after obtaining ˆηP such as . We conjecture that an additional estimation error of ( log nQ nQ 2 + κ } ∈ ) 1+α 2+α ˆκ = arg min 2 , 1 2 ] [ κ ∈ − 1 1 n n 1 1 ˆηP (Xi) i=1 X (cid:26) n 1 2 ≥ + κ = Yi o (cid:27) may be required to obtain a corrected version of ˆf P over the target data. Another direction is to develop an adaptive and generic procedure for selecting the thresh- old τ . There are three possible directions. Firstly, it is an open question whether simple Empirical Risk Minimization (ERM) methods for choosing τ still keeps the upper bound op- timal. Secondly, Lepski's method (Lepski 1993) may offer a solution for maintaining optimal rates with an adaptive choice of τ . Thirdly, we conjecture that choosing τ Q , where ˆηQ is an M-estimator consisting of a simple average of kQ terms, is helpful for obtaining an optimal rate. log(nQ ∨ nP )k− ≍ 1 2 As a final future direction, the conditions presented in the non-parametric and logistic model settings could be relaxed to some extent, for instance, by considering non-compact feature spaces with sub-Gaussian conditions or other marginal distribution assumptions (e.g., Assumption A4 in Gadat et al. (2016)). Our proposed TAB classifier is expected to perform well in these settings without a significant modification of the framework, and may offer advantages over other case-specific estimators in the transfer learning literature. REFERENCES Abramovich, F. and Grinshtein, V. (2019). High-dimensional classification by sparse logistic regression. IEEE Transactions on Information Theory, 65(5):3068–3079. Audibert, J.-Y. and Tsybakov, A. B. (2007). Fast learning rates for plug-in classifiers. The Annals of Statistics, 35(2):608–633. Audibert, J.-Y. and Tsybakov, A. B. (2011). Fast learning rates for plug-in classifiers under the margin condition. Bastani, H. (2020). Predicting with proxies: Transfer learning in high dimension. Management Science, 67. Ben-David, S., Blitzer, J., Crammer, K., Kulesza, A., Pereira, F., and Vaughan, J. (2010a). A theory of learning from different domains. Machine Learning, 79:151–175. Ben-David, S., Lu, T., Luu, T., and Pal, D. (2010b). Impossibility theorems for domain adaptation. In Teh, Y. W. and Titterington, M., editors, Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, volume 9 of Proceedings of Machine Learning Research, pages 129–136, Chia Laguna Resort, Sardinia, Italy. PMLR. Bickel, P. J. and Levina, E. (2008). Regularized estimation of large covariance matrices. The Annals of Statistics, 36(1):199 – 227. 25 6 Blanchard, G., Deshmukh, A. A., Dogan, U., Lee, G., and Scott, C. (2021). Domain general- ization by marginal transfer learning. J. Mach. Learn. Res., 22(1). Cai, T. T. and Pu, H. (2022). Transfer learning for nonparametric regression: Non-asymptotic minimax analysis and adaptive procedure. Technical report, University of Pennsylvania. Cai, T. T. and Wei, H. (2021). Transfer learning for nonparametric classification: Minimax rate and adaptive classifier. The Annals of Statistics, 49:100–128. Cannings, T. I., Berrett, T. B., and Samworth, R. J. (2020a). Local nearest neighbour classi- fication with applications to semi-supervised learning. Annals of Statistics, 48:1789–1814. Cannings, T. I., Fan, Y., and Samworth, R. J. (2020b). Classification with imperfect training labels. Biometrika, 107(2):311–330. Caruana, R. (1997). Multitask learning. Machine Learning, 28. Celisse, A. and Mary-Huard, T. (2018). Theoretical analysis of cross-validation for estimating the risk of the k-nearest neighbor classifier. Journal of Machine Learning Research, 19(58):1– 54. Chen, A., Owen, A., and Shi, M. (2013). Data enriched linear regression. Electronic Journal of Statistics, 9. Choi, K., Fazekas, G., Sandler, M. B., and Cho, K. (2017). Transfer learning for music classification and regression tasks. In International Society for Music Information Retrieval Conference. Christiansen, R., Pfister, N., Jakobsen, M. E., Gnecco, N., and Peters, J. (2020). The difficult task of distribution generalization in nonlinear models. arXiv: Methodology. Cortes, C., Mohri, M., and Medina, A. M. (2019). Adaptation based on generalized discrep- ancy. Journal of Machine Learning Research, 20(1):1–30. Devroye, L., Gy ̈orfi, L., and Lugosi, G. (1997). A Probabilistic Theory of Pattern Recognition. Stochastic Modelling and Applied Probability. Springer New York. Fan, J. (1993). Local Linear Regression Smoothers and Their Minimax Efficiencies. The Annals of Statistics, 21(1):196 – 216. Fan, J. and Gijbels, I. (1996). Local polynomial modelling and its applications: monographs on statistics and applied probability 66, volume 66. CRC Press. Fan, J., Li, R., Zhang, C.-H., and Zou, H. (2020). Statistical Foundations of Data Science (1st ed.). CRC Press. Frenay, B. and Verleysen, M. (2014). Classification in the presence of label noise: A survey. IEEE Transactions on Neural Networks and Learning Systems, 25(5):845–869. Gadat, S., Klein, T., and Marteau, C. (2016). Classification in general finite dimensional spaces with the k-nearest neighbor rule. Annals of Statistics, 44(3):982–1009. 26 Germain, P., Habrard, A., Laviolette, F., and Morvant, E. (2013). A pac-bayesian approach for domain adaptation with specialization to linear classifiers. In Dasgupta, S. and McAllester, D., editors, Proceedings of the 30th International Conference on Machine Learning, vol- ume 28 of Proceedings of Machine Learning Research, pages 738–746, Atlanta, Georgia, USA. PMLR. Gretton, A., Smola, A., Huang, J., Schmittfull, M., Borgwardt, K., and Sch ̈olkopf, B. (2008). 131Covariate Shift by Kernel Mean Matching. In Dataset Shift in Machine Learning. The MIT Press. Gross, S. M. and Tibshirani, R. (2016). Data shared lasso: A novel tool to discover uplift. Computational Statistics & Data Analysis, 101:226–235. Gyorfi, L. (1978). On the rate of convergence of nearest neighbor rules (corresp.). IEEE Transactions on Information Theory, 24:509 – 512. Hall, P., Park, B. U., and Samworth, R. J. (2008). Choice of neighbor order in nearest-neighbor classification. The Annals of Statistics, 36(5):2135 – 2152. Hanneke, S. and Kpotufe, S. (2019). On the value of target data in transfer learning. In Wallach, H., Larochelle, H., Beygelzimer, A., d'Alch ́e-Buc, F., Fox, E., and Garnett, R., editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc. Huang, J.-T., Li, J., Yu, D., Deng, L., and Gong, Y. (2013). Cross-language knowledge transfer using multilingual deep neural network with shared hidden layers. In 2013 IEEE International Conference on Acoustics, Speech and Signal Processing, pages 7304–7308. Kpotufe, S. and Martinet, G. (2018). Marginal singularity, and the benefits of labels in covariate-shift. The Annals of Statistics, 49. Lepski, O. V. (1993). Asymptotically minimax adaptive estimation. ii: Schemes without optimal adaptation: Adaptive estimators. Theory of Probability & Its Applications, 37:433– 448. Li, S., Cai, T. T., and Li, H. (2022). Transfer learning for high-dimensional linear regression: Prediction, estimation and minimax optimality. Journal of the Royal Statistical Society: Series B, 84:149–173. Li, X., Grandvalet, Y., Davoine, F., Cheng, J., Cui, Y., Zhang, H., Belongie, S., Tsai, Y.-H., and Yang, M.-H. (2020). Transfer learning in computer vision tasks: Remember where you come from. Image and Vision Computing, 93:103853. Maity, S., Sun, Y., and Banerjee, M. (2022). Minimax optimal approaches to the label shift problem in non-parametric settings. Journal of Machine Learning Research, 23:1–45. Mammen, E. and Tsybakov, A. B. (2004). Smooth discrimination analysis. The Annals of Statistics, 32(5):2340 – 2341. 27 Mansour, Y., Mohri, M., and Rostamizadeh, A. (2009a). Domain adaptation: Learning bounds and algorithms. In Proceedings of The 22nd Annual Conference on Learning Theory (COLT 2009), Montr ́eal, Canada. Mansour, Y., Mohri, M., and Rostamizadeh, A. (2009b). Multiple source adaptation and the r ́enyi divergence. In Proceedings of the Twenty-Fifth Conference on Uncertainty in Artificial Intelligence, UAI '09, page 367–374, Arlington, Virginia, USA. AUAI Press. Maurer, A., Pontil, M., and Romera-Paredes, B. (2016). The benefit of multitask representa- tion learning. J. Mach. Learn. Res., 17(1):2853–2884. Natarajan, N., Dhillon, I. S., Ravikumar, P., and Tewari, A. (2018). Cost-sensitive learning with noisy labels. Journal of Machine Learning Research, 18(155):1–33. Negahban, S., Ravikumar, P., Wainwright, M. J., and Yu, B. (2009). A unified framework for high-dimensional analysis of m-estimators with decomposable regularizers. In Proceedings of the 22nd International Conference on Neural Information Processing Systems, NIPS'09, page 1348–1356, Red Hook, NY, USA. Curran Associates Inc. Ollier, E. and Viallon, V. (2017). Regression modelling on stratified data with the lasso. Biometrika, 104(1):83–96. Pan, S. J. and Yang, Q. (2010). A survey on transfer learning. IEEE Transactions on Knowl- edge and Data Engineering, 22(10):1345–1359. Quionero-Candela, J., Sugiyama, M., Schwaighofer, A., and Lawrence, N. D. (2009). Dataset Shift in Machine Learning. The MIT Press. Raskutti, G., Wainwright, M. J., and Yu, B. (2009). Minimax rates of estimation for high- dimensional linear regression over l q -balls. IEEE Transactions on Information Theory, 57:6976–6994. Reeve, H. and Kaban, A. (2019). Fast rates for a knn classifier robust to unknown asymmetric label noise. Proceedings of Machine Learning Research, 97:5401–5409. International Confer- ence on Machine Learning, ICML 2019 ; Conference date: 09-06-2019 Through 15-06-2019. Reeve, H. W. J., Cannings, T. I., and Samworth, R. J. (2021). Adaptive transfer learning. Annals of Statistics, 49(6):3618–3649. Ruder, S., Peters, M. E., Swayamdipta, S., and Wolf, T. (2019). Transfer learning in natural language processing. In Proceedings of the 2019 Conference of the North American Chap- ter of the Association for Computational Linguistics: Tutorials, pages 15–18, Minneapolis, Minnesota. Association for Computational Linguistics. Samworth, R. J. (2012). Optimal weighted nearest neighbour classifiers. The Annals of Statistics, 40(5):2733 – 2763. Scott, C., Blanchard, G., and Handy, G. (2013). Classification with asymmetric label noise: Consistency and maximal denoising. In Shalev-Shwartz, S. and Steinwart, I., editors, Pro- ceedings of the 26th Annual Conference on Learning Theory, volume 30 of Proceedings of Machine Learning Research, pages 489–511, Princeton, NJ, USA. PMLR. 28 Scott, C. and Zhang, J. (2019). Learning from multiple corrupted sources, with application to learning from label proportions. CoRR, abs/1910.04665. Scott, C. D. (2018). A generalized neyman-pearson criterion for optimal domain adaptation. ArXiv, abs/1810.01545. Sinha, A., Namkoong, H., and Duchi, J. C. (2018). Certifying some distributional robustness with principled adversarial training. In 6th International Conference on Learning Represen- tations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net. Storkey, A. (2008). 23When Training and Test Sets Are Different: Characterizing Learning Transfer. In Dataset Shift in Machine Learning. The MIT Press. Tian, Y. and Feng, Y. (2022). Transfer learning under high-dimensional generalized linear models. Journal of the American Statistical Association, 0(0):1–14. Tzeng, E., Hoffman, J., Saenko, K., and Darrell, T. (2017). Adversarial discriminative do- main adaptation. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 2962–2971, Los Alamitos, CA, USA. IEEE Computer Society. Wang, D. and Zheng, T. F. (2015). Transfer learning for speech and language processing. In 2015 Asia-Pacific Signal and Information Processing Association Annual Summit and Conference (APSIPA), pages 1225–1237. IEEE. Weiss, K., Khoshgoftaar, T., and Wang, D. (2016). A survey of transfer learning. Journal of Big Data, 3. Zheng, C., Dasgupta, S., Xie, Y., Haris, A., and Chen, Y. Q. (2019). On data enriched logistic regression. arXiv: Applications. 29 A. Supplementary Results A.1. General Signal Transfer Risk Bound for Plug-in Rules Suppose that ˆf P can be expressed in the form of a plug-in rule, i.e., ˆf P ( where ˆηP ( the area with strong signal strength as ) is an estimate of the regression function ηP ( 1 , 2 } ). For notational simplicity, define ) = 1 ˆηP ( ≥ { ) * * * * Ω+(γ, Cγ) := x { ∈ Ω : s(x) ηQ(x) Cγ| ≥ γ 1 2 | . } − Since Ω+(γ, Cγ) indicates the informative area where ηP provides strong signal relative to ηQ, ˆηP could also give indications on ηQ if it approximates ηP well. In order to obtain a complete convergence rate for the signal transfer risk, it is necessary to impose some conditions on the behavior of ˆηP . The following result requires that ˆηP recovers ηP in the sense that the misclassification rate is upper bounded. Theorem 8. Let ˆηP be an estimator of the regression function ηP depending on that two nP -sequences δP , δP,f satisfy that, with probability at least 1 C2 > 0, − DP . Suppose δP,f , for some constant (ˆηP (x) sup (Q,P ) Π P DP ∈ holds except at Ωb (cid:18) 1 2 − )(ηQ(x) 1 2 − ) < 0 X P 1:nP | C2 exp ( − (cid:18) ≤ (cid:19) Cγ| ηQ(x) δP γ 1 2| )2 − (cid:19) (25) Ω+(γ, Cγ). Then we have ⊂ DP ξ( ˆf P ) . δ E 1+α γ P + δP,f + δb P , sup (Q,P ) Π ∈ where δb P = sup(Q,P ) ∈ Π ηQ(x) 1 2 | − dQX. Ωb | R Theorem 8 does not explicitly require the concentration property for ˆηP around the true regression function ˆηP . Instead, it bounds the misclassification rate for a given query point )2) which is consistent with the signal provided by ηP relative to ηQ by C2 exp( within the signal transfer set. ηP (x) δP 1/2 | − ( | − Similar to δf , the quantity δP,f denotes the (typically small) probability that the misclas- sification rate bound (25) fails. To account for the case where the query point is near the boundary of the signal transfer set Ω+(γ, Cγ), and the estimate ˆηP (x) may be influenced by its neighborhood outside the set, we introduce a new term δb P in addition to δP,f . This allows for the possibility of failure of the misclassification rate bound (25) near the boundary of the signal transfer set. This situation may occur in some non-parametric methods, such as K-NN models, and needs to be considered in theoretical analysis. The following simple proposition shows that (25) is weaker than the classical exponential concentration inequality. Proposition 1. Let ˆηP be an estimator of the regression function ηP depending on any x Ω+(γ, Cγ), the event that for any t > 0, ∈ DP . For sup (Q,P ) Π ∈ P ˆηP (x) ηP (x) X P 1:nP t | | ≥ − DP | (cid:0) belongs to the event that (25) holds. C2 exp t δP )2 ( − (cid:18) (cid:19) ≤ (cid:1) 30 Proof. The result is straightforward by observing that P DP ((ˆηP (x) 1 2 − )(ηQ(x) 1 2 − ) < 0 X P 1:nP ) | P DP ( | ≤ ˆηP (x) − ηP (x) ηP (x) X P 1:nP ), || | ≥ | of which the latter term is less than C2 exp( − )2). it is also less than C2 exp( ( Cγ 1/2 | − γ | ηQ(x) δP − ( | ηP (x) | δP )2). Since we require that x Ω+(γ, Cγ), ∈ A.2. Non-parametric Classification with General Form of Ambigu- ity In this section, we focus on the general parametric space ΠN P under the non-parametric classification scenario. Under this scenario, it is necessary to discuss the relationship between the parameters α, γ, β and βP . We claim that, if γβ βP , we can rule out a "super-smooth" source regression function ηP . The motivation behind this assumption is that if γβ < βP , the smoothness of ηP will potentially restrict the family of the target distribution Q. To see this, we define the family of target distributions as follows: ≥ ΠN P Q := Q : Q (α, Cα), ηQ { ∈ H (α, Cα) denotes the set of distributions that satisfies the margin assumption (As- 0 and Cα > 0. The following proposition shows that when ∈ M } (β, Cβ), QX ∈ S (μ) , Q is not a subset of the slice of ΠN P on Q when setting ε(z) M where sumption 1) with parameters α γβ < βP , ΠN P ≥ 0. ≡ Proposition 2. Suppose ΠN P satisfies ε(z) 0. Then, ≡ 1. If γβ ≥ βP , then ΠN P Q = Q : (Q, P ) { 2. If γβ < βP , then ΠN P Q 6⊂ { Q : (Q, P ) ΠN P ΠN P } . } ∈ ∈ for CβP ≥ Cγ2− γ ∨ 2CγC βP β 2γ β βP /β. − Proposition 2 implies that when βP is sufficiently large, a too-small γ imposes an additional smoothness condition on Q. To avoid this issue, we assume that a large enough γ Define Ω+(γ, Cγ) := x { ∈ Ω : s(x) ηQ(x) Cγ| ≥ γ 1 2 | } − βP /β. ≥ as the area with strong signal strength for convenience. The upper bound results is as follows. Theorem 9 (Non-parametric Classification Upper Bound, General Case). Suppose that d 2β+d Q n exp( 2β 2β+d Q β(1+α) 2γβ+d ) . n− P . Then the TAB K-NN classifier ˆf N N T AB(x) satisfies cQn − • γβ ≥ βP : For any (Q, P ) ΠN P , ∈ E( DQ, DP )EQ( ˆf N N T AB) . n− P (cid:18) . n− P (cid:18) β(1+α) 2γβ+d + εb + ε(2τ ) βP (1+α)/γ 2γβ+d + ε(2τ ) (cid:19) ∧ (cid:19) 31 ∧ log1+α(nQ ∨ (cid:18) log1+α(nQ ∨ (cid:18) β(1+α) 2β+d nP )n− Q nP )n− Q (26) β(1+α) 2β+d (cid:19) , (cid:19) where εb = Ωb := { Ωb | R x ∈ ηQ(X) 1 2 | − dQX and the boundary of the signal transfer set is defined as Ω : ηQ(x) | 1 2 | ≤ − βP /γ 2γβ+d cbn− P , B(x, cbn− P 1 2γβ+d ) Ω ΩP 6⊂ ∩ ∩ Ω+(γ, Cγ) } for some constant cb > 0. • γβ < βP : If we choose kP = 2βP 2βP +d cP n P ⌊ ⌋ βP (1+α)/γ 2βP +d for any cP > 0 instead, then sup (Q,P ) ΠNP ∈ E( DQ, DP )EQ( ˆf N N T AB) . n− P (cid:18) + ε(2τ ) log1+α(nQ ∨ (cid:18) ∧ (cid:19) β(1+α) 2β+d nP )n− Q . (cid:19) (27) ≥ When γβ βP , the optimal "smoothness" parameter for the source data should be γβ, provided by Ω+(γ, Cγ), as our upper bound (except the boundary risk term εb) and the choice of kP do not involve βP . In other words, our upper bound automatically smooths ηP implicitly through the connection between the area with strong signal strength and ηQ. However, if βP > γβ, the upper converges faster as the smoothness of ηP also has implicit information about ηQ. We next provide lower bound results for the parameter space ΠN P . While the scenario of γβ < βP causes a "phase transition" transition with a smaller upper bound, our obtained lower bound is even smaller under this scenario and does not match the lower bound. How to develop a optimal and robust upper bound methodology under this case is still open. Theorem 10 (Non-parametric Classification Lower Bound, General Case). (a) Fix the pa- rameters in the definition of ΠN P with αβ βP . We have that for some constant c > 0, d, γβ ≥ ≤ inf ˆf sup (Q,P ) ΠNP ∈ Ω=ΩP EQ( ˆf ) & E n− P (cid:18) β(1+α) 2γβ+d + ε(cn− Q β 2β+d ) β(1+α) 2β+d . n− Q ∧ (cid:19) (b) Fix the parameters in the definition of ΠN P with max have that for some constant c > 0, { αβ, αβP /γ } ≤ d, γβ < βP . We inf ˆf sup (Q,P ) ΠNP ∈ Ω=ΩP EQ( ˆf ) & E n− P (cid:18) βP (1+α)/γ 2βP +d + ε(cn− Q β 2β+d ) βP (1+α)/γ 2βP /γ+d . n− Q ∧ (cid:19) Theorem 10 indicates that when γβ ≥ βP , as long as the risk term εb is dominated in that β(1+α) 2γβ+d εb . n− P + ε(2τ ), (28) our obtained excess risk upper bound is optimal up to some logarithmic factors. This addi- tional risk term εb can be attributed to the set of points whose neighboring source data tend to fall outside Ω+(γ, Cγ). We claim that if a point x belonging to Ω+(γ, Cγ) is in close proximity to the boundary of Ω+(γ, Cγ), that is, B(x, rP ) ∩ ΩP 6⊂ 32 Ω+(γ, Cγ) 1 2γβ+d n− P , it may be difficult to accurately classify this point using ˆηP . for some small rp ≍ This difficulty arises due to the tendency of the neighboring source data of x to fall outside the signal transfer set. As a result, the small neighborhood of x might not provide enough information to correctly classify ηP (x), leading to inaccurate classification. Giving up the correct classification of these points generate such risk term εb. We also take the smoothness parameter βP into consideration since it influences the smoothness of ηP , and thus controls the distortedness of the boundary of the signal transfer set. A trivial asymptotic upper bound of εb is n− P strictly dominates the risk term n− P on the source distribution to ensure a smaller εb. β(1+α) 2γβ+d βP (1+α)/γ 2γβ+d . Unfortunately, this trivial bound when βP < γβ. Hence, we need additional conditions From the proof of Theorem 4, we show that those three listed cases satisfy (28). The following corollary lists two more special cases to help readers to better understand the upper bound result we obtained. In all of these cases, we can explicitly express εb and verify that it satisfies (28), which shows that our upper bound achieves the optimal rate up to logarithmic factors. Corollary 1. Keep the notations and parameter choices in Theorem 9. Define the topology boundary point of any set A in Rd as ∂A. Suppose that γβ βP . Consider the following additional conditions added to (Q, P ) ΠN P , respectively: ≥ ∈ 1. Signal Transfer Boundary as part of the Decision Boundary: If ηQ, ηP are continuous, and Then εb . n− P β(1+α) 2γβ+d , and ∂Ω+(γ, Cγ) x ∈ ⊂ { Ω : ηQ(x) = 1 2 } . E( DQ, DP )EQ( ˆf N N T AB) . n− P β(1+α) 2γβ+d log1+α(nQ ∨ (cid:18) ∧ β(1+α) 2β+d nP )n− Q + ε(2τ ; γ, Cγ). (cid:19) 2. Signal Transfer Boundary Margin: If for any r > 0, there exists some constant αr ≥ 0, rm > 0, Cr > 0 such that for any 0 < r < rm, QX(B(X, r) Ω ΩP 6⊂ ∩ ∩ Ω+(γ, Cγ)) Crrαr . ≤ Specially, we set αr = the sense that ∞ when Ω+(γ, Cγ) can be separated with its compliment set in inf x y k − {k : x ∈ Ω+(γ, Cγ), y Ω/Ω+(γ, Cγ) rm } ≥ ∈ for some rm > 0. Then if βP /γ + αr ≥ DP )EQ( ˆf N N T AB) . n− P β(1+α) 2γβ+d DQ, E( ∧ β(1 + α), we have εb . n− P β(1+α) 2γβ+d , and log1+α(nQ ∨ (cid:18) β(1+α) 2β+d nP )n− Q + ε(2τ ; γ, Cγ). (cid:19) 33 B. Proofs of General Convergence Theorems In this section, we will prove Theorem 1 and Theorem 2. Suppose ˆf P is a classifier based on DP . define Ac = Ω/A as the compliment. For any set B, define We list some additional notations used in the rest of the appendix part. For any set A as its cardinality. Define Ω, ⊂ B | | Ω+(γ, Cγ) := x { ∈ Ω : s(x) ηQ(x) Cγ| ≥ γ 1 2 | , } − and Ω−(γ, Cγ) := x { ∈ Ω : s(x) < Cγ| ηQ(x) γ 1 2 | } − = (Ω+(γ, Cγ))c. We abbreviate ( expectation w.r.t. a new target observation, i.e., E(X,Y ) ∼ DP ), the combination of the target and source data, as Q, by E. DQ, . Denote the D B.1. Proofs of Theorem 2 Proof. Define the following events: E0 := {| ηQ(X) 1 2 | ≥ 2τ } − , E∗ := X { ∈ Ω∗ } , E := ˆηQ(X) ηQ(X) τ . } | ≤ − {| ∈ Π, denote the event on which ηQ(X) is far from 1/2 by 2τ , and the event For any (Q, P ) on which the concentration property holds. Note that E0 only depends on Q, but E∗ and E depends on both Q and E . The expected excess risk could be reformulated by the law of D total expectation considering Ec, E0 ∩ E and Ec 0 ∩ E : 1 2 | 1 − ηQ(X) EQ( ˆfT AB) = 2Q(Ec)E[ | E)E[ + 2Q(E0 ∩ | E)E[ + 2Q(Ec | 0 ∩ ηQ(X) ηQ(X) 1 ˆfT AB(X) { 1 2 | 1 2 | 1 { { − − = f ∗Q(X) Ec] }| ˆfT AB(X) = f ∗Q(X) }| ˆfT AB(X) = f ∗Q(X) E0 ∩ Ec 0 ∩ }| (29) (30) (31) E] E]. Next, we will bound the expectation of the three components (29), (30), (31) with respect to E D , respectively. Firstly, a trivial upper bound is 2E[ | ηQ(X) 1 2 | 1 { − ˆfT AB(X) = f ∗Q(X) Ec] }| 1, ≤ which deduces that E D E ≤ D ηQ(X) [2Q(Ec)E[ | [Q(Ec)] = Q(E D 1 2 | − [Ec)]) ˆfT AB(X) = f ∗Q(X) Ec]] }| 2δQ(nQ, τ ). 1 { ≤ (32) To see the last inequality of (32), the condition of Theorem 2 implies that Q((E∗)c) = Q(Ω/Ω∗) δ(nQ, τ ) ≤ E D ⇒ [Q((E∗)c)] δ(nQ, τ ). ≤ 34 6 6 6 6 6 In addition, the concentration property on Ω∗ implies that [Ec E D | E∗] ≤ [Ec E D | sup Ω∗ X ∈ X = x] ≤ δQ(nQ, τ ), so by the law of total expectation, we have Q(E D [Q(Ec)]) Next, on the event E0 ∩ [(E∗)c]) [(E∗)c]) Q(E ≤ D = Q(E D (E∗)c]E [E∗] + E E∗]E [Ec [Ec | | D D D (E∗)c]E [E∗]) + Q(E E∗]E [Ec [Ec | | D D D [E∗]) + Q(E δQ(nQ, τ )Q(E [(E∗)c]) D D δQ(nQ, τ ) + E [Q((E∗)c)] D δQ(nQ, τ ) + δ(nQ, τ ). ≤ ≤ ≤ E, we observe that (ˆηQ(X) 1 2 − )(ηQ(X) 1 2 ) − 0, | ≥ ˆηQ(X) 1 2 | ≥ τ. − This fact tells us 1 ˆfT AB(X) = f ∗Q(X) } { = 0. Hence, we have that E [2Q(E0 ∩ E)E[ | ηQ(X) ˆfT AB(X) = f ∗Q(X) E0 ∩ E]] = 0. D − Lastly, let's upper bound the expectation of (31) with respect to E D }| { 1 2 | 1 . Without loss of 2, or otherwise the upper bound can be set as just 0. Then, E, generality, suppose that ηQ(X) we observe that on the event Ec = 1 (33) 0 ∩ 1 2 )(ηQ (ˆηQ − 1 2 − ) < 0 ⇒ | ˆηQ(X) 1 2 | − < τ. This is because, if the plug-in rule 1 ≥ the concentration bound of τ guarantees that ˆηQ(X) { is different from the Bayes classifier on X, 1 2 } ˆηQ(X) | 1 2| ≤ | − ˆηQ(X) ηQ(X) < τ. | − Therefore, on the event Ec E, the indicator of wrong classification could be bounded by 1 and it holds that { 0 ∩ ˆfT AB(X) = f ∗Q(X) 1 { } ≤ ˆf P (X) = f ∗Q(X) , } E D =E D [2Q(Ec 0 ∩ [2E[ | ηQ(X) E ≤ D =E [2E[ | DP [2E[ | ηQ(X) ηQ(X) 1 − E)E[ | 1 2 | 1 2 | 1 2 | − 1 { { 1 ηQ(X) 1 2 | − ˆfT AB(X) 1 ˆfT AB(X) = f ∗Q(X) Ec 0 ∩ }| E]] { = f ∗Q(X) X 1 { } 0 ∩ E ] } ˆf P (X) = f ∗Q(X) X 1 { } ∈ ˆf P (X) = f ∗Q(X) 1 X Ec ] ∈ Ec 0} Ec 0} ], − where the last equality is due to the fact that the random variable ∈ { { } ηQ(X) | 1 2 | 1 { − ˆf P (X) = f ∗Q(X) X 1 { } Ec 0} ∈ 35 6 6 6 6 6 6 6 6 6 6 does not depend on Define E+ := Ec DQ. X 0 ∩ { X ∈ of total expectation again on E+ and E− as a partition of Ec 0, we have and E− := Ec Ω+(γ, Cγ) 0 ∩ { Ω−(γ, Cγ) ∈ } . Applying the law } DP [2E[ E | DP [2E[ E | DP [2E[ | ≤ +E ηQ(X) ηQ(X) ηQ(X) =2E DP ZΩ+(γ,Cγ ) | ηQ(X) +E DP [2E[ | { 1 1 − − 1 2 | 1 2 | 1 2 | { − ηQ(X) 1 { ˆf P (X) = f ∗Q(X) ˆf P (X) = f ∗Q(X) ˆf P (X) = f ∗Q(X) X X X 1 1 1 { { { } } } ∈ ∈ ∈ 1 2 | 1 { − ˆf P (X) = f ∗Q(X), | ] Ec 0} E+ } ] ] E− } ηQ(X) 1 2| ≤ − dQX 2τ } 1 2 | 1 { X − E− ] } ∈ 2E DP ≤ +E DP [2E[ | ZΩ+(γ,Cγ ) | ηQ(X) − ηQ(X) 1 2 | 1 { − ˆf P (X) = f ∗Q(X) 1 2 | 1 { X E− ]. } ∈ dQX } ! ∧ 2QX( (cid:18) ηQ(X) | 1 2| ≤ − 2τ ) (cid:19) The term 2E DP ηQ(X) 1 1 2| { − ˆf P (X) = f ∗Q(X) dQX } (cid:17) upper bounded by the restricted signal transfer risk 2 sup(Q,P ) Π ∈ by Definition 2 and Assumption 1. Moreover, since E− does not depend on (cid:16) Ω+(γ,Cγ ) | R ηQ(X) 2QX ( ∧ | − DP ξ( ˆf P ; γ, Cγ) E (cid:0) 1 2τ ) is 2| ≤ 2Cα(2τ )1+α DP , it holds that ∧ (cid:1) E DP [2E[ | ηQ(X) 1 X E− ] ∈ − ηQ(X) 1 2 | − { 1 2 | } ηQ(X) 0 < 1 { | =2 ZΩ−(γ,Cγ ) | 1 2 | − < 2τ dQX ≤ } 2ε(2τ ; γ, Cγ), by the definition of the ambiguity level. Hence, the following bound holds: E [2Q(Ec D 2 sup (Q,P ) ≤ Π ∈ E)E[ ηQ(X) 0 ∩ | DP ξ( ˆf P ; γ, Cγ) E 1 ˆfT AB(X) 1 2 | 2Cα(2τ )1+α + 2ε(2τ ; γ, Cγ). = f ∗Q(X) }| { Ec 0 ∩ − ∧ E]] (34) It is easy to see that Theorem 2 holds by bounding the three components (29), (30), (31) by (32), (33), (34), respectively. B.2. Proofs of Theorem 1 Suppose that (Q, P ) 1 ∈ − δf w.r.t. the distribution of X1:nQ, we have for any x Ω, ∈ Π. By plugging in t = τ in (8), we have that with probability at least P DQ( | ˆηQ(x) − ηQ(x) τ | | ≥ X1:nQ) . exp( τ δQ ( − )2). (35) In other words, by taking the probability of which the concentration (35) fails into account, for any x ∈ Ω, the equation ˆηQ(x) | − ηQ(x) τ | ≤ 36 6 6 6 6 6 6 6 holds with probability that is asymptotically less than δf + exp( We fix Ω∗ = Ω in the terminology of Theorem 2, and thus set δ( ≡ Proof of Theorem 1. Suppose that for some c0 > 0, the inequality τ always holds. We have that − , * * ( τ δQ ) 0. )2) with respect to P DQ. c0 log(nQ ∨ ≥ nP )δQ exp( τ δQ ( − )2) ≤ exp( nP )) − c2 0 log nQ 0 log2(nQ ∨ c2 n− P c2 0 log nP = n− Q . n− c Q ∧ . sup (Q,P ) Π ∈ ∧ c n− P DP ξ( ˆf P , 2δQ; γ, Cγ). E Suppose that for some c0 > 0, the inequality τ that ≥ exp( ( − τ δQ )2) ≤ c0 log(nQ ∨ nP )) exp( − c2 0 log nQ 0 log2(nQ ∨ c2 n− P c2 0 log nP = n− Q . n− c Q ∧ . sup (Q,P ) Π ∈ ∧ c n− P DP ξ( ˆf P ; γ, Cγ) E nP )δQ always holds. We have δ1+α Q . ∧ Therefore, the conditions of Theorem 2 holds by setting δQ(nQ, τ ) = C(δf + sup (Q,P ) ∈ Π DP ξ( ˆf P ; γ, Cγ) + δ1+α E Q ) for some C > 0 that is large enough. Theorem 1 thus holds. B.3. Proof of Theorem 3 Proof. Suppose that (Q, P ) Π ∈ ∩ A (M). For any t ≥ Ω(t) := x { ∈ Ω : | ηQ(x) − 0, define 1 2| ≤ . t } For any z (0, 1 2), define ∈ A(z) := E DP Ω(z) | ZΩ+(γ,Cγ ) ∩ E(X,Y ) ∼ DP ), B := E A := A( 1 2 ηQ(X) 1 2 | 1 { − ˆf P (X) = f ∗Q(X) dQX, } ηP (X) P [ | 1 2 | 1 { − ˆf P (X) = f ∗P (X) ]. } I. Case of γ ≥ 1 : By definition, εP is an upper bound of B, so it suffices to prove 2M 1+α γ+α C γ−1 γ+α α C − γ 1+α γ+α 1+α γ+α . B A ≤ By decomposing Ω+(γ, Cγ) into Ω+(γ, Cγ) 1 M A/M DP E ≤ Ω(t) | ZΩ+(γ,Cγ ) ∩ ∩ ηQ(X) Ω(t) and Ω+(γ, Cγ) Ω(t)c, we have ∩ 1 2 | 1 { ˆf P (X) = f ∗Q(X) dQX } − 1 2 | ˆf P (X) = f ∗Q(X) 1 { dPX } +E DP Ω(t)c | ZΩ+(γ,Cγ ) ∩ ηQ(X) − 37 6 6 6 6 since dQX ≤ MdPX . First, by upper bounding 1 ˆf P (X) = f ∗Q(X) } by 1, we have E DP Ω(t) | ZΩ+(γ,Cγ ) ∩ ηQ(X) − ˆf P (X) = f ∗Q(X) 1 { dQX } 1 M 1 M Cα M ≤ ≤ ηQ(X) − dQX Ω(t) | ZΩ+(γ,Cγ ) ∩ tQX (Ω+(γ, Cγ) Ω(t)) ∩ by the margin assumption. Secondly, when x 1 tγ − ηQ(x) | ηQ(x) − 1 2 | ≤ | γ t1 − 1 2| ≤ Applying this inequality to the risk term with respect to Ω+(γ, Cγ) ηP (x) ⇒| − − | Ω(t)c, we have ∩ ηP (x) 1 2 | − /Cγ Ω(t)c, we have ∩ { 1 2| 1 2 | ≤ ∈ ηQ(x) t1+α Cα M Ω+(γ, Cγ) 1 2| 1 2| /Cγ. ≤ | − γ ηQ(X) 1 2 | 1 − ˆf P (X) = f ∗Q(X) dPX } Ω(t) | ZΩ+(γ,Cγ ) ∩ E DP Ω(t) | ZΩ+(γ,Cγ ) ∩ { 1 2 | − ηP (X) ˆf P (X) = f ∗Q(X) 1 { dPX } E DP γ t1 − Cγ t1 γ − Cγ ≤ ≤ B. By plugging in the two inequalities above, we have that for any t A/M Cα M ≤ t1+α + γ t1 − Cγ B. 0, ≥ Since the choice of t is arbitrary, we choose t = ( M B CαCγ )γ+α, the bound becomes II. Case of γ < 1 : By definition, εP is an upper bound of B, so it suffices to prove 2M 1+α γ+α C γ−1 γ+α α C − γ 1+α γ+α 1+α γ+α . B A ≤ and then let z = 1 A(z) z1 − γMC − 1 γ B ≤ Ω+(γ, Cγ) ∈ 2. Note that when x 1 2| ≤ | γ z1 − | ηQ(x) ηQ(x) zγ − − 1 1 2 | ≤ − ⇒| ηQ(x) ηP (x) − − | ∩ 1 2 | 1 2 | /Cγ. Ω(z), we have ηP (x) γ ≤ | 1 2| − /Cγ Therefore, A(z)/M ≤ ≤ 1 M E DP C − γ z1 1 − = C − γ z1 1 − which finishes the proof. ηQ(X) 1 2| 1 { − ˆf P (X) = f ∗Q(X) dQX } ηP (x) 1 2 | 1 { − ˆf P (X) = f ∗Q(X) dPX } Ω(z) | ZΩ+(γ,Cγ ) ∩ γE Ω(z) | ZΩ+(γ,Cγ ) ∩ DP γB, 38 6 6 6 6 6 6 C. Proofs in Non-parametric Classification ΠN P . Since ΠN P assumes the compactness In this section, we only consider the case of (Q, P ) of the support sets Ω and ΩP , we assume for simplicity that Ω, ΩP is a subset of the d-dimension unit square [0, 1]d. ∈ Our proof of Lemma C.2 partially relies on verifying the conditions in Theorem 8, presented in Appendix A.1. Therefore, we will provide the proof of Theorem 8 first in this section. C.1. Proof of Theorem 8 Proof. Denote the distribution of X P 1:nP by P ̃Π. It is easy to see that there exists an event Ef P related to the distribution of X P 1:nP , and Ω∗(γ, Cγ) := Ω+(γ, Cγ)/Ωb. Suppose X P 1:nP (Q, P ) ∈ such that • P X P 1:nP (Ef P ) δP,f . ≤ • On the event (Ef P )c, we have for any x Ω∗(γ, Cγ), ∈ P DP ((ˆηP (x) 1 2 − )(ηQ(x) 1 2 − ) < 0 X P 1:nP ) | ≤ C2 exp( Cγ| ηQ(x) δP ( − γ 1 2| − )2). Define E∗ = X { by decomposing reads } ηQ(X) Ω∗(γ, Cγ) ∈ E DP [E[ | X − Ω+(γ, Cγ) { ∈ } . We apply the law of total expectation on 1 1 2| { into Ef ˆf P (X) = f ∗Q(X) 1 X Ω+(γ, Cγ) ]] } ∈ } { E∗ and (Ef P )c P , (Ef P )c ∩ (E∗)c. The decomposition ∩ ˆf P (X) { ηQ(X) = f ∗Q(X) 1 2| } ˆf P (X) 1 1 X { ∈ Ω+(γ, Cγ) ]] } = f ∗Q(X) Ef P ] ] | } ηQ(X) E DP [E[ | (Ef X P 1:nP =P P )E +P +P X P 1:nP X P 1:nP ((Ef P )c)E ((Ef P )c)E 1 1 2 | − DP [E[ | DP [E[ | DP [E[ | − ηQ(X) ηQ(X) { 1 2 | 1 2 | − − ˆf P (X) = f ∗Q(X) ˆf P (X) = f ∗Q(X) 1 1 { { X X 1 1 { { } } ∈ ∈ Ω∗(γ, Cγ) (Ef Ωb ] | } ] | } P )c]. (36) (37) (38) (39) (Ef P )c] We will then bound the three components (37), (38), (39) respectively. Firstly, we observe that (37) could be bounded by P X P 1:nP (Ef P )E DP [E[ηQ(X) 1 2 | 1 { − ˆf P (X) = f ∗Q(X) Ef P ] ] | } ≤ P 1 2 (Ef P ) X P 1:nP 1 2 ≤ δP,f . (40) Secondly, (38) could be bounded by 1 2 | − Ωb 1 { } 1 ˆf P (X) { (Ef P )c holds P X P 1:nP ((Ef P )c)E ηQ(X) DP [E[ | 1 1 2 | 1 2 | 1 { { − − X X ηQ(X) ηQ(X) ≤ DP [E[ E | DP [E[ E | ηQ(X) ≤ =E[ | 1 2 | − X 1 { ∈ Ωb ∈ ∈ ] } ]] } δb P , Ωb ≤ 39 = f ∗Q(X) X 1 { } Ωb ] | } ∈ (Ef P )c] ]] } (41) 6 6 6 6 6 6 6 where the last equality holds as E[ηQ(X) DP . By plugging { in (40) and (41) back into (37) and (39), we see that to finish the proof, it suffices show that ] does not depend on 1 2 | Ωb X − ∈ 1 } DP [E[ E | ηQ(X) 1 2 | − } Consider a partition of Ω∗(γ, Cγ), which are Aj ⊂ Ω∗(γ, Cγ) : 0 < A0 := x { 1 ˆf P (X) = f ∗Q(X) 1 X Ω∗(γ, Cγ) ∈ { Ω∗(γ, Cγ), j = 0, 1, 2, } ] | ηQ(x) | 1 2 | ≤ δ1/γ P } , { ∈ (Ef P )c] . δ P 1+α γ . (42) defined as * * * − 1 2| ≤ − Aj := x { ∈ Ω∗(γ, Cγ) : 2j − 1δ1/γ P < ηQ(x) | 2jδ1/γ P } , j ≥ 1. We have that = ηQ(X) DP [E[ E | DP [E[ E | 1 2 | − ηQ(X) { 1 2 | − 1 ˆf P (X) = f ∗Q(X) X 1 { } ∈ Ω∗(γ, Cγ) ˆf P (X) = f ∗Q(X) 1 { X 1 { } Aj} ] | ∈ P )c] (Ef ] | } (Ef P )c]. 0 j X ≥ For j = 0, by the margin assumption, we have E DP [E[ | E[ ηQ(X) | ηQ(X) 1 2 | 1 { − ˆf P (X) = f ∗Q(X) 1 X 1 2 | Aj, it holds by (25) that δ1/γ P Q(X A0} ≤ ∈ { ] − ≤ 1, under the event X X 1 { ∈ } A0) ∈ ≤ (Ef P )c] ] | A0} Cαδ P 1+α γ . For j ≥ ∈ 2j 1δ1/γ P < − ηQ(X) | − 2jδ1/γ P , 1 2| ≤ 1 2 − )(ηQ P DP ( ˆf P (X) = f ∗Q(X) | (Ef P )c) = P DP ((ˆηP (x) − for some constant C > 0. Therefore, 1 2 ) 0 | ≥ (Ef P )c) ≤ C exp( C 2 γ 22γ(j − ≤ =E[2jδ1/γ E DP [E[ ηQ(X) | DP [E[2jδ1/γ E P 1 E DP [1 { exp( P CE[2jδ1/γ P C2jδ1/γ exp( ≤ { 1 1 2| − { ˆf P (X) ˆf P (X) γ22γ(j C 2 − γ 22γ(j C 2 − P ≤ − ˆf P (X) = f ∗Q(X) } 1 = f ∗Q(X) = f ∗Q(X) 1))1 X − { 1))Q(X } }| 1 X ∈ { (Ef P )c]1 Aj} ] ∈ Aj) C2jδ1/γ P ≤ exp( C 2 γ 22γ(j − 1))2αjδ − (Ef P )c] X { Aj} X { Aj} ] ∈ | (Ef P )c] ] | Aj} ] ∈ ∈ γ = C2(1+α)j exp( α C 2 γ 22γ(j − 1+α γ 1))δ P , − where the last inequality is derived by the margin assumption. Summing all terms above in (43) and (44), we have that DP [E[ E | ηQ(X) 1+α γ δ P ≤ (Cα + 1 2| 1 ˆf P (X) { − C2(1+α)j exp( = f ∗Q(X) C 2 γ22γ(j − − 1 X ∈ { } 1))) . δ P 1+α γ , Ω∗(γ, Cγ) (Ef P )c] ] | } 1 C2(1+α)j exp( since j ≥ P 1 j X ≥ γ 22γ(j C 2 − 1)) < − ∞ . Therefore, (42) holds and we finish the proof. 40 (43) 1)) − (44) 6 6 6 6 6 6 6 6 6 C.2. Proof of Theorem 9 Next, we will prove the excess risk upper bound of the TAB K-NN classifier. Let β∗P = max we assume that nQ is large enough so that γβ, βP } . Define Ω∗(γ, Cγ) := Ω+(γ, Cγ)/Ωb, and δP := n− P { ∗ β P ∗ 2β P +d . To simplify the analysis, 1 2 cQn 2β 2β+d Q ≤ cQn 2β 2β+d Q , kQ ≤ ∗ P +d 2β ∗ P 2β cP n P 1 2 kP ≤ ≤ 2β ∗ P 2β cP n P ∗ P +d , (45) ∗ P +d 2β ∗ P 2β 2β+d Q cQn ⌊ where kQ = DQ and results are shown in the asymptotic regime, and we assume that nP are the chosen number of nearest neighbors in DP , respectively, and cQ and cP are constants. This assumption is valid since our and kP = ⌋ ⌋ . 2β cP n P ⌊ Given the condition of (45), the K-NN distance bound (Lemma E.3) shows that there exists a constant cD > 0 such that with probability at least 1 the distribution of X1:nQ, we have − d 2β+d Q n cD cQ exp( X(kQ)(x) k x k ≤ − cD( kQ nQ 1 d ) ≤ cDc 1 d Qn− Q 1 2β+d , x ∀ ∈ Ω. cQn 2β 2β+d Q − ) w.r.t. (46) nQ→∞ −→ ∞ In addition, with probability at least 1 X P 1:nP , we have − d ∗ P +d cD cP 2β n P exp( − 2β ∗ P ∗ P +d ) w.r.t. the distribution of 2β cP n P X P (kP )(x) k x k ≤ − cD( kP nP 1 d ) cDc ≤ 1 d P n− P 1 ∗ P 2β +d , x ∀ ∈ ΩP . (47) Denote EQ and EP as the event that (46) and (47) hold, respectively. Note that EQ and EP depend on the distribution of X1:nQ and X P 1:nP respectively. From the probability bound, we have P DQ(Ec Q) ≤ d 2β+d Q n cD cQ exp( − cQn 2β 2β+d Q ), P DP (Ec P ) d ∗ P +d 2β n P cD cP ≤ exp( − 2β ∗ P ∗ P +d ). 2β cQn P The proof of Theorem 9 is obtained simply by verifying the conditions in Theorem 1. The next two lemmas aim to prove such conditions: Lemma C.1. By choosing kQ = estimates ˆηQ kQ for any constant cQ > 0, the regression function (x) has the property that there exists constants c1, c2, c3 > 0 such that with prob- cQn ⌊ ⌋ 2β 2β+d Q ability at least 1 for any x c1n − Ω we have ∈ d 2β+d Q t > 0, ∀ 2β 2β+d Q exp( cQn − ) w.r.t. the distribution of X1:nQ := (X1, , XnQ), * * * sup (Q,P ) ΠNP ∈ P DQ( | ˆηQ(x) − ηQ(x) t | | ≥ X1:nQ) ≤ c2 exp( ( − t β 2β+d c3n− Q )2). (48) 41 Lemma C.2. Let β∗P = max γβ, βP } { the regression function estimates ˆηP ΠN P , we have such that for any ΠN P,s ⊂ . By choosing kP = 2β cP n for any constant cP > 0, P ⌊ kP (x) has the property that there exists constants cb > 0 ⌋ ∗ P +d 2β ∗ P ξ( ˆf P ; γ, Cγ, ΠN P,s) . n− P β ∗ P (1+α)/γ ∗ 2β P +d + εb, εb = sup (Q,P ) ΠNP,s ∈ ηQ(X) 1 2 | − dQX, ZΩb | where the boundary of the signal transfer set is defined as Ωb := x { ∈ Ω : | ηQ(x) 1 2 | ≤ − cbn− P βP /γ ∗ +d 2β P , B(x, cbn− P 1 ∗ P 2β +d ) ΩP 6⊂ ∩ Ω+(γ, Cγ) } for some constant cb > 0. Proof of Lemma C.1. Define the simple average of the regression functions of the kQ neighbors of x as ̄ηQ kQ (x) := 1 kQ kQ ηQ(Y(i)(x)). i=1 X E DQ[ˆηQ kQ (x) | X1:nQ] = ̄ηQ kQ Rd, we have (x). ∈ It is easy to see that ̄ηQ kQ tation (x) depends on the distribution of X1:nQ, and the conditional expec- Recall that Condition 2 states that for any x, y Therefore, on the event EQ, we have ηQ(x) | ηQ(y) x Cβk − β. y k | ≤ − ̄ηQ kQ (x) | − ηQ(x) | ≤ ≤ ≤ 1 kQ Cβ kQ i=1 X 1 kQ ηQ(Y(i)(x)) | ηQ(x) | − kQ X(i)(x) β x k − k i=1 X β Qn− d Q β 2β+d . Cβcβ Dc ηQ(Y(i)(x)) On the other hand, conditioning on X1:nQ, the quantities independent with mean 0. Hence, the Hoeffding's inequality tells that for any t Y(i)(x) − { }i=1, 0 ≥ P DQ( | ˆηQ kQ (x) − ̄ηQ kQ (x) t | | ≥ X1:nQ) ≤ 2 exp( 2t2 kQ ) − ≤ 2 exp( 2 cQ ( − t β 2β+d )2). n− Q ,kQ are *** (49) On the event EQ, ̄ηQ kQ (x) falls into the interval [ηQ(x) Cβcβ Dc β d Qn− Q β 2β+d , ηQ(x)+Cβcβ Dc β d Qn− Q β 2β+d ], so with probability at least 1 d 2β+d Q n cD cQ − exp( cQn ) w.r.t. the distribution of X1:nQ, we − 2β 2β+d Q − 42 have for any t ≥ DQ( | P 2Cβcβ Dc β d Qn− Q β 2β+d , ˆηQ kQ (x) − ηQ(x) t | | ≥ X1:nQ) ≤ ≤ ˆηQ kQ P DQ( | 2 exp( − (x) 1 2cQ − ( ̄ηQ kQ t (x) | ≥ )2). β 2β+d n− Q X1:nQ) t/2 | (50) In addition, for any t [0, 2Cβcβ Dc β d Qn− Q β 2β+d ∈ ], since exp( 1 2cQ ( − )2) are bounded below from t − β 2β+d n Q 0, we have P DQ( | ˆηQ kQ (x) − ηQ(x) t | | ≥ X1:nQ) ≤ C exp( 1 2cQ ( − n− Q t β 2β+d )2). (51) for some C > 0 large enough. Combining (50) and (51), the first statement holds with c1 = cD cQ and c2 = max C, 2 . { } Proof of Lemma C.2. Consider any (Q, P ) define the simple average of the regression functions of the kP neighbors of x as ΠN P,s. Suppose that x ∈ ∈ Ω+(γ, Cγ). Similarly, ̄ηP kP (x) := 1 kP kP i=1 X ηQ(Y P (i)(x)), which depends on the distribution of X P 1:nP , and the conditional expectation E PQ[ˆηP kP (x) | X1:nP ] = ̄ηP kP (x). Again, Condition 2 gives that for any x, y Rd, we have Therefore, on the event EP we have ηP (x) | − ̄ηP kP (x) | − ηP (x) | ≤ 1 kP ∈ ηP (y) CβP k x y k − | ≤ βP . kP ηP (Y P (i)(x)) | ηP (x) | − kP X P (i)(x) βP x k − k i=1 X βP P n− d P βP ∗ P 2β +d . i=1 X 1 kP CβP CβP cβP D c ≤ ≤ (52) Setting cb ≥ βP /γ ∗ 2β +d P , we have cbn− P (2CβP cβP D c βP Q /Cγ) d 1 γ , (52) implies that on the event EP , if ηQ(x) | 1 2| ≥ − ηP (x) | 1 2 | ≥ − 2CβP cβP D c βP d Q n− P βP ∗ P 2β +d ( ̄ηP kP (x) ⇒ 1 2 − )(ηP (x) 1 2 ) − 0, | ≥ ̄ηP kP (x) 1 2 | ≥ 1 2 | − ηP (x) 1 2 | . − 43 The Hoeffding's inequality then tells that for any t P DP ( | ˆηP kP (x) − ̄ηP kP (x) X P 1:nP ) t | ≤ | ≥ 2 exp( 0 2t2 kP ≥ − 2 exp( ) ≤ 2 cP ( − n− P Define Ω+ 1 (γ, Cγ) := x { ∈ Ω+(γ, Cγ) : ηQ(x) | 1 2 | ≥ − cbn− P βP /γ ∗ 2β +d P . } t ∗ β P ∗ P 2β +d )2). (53) Ω+ If x P ∈ DP ((ˆηP (x) 1 (γ, Cγ), then on the event EP , we have 1 2 )(ηQ(x) 1:nP ) ) < 0 X P 1 2 P − ≤ − | ˆηP kP (x) | − ̄ηP kP (x) | ≥ 1 2 | ηP (x) 1 2 || − X P 1:nP ) DP ( 2 exp  ( − ≤   ηQ(x) Cγ| γ 1 2| )2 − ∗ β P ∗ P 2β +d 2 n− cP P 1 d P , (47) implies that if B(x, cbn− P p .    (54) 1 ∗ P 2β +d ) ΩP ⊂ ∩ Ω+(γ, Cγ), On the other hand, setting cb ≥ on the event EP we have cDc X P (i)(x) ∈ Ω+(γ, Cγ) ⇒ | ηP (X P (i)(x)) 1 2 | ≥ Cγ| − ηQ(X P (i)(x)) 1 2 | γ. − Define Ω+ 2 (γ, Cγ) := x { ∈ Ω+(γ, Cγ) : B(x, cbn− P If x ∈ Ω+ 2 (γ, Cγ) satisfies ηQ(x) ̄ηP kP (x) 1 2 − = − 1 kP 1/2 kP 2Cβcβ Dc ≥ β d P n− P (ηP (X P (i)(x)) 1 2 ) − 1 ∗ P 2β +d ) β ∗ P 2β +d Ω ΩP ⊂ ∩ ∩ Ω+(γ, Cγ) . } , then on the event EP , we have kP i=1 X 1 kP Cγ ≥ Cγ ≥ 1 kP i=1 X kP i=1 X kP (ηQ(X P (i)(x)) 1 2 )γ − X P (i)(x) Cβk β)γ x k − Cβ(cDc 1 d P n− P 1 ∗ P 2β +d )β)γ 1 2 − 1 2 − − − )γ. (ηQ(x) (ηQ(x) 1 2 − 1 kP i=1 X 1 2γ (ηQ(x) The Hoeffding's inequality then tells that Cγ Cγ ≥ ≥ P DP ((ˆηP (x) 1 2 − )(ηQ(x) 1 2 − ) < 0 X P 1:nP ) | P DP ( | ≤ ˆηP kP (x) − ̄ηP kP (x) | ≥ Cγ 1 2γ | ηQ(x) γ 1 2| | − X P 1:nP ) Cγ| 2γ ηQ(x) 2 n− cP P 1 2| γ )2 − ∗ β P ∗ P 2β +d p 2 exp  ( − ≤   44 .    (55) (55) holds for ηQ(x) − 2 (γ, Cγ) satisfies Ω+ x ∈ 1 2 ≤ − ηQ(x) | 2Cβcβ Dc 1 2 | ≥ − β d 2β P n− P 2Cβcβ β ∗ P +d with the similar argument. To summarize, if β d P n− P β ∗ P 2β +d , then on the event EP , we have Dc P DP ((ˆηP (x) 1 2 − )(ηQ(x) 1 2 − ) < 0 X P 1:nP ) | ≤ 2 exp( ( − Cγ| 2γ ηQ(x) 2 n− cP P 1 2 | γ )2). − ∗ β P ∗ P 2β +d We finish the proof of this lemma divided into two cases: I. Case of γβ βP : If x ∈ ≥ Ω+ 2 (γ, Cγ) satisfies p ηQ(x) | 1 2| ≥ − 2Cβcβ Dc β d P n− P β ∗ P 2β +d , then exp( ηQ(x) | ( Cγ 2γ√ cP − P 2 n − 1 γ 2 | ∗ β P ∗ P 2β +d − )2) is bounded below from 0, which means on the event EP , P DP ((ˆηP (x) 1 2 − )(ηQ(x) 1 2 − ) < 0 X P 1:nP ) | ≤ C exp( ( − Cγ| 2γ ηQ(x) 2 n− cP P 1 2| γ )2) − ∗ β P ∗ P 2β +d for some constant C > 0 large enough. In other words, the exponential concentration holds within the whole Ω+ 2 (γ, Cγ). Combining this concentration bound with (54) and (55), we see , that by setting that cb = max γ , cDc (2CβP cβP D c βP Q /Cγ) d p 1 2 1 { P } P DP ((ˆηP (x) 1 2 − )(ηQ(x) 1 2 − ) < 0 X P 1:nP ) | max C, 2 exp( ( − } { ≤ Cγ| 2γ ηQ(x) 1 2| γ )2) (56) − ∗ β P ∗ P 2β +d 2 n− cP P holds with probability at least 1 1 (γ, Cγ) for any x applying Theorem 8 with the setting of Ω+ Ω+ − ∈ ∪ d ∗ P +d cD cP 2β n P 1:nP 2 (γ, Cγ) = Ω+(γ, Cγ)/Ωb. The statement then holds by directly − ) w.r.t. the distribution of X P exp( 2β cQn P ∗ P +d 2β ∗ P p ∗ β P ∗ P 2β +d δP = 2γ cP 2 n− P r , δP,f = P DP [Ec P ], δb P = εb. (57) II. Case of γβ < βP : Without loss of generality, we suppose that nQ is large enough such that 2Cβcβ Dc 2β β d P n− P Hence, if x ∈ Ω+ 2 (γ, Cγ) satisfies β ∗ P (2CβP cβP D c βP Q /Cγ) d 1 γ n− P +d ≥ βP /γ ∗ 2β +d P . ηQ(x) | 1 2| ≥ − βP Q /Cγ) d 2Cβcβ Dc β d P n− P β ∗ P 2β +d , 1 γ , cDc 1 2 P } exp( d ∗ P +d cD cP 2β n P ∗ P +d 2β ∗ P 2β cQn P then by setting cb = max (2CβP cβP D c { , it holds that x Ω+ 1 (γ, Cγ). Therefore, ∈ (56) holds with probability at least 1 Ω+ X P directly applying Theorem 8 with the same setting as the one in (57). ) w.r.t. the distribution of 2 (γ, Cγ) = Ω+(γ, Cγ)/Ωb. The statement then holds by 1:nP for any x 1 (γ, Cγ) Ω+ − − ∈ ∪ 45 Proof of Theorem 9. Consider any (Q, P ) ∈ applying the results derived in Lemma C.1 and C.2 to Theorem 1 by setting ΠN P,s = and β∗P = γβ. βP , the proof is straightforward by (Q, P ) ΠN P . If γβ ≥ { } If γβ < βP , the proof is straightforward by applying the results derived in Lemma C.1 and and β∗P = βP . To illustrate the reason why the C.2 to Theorem 1 by setting ΠN P,s = (Q, P ) { } βP (1+α)/γ 2βP +d , by Assumption 1 we risk term εb in Lemma C.2 is asymptotically dominated by n− P have εb ≤ βP (1+α)/γ 2βP +d Cαc1+α QX (Ωb) b n− P βP /γ 2βP +d cbn− P ≤ , which finishes the proof. C.3. Proofs of Theorem 4 For convenience, we repeat the definitions that and the boundary of the signal transfer set is defined as εb = ZΩb | ηQ(X) 1 2 | − dQX Ωb := x { ∈ Ω : | ηQ(x) 1 2 | ≤ − cbn− P βP /γ ∗ 2β +d P , B(x, cbn− P 1 ∗ P 2β +d ) Ω ΩP 6⊂ ∩ ∩ Ω+(γ, Cγ) } for some constant cb > 0. From Theorem 9, which is the upper bound result for the general parametric space ΠN P , it suffices to show that εb . n− P to prove the results. in each case listed in Theorem 4 β 2γβ+d Proof. Band-like Ambiguity: By Lemma E.1, Assumption 2 holds with ε(z; γ, Cγ/2) = Cαz1+α (cid:0) ∧ 2 (cid:18) (cid:1) 1+α γ CαC − γ 1+α γ 1+α γ ∆ . (cid:19) From Theorem 9, it suffices to show that εb . ∆ bound. 1+α γ + n− P β(1+α) 2γβ+d to prove the excess risk upper Following the same proof in Lemma E.1, we have that x { ∈ Ω : | ηQ(x) 1 2| ≥ ( 2∆ Cγ 1 γ ) − } ⊂ Ω+(γ, Cγ/2). Suppose that x B(x, cbn− P 1 2γβ+d ), we have Ω+(γ, Cγ/2) satisfies ηQ(x) | 1 2 | ≥ − ( 2∆ Cγ ) ∈ 1 γ + Cβcβ b n− P β 2γβ+d . For any x′ ∈ ηQ(x′) | ηQ(x) x′ Cβk − β x k ≤ | ≤ − β 2γβ+d Cβcβ b n− P ηQ(x′) ⇒ | 1 2| ≥ ( 2∆ Cγ 1 γ , ) − which further implies that x Ω+(γ, Cγ/2). In other words, ∈ Ωb ⊂ { x ∈ Ω+(γ, Cγ/2) : ηQ(x) | 1 2 | − < ( 2∆ Cγ ) 46 1 γ + Cβcβ b n− P β 2γβ+d , } so by Assumption 1, it holds that εb ≤ ≤ ( (cid:18) Cα 1 γ + Cβcβ b n− P β 2γβ+d QX (Ωb) 1 γ + Cβcβ b n− P (cid:19) β 2γβ+d 1+α (cid:19) 2∆ Cγ ) ) 2∆ Cγ ( (cid:18) γ + n− P 1+α . ∆ β(1+α) 2γβ+d . The proof is then finished given the inequality above. β 2γβ+d cbn− P Smooth Source: Suppose (Q, P ) εb ≤ Strong Signal with Imperfect Transfer: Suppose (Q, P ) such that Cαc1+α QX (Ωb) b n− P β(1+α) 2γβ+d ≤ ∈ ΠN P , which finishes the proof. ηQ(x′) = 1 2 , x′ ∀ ∈ B(x, r), S . By Assumption 1, since βP = γβ, we have ΠN P F . For any x Ω, r > 0 ∈ ∈ i.e., B(x, r) does not intersect with the decision boundary of ηQ we see that either ηQ(x′) > 1 x { 2 for any x′ 2 or ηQ(x′) < 1 Ω : ηQ(x) = 1 ∈ B(x, r). ∈ 2} We claim that either or B(x, r) Ω ∩ ⊂ Ω+(γ, Cγ) B(x, r) Ω ∩ ⊂ Ω/Ω+(γ, Cγ). Otherwise, suppose for any two points x1, x2 ∈ ηQ(x) x2 ∈ | Ω/Ω+(γ, Cγ). Since 1 2 | ≥ ηP (x) − B(x, r) Ω, we have x1 ∈ ∩ γ holds for any x Ω, we have (ηP (x1) (ηP (x1) ⇒ 1 2 1 2 − − )(ηQ(x1) )(ηP (x2) − − 1 2| − Cγ| 1 ) > 0, (ηP (x2) 2 1 2 ) < 0. 1 2 − )(ηQ(x2) − ) < 0, ∈ 1 2 , by continuity Ω+(γ, Cγ) but Therefore, there exists some λ (0, 1) such that ∈ ηP (λx1 + (1 λ)x2) = − 1 2 , which contradicts with the facts that ηQ(λx1 +(1 for any x Ω. Since the choice of x ∈ Ω and r > 0 are arbitrary, we conclude that any sphere in Ω is a subset of either that does not intersect with the decision boundary Ω+(γ, Cγ) or Ω/Ω+(γ, Cγ). Therefore, the signal transfer boundary is a part of the decision boundary, i.e., Ω : ηQ(x) = 1 2 } ∈ ∈ x { λ)x2) = 1 2 and ηP (x) | 1 2| ≥ Cγ| − ηQ(x) γ 1 2| − − ∂Ω+(γ, Cγ) x ∈ ⊂ { Ω : ηQ(x) = 1 2 } , which is a sufficient condition for εb . n− P β(1+α) 2γβ+d as shown in the first case of Corollary 1. 47 6 6 C.4. Proofs of Corollary 1 x ∈ Ω+(γ, Cγ) satisfies ηQ(x) | − ηQ(x′) | − ηQ(x) which further deduces that | ≤ 1 2 | ≥ Cβk Proof. Signal Transfer Boundary as part of the Decision Boundary: Suppose that 2Cβcβ b n− P β 2γβ+d . For any x′ B(x, cbn− P 1 2γβ+d ), we have x′ β x k − ≤ Cβcβ b n− P β 2γβ+d ∈ 1 2 | ≤ ηQ(x) 1 2| , − (ηQ(x′) 1 2 − )(ηQ(x) 1 2 − ) > 0, x′ ∀ ∈ B(x, cbn− P 1 2γβ+d ). (58) Since ∂Ω+(γ, Cγ) x ∈ ⊂ { Ω : ηQ(x) = 1 2} , (58) implies that In other words, B(x, cbn− P 1 2γβ+d Ω ) ∩ ⊂ Ω+(γ, Cγ) x / ∈ ⇒ Ωb. Ωb ⊂ { x ∈ Ω+(γ, Cγ) : ηQ(x) | 1 2 | − < 2Cβcβ b n− P β 2γβ+d , } so by Assumption 1, it holds that 2Cβcβ b n− P εb ≤ β 2γβ+d QX (Ωb) ≤ Cα(2Cβcβ b )1+αn− P β(1+α) 2γβ+d β(1+α) 2γβ+d , . n− P which finishes the proof. Signal Transfer Boundary Margin: Suppose that nP is large enough such that 1 2γβ+d cbn− P rm. ≤ It is obvious that εb ≤ cbn− P βP /γ 2γβ+d QX (B(X, cbn− P 1 2γβ+d ) Ω ΩP 6⊂ ∩ ∩ of which the last term is asymptotically less than n− P β(1+α) 2γβ+d C.5. Proof of Theorem 5 and 10 Ω+(γ, Cγ)) Crc1+αr b n− P ≤ given that βP /γ +αr ≥ βP /γ+αr 2γβ+d , β(1+α). Let H(μ, ν) and T V (μ, ν) denote the Hellinger distance and total variation distance between two probability measures μ and ν. Before proving the minimax lower bound in Theorem 5 and 10 over ΠN P (α, Cα, γ, Cγ, ε, β, βP , Cβ, CβP , μ+, μ−, cμ, rμ) and its subsets ΠN P S , ΠN P special subset of ΠN P and ΠN P is rigorously defined as I BA that satisfies ε(z; γ, Cγ) , we first prove the excess risk minimax lower bound over a 0 or ∆ = 0. The parameter space BA , ΠN P ≡ ΠN P 0 := ΠN P (α, Cα, γ, Cγ, 0, β, βP , Cβ, CβP , μ+, μ−, cμ, rμ) ΠN P (Q, P ) : Ω+(γ, Cγ) = Ω = ΩP } It is trivial to see that ΠN P BA since the "perfect source" setting can be viewed as a special case of those with different types of ambiguity. In addition, when γβ = βP , we have ΠN P 0 must be the minimax lower bound over the desired parametric spaces, and our first goal is to see the minimax lower bound over ΠN P S . Therefore, the minimax lower over ΠN P . The propositions are as follows: 0 ⊂ ΠN P ΠN P and ΠN P 0 ⊂ 0 ⊂ I ⊂ ΠN P ∩ { . 0 48 Proposition 3. Fix the parameters in the definition of ΠN P with αβ that d, γβ ≤ ≥ βP . We have inf ˆf sup (Q,P ) ΠNP 0 ∈ EQ( ˆf ) & n− E P β(1+α) 2γβ+d β(1+α) 2β+d . n− Q ∧ Proposition 4. Fix the parameters in the definition of ΠN P with max { βP . We have that αβ, αβP /γ d, γβ < } ≤ inf ˆf sup (Q,P ) ΠNP 0 ∈ EQ( ˆf ) & n− E P βP (1+α)/γ 2βP +d βP (1+α)/γ 2βP /γ+d . n− Q ∧ Proposition 3 and 4 serve as the minimax lower bound under the regimes of γβ βP and γβ < βP given that there is no ambiguity in the signal provided by ηP relative to ηQ. Furthermore, we see that Proposition 3 is an extension of Theorem 3.2 of Cai and Wei (2021) as we impose the condition ηP = 0 as well. ≥ Pσ The idea of the proofs are based on the application of Assouad's lemma on the family DP are defined as the product probability measure with respect to m. DQ and Pσ the target and source data, corresponding to the distribution pairs (Qσ, Pσ), σ See Section E.2 and E.3 for the proof details. DP . Here Pσ Pσ 1 − DQ × ∈ { 1, } Proofs of Theorem 5 (2), (3) and Theorem 10. We claim that it suffices to prove inf ˆf sup (Q,P ) ΠNP S ∈ Ω=ΩP EQ( ˆf ) & ε(cn− E Q β 2β+d ; γ, Cγ). (59) for some constant c > 0 given any setting of γ, β and βP = γβ to obtain Theorem 5 (2). To clarify, since ΠN P 0 must be the minimax lower bound over ΠN P , the minimax lower over ΠN P (Q, P ) : Ω = ΩP } . Hence, 0 ⊂ ΠN P ∩ { ∩ { (Q, P ) : Ω = ΩP } EQ( ˆf ) & n− E P β(1+α) 2γβ+d β(1+α) 2β+d . n− Q ∧ inf ˆf sup (Q,P ) ΠNP S ∈ Ω=ΩP Since the minimax lower bounds we desire is just ε(cn− ; γ, Cγ) added to the lower bounds Q above, it suffices to prove (59) for both cases to finish the proof. Similarly, it suffices to prove β 2β+d inf ˆf sup (Q,P ) ΠNP I ∈ Ω=ΩP EQ( ˆf ) & ε(cn− E Q β 2β+d ; γ, Cγ) for some constant c > 0, given any setting of γ, β to obtain Theorem 5 (3), and inf ˆf sup (Q,P ) ΠNP ∈ Ω=ΩP EQ( ˆf ) & ε(cn− E Q β 2β+d ; γ, Cγ) for some constant c > 0 given any setting of γ, β, and βP to obtain Theorem 10. We only prove the case of ΠN P and ΠN P , no matter what γ, β and βP are, are the same because it is easy to check that our construction of distribution pairs satisfy S . The cases of ΠN P I 49 all conditions, i.e., any γ, β and βP . { (Qσ, Pσ), σ m 1, 1 − } ∈ { } ⊂ ΠN P S ∩ ΠN P I ∩ ΠN P (Q, P ) : Ω = ΩP } ∩ { for We would like to illustrate our proof idea as follows. In order to satisfy the ambiguity level condition, we need to select a smaller number m of spheres with positive density than the classical case of no source data, as stated in Theorem 4.1 of Audibert and Tsybakov (2007). To achieve this, we set ηP 1 and select the maximum possible value of m while still satisfying the given ambiguity level ε(z; γ, Cγ). ≡ Fix ηP 1. Since ηP is a constant, it is trivial that ηP ≡ Next, define the quantities (βP , CβP ) for any βP , CβP . ∈ H 1 2β+d r = crn− Q , w = cwrd, m = ⌈ cmε(Cβcβ β 2β+d r n− Q Cβwrβ ; γ, Cγ) , ⌉ where the constants cr, cw, cm will be specified later in the proof. Here, integer that is greater equal than a for any real value a. enough such that a is the minimum ⌉ ⌈ In addition, suppose nQ is large 2cmε(Cβcβ β 2β+d r n− Q Cβwrβ ; γ, Cγ) . m ≤ Suppose that ε(Cβcβ trivial. r n− Q β 2β+d ; γ, Cγ) > 0, or otherwise the lower bound is 0 and the proof is We consider a packing ,m with radius 2r in [0, 1]d. For an example of such constuction, divide [0, 1]d into uniform small cubes with side length as 6r, which forms a grid with at least xk}k=1, d small cubes. Since ⌋ (6r)− ⌊ { *** 1 ε(Cβcβ r n− Q β 2β+d ; γ, Cγ) ≤ Cα(Cβcβ r )1+αn− Q β(1+α) 2β+d = Cαc− r β(1+α) (Cβcβ r )1+αrβ(1+α), we have m ≤ ≤ = ; γ, Cγ) (Cβcβ Cβwrβ (Cβcβ r )1+αrβ(1+α) r )1+α rαβ − d β 2β+d 2cmε(2n− Q Cβwrβ β(1+α) 2cmCαc− r 2cmCαc− r β(1+α) (6r)− 1 ≪ ⌊ Cβcw d. ⌋ Therefore, we could suppose that cm is small enough such that m < d. Therefore, ⌋ we could assign exactly one sphere with radius 2r in one cube without intersection, which ,m with radius 2r in [0, 1]d. For simplicity of notations, we forms a packing of −β(1+α) denote 2cmCαc r 0. Also, define Bc as the by c′m that converges to 0 when cm → compliment of these m balls, i.e. Bc := [0, 1]d/ ( xk}k=1, (6r)− ⌊ { (Cβ cβ r )1+α Cβ cw *** 1 m k=1 B(xk, 2r)). m, we consider the regression function ηQ σ (x) defined as follows: For any σ 1, ∈ { } 1 − 1 2 + σkCβrβgβ( k x xkk − r ) ηQ σ (x) = 1 2 ( S if x ∈ otherwise, 50 B(xk, 2r) for some k = 1, , m * * * where the function g( ) is defined as g(x) = min 1, 2 on x [0, 2]. { x } − ∈ The construction of the marginal distributions Qσ,X is as follows. Define * cmε(Cβcβ r n− Q β 2β+d r0 =  ; γ, Cγ) Cβcw − (m − 1)Cβwrβ  By the definition of m, we have that 1 β+d   , w0 = cwrd 0. r0 ≤ ( Cβwrβ Cβcw ) 1 β+d = r. Let Qσ,X have the density function μ( ) defined as * μ(x) =  w λ[B(xk,r)] w0 λ[B(xm,r0)] (m 1 w0 1)w − 1 mλ[B(xk,2r)] − 0 if x if x ∈ ∈ B(xk, r) for some k = 1, B(xm, r0) Bc , m 1 − * * * − − if x   ) does not depend on the specific choice of σ, we fix PX = Qσ,X m. Given the the construction of Qσ, we next verify that (Qσ, P ) belongs ∈ otherwise. * Since the density function μ( for any σ 1, to ΠN P 1 ∈ { − for any σ 1, m. S } ∈ { 1 − } Verify Margin Assumption: We have that Qσ(0 < ηQ σ − | 1 2 | < t) = (m − + Qσ(0 < Cβrβgβ( k X 1)Qσ(0 < Cβrβgβ( k xmk ) x1k 1)Qσ(0 < g( k − r X X − r x1k ) t) ≤ t) − r ≤ ( t Cβrβ ) 1 β ) ) ≤ = (m − + Qσ(0 < g( k X − r xmk ) ( t Cβrβ ) 1 β ) ≤ Cβrβ ≥ } = ((m t { 1)w + w0)1 Cβrβ t t } Cβrβ { ≥ − mw1 ≥ { c′mcwrαβ1 Cαtα. } ≤ ≤ ≤ given that cm is small enough since c′m cm → −→ 0 0. Therefore, it holds that Qσ ∈ M (α, Cα). Verify Smoothness Assumption: It is easy to see that for any a, b [0, 2] we have ∈ Thus, for any x, x′ x that x′ k − k gβ(a) | gβ(b) a β. b | − | ≤ | − B(xk, 2r), we obtain from the triangular inequality ∈ rβgβ( | x k xkk − /r)) − rβgβ( x′ k 51 xkk − /r)) | ≤ k x′ x − k x k β, xkk−k x′ − − xkk ≤ (60) Therefore, by the definition of ηQ σ and (60), we see that − ηP is smooth with any smoothness parameter βP . | ≤ − | ηQ σ (x) ηQ σ (x′) x Cβk x′ β, k x, x ∀ ∈ [0, 1]d. Verify Strong Density Condition: If x B(xk, r) for some k = 1, μ(x) = = cw/πd. ∈ w λ[B(xk, r)] , m − * * * 1, we have B(xm, r0) we have Bc, we have ∈ ∈ If x If x and Hence, μ(x) = w0 λ[B(xm, r0)] = cw/πd. (m 1)w + w0 ≤ − mλ[B(xk, 2r)] ≤ 0, mw ≤ c′mrαβ nQ→∞ −→ c′m2dπdrαβ nQ→∞ −→ 0. μ(x) = (m w0 1)w mλ[B(xk, 2r)] − − nQ→∞ −→ 1. 1 − 1 − Combining all cases above, we could set cw ∈ (μ). S [πdμ−, πdμ+] to satisfy the condition (Qσ, P ) ∈ Verify Ambiguity Level: Since Ω = ΩP , we trivially have that Ω−(γ, Cγ) x ∈ ⊂ { Ω : ηQ(x) = 1 2} =: Ω−. Then, A(z) := If z < Cβrβ, we have If z ≥ Cβrβ, we have ηQ(X) 1 2 | 1 { 0 < | − ηQ(X) 1 2 | ≤ − dQX z } ZΩ−(γ,Cγ ) | ηQ(X) 1 1 2 | 1)w + w0)Cβrβ1 0 < − { | z ηQ(X) dQX z } 1 2 | ≤ . } − Cβrβ { ≥ ≤ ZΩ− | =((m − A(z) = 0 ≤ ε(z; γ, Cγ). A(z) ≤ Cβmwrβ ≤ 2cmε(Cβcβ r n− Q β 2β+d ; γ, Cγ) ≤ ε(z; γ, Cγ). Therefore, the given ambiguity level ε(z; γ, Cγ) is well-defined provided that cm ≤ ΠN P m. the proof of this part by applying Assouad's lemma to (Qσ, P ), Putting all verification steps above together, we conclude that (Qσ, P ) 1, σ ∀ m differ only at one coordinate, i.e. ∈ { ∈ 1 } − Suppose that σ, σ′ 1, 1 − ∈ { 1 2. S . We finish } σk = σ′k, − σl = σ′l ( l ∀ = k). 52 6 6 If k = m, we have the Hellinger distance bound as H 2(Qσ, Qσ′) = 1 2 ηQ σ (X) − ηQ σ′(X) q (cid:19) + 1 (cid:18)q − Z (cid:18)q ηQ σ (X) 2 2 ηQ σ′(X) dQX (cid:19) 1 q − 2 − 1 2 + Cβrβ 1 2 − − r w λ[B(xk, r)] r 2C 2 βr2β) 1 − ZB(xk,r) 1 w(1 2 C 2 − βwr2β. q = = ≤ Cβrβ ! dx Similarly, if k = m, the Hellinger distance bound should be H 2(Qσ, Qσ′) C 2 βw0r2β C 2 βwr2β. ≤ ≤ Recall that r = crn− Q 1 2β+d . By the property of Hellinger distance, we have H 2(Pσ DQ, Pσ′ DQ) ≤ nQH 2(Qσ, Qσ′) nQC 2 βwr2β C 2 βc2β+d r cw ≤ ≤ ≤ √2 4 provided that cr is small enough. This further indicates that T V (Pσ DQ, Pσ′ DQ) ≤ √2H 2(Pσ DQ, Pσ′ DQ) 1 2 . ≤ (61) For any empirical classifier ˆf , if k = m, we have EQσ( ˆf ) + ′ ( ˆf ) = 2EQσ[ | EQσ ηQσ(X) − ˆf (X) = f ∗Qσ(X) ] } { + 2EQσ ′ [ | ηQσ ′ (X) − = f ∗Qσ ′ (X) ] } 1 1 2 | 1 2 | 1 ˆf (X) { Cβrβ(1 w λ[B(xk, r)] 2 ≥ ZB(xk,r) = 2Cβwrβ. ˆf (X) = f ∗Qσ(X) + 1 { } ˆf (X) = f ∗Qσ ′ (X) )dx } { If k = m, we have EQσ( ˆf ) + ′ ( ˆf ) = 2EQσ[ | EQσ ηQσ(X) − 1 1 2 | 1 2 | ˆf (X) = f ∗Qσ (X) ] } { 1 ˆf (X) = f ∗Qσ ′ (X) ] } + 2EQσ ηQσ ′ [ | 2 ≥ ZB(xm,r0) = 2Cβw0rβ. ′ (X) { − w0 λ[B(xm, r0)] Cβrβ(1 { ˆf (X) = f ∗Qσ(X) ˆf (X) + 1 { } = f ∗Qσ ′ (X) )dx } Combining this lower bound with (61), the Assouad's lemma shows that sup (Q,P ) ΠNP S ∈ EQ( ˆf ) E ≥ σ EQσ( ˆf ) E ≥ 1 2 Cβ((m − 1)w + w0)rβ. m sup (Qσ,P ) 1 1, ∈{ − } 53 6 6 6 6 6 6 6 6 6 6 On one hand, if m 2, we further have ≥ EQ( ˆf ) E sup (Q,P ) ΠNP S ∈ 1 2 ≥ Cβ((m − 1)w + w0)rβ 1 4 ≥ Cβmwrβ & ε(Cβcβ r n− Q β 2β+d ; γ, Cγ). On the other hand, if m = 1, we have cmε(Cβcβ β 2β+d r n− Q Cβcw 1 β+d ; γ, Cγ)   , w0 = cwrd 0. r0 =   Therefore, sup (Q,P ) ΠNP S ∈ EQ( ˆf ) E ≥ 1 2 Cβw0rβ 1 2 ≥ Cβcwrβ+d 0 & ε(Cβcβ r n− Q β 2β+d ; γ, Cγ). We conclude that it always holds that sup(Q,P ) ∈ finishes the proof. ΠNP BA EQ( ˆf ) & ε(Cβcβ E r n− Q β 2β+d ; γ, Cγ), which Proofs of Theorem 5 (1). Following a similar argument with the ones in the proofs of Theorem 5 (2), (3) and Theorem 10, it suffices to show that inf ˆf for any setting of γ and β. sup (Q,P ) ΠNP BA ∈ EQ( ˆf ) & ∆ E 1+α γ n− Q ∧ β(1+α) 2β+d . (62) Fix ηP 1 2. Since ηP is a constant, it is trivial that ηP Next, define the quantities ≡ (βP , CβP ) for any βP , CβP . ∈ H r = (crn− Q 1 2β+d (C − β ) ∧ 1 β ( ∆ Cγ ) 1 γβ ), w = cwrd, m = cmrαβ ⌊ d − , ⌋ *** { We consider a packing where the constants cr, cw, cm will be specified later in the proof. xk}k=1, ,m with radius 2r in [0, 1]d. We repeat the example of such construction given in Proposition 3. Divide [0, 1]d into uniform small cubes with side d, length as 6r, which forms a grid with at least (6r)− ⌋ ⌊ d. Therefore, we could assign we suppose that cm is small enough such that m < ⌋ exactly one sphere with radius 2r in one cube without intersection, which forms a packing of ,m with radius 2r in [0, 1]d. Also, define Bc as the compliment of these m balls, i.e. xk}k=1, { Bc := [0, 1]d/ ( For any σ d small cubes. Since m ⌋ (6r)− ⌊ m, we consider the regression function ηQ m k=1 B(xk, 2r)). 1, σ (x) defined as follows: (6r)− ≪ ⌊ *** 1 1 1 ∈ { S } 1 − 2 + σkCβrβgβ( k 1 ηQ σ (x) = 1 2 ( x xkk − r ) B(xk, 2r) for some k = 1, if x ∈ otherwise, , m * * * where the function g( * ) is defined as g(x) = min 1, 2 { x } − on x ∈ [0, 2]. 54 The construction of the marginal distributions Qσ,X is as follows. Let Qσ,X have the density function μ( * ) defined as μ(x) =   w λ[B(xk,r)] mw 1 mλ[B(xk,2r)] − 1 − 0 ∈ if x if x B(xk, r) for some k = 1, Bc, ∈ otherwise. , m, * * * Since the density function μ( for any σ 1, to ΠN P 1 − ∈ { BA for any σ 1, m.  } ∈ { 1 − } ) does not depend on the specific choice of σ, we fix PX = Qσ,X m. Given the the construction of Qσ, we next verify that (Qσ, P ) belongs * Verify Margin Assumption: We have that Qσ(0 < ηQ σ − | 1 2 | < t) = mQσ(0 < Cβrβgβ( k X − r x1k ) t) ≤ t Cβrβ ) 1 β ) = mQσ(0 < g( k X − r x1k ) ( ≤ = mw1 t ≥ { cmcwrαβ1 Cαtα. ≤ ≤ Cβrβ t { ≥ } Cβrβ } given that cm is small enough. Therefore, Qσ ∈ M Verify Smoothness Assumption: It is easy to see that for any a, b (α, Cα). [0, 2] we have ∈ gβ(a) | gβ(b) a β. b | − | ≤ | − B(xk, 2r), we obtain from the triangular inequality ∈ Thus, for any x, x′ x that x′ k − k rβgβ( | x xkk xkk Therefore, by the definition of ηQ σ and (63), we see that β, ηQ Cβk σ (x′) ηQ σ (x) /r)) | ≤ − − − − − x′ x′ x k k k | rβgβ( /r)) x′ x − | ≤ k k x, x ∀ ∈ [0, 1]d. x k β. xkk−k x′ − − xkk ≤ (63) Verify Strong Density Condition: If x ∈ B(xk, r) for some k = 1, w λ[B(xk, r)] = cw/πd. μ(x) = , m, we have * * * If x ∈ Bc, we have d μ(x) = 1 1 rd ⌋ rd d − ⌋ [πdμ−, πdμ+] to satisfy the condition (Qσ, P ) cw⌊ − 2dπd⌊ − cmrαβ − cmrαβ nQ→∞ −→ 1. (μ). ∈ S Therefore, we could set cw ∈ Verify Band-like Ambiguity: Since ηP Ω. In addition, by definition of ηQ x ≡ ∈ 1 2, by Definition 1 we have s(x) = 0 for any σ and r, we have that for any x Ω, ηQ σ − | 1 2 | ≤ Cβrβ ( ∆ Cγ 1 γ ) ≤ Cγ| ηQ σ − ⇒ γ 1 2 | 55 ∈ ∆. ≤ Therefore, we have s(x) = 0 Cγ| ηQ σ − ≥ γ 1 2 | ∆ − for any x Ω. ∈ Putting all verification steps above together, we conclude that (Qσ, P ) BA . We finish the proof of this part by applying Assouad's lemma to (Qσ, P ), If σ, σ′ 1, 1 − } ∈ { m differ only at one coordinate, i.e. σ ∀ ∈ { 1, ΠN P m. ∈ 1 } − σk = σ′k, − σl = σ′l ( l ∀ = k), we have the Hellinger distance bound as H 2(Qσ, Qσ′) = 1 2 ηQ σ (X) − ηQ σ′(X) q (cid:19) + 1 (cid:18)q − Z (cid:18)q ηQ σ (X) 2 2 ηQ σ′(X) dQX (cid:19) 1 q − 2 − 1 2 + Cβrβ 1 2 − − r w λ[B(xk, r)] r 2C 2 βr2β) 1 − ZB(xk,r) 1 w(1 2 C 2 − βwr2β. q = = ≤ Cβrβ ! dx Recall that r = (crn− Q 1 2β+d (C − β ) ∧ 1 β ( ∆ Cγ ) 1 γβ ). By the property of Hellinger distance, we have H 2(Pσ DQ, Pσ′ DQ) ≤ nQH 2(Qσ, Qσ′) C 2 βwnQr2β C 2 βc2β+d r cw ≤ ≤ ≤ √2 4 provided that cr is small enough. This further indicates that DQ, Pσ′ DQ) For any empirical classifier ˆf , we have T V (Pσ √2H 2(Pσ DQ, Pσ′ DQ) ≤ 1 2 . ≤ (64) EQσ( ˆf ) + ′ ( ˆf ) = 2EQσ[ | EQσ ηQσ(X) − ˆf (X) = f ∗Qσ(X) ] } { + 2EQσ ′ [ | ηQσ ′ (X) − = f ∗Qσ ′ (X) ] } 1 1 2 | 1 2 | 1 ˆf (X) { Cβrβ(1 w λ[B(xk, r)] 2 ≥ ZB(xk,r) = 2Cβwrβ. ˆf (X) = f ∗Qσ(X) + 1 { } ˆf (X) = f ∗Qσ ′ (X) )dx } { Combining this lower bound with (64), the Assouad's lemma shows that sup (Q,P ) ΠNP BA ∈ EQ( ˆf ) E ≥ σ EQσ( ˆf ) E ≥ 1 2 m Cβmwrβ & rβ(1+α) & ∆ 1+α γ n− Q ∧ β(1+α) 2β+d . sup (Qσ,P ) 1 1, ∈{ − } 56 6 6 6 6 6 D. Proofs in Parametric Classification We first list some definitions that are helpful for the proofs in this section. Denote the target and source distribution with certain linear coefficients β, w as Qβ := Pw := Q : X { Q : X ∼ N(0, Id), ηQ(x) = σ(βT x) } N(0, Id), ηQ(x) = σ(wT x) , , ∼ Rd. The family of distribution pairs then becomes { } for any β, w ∈ ΠLR = ΠLR(s, Π, M) = (Qβ, Pw) : (β, w) Θ(s, ∆) , } where Θ(s, ∆) is defined in (21). Moreover, we abbreviate Eβ as E(X,Y ) ∼ with respect to a new observation drawn from the distribution Qβ. Similarly, define as the excess risk with respect to the target distribution Qβ. Qβ , the expectation EQβ (f ) Before entering into the proof of the main theorems, we first show the following lemma ∈ { that bounds the ambiguity level for any (Q, P ) Lemma D.1. Assume that L 0 < m ∈ βP k2 ≤ βQk2 ≤ k m k 1. We have that ΠLR(s, ∆) Π(α, Cα, γ, Cγ, ε) where ⊂ ≤ ≤ ΠLR: U for some constant L, U > 0 and α = 1, Cα = 16m √2πL ∨ 4, γ = 1, Cγ = m π , ε(z; 1, m π ) = ( (cid:18) 16m √2πL ∨ 4)z2 ∧ (cid:19) √2U m ∆2. D.1. Proof of Lemma D.1 Proof. For any x B(0, 1), we have ∈ σ′(βT Qx) = σ(βT Qx)(1 σ(βT Qx))βQ, − Qx)(1 Define eQ and eP as the unit vectors that have the same directions with βQ and βP , respectively. Qx))βP . − σ′(βT P x) = σ(βT σ(βT Verify Margin Assumption: From the simple equality that log(1 + 4t − t [0, 1 1 2t ) L m we have ∈ 4] and βQk ≥ k 8t for any ≤ 4t 1 − )) 2t QX (0 < σ(βT QX) | 1 2 | − < t) = QX(0 < βT QX | | ≤ log(1 + QX (0 < QX (0 < | | ≤ ≤ βT QX eT QX = QX( N(0, 1) tφ(0) = t) | ≤ | ≤ 8t) 8m L 8m L 16m √2πL t, t) | ≤ | m L 16 ≤ 57 where φ( ( 1 t 4, 1], we trivially have QX(0 < Therefore, Assumption holds with α = 1, Cα = 16m ) is the density function of the univariate standard normal distribution N(0, 1). For 4t since QX is a probability measure. < t) σ(βT QX) ≤ 4. − ∈ | * 1 2| √2πL ∨ Verify Ambiguity Level: A trivial well-defined ambiguity level by the margin assumption is ε(z; γ, ) = Cαz1+α = ( m π 16m √2πL ∨ 4)z2. Hence, it suffices to show that a well-defined ambiguity level is ε(z; 1, m π ) = √2U m ∆2. Without loss of generality and due to the symmetry property of of N(0, Id), we could rotate βQ and βP at the same time so that βQ = ( βQk k , 0, 0, * * * , 0), βP = ( βP k k cos ∠(βQ, βP ), βP k k sin ∠(βQ, βP ), 0, 0, , 0). * * * Therefore, we assume that only the first coordinate of βQ and the first and second coordinates of βP can be non-zero. For any x Rd, we define dQ(x) and dP (x) as the angle between (x1, x2, 0, normal planes of βQ and βP , respectively. Note that dQ(x), dP (x) ∈ , 0) and the * * * [0, π/2]. Define the area ∈ D := x { ∈ Rd : (βT Qx)(βT P x) < 0 x ∈ } ∪ { Rd : (βT Qx)(βT P x) 0, dP (x) < ≥ 1 2 dQ(x) } as the region where ηP does not give strong signal relative to ηQ. We see that D is a cone centered at origin with angle between the two normal planes equal to 2∠(βQ, βP ) 2∆. In D, the norm of projection of x onto the normal plane of βQ is less than addition, for any x ≤ ∈ (x2 1 + x2 2) 1 2 sin 2∠(βQ, βP ) 2(x2 1 + x2 2) 1 2 ∆, ≤ where the simple inequality sin 2∠(βQ, βP ) 2∠(βQ, βP ) is used. Therefore, ≤ ηQ(x) | 1 2 | ≤ − 2 max { σ′(z) R ∈ }z βQk k (x2 1 + x2 2) 1 2 ∆ U 2m ≤ (x2 1 + x2 2) 1 2 ∆ x ∀ ∈ D, and ηQ(X) 1 2| − ZD | dQX ≤ (X 2 1 + X 2 2 ) 1 2 dQX (X 2 1 + X 2 2 ) 1 2 dQX Rd Z (X 2 1 + X 2 2 ) 1 2 dQX ZD ∆(2∆) = ∆ U 2m U 2m U m √2U m ≤ EQX [X 2 ∆2 ≤ Rd Z ∆2, 58 since ∆ ∈ [0, π 2 ] and EQX [(X 2 1 + X 2 2 ) 1 2 ] ≤ 1 + X 2 2 ] 1 2 = √2. On the other hand, if x / ∈ ηP (x) | − D, we have 1 2| = = | | σ(βT P x) σ( βP k k 1 2| 1 + x2 2) − (x2 1 2 sin(dP (x)) 1 2 | − σ( σ(m βQk k m βQk π k m βT Qx) π σ(βT Qx) σ( m π | ≥ | ≥ | ≥ | ≥ (x2 1 + x2 2) 1 2 sin( 1 2 dQ(x)) 1 2 sin(dQ(x)) (x2 1 + x2 2) 1 2 | 1 2 | , − − 1 2| − 1 2 | − given the fact that sin( 1 on t sin t σ(t) π on t 0. Therefore, a well-defined ambiguity level is ε(z; 1, m 2 ] and that [0, π 2t) ≥ ∈ | 1 2| − π ) = √2U /x in monotone decreasing m ∆2. ≥ D.2. Proof of Theorem 6 ex+1, ψ′′(x) = ex Define the logistic link function ψ(x) := log(1 + ex). It is obvious from straightforward calculation that ψ′(x) = ex 1 4. Prior to the proof, we present two lemmas that are helpful for deriving the key conditions in Theorem 2. They serve as the parametric bound of the estimator obtained by the loss function optimization in (20). See Section E.4 for the proof of the two lemmas. Lemma D.2 (Parameter Bound for ˆβQ). Under the notations and conditions of Theorem 6, there exists some constant CQ, κQ > 0 such that (ex+1)2 ≤ P ( ˆβQ − k D βQk ≥ κQ s log d nQ ) ≤ CQ s s log d nQ ∧ s log d nP (cid:19) . (cid:18) (65) Lemma D.3 (Parameter Bound for ˆβP ). Under the notations and conditions of Theorem 6, there exists some constant CP , κP > 0 such that P ( ˆβP − k D βP k ≥ κP ( r cP for some constant cP > 0. s log d nP when ∆ ≤ + ∆)) CP ≤ s log d nQ ∧ s log d nP (cid:19) (cid:18) (66) Proof of Theorem 6. By Lemma D.2, there exist constants CQ, κQ > 0 such that CQ( s log d nQ ∧ s log d nP ), P DQ(Ec) ≤ ˆβQ − {k βQ. We define where we define the event E := the same direction as ˆβQ − βQk ≤ s log d nQ } κQ q . Define ˆe as the unit vector with Ω∗ := x { ∈ Ω : | ˆeT x | ≤ √2τ /( κQ 2√2s s log d nQ ) . } 59 Since ˆeT X ∼ N(0, 1) with respect to QX , the tail bound of normal distributions that Q(Ω∗) 1 − ≥ 2 exp( τ /( − κQ 2√2 s s log d nQ ) 2 ). ! Since σ( have * ) is Lipschitz-continuous with the Lipschitz constant as 1 4, on the event E, we further σ(βT Qx) | − σ( ˆβT Qx) | ≤ 1 4| (βT Q − ˆβT Q)x | ≤ k ˆβQ − βQk * | ˆeT x | ≤ τ (67) for any x Ω∗. ∈ Now we could directly apply Theorem 2 where the parameters are τ = cτ s log d nQ s log(nQ ∨ nP ), and δQ(nQ, τ ) = 2 exp( τ /( − κQ 2√2 s s log d nQ ) 2 ! ) + CQ( s log d nQ ∧ s log d nP ) with cτ ≥ satisfies κQ 2√2 . Note that δQ(nQ, τ ) . s log d nQ ∧ s log d nP . By Theorem 2, the TAB classifier ˆf LR T AB m π m π ) ) τ 2 + ε(2τ ; 1, ∧ m π ) + δQ(nQ, τ ) (log2(nQ ∨ ∧ nP ) s log d nQ ) ˆf LR T AB . sup ∈ (Q,P ) ΠLR E DP ξ(1 { ˆβT P x ; 1, 0 } ≥ E DP ξ(1 ˆβT P x ; 1, 0 } ≥ . sup (Q,P ) ΠLR ∈ + (log2(nQ ∨ s log d + nQ ∧ nP ) s log d nP . { s log d nQ ∆2 ) ∧ Therefore, it suffices to show that E DP ξ(1 { ˆβT P x ; 1, 0 } ≥ m π ) . s log d nP + ∆2 ∈ for any (Q, P ) ∆ in Lemma D.3, this bound is trivial as E assume that ∆ enough such that κP cP ≤ ΠLR to prove Theorem 6. If ∆ > cp where cp is the constant constraint of ˆβT P x 1. Hence, we WLOG cp to apply Lemma D.3. In addition, we may as well assume that cP is small DP ξ(1 ; 1, m π ) By Lemma D.3, there exist constants CP , κP > 0 such that L 4 . ≥ ≤ ≤ } { 0 P DP (Ec 2) ≤ CP ( s log d nQ ∧ s log d nP ), where we define the event E2 := + ∆) by Λ by simplicity. By the theorem setting, we could assume that nP is large enough such that . Denote κP ( βP k ≤ + ∆) κP ( {k } q q s log d nP s log d nP ˆβP − 60 s log d nP ≤ κP and q L 4 , so we have Λ by the law of sines. Hence, L 2 ≤ k ≤ sin ∠( ˆβP , βP )/ βP k2. Therefore, on the event E2 we have ∠( ˆβP , βP ) βP k βP k ≤ ˆβP − 1/ k k π 2 ≤ ∠( ˆβP , βP ) π 2 ≤ sin ∠( ˆβP , βP ) ˆβP − ≤ k / βP k βP k ≤ k Λ L . Without loss of generality and due to the symmetry property of of N(0, Id), we could rotate βP and ˆβP at the same time so that βP = ( βP k k , 0, 0, * * * , 0), ˆβP = ( ˆβP k k cos ∠( ˆβP , βP ), ˆβP k k sin ∠( ˆβP , βP ), 0, 0, , 0). * * * Therefore, we assume that only the first coordinate of βQ and the first and second coordinates of ˆβP can be non-zero. Rd : (βT Define D := x { size bounded by Λ L . For any x is less than ∈ ∈ P x)( ˆβT P x) < 0 , which is a cone centered at the origin with angle D, the norm of projection of x onto the normal plane of βQ } (x2 1 + x2 2) 1 2 sin ∠( ˆβP , βP ) (x2 1 + x2 2) 1 2 ≤ Λ L , where the simple inequality sin ∠( ˆβP , βP ) ∠( ˆβP , βP ) is used. Therefore, ≤ ηQ(x) | 1 2 | ≤ − max σ′(z) R ∈ }z βP k k { (x2 1 + x2 2) 1 2 Λ L ≤ U 4 (x2 1 + x2 2) 1 2 Λ L ∀ x ∈ D, and since Λ L ∈ ηQ(X) 1 2 | − dQX ≤ ZD | = (X 2 1 + X 2 2 ) 1 2 dQX Rd (X 2 1 + X 2 2 ) 1 2 dQX 1 2 = √2. Hence, we obtain that [0, π 2 ] and EQX [(X 2 1 + X 2 2 ) 1 2 ] ≤ ˆβT P x ξ(1 { ; 1, 0 } ≥ m π ) = 2EX N (0,Id)[ | ηP 1 2| 1 { X − D ] } ∈ U Λ L 4 ZD U Λ )2 L 4 Z √2U 4L2 Λ2 ( ≤ EQX [X 2 1 + X 2 2 ] ∼ √2U 2L2 Λ2 √2U 2L2 κ2 P ( ≤ = s log d nP + ∆)2. r ; 1, m π ) Λ L on the event E2 and ξ(1 ˆβT P x { ≥ ≤ To summarize, we have the boundsξ(1 ˆβT P x { 0 } ≥ 61 ; 1, m π ) 0 } 1 on the event Ec 2. As a result, ˆβT P x ˆβT P x ≥ 0 ; 1, } 0 } ; 1, m ) π m π ≥ s log d nP s log d nP ) E2]P | DP (E2) + E DP [ξ(1 + ∆)2 1 + 1 CP ( × × + ∆)2 + CP ( s log d nQ ∧ s log d nQ ∧ s log d nP ) ˆβT P x { s log d nP ≥ ) =E { ≤ E DP ξ(1 { DP [ξ(1 √2U 2L2 κ2 P ( √2U 2L2 κ2 P ( s log d nP ≤ = . r r + ∆2. ; 1, 0 } m π ) | Ec 2]P DP (Ec 2) D.3. Proof of Theorem 7 Given an arbitrary classifier ˆf based on DQ and EQ( ˆf ) & E First part of Proof. As part of the proof, we would like to first show that sup (Q,P ) ΠLR (cid:18) (cid:19) ∧ ∈ DP . Our goal is to show that s log d nQ + ∆2 s log d nP . sup (Q,P ) ΠLR ∈ EQ( ˆf ) & E s log d nP ∧ s log d nQ . The idea is to suppose βP = βQ = β, P = Q = Qβ which implies ∠(βQ, βP ) = 0, and then reveal the lower bound provided by the combined sample DQ ∪ DP . The proof is based on Fano's lemma on the vector angle. We consider a class of β Rd such that k β 0, C k0 ≤ s, β1 = 1, log d/(nQ ∨ where the constant C > 0 will be specified later. Denote such a class of β as . The construction of the class of β is inspired and similar to Raskutti et al. (2009). By Lemma , such that 5 of Raskutti et al. (2009), we see that there exists a subset of log d/(nQ ∨ nP ), 2 ∀ nP ) d), q q H − ≤ ≤ C } j ( | , named ̃ H H ∈ βj| ∈ { ̃ H| ≥ | exp( s 1 − 2 log d s 1)/2 ) and − (s − 1 βj 6 = β′j} ≥ { s 1 , − 2 β, β′ ∀ . ̃ H ∈ d j=2 X We provide the following two observations on the elements of ̃ H : , its norm is bounded by the following inequality: • For any β ̃ H ∈ 1 β k2 ≤ ≤ k 1 + C s log d/(nQ ∨ nP ) M, ≤ (68) for some M > 0 large enough since we supposed that s log d/(nQ ∨ nP ) . 1. q 62 • For any β = β′ ̃ H ∈ ∠(β, β′) , their angle could be bounded by = β′j} sin ∠(β, β′) d j=2 1 βj 6 { ( ≥ This inequality holds since as long as βj construction of ̃ we have H β′j| ≥ βj − C | Next, we define the random variable Z as the β that attains the minimum of ≥ ≥ P C p 1 ) 2 C β k k nP ) . p s log d/(nQ ∨ 2M = β′j for some 2 log d/(nQ ∨ ̃ ∈ H EQβ ( ˆf ). nP ). p log d/(nQ ∨ nP ) (69) j ≤ ≤ d, based on the EQβ ( ˆf ), i.e. For any β′ = Z, β′ ∈ Z := arg min β ̃ H ∈ , by Lemma E.4, we have that ̃ H EQZ ( ˆf ) + ′ ( ˆf ) EQβ ≥ σ(M)(1 − 20π σ(M)) ∠(Z, β′)2. by (68). The choice of Z further indicates that σ(M)) ∠(Z, β′)2 σ(M)(1 − 40π Cσ(M)(1 ′ ( ˆf ) EQβ ≥ ≥ σ(M)) − 80πM σ(M )) s log d/(nQ ∨ by CM for simplicity. Hence, nP ). q nP ) P Dβ × ′ (Z = β′), We denote the constant term Cσ(M )(1 − 80πM C 2 M s log d/(nQ ∨ E and so ′ ( ˆf ) ≥ Dβ E ′ EQβ EQ( ˆf ) E sup (Q,P ) Π ∈ ≥ ≥ ≥ ′ ∈ Dβ ̃ H max βQ=βP =β′ C 2 M s log d/(nQ ∨ C 2 M s log d/(nQ ∨ P ′ ( ˆf ) P EQβ nP ) max β′ ̃ H ∈ 1 ̃ H| Xβ′ nP ) ∈ ̃ H Dβ | ′ (Z ′ (Z = β′) P Dβ ′ (Z = β′). (70) The remaining work is to lower bound 1 = β′) by some positive constant. By β′ ̃ ∈ H| | Fano's lemma where the total sample size is nQ + nP (Note that we suppose P = Q), we have ̃ H Dβ P 1 ̃ H| Xβ′ ∈ ̃ H | P Dβ ′ (Z = β′) 1 ≥ − log 2 + (nQ + nP ) maxβ =β′ ̃ H| log 2 + (nQ + nP ) maxβ log | KL(Qβ, Qβ′) KL(Qβ, Qβ′) ̃ H ∈ ̃ H ∈ =β′ s log d c * s log d for some c > 0 small enough. For any β 1 ≥ − (71) = β′ , ̃ H ∈ since log their Kullback-Leibler divergence satisfies log d s − 1)/2 ≥ (s − ̃ H| ≥ − 2 c * | 1 s KL(Qβ, Qβ′) = EQβ [ψ′′(X T (tβ + (1 t)β′))(X T (β β′))2] CψEQβ [(X T (β Cψk β′ − β k 2 ≤ ≤ − − β′))2] − CψC 2(s log d)/(nQ ∨ nP ) ≤ 63 6 6 6 6 6 6 6 6 6 6 6 for the logistic regression link function ψ(u) = log(1 + eu), some constant t [0, 1] and ∈ Therefore, Cψ := ψ′′ k k∞ . log 2 + (nQ + nP ) maxβ =β′ s log d KL(Qβ, Qβ′) ̃ H ∈ ≤ log 2 + CψC 2(s log d) (nQ+nP ) nP s log d nQ∨ c 1 2 ≤ c * * by choosing C to be small enough. With such a choice of C, we see that (70) further reduces to sup (Q,P ) Π ∈ EQ( ˆf ) E C 2 M s log d/(nQ ∨ ≥ nP ) | 1 ̃ H| Xβ′ ∈ ̃ H P Dβ ′ (Z = β′) 1 2 1 2 ≥ = nP ) C 2 M s log d/(nQ ∨ C 2 M s log d nQ ∧ s log d nP , which is just our desired result. Second part of Proof. Next, we would like to show that sup (Q,P ) ΠLR ∈ EQ( ˆf ) & ∆2 E ∧ s log d nQ . First, we fix βP = h in the sense that Next, we consider a class of β such that h1 = 1, hj = 0 ( 2 ∀ ≤ j ≤ d). β k0 ≤ s, β1 = 1, βj| ∈ { 0, C∆ log d/nQ ∧ | k where the constant C∆ ≥ by definition, it suffices to show that ∠(β, h) holds that We want to verify that for any β q ≤ 0 will be specified later. Denote such a class of β as sin ∆ √s , − sin ∆ √s } ( C∆ log d/nQ ∧ 2 ∀ ≤ H∆. ΠLR. Since it is obvious that q d), j ≤ ∈ H∆, (Qβ, Ph) s ∆ from the calculation of the angle sine. It k0 ≤ ∈ β k d j=2 1 since satisfies P β { = h } ≤ s, h k k sin ∠(β, h) sin ∆, (72) ( d j=2 1 β { = h } ) 1 2 ( sin ∆ √s ) ≤ P = 1, and β h k k h | − | ≤ βT h = 1 > 0, ≤ if βj 6 sin ∆ √s = hj. Also, the dot product (73) which indicates that ∠(β, h) < π 2 . Based on (72) and (73), we conclude that By following the same idea in the first part of the proof, Lemma 5 of Raskutti et al. (2009) s 1)/2 ) and − shows that there exists a subset of 2 log d exp( s (s − 1 ̃ H∆| ≥ | − ∠(β, h) ∆, β ∈ H∆. ∀ ≤ H∆, named ̃ H∆, such that 1 s 1 { βj 6 = β′j} ≥ , − 2 β, β′ ∀ ̃ H∆. ∈ d j=2 X 64 Following the same procedure of (68) and (69), we claim that 6 6 6 6 • For any β ̃ H∆, its norm is bounded by the following inequality: ∈ 1 β k2 ≤ ≤ k 1 + C∆ sin ∆ 1 + C∆. ≤ • For any β = β′ ∈ ̃ H∆, their angle sine could be bounded by d j=2 1 2 (C∆ β sin ∠(β, β′) = β′j} βj 6 { ≥ ≥ ( ) 1 ∠(β, β′) log d/nQ ∧ sin ∆ √s ) P C∆ ≥ p s log d/nQ ∧ 2(1 + C∆) p k k sin ∆ . (74) (75) This inequality holds since as long as βj construction of ̃ C∆ H∆ we have β′j| ≥ βj − | = β′j for some 2 sin ∆ log d/nQ ∧ √s . j ≤ ≤ d, based on the Define the random variable Z as the β p ∈ ̃ H∆ that attains the minimum of H∆ EQβ ( ˆf ). ̃ H∆, by Lemma E.4, we have that Z := arg min β ∈ ̃ EQβ( ˆf ), i.e. For any β′ = Z, β′ ∈ EQZ ( ˆf ) + by (74). The choice of Z further indicates that ′ ( ˆf ) EQβ ≥ σ(1 + C∆)(1 − 20π σ(1 + C∆)) ∠(Z, β′)2. ′ ( ˆf ) EQβ ≥ ≥ σ(1 + C∆)(1 − 40π σ(1 + C∆)) ∠(Z, β′)2 σ(1 + C∆)(1 σ(1 + C∆)) − 80π(1 + C∆) (C 2 ∆s log d/nQ) sin2 ∆. ∧ We denote the constant term σ(1+C∆)(1 − 80π σ(1+C∆ )) by C ′∆ for simplicity. Hence, E Dβ ′ EQβ ′ ( ˆf ) ≥ C ′∆((C 2 ∆s log d/nQ) sin2 ∆) P Dβ × ∧ ′ (Z = β′), and so sup (Q,P ) Π ∈ EQ( ˆf ) E ≥ ≥ ≥ E max β′ ̃ H∆,βP =h ∈ C ′∆((C 2 EQβ ∆s log d/nQ) Dβ ′ C ′∆((C 2 ∆s log d/nQ) ′ ( ˆf ) ∧ ∧ P β′ Dβ sin2 ∆) max ̃ H∆ ∈ 1 ̃ H∆| Xβ′ ̃ H∆ sin2 ∆) ∈ | ′ (Z = β′) (76) P Dβ ′ (Z = β′). By Fano's lemma where the total sample size is nQ, we have 1 ̃ H∆| Xβ′ ̃ H∆ ∈ | P Dβ ′ (Z = β′) 1 ≥ − 1 ≥ − log 2 + nQ maxβ =β′ log KL(Qβ, Qβ′) ̃ H∆ ∈ ̃ H| (77) | log 2 + nQ maxβ =β′ KL(Qβ, Qβ′) s log d c * 65 6 6 6 6 6 6 6 6 6 2 log d since log their Kullback-Leibler divergence satisfies s − 1)/2 ≥ ̃ H∆| ≥ c (s − − | * 1 s s log d for some c > 0 small enough. For any β = β′ ̃ H∆, ∈ KL(Qβ, Qβ′) = EQβ [ψ′′(X T (tβ + (1 t)β′))(X T (β β′))2] − CψEQβ [(X T (β β Cψk − β′ 2 k ≤ ≤ ≤ − β′))2] − CψC 2 ∆ s log d nQ for the logistic regression link function ψ(u) = log(1 + eu) and some constants t Therefore, ∈ [0, 1]. log 2 + (nQ + nP ) maxβ s log d c * =β′ KL(Qβ, Qβ′) log 2 + CψC 2 s log d c ∆s log d * 1 2 ≤ ≤ by choosing C∆ to be small enough. With such a choice of C∆, we see that (70) further reduces to sup (Q,P ) Π ∈ EQ( ˆf ) E ≥ C ′∆((C 2 ∆s log d/nQ) sin2 ∆) max ̃ H∆ β′ ∈ ∧ P ′ (Z = β′) Dβ ≥ = ≥ which is just our desired result. 1 2 1 2 C ′∆((C 2 C ′∆C 2 ∆ sin2 ∆) ∆s log d/nQ) s log d ∧ C ′∆ sin2 ∆ nQ ∧ s log d nQ (cid:19) C ′∆C 2 ∆ 1 2 (cid:18) 4C ′∆ π2 ∆2 , (cid:19) ∧ (cid:18) Theorem 7 is achieved simply by combining the first and second parts of the proof above. E. Auxiliary Results E.1. Proof of Proposition 2 In this subsection, ε(z; γ, Cγ) ≡ 0 in the parameter setting of ΠN P . Proof of the first statement. The direction of definitions. Suppose Q ∈ obvious that PX = QX ∈ S ΠN P (μ+, μ−, cμ, rμ). ΠN P Q is obvious from the Q . We always assume that PX = QX in this part. It is then Q : (Q, P ) ΠN P } ⊂ ∈ { If β = 0, then βP = 0, and ηQ, ηP can be noncontinuous. Simply setting ηP = 1 2 + Cγ 2γ sgn ηQ 1 2 − (cid:18) (cid:19) satisfies (Q, P ) ΠN P provided that CβP ≥ ∈ Cγ 2γ . If β > 0, and ηQ does not hit 1 is a fixed constant. In this case, either setting ηP 2 on Ω, then the continuity of ηQ indicates that sgn(ηQ ΠN P . ≡ 0 satisfies (Q, P ) 1 or ηP ≡ ∈ 1 2 ) − 66 6 6 6 At last, we prove the first statement under the conditions that β > 0 and ηQ hits 1 If βP = 0, then we can again set ηP = 1 we consider βP > 0 below. For any x ∈ Ω, define d(x) as the point x′ ∈ − Ω, ηQ(x′) = 1 (cid:0) (cid:1) 2 + Cγ 2γ sgn ηQ 1 2 to satisfy that (Q, P ) 2 on Ω. ΠN P , so ∈ 2 that is closest to x, i.e. . d(x) := arg min x′ Ω,ηQ(x′)= 1 2 x k − x′ k ∈ This function is well-defined since ηQ hits 1 2 on Ω. Define ηP as ηP = 1 2 + Csgn ηQ (cid:18) 1 2 − where the constant C > 0 will be specified later. 2)(ηQ By the definition of P , we have (ηP 1 − − (cid:19) 1 2) x k − d(x) βP , k 0. Moreover, we have ≥ βP ηP (x) | 1 2 | ≥ − ≥ ≥ ≥ C x k − βP β CC − β βP β βP β CC − β CC − β d(x) x k Cβk (cid:0) ηQ(x) | 2βP /β − ηQ(x) Cγ| ≥ 1 2 | − − βP β d(x) 1 2 | − ηQ(x) βP β β k (cid:1) γ 1 2 | − γ | γ. We conclude that Ω+(γ, Cγ) = Ω provided that C obtain that ≥ CγC βP β 2γ β βP /β. Hence, it suffices to − ηP (βP , CβP ) ΠN P (α, Cα, γ, Cγ, 0, β, βP , Cβ, CβP , μ+, μ−, cμ, rμ). For any x, x′ ∈ 2)(ηQ(x′) − without loss of generality. If (ηQ(x) d(x′) ∈ H − x′ 1 ∈ d(x) − Rd, we 1 0, 2) ≥ to show (Q, P ) x assume that we have k k ≥ k ηP (x) − k ηP (x′) | − − k x′ x′ − d(x′) − d(x′) βP k βP | k| || − || | ≤ k| − C C x x ≤ d(x) βP k − d(x) βP , − k 1 2)(ηQ(x′) x′ |k x − C k C. If (ηQ(x) ≤ ηQ(λx + (1 λ)x′) = − 1 2 . βP so ηP exists λ ∈ H ∈ (βP , CβP ) if CβP ≥ (0, 1) such that 1 2) < 0, since ηP is continuous, there − We have ηP (x) | − ηP (x′) | ≤ ≤ 2C 2C 2C x x x k k k − − − d(x) k (λx + (1 βP , x′ k ≤ λ)x′) βP k − so ηP Q ∈ (βP , CβP ) if CβP ≥ ∈ H Q , there exists some P such that (Q, P ) ΠN P ΠN P provided that ∈ 2C. Combining all cases above, we conclude that for any CβP ≥ max { Cγ2− γ, 2CγC βP β β 2γ − βP /β . } 67 Proof of the second statement. Let Ω = [0, 1]d. Since βP > γβ 0, ηP is continuous. Define ≥ 1 2 ηQ = + Cβ(x1 − Ω, it holds that ηQ(x) = 1 1 2 )β. When x1 = 1 claim ηP = 1 which (ηP 2 for any x 2 on x 1 2)(ηQ . We Ω1. Otherwise, it is trivial to see that there will be a small ball in Ω on 1 2 ) < 0, which contradicts the fact that ε(z; γ, Cγ) 2. Define Ω1 = Ω : x1 = 1 2} 0. ∈ ∈ x { − ∈ − ≡ , 0). We see that for any Define the unit vector on the first coordinate as e1 := (1, 0, 0, [0, 1], * * * t ∈ ηQ(e1) = , ηQ(te1) = 1 2 1 2 + Cβ(t − 1 2 )β, ηP (e1) = However, since ηP ∈ H , ηP (te1) 1 2 (βP , CβP ), we have − 1 2| ≥ | ηQ(te1) Cγ| γ 1 2| − CγC γ β | t − ≥ 1 2| γβ. (78) ηP (te1) | 1 2 | = | − ηP (te1) ηP (e1) − | ≤ CβP tβP , which contradicts with (78) by choosing t > 0 to be small enough. E.2. Proof of Proposition 3 Proof. The proof is similar to the proof of Theorem 3.2 in Cai and Wei (2021), which shows that inf ˆf sup (Q,P ) ΠNP 0 ∈ Ω=ΩP ,βP =0,CβP =1 EQ( ˆf ) & n− E P β(1+α) 2γβ+d β(1+α) 2β+d n− Q ∧ . (79) without imposing any smoothness condition on ηP . Our objective is to show that the minimax lower bound (79) could apply to a broader class: EQ( ˆf ) & n− E P β(1+α) 2γβ+d β(1+α) 2β+d n− Q ∧ inf ˆf sup (Q,P ) γβ ΠNP 0 ∈ βP ≥ with some modifications on the original proof. The only extra work is to verify that our m also satisfies the smoothness condition for ηP with parameters construction Pσ, σ (βP , CβP ), i.e., (Q, P ) } (β, βP , Cβ, CβP ), given that βP < γβ. ∈ { 0, 1 Define the quantities ∈ H 1 2γβ+d 1 2β+d ∧ n− Q r = cr(n− P We consider a packing ), w = cwrd, m = cmrαβ ⌊ where the constants cr, cw, cm will be specified later in the proof. xk}k=1, ,m with radius 2r in [0, 1]d. For an example of such construction, we divide [0, 1]d into uniform small cubes with side length as 6r, which forms a d, we suppose that cm is small grid with at least ⌋ d. Therefore, we could assign exactly one sphere with radius enough such that m < ⌋ d small cubes. Since m ⌋ (6r)− ⌊ (6r)− ⌊ d − , ⌋ (6r)− ≪ ⌊ { *** 1 1 1 68 2r in one cube without intersection, which forms a packing of [0, 1]d. Also, define Bc as the compliment of these m balls, i.e. Bc := [0, 1]d/ ( { *** m, we consider the regression functions ηQ ,m with radius 2r in xk}k=1, m k=1 B(xk, 2r)). σ (x) and ηP σ (x) defined as S For any σ follows: 1, 1 − } ∈ { ηQ σ (x) = 1 2 + σkCβrβgβ( k x 1 2 ( xkk − r ) B(xk, 2r) for some k = 1, if x ∈ otherwise, , m, * * * ηP σ (x) = ( 2 + σk(CβP ∨ 1 1 2 CγC γ x β )rγβgγβ( k xkk − r ) B(xk, 2r) for some k = 1, if x ∈ otherwise, , m, * * * where the function g( ) is defined as g(x) = min 1, 2 on x [0, 2]. { The construction of the marginal distributions Qσ,X and Pσ,X is as follows. Let Qσ,X = − ∈ * x } Pσ,X , both of which have the density function μ( ) defined as * w λ[B(xk,r)] mw 1 mλ[B(xk,2r)] − 1 − 0 μ(x) =   ∈ if x B(xk, r) for some k = 1, Bc, ∈ otherwise. if x , m, * * * Given the the construction of (Qσ, Pσ), we next verify that (Qσ, Pσ) belongs to ΠN P for m. The fact that Ω+(γ, Cγ) = Ω is trivial by the construction of the regression 0  1, any σ 1 − σ (x) and ηP functions ηQ ∈ { } σ (x), so we omit its verification. Verify Margin Assumption: We have that Qσ(0 < ηQ σ − | 1 2 | < t) = mQσ(0 < Cβrβgβ( k X − r x1k ) t) ≤ t Cβrβ ) 1 β ) = mQσ(0 < g( k X x1k ) − r ( ≤ = mw1 t { ≥ cmcwrαβ1 Cαtα ≤ ≤ Cβrβ t { ≥ } Cβrβ } given that cm is small enough. Therefore, Qσ ∈ M Verify Smoothness Assumption: It is easy to see that for any a, b (α, Cα). [0, 2] we have ∈ gβ(a) | gβ(b) a β b | − | ≤ | − and gγβ(a) | − gγβ(b) a | | ≤ ( 1 b | (1 γβ a )γβ b | − − | γβ a | − b | ≤ 1, γβ ≤ γβ > 1. − − Thus, for any x, x′ x that x′ k − k ∈ | B(xk, 2r), we obtain from the triangular inequality x xkk−k x′ − k − rβgβ( x k − xkk /r)) − rβgβ( k 69 x′ xkk − /r)) | ≤ k x x′ β k − xkk ≤ (80) and rγβgγβ( rγβgγβ( | k x x′ − − /r)) xkk − * Suppose that cr is small enough such that for any nQ, nP ≥ max { rγβ(4r)1 − βP , (4r)γβ xkk /r)) γβ − βP k − * x k | ≤ ( γβ γβ x′ k rγβ k x x′ k − 1, we have 1, } ≤ γβ 1, ≤ γβ > 1. (81) then we further deduces that x k γβ − x′ k rγβ γβ x k x − k ≤ ≤ k x′ − * On one hand, by the definition of ηQ βP x′ k γβ βP βP (4r)γβ − rγβ(4r)1 − ≤ k x βP x x′ k βP − x′ * k σ and (80), we see that − k x x′ k − ≤ k βP . (82) | One the other hand, by the definition of ηP | ≤ − ηQ σ (x) ηQ σ (x′) x x′ β, Cβk ∀ σ , (81) and (82), we see that x, x [0, 1]d. − ∈ k | Hence, (Q, P ) ηP σ (x) ∈ H ηP σ (x′) CβP k − (β, βP , Cβ, CβP ). | ≤ γβ x x′ k − CβP k x − x′ k ≤ βP , x, x ∀ ∈ [0, 1]d. Verify Strong Density Condition: If x B(xk, r) for some k = 1, , m, we have * * * ∈ μ(x) = w λ[B(xk, r)] = cw/πd. If x Bc, we have ∈ μ(x) = rd ⌋ rd d − ⌋ [πdμ−, πdμ+] to satisfy the condition (Qσ, Pσ) Putting all verification steps above together, we conclude that (Qσ, Pσ) 1, Therefore, we could set cw ∈ the proof of this part by applying Assouad's lemma to (Qσ, Pσ), cw⌊ − 2dπd⌊ − cmrαβ − cmrαβ nQ→∞ −→ 1 1 1. σ d If σ, σ′ 1, 1 − } ∈ { m differ only at one coordinate, i.e. σk = σ′k, − σl = σ′l ( l ∀ = k), we have the Hellinger distance bound as (μ+, μ−, cμ, rμ). ΠN P . We finish 0 m. ∈ S ∈ 1 − } ∀ ∈ { H 2(Qσ, Qσ′) = 1 2 ηQ σ (X) − ηQ σ′(X) q (cid:19) + 1 (cid:18)q − Z (cid:18)q ηQ σ (X) 2 2 ηQ σ′(X) dQX (cid:19) 1 q − 2 − w λ[B(xk, r)] r 2C 2 βr2β) 1 − ZB(xk,r) 1 w(1 2 C 2 − βwr2β, q = = ≤ 1 2 + Cβrβ 1 2 − − r 70 Cβrβ ! dx 6 H 2(Pσ, Pσ′) = = = ≤ 1 2 ηP σ (X) Z (cid:18) p w ηP σ′(X) − q 2 + (cid:19) (cid:18) ηP σ (X) 1 − − 1 2 + (CβP ∨ p CγC γ β )rγβ − r 2 ηP σ′(X) dPX (cid:19) − (CβP ∨ CγC γ β )rγβ ! 1 q 1 2 − 2 dx ZB(xk,r) 1 w(1 2 (C 2 βP ∨ − λ[B(xk, r)] r 2(C 2 1 βP ∨ − q γC 2γ β )r2γβ. C 2 C 2 γ C 2γ β )r2γβ) Recall that r = cr(n− P 1 2γβ+d 1 2β+d n− Q ∧ ). By the property of Hellinger distance, we have H 2(Pσ DQ × Pσ DP , Pσ′ DQ × Pσ′ DP ) nQH 2(Qσ, Qσ′) + nP H 2(Pσ, Pσ′) βwnQr2β + (C 2 C 2 cw + (C 2 βc2β+d C 2 r √2 4 γC 2γ C 2 γC 2γ C 2 βP ∨ βP ∨ β )nP r2γβ β )c2γβ+d cw r ≤ ≤ ≤ ≤ provided that cr is small enough. This further indicates that T V (Pσ DQ × Pσ DP , Pσ′ DQ × Pσ′ DP ) ≤ √2H 2(Pσ DQ × For any empirical classifier ˆf , we have Pσ DP , Pσ′ DQ × Pσ′ DP ) ≤ 1 2 . (83) EQσ( ˆf ) + ′ ( ˆf ) = 2EQσ[ | EQσ ηQσ(X) − ˆf (X) = f ∗Qσ(X) ] } { + 2EQσ ′ [ | ηQσ ′ (X) − = f ∗Qσ ′ (X) ] } 1 1 2 | 1 2 | 1 ˆf (X) { Cβrβ(1 w λ[B(xk, r)] 2 ≥ ZB(xk,r) = 2Cβwrβ. ˆf (X) = f ∗Qσ(X) ˆf (X) + 1 { } = f ∗Qσ ′ (X) )dx } { Combining this lower bound with (83), the Assouad's lemma shows that sup (Q,P ) Ω=ΩP ,γβ ∈ ΠNP 0 βP ≥ EQ( ˆf ) E ≥ σ sup (Qσ,Pσ) 1, 1 ∈{ − } m EQσ ( ˆf ) E ≥ 1 2 Cβmwrβ & rβ(1+α) & n− P β(1+α) 2γβ+d β(1+α) 2β+d . n− Q ∧ E.3. Proof of Proposition 4 Proof. Our objective is to show that the minimax lower bound satisfies inf ˆf sup (Q,P ) ΠNP 0 ∈ γβ<βP EQ( ˆf ) & n− E P βP (1+α)/γ 2βP +d βP (1+α)/γ 2βP /γ+d . n− Q ∧ 71 6 6 6 6 Define the quantities rQ = cr(n− P βP /γβ 2βP +d n− Q ∧ 1 2β+dγβ/βP ), rP = rγβ/βP Q = cγβ/βP r (n− P 1 2βP +d 1 2βP /γ+d ), n− Q ∧ w = cwrd Q, m0 = cm0 ⌊ rd P rd Q ⌋ , m = cmrαβP /γ P ⌊ d − , ⌋ where the constants cr, cw, cm0, cm will be specified later in the proof. βP , we consider a packing Similar to the proof of the case of γβ 2rP in [0, 1]d. Define Bc as the compliment of these m balls, i.e., ≥ xk}k=1, { *** ,m with radius Bc := [0, 1]d/ B(xk, 2rP ) m . ! Next, we further consider a packing [k=1 , m with radius 2rQ. xk,l}l=1, By scaling the radius of the balls, the feasibility of our considered packing reduces to finding ,m0 of B(0, 1) with radius rQ/rP . We denote rQ/rP by R, and m0 then a packing becomes ,m0 for any k = 1, * * * { *** We provide an example of the reduced form of packing as follows. Consider the inscribed . We divide this inscribed cube into cube of B(0, 1) with diagonal length 2 and side length 2 √d uniform small cubes with side length as 6R, which forms a grid with at least xl}l=1, { *** cm0R− . ⌋ ⌊ d 1 (6R)− 2 √d small cubes for some constant c > 0. Therefore, provided that cm0 ≤ is small enough, we could assign exactly one sphere with radius 2R in one cube without intersection, which forms a packing ,m0 for any k = 1, ,m0 with radius 2R. Hence, we can find a packing 2 √d c ≥ ⌊ (6R)− 2c 6d√d d ⌋ ⌋ ⌊ *** d m, we consider the regression functions ηQ σ (x) defined as xk,l}l=1, { σ (x) and ηP xl}l=1, { , m with radius 2rQ. 1, *** ∈ { 1 − } * * * For any σ follows: ηQ σ (x) = 1 2 1 2 ( (cid:16) 1 + σk(Cβ ∧ ( CβP Cγ ) 1 γ )rβ x Qgβ( k xk,lk − rQ ) (cid:17) if x B(xk,l, 2rQ) for some k, l, ∈ otherwise, ηP σ (x) = 1 2 1 2 where the function g( ( 1 + σkCβP rβP x P gβP ( k xkk − rP ) (cid:16) (cid:17) if x B(xk, 2rP ) for some k, ∈ otherwise, { The construction of the marginal distributions Qσ,X and Pσ,X is as follows. Let Qσ,X = − ∈ * ) is defined as g(x) = min 1, 2 on x [0, 2]. x } Pσ,X , both of which have the density function μ( ) defined as * w λ[B(xk,rQ)] μ(x) =   1 − 0 1 mm0w mλ[B(xk,2rP )] − ∈ if x B(xk,l, r) for some k, l, Bc, ∈ otherwise. if x Given the the construction of (Qσ, Pσ), we next verify that (Qσ, Pσ) belongs to ΠN P for 0  any σ 1, 1 − } m. ∈ { 72 (84) (85) Verify Margin Assumption: We have that Qσ(0 < ηQ σ − | 1 2 | < t) = mm0Qσ(0 < (Cβ ∧ X = mm0Qσ(0 < g( k ( CβP Cγ x1k − rQ 1 γ )rβ Qgβ( k X ) ) ( ≤ (Cβ ∧ ( x1,1k − rQ 2t CβP Cγ ) 1 γ )rβ Q 2t) ) ≤ 1 β ) ) 1 2 (Cβ ∧ ( CβP Cγ ) 1 γ )rβ Q} CβP Cγ 1 2 (Cβ ∧ ( ) 1 γ )rβ Q} (Cβ ∧ ( CβP Cγ ) 1 γ )rβ Q} = mm0w1 t ≥ { cmcm0cwrαβP /γ P ≤ 1 t { = cmcm0cwrαβ Q 1 t { ≥ Cαtα ≤ ≥ 1 2 given that cm is small enough. Therefore, Qσ ∈ M Verify Smoothness Assumption: It is easy to see that for any a, b (α, Cα). gβ(a) gβ(b) a β, b | − | ≤ | − gβP (a) | − gβP (b) a − | ≤ | B(xk,l, 2rQ), we obtain from the triangular inequality x k xkk − k x′ − − [0, 2] we have βP . ∈ b | | Thus, for any x, x′ x xkk ≤ k − x′ k ∈ that rβ Qgβ( By the definition of ηQ | k x − xkk ≤ k In addition, for any x, x′ x′ that x′ − k rβP P gβP ( By the definition of ηP | ∈ x k − xk,lk /rQ)) − rβ Qgβ( x′ k xk,lk − /rQ)) | ≤ k x β. x′ k − (86) σ and (86), we see that ηQ Cβk σ (x′) ηQ σ (x) | ≤ | x − B(xk, 2rP ), we obtain from the triangular inequality − ∈ ∀ k x′ β, x, x [0, 1]d. x k xkk − − (87) x k xkk − /rP )) − rβP P gβP ( x′ k xkk − /rP )) | ≤ k x x′ k − βP . σ and (87), we see that ηP CβP k σ (x) ηP σ (x′) | ≤ − | x x′ k − βP , x, x ∀ ∈ [0, 1]d. Hence, (Q, P ) (β, βP , Cβ, CβP ). ∈ H Verify Strong Density Condition: 1, , m0, we have * * * μ(x) = If x ∈ B(xk,l, r) for some k = 1, , m and l = * * * w λ[B(xk,l, r)] = cw/πd. If x ∈ Bc, we have 1 μ(x) = 1 = d − cw⌊ − 1 − cw⌊ 1 − − rd cmrαβP /γ P P rd Q ⌋⌊ cmrαβP /γ P d cm0 2dπd⌊ cm0rdγβ/βP − cmrαβ 2dπd⌊ P rd Q ⌋ rd − P ⌋ cmrαβ Q ⌋⌊ dγβ/βP − Q d dγβ/βP − rdγβ/βP Q ⌋ 73 rd Q ⌋ nQ→∞ −→ 1. [πdμ−, πdμ+] to satisfy the condition (Qσ, Pσ) Therefore, we could set cw ∈ Verify Signal Transfer Set: We show that Ω+(γ, Cγ) = Ω for our construction of (Qσ, Pσ). By the construction of the marginal distribution pair (Qσ σ and ηP σ in (84) and (85), for any x X) and the definition of ηQ m k=1 B(xk,l, rQ)), (μ+, μ−, cμ, rμ). X, P σ ∈ S ( Ω = Bc ∪ ∈ • If x ∈ B(xk,l, r) for some k = 1, ηQ σ (x) 1 2 − = σk(Cβ ∧ ( , m and l = 1, S , m0, we have * * * 1 γ )rβ Q, ) ηP σ (x) 1 2 − = σkCβP rβP P = σkCβP rγβ Q . * * * CβP Cγ Therefore, sgn ηQ(x) (cid:18) 1 2 × − (cid:19) σ (x) = 1 • If x ∈ Bc, we have ηQ σ (x) = ηP 2 . Therefore, (ηP (x) 1 2 ) − ηQ(x) Cγ| ≥ 1 2| γ. − sgn ηQ(x) (cid:18) 1 2 − × (cid:19) (ηP (x) 1 2 ) − ηQ(x) Cγ| ≥ 1 2| γ. − Putting all verification steps above together, we conclude that (Qσ, Pσ) 1, the proof of this part by applying Assouad's lemma to (Qσ, Pσ), σ . We finish ΠN P 0 m. } ∈ 1 − ∀ ∈ { If σ, σ′ 1, 1 − } ∈ { m differ only at one coordinate, i.e. σk = σ′k, − σl = σ′l ( l ∀ = k), we have the Hellinger distance bound as H 2(Qσ, Qσ′) = 1 2 Z (cid:18)q m0 ηQ σ (X) − 2 ηQ σ′(X) (cid:19) q w + 1 (cid:18)q 1 2 + (Cβ ∧ ηQ σ (X) − − 1 q − 2 ηQ σ′(X) dQX (cid:19) ( CβP Cγ ) 1 γ )rβ Q − s 1 2 − (Cβ ∧ ( CβP Cγ 1 γ )rβ Q ) 2 dx ! = = Xl=1 ZB(xk,l,rQ) 1 m0w(1 2 1 − s CβP Cγ ) 2 (C 2 β ∧ ( ≤ γ )m0wr2β Q , λ[B(xk,l, rQ)] s 2(C 2 β ∧ − ( CβP Cγ 2 γ )r2β Q ) ) H 2(Pσ, Pσ′) = 1 2 Z (cid:18) p m0 ηP σ (X) − ηP σ′(X) 2 + 1 (cid:19) q w λ[B(xk,l, rQ)] r − (cid:18) p 1 + CβP rβP 2 ηP σ (X) 1 − − q 1 2 − CβP rβP P ! P − r (cid:19) 2 dx 2 ηP σ′(X) dPX = = ≤ Xl=1 ZB(xk,l,rQ) 1 m0w(1 2 m0wC 2 1 − q βP r2βP P . 2C 2 βP r2βP P ) − 74 6 By the property of Hellinger distance, we have H 2(Pσ DQ × Pσ DP , Pσ′ DQ × Pσ′ DP ) nQH 2(Qσ, Qσ′) + nP H 2(Pσ, Pσ′) (C 2 β ∧ ( CβP Cγ ) 2 γ )m0wnQr2β Q + m0wC 2 βP nP r2βP P cwcm0(C 2 ( CβP Cγ ) 2 γ )c2β r + cwcm0C 2 βP c2γβ r β ∧ ≤ ≤ ≤ provided that cr is small enough. This further indicates that √2 4 ≤ T V (Pσ DQ × Pσ DP , Pσ′ DQ × Pσ′ DP ) ≤ √2H 2(Pσ DQ × Pσ DP , Pσ′ DQ × For any empirical classifier ˆf , we have EQσ( ˆf ) + ′ ( ˆf ) = 2EQσ [ | EQσ ηQσ(X) − 1 2 | 1 2 | 1 ˆf (X) = f ∗Qσ(X) ] } { 1 ˆf (X) − { w λ[B(xk,l, rQ)] = f ∗Qσ ′ (X) } CβP Cγ (Cβ ∧ ( + 2EQσ m0 ηQσ ′ (X) ′ [ | 2 ≥ Xl=1 ZB(xk,l,rQ) ) ( 1 CβP Cγ = 2(Cβ ∧ γ )m0wrβ Q. Pσ′ DP ) ≤ 1 2 . (88) ] ) 1 γ )m0wrβ Qdx Combining this lower bound with (88), the Assouad's lemma shows that sup ΠNP (Q,P ) 0 ∈ Ω=ΩP ,γβ<βP EQ( ˆf ) E ≥ σ sup (Qσ,Pσ) 1, 1 ∈{ − } m EQσ ( ˆf ) E ≥ 1 2 (Cβ ∧ ( CβP Cγ 1 γ )mm0wrβ Q ) & rβ(1+α) Q & n− P βP (1+α)/γ 2βP +d βP (1+α)/γ 2βP /γ+d . n− Q ∧ E.4. Proof of Lemma D.2 and D.3 Proof of Lemma D.2. For any i = 1, [ − any t 1, 1]. Define Vij := Xijεi, where Xij is the j R, we compute the cumulant function * * * − ∈ , nQ, define the residual as εi := ψ′(βT Yi ∈ th covariate of the i-th observation Xi. For QXi) − log E DQ[exp(tVij) | Xi] = log E DQ[exp(t)XijYi] exp( − QXi) − QXi) ψ(βT = ψ(tXij + βT (cid:0) − tXijψ′(βT ψ′(βT QXi)) QXi)tXij. (cid:1) Hence, by the second-order Taylor series expansion, we have log E DQ[exp(tVij) Xi] = | t2 2 X 2 ijψ′′(βT QXi + ξitXij) 75 t2 8 ( 1 nQ ≤ nQ i=1 X X 2 ij). (89) 6 6 ij is sub-exponential since Xij ∼ for some ξi ∈ tail bound for the independent sum of sub-exponential random variables reads ij] = 1 and X 2 DQ[X 2 [0, 1]. Since E N(0, 1), the P DQ( 1 nQ nQ i=1 X X 2 ij ≥ 2) ≤ 2 exp( nQ/4). − We denote the event E := maxj=1, 1 nQ ,d *** { nQ i=1 X 2 ij ≤ 2 } . The union bounds give P DQ(Ec) ≤ d j=1 X P DQ( By (89), we have that on the event E, 1 nQ P nQ X 2 ij ≥ 2) ≤ 2d exp( nQ/4). − (90) i=1 X log E DQ[exp(tVij) Xi] | ≤ t2 4 , and we obtain by the Chernoff bound that P DQ( | 1 nQ nQ i=1 X Vij| ≥ t | E) ≤ 2 exp( 4nQt2), − and the union bound is as follows: P DQ( max j=1, ,d | *** 1 nQ nQ i=1 X Vij| ≥ t | E) ≤ 2d exp( 4nQt2). − We set t = √K+1 2 log d nQ , then (91) becomes q P DQ( max j=1, ,d | *** 1 nQ nQ i=1 X Vij| ≥ √K + 1 2 s log d nQ | E) ≤ 2d− K. Putting (90) and (92) together, we have (91) (92) DQ( max j=1, ,d | *** 1 nQ nQ i=1 X Vij| ≥ √K + 1 2 s log d nQ ) ≤ 2d− K + 2d exp( nQ/4). − (93) P Denote nQ EQ := max *** j=1, ,d | 1 nQ Vij| ≤ √K + 1 2 s log d nQ , then we have P K + 2d exp( DQ(Ec Q) Define the empirical loss function as 2d− ≤ − i=1 X nQ/4). lQ(β) := 1 nQ nQ i=1 n X log(1 + eX T i β) − YiX T i β . o 76 From straightforward calculation,we have lQ(β) = ∇ 1 nQ nQ i=1 X (ψ′(βT Xi) Yi)Xi ⇒ ∇ − lQ(βQ) = 1 nQ nQ i=1 X Vi, 2lQ(β) = ∇ 1 nQ nQ ψ′′(βT Xi)XiX T i . i=1 X Yi)Xi. We see that lQ(β) is convex since 2lQ(β) is positive definite. ∇ where Vi = (ψ′(βT QXi) In addition, we have − k∇ lQ(βQ) k∞ = max j=1, *** ,d | 1 nQ nQ i=1 X . Vij| Define the error of the first-order Taylor series expansion of lQ at βQ as δlQ(v) = lQ(βQ + v) lQ(βQ) ( ∇ − − lQ(βQ))T v Rd. for any v ∈ Define the support of βQ as S with the cardinality S | ≤ { Sc. Since we choose λQ ≥ , on the event EQ we have λQ ≥ 2 Proposition 5.3 of Fan et al. (2020) then implies that on the event EQ, we have s. Denote √K + 1 log d nQ 1, | /S by , d } lQ(βQ) . k∞ * * * k∇ ( ˆβQ − k βQ)Sc βQ)Sk1 ⇒ k k1 ≤ Suppose that nQ is large enough such that nQ ≥ k 3 ˆβQ − 64κ2 2s log d, which is feasible as we assumed s log d. From Proposition 2 of the full version of Negahban et al. (2009), there exists vSk1, nQ ≫ constants κ1, κ2, c1, c2 > 0 such that for any v we have Rd satisfying that k1 ≤ k2 ≤ vSc 1, ∈ k k k 3 v βQk ≤ 4 ( ˆβQ − k βQ)Sk1. q ( ˆβQ − δlQ(v) v κ1k k 2 2 − ≥ κ1κ2 s v k1k v k2 k1) vSk1) v log d nQ k 1 8√s k 1 2√s k 1 2 k 1 2 k v κ1k k2( k v k2 − ≥ v κ1k k2( k v k2 − ≥ ≥ ≥ = v v v v k k2 − k2( k2( v vSk2) v k2) κ1k κ1k κ1 2 k c2nQ) w.r.t. the distribution of k2 − k k 2 2 (94) K 2d− − (95) with probability at least 1 of the full version of Negahban et al. (2009) to get a clearer view of this statement. Putting (93) and (94) together, we obtain that with probability at least 1 c2nQ) w.r.t. the distribution of c1 exp( 2d exp( c1 exp( nQ/4) − − − DQ. See Appendix D.2 − − − δlQ(v) κ1 2 k v 2 2 ∀k k ≥ 1, v k v k2 ≤ 77 DQ, we have vSk1, k 3 k1 ≤ and λQ ≥ 2 k∇ lQ(βQ) . k∞ (96) Applying Theorem 1 of the full version of Negahban et al. (2009) with (95) and (96), we have 2d exp( that with probability at least 1 2d− c1 exp( c2nQ), nQ/4) K − − − − − ˆβQ − k βQk ≤ 4√s κ1 λQ = 4cQ κ1 s s log d nQ . (97) since (βQ)Sc k k1 = 0. Denote the event DQ(Ec 0) 2d− P ≤ ˆβQ − {k K + 2d exp( βQk 2 4√s κ1 λQ} ≤ by E0, we have nQ/4) + c1 exp( − c2nQ). − By the theorem setting, we have 2d− nQ/4) + c1 exp( d, we could set nQ to be large enough such that c2nQ) is asymptotically less than s log d − nQ ∧ K . s log d nQ ∧ s log d nP , so it remains to show that the term s log d nP . Given the condition 2d exp( − log nQ ≫ 2d exp( nQ/4) = exp( − nQ/4 + log d) − exp( ≤ nQ/8). − Hence, it suffices to show that for any c > 0, we have exp( cnQ) − s log d nQ ∧ s log d nP ≪ . Note that nQ ≫ log nP s log d ⇒ exp(cnQ − nP s log d ) 1 ≫ ⇒ exp( cnQ) − ≪ s log d nP . Since it is trivial that exp( the proof. cnQ) − ≪ s log d nQ , we have exp( cnQ) − s log d nQ ∧ s log d nP ≪ , which finishes Proof of Lemma D.3. For any i = 1, , nP , define the residual as * * * := ψ′(βT εP i P X P i ) Y P i ∈ − 1, 1]. [ − Define V P ij the completely identical procedures as given in Lemma D.2, we have that th covariate of the i-th observation X P i , where X P ij is the j := X P ij εP − i . Following DP ( max j=1, ,d | *** 1 nP nP i=1 X V P ij | ≥ √K + 1 2 log d nP ) ≤ r 2d− K + 2d exp( nP /4). − (98) P Denote 1 nQ j=1, EP := max *** K + 2d exp( 2d− ,d | − nP Vij| ≤ √K + 1 2 log d nP , r i=1 X nP /4). Similarly, define the empirical loss function then we have P as DP (Ec P ) ≤ Similarly, we have lP (β) := 1 nP nP log(1 + e(X P i )T β) i=1 n X − i (X P Y P i )T β . o k∇ lP (βQ) k∞ = max j=1, *** ,d | 78 1 nP nP i=1 X V P ij | , and Define 2lP (β) = ∇ 1 nP nP i=1 X ψ′′(βT X P i )X P i (X P i )T . βP k βQk which could be seen as the "rotated" βP in order to have the sparsity pattern with the same norm. Due to the angle constraint with the parameter ∆ between βQ and βP , we have h = k k βQ, βP − k h k ≤ ∆ k βP k ≤ U∆. We expand the first-order Taylor series at h, which is different from the classical analysis in Lemma D.2. Define the error of the first-order Taylor series expansion of lP at h as δlP (v) = lP (h + v) lP (h) ( ∇ − − lP (h))T v for any v ∈ event EP we have λP ≥ 2 Let F (v) = lP (h + v) could be observed that on the event Rd. Define the support of βQ as S. Since we choose λP ≥ k1) and ˆv = ˆβP − h h + v lP (βP ) . k∞ l(v) + λP ( k1 − k k∇ − k √K + 1 log d nP , on the q h. Then F (ˆv) 0. It ≤ EP ∩ {k 1 nP nP i=1 X X P i (X P i )T k2 ≤ 2 , } we have lP (h + v) l(v) − ≥ −|∇ lP (h)T v | lP (βP )T v lP (βP ) ≥ −|∇ ≥ −k∇ λP 2 k λP 2 k ≥ − ≥ − v v ( | − | v ∇ k1 − k∇ lP (βP ) lP (h))T v | lP (h) − ∇ lP (βP ) − ∇ 2lP k2} * k h βP − k2 * k i )T i (X P X P k∞k max k1 − 1 4 k k1 − {k∇ nP 1 nP v k2 k2k v k2 k2 * k βP − h k2 * k v k2 λP 2 k v ≥ − U∆ k1 − 2 k i=1 X k2. v (99) The first inequality is due to convexity of lp. The third inequality is because that k1, uT v for any vector pair u, v. The fourth inequality is due to the first-order Taylor expansion for the derivative and the matrix norm inequality uT v k2k k∞k ≤ k ≤ k k2 u u v v for any matrix A and vector u. Au k2 ≤ k A k2k u k2 k 79 On the other hand, as hS = h by definition of h, we have h + v k k1 − k h k1 − k k1 vSk1 − k h k1 h vSk1 − k k1 h + vS + vSc h + vSc k1 − k vSc h k1 + k1 − k k vSk1. vSc k1 − k h k1 = k ≥ k = k = k 0, we have Combining (99), (100), and F (ˆv) ≤ (100) U∆ k ˆv k2 ≥ λP ( ˆvSc k k1 − 3 k ˆvSk1) = ⇒ k ˆv k1 ≤ 4 ˆvSk1 + k U∆ λP k k2. ˆv (101) We apply Proposition 2 of the full version of Negahban et al. (2009) again. Suppose that nP s log d. From is large enough such that nP ≥ Proposition 2 of the full version of Negahban et al. (2009), there exists constants κ1, κ2, c1, c2 > 0 such that 2s log d, which is feasible as we assumed nP ≫ 64κ2 δlP (ˆv) κ1k ˆv k 2 2 − ≥ κ1κ2 r log d nP k ˆv k1k ˆv k2 κ1k ˆv k2( k ˆv k2 − κ2 ≥ ˆv k1) 4κ2 r r log d nP k log d nP k ˆvSk1 − 1 ˆvSk2 − 4 k 1 ˆv k2 − 4 k 1 2√sk 1 2 k 1 2 k κ2 ˆvSk1 − κ2U∆ √K + 1k ˆv k2) ˆv k2) ≥ ≥ ≥ ≥ = κ1k κ1k ˆv k2( ˆv k2( ˆv k2 − k ˆv k2 − k ˆv k2 − ˆv k2 − k k κ1k κ1k κ1 4 k ˆv k2( ˆv k2( ˆv k 2 2 U∆ λP k ˆv k2) (102) log d nP r ˆv k2) ∆ √K+1 4κ2U . with probability at least 1 is due to nP ≥ that ∆ is smaller than a constant, and in (102) we specifically assume that κ2U ∆ DQ. The fourth inequality . Recall that in the lemma we assumed 1 4, i.e., c2nQ) w.r.t. the distribution of log d nP − 2s log d, and λP ≥ √K + 1 c1 exp( 64κ2 q − √K+1 ≤ ≤ From the proof of Theorem 1 of Bickel and Levina (2008), by applying Lemma A.3 of Bickel and Levina (2008) and the union bound, we have P DP ( k 1 nP nP i=1 X X P i (X P i )T Idk ≥ − t) ≤ 3d exp(c3nt2) for some constant c3 > 0 and any t > 0. Hence, P DP ( k 1 nP nP i=1 X X P i (X P i )T 2) k P DP ( k ≤ 1 nP nP i=1 X 80 X P i (X P i )T Idk ≥ − 1) ≤ 3d exp(c3n). (103) Putting (98), (102), and (103) together, we obtain that with probability at least 1 − DP , we have 3d exp(c3n) w.r.t. the distribution of c1 exp( nP /4) c2nP ) − − − − 2d exp( and δlP (ˆv) ≥ κ1 4 k 2 2 ˆv k K 2d− − (104) (105) λP ≥ 2 k∇ lP (βQ) . k∞ With a similar analysis as the one in Lemma D.2 based on the theorem setting, we have 2d− . Therefore, it c2nP ) + 3d exp(c3n) K + 2d exp( CP ≤ s log d nQ ∧ s log d nP nP /4) + c1 exp( ˆβP − k Applying (99) and (100) again, we have remains to show that − − βP k2 . √sλP + ∆ when (104) and (105) hold. (cid:16) (cid:17) h k1) k1 − k h + ˆv v k k2 + λP ( k U∆ vSc − 2 k vSk1) vSc k1 − k k2 + λP ( k v k1 − k vSk1) F (ˆv) 0 ≥ lP (h)T ˆv + = ≥ ≥ ∇ κ1 4 k κ1 4 k κ1 4 k κ1 4 k κ1 4 k ≥ ≥ ≥ ˆv k ˆv k ˆv k 2 2 − 2 2 − 2 2 − ˆv k 2 2 − ˆv k 2 2 − κ1 4 k ˆv k 2 2 + λP ( U∆ k1 − 2 k λP 2 k λP 2 3λP ( v k vSc k1 + vSk1 − vSk1) k U∆ v 2 k k2 2 k 3√sλP 2 k 3√sλP 2 (cid:18) vSk2 − U∆ + 2 U∆ 2 k v k2 v k k2 (cid:19) given (104) and (105), which implies ˆv k2 ≤ k 4 κ1 ( 3√sλP 2 + U∆ 2 ) . √sλP + ∆. The proof is finished by observing that ˆβP − βP k2 ≤ k ˆv k2 + k k h βP k2 ≤ k k2 + U∆ . √sλP + ∆. ˆv − E.5. Proofs of Auxiliary Results Lemma E.1. If the distribution pair (Q, P ) belongs to ΠN P sponding parameters, then (Q, P ) satisfies Assumption 2 with BA defined in Section 4 with corre- ε(z; γ, Cγ/2) = Cαz1+α 1+α γ CαC − γ 1+α γ 1+α γ ∆ . (cid:19) ∧ 2 (cid:18) (cid:1) Proof. Suppose (Q, P ) of ΠN P BA we have ∈ ΠN P BA . If x (cid:0) ∈ ∆ Ω satisfies ηQ(x) | 1 2| ≥ − ( 2∆ Cγ ) 1 γ , then by the definition Cγ 2 | ≤ ηQ(x) 1 2| γ, − 81 s(x) = ⇒ ηQ(x) Cγ| ≥ ≥ Ω+(γ, Cγ/2) and Ω−(γ, Cγ/2) − − ∆ γ 1 2 | Cγ 2 | ηQ(x) 1 2 | γ. − x ∈ ⊂ { Ω : | ηQ(x) 1 2| − < ( 2∆ Cγ ) 1 γ . } which indicates that x Therefore, ∈ ≤ ≤ 1 2 | ≤ − z) Q(X ∈ Ω−(γ, Cγ/2), 0 < ηQ(X) 1 2 | ≤ ( − | 2∆ Cγ 1 γ ) z) ∧ Q(0 < ηQ(X) | 2∆ Cγ Cα(( α γ ) ∧ zα). Moreover, since we have x sup Ω−(γ,Cγ ), ηQ(x) − | ∈ ηQ(x) 1 2 | ≤ ( 2∆ Cγ 1 γ ) − z, ∧ z | 1 2 |≤ E(X,Y ) ∼ Q | (cid:20) ηQ(X) 1 2 | 1 { − s(X) Cγ| ≤ ηQ(X) γ 1 2 | − ≤ Cγzγ } (cid:21) sup ≤ x ∈ Ω−(γ,Cγ ), ηQ(x) − | ηQ(x) 1 2 |! * − Q(X ∈ z | 1 2 |≤ Ω−(γ, Cγ/2), 0 < ηQ(X) | 1 2 | ≤ − z) Cα ≤ ( (cid:18) 2∆ Cγ α γ ) zα ∧ ( 2∆ Cγ 1 γ ) ∧ z . (cid:19) * (cid:18) (cid:19) Therefore, Assumption 2 holds with ε(z; γ, Cγ/2) = Cα 2∆ Cγ ( (cid:18) Cαz1+α α γ ) ∧ ∧ 2 (cid:18) (cid:1) = (cid:0) zα * ( (cid:19) (cid:18) γ CαC − γ 1+α 2∆ Cγ 1 γ ) 1+α γ z ∧ (cid:19) 1+α γ ∆ . (cid:19) Lemma E.2. Suppose there exists a continuous function p( for any η [0, 1], ∈ ; γ, Cγ) : [0, 1] * → [0, 1] such that Q(sgn η (cid:18) − (cid:19) Then Assumption 2 holds with 1 2 (ηP 1 2 ) − η Cγ| − ≥ γ 1 2 | | ηQ = η) ≤ p(η; γ, Cγ). × ε(z; γ, Cγ) = 1 2 +z z 1 2 − Z η | − 1 2| p(η; γ, Cγ)dF Q η (η) Cαz1+α ≤ × η sup z, 1 [ 1 2 − ∈ 2 +z] p(η; γ, Cγ) where F Q η is defined as the cumulative distribution function of ηQ w.r.t. QX . 82 Proof. The first equality holds by observing the transform using Funibi's Theorem: ZΩ−(γ,Cγ ) | 1 2 +z η | − z 1 2 − Z = ηQ(X) 1 2| 1 { 0 < | − ηQ(X) 1 2 | ≤ − dQX z } 1 2 | QηP (sgn 1 2 η (cid:18) − × (cid:19) (ηP 1 2 ) − η Cγ| − ≥ γ 1 2| | ηQ = η)dF Q η (η), where QηP is the marginal distribution of ηP with respect to Q. The second equality holds by the provided lemma condition. We present a lemma that establishes a high probability uniform bound on the distance between any point and its K-nearest neighbors. This result improves upon Lemma 9.1 in Cai and Wei (2021) by providing a tighter bound that leverages the Hoeffding's inequality, and the rest of our proof is similar. The proof follows a similar approach, so we only provide a more concise presentation here. Lemma E.3 (K-NN Distance Bound). There exists a constant cD > 0 such that with prob- ability at least 1 2kQ) w.r.t. the distribution of X1:nQ, for all x [0, 1]d, exp( cD Ω nQ kQ − − ∈ ⊂ X(kQ)(x) k x k ≤ − cD( kQ nQ 1 d . ) (106) In addition, with probability at least 1 all x [0, 1]d, ΩP ∈ ⊂ cD nP kP exp( − − 2kP ) w.r.t. the distribution of X P 1:nP , for X P (kP )(x) k x k ≤ − cD( kP nP 1 d . ) (107) dλ ≥ cμμ−πdrd, Proof. It suffices to prove (106) since the proof of (107) can be obtained by symmetrically replacing the relevant quantities. Let (Q, P ) ∈ ΠN P and take any x ∈ Ω and r < rμ. Since dQX μ−, we have Q(X ∈ B(x, r)) ≥ μ−λ(B(x, r) Ω) ∩ ≥ (108) where πd = λ(B(0, 1)) is the volume of a d-dimensional unit sphere. If kQ ≥ ( 1 4 ∧ cμμ−πdrd μ 2 ), then cD( kQ nQ 1 d ) satisfy (106) using the trivial bound the case when kQ ≤ 2kQ Set r0 = ( cμμ−πdnQ ( 1 ). 4 ∧ d . From kQ ≤ ) cμμ−πdrd μ 2 1 k 1 cD( 1 4) x ≥ X(kQ)(x) − k ≤ d , and we can set cD to be large enough to 2 . Therefore, we only need to consider d 1 cμμ−πdrd μ 2 nQ we have r0 < rμ. Therefore, (108) tells Q(X ∈ B(x, r0)) 2kQ nQ . ≥ Let S(x) = nQ i=1 1 Xi ∈ { binomial distribution with parameters nQ and 2kQ nQ } P * * * . By Hoeffding's inequality, B(x, r0) . Since X1, , XnQ are independent, S follows a PX1:nQ (S(x) < kQ) = PX1:nQ (S − E DQ[S] < 83 kQ) − ≤ exp( 2k2 Q kQ ) = exp( − 2kQ). − (109) Suppose that M balls with radius r0 centered at x1, , xM satisfy that * * * [0, 1]d M B(xm, r0). m=1 [ Cr− 0 d for some C > 0 large enough. By the union ⊂ ≤ M exp( 2kQ) d Cr− 0 exp( 2kQ). − ≤ M such that xm′ − B(x, r0). Note that (110) ∈ It is feasible to find such M balls with M bound, PX1:nQ ( min m 1 ≤ ≤ M{ S(xm) } < kQ) ≤ For any x Ω, there exists some 1 S(xm′) ≥ ∈ kQ implies that m′ ≤ ≤ X(kQ)(x) k x k ≤ − 2r0. Therefore, we have PX1:nQ ( x ∀ ∈ Ω, k X(kQ)(x) x k ≤ − 2r0) ≥ PX1:nQ ( min m 1 ≤ ≤ M{ S(xm) kQ) 1 − ≥ } ≥ Cr− d 0 exp( 2kQ), − i.e., with probability at least 1 2C cμμ−πd nQ kQ exp( − 2kQ) w.r.t. the distribution of X1:nQ, we have − X(kQ)(x) k x k ≤ − 2( 2 cμμ−πd 1 d ( ) kQ nQ 1 d . ) This completes the proof by setting cD large enough. Lemma E.4. For any empirical classifier ˆf and α, β between c and C for some constant C > c > 0, and ∠(α, β) ∈ Rd such that α and [0, π/2]. Then we have β k k k k are bounded ∈ EQα( ˆf ) + EQβ( ˆf ) ≥ cσ(C)(1 − 20π σ(C)) ∠(α, β)2. Proof. Without loss of generality and due to the symmetry property of of N(0, Id), we could rotate α and β at the same time so that α = ( , 0, 0, α k k * * * , 0), β = ( β k k cos ∠(α, β), β k k sin ∠(α, β), 0, 0, , 0). * * * Therefore, we assume that only the first coordinate of α and the first and second coordinates of β can be non-zero. For any λ satisfying that ∈ [0, 1], we define wλ := λα + (1 λ)β. Define λ0, λ1 ∈ − [0, 1] as the value ∠(α, wλ0) = ∠(wλ1, β) = ∠(α, β)/4. For simplicity, we abbreviate wλ0 as w0 and wλ1 as w1. Define the area D := x { ∈ Rd : (wT 0 x)(wT 1 x) < 0, 1 4 ≤ 1 + x2 x2 2 ≤ 1 . } It is easy to see that D D, we have if x ∈ x ∈ ⊂ { Rd : (αT x)(βT x) < 0, 1 . Moreover, we see that 1 + x2 x2 2 ≤ 1 } )(x1 + x2) 1 2 , 2 ≤ ∠(α, β) 4 αT x | | = α x1 ≥ k k α k k sin( 84 βT x | ≥ k | sin( β k ∠(α, β) 4 )(x1 + x2) 1 2 since the angle between (x1, x2, 0 Therefore, since σ′(t) = σ(t)(1 D. D, we have that if x x * * * − ∈ ∈ , 0) and normal planes of α and β are both in [ ∠(α,β) , and t | | | αT x | ≤ k k ≤ , 3∠(α,β) ]. 4 C on 4 α σ(t)) decreases with growing ηQα(x) | − 1 2 | ≥ | σ(sin( ∠(α, β) 4 α ) k k − 1 2| 1 + x2 (x2 2) 1 2 (x2 1 2 ) 1 + x2 2) ∠(α, β) 4 k ∠(α, β) 4 ) α k ). σ(C)(1 − σ(C)) sin( 1 2 cσ(C)(1 − σ(C)) sin( ≥ ≥ Similarly, ηQβ (x) | 1 2 | ≥ 1 2 − cσ(C)(1 − σ(C)) sin( ∠(α, β) 4 ). Hence, we have EQα( ˆf ) + ηQα(X) EQβ ( ˆf ) = 2EQα[ | + 2EQβ [ ηQβ (X) | 2EQα[ | ηQβ (X) ≥ + 2EQβ [ | ηQα(X) − − − − 1 1 1 1 2| 1 2 | 1 2 | 1 2 | 1 ] ] } } { − − ( ˆf ( ˆf { ( ˆf )(αT x) < 0 1 2 1 )(βT x) < 0 2 1 2 1 )(βT x) < 0, x 2 { − ∠(α, β) 4 )(αT x) < 0, x { ( ˆf − × ) D ] } ∈ D ] } ∈ cσ(C)(1 σ(C)) sin( ≥ EX N (0,Id)[ ∼ − 1 (cid:18) ( ˆf { − 1 2 )(αT x) < 0 + 1 ( ˆf { − } 1 2 )(βT x) < 0 1 x { D ]. } ∈ } (cid:19) The change of the expectation operator in the last inequality is due to the fact that 1 2)(αT x) < 0 2| } of the response value. 2)(βT x) < 0 − do not depend on the distribution ηQβ (X) and ( ˆf ( ˆf 1 2| − − − 1 1 { } { | | 1 1 ηQα(X) If x ∈ D, then (αT x)(βT x) < 0, which implies 1 2 )(αT x) < 0 + 1 ( ˆf 1 − { Therefore, we could further bound } EQα( ˆf ) + )(βT x) < 0 = 1. } EQα( ˆf ) + EQβ ( ˆf ) ≥ ≥ ≥ cσ(C)(1 cσ(C)(1 − − σ(C)) sin( σ(C)) sin( cσ(C)(1 − 20π σ(C)) ∠(α, β)2. )QX (D) )∠(α, β)Q(X 2 1 + X 2 2 ∈ [ 1 4 , 1]) where Ψ( tion. Note that we utilized the numerical results that * ) is the cumulative distribution function of the univariate standard normal distribu- sin( ∠(α, β) 4 1 2π ) ≥ 85 ∠(α, β), ( ˆf 1 2 { − EQβ ( ˆf ) by ∠(α, β) 4 ∠(α, β) 4 and the cumulative distribution function of chi-squared distribution with 2 degrees of freedom Q(X 2 1 + X 2 2 ∈ , 1]) = e− 1 2 [ 1 4 1 8 e− − 1 10 . ≥ 86
http://arxiv.org/abs/2310.04605v1
"2023-10-06T21:48:39"
"2023-10-06T21:48:39"
Learning Optimal Power Flow Value Functions with Input-Convex Neural Networks
The Optimal Power Flow (OPF) problem is integral to the functioning of power systems, aiming to optimize generation dispatch while adhering to technical and operational constraints. These constraints are far from straightforward; they involve intricate, non-convex considerations related to Alternating Current (AC) power flow, which are essential for the safety and practicality of electrical grids. However, solving the OPF problem for varying conditions within stringent time frames poses practical challenges. To address this, operators resort to model simplifications of varying accuracy. Unfortunately, better approximations (tight convex relaxations) are often computationally intractable. This research explores machine learning (ML) to learn convex approximate solutions for faster analysis in the online setting while still allowing for coupling into other convex dependent decision problems. By trading off a small amount of accuracy for substantial gains in speed, they enable the efficient exploration of vast solution spaces in these complex problems.
[ "Andrew Rosemberg", "Mathieu Tanneau", "Bruno Fanzeres", "Joaquim Garcia", "Pascal Van Hentenryck" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04605v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04605v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "math.OC", "49M20" ]
Learning Optimal Power Flow Value Functions with Input-Convex Neural Networks Andrew Rosemberg∗, Mathieu Tanneau∗, Bruno Fanzeres†, Joaquim Garcia‡ and Pascal Van Hentenryck∗ ∗Georgia Institute of Technology, arosemberg3@gatech.edu, {mathieu.tanneau, pascal.vanhentenryck}@isye.gatech.edu † Industrial Engineering Department, Pontifical Catholic University of Rio de Janeiro, bruno.santos@puc-rio.br ‡ Research and Development, PSR - Energy Consulting and Analytics, joaquimgarcia@psr-inc.com 3 2 0 2 t c O 6 ] G L . s c [ 1 v 5 0 6 4 0 . 0 1 3 2 : v i X r a Abstract-The Optimal Power Flow (OPF) problem is inte- gral to the functioning of power systems, aiming to optimize generation dispatch while adhering to technical and operational constraints. These constraints are far from straightforward; they involve intricate, non-convex considerations related to Alternating Current (AC) power flow, which are essential for the safety and practicality of electrical grids. However, solving the OPF problem for varying conditions within stringent time-frames poses practical challenges. To address this, operators often resort to model simplifications of varying accuracy. Unfortunately, better approximations (tight convex relaxations) are often still computationally intractable. This research explores machine learning (ML) to learn convex approximate solutions for faster analysis in the online setting while still allowing for coupling into other convex dependent decision problems. By trading off a small amount of accuracy for substantial gains in speed, they enable the efficient exploration of vast solution spaces in these complex problems. Index Terms-Optimal Power Flow, Renewable Energy, Deep Learning, Convex Relaxations, Learn-to-Optimize. NOMENCLATURE Set of buses Set of branches Set of reverse branches Imaginary unit j2 = −1 Complex conjugate of z Complex power demand; Sd = pd + jqd Bus shunt admittance Complex branch line admittance Complex branch shunt admittance Thermal branch limit Active power generation bounds Reactive power generation bounds Voltage magnitude bounds Branch susceptance Complex power generation; Sg=pg + jqg Complex power flow; Sf = pf + jqf Complex voltage; V = v∠θ N E E R j z⋆ Sd Y s Y Y c ̄s pg, pg qg, qg v, v b Sg Sf V This research is partly funded by NSF award 2112533. I. INTRODUCTION The Optimal Power Flow (OPF) problem optimizes gen- eration dispatch while satisfying physical and engineering constraints. It is therefore fundamental for many aspects of power systems operations: market-clearing, unit commitment, optimal transmission switching, transmission expansion plan- ning, to name a few. Its alternating current (AC) form [1], [2], AC-OPF, is a nonlinear, non-convex problem which makes it challenging to solve in practice, especially when combined with discrete decisions like unit commitment, line switch- ing, and bus splitting. Therefore, operators rely on approxi- mate OPF formulations, typically the DC-OPF approximation which, although more tractable, may lead to sub-optimal or unsafe decisions when far from the traditional operating point, because it does not capture the complexity of AC systems. These computational limitations have spurred interest in optimization proxies for power systems, and OPF problems in particular. Optimization proxies [3]–[5] are machine learning (ML) models that approximate the input-to-output mapping of an optimization solver; once trained, they produce predictions in milliseconds. A large body of work has focused on predict- ing solutions to OPF problems, especially DC-OPF and AC- OPF. In this case, the proxy takes the input data of the OPF as input and outputs a near-feasible, near-optimal solution. This enables real-time risk assessment at massive scales. Another stream of research uses optimization proxies to capture complex interactions, e.g., AC power flow equations, then embeds the trained proxy in a larger optimization prob- lem, e.g., a unit-commitment problem [6], [7]. This strategy replaces the nonlinear component. e.g., the AC power flow equations, with a mixed-integer representation of a trained neural network. Although it removes the nonconvexity stem- ming from the physics, this approach requires the use of discrete variables, introducing another type of non-convexity, which reduces its tractability for large-scale systems. To address this challenge, this paper explores the use of input-convex neural networks (ICNN) [8] as an alternative to non-convex DNN for applications where the neural network must be embedded in a larger optimization. Specifically, the paper focuses on learning a tractable approximation of the value function of an OPF problem using ICNNs. Such ICNNs, if accurate enough, would provide a highly valuable tool for a broad range of applications in power systems: unit commitment, transmission switching but also a wealth of stochastic optimization and reinforcement learning methods that implicitly rely on value functions and their gradients. The main objective of the paper is thus to determine whether ICNNs, despite their more limited expressive power, can match the performance of DNNs for approximating the value of OPF problems. This is a pre-requisite to using ICNNs in larger optimizations and an open issue in the representation power of neural networks. The main contributions of the paper can be summarized as follows. 1) The paper contributes strong theoretical guarantees on the performance of ICNNs. In particular, it provides bounds on the generalization error of ICNNs that only depend on the ICNN performance on the training data. 2) The paper explores specific ICNN architectures and trains it to learn three OPF formulations: the AC-OPF, the SOC relaxation, and the DC-OPF. 3) The paper reports the performance of the resulting ICNNs on large-scale systems, that are 50 times larger than prior research. The results demonstrate that ICCNs are capable of learning the value function of OPF problems, at least as effectively as DNNs on traditional test cases, with optimality gaps almost always lower than 0.5%. The rest of the paper is organized as follows. Section II reviews related works in the literature, Section III describes the OPF formulations considered in the paper. Section IV presents the input-convex architecture used in the paper, and provides strong generalization bounds for this class of models. Section V presents and analyses the results of the proposed comparison, and Section VI concludes the paper. II. RELATED WORK The decomposition of intricate problems through value function approximations has found widespread application both in industry and academic literature. This approach has been instrumental in achieving tractable solutions for vari- ous practical scenarios, including multistage decision-making problems. In multistage problems, such as those encountered in storage management and long-term asset investment, decision-makers often seek optimal policies. They do so by employing a spectrum of function approximations that range from simple parametric forms [9] to more intricate piece-wise models [10], [11]. Some of these advanced models may involve a substantial number of individual function evaluations to reach convergence [12]–[14]. DNNs have emerged as a standout player in approximating solutions, particularly in the domain of Optimal Power Flow (OPF) problems [15]–[17]. Furthermore, He et al. [18] have successfully employed neural networks to approximate the cost function of unit commitment problems, streamlining constraint screening processes and improving solution efficiency. ICNNs have also found applications in energy-related chal- lenges, such as unit commitment [7] and voltage regulation [19]. These networks offer a unique advantage by ensur- ing convexity within specific regions of their input domains 2 through parameter constraints, thereby reducing the complex- ity of identifying convex mappings. A notable contribution by Zhang et al. [20] involves training convex neural networks to predict the objective values of DC-OPF. This innovative approach enables the derivation of dual solutions, aiding in the identification of active sets of constraints. Leveraging the convexity of these ICNNs, this method augments the training process and provides valuable generalization bounds. Similar investigations by Chen et al. [21] extend this approach to systems with up to 118 buses, highlighting its applicability. In another pioneering effort, Wu et al. [7] harness the power of ICNNs to map pre-fault operation conditions to transient stability indices. This enables the formulation of transient stability constraints, with numerical experiments conducted on systems featuring 39 and 118 buses validating the effectiveness of their methodology. Machine Learning (ML) techniques, including ICNN-based approaches, have shown promise in discovering convex ap- proximations and relaxations for optimization problems. In the context of Optimal Power Flow (OPF) applications [22], methodologies utilizing ICNNs have exhibited significant po- tential [23]. These collective advances underscore the growing role of advanced neural network techniques in enhancing optimization methodologies, promising more efficient and effective problem-solving strategies. This paper extends these lines of research in several direc- tions. First, it demonstrates, for the first time, that ICNNs can provide state-of-the-art results in predicting value functions for large-scale OPF problems involving thousands of buses. The OPF problems studied in the paper also go beyond the DC model and include the SCOP relaxation and the AC-OPF. Second, the paper contributes strong generalization bounds for ICNNs that significantly expand existing work. III. OPTIMAL POWER FLOW The Optimal Power Flow (OPF) problem [24] is a fun- damental problem in power systems operations. The OPF problem finds the most economical generation dispatch so as to serve electricity demand while satisfying physical and engineering constraints. The paper considers the AC-OPF formulation, its second-order cone (SOC) relaxation, and its DC-OPF linear approximation, which are presented next. For ease of reading, the presentation omits transformer tap ratios, phase angle difference constraints, and reference voltage (slack bus) constraints. All are implemented and considered in the experiments of Section V A. The AC-OPF Formulation Model 1 presents the AC-OPF formulation, in complex variables. The objective (1a) minimizes total generation costs. Constraints (1b) enforce power balance (Kirchhoff's current law) at each bus. Constraints (1c) and (1d) express Ohm's law on forward and reverse power flows, respectively. Constraints (1e) enforce thermal limits on forward and reverse power flows. Finally, constraints (1f)–(1h) enforce minimum and Model 1 The AC-OPF Model Model 3 The DC-OPF Model min (cid:88) cipg i i∈N i − Sd s.t. Sg i − (Y s i )⋆|Vi|2 = (1a) min (cid:88) i∈N cipg i (cid:88) Sf ij ij∈E∪ER ∀i ∈ N (1b) s.t. pg i + (cid:88) ji∈E pf ji − (cid:88) ij∈E ij = pd pf i pf |pf pg i ij = bij (θj − θi) ij | ≤ ̄sij ≤ pg i ≤ pg i 3 (8a) ∀i ∈ N (8b) ∀ij ∈ E ∀ij ∈ E ∀i ∈ N (8c) (8d) (8e) ij )⋆|Vi|2 − Y ⋆ ji)⋆|Vj |2 − Y ⋆ ij ViV⋆ j ij V⋆ i Vj ij = (Yij + Y c Sf ji = (Yij + Y c Sf |Sf ij |, |Sf ji| ≤ ̄sij vi ≤ |Vi| ≤ vi i ≤ pg pg i i ≤ qg qg i ≤ pg ≤ qg i i Model 2 The SOC-OPF model min (cid:88) cipg i i∈N i − pd s.t. pg i − gs i wi = qg i − qd i + bs i wi = (cid:88) ij∈E∪ER (cid:88) ij∈E∪ER pf ij qf ij ij + γp,i ij + γq,i ij + γp,i ij + γq,i ij wi ij ij wi ij ji wi ij ji wi ij ij wi + γp,r ij wr ij wj + γq,r ij wr jiwi + γp,r ji wr jiwj + γq,r ji wr ij )2 ≤ ̄s2 ij ij )2 ≤ wiwj ij = γp pf ij = γq qf ji = γp pf ji = γq qf ij )2 + (qf (pf ij )2 + (wi (wr i ≤ wi ≤ v2 v2 i ≤ pg i ≤ pg pg i ≤ qg i ≤ qg qg i i i ∀ij ∈ E ∀ij ∈ E ∀ij ∈ E ∀i ∈ N ∀i ∈ N ∀i ∈ N ∀i ∈ N ∀i ∈ N ∀ij ∈ E ∀ij ∈ E ∀ij ∈ E ∀ij ∈ E ∀ij ∈ E ∪ E R ∀ij ∈ E ∀i ∈ N ∀i ∈ N ∀i ∈ N (1c) (1d) (1e) (1f) (1g) (1h) (2a) (2b) (2c) (2d) (2e) (2f) (2g) (2h) (2i) (2j) (2k) (2l) maximum limits on nodal voltage magnitude, active gen- eration, and reactive generation, respectively. The AC-OPF problem is nonlinear and non-convex and is typically solved using interior-point algorithms. B. The SOC-OPF Formulation The Second-Oder Cone (SOC) relaxation of AC-OPF pro- posed by Jabr [25] is obtained from AC-OPF by introducing the additional variables wi = v2 i , wr ij = vivj cos(θj − θi), wi ij = vivj sin(θj − θi), and the non-convex constraint (wr ij)2 + (wi ij)2 = wiwj, ∀i ∈ N ∀ij ∈ E ∀ij ∈ E (3) (4) (5) ∀ij ∈ E. (6) The SOC relaxation is then obtained by relaxing Eq. (6) into (wr ij)2 + (wi ij)2 ≤ wiwj, ∀ij ∈ E. (7) Model 2 presents the SOC-OPF formulation, in real vari- ables. The objective function (2a) is equivalent to (1a). Con- straints (2b) and (2c) enforce, at each node, Kirchhoff's current law for active and reactive power, respectively. Constraints (2d)–(2f) capture Ohm's law on active and reactive, forward and reverse power flows. The γ parameters that appear in terms derived from (1c)–(1d), the constraints are constant after substituting variables w, wr, wi. Constraints (2h) enforce thermal limits on forward and reverse power flows. Constraints (2i) is Jabr's inequality (7). Finally, constraints (2j)–(2l), like constraints (1f)–(1h), enforce minimum and maximum limits on nodal voltage magnitude, active and reactive generation. The SOC-OPF formulation is nonlinear and convex. This makes it more tractable to solve than AC-OPF using, e.g., polynomial-time interior-point algorithms. Furthermore, since it is a relaxation of AC-OPF, solving SOC-OPF provides valid dual bounds on the optimal value of AC-OPF. C. The DC-OPF Formulation The DC-OPF formulation is a linear approximation of AC- OPF. The approximation assumes that all voltage magnitudes are one per-unit, voltage angles are small and losses are negligible, and it ignores reactive power [26], [27]. The DC approximation underlies virtually all electricity markets and is widely used in, e.g., unit commitment and transmission network expansion planning problems. Model 3 presents the resulting linear programming (LP) formulation of DC-OPF. The objective (8a) minimizes to- tal generation costs. Constraints (8b) enforce (active) power balance at each node. Constraints (8c) approximate Ohm's law using a phase-angle formulation. Note that, DC-OPF does not consider reverse power flows, unlike AC-OPF and SOC-OPF; this is because losses are neglected in DC-OPF. Constraints (8d) enforce thermal constraints on each branch. Constraints (8e) enforce minimum and maximum limits on active power generation. Finally, recall that constraints on phase angle differences and slack bus are omitted from the presentation for readability, but are implemented in all the numerical experiments. IV. METHODOLOGY The goal of the paper is to train an ML model that takes the nodal demand vector Sd as input, and outputs the optimal solution of its corresponding OPF problem. This section presents the input-convex neural network (ICNN) architecture and its training, and establishes its generalization guarantees. 4 Fig. 2. Fully Connected ICNN gradient descent algorithms, projected gradient descent re- quires special attention to avoid slow convergence. Preliminary experiments showed that, for larger learning rates, gradient clipping results in a dramatic slow-down, when compared to the training of regular DNNs. This comes from the greater impact on the loss that happens when projecting back onto the feasible region. In fact, appropriate learning rates (e.g., [28]) also depend on the relative distance to the constraint barriers - which can be very small when approaching the local optimum the algorithm is converging to. Unfortunately, dynamically adapting learning rates is not an easy task when post-clipping gradients from a standard gradient descent algorithms. Scheduling parameters had to be tuned in hyper-parameter optimization over the validation set. C. Generalization Guarantees One fundamental benefit of using ICNNs is their stronger generalization guarantees. To the best of the authors' knowl- edge, the strongest theoretical guarantee for ICNNs in the context of OPF proxies is from [20] (Theorem 6.5): they show that the gradient of a perfectly-trained ICNN is bounded over the convex hull of the training set. While their proof uses convexity arguments, the result is not specific to ICNNs. For instance, it also holds for fully-connected DNNs with ReLU activation (DNN-ReLU for short). Indeed, DNN-ReLUs repre- sent continuous, piece-wise linear functions, whose gradient is piece-wise constant. Since DNN-ReLUs have a finite number of pieces, their gradients are immediately bounded. This paper improves on the generalization guarantees of [20]: it provides generalization bounds for general ICNNs (Theorem 1), and explicit formulae for perfectly-trained IC- NNs (Theorem 2). The results are presented for a parametric convex optimization problem Φ(b) that the ICNN f must learn, and its parametric strong dual Ψ(b). For instance, for the case of a parametric linear program, (cid:8)c⊤x (cid:12) (cid:8)b⊤y (cid:12) (cid:12) Ax ≥ b(cid:9) , (cid:12) A⊤y = c, y ≥ 0(cid:9) , Ψ(b) = max Φ(b) = min (10) (11) x y with primal and dual variables x and y respectively. When strong duality holds, Φ(b) = Ψ(b). Φ is convex in b and for a (a) Example DNN (left) and its Output (right). The DNN defines a non-convex function. (b) Example ICNN (left) and its Output (right). All ICNN weights are positive and it defines a convex function. Fig. 1. Illustration of Input-Convex Neural Networks. A. The Input-Convex Neural Network Architecture An ICNN is a special type of DNN that computes a convex function of its input [8]. ICNNs are well-suited when one seeks to represent or approximate convex functions since they are convex by design, unlike general DNNs. ICNNs achieve their convexity by combining convex activation functions with convexity-preserving operations [8]. The simplest ICNN architecture consists of fully-connected layers of the form h(x) = ReLU (W x + d), where x ∈ Rn denotes the layer input vector, d ∈ Rm is the bias vector, and W ∈ Rm×n is a weight matrix with non-negative coefficients, to ensure convexity. The Rectified Linear Unit (ReLU) activa- tion function ReLU(x) = max(0, x) is applied element-wise. Figure 1 illustrates the difference between DNNs and ICNNs on a small example, and showcases ICNNs' convexity. To learn the value function of OPF problems, this paper considers ICNN architectures with skip-connections, which allow the approximation of convex functions with decreasing slopes, and have been shown to improve performance [8], [20]. The overall architecture is illustrated in Figure 2. Its k-th layer is of the form xk = hk(xk−1) = ReLU(W kxk−1 + H kx0 + dk), (9) where xk and xk−1 denote the outputs of layer k and k−1, x0 denotes the input of the ICNN, i.e., x0 = (pd, qd), dk is the bias vector, and W k, H k are weight matrices. Skip-connections feed the ICNN input x0 to each layer. The coefficients of W k are non-negative, whereas H k may take positive or negative values without affecting convexity [8]. B. The Training of ICNNs Because some of their weights must be non-negative, ICNNs cannot directly be trained with traditional gradient descent algorithms. A common choice is to use projected gradient descent, which clips gradients before updating the weights. While it converges under the same assumptions as traditional +0.95+2.62-1.25-2.15-0.39-3.73-0.77+0.48+1.0+1.0+2+1+1.0+1.0+2+2...... given b, any dual optimal solution is a sub-gradient of Φ [29]. In addition, if the dual optimum y∗(b) is unique, then ∇Φ is defined and ∇Φ(b) = y∗(b). are The results expressed in terms of a dataset D = {(bi, yi, zi)}i=1,...,N where each bi, yi, zi are the right- hand side, optimal dual solution, and optimal value of instance i = 1, ..., N , respectively. They are also expressed in terms of B = conv{b1, ..., bN }, the convex hull of the right-hand sides with diameter diam(B). The first result is a generalization bound for arbitrary ICNNs. Theorem 1. Let f be an ICNN, ̃zi = f (bi), and ̃yi = ∇f (bi). There exists a constant M , whose value depends only on D and { ̃yi, ̃zi}, such that ∀b ∈ B, |f (b) − Φ(b)| ≤ M. (12) Proof. Define ˇf , ˆf over B as ˇf (b) = max (cid:8) ̃zi + ̃y⊤ i (b − bi) (cid:12) (cid:12) i = 1, ..., N (cid:9) (cid:40) (cid:88) ˆf (b) = min λ (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) Note that ˇf , ˆf are convex lower and upper envelopes of f . The constant M is obtained by solving λ ≥ 0, e⊤λ = 1 λi ̃zi (cid:41) i M = max b,z |z − Φ(b)| s.t. ˇf (b) ≤ z ≤ ˆf (b), b ∈ B, (13a) (13b) (13c) which concludes the proof by convexity of Φ. Theorem 1 provides a worst-case guarantee on the general- ization performance of the ICNN, which only depends on the value of f on the dataset D. The next theorem 2 provides an explicit worst-case guarantee when the ICNN perfectly fits the training data. Theorem 2. Let f be an ICNN for learning Φ and assume that, for all i ∈ {1, ..., N }, f (bi) = zi = Φ(bi) and ∇bf (bi) = yi = Φ(bi). Then, ∀b ∈ B, |f (b) − Φ(b)| ≤ maxi ∥yi∥ × diam(B). Proof. Let b ∈ B, i.e., b = (cid:80) non-negative and sum to 1. By convexity of f and Φ, i λibi where weights λi are ∀i, zi + (b − bi)⊤yi ≤ Φ(b), f (b) ≤ (cid:88) j λjzj. Combining the above inequalities with weights λi yields |Φ(b) − f (b)| ≤ ≤ (cid:88) j (cid:88) λjzj − (cid:88) i λi[zi − (b − bi)⊤yi] λi(b − bi)⊤yi i ≤ max i (b − bi)⊤yi ≤ max i ∥yi∥ diam(B) 5 TABLE I STATISTICS OF THE PGLIB TEST CASES. System ieee300 pegase1k pegase2k rte6k |N | 300 1354 2869 6468 |E| 411 1991 4582 9000 |G| 69 260 510 399 Pd ref 263 781 1522 1109 [Pd, ̄Pd] [ 210, 280] [ 625, 820] [1218, 1599] [ 887, 1164] which concludes the proof. Observe that Theorem 2 applies to any subset of data points, which offers tighter guarantees over smaller domains. V. NUMERICAL EXPERIMENTS The section reports numerical results for ICNNs that are trained to learn the value functions of DC-OPF, SOC-OPF, and AC-OPF. While DC-OPF and SOC-OPF are convex with convex value functions, AC-OPF is not convex and its value function is not guaranteed to be convex. In this last case, the task is thus to approximate (possibly) the OPF value function with a convex function. A. Experimental Setting The proposed approach is evaluated on several test cases from PGLib [30] with up to 6468 buses. These test cases are 50 times larger in size compared to those in [20]. Moreover, these prior results only considered DC-OPF. Table I reports, for each system, the number of buses |N |, branches |E| and generators |G|, as well as the nominal total demand (Pd ref) and its range across the dataset ([Pd, ̄Pd]). For each system, a dataset of OPF instances is generated by perturbing the load vectors as follows pd = α × η × pd ref, qd = α × η × qd ref, ref, qd where α is the system-wide scaling factor, sampled from a uniform distribution, η ∈ R|N | is the bus-level uncorrelated noise vector, sampled from a log-normal distribution with mean 1 and standard deviation 5%, and pd ref are the nominal active and reactive load vectors. The range of α is selected to avoid regions where AC-OPF becomes infeasible. For each system, 50, 000 OPF instances are generated and solved. The OPF problems are formulated with PowerMod- els.jl and solved with Mosek (DC and SOC) or Ipopt (AC). Infeasible instances are excluded, and the remaining dataset is partitioned into training (40%), validation (30%), and testing (30%) sets for appropriate training and model assessment procedures. For each system and OPF formulation, the paper trains a DNN and an ICNN to predict the value function of the considered OPF. Both models use the very same architecture, the only difference being that DNN weights are unrestricted. All ML models are implemented in Julia using Flux.jl [31]. Experiments are carried out on Intel(R) Xeon(R) Gold 6226 CPU @ 2.70GHz machines with NVIDIA Tesla A100 GPUs on the Phoenix cluster [32]. TABLE II ICNN PERFORMANCE RESULTS. Mean gap (%) Worst gap (%) System OPF ICNN DNN ICNN DNN ieee300 pegase1k pegase2k rte6k DC SOC AC DC SOC AC DC SOC AC DC SOC AC 0.15 0.31 0.39 0.28 0.33 0.33 0.22 1.03 0.24 0.27 0.29 0.25 0.19 0.37 0.39 0.33 0.82 0.68 0.30 0.32 0.27 0.38 0.57 0.33 1.58 5.77 15.81 1.90 4.96 14.56 2.35 2.22 2.37 3.45 2.15 3.02 1.76 1.69 2.71 1.83 2.15 1.95 3.21 2.36 8.89 1.15 5.52 3.08 B. ICNN Performance The paper uses relative absolute optimality gap to measure the performance of the DNN and ICNN models. Let z∗ and ̃z denote the ground truth (obtained by the optimization solver) and the predicted optimal value by a ML model, respectively. The relative absolute optimality gap, henceforth referred to as optimality gap for simplicity, is defined as gap = | ̃z − z∗| |z∗| . (14) Note that the prediction ̃z may over-estimate or under-estimate the ground truth z∗, which is why the absolute value is needed. Unless specified otherwise, reported averages use the √ geometric mean μ(x1, ..., xn) = n x1 × ... × xn. Table II reports, for each system and model architecture (DNN or ICNN), the geometric mean optimality gap, and the worst-case optimality gap across the testing set. First, observe that, except for SOC on the pegase2k system (for which ICNN training did not converge), ICNN always yields a mean optimality gap below 0.5%, and DNN yields mean gaps below 1%. Overall, predictions for DC-OPF tend to be slightly more accurate than those for SOC- and AC- OPF, which may be explained by the fact that DC-OPF is a linear programming problem, whereas SOC- and AC-OPF are nonlinear. Second, ICNN almost always outperforms DNN in terms of mean optimality gap. This holds even for AC-OPF, whose value function is non-convex. These results suggest that ICNN models are accurate enough to be used instead of general, non-convex DNN models to accurately represent the value functions of OPF problems. It is also important to study the worst-case optimality gaps, especially if ML models are to be embedded in larger optimization problems. Interestingly, the worst-case gaps are highest for the ieee300 system, with both ICNN and DNN exhibiting worst-case optimality gaps of about 15%, i.e., roughly 40 times larger than their mean gap. This demon- strates that low mean optimality gaps are not a guarantee of uniformly good performance. For the larger systems, both architectures exhibit lower worst-case gaps, ranging around 6 (a) Comparison of errors on DC-OPF (b) Comparison of errors on SOC-OPF (c) Comparison of errors on AC-OPF Fig. 3. Comparison of relative gap ( ̃z − z∗)/|z∗| on rte6k. Positive (resp. negative) values mean the prediction over- (resp. under-) estimates the ground truth optimal value. 2–5%, or roughly 20 times larger than the mean optimality gap. Interestingly, ICNN tends to produce better worst-case optimality gaps than DNN for SOC and AC-OPF on the two larger test cases. Designing training procedures that reduce worst-case performance is an active area of research. Figure 3 provides a more granular picture of the DNN and ICNN performance on the rte6k system. The figure reports, for each OPF formulation, the distribution of relative optimality gaps over the dataset (left panel) and as a function of total load (right panel). Note that these results are relative optimality gaps ( ̃z − z∗)/|z∗|: a positive (resp. negative) gap indicates that the ML model over-estimates (resp. under- estimates) the ground truth value. Overall, echoing the results of Table II, the ICNN gaps exhibit lower variance than the DNN gaps, especially for SOC-OPF. Furthermore, both for- mulations exhibit similar behavior with respect to the system total load, with overall higher gaps towards the ends of the range. For SOC-OPF and AC-OPF, the plots on the right panels highlight the benefits of ICNNs. VI. CONCLUSION This paper studies whether ICNNs can be accurate enough to approximate the value function of large-scale OPF prob- lems. ICNNs are an attractive avenue for approximating OPF problems, since their convexity enables them to be embedded in optimization models without resorting to a MIP reformula- tion. The results in this paper indicate that ICNNs can con- 7 [12] A. Ruszczynski, Nonlinear optimization. Princeton university press, 2011. [13] Y. Nesterov, Introductory lectures on convex optimization: A basic course. Springer Science & Business Media, 2003, vol. 87. [14] T. Asamov and W. B. Powell, "Regularized decomposition of high- dimensional multistage stochastic programs with markov uncertainty," SIAM Journal on Optimization, vol. 28, no. 1, pp. 575–595, 2018. [15] W. Chen, S. Park, M. Tanneau, and P. Van Hentenryck, "Learning optimization proxies for large-scale security-constrained economic dis- patch," Electric Power Systems Research, vol. 213, p. 108566, 2022. [16] F. Fioretto, T. W. Mak, and P. Van Hentenryck, "Predicting ac optimal power flows: Combining deep learning and lagrangian dual methods," in Proceedings of the AAAI conference on artificial intelligence, vol. 34, no. 01, 2020, pp. 630–637. [17] T. W. Mak, F. Fioretto, and P. VanHentenryck, "Load embeddings for scalable ac-opf learning," arXiv preprint arXiv:2101.03973, 2021. [18] X. He, H. Wen, Y. Zhang, and Y. Chen, "Enabling fast unit commitment constraint screening via learning cost model," 2022. [19] Y. Chen, Y. Shi, and B. Zhang, "Data-driven optimal voltage regulation using input convex neural networks," Electric Power Systems Research, vol. 189, p. 106741, 2020. [20] L. Zhang, Y. Chen, and B. Zhang, "A convex neural network solver for dcopf with generalization guarantees," IEEE Transactions on Control of Network Systems, vol. 9, no. 2, pp. 719–730, 2022. [21] Y. Chen, L. Zhang, and B. Zhang, "Learning to solve dcopf: A duality approach," Electric Power Systems Research, vol. 213, p. 108595, 2022. [22] F. Cengil, H. Nagarajan, R. Bent, S. Eksioglu, and B. Eksioglu, "Learn- ing to accelerate globally optimal solutions to the ac optimal power flow problem," Electric Power Systems Research, vol. 212, p. 108275, 2022. [23] L. Duchesne, Q. Louveaux, and L. Wehenkel, "Supervised learning of convex piecewise linear approximations of optimization problems," in 29th European Symposium on Artificial Neural Networks, Computational Intelligence and Machine Learning (ESANN), 2021. [24] J. Carpentier, "Contribution to the economic dispatch problem," Bulletin de la Societe Francoise des Electriciens, vol. 3, no. 8, pp. 431–447, 1962. [25] R. A. Jabr, "Radial distribution load flow using conic programming," IEEE Transactions on Power Systems, vol. 21, no. 3, pp. 1458–1459, Aug 2006. [26] B. Stott, J. Jardim, and O. Alsac, "DC power flow revisited," IEEE Transactions on Power Systems, vol. 24, no. 3, pp. 1290–1300, Aug 2009. [27] J. A. Taylor, Convex optimization of power systems. Cambridge University Press, 2015. [28] N. Tripuraneni, N. Flammarion, F. Bach, and M. I. Jordan, "Averaging stochastic gradient descent on riemannian manifolds," in Conference on Learning Theory. PMLR, 2018, pp. 650–687. [29] J. Nocedal and S. J. Wright, Numerical optimization. Springer, 1999. [30] S. Babaeinejadsarookolaee, A. Birchfield, R. D. Christie, C. Coffrin, C. DeMarco, R. Diao, M. Ferris, S. Fliscounakis, S. Greene, R. Huang et al., "The power grid library for benchmarking ac optimal power flow algorithms," arXiv preprint arXiv:1908.02788, 2019. [31] M. Innes, E. Saba, K. Fischer, D. Gandhi, M. C. Rudilosso, N. M. Joy, T. Karmali, A. Pal, and V. Shah, "Fashionable modelling with flux," CoRR, vol. abs/1811.01457, 2018. [Online]. Available: https://arxiv.org/abs/1811.01457 [32] PACE, Partnership for an Advanced Computing Environment (PACE), 2017. [Online]. Available: http://www.pace.gatech.edu sistently approximate system operating costs under different grid conditions, often with optimization gaps below 0.5. This suggests that convexity constraints do not entail a substantial sacrifice in accuracy, even in inherently non-convex scenarios like AC-OPF. Notably, in most cases, ICNNs exhibit slightly lower geometric errors than DNNs with similar architectures, reinforcing the potential of this approach. It is important to acknowledge challenges and opportu- nities in ICNN research. As highlighted by the SOC-OPF formulation of the 2869_pegase system, ICNN training did not converge smoothly in some instances, indicating that fine tuning the optimization parameters may be needed to render more efficient training. Additionally, convexity introduced a slight optimistic bias increasing the error in extreme cases. Although it may not result in large impacts, and might even be desirable depending on the application, it is important to mitigate its potential negative effects. Penalizing differently for under and over estimations might allow the training to be tailored for different applications. In summary, this paper identified a promising pathway for addressing complex and time-sensitive OPF couplings in power systems. The ability to achieve near-optimal cost esti- mations with reduced computational burden through machine learning methods has significant implications for the efficient operation and management of electrical grids. As research on ICNNs for OPF progresses, they will play an increasingly vital role in ensuring the reliability and sustainability of power systems in the future. is likely that it REFERENCES [1] J. Carpentier, "Optimal power flows," International Journal of Electrical Power & Energy Systems, vol. 1, no. 1, pp. 3–15, 1979. [2] S. Granville, J. Mello, and A. Melo, "Application of interior point methods to power flow unsolvability," IEEE Transactions on Power Systems, vol. 11, no. 2, pp. 1096–1103, 1996. [3] J. Kotary, F. Fioretto, P. Van Hentenryck, and B. Wilder, "End- to-end constrained optimization learning: A survey," arXiv preprint arXiv:2103.16378, 2021. [4] P. Van Hentenryck, "Machine learning for optimal power flows," Tu- torials in Operations Research: Emerging Optimization Methods and Modeling Techniques with Applications, pp. 62–82, 2021. [5] A. Velloso and P. Van Hentenryck, "Combining deep learning and optimization for preventive security-constrained dc optimal power flow," IEEE Transactions on Power Systems, vol. 36, no. 4, pp. 3618–3628, 2021. [6] A. Kody, S. Chevalier, S. Chatzivasileiadis, and D. Molzahn, "Modeling the AC power flow equations with optimally compact neural networks: Application to unit commitment," Electric Power Systems Research, vol. 213, p. 108282, 2022. [7] T. Wu and J. Wang, "Transient stability-constrained unit commitment using input convex neural network," IEEE Transactions on Neural Networks and Learning Systems, pp. 1–13, 2023. [8] B. Amos, L. Xu, and J. Z. Kolter, "Input convex neural networks," in International Conference on Machine Learning. PMLR, 2017, pp. 146– 155. [9] W. B. Powell and S. Ghadimi, "The parametric cost function approxi- mation: A new approach for multistage stochastic programming," arXiv preprint arXiv:2201.00258, 2022. [10] M. V. Pereira and L. M. Pinto, "Multi-stage stochastic optimization applied to energy planning," Mathematical programming, vol. 52, no. 1-3, pp. 359–375, 1991. [11] A. Shapiro, D. Dentcheva, and A. Ruszczy ́nski, Lectures on stochastic programming: modeling and theory. SIAM, 2009.
http://arxiv.org/abs/2310.04604v1
"2023-10-06T21:45:05"
"2023-10-06T21:45:05"
PriViT: Vision Transformers for Fast Private Inference
The Vision Transformer (ViT) architecture has emerged as the backbone of choice for state-of-the-art deep models for computer vision applications. However, ViTs are ill-suited for private inference using secure multi-party computation (MPC) protocols, due to the large number of non-polynomial operations (self-attention, feed-forward rectifiers, layer normalization). We propose PriViT, a gradient based algorithm to selectively "Taylorize" nonlinearities in ViTs while maintaining their prediction accuracy. Our algorithm is conceptually simple, easy to implement, and achieves improved performance over existing approaches for designing MPC-friendly transformer architectures in terms of achieving the Pareto frontier in latency-accuracy. We confirm these improvements via experiments on several standard image classification tasks. Public code is available at https://github.com/NYU-DICE-Lab/privit.
[ "Naren Dhyani", "Jianqiao Mo", "Minsu Cho", "Ameya Joshi", "Siddharth Garg", "Brandon Reagen", "Chinmay Hegde" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04604v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04604v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CR", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CR", "cs.LG" ]
3 2 0 2 t c O 6 ] R C . s c [ 1 v 4 0 6 4 0 . 0 1 3 2 : v i X r a PRIVIT: VISION TRANSFORMERS FOR FAST PRIVATE INFERENCE A PREPRINT Naren Dhyani* Jianqiao Mo Minsu Cho Ameya Joshi Siddharth Garg Brandon Reagen Chinmay Hegde October 10, 2023 ABSTRACT The Vision Transformer (ViT) architecture has emerged as the backbone of choice for state-of-the-art deep models for computer vision applications. However, ViTs are ill-suited for private inference using secure multi-party computation (MPC) protocols, due to the large number of non-polynomial operations (self-attention, feed-forward rectifiers, layer normalization). We propose PriViT, a gradient- based algorithm to selectively "Taylorize" nonlinearities in ViTs while maintaining their prediction accuracy. Our algorithm is conceptually simple, easy to implement, and achieves improved perfor- mance over existing approaches for designing MPC-friendly transformer architectures in terms of achieving the Pareto frontier in latency-accuracy. We confirm these improvements via experiments on several standard image classification tasks. Public code is available at https://github.com/NYU- DICE-Lab/privit. 1 Introduction Motivation. Deep machine learning models are increasingly being deployed by cloud-based providers, accessible only by API calls. In such cases, user data privacy becomes paramount, motivating the setting of private inference (PI) using secure multiparty computation (MPC). In its simplest form, MPC-based private inference is a two-party setup where a user (the first party) performs inference of their data on a model whose weights are owned by the cloud service provider (the second party), with both sides encrypting their inputs using cryptographic techniques prior to inference. The main technical barrier to widespread deployment of MPC-based PI protocols is the large number of nonlinear operations present in a deep neural network model. Private execution of linear (or low-degree polynomial) operations can be made fast using cryptographic protocols like homomorphic encryption and/or secret sharing. However, private execution of nonlinear operations (such as ReLUs or softmax operations) require Yao's Garbled Circuits, incurring high latency and storage overhead. Thus, unlocking fast, accurate, and efficient PI requires rethinking network design. Consequently, an emerging line of work has made several forays towards the design of "MPC-friendly" models; cf. more discussions below in Section 2. These methods approach PI from different angles. Approaches such as Delphi (Mishra et al., 2020a) or Circa (Ghodsi et al., 2021) propose to replace ReLUs with MPC-friendly approximations, while approaches such as CryptoNAS (Ghodsi et al., 2020) and Sphynx (Cho et al., 2021) use neural architecture search (NAS) to search for network backbones with a minimal number of ReLUs. Peng et al. (2023) propose hardware-aware ReLU-reduced networks to achieve better latencies. The latest approaches in this direction (SNL by Cho et al. (2022a), and SENet by Kundu et al. (2023)) derive inspiration from network pruning. However, this body of work has gaps. The overwhelming majority of PI-aware model approaches have focused on convolutional architectures, and have largely ignored transformer models. In particular, the proper application of MPC to vision transformer architectures remains far less studied; see Table 1. Vision transformers (Dosovitskiy et al., 2020) ∗The authors are with the Tandon School of Engineering at New York University. Corresponding authors: Naren Dhyani, nhd7682@nyu.edu; Chinmay Hegde chinmay.h@nyu.edu PriViT: Vision Transformers for Fast Private Inference A PREPRINT Approach DELPHI (Mishra et al., 2020a) CryptoNAS (Ghodsi et al., 2020) Sphynx (Cho et al., 2021) DeepReDuce (Jha et al., 2021) SNL (Cho et al., 2022a) SENet (Kundu et al., 2023) MPCFormer (Li et al., 2022) MPCViT (Zeng et al., 2022) PriViT (this paper) Arch Methods ConvNets NAS + poly approx. ResNets ResNets ResNets ResNets ResNets BERT ViT ViT NAS NAS manual GD GD Units removed ReLU layers ReLU layers ReLU layers ReLU layers Individual ReLUs Individual ReLUs NAS + poly approx. GELU layers, softmaxes NAS + poly approx. GELU layers, softmaxes GD + poly approx. Individual GELUs, softmaxes Table 1: Comparison of various MPC-friendly approaches for deep image classification. NAS stands for neural architecture search; GD stands for gradient descent. Our approach, PriViT, adaptively replaces various nonlinearities present in transformers with their Taylorized versions in order to reduce PI latency costs without drop in accuracy. currently list among the best performing deep models in numerous computer vision tasks, spanning image classification, generation, and understanding. On the other hand, vision transformers are very bulky, possessing an enormous number of nonlinear operations of different types: GELUs, softmaxes, and layer norms. As of early September 2023, the only published approach addressing private inference for vision transformers is the MPCViT framework of (Zeng et al., 2022); they use a carefully constructed combination of NAS, various simplifications of the attention mechanism, and knowledge distillation (Hinton et al., 2015) to achieve highly competitive results on common image classification benchmarks. Our contributions and techniques. In this paper we introduce PRIVIT, an algorithm for designing MPC-friendly vision transformers. PriVit considerably improves upon the previous best results for PI using Vision Transformers (MPCViT) both in terms of latency and accuracy on TinyImagenet, and competitive results on CIFAR 10/100. At a high level, our approach mirrors the network linearization strategy introduced in the SNL method by Cho et al. (2022a). Let us start with a pre-trained ViT model with frozen weights, but now replace nonlinear operations with their switched Taylorized versions: • Each GELU unit, GELU(xi) is replaced by ciGELU(xi) + (1 − ci)xi; and • Each row-wise softmax operation Softmax(Xi) is replaced by siSoftmax(xi) + (1 − si)SquaredAttn(Xi). where SquaredAttn is just the unnormalized quadratic kernel, and binary switching variables ci, si. These switches decide whether to retain the nonlinear operation, or to replace it with its Taylor approximation (linear in the case of GELU, quadratic in the case of softmax2). Having defined this new network, we initialize all switch variables to 1, make weights as well as switches trainable, and proceed with training using gradient descent. Some care needs to be taken to make things work. We seek to eventually set most of the switching variables to zero since our goal is to replace most nonlinearities with linear units or low-degree polynomials; the surviving switches should be set to one. We achieve this by augmenting the standard cross-entropy training loss with a l1-penalty term that promotes sparsity in the vector of all switch variables, apply a homotopy-style approach that gradually increases this penalty if sufficient sparsity is not reached, and finally binarize the variables via rounding. We can optionally perform knowledge distillation; see Section 3 for details. Discussion and implications. We note that the previous state-of-the-art, MPCViT, also follows a similar strategy as (Cho et al., 2022a): selectively replace both GELUs and softmax operations in vision transformers with their linear (or polynomial) approximations. However, they achieve this via a fairly complex MPC-aware NAS procedure. A major technical contribution of their work is the identification of a (combinatorial) search space, along with a differentiable objective to optimize over this space. Our PriViT algorithm, on the other hand, is conceptually much simpler and can be applied out-of-the-box to any pre-trained ViT model. The only price to be paid is the computational overhead of training the new switching variables, which incurs extra GPU memory and training time. While our focus in this paper is sharply on private inference, our results also may hold implications on the importance of nonlinearities at various transformer layers. Indeed, we see consistent trends in the architectures obtained via PriViT. First, most nonlinear operations in transformers are redundant. PriViT is able to remove nearly 83% of GELUs and 97% softmax operations with less than 0.5% reduction in accuracy over CIFAR100 (Krizhevsky et al., 2009). Second, given 2Via several ablation studies we justify why we choose these particular approximations for these functions. 2 PriViT: Vision Transformers for Fast Private Inference A PREPRINT PriViT MPCViT PriViT (with GELU) MPCViT PriVit (with ReLU) MPCViT+ Acc Latency (s) Acc Latency (s) Acc Latency (s) 78.88 78.16 75.5 64.46 31.77 28.45 20.47 14.41 62.55 63.7 63.36 62.62 150.83 95.75 71.04 43.96 78.51 80.49 78.5 77.74 17.75 14.21 14.08 11.69 Acc 77.8 76.9 76.9 76.4 Latency (s) Acc Latency (s) Acc Latency (s) 9.16 8.76 8.21 7.86 78.37 78.73 77.1 76.59 16.77 13.46 10.62 12.43 77.1 76.8 76.3 76.2 9.05 8.77 8.37 7.94 Table 2: Accuracy-latency tradeoffs between PriVit and MPCViT. All latencies are calculated with the Secretflow Ma et al. (2023) framework using the SEMI2k Cramer et al. (2018) protocol. Detailed methodology is reported in Appendix A Left: Comparison of PriViT versus MPCViT on TinyImagenet. PriViT achieves 6.6× speedup for isoaccuracy approximately 63%. Right: Comparison of PriVIT versus MPCViT on CIFAR-100. Due to ViT architecture differences, PriViT uses a much larger model with 3× more input tokens, and is able to achieve nearly percentage points increase in CIFAR-100 accuracy with only 27% increase in latency. Mirroring the MPCViT+ approach, we also report the effect of PriViT with all GELUs replaced with ReLUs, and again show competitive performance. a target overall budget of softmaxes and GELUs, PriViT overwhelmingly chooses to retain most of the nonlinearities in earlier layers, while discarding most of the later ones. These suggest that there is considerable room for designing better architectures than merely stacking up identical transformer blocks, but we defer a thorough investigation of this question to future work. 2 Preliminaries Private inference. Prior work on private inference (PI) have proposed methods that leverage existing cryptographic primitives for evaluating the output of deep networks. Cryptographic protocols can be categorized by choice of ciphertext computation used for linear and non-linear operations. Operations are computed using some combination of: (1) secret-sharing (SS) (Shamir, 1979; Micali et al., 1987); (2) partial homomorphic encryptions (PHE) (Gentry & Halevi, 2011), which allow limited ciphertext operations (e.g., additions and multiplications), and (3) garbled circuits (GC) (Yao, 1982, 1986). In this paper, our focus is exclusively on the DELPHI protocol (Mishra et al., 2020a) for private inference. We choose DELPHI as a matter of convenience; the general trends discovered in our work hold regardless of the encryption protocol, and to validate this we measure latency of our PriViT-derived models using multiple protocols. DELPHI assumes the threat model that both parties are honest-but-curious. Therefore, each party strictly follows the protocol, but may try to learn information about the other party's input based on the transcripts they receive from the protocol. Wang et al. (2022), Peng et al. (2023), Lu et al. (2021), Qin et al. (2022) DELPHI is a hybrid protocol that combines cryptographic primitives such as secret sharing (SS) and homomorphic encryptions (HE) for all linear operations, and garbled circuits (GC) for ReLU operations. DELPHI divides the inference into two phases to make the private inference happen: the offline phase and an online phase. DELPHI's cryptographic protocol allows for front-loading all input-independent computations to an offline phase. By doing so, this enables ciphertext linear computations to be as fast as plaintext linear computations while performing the actual inference. For convolutional architectures, the authors of DELPHI shows empirical evidence that ReLU computation requires 90% of the overall private inference time for typical deep networks. As a remedy, DELPHI and SAFENET (Lou et al., 2021) propose neural architecture search (NAS) to selectively replace ReLUs with polynomial operations. CryptoNAS (Ghodsi et al., 2020), Sphynx (Cho et al., 2021) and DeepReDuce (Jha et al., 2021) design new ReLU efficient architectures by using macro-search NAS, micro-search NAS and multi-step optimization respectively. Protocols for nonlinearities. To standardize across different types of non-linear activations, we compare their DELPHI (online) GC computation costs. We use the EMP Toolkit (Wang et al., 2016), a widely used GC framework, to generate GC circuits for nonlinear functions. High-performance GC constructions implement AND and XOR gates, where XOR is implemented using FreeXOR (Kolesnikov & Schneider, 2008) and AND using Half-Gate (Zahur et al., 2015). With FreeXOR, all XOR gates are negligible, therefore we count the number of AND gates as the cost of each nonlinear function (Mo et al., 2023b). To be consistent with prior work (Ghodsi et al., 2021), the activation functions also consider value recovery from Secret Sharing. Figure 1 (left) breaks down the GC cost of ViT for different nonlinearities, and (right) shows the proportion of GC cost for Softmax and GeLU, normalized by the vector length. More details are in Appendix D. 3 PriViT: Vision Transformers for Fast Private Inference A PREPRINT Figure 1: Breakdown of latency in ViT Tiny model of different non-linearities based on DELPHI. 3 PriViT: Privacy Friendly Vision Transformers 3.1 Setup Following (Cho et al., 2022a; Ghodsi et al., 2020; Mo et al., 2023a), we exclusively focus on DELPHI (Mishra et al., 2020b) as the protocol for private inference. However, we emphasize this choice is only due to convenience, and that our approach extends to any privacy-preserving protocol that relies on reducing nonlinearities to improve PI latency times. Let fW : Rn×d → [0, 1]C be a vision transformer that takes as input n tokens (each of d dimensions) and outputs a vector of probabilities for each of C classes. Each of these tokens is a patch sampled from the original image, X and is indexed by i. As described, the transformer architecture consists of stacked layers of multi-headed self-attention blocks with nonlinearities like GeLU (Hendrycks & Gimpel, 2016) and Layernorm (Ba et al., 2016). ViTs use dot-product self-attention (see Equation 1) which additionally consists of n row-wise softmax operations. Softmax(XWqWkX) √ d To frame the computational challenges inherent to Vision Transformers (ViTs), consider the ViT-base (12 layer) model designed for 224 × 224 images. Delving into its architecture reveals a composition of (approximately) 726, 000 GeLUs, 28, 000 layernorms, and 4000 softmaxes. All the non-linearities, when viewed through the lens of the DELPHI protocol, become extremely resource-intensive operations. WvX. o = (1) Our PriViT algorithm designs an architecture that circumvents these computationally heavy operations. Our proposition is to surgically introduce appropriate Taylor approximations of the GeLU and softmax attention operations wherever possible (under the constraint that accuracy drops due to such approximations should be minimal. The main challenge is to figure out where to do these approximations, which we describe below, Our algorithm can be viewed as an extension of SNL (Cho et al., 2022b), a network linearization approach. SNL allows for automatic linearization of feed-forward networks through the use of parametric ReLU activations and optimizing a Lasso-like loss (Tibshirani, 1996). While SNL can reasonably be used to linearize ReLUs (GeLUs) in ViTs, it does not support linearizing softmax operations, which form a large proportion of nonlinearities in ViTs. We therefore add a reparametrized normalization layer that allows a choice between softmax and SQUAREDATTN. Note that this is distinct to many existing approaches (Qin et al., 2022; Lu et al., 2021; Wang et al., 2020; Song, 2021) which also propose blanket alternatives to softmax attention throughout the network. 3.2 PriViT Algorithm To begin, we focus on softmax and GeLUs and ignore layernorms; we found that these were far harder to Taylorize. For the former, we introduce auxiliary variables to act as switches. Given fW, let C and S be the total number of GeLUs and softmaxes. Further, let S = [s1, s2, ..., sS] and C = [c1, c2, . . . , cG] be collections of binary switch variables defined for all instances of GeLU and softmax activations. Our goal here is to learn W, S, and C to ensure high accuracy with as few nonlinearities as possible. We also use N to denote the number of tokens, H to denote the number of heads and m to denote the size of the token embedding (and consequently the output size of the feedforward MLP). GELU. In the case of GELU operations, we define a switched version of the GeLU activation: f (ci, xi) = ciGELU(xi) + (1 − ci)xi (2) 4 20.2%4.7%75.1%SoftmaxLayernormGeLUSoftmaxGeLU0510152025Cost (#AND gates in 1000x)Operationsaddmuldivexp PriViT: Vision Transformers for Fast Private Inference A PREPRINT y = (cid:2)f (c1, x1), f (c2, x2), . . . , f (cn, xn)(cid:3), where ci is the corresponding auxiliary variable for the ith token, xi is the ith input token embedding of dimension m (m being the MLP dimension) and y ∈ RN ×m is the output. During training, ci are initially real-valued, trainable, and are initialized to 1 at the start of training. During inference, we binarize all ci using an indicator function, 1ci>ε, where ε is an appropriately chosen threshold. ci = 1 implies that the GELU is preserved whereas ci = 0 reverts to the linear activation. Figure 11 in the Appendix shows a graphical representation of the GELU parametrization. Note that GELU is a pointwise function and therefore is applied to elementwise. (3) Softmax Attention. The next step is to reparameterize softmax attention. However unlike GELUs, choice of parameterization is not obvious here. As per the DELPHI protocol, exponents are extremely expensive to calculate. On the other hand, polynomials are comparatively cheaper. Also division by a constant can be folded away compared to division by a number that is input dependent as in the case of softmax. Therefore, we propose a modified 'Squared Attention' block; SQUAREDATTN(X) = WvX, (4) (XWqWkX)2 N wherein we apply pointwise squaring instead of a row-wise softmax and divide by the number of tokens. Squared attention is MPC friendly for the properties described above, all the while preserving performance compared to original softmax. Similar to our approach with GELUs, we further add a learnable auxiliary variable, si for every row-wise softmax operation in the attention layer. o = siSoftmax(Xi) + (1 − si)SQUAREDATTN(Xi), (5) where Xi is the ith row of the attention matrix. As before, sis are initially real-valued, trainable and initialized to 1. The variables are binarized during inference allowing use of either Softmax or squared attention based on the values of si. Further ablations of different candidate attention functions are presented in the results sections. 3.3 Training PriVit To train PriVit models, we need to train three sets of variables: the weights of the transformer, W, the switch variables for the GELU parameterization, C, and the switch variables for the attention parametrization, S. Our goal is to train a model that minimizes the number of nonlinearities to satisfy a given nonlinearity budget, that is, ∥C∥0 < C, and ∥S∥0 < S, while increasing the overall performance. This is reminiscent of standard LASSO-style (Tibshirani, 1996) optimization. We therefore propose the following loss function to train the model, min W,C,S L(fW(X, y)) + λg |G| (cid:88) i=0 |ci| + λs |S| (cid:88) j=0 |si|, (6) where L is the standard cross-entropy loss. We then optimize for each of the variables until the required softmax attention and GELU budgets. We show pseudocode for our training algorithm in Algorithm 1 in the Appendix. After every epoch, we count the number of GELUs and softmax attention operations by thresholding the si and ci values. Once the model satisfies the required budgets,,we freeze the chosen GELUs and softmax attention operations by binarizing all si and ci values and fine-tune the model weights for the classification task. Optionally, we can also make use of knowledge distillation during both training and fine-tuning. Figure 13 provides a complete illustration. 4 Results 4.1 Experimental Setup Architecture and data set. We apply PriViT algorithm to a pretrained checkpoint of ViT Tiny (Steiner et al., 2021) that is trained on ImageNet-21k (14 million images, 21,843 classes) at resolution 224x224, and fine-tuned on ImageNet 2012 (1 million images, 1,000 classes) at resolution 224x224. The pretrained ViT Tiny checkpoints are made available by (WinKawaks, 2022). In this research work we focus on finetuning an existing model checkpoint like ViT Tiny on a target standard image classification dataset (CIFAR10/100 (Krizhevsky et al., 2009) and Tiny-ImageNet). CIFAR10/100 has images of size 32 × 32 while Tiny-ImageNet has 64 × 64. These images were resized to 224 × 224 before being given as an input. CIFAR10 has 10 classes with 5000 training images and 1000 test images per class. CIFAR100 has 100 classes with 500 training images and 100 test images per class. Tiny-ImageNet has 200 classes with 500 training images and 50 test images per class. We also perform hyperparameter tuning and present more details in Appendix A 5 PriViT: Vision Transformers for Fast Private Inference A PREPRINT ViT teacher pretraining. As the base model, we finetune a pretrained ViT-Tiny on CIFAR10/100 for 10 epochs. We use AdamW (Loshchilov & Hutter, 2017) as the optimizer with an initial learning rate and weight decay as 0.0001 and 0.0001 respectively, and decay the learning rate after every 30 epochs by multiplying it by 0.1. Batch size used is 64. We use the same hyperparameters for the TinyImagenet model as well. We use these weights to initialize PriViT and start KD. Joint optimization of student ViT and parametric non linearities. We use Adam (Kingma & Ba, 2014) optimizer with learning rate equal to 0.0001. We use knowledge distillation and use soft labels generated by the teacher model with a temperature of 4. The total loss is then, L = LPriViT + LKL, where LPriViT is Equation 6 and LKL is the KL divergence loss between the logits of teacher and student model. The Lasso coefficient (Tibshirani, 1996) for parametric attention and GELU mask are set to λg = 0.00003 and λs = 0.00003 respectively at the beginning of the search. We set warmup epochs to 5 during which we don't change any hyperparameters of the model. Post warmup, we increment λg by a multiplicative factor of 1.1 at the end of each epoch if the number of active GELUs of current epoch do not decrease by atleast 2 as compared to previous epoch. Note that a GELU/softmax is considered active if it's corresponding auxiliary variable is greater than threshold hyperparameter ε = 0.001. We follow the same approach for λs, with a multiplicative factor of 1.1 and an active threshold of 200. Binarizing parametric nonlinearities, finetuning. When the GELUs and softmax budgets are satisfied, we binarize and freeze the the GELU and softmax auxiliary variables. We subsequently finetune the model for 50 epochs using AdamW with a learning rate 0.0001, weight decay 0.0001 and a cosine annealing learning rate scheduler (Loshchilov & Hutter, 2016). Our finetuning approach continues to use knowledge distillation as before. Non-linearity cost comparison. We conduct experiments to assess the computational cost of non-linear functions such as layernorm, softmax, and GeLU in comparison to ReLU within GC. The detailed results are reported in Appendix D, and it demonstrates that with a vector length of 197, all layernorm and softmax functions incur higher computational costs (i.e., number of ANDs) than ReLU. Specifically, they exhibit costs 6504×, 18586× higher than that of ReLU respectively and for pointwise GELU, we saw a cost 270× higher than that of ReLU. The cost of denominator of layernorm and softmax can be amortized to the whole vector and thus incur less cost than GELU. We estimate the latency of each model generated by PriViT using these conversion factors. To show an example, we estimate the non-linearity cost of a hypothetical model with 1000 softmax operation, 1000 layernorm operations and 1000 GELUs, by taking the weighted sum of each operations with their corresponding latency factor. 4.2 Comparison with prior art We follow SNL and use Delphi as our primary secure two party MPC framework to report latency. We also benchmark PriViT against MPCViT, using the checkpoints publicly shared by the authors. We use the latency estimates reported in Section 4.1 and report the total latency by adding the contribution from all types of non-linearities like softmax attention, layernorm, GELU, SquaredAttention, ReluSoftmax, ScaleAttention to a common proxy. Specifically we convert latency contribution by these operations to ReLU equivalents. We refer to the latency of a single RELU operation as 'RELUOps' for a given system. We can therefore measure other non-linearities in terms of RELUOps. This proxy has the advantage that it abstracts away system level variables like hardware, memory and bandwidth which often cause variance in bench marking performance. Table 3 highlights the differences in base model architecture of PriViT and MPCViT. Model Layers Width MLP Heads Image size Patch size params (M) PriViT MPCViT (Tiny Imagenet) MPCViT (Cifar 10/100) 12 9 7 192 192 256 768 384 512 3 12 4 224×224 64×64 32×32 16×16 4×4 4×4 5.8 - 3.72 Table 3: Base model archictecture of PriViT and MPCViT Pareto analysis of PriViT over Tiny Imagenet, and Cifar10/100 In our evaluation on various datasets, the performance of PriVit was benchmarked against both MPCViT and MPCViT+. We measure two metrics of importance – the latency (measured in terms of RELUOps), and accuracy. An ideal private inference algorithm will achieve high accuracy with low latency. 1. Tiny ImageNet: Using a Pareto analysis on the Tiny ImageNet dataset, PriViT showcases notable improvement. On Tiny imagenet, for an isoaccuracy of approximately 63% , PriViT G and PriViT R achieved 3× and 4.7× speedup compared to MPCViT respectively as reported in table 4. 2. CIFAR-10: We observe from our results in Fig 2 that in certain latency regimes PriVit performs just as well as MPCViT and slightly worse than MPCViT+ in the trade-off between performance and computational efficiency. 6 PriViT: Vision Transformers for Fast Private Inference A PREPRINT Table 4: Comparison of PriViT-R, PriViT-G, and MPCViT over Tiny Imagenet PriViT - G PriViT - R MPCViT Accuracy Latency (M) Accuracy Latency (M) Accuracy Latency (M) 64.73 61.05 56.83 57.65 69.11 67.08 69.28 82.77 69.8 66.98 64.46 60.53 151.75 128.23 110.60 93.72 62.55 63.7 63.36 62.62 381.42 331.35 307.45 282.42 3. CIFAR-100: Turning our attention to the CIFAR-100 dataset, the performance nuances became more evident. PriViT G performs just as well as MPCViT but is slightly worse compared to MPCViT+. However, when benchmarked against PriViT R, PriVit's performance was much better than MPCViT and MPCViT+, indicating the competitive nature of the two algorithms on this dataset. These findings underscore PriVit's potential as a viable alternative to the existing MPCViT variants, especially in scenarios where efficiency and performance are paramount. PriViT-R PriViT-G MPCViT MPCViT+ PriViT-R PriViT-G MPCViT MPCViT+ CIFAR 100 CIFAR 10 ) % ( y c a r u c c A 80 75 70 96 95 94 ) % ( y c a r u c c A 40 60 80 100 Latency (M) 120 140 50 60 70 80 Latency (M) 90 100 110 Figure 2: Comparison of PriViT over CIFAR 10/100 benchmarked against MPCViT, and MPCViT+. The latency is calculated as per 4.1 4.3 Ablation studies Contribution by Knowledge Distillation. In PriViT, we incorporate knowledge distillation (KD) alongside supervised learning. To assess the contribution of KD to the overall performance, we trained PriViT on the TinyImagenet dataset with varying non-linearity budgets. We then compared its performance to a version of PriViT (as outlined in fig 13) that does not employ a teacher model for knowledge distillation. Our results in figure 3 indicate that, under identical latency conditions, incorporating KD enhances performance by approximately 5%. ) % ( y c a r u c c A t s e T 70 65 60 55 50 Pri-ViT Pri-ViT w/o KD 60 80 100 120 140 160 180 200 Latency (M) Figure 3: PriViT performance without KD. PriViT PriViT w/o pretrain Latency (M) Accuracy (%) Latency (M) Accuracy (%) 271.59 151.74 128.23 93.71 75.5 69.8 66.98 60.53 234.18 194.78 167.20 153.31 53.57 54.66 55.59 55.92 Table 5: Latency comparison between PriViT and PriViT w/o Pretrain Contribution of pretraining. In PriViT, we utilize a pretrained checkpoint, which is subsequently fine-tuned. Post fine-tuning, we introduce a parametric GeLU and attention mechanisms to decrease non-linearities in the model. To gauge the impact of using a pretrained model on the overall performance, we contrast the performance of PriViT (as outlined in Fig.13 of Appendix) with a variant of PriViT that is not built upon a pretrained model. Instead, this variant employs weights initialized from scratch and is trained with the same parametric non-linearity mask as used in PriViT 7 PriViT: Vision Transformers for Fast Private Inference A PREPRINT to minimize non-linearities. The comparative outcomes of these approaches are presented in Table 5. Our findings reveal that, for comparable latencies, PriViT with the pretrained checkpoint outperforms its counterpart without it, registering a 14% enhancement in accuracy. Choice of softmax approximation. To highlight the contribution of different attention candidate, we run PriViT over different softmax budget over CIFAR100, and report the accuracy of the resulting model versus the number of original softmax attention retained. Lower number of softmax operations implies higher the number of softmax attention replaced with our candidate attention operation. As per Figure 4 we see almost no performance drop for SQUAREDATTN, roughly 5% drop in performance for SCALEATTN and 10% drop in performance for UNIFORMATTN in low budgets. ) % ( y c a r u c c A t s e T 90 85 80 UniformAttn ScaleAttn SquaredAttn (ours) 0 0.25 0.5 Softmax count 0.75 1 *104 Figure 4: We evaluated the PriViT algorithm using three attention operations: Uniform, Linear, and Squared Attention. The x-axis represents the target softmax count, while the y-axis shows the test accuracy on CIFAR100. Squared Attention outperformed the others across all softmax budgets, motivating its selection to replace the standard softmax attention in PriViT. Fine-grained versus layer-wise Taylorization PriVit employs a unique approach where it selectively Taylorizes softmax and GELU operations. To probe the effectiveness of this method, we contrasted it with an alternative PriViT approach that Taylorizes a ViT model progressively, layer by layer. As illustrated in Table 8, our observations underscored the superiority of selective Taylorization. See the Appendix for further details. Visualization of non-linearity distribution. To understand which nonlinearities are preserved, we investigate the distribution of PriViT models under different softmax and GELU budgets. From our observations in Figure 5 we can conclude that GELUs in earlier encoder layers are preferred over the ones in the later layers. From figure 6 we observe a similar trend in softmax distributions. We find this interesting, since the trends reported in earlier work on convolutional networks are in the reverse direction: earlier layers tend to have a larger number of linearized units. Understanding this discrepancy is an interesting question for future work. Base PriVit 1 2 3 4 5 6 7 8 9 10 11 12 106 105 104 K 0 5 1 U L e G 106 105 104 k 0 0 5 U L e G 1 2 3 4 5 6 7 8 9 10 11 12 Layer Index Figure 5: Comparison of GELU distribution between ViT-base (Base) and PriViT without softmax linearization. The x-axis represents the model's layer index, while the y-axis shows log-scaled GELU operations per layer. With an input tensor size of 197 × 3072 for the GELU layer, each layer contains 197 × 3072 = 605184 GELU operations. Top: 150K target GELU. Bottom: 500K target GELU. 8 PriViT: Vision Transformers for Fast Private Inference A PREPRINT Base PriVit 1 2 3 4 5 6 7 8 9 10 11 12 2,000 1,000 x a m t f o S 0 2,000 1,000 x a m t f o S 0 1 2 3 4 5 6 7 8 9 10 11 12 Layer Index Figure 6: Comparison of softmax distribution in ViT-base model (Base) versus PriViT without GeLU linearization. The x-axis denotes the layer index, while the y-axis shows the softmax operations per layer. With a 197 × 197 attention matrix across 12 heads, the ViT-base model totals 2364 softmax operations per layer. Notably, PriViT tends to substitute earlier layer softmaxes with linear operations. Top: 1K target softmax; Bottom: 10K target softmax. 5 Conclusions We introduce PriViT, a new algorithm for designing MPC-friendly vision transformers, and showed its competitive performance on several image classification benchmarks. A natural direction of future work is to extend similar techniques for designing other families of transformer architectures, such as Swin Transformers and Data Efficient image transformers (DEiT), as well as encoder-decoder transformer architectures. References Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. 4 Minsu Cho, Zahra Ghodsi, Brandon Reagen, Siddharth Garg, and Chinmay Hegde. Sphynx: Relu-efficient network design for private inference. arXiv preprint arXiv:2106.11755, 2021. 1, 2, 3 Minsu Cho, Ameya Joshi, Brandon Reagen, Siddharth Garg, and Chinmay Hegde. Selective network linearization for efficient private inference. In International Conference on Machine Learning, pp. 3947–3961. PMLR, 2022a. 1, 2, 4 Minsu Cho, Ameya Joshi, Brandon Reagen, Siddharth Garg, and Chinmay Hegde. Selective network linearization for efficient private inference. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato (eds.), Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pp. 3947–3961. PMLR, 17–23 Jul 2022b. URL https://proceedings.mlr. press/v162/cho22a.html. 4 Ronald Cramer, Ivan Damg ̊ard, Daniel Escudero, Peter Scholl, and Chaoping Xing. Spd: efficient mpc mod for dishonest majority. In Annual International Cryptology Conference, pp. 769–798. Springer, 2018. 3 Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with a reduced search space. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition workshops, pp. 702–703, 2020. 13 Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2020. 1 Craig Gentry and Shai Halevi. Implementing gentry's fully-homomorphic encryption scheme. In Annual international conference on the theory and applications of cryptographic techniques, pp. 129–148. Springer, 2011. 3 Zahra Ghodsi, Akshaj Kumar Veldanda, Brandon Reagen, and Siddharth Garg. Cryptonas: Private inference on a relu budget. In Adv. Neural Inf. Proc. Sys. (NeurIPS), 2020. 1, 2, 3, 4 9 PriViT: Vision Transformers for Fast Private Inference A PREPRINT Zahra Ghodsi, Nandan Kumar Jha, Brandon Reagen, and Siddharth Garg. Circa: Stochastic relus for private deep learning. In Adv. Neural Inf. Proc. Sys. (NeurIPS), 2021. 1, 3, 17 A Hassani, S Walton, N Shah, A Abuduweili, J Li, and H Shi. Escaping the big data paradigm with compact transformers. arXiv preprint arXiv:2104.05704, 2021. 13 Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016. 4 Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. 2 Nandan Kumar Jha, Zahra Ghodsi, Siddharth Garg, and Brandon Reagen. DeepReDuce: Relu reduction for fast private inference. In Proc. Int. Conf. Machine Learning, 2021. 2, 3 Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. 6 Vladimir Kolesnikov and Thomas Schneider. Improved garbled circuit: Free xor gates and applications. In Automata, Languages and Programming: 35th International Colloquium, ICALP 2008, Reykjavik, Iceland, July 7-11, 2008, Proceedings, Part II 35, pp. 486–498. Springer, 2008. 3 Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. Technical report, U. Toronto, 2009. 2, 5 Souvik Kundu, Shunlin Lu, Yuke Zhang, Jacqueline Tiffany Liu, and Peter Anthony Beerel. Learning to linearize deep neural networks for secure and efficient private inference. In Proc. Int. Conf. Learning Representations, 2023. 1, 2 Dacheng Li, Hongyi Wang, Rulin Shao, Han Guo, Eric Xing, and Hao Zhang. MPCFormer: Fast, Performant Private Transformer Inference With MPC. In The Eleventh International Conference on Learning Representations, 2022. 2 arXiv preprint Sgdr: Stochastic gradient descent with warm restarts. Ilya Loshchilov and Frank Hutter. arXiv:1608.03983, 2016. 6 Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. 6 Qian Lou, Yilin Shen, Hongxia Jin, and Lei Jiang. Safenet: Asecure, accurate and fast neu-ral network inference. In Proc. Int. Conf. Learning Representations, 2021. 3 Jiachen Lu, Jinghan Yao, Junge Zhang, Xiatian Zhu, Hang Xu, Weiguo Gao, Chunjing Xu, Tao Xiang, and Li Zhang. Soft: Softmax-free transformer with linear complexity. In Adv. Neural Inf. Proc. Sys. (NeurIPS), 2021. 3, 4 Junming Ma, Yancheng Zheng, Jun Feng, Derun Zhao, Haoqi Wu, Wenjing Fang, Jin Tan, Chaofan Yu, Benyu Zhang, and Lei Wang. SecretFlow-SPU: A performant and User-Friendly framework for Privacy-Preserving machine learning. In 2023 USENIX Annual Technical Conference (USENIX ATC 23), pp. 17–33, Boston, MA, July 2023. USENIX Association. ISBN 978-1-939133-35-9. URL https://www.usenix.org/conference/atc23/ presentation/ma. 3 Silvio Micali, Oded Goldreich, and Avi Wigderson. How to play any mental game. In Proceedings of the Nineteenth ACM Symp. on Theory of Computing, STOC, pp. 218–229. ACM New York, NY, USA, 1987. 3 Pratyush Mishra, Ryan Lehmkuhl, Akshayaram Srinivasan, Wenting Zheng, and Raluca Ada Popa. Delphi: A cryptographic inference service for neural networks. In 29th USENIX Security Symposium (USENIX Security 20), pp. 2505–2522. USENIX Association, Aug. 2020a. ISBN 978-1-939133-17-5. URL https://www.usenix.org/ conference/usenixsecurity20/presentation/mishra. 1, 2, 3 Pratyush Mishra, Ryan Lehmkuhl, Akshayaram Srinivasan, Wenting Zheng, and Raluca Ada Popa. Delphi: A cryptographic inference service for neural networks. In 29th USENIX Security Symposium (USENIX Security 20), 2020b. 4 Jianqiao Mo, Karthik Garimella, Negar Neda, Austin Ebel, and Brandon Reagen. Towards fast and scalable private inference. In Proceedings of the 20th ACM International Conference on Computing Frontiers, pp. 322–328, 2023a. 4 Jianqiao Mo, Jayanth Gopinath, and Brandon Reagen. Haac: A hardware-software co-design to accelerate garbled circuits. In Proceedings of the 50th Annual International Symposium on Computer Architecture, pp. 1–13, 2023b. 3 Hongwu Peng, Shanglin Zhou, Yukui Luo, Nuo Xu, Shijin Duan, Ran Ran, Jiahui Zhao, Shaoyi Huang, Xi Xie, Chenghong Wang, Tong Geng, Wujie Wen, Xiaolin Xu, and Caiwen Ding. Rrnet: Towards relu-reduced neural network for two-party computation based private inference. arxiv preprint: ArXiv:2302.02292v2, 2023. 1, 3 Zhen Qin, Weixuan Sun, Huicai Deng, Dongxu Li, Yunshen Wei, Baohong Lv, Junjie Yan, Lingpeng Kong, and Yiran Zhong. cosformer: Rethinking softmax in attention. In Proc. Int. Conf. Learning Representations, 2022. 3, 4 Adi Shamir. How to share a secret. Communications of the ACM, 22(11):612–613, 1979. 3 10 PriViT: Vision Transformers for Fast Private Inference A PREPRINT Jeonggeun Song. Ufo-vit: High performance linear vision transformer without softmax. ArXiv, abs/2109.14382, 2021. URL https://api.semanticscholar.org/CorpusID:238215432. 4 Andreas Steiner, Alexander Kolesnikov, Xiaohua Zhai, Ross Wightman, Jakob Uszkoreit, and Lucas Beyer. How to train your vit? data, augmentation, and regularization in vision transformers. arXiv preprint arXiv:2106.10270, 2021. 5 Robert Tibshirani. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society. Series B (Methodological), pp. 267–288, 1996. 4, 5, 6 Sinong Wang, Belinda Z. Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. ArXiv, abs/2006.04768, 2020. URL https://api.semanticscholar.org/CorpusID:219530577. 4 Xiao Wang, Alex J. Malozemoff, and Jonathan Katz. EMP-toolkit: Efficient MultiParty computation toolkit. https: //github.com/emp-toolkit, 2016. 3 Yongqin Wang, G Edward Suh, Wenjie Xiong, Benjamin Lefaudeux, Brian Knott, Murali Annavaram, and Hsien-Hsin S Lee. Characterization of mpc-based private inference for transformer-based models. In 2022 IEEE International Symposium on Performance Analysis of Systems and Software (ISPASS), pp. 187–197. IEEE, 2022. 3 WinKawaks. Vit-tiny-patch16-224 model, 2022. https://huggingface.co/WinKawaks/ vit-tiny-patch16-224. 5 Andrew Chi-Chih Yao. Protocols for secure computations. In 23rd Annual Symposium on Foundations of Computer Science (sfcs 1982), pp. 160–164. IEEE, 1982. 3 Andrew Chi-Chih Yao. How to generate and exchange secrets. In 27th Annual Symposium on Foundations of Computer Science (sfcs 1986), pp. 162–167. IEEE, 1986. 3 Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regular- ization strategy to train strong classifiers with localizable features. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 6023–6032, 2019. 13 Samee Zahur, Mike Rosulek, and David Evans. Two halves make a whole: Reducing data transfer in garbled circuits using half gates. In Advances in Cryptology-EUROCRYPT 2015: 34th Annual International Conference on the Theory and Applications of Cryptographic Techniques, Sofia, Bulgaria, April 26-30, 2015, Proceedings, Part II 34, pp. 220–250. Springer, 2015. 3 Wenxuan Zeng, Meng Li, Wenjie Xiong, Wenjie Lu, Jin Tan, Runsheng Wang, and Ru Huang. Mpcvit: Searching for mpc-friendly vision transformer with heterogeneous attention. arXiv preprint arXiv:2211.13955, 2022. 2, 11, 18 Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017. 13 Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation. In Proceedings of the AAAI conference on artificial intelligence, 2020. 13 A Supplementary results Additional PI results Following Zeng et al. (2022) we benchmark our method over SEMI2k using secretflow framework, the client and server are 64GB RAM, Intel(R) Xeon(R) Platinum 8268 CPU @ 2.90GHz. We run PI over LAN settings between two nodes of HPC cluster, hence there is a variation of the total inference latency from what is reported in Zeng et al. (2022), but to keep a consistent comparison, we benchmark both PriViT and MPCViT under our system settings. We report additional bench marking results on CIFAR 10 data in the table 6. Analysis of performance degradation. In this analysis, we aim to compare the performance of trained PriViT models with their finetuned versions. Our analysis is based on the class-level accuracy metric from the Tiny ImageNet dataset, which consists of 200 classes. We focus on three specific parameters to understand the performance degradation: Maximum Difference in Accuracy: We assess the greatest disparity in accuracy across all 200 classes between the PriViT and finetuned models. Overall Accuracy Difference: We compute the average accuracy difference between the finetuned and the PriViT models across all 200 classes. Variance in Accuracy Difference: We analyze the consistency of the differences in accuracy across the 200 classes by calculating the variance. 11 PriViT: Vision Transformers for Fast Private Inference A PREPRINT PriViT G MPCViT PriVit R MPCViT+ Acc Latency (s) Acc Latency (s) Acc Latency (s) Acc Latency (s) 96.31 95.31 95.58 95.14 94.52 94.44 21.13 19.27 15.99 14.43 14.37 11.6 94.3 94.2 94.1 93.6 10.39 9.85 9.39 8.96 94.45 92.45 92.36 92.39 91.08 18.74 17.83 13.26 13.01 10.24 93.3 93.9 94.2 94.3 5.57 6.38 7.39 6.83 Table 6: Benchmarking PriViT and MPCViT over CIFAR 10 dataset on SEMI2k protocol. Table 7 highlights that average accuracy degradation is anywhere between 1-13% for different non-linearity budgets but certain classes seem to be more adversely affected even in low budgets as the max class level difference in accuracy is consistent around 30%. Table 7: Performance degradation of PriViT models compared to finetuned model on tinyimagenet. Accuracy Latency (M) Max Difference Mean Difference Variance (10 × 10−3) 69.8 66.98 64.46 60.53 59.55 59.58 59.04 58.74 58.2 151.75 128.23 110.60 93.72 86.51 84.78 84.13 69.42 67.43 30.00% 34.00% 34.00% 40.00% 34.00% 36.00% 36.00% 40.00% 36.00% 1.85% 4.68% 7.21% 11.13% 12.12% 12.08% 12.63% 12.92% 13.48% 6.8 6.9 8 9 9.4 9.8 9.9 9.4 8.7 Fine-grained versus layer-wise Taylorization PriVit employs a unique approach where it selectively Taylorizes softmax and GELU operations in models. To probe the effectiveness of this method, we contrasted it with an alternative PriViT approach that Taylorizes a ViT model progressively, layer by layer. Table 8: Performance comparison of PriViT versus layerwise linearization of GeLU in a ViT model with 200k GeLUs. Twelve models were generated by sequentially replacing up to 12 GeLU layers with Identity. PriViT was also evaluated with varying GeLU budgets below 200k. Layerwise GELU linearizing Pri-ViT Gelus (K) Accuracy Gelus (K) Accuracy 200 150 100 50 10 1 95.59 95.34 95.58 94.98 94.24 93.96 197 196 193 190 187 184 181 178 174 171 164 123 0 96.07 96.07 95.91 95.35 94.28 93.75 93.33 92.99 93.04 92.88 92.06 82.48 56.64 As illustrated in Table 8, our observations underscored the superiority of selective Taylorization. This superiority was especially pronounced under constrained non-linearity budgets. 12 PriViT: Vision Transformers for Fast Private Inference A PREPRINT Delving deeper, our experiment commenced with a foundational ViT model populated with 200k GeLUs, while the remaining operations were Identity-based. From this foundation, we crafted a series of models, each with an increasing number of GeLU layers swapped for Identity, creating a spectrum from 1 to 12 GeLU replacements. Post-finetuning, the performance metrics of these models were recorded. In parallel, we evaluated PriViT under a gamut of GeLU budgets, all set below the 200k threshold, thereby exploring its capability for dynamic GeLU retention. Hyperparameter Tuning Following (Hassani et al., 2021) we use CutMix (Yun et al., 2019), Mixup (Zhang et al., 2017), Randaugment (Cubuk et al., 2020), and Random Erasing (Zhong et al., 2020) as data augmentation strategy. We probed multiple hyperparameter strategies for the joint optimization phase of PriViT to ensure consistent good performance over multiple configurations of non-linearity budgets of softmax and GELUs. Specifically we describe these strategies as follows: Late-Binarized Epoch (Strategy 1): This strategy involved 10 post-linearization training epochs. The binarization of auxiliary parameters, s and c, occurred late in the process, specifically after the linearization was complete. The penalty increment condition for this method was checked when the reduction in the softmax and GELU coefficients per epoch was less than 200 and 2, respectively. Both masks began with identical penalties, signifying an 'equal' starting penalty. Late-Binarized Incremental (Strategy 2): This strategy also encompassed 10 training epochs with late binarization. Here, the penalty increment condition was activated with an increase in the softmax and GELU coefficients per epoch. The starting penalty for both masks was 'equal'. Late-Binarized Divergent Penalty (Strategy 3): Much like Strategy 2, this involved 10 epochs with late binarization and an increment condition based on softmax and GELU coefficient rises. However, the initial penalty was set to 'unequal', making the softmax penalty 20 times higher than the GELU penalty. Early-Binarized Incremental (Strategy 4): This strategy shared several similarities with Strategy 2, including 10 training epochs and an increment condition based on coefficient increases. The difference, however, lay in its early binarization, occurring during the freezing of the auxiliary parameters. The starting penalty was kept 'equal' for both masks. Prolonged Early-Binarized Epoch (Strategy 5): Spanning 50 post-linearization training epochs, this strategy adopted an early binarization approach. The penalty increment condition was activated when the reduction in softmax and GELU coefficients per epoch was under 200 and 2, respectively. The masks were initialized with 'equal' penalties. Each of these strategies offered unique configurations in terms of epoch durations, binarization timings, increment conditions, and starting penalties, enabling a comprehensive assessment of the PriViT algorithm's performance under various conditions. We test the different finetuning strategies described here by taylorizing PriViT for different softmax and GELU budgets and compare the test accuracy of the resulting model over CIFAR100. Table 9 highlights the comparative performance of all the strategies that we described. Strategy 5 seems to be performing best over different configuration of nonlinearity budget which is important as we would want to find the best model peformance for a particular non-linearity budget. Table 9: We test the different finetuning strategies described in A. We run PriViT for different softmax and GELU budgets and compare the test accuracy of the resulting model over CIFAR100. We observe that strategy 5 works the best across a wide range of target softmax and GELU budgets. Strategy 2 # Gelu (Acc. %) (K) # Softmax (K) Strategy 3 (Acc. %) Strategy 1 (Acc. %) Strategy 5 (Acc. %) Strategy 4 (Acc. %) 10 5 5 2 2 1 5 5 1 10 1 5 77.68 76.27 76.73 76.04 75.92 76.12 76.74 75.99 75.21 75.23 74.84 74.99 - 75.72 76.24 - 76.45 76.32 77.82 - - 74.65 - - 78.83 77.63 77.08 76.35 76.97 76.96 Grid search of softmax and GELU configuration. In order to elucidate the nuanced trade-off between softmax and GeLU operations, we executed a systematic grid search across an extensive parameter space encompassing varied softmax and GeLU configurations. Upon analysis of models exhibiting iso-latencies, as demarcated by the red lines in figure 7, it became evident that the trade-off dynamics are non-trivial. Specifically, configurations with augmented softmax values occasionally demonstrated enhanced performance metrics, whereas in other scenarios, models optimized with increased GeLU counts exhibited superior benchmark results. 13 PriViT: Vision Transformers for Fast Private Inference A PREPRINT Grid search on CIFAR-100 Acc. 300 250 200 150 100 50 ) K ( U L E G 80 79 78 77 76 0.2 0.4 0.6 Sof tmax 0.8 1 *104 Figure 7: The PriViT algorithm produces a Pareto surface mapping the tradeoff between GeLU and softmax budgets over cifar 100. Taylorizing only one type of non-linearity. The PriViT algorithm's standout capability is its simultaneous linearization of GELU and softmax operations, enabling a myriad of model configurations. In our focused experiment, we exclusively linearized GELU operations and anchored the auxiliary softmax parameter S, binarizing it to activate only the SoftmaxAttention mechanism. Despite extensive GELU substitutions, as reported in 8 the PriViT model displayed notable resilience on CIFAR10 and CIFAR100 datasets, with only slight performance drops, underscoring its robustness in varied setups. 100 90 80 ) % ( y c a r u c c A CIFAR-100 CIFAR-10 2,000 1,800 1,600 1,400 1,200 1,000 800 600 400 200 0 # GELU (K) Figure 8: PriViT's ability to linearize GeLU operations visualized through performance on CIFAR datasets. As GELU operations decrease, CIFAR-100 and CIFAR-10 accuracies are affected, showcasing the trade-off between operation count and accuracy. Effect of using pre-trained checkpoints. To further investigate why using pretrained checkpoint is improving performance, we report the non-linear distributions searched by PriViT and compare it with PriViT without pretrain for the nonlinearity budget of 315k and 320k respectively. We observe from our findings in figures 9,10 that the distribution found by the two methods differs across each layer. This supports our theory as to how PriViT operates under a strategic 'top-down' paradigm. Starting with a fine-tuned model, it has the advantage of an architecture that has not just discerned overarching generalization patterns but has also selectively pruned irrelevant information, streamlining its focus for a specific downstream task. This reduction of redundancy, undertaken from a vantage point of a pre-existing knowledge base, gives PriViT an edge. B Supplementary graphics The following figure shows a graphical representation of the switching operation. 14 PriViT: Vision Transformers for Fast Private Inference A PREPRINT 200 197 127 s u l e G 100 0 PriViT w/o pretrain PriVit 41 1 1 1 1 6 1 5 1 6 1 6 1 4 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 10 11 12 Layer Index Figure 9: We compare the distribution of 208 GELU and 200 GELU operations distributed by PriViT w/o pretrain and PriViT respectively over tiny imagenet dataset. 600 591 PriViT w/o pretrain PriVit x a m t f o S 400 200 0 381 393 352 205 3 3 0 3 2 3 0 3 2 3 3 3 3 3 3 3 3 3 3 1 2 3 4 5 6 7 8 9 10 11 12 Layer Index Figure 10: We compare the distribution of 973 softmax operations and 998 softmax operations operations distributed by PriViT w/o pretrain and PriViT respectively over tiny imagenet dataset. Figure 11: Parameterized Gelu and Self-Attention operations. Top: Tokens undergo softmax and squared attention in training. Post-training, parameter S is frozen and binarized, selecting only one operation. Bottom: Embeddings pass through GeLU and Identity during training. Afterwards, parameter C is frozen and binarized, choosing a single operation. Search granularity. An important characteristic of PriViT is it's flexibility to search over different granularity of non-linearities. GELU is a pointwise functions, thus PriViT can search either at embedding level or at a token level. On the other hand, softmax is a token level operation, thus it cannot be broken into a finer search space. Note that softmax 15 PriViT: Vision Transformers for Fast Private Inference A PREPRINT operations can be extended to search over the head space or layer space, and similarly GELU can be searched over the layer space. Fig 12 illustrates the search granularity over token and embedding space. Figure 12: Left: The green blocks are SQUAREDATTENTION, and the grey blocks are Softmax Attention. For parametric attention, tokens emerge from a blend of softmax and square attention (refer to fig 11). Post-training, auxiliary variable S is set to 0 or 1, resulting in 2N ×H potential combinations per encoder block. Right: The green blocks are Identity function, and the grey blocks are GELU activation. Embeddings combine GELU and identity operations during training, as seen in fig 11. After training, parameter C is frozen and binarized. This yields potential combinations of either 2H×N or 2N ×H×m for each ViT encoder block. Note that GELU being a pointwise function, we possess the flexibility to expand our search space either to tokens or directly to individual embeddings. C PriViT Algorithm We provide detailed pseudocode for PriViT here. Figure 13: Left: Step 1 - Fine-tuning of a pretrained ViT over target dataset to produce the 'teacher ViT'. Middle: Step 2 - Duplicate teacher ViT, introduce parametric GELUs and attention mask to form 'student ViT'. Train using cross-entropy loss, KL divergence, and L1 penalty to gradually find a sparse mask. Binarize the mask post desired non- linearity budget. Right: Step 3 - With a frozen, binarized mask, further fine-tune the student model using cross-entropy loss and KL divergence with the teacher. 16 PriViT: Vision Transformers for Fast Private Inference A PREPRINT Algorithm 1 PRIVIT: Privacy Friendly ViT 1: Inputs: fW: pre-trained network, λs: Lasso coefficient for Softmax mask, λg: Lasso coefficient for GeLU mask, κ: scheduling factor, G: GeLU budget, S: Softmax budget, ε: threshold. end if if Lowest Softmax Count - Softmax Count < 200 and Sbudget = F alse then λs ← κ * λs. λg ← κ * λg. Update W via ADAM for one epoch. GeLU Count ← ∥1(C > ε)∥0 Softmax Count ← ∥1(S > ε)∥0 if Lowest GeLU Count - GeLU Count < 2 then 2: Set C = 1: same dimensions to all GeLU mask. 3: Set S = 1: same dimensions to all Attention Heads. 4: Set Cbudget = F alse: GeLU budget flag. 5: Set Sbudget = F alse: Softmax budget flag. 6: W ← (W, C, S) 7: Lowest GeLU Count ← ∥1(C > ε)∥0 8: Lowest Softmax Count ← ∥1(S > ε)∥0 9: while GeLU Count > G or Softmax Count > S do 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: end while end if if Lowest Softmax Count > Softmax Count then Lowest Softmax Count ← Softmax Count end if if Lowest GeLU Count > GeLU Count then Lowest GeLU Count ← GeLU Count end if if GeLU count <= G and Cbudget = F alse then end if if Softmax count <= S and Sbudget = F alse then C ← 1(C > ε) Cbudget = T rue W ← (W, S) S ← 1(S > ε) Sbudget = T rue W ← (W, C) end if D Latency benchmarks PriViT MPCViT TinyImagenet MPCViT CIFAR10/100 Function # ReluOps Function # ReluOps Function # ReluOps Softmax(197) Layernorm(192) GeLU(1) x2(197) 18586 6504 270 3248 ReLU Softmax(257) Layernorm(192) GeLU(1) 4428 6504 270 ReLU Softmax(65) Layernorm(256) GeLU(1) 1133 8614 270 Table 10: Non-linearity cost normalized to the cost of one ReluOp which is 1 ReLU operation over a scalar value. Bracket considers amortizing to a vector of inputs, e.g., a Layernorm(192) is an operation over a vector length of 192 is equivalent to 6504× than the cost of a ReLU. We conduct thorough benchmarking by creating GC circuits for the non-linearity functions found in ViT, and also benchmark specific functions used in MPCViT so as to enable us to compare the two methods under the same protocol DELPHI. In order to compare the different cost of non-linearity we bring them down to a common benchmark of ReluOps, where 1 ReluOp is the cost incurred for performing a GC evaluation of ReLU of one scalar value. Figure 14 shows how we count the non-linearity cost of softmax. The front and end consider Secret Sharing similar to Circa Ghodsi et al. (2021). Since the GC cost of each operation is known, we add them up as the final cost of softmax. 17 PriViT: Vision Transformers for Fast Private Inference A PREPRINT Figure 14: Detailed steps of benchmarking the non-linearity cost for softmax. Denominator is calculated once and reused for all indices of the vector. E Attention Variants Here we describe formally the different attention variant we ablated. Uniform form attention is basically described by the following equation UNIFORMATTN(X) = (1) N WvX, (7) Where N is the number of tokens, so for each token the attention weights are equal hence the name UniformAttention. ScaleAttn is the softmax candidate used in the work Zeng et al. (2022) which is essentially described as SCALEATTN(X) = (XWqWkX) N WvX, (8) 18 =add× nexp × nsum():add × (n-1)inverse():div × 1mul × nadd× n
http://arxiv.org/abs/2310.04598v1
"2023-10-06T21:31:17"
"2023-10-06T21:31:17"
A neuro-symbolic framework for answering conjunctive queries
The problem of answering logical queries over incomplete knowledge graphs is receiving significant attention in the machine learning community. Neuro-symbolic models are a promising recent approach, showing good performance and allowing for good interpretability properties. These models rely on trained architectures to execute atomic queries, combining them with modules that simulate the symbolic operators in queries. Unfortunately, most neuro-symbolic query processors are limited to the so-called tree-like logical queries that admit a bottom-up execution, where the leaves are constant values or anchors, and the root is the target variable. Tree-like queries, while expressive, fail short to express properties in knowledge graphs that are important in practice, such as the existence of multiple edges between entities or the presence of triangles. We propose a framework for answering arbitrary conjunctive queries over incomplete knowledge graphs. The main idea of our method is to approximate a cyclic query by an infinite family of tree-like queries, and then leverage existing models for the latter. Our approximations achieve strong guarantees: they are complete, i.e. there are no false negatives, and optimal, i.e. they provide the best possible approximation using tree-like queries. Our method requires the approximations to be tree-like queries where the leaves are anchors or existentially quantified variables. Hence, we also show how some of the existing neuro-symbolic models can handle these queries, which is of independent interest. Experiments show that our approximation strategy achieves competitive results, and that including queries with existentially quantified variables tends to improve the general performance of these models, both on tree-like queries and on our approximation strategy.
[ "Pablo Barceló", "Tamara Cucumides", "Floris Geerts", "Juan Reutter", "Miguel Romero" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04598v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04598v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.DB" ]
3 2 0 2 t c O 6 ] G L . s c [ 1 v 8 9 5 4 0 . 0 1 3 2 : v i X r a A neuro-symbolic framework for answering conjunctive queries A NEURO-SYMBOLIC FRAMEWORK FOR ANSWERING CONJUNCTIVE QUERIES Pablo Barcel ́o Institute for Mathematical and Computational Engineering Universidad Cat ́olica de Chile & IMFD Chile & CENIA Chile Juan Reutter Department of Computer Science, Institute for Mathematical and Computational Engineering Universidad Cat ́olica de Chile & IMFD Chile Miguel Romero Department of Computer Science Universidad Cat ́olica de Chile & CENIA Chile Tamara Cucumides & Floris Geerts Department of Computational Science University of Antwerp Antwerp, Belgium ABSTRACT The problem of answering logical queries over incomplete knowledge graphs is re- ceiving significant attention in the machine learning community. Neuro-symbolic models are a promising recent approach, showing good performance and allowing for good interpretability properties. These models rely on trained architectures to execute atomic queries, combining them with modules that simulate the sym- bolic operators in queries. Unfortunately, most neuro-symbolic query processors are limited to the so-called tree-like logical queries that admit a bottom-up exe- cution, where the leaves are constant values or anchors, and the root is the target variable. Tree-like queries, while expressive, fail short to express properties in knowledge graphs that are important in practice, such as the existence of multiple edges between entities or the presence of triangles. We propose a framework for answering arbitrary conjunctive queries over incom- plete knowledge graphs. The main idea of our method is to approximate a cyclic query by an infinite family of tree-like queries, and then leverage existing models for the latter. Our approximations achieve strong guarantees: they are complete, i.e. there are no false negatives, and optimal, i.e. they provide the best possible approximation using tree-like queries. Our method requires the approximations to be tree-like queries where the leaves are anchors or existentially quantified vari- ables. Hence, we also show how some of the existing neuro-symbolic models can handle these queries, which is of independent interest. Experiments show that our approximation strategy achieves competitive results, and that including queries with existentially quantified variables tends to improve the general performance of these models, both on tree-like queries and on our approximation strategy. 1 INTRODUCTION Knowledge graphs play a crucial role in representing knowledge within organizations and commu- nities. Their usage is now widespread both in industry and in the scientific community (Fensel et al., 2020; Hogan et al., 2021). Knowledge graphs model information as nodes, which represent entities of interest, and edges, that represent relations between entities. During the creation of knowledge graphs, however, information may be stale or conflicting, and certain sources of data may have not been integrated yet. As a consequence, knowledge graphs tend to be incomplete in the sense that some of the entities or relations occurring in the application domain may not be present in the graph. We refer to Ren et al. (2023) for statistics about missing information in knowledge graphs. A particularly important reasoning task on knowledge graphs is the answering of queries. Tra- ditional query answering methods, especially those from the data management and semantic web literature, focus on only extracting the information that can be derived from the knowledge present 1 A neuro-symbolic framework for answering conjunctive queries Figure 1: Different conjunctive queries (CQs) (a) atoms in anchored tree-like CQs are structured as trees where the leaves are anchors and the root the target variable (x in this case); (b) leaves in tree- like CQs can be anchors or existential varibles (w in this case); (c) arbitrary CQs can have cycles. in the graph (Angles et al., 2017; Hogan et al., 2021; Ali et al., 2022). Given the incomplete char- acter of knowledge graphs, these methods hence fail to address the need to reason about unknown information. This limits their usefulness in many application domains (Nickel et al., 2015). This observation has spurred the development of numerous machine learning approaches to query answering, e.g. Hamilton et al. (2018); Ren et al. (2019); Ren & Leskovec (2020); Zhang et al. (2021); Zhu et al. (2022). We focus on a recently proposed family of approaches, namely, the neuro-symbolic models. They rely on trained (e.g. neural) architectures to execute atomic queries, and combine them with modules that simulate the symbolic logical operators in queries. These approaches have shown promising performance and, more importantly, produce more interpretable models. We refer to Ren et al. (2023) for a comprehensive recent survey on neural and neuro- symbolic approaches for query answering over incomplete knowledge graphs. State-of-the-art neuro-symbolic approaches, however, only support a restricted class of queries, namely, anchored tree-like queries1 (Ren et al., 2023). Figure 1a shows an example of an anchored tree-like query. Although tree-like queries already capture interesting properties in graphs, they are not capable of checking more complex properties such as the existence of triangles or of multiple edges between entities. The development of neuro-symbolic approaches for more complex query classes remains largely unexplored. In particular, supporting cyclic queries, such as the triangle query, has been identified as an important open challenge by Ren et al. (2023). Figure 1c shows an example of a cyclic (triangle) query. In this paper we propose a neuro-symbolic framework for approximating complex queries by maximally leveraging methods for tree-like queries. More specifically, our contributions are as follows. (1) We propose an approximation scheme for complex conjunctive queries using tree-like queries. Moreover, the approximation scheme comes with theoretical guarantees: It is complete in the sense that no false negative query answers are produced. It is optimal in that we provide the best possible approximation using tree-like queries. (2) The approximation scheme is adaptive in the sense that it is parameterized by the notion of depth of tree-like queries. For any depth, an approximation exists and higher depth queries potentially provide better approximations. The choice of depth can be tuned depending on available resources, queries and data at hand. (3) Our approach is generic and can be used in combination with any neuro-symbolic query processor, provided that unanchored tree-like queries are supported. Figure 1b depicts an unanchored tree-like query in which the input node w is variable. As an independent contribution, we show how to go from anchored to (unanchored) tree-like queries in some neuro- symbolic methods. (4) We implemented our approach on top of the GNN-QE implementation by Zhu et al. (2022). Results show our techniques are a viable strategy for answering cyclic queries, and that our improvements can be carried over with little cost over this standard neuro-symbolic architecture. 1These queries are also referred simply as tree-like in the literature. We reserve the term tree-like for the generalization where the anchored condition is lifted. 2 yzxEmployeeEmployeeFriendFriendBankTechyzxEmployeeEmployeeFriendFriendTechwxyzCoworkerFriendFriendq(x)←E(w,y)∧E(Tech,z)∧F(y,x)∧F(z,x)q(x)←E(Bank,y)∧E(Tech,z)∧F(y,x)∧F(z,x)q(x)←F(x,y)∧F(y,z)∧C(z,x)(a) Anchored tree-like CQs(b) Tree-like CQs(c) Cyclic CQs A neuro-symbolic framework for answering conjunctive queries 2 RELATED WORK Neural and neuro-symbolic query answering. The machine learning community has produced a wide body of literature investigating how to answer complex queries over incomplete knowledge graphs. These works build on and extend recently successful methods desgined for knowledge graph completion (Bordes et al., 2013; Yang et al., 2015; Trouillon et al., 2016; Sun et al., 2019; Schlichtkrull et al., 2018; Vashishth et al., 2020; Teru et al., 2020). Following Ren et al. (2023), we can identify two different approaches to complex query answering. Firstly, neural approaches (Hamilton et al., 2018; Kotnis et al., 2021; Liu et al., 2022; Pflueger et al., 2022) answer queries by processing atomic queries and logical operators directly in the embedding space, parameterizing them with neural networks. These methods usually lead to better performance, but at the cost of being much less interpretable. Secondly, there are so-called neuro-symbolic approaches, which combine neural approaches to compute missing links between entities and symbolic approaches to extract answers from the completed data (Bai et al., 2023; Luo et al., 2023; Chen et al., 2022; Ren & Leskovec, 2020; Yin et al., 2023; Zhu et al., 2022). While logical operators are still processed in the latent space, they are biased to better correlate with their symbolic counterparts. We refer to Ren et al. (2023) for more details on the particular workings of each of these models. To our knowledge, none of these approaches deal with general CQs. Approximation of conjunctive queries. The notion of a tree-like approximation of a conjunctive query, as explored in this paper, was originally introduced by the database theory community. Two types of approximations were proposed: underapproximations, which yield sound but not necessar- ily complete answers (Barcel ́o et al., 2014), and overapproximations, which yield complete but not necessarily sound answers (Barcel ́o et al., 2020). For reasons explained above, in this work we focus on overapproximations, that is, complete approximations of conjunctive queries. The main distinc- tion between our work and previous research is the fact that tree-like approximations are evaluated using a neuro-symbolic approach. Additionally, we present the first working implementation of the concept of CQ approximation, as prior work had only examined its theoretical properties. Finally, previous works deal with a slighly different notion of tree-like, namely, treewidth-1 queries, and hence some refinements are needed to obtain our theoretical results. 3 PRELIMINARIES , G = ( ) where Knowledge graphs and conjunctive queries. Knowledge graphs are directed graphs with labeled edges. Formally, let Con be a countably infinite set of constants. A knowledge graph (KG) is a is a finite set of edge types, and Con is a finite set of entities, tuple , S R is a finite set of edges. We typically denote an edge (a, R, b) by R(a, b). S ⊆ E × R × E Let Var be a countably infinite set of variables. As is common in machine learning, we focus on unary queries, that is, queries with only one target variable. Formally, a (unary) conjunctive query (CQ) q over a set of edge types is a first-order logic (FO) formula of the form E ⊆ R E R q(x) R1(y1, z1) ← ∧ * * * ∧ Rm(ym, zm), where x is the target variable, each Ri(yi, zi) is an atom with Ri Var } ⊆ (yi, zi are either variables or constants). The variable set Var(q) of q is the set of variables appearing . Similarly, we denote by in the atoms of q, that is, the variables appearing in } Con(q) the constants appearing in the atoms of q. As usual, we assume x Var(q). The variables are the existentially quantified variables of q. Sometimes we write q(x) instead of q in Var(q) to emphasize that x is the target variable of q. The semantics of CQs is defined using the standard semantics of first-order logic. We denote by q( ∈ R y1, z1, . . . , ym, zm { ) the answer of the CQ q over the KG yi, zi { Con and \ { ∈ ∪ x } . Figure 1c shows the CQ q(x) x that have a friend y and a coworker z that are friends with each other. Here, Var(q) = is the target variable, and y and z are both existentially quantified. Coworker(z, x) looking for all persons , x } Friend(x, y) x, y, z { ← ∧ ∧ G Friend(y, z) G The query graph of a CQ q is the multigraph that has Var(q) ConOcc(q) as nodes, and an edge from node u to node v for every atom R(u, v) in q. Here ConOcc(q) is the set of occurrences of Con(q) is constants in q, i.e. if the number of occurrences in different atoms of q of a constant a k, then there are k duplicates of a in ConOcc(q). We say that a CQ q(x) with target variable x is ∈ ∪ 3 A neuro-symbolic framework for answering conjunctive queries tree-like if the query graph of q is an (undirected) tree rooted in node x. In particular, no multiple edges between pair of nodes are allowed. Additionally, q is anchored if all the leaves of this tree are nodes in ConOcc(q); otherwise it is unanchored. As we are working with ConOcc(q) instead of Con(q), different leaves could correspond to the same anchor. The depth of a tree-like CQ is the depth of the corresponding tree formed in its query graph, that is, the length of the longest path from the root to one of its leaves. Finally, q is cyclic if the query graph of q has an undirected cycle. Figure 1 contains examples of anchored tree-like, tree-like and cyclic conjunctive queries, depicted using their query graph. Notice that the unanchored query in Figure 1b was obtained by existentially quantifying one of the leaves of the query in Figure 1a. As we mentioned, most neuro-symbolic methods for logical query answering are restricted to an- chored tree-like queries. Notice that one could define tree-like queries for the full FO fragment. This is the fragment commonly dealt with in the literature, and our implementation also supports it. We refer to Ren et al. (2023); Yin et al. (2023) for the definitions. CQ containment. A concept we will exploit heavily is that of query containment. We say that a CQ q is contained in a CQ q′, denoted by q . That is, the answer q′, if q( of q is always contained in the answer of q′, independently of the underlying KG. While this notion reasons over all KGs, it admits a simple syntactic characterization based on homomorphisms. ), for all KGs q′( ⊆ ⊆ G G G ) A homomorphism from CQ q(x) to CQ q′(x) is a mapping h : Var(q) Con(q′) from the variables and constants of q to the variables and constants of q′ such that h(x) = x, Con(q), and R(h(y), h(z)) is an atom of q′, for all atoms R(y, z) of q. That is, h(a) = a for all a a homomorphism is a way of replacing the variables of q by variables of q′ such that each atom of q becomes an atom of q′. The target variable of q must be mapped to the target variable of q′. The following is a well-known characterization of CQ containment. Proposition 3.1 (Chandra & Merlin (1977)). A CQ q is contained in a CQ q′ if and only if there is a homomorphism from q′ to q. Var(q′) Con(q) → ∈ ∪ ∪ 4 ANSWERING CQS VIA TREE-LIKE APPROXIMATIONS We now present our framework for answering arbitrary CQs over incomplete KGs. The idea of our method is to approximate a cyclic CQ q by an infinite family 1 of tree-like CQs. As already mentioned, by doing so we can use state-of-the-art neuro-symbolic methods – only designed for tree-like queries – to deal with complex queries as well. The family q is parameterized by the query depth: each ̃qd is of depth d. By taking greater depths, we obtain better or equal approxima- tions in q provides us with the following formal guarantees: q. Interestingly, the family ̃qd { q = U U } ≥ d U • Completeness: CQs in U q are complete, that is, their answers always contain the answer of q. In other words, q is contained in each ̃qd and hence ̃qd does not produce false negatives. q is the best approximation (in a precise • Optimality: For each depth d 1, the CQ ̃qd U sense) among all the complete tree-like approximations of q with depth at most d. ∈ U ≥ This suggests the following neuro-symbolic method for answering complex queries: Take any neuro-symbolic method capable of answering tree-like queries. Then, given a CQ q, we answer q by q (the chosen depth D is a hyperparameter of our feeding one of its tree-like approximations ̃qD ∈ U model) to the chosen neuro-symbolic method. We thus leverage existing neuro-symbolic methods for anchored tree-like CQs, both for inference and learning. We remark that current methods work with anchored tree-like CQs, while our approach requires the use of (not necessarily anchored) tree-like CQs. We show in Section 4.3 how to remedy this but first formalize our approach. 4.1 COMPLETE TREE-LIKE APPROXIMATIONS Let q be an arbitrary CQ. A complete tree-like approximation of q is a tree-like CQ q′ that contains . q. That is, the answer q( G G We stress that the notion of completeness is particularly relevant for the setting of incomplete KGs. Indeed, we are given a CQ q and an (incomplete) KG ∗) for the unobservable complete KG ∗. As containment considers all possible KGs, the answer q′( ∗) of a complete approximation q′ must hence contain the sought answer set q( ) is always contained in the answer q′( and the goal is to obtain the answers q( ), independently of the KG ∗). G G G G G G 4 A neuro-symbolic framework for answering conjunctive queries Figure 2: A cyclic CQ q and three possible complete tree-like approximations. Best viewed in color. By Proposition 3.1, a tree-like CQ q′ is a complete approximation of q if there is a homomorphism from q′ to q. Of course, there could be many approximations for the same query. As an example, consider the triangle CQ q(x) Coworker(z, x) depicted in Figure 2. On the right of Figure 2, we can see three possible complete tree-like approximations for q. Indeed, . For q′3, q′1 and q′2 can be mapped to q via the homomorphism y, z z, x′ x (cid:55)→ (cid:55)→ (cid:55)→ } we can use the homomorphism . x, x2 (cid:55)→ z, x1 (cid:55)→ z, z2 (cid:55)→ } Actually, by taking longer paths, it is easy to get infinitely many approximations for q. Hence, the space of approximations may be infinite. This raises the question which approximation should we choose? We discuss this problem in the next section. x { y, y2 (cid:55)→ x, y (cid:55)→ y, z1 (cid:55)→ x, y1 (cid:55)→ Friend(x, y) Friend(y, z) x { (cid:55)→ ← ∧ ∧ x 4.2 COMPLETE OPTIMAL APPROXIMATIONS: UNRAVELINGS While the number of approximations is infinite, we show there are a special kind of approximations that are optimal in a precise sense, and hence are a natural choice to approximate the original CQ. Let q(x) be a CQ. A valid path of q(x) is a sequence x0, A1, x1, . . . , Ak, xk, for k 0, such that: ≥ • x0 = x, each xi • for each 1 i ≤ the atom), or R(xi, xi − = Ai+1, for each 1 • Ai ∈ ≤ Con(q), and each Ai is an atom of q. Var(q) k, the atom Ai is either of the form R(xi − 1) (a backward traversal of the atom). ∪ i < k. ≤ 1, xi) (a forward traversal of Intuitively, a valid path is a way of traversing the CQ q starting from the target variable x and sequentially moving through the atoms of q. We can visit the same variable, constant or atom several times. The only restriction is that an atom cannot be visited multiple times consecutively in the sequence. Hence, once an atom is traversed, we cannot go back via the same atom immediately. The length of a valid path is the number of atoms k. Note that the valid path of length 0 is well- defined and corresponds to the sequence x. A valid path is unanchored if it ends at a variable of q; otherwise, we say that it is anchored. For a valid path P , we denote by end(P ) Con(q) the element at the end of path P . A1 ∧ A3 in Figure 2, where A1 = Friend(x, y), A2 = Friend(y, z) Consider the CQ q(x) and A3 = Coworker(z, x). An example of an unanchored valid path is x, A1, y, A2, z, A3, x, which corresponds to a clockwise traversal of length 3 starting at x. The anticlockwise traversal of length 3 is given by the valid path x, A3, z, A2, y, A1, x. A2 ∧ Var(q) ← ∪ ∈ Now we are ready to define our optimal approximations. Let q(x) be a CQ. The unraveling of q(x) of depth d 1 is the tree-like CQ ̃qd(x) constructed as follows: ≥ • The variables of ̃qd correspond to the unanchored valid paths of q of length at most d. zP Formally, Var( ̃qd) := P unanchored valid path of q of length . d } ≤ • For valid paths P and P ′ = P, A′, end(P ′) of q of lengths ≤ if A′ = R(end(P ), end(P ′)) then ̃qd has an atom R(oP , oP ′), where oW = zW if W is unan- chored, and oW = end(W ) otherwise. If A′ = R(end(P ′), end(P )) then ̃qd has an atom R(oP ′, oP ). d, { | • The target variable x of ̃qd is zP0 , where P0 is the valid path of q of length 0. 5 xyzCoworkerFriendFriendq′ 2(x)←F(x,y)∧F(y,z)∧C(z,x′ )xyzx′ xyzx′ q(x)←F(x,y)∧F(y,z)∧C(z,x)q′ 1(x)←F(x′ ,y)∧F(y,z)∧C(z,x)q′ 3(x)←F(x,y1)∧F(y1,z1)∧C(z1,x1)∧F(x,y2)∧F(y2,z2)∧C(z2,x2)z2x2y2z1x1y1x̸ A neuro-symbolic framework for answering conjunctive queries Figure 3: Overview of our approach. We show unravelings until depth 4. The goal is to approximate the answer q( ∗) of q over the unobservable complete KG ∗. Best viewed in color. G G The idea is that the unraveling ̃qd(x) of depth d of q(x) is obtained by traversing q in a tree-like fashion, starting from the target variable x and moving from one variable to all of its neighbors, through the atoms of q. Every time we add fresh variables to the unraveling and hence this is actually a tree-like CQ. The tree traversal has depth d and is always restricted to valid paths (no immediate returns to the same atom). The leaves of the unraveling could be anchors or existentially quantified variables. The latter case is unavoidable in general and hence the need of working with (not necessarily anchored) tree-like CQs. Continuing the example from Figure 2, q′3 is the depth 3 unraveling of q. Note how the variables z1, y1, x1 of q′3 correspond to the valid paths (x, A3, z), (x, A3, z, A2, y), (x, A3, z, A2, y, A1, x). Sim- ilarly, the variables y2, z2, x2 correspond to (x, A1, y), (x, A1, y, A2, z), (x, A1, y, A2, z, A3, x). By definition, the unraveling ̃qd is a tree-like CQ. By inverting the "unraveling" process, we can obtain a homomorphism from ̃qd to q, and then ̃qd is always a complete tree-like approximation. ̃qd holds and hence the family 1 provides potentially better Also, we have that ̃qd+1 ⊆ q = U approximations as depth increases (q ̃q1). These properties are summarized in ̃q2 ⊆ the following proposition (see Appendix A for a formal proof). ̃q3 ⊆ ⊆ * * * ⊆ d } ̃qd { ≥ 1. The unraveling ̃qd is a complete tree-like approximation ̃qd holds. Proposition 4.1. Let q be a CQ and d of q. Moreover, ̃qd+1 ⊆ Interestingly, we can show that ̃qd is optimal in the following sense: Theorem 4.1. Let q be a CQ and d at most d. Then ̃qd q′ holds. ≥ ≥ ⊆ 1. Suppose q′ is a complete tree-like approximation of depth In particular, for any complete tree-like approximation q′ of q, there exists an unraveling ̃qd at least as good than q′ as an approximation of q, i.e. q q′. The proof idea of Theorem 4.1 is to turn ⊆ any homomorphism h from q′ to q into a homomorphism from q′ to ̃qd by analyzing the image of h on q. See Appendix A for complete details. Figure 2 shows the depth 3 unraveling ̃q3 = q′3 for q, and two additional depth 3 approximations q′1 and q′2. We see that q ̃q3 ⊆ ⊆ In conclusion, we have shown that the tree-like queries 1 satisfy the desired properties of completeness and optimality. Figure 3 shows an overview of our approach for the triangle query. We next show how to turn the theory into practice. q′1 and q ̃q3 ⊆ ̃qd { q = q′2. d } ̃qd ⊆ ⊆ U ≥ 4.3 A CONCRETE IMPLEMENTATION: GNN-QE ∃ One of the key strengths of our proposed approximation scheme is that it is generic. That is, it can be implemented on top of any neuro-symbolic query processing method, provided that the method is capable of dealing with (possibly unanchored) tree-like queries. This claim comes with a small caveat. As already mentioned, state-of-the-art methods deal with anchored tree-like queries (see also Ren et al. (2023)) and modifications are needed to support general tree-like queries. The challenge is to encode unanchored leaf nodes in tree-like queries in the latent space in which the encoding of anchored entities typically reside. Importantly, the encoding needs to simulate existential quantification in line with the semantics of unanchored leaf 6 xyzCoworkerFriendFriend⊆⊆⊆⊆⋯⋯CoworkeryxEmployeeFriendBank⊆⊆⊆⊆⋯⋯Cyclic CQsTree-like CQs<latexit sha1_base64="pGbtVN/lLuMJd7sD2e0FEdK5j3M=">AAACB3icbVDLSsNAFJ3UV62vqEtBBotQXZSkiLosutBlBfuAJobJZNIOnTycmQglZOfGX3HjQhG3/oI7/8ZJm4W2HrhwOOde7r3HjRkV0jC+tdLC4tLySnm1sra+sbmlb+90RJRwTNo4YhHvuUgQRkPSllQy0os5QYHLSNcdXeZ+94FwQaPwVo5jYgdoEFKfYiSV5Oj7EFqSMo+k95nTqFkBkkOMWHqV3aXH2ZGjV426MQGcJ2ZBqqBAy9G/LC/CSUBCiRkSom8asbRTxCXFjGQVKxEkRniEBqSvaIgCIux08kcGD5XiQT/iqkIJJ+rviRQFQowDV3Xmd4pZLxf/8/qJ9M/tlIZxIkmIp4v8hEEZwTwU6FFOsGRjRRDmVN0K8RBxhKWKrqJCMGdfniedRt08rZs3J9XmRRFHGeyBA1ADJjgDTXANWqANMHgEz+AVvGlP2ov2rn1MW0taMbML/kD7/AEKOpjL</latexit> ̃q2(G⇤)<latexit sha1_base64="lM3lRdyydjhxTY4qdNsSuHViMc4=">AAACB3icbVDLSsNAFJ3UV62vqEtBBotQXZRERV0WXeiygn1AE8NkMmmHTh7OTIQSsnPjr7hxoYhbf8Gdf+OkzUJbD1w4nHMv997jxowKaRjfWmlufmFxqbxcWVldW9/QN7faIko4Ji0csYh3XSQIoyFpSSoZ6cacoMBlpOMOL3O/80C4oFF4K0cxsQPUD6lPMZJKcvRdCC1JmUfS+8w5rlkBkgOMWHqV3aWH2YGjV426MQacJWZBqqBA09G/LC/CSUBCiRkSomcasbRTxCXFjGQVKxEkRniI+qSnaIgCIux0/EcG95XiQT/iqkIJx+rviRQFQowCV3Xmd4ppLxf/83qJ9M/tlIZxIkmIJ4v8hEEZwTwU6FFOsGQjRRDmVN0K8QBxhKWKrqJCMKdfniXto7p5WjdvTqqNiyKOMtgBe6AGTHAGGuAaNEELYPAInsEreNOetBftXfuYtJa0YmYb/IH2+QMLz5jM</latexit> ̃q3(G⇤)<latexit sha1_base64="UseQU5Aos9B20dIbaYlUG6Glifo=">AAAB/XicbVDLSsNAFL2pr1pf8bFzM1iE6qIkIuqy6EKXFewD2lgm00k7dPJwZiLUEPwVNy4Ucet/uPNvnLRZaPXAwOGce7lnjhtxJpVlfRmFufmFxaXicmlldW19w9zcasowFoQ2SMhD0XaxpJwFtKGY4rQdCYp9l9OWO7rI/NY9FZKFwY0aR9Tx8SBgHiNYaaln7iB0V+n6WA0J5sllepscpgc9s2xVrQnQX2LnpAw56j3zs9sPSezTQBGOpezYVqScBAvFCKdpqRtLGmEywgPa0TTAPpVOMkmfon2t9JEXCv0ChSbqz40E+1KOfVdPZjnlrJeJ/3mdWHlnTsKCKFY0INNDXsyRClFWBeozQYniY00wEUxnRWSIBSZKF1bSJdizX/5LmkdV+6RqXx+Xa+d5HUXYhT2ogA2nUIMrqEMDCDzAE7zAq/FoPBtvxvt0tGDkO9vwC8bHNza6lHA=</latexit>q(G⇤)<latexit sha1_base64="UseQU5Aos9B20dIbaYlUG6Glifo=">AAAB/XicbVDLSsNAFL2pr1pf8bFzM1iE6qIkIuqy6EKXFewD2lgm00k7dPJwZiLUEPwVNy4Ucet/uPNvnLRZaPXAwOGce7lnjhtxJpVlfRmFufmFxaXicmlldW19w9zcasowFoQ2SMhD0XaxpJwFtKGY4rQdCYp9l9OWO7rI/NY9FZKFwY0aR9Tx8SBgHiNYaaln7iB0V+n6WA0J5sllepscpgc9s2xVrQnQX2LnpAw56j3zs9sPSezTQBGOpezYVqScBAvFCKdpqRtLGmEywgPa0TTAPpVOMkmfon2t9JEXCv0ChSbqz40E+1KOfVdPZjnlrJeJ/3mdWHlnTsKCKFY0INNDXsyRClFWBeozQYniY00wEUxnRWSIBSZKF1bSJdizX/5LmkdV+6RqXx+Xa+d5HUXYhT2ogA2nUIMrqEMDCDzAE7zAq/FoPBtvxvt0tGDkO9vwC8bHNza6lHA=</latexit>q(G⇤)<latexit sha1_base64="WMl63flrj0Ff3HABfk0QY4EzpcE=">AAACB3icbVDLSsNAFJ3UV62vqEtBBotQXZREirosutBlBfuAJobJZNIOnTycmQglZOfGX3HjQhG3/oI7/8ZJm4W2HrhwOOde7r3HjRkV0jC+tdLC4tLySnm1sra+sbmlb+90RJRwTNo4YhHvuUgQRkPSllQy0os5QYHLSNcdXeZ+94FwQaPwVo5jYgdoEFKfYiSV5Oj7EFqSMo+k95nTqFkBkkOMWHqV3aXH2ZGjV426MQGcJ2ZBqqBAy9G/LC/CSUBCiRkSom8asbRTxCXFjGQVKxEkRniEBqSvaIgCIux08kcGD5XiQT/iqkIJJ+rviRQFQowDV3Xmd4pZLxf/8/qJ9M/tlIZxIkmIp4v8hEEZwTwU6FFOsGRjRRDmVN0K8RBxhKWKrqJCMGdfniedk7p5WjdvGtXmRRFHGeyBA1ADJjgDTXANWqANMHgEz+AVvGlP2ov2rn1MW0taMbML/kD7/AENZJjN</latexit> ̃q4(G⇤)<latexit sha1_base64="WMl63flrj0Ff3HABfk0QY4EzpcE=">AAACB3icbVDLSsNAFJ3UV62vqEtBBotQXZREirosutBlBfuAJobJZNIOnTycmQglZOfGX3HjQhG3/oI7/8ZJm4W2HrhwOOde7r3HjRkV0jC+tdLC4tLySnm1sra+sbmlb+90RJRwTNo4YhHvuUgQRkPSllQy0os5QYHLSNcdXeZ+94FwQaPwVo5jYgdoEFKfYiSV5Oj7EFqSMo+k95nTqFkBkkOMWHqV3aXH2ZGjV426MQGcJ2ZBqqBAy9G/LC/CSUBCiRkSom8asbRTxCXFjGQVKxEkRniEBqSvaIgCIux08kcGD5XiQT/iqkIJJ+rviRQFQowDV3Xmd4pZLxf/8/qJ9M/tlIZxIkmIp4v8hEEZwTwU6FFOsGRjRRDmVN0K8RBxhKWKrqJCMGdfniedk7p5WjdvGtXmRRFHGeyBA1ADJjgDTXANWqANMHgEz+AVvGlP2ov2rn1MW0taMbML/kD7/AENZJjN</latexit> ̃q4(G⇤)<latexit sha1_base64="lM3lRdyydjhxTY4qdNsSuHViMc4=">AAACB3icbVDLSsNAFJ3UV62vqEtBBotQXZRERV0WXeiygn1AE8NkMmmHTh7OTIQSsnPjr7hxoYhbf8Gdf+OkzUJbD1w4nHMv997jxowKaRjfWmlufmFxqbxcWVldW9/QN7faIko4Ji0csYh3XSQIoyFpSSoZ6cacoMBlpOMOL3O/80C4oFF4K0cxsQPUD6lPMZJKcvRdCC1JmUfS+8w5rlkBkgOMWHqV3aWH2YGjV426MQacJWZBqqBA09G/LC/CSUBCiRkSomcasbRTxCXFjGQVKxEkRniI+qSnaIgCIux0/EcG95XiQT/iqkIJx+rviRQFQowCV3Xmd4ppLxf/83qJ9M/tlIZxIkmIJ4v8hEEZwTwU6FFOsGQjRRDmVN0K8QBxhKWKrqJCMKdfniXto7p5WjdvTqqNiyKOMtgBe6AGTHAGGuAaNEELYPAInsEreNOetBftXfuYtJa0YmYb/IH2+QMLz5jM</latexit> ̃q3(G⇤)<latexit sha1_base64="pGbtVN/lLuMJd7sD2e0FEdK5j3M=">AAACB3icbVDLSsNAFJ3UV62vqEtBBotQXZSkiLosutBlBfuAJobJZNIOnTycmQglZOfGX3HjQhG3/oI7/8ZJm4W2HrhwOOde7r3HjRkV0jC+tdLC4tLySnm1sra+sbmlb+90RJRwTNo4YhHvuUgQRkPSllQy0os5QYHLSNcdXeZ+94FwQaPwVo5jYgdoEFKfYiSV5Oj7EFqSMo+k95nTqFkBkkOMWHqV3aXH2ZGjV426MQGcJ2ZBqqBAy9G/LC/CSUBCiRkSom8asbRTxCXFjGQVKxEkRniEBqSvaIgCIux08kcGD5XiQT/iqkIJJ+rviRQFQowDV3Xmd4pZLxf/8/qJ9M/tlIZxIkmIp4v8hEEZwTwU6FFOsGRjRRDmVN0K8RBxhKWKrqJCMGdfniedRt08rZs3J9XmRRFHGeyBA1ADJjgDTXANWqANMHgEz+AVvGlP2ov2rn1MW0taMbML/kD7/AEKOpjL</latexit> ̃q2(G⇤)<latexit sha1_base64="kKJZjj9cG1DFRyuDg5zmK4Khdwg=">AAACB3icbVDLSsNAFJ3UV62vqEtBBotQXZRERF0WXeiygn1AE8NkMm2HTiZxZiKUkJ0bf8WNC0Xc+gvu/BsnbRZaPXDhcM693HuPHzMqlWV9GaW5+YXFpfJyZWV1bX3D3NxqyygRmLRwxCLR9ZEkjHLSUlQx0o0FQaHPSMcfXeR+554ISSN+o8YxcUM04LRPMVJa8sxdCB1FWUDSu8yza06I1BAjll5mt+lhduCZVatuTQD/ErsgVVCg6ZmfThDhJCRcYYak7NlWrNwUCUUxI1nFSSSJER6hAelpylFIpJtO/sjgvlYC2I+ELq7gRP05kaJQynHo6878Tjnr5eJ/Xi9R/TM3pTxOFOF4uqifMKgimIcCAyoIVmysCcKC6lshHiKBsNLRVXQI9uzLf0n7qG6f1O3r42rjvIijDHbAHqgBG5yCBrgCTdACGDyAJ/ACXo1H49l4M96nrSWjmNkGv2B8fAMIpZjK</latexit> ̃q1(G⇤)<latexit sha1_base64="kKJZjj9cG1DFRyuDg5zmK4Khdwg=">AAACB3icbVDLSsNAFJ3UV62vqEtBBotQXZRERF0WXeiygn1AE8NkMm2HTiZxZiKUkJ0bf8WNC0Xc+gvu/BsnbRZaPXDhcM693HuPHzMqlWV9GaW5+YXFpfJyZWV1bX3D3NxqyygRmLRwxCLR9ZEkjHLSUlQx0o0FQaHPSMcfXeR+554ISSN+o8YxcUM04LRPMVJa8sxdCB1FWUDSu8yza06I1BAjll5mt+lhduCZVatuTQD/ErsgVVCg6ZmfThDhJCRcYYak7NlWrNwUCUUxI1nFSSSJER6hAelpylFIpJtO/sjgvlYC2I+ELq7gRP05kaJQynHo6878Tjnr5eJ/Xi9R/TM3pTxOFOF4uqifMKgimIcCAyoIVmysCcKC6lshHiKBsNLRVXQI9uzLf0n7qG6f1O3r42rjvIijDHbAHqgBG5yCBrgCTdACGDyAJ/ACXo1H49l4M96nrSWjmNkGv2B8fAMIpZjK</latexit> ̃q1(G⇤) A neuro-symbolic framework for answering conjunctive queries nodes. We here describe how this can be done in fuzzy-based neuro-symbolic approaches such as Chen et al. (2022); Zhu et al. (2022), leaving the extension of other approaches to future work. Our implementation is based on GNN-QE by Zhu et al. (2022), a neuro-symbolic architecture that processes anchored tree-like queries in a bottom-up fashion. Anchored leaf nodes are encoded as one-hot vectors in latent space, and edges between entities are processed using an adaptation of the NBFNet graph neural network (Zhu et al., 2021). In each step, a probabilistic vector over entities is obtained, indicating the likelihood of an edge to those entities. Intuitively, the knowledge graph is completed by these edge predictions. Finally, the probability vectors are combined using operations that simulate logical operations. For example, for the query in Figure 1a, a one-hot vector encoding anchor "Tech" is transformed through the Employee edge into a vector indicating the probability that someone (entity) works in Tech. Following this reasoning, we encode unanchored leaf nodes as full unitary vectors (that is, a vector consisting of all ones). Such a vector indeed gives equal probability to every entity hereby simulating existential quantification. For example, to answer a query such as the one in Figure 1b, we encode the w node by the full unitary vector, the anchor node "Tech" remains encoded as before. We then process these vectors as in GNN-QE. We denote our extension by GNN-QE. Since it can deal with general tree-like queries, we can use it alongside our approximation scheme. In the next section we report how well everything works in practice. ∃ 5 EXPERIMENTS We set up our experimental evaluation to address the following questions. The first two questions relate to our support for general (not necessarily anchored) tree-like queries. (Q1) What is the effect on the performance of answering anchored tree-like queries when the training set includes unanchored tree-like queries as well? (Q2) Similarly, what is the effect on the performance of answering general tree-like queries? Looking ahead, as a contribution of independent interest, our results indicate that we can support general tree like queries (Q2) with little or no negative impact for both anchored tree-like queries (Q1). This gives us ground to suggest that general tree-like queries should become default members in training and testing sets of future neuro-symbolic architectures. Our third question relates to our approximation scheme. (Q3) What is the performance of our approximation scheme in answering cyclic queries? And related, how does this depend on the chosen depth of the unraveling? Looking ahead, our results show that unravellings can be used to answer cyclic queries: the metrics obtained for our suite of cyclic test queries are competitive, albeit slightly weaker, with similar metrics obtained by recent approaches for complex tree-like queries involving unions and negations of atoms. We thus validate the potential of our approach and promote it to become a competitive standard for future algorithms dealing with complex query types. 5.1 EXPERIMENTAL SETUP We perform our evaluation on the commonly used knowledge graphs FB15k-237 (Toutanova & Chen, 2015), FB15k (Bordes et al., 2013) and NELL995 (Xiong et al., 2017) with their official train- ing/validation/testing split. With regards to methods, as baseline we use GNN-QE, trained following the specifications of Zhu et al. (2022). That is, it is trained using the queries generated by BetaE (Ren & Leskovec, 2020), consisting of 10 tree-like query types, including queries featuring union and negation (1p/2p/3p/2i/3i/2in/3in/inp/pni/pin). For our method2 GNN-QE we additionally pro- vide a new set of training, validation and test queries without anchors and unravelings of cyclic queries alongside with their corresponding answers for FB15k-237, FB15k and NELL995. These queries adhere to the same query types as before, except they are not anchored. In order to ensure a fair comparison, we trained GNN-QE keeping the training parameters identical to those used for GNN-QE, but including queries without anchors. Details and statistics of both the new query set and the training can be found in the Appendix B. Metrics of GNN-QE are taken from its original paper by Zhu et al. (2022). Specifically, we report the mean reciprocal rank (mrr) of the predicted ∃ ∃ 2Code is available at https://anonymous.4open.science/r/exists-gnn-qe-8A7C/ 7 A neuro-symbolic framework for answering conjunctive queries Table 1: Mean reciprocal rank and spearman rank correlation on test BetaE queries. Results of GNN-QE are taken from (Zhu et al. (2022)). Other metrics can be found in Appendix C Metric Model 1p 2p 3p 2i 3i spearmanr mrr spearmanr mrr GNN-QE 0.948 GNN-QE 0.977 0.428 GNN-QE 0.321 ∃ GNN-QE ∃ GNN-QE 0.958 GNN-QE 0.951 0.885 GNN-QE 0.855 ∃ GNN-QE ∃ 0.951 0.966 0.147 0.107 0.970 0.829 0.693 0.688 0.895 0.942 0.118 0.096 0.940 0.714 0.587 0.587 0.992 0.992 0.383 0.339 0.984 0.971 0.797 0.801 ip FB15k-237 0.937 0.898 0.189 0.147 FB15k 0.916 0.650 0.704 0.620 0.970 0.975 0.541 0.501 0.927 0.944 0.835 0.833 pi 2in 3in inp pin pni 2u up 0.911 0.943 0.311 0.268 0.936 0.808 0.699 0.720 0.981 0.990 0.100 0.063 0.980 0.985 0.447 0.430 0.968 0.981 0.168 0.139 0.907 0.974 0.417 0.418 0.864 0.853 0.093 0.080 0.905 0.843 0.420 0.403 0.880 0.933 0.072 0.053 0.944 0.821 0.301 0.302 0.987 0.989 0.078 0.048 0.978 0.967 0.343 0.340 - 0.979 0.162 0.119 - 0.995 0.741 0.747 - 0.968 0.134 0.103 - 0.939 0.610 0.600 Table 2: Mean reciprocal rank and spearman rank correlation on test unanchored queries. Results of GNN-QE were obtained through our adaptation. Other metrics can be found in Appendix C.2 Metric Model 1p 2p 3p 2i spearmanr mrr spearmanr mrr GNN-QE 0.629 GNN-QE 0.901 0.007 GNN-QE 0.035 ∃ GNN-QE ∃ GNN-QE 0.647 GNN-QE 0.924 0.112 GNN-QE 0.228 ∃ GNN-QE ∃ 0.899 0.975 0.081 0.089 0.706 0.789 0.387 0.434 0.865 0.963 0.087 0.083 0.657 0.660 0.457 0.496 0.966 0.993 0.221 0.222 0.921 0.957 0.685 0.613 3i pi ip No Anchor FB15k-237 0.894 0.932 0.970 0.965 0.948 0.986 0.164 0.108 0.295 0.294 0.160 0.099 No Anchor FB15k 0.791 0.894 0.539 0.959 0.571 0.686 0.579 0.718 0.816 0.803 0.533 0.572 2in 3in inp pin pni 2u up 0.811 0.979 0.020 0.029 0.884 0.964 0.109 0.190 0.802 0.972 0.105 0.105 0.787 0.971 0.283 0.325 0.651 0.815 0.063 0.067 0.648 0.804 0.240 0.269 0.711 0.927 0.036 0.040 0.752 0.824 0.152 0.189 0.893 0.984 0.022 0.027 0.878 0.967 0.102 0.158 0.553 0.879 0.029 0.067 0.869 0.967 0.131 0.292 0.937 0.983 0.078 0.092 0.852 0.897 0.421 0.455 answer set (compared with the ground truth), and the Spearman correlation rank (spearmanr) be- tween the total number of answers predicted and the number of answers in the ground truth. We report the remaining metrics used in Zhu et al. (2022) in Appendix B. Results are measured only against GNN-QE, see their original paper for comparison against other methods. 5.2 RESULTS In our first batch of experiments we investigate the effect of training Anchored tree-like queries. with unanchored queries on the performance on the original anchored BetaE queries (Q1). We com- GNN-QE on anchored queries on our datasets. Importantly, pare the performance of GNN-QE and GNN-QE is as mentioned already, GNN-QE is trained using the original BetaE queries, whereas trained using additional unanchored BetaE queries. In Table 1 we report the results. ∃ ∃ The experiments show that training with unanchored queries ( GNN-QE) results in a slight decrease in the mean reciprocal rank metric, and a slight increase in the spearman's rank correlation. We note that we failed to replicate the original numbers obtained in Zhu et al. (2022), so some of these differences may also be due to differences in training hardware. All in all, we see we are either paying a small price, or none at all, in order to enable a much more expressive class of queries. Note that the set of queries with best comparative performance is in queries with negation: this is according to our expectations, as negating a small set of entities results in dealing with large number of entities, just as in unanchored entry points. ∃ Tree-like queries. Our second batch of results relates to enabling treatment of tree-like queries without anchors (Q2). While less interesting, we can also measure the effect of training with queries without anchors. In order to do this, we maintain weights computed by GNN-QE, but enable the processing of relation-projection that is non-anchored. Table 2 shows the results of both GNN-QE and GNN-QE over the original test set of our benchmark databases. Results, as expected, suggest that training for this type of queries has a drastic increase in performance in all metrics. ∃ Cyclic Queries. Next we move to cyclic queries, computed through their unravelings (Q3). Be- cause our method relies on approximating the ground truth, we do not train for these types of queries, but rather try them directly in the trained models. To this extent, we construct a new test set for cyclic queries with 2 query-types: triangles, and squares (see Appendix B for more details). 8 A neuro-symbolic framework for answering conjunctive queries Figure 4: Mean reciprocal rank test results for different depths of unravelings for the triangle query. Figure 5: Spearman rank correlation test results for different depths of unravelings for the trian- gle query. Table 3: Spearman's rank correlation and reciprocal ranking scores of unravelings of depths 3 and 4 for the triangle query. GNN-QE model across ∃ Triangle mrr sp 3 4 3 4 FB15k-237 FB15k NELL 0.207 0.138 0.206 0.136 0.516 0.816 0.439 0.801 0.354 0.359 0.716 0.721 Since our unravelings are parameterized by depth, before trying our all query shapes we tuned this parameter with an exploratory analysis for triangles and squares on FB15k-237. Here we are interested in maxing out the spearman correlation rank, because the choice of depth incides directly on the number of answers returned by each query. The result of this analysis for the triangle are shown in Figures 4 and 5. Further results can be found in Appendix C. As we see, deeper unravelings appear to improve, but there seems to be a point after which this effect starts to be cancelled out by natural imprecisions of the trained model. This is evident when we analyze both the mean reciprocal rank (MRR) and the Spearman correlation. While the MRR tends to show slight improvements after a depth of 3, the Spearman correlation starts to diminish or worsen beyond that point. Hence, the remaining results (see Table 3) are reported for unravelings at depths 3 and 4 for triangles on all datasets. Notice that the metrics reported here are comparable to what state-of-the art architectures such as GNN-QE report for complex tree-like queries (see e.g. results for query type combining paths and intersection). We believe that our approximation scheme thus proves as a valid approach for allowing arbitrary CQs on neuro-symbolic architectures. Remaining results can be found on Appendix C. 6 FUTURE WORK In this work, we present an approach to approximate the answers to arbitrary CQs over incomplete knowledge graphs by applying the mature toolbox developed for answering tree-like CQs. As for future work, we plan on expanding other neuro-symbolic architecture with the ability to deal with unanchored queries, so that we can also implement our approach in these architectures. While this approximation is cost-efficient, it can affect the quality of the retrieved answers. In fact, overapprox- imations may return answers that are not necessarily sound, even when the data is complete. One of our main goals for future work is to develop neuro-symbolic methods for CQs on knowledge graphs that return exact answers when evaluated on complete data. This process can be computationally de- manding, but over the last decade, worst-case optimal algorithms have been developed for retrieving such answers in a symbolic manner (Ngo et al., 2013). We plan to investigate how such algorithms can be integrated into the neuro-symbolic framework studied in this paper to provide high-quality answers in a context where data is considered incomplete. Another important issue we aim to address is determining the appropriate semantics for evaluating CQs over incomplete knowledge graphs. Neural approaches for completing knowledge graphs of- 9 A neuro-symbolic framework for answering conjunctive queries ten produce a probability or score that indicates the likelihood of a link's existence between two given entities. This places us in the realm of probabilistic data. The data management commu- nity has long been studying how queries over probabilistic data should be interpreted (Suciu et al., 2011). We believe it is important to understand how this semantics aligns with the one used in the neuro-symbolic evaluation of tree-like CQs and how the techniques employed to approximate the probabilistic evaluation of CQs can be used in our setting. REFERENCES Waqas Ali, Muhammad Saleem, Bin Yao, Aidan Hogan, and Axel-Cyrille Ngonga Ngomo. A survey of RDF stores & SPARQL engines for querying knowledge graphs. The VLDB Journal, 31, 2022. URL https://doi.org/10.1007/s00778-021-00711-3. Renzo Angles, Marcelo Arenas, Pablo Barcel ́o, Aidan Hogan, Juan Reutter, and Domagoj Vrgoˇc. Foundations of modern query languages for graph databases. ACM Comput. Surv., 50(5), 2017. URL https://doi.org/10.1145/3104031. Yushi Bai, Xin Lv, Juanzi Li, and Lei Hou. Answering complex logical queries on knowledge graphs via query computation tree optimization. In International Conference on Machine Learn- ing (ICML), volume 202 of Proceedings of Machine Learning Research, pp. 1472–1491, 2023. URL https://proceedings.mlr.press/v202/bai23b.html. Pablo Barcel ́o, Leonid Libkin, and Miguel Romero. Efficient approximations of conjunctive queries. SIAM J. Comput., 43(3):1085–1130, 2014. URL https://doi.org/10.1137/1309117. Pablo Barcel ́o, Miguel Romero, and Thomas Zeume. A more general theory of static approximations for conjunctive queries. Theory of Computing Systems, 64(5):916–964, 2020. URL https: //doi.org/10.1007/s00224-019-09924-0. Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Translating embeddings and Oksana In Ad- Yakhnenko. vances in Neural Information Processing Systems (NEURIPS), volume 26, 2013. URL https://proceedings.neurips.cc/paper_files/paper/2013/file/ 1cecc7a77928ca8133fa24680a88d2f9-Paper.pdf. for modeling multi-relational data. Jason Weston, Ashok K. Chandra and Philip M. Merlin. Optimal implementation of conjunctive queries in rela- tional data bases. In Proceedings of the ACM Symposium on Theory of Computing (STOC), pp. 77–90, 1977. URL https://doi.org/10.1145/800105.803397. Xuelu Chen, Ziniu Hu, and Yizhou Sun. Fuzzy logic based logical query answering on knowledge graphs. Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), 36(4):3939–3948, 2022. URL https://doi.org/10.1609/aaai.v36i4.20310. Dieter Fensel, Umutcan S ̧ ims ̧ek, Kevin Angele, Elwin Huaman, Elias K ̈arle, Oleksandra Pana- siuk, Ioan Toma, J ̈urgen Umbrich, and Alexander Wahler. Knowledge Graphs - Methodol- ogy, Tools and Selected Use Cases. Springer, 2020. URL https://doi.org/10.1007/ 978-3-030-37439-6. William L. Hamilton, Payal Bajaj, Marinka Zitnik, Dan Jurafsky, and Jure Leskovec. Embedding In Advances in Neural Information Processing Systems logical queries on knowledge graphs. (NEURIPS), volume 31, pp. 2030–2041, 2018. URL https://proceedings.neurips. cc/paper/2018/hash/ef50c335cca9f340bde656363ebd02fd-Abstract. html. Aidan Hogan, Eva Blomqvist, Michael Cochez, Claudia d'Amato, Gerard de Melo, Claudio Gutier- rez, Sabrina Kirrane, Jos ́e Emilio Labra Gayo, Roberto Navigli, Sebastian Neumaier, Axel- Cyrille Ngonga Ngomo, Axel Polleres, Sabbir M. Rashid, Anisa Rula, Lukas Schmelzeisen, Juan Sequeda, Steffen Staab, and Antoine Zimmermann. Knowledge Graphs. Synthesis Lec- tures on Data, Semantics, and Knowledge. Morgan & Claypool Publishers, 2021. URL https: //doi.org/10.2200/S01125ED1V01Y202109DSK022. 10 A neuro-symbolic framework for answering conjunctive queries Bhushan Kotnis, Carolin Lawrence, and Mathias Niepert. Answering complex queries in knowledge graphs with bidirectional sequence encoders. Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), 35(6):4968–4977, 2021. URL https://doi.org/10.1609/aaai. v35i6.16630. Xiao Liu, Shiyu Zhao, Kai Su, Yukuo Cen, Jiezhong Qiu, Mengdi Zhang, Wei Wu, Yuxiao Dong, and Jie Tang. Mask and reason: Pre-training knowledge graph transformers for complex log- In Proceedings of the ACM SIGKDD Conference on Knowledge Discovery and ical queries. Data Mining (KDD), pp. 1120–1130, 2022. URL https://doi.org/10.1145/3534678. 3539472. Haoran Luo, E Haihong, Yuhao Yang, Gengxian Zhou, Yikai Guo, Tianyu Yao, Zichen Tang, Xueyuan Lin, and Kaiyang Wan. NQE: N-ary query embedding for complex query answer- ing over hyper-relational knowledge graphs. Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), 37(4):4543–4551, 2023. URL https://doi.org/10.1609/aaai. v37i4.25576. Hung Q. Ngo, Christopher R ́e, and Atri Rudra. Skew strikes back: new developments in the theory of join algorithms. SIGMOD Rec., 42(4):5–16, 2013. URL https://doi.org/10.1145/ 2590989.2590991. Maximilian Nickel, Kevin Murphy, Volker Tresp, and Evgeniy Gabrilovich. A review of relational machine learning for knowledge graphs. Proceedings of the IEEE, 104(1):11–33, 2015. URL https://doi.org/10.1109/JPROC.2015.2483592. Maximilian Pflueger, David J Tena Cucala, and Egor V Kostylev. GNNQ: A neuro-symbolic In International Seman- approach to query answering over incomplete knowledge graphs. tic Web Conference (ISWC), pp. 481–497, 2022. URL https://doi.org/10.1007/ 978-3-031-19433-7_28. Hongyu Ren and Jure Leskovec. Beta embeddings for multi-hop logical reasoning in knowl- In Advances in Neural Information Processing Systems (NEURIPS), volume 33, edge graphs. pp. 19716–19726, 2020. URL https://proceedings.neurips.cc/paper/2020/ hash/e43739bba7cdb577e9e3e4e42447f5a5-Abstract.html. Hongyu Ren, Weihua Hu, and Jure Leskovec. Query2box: Reasoning over knowledge graphs in vector space using box embeddings. In International Conference on Learning Representations (ICLR), 2019. URL https://openreview.net/forum?id=BJgr4kSFDS. Hongyu Ren, Mikhail Galkin, Michael Cochez, Zhaocheng Zhu, and Jure Leskovec. Neural graph reasoning: Complex logical query answering meets graph databases. CoRR, abs/2303.14617, 2023. URL https://doi.org/10.48550/arXiv.2303.14617. Michael Sejr Schlichtkrull, Thomas N. Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, and Max Welling. Modeling relational data with graph convolutional networks. In European Semantic Web Conference (ESWC), volume 10843 of Lecture Notes in Computer Science, pp. 593–607. Springer, 2018. URL https://doi.org/10.1007/978-3-319-93417-4_38. Dan Suciu, Dan Olteanu, Christopher R ́e, and Christoph Koch. Probabilistic Databases. Synthesis Lectures on Data Management. Morgan & Claypool Publishers, 2011. URL https://doi. org/10.2200/S00362ED1V01Y201105DTM016. Zhiqing Sun, Zhi-Hong Deng, Jian-Yun Nie, and Jian Tang. Rotate: Knowledge graph embedding by relational rotation in complex space. In International Conference on Learning Representations (ICLR), 2019. URL https://openreview.net/forum?id=HkgEQnRqYQ. Komal K. Teru, Etienne G. Denis, and William L. Hamilton. Inductive relation prediction by In Proceedings of the International Conference on Machine Learning subgraph reasoning. (ICML), volume 119 of Proceedings of Machine Learning Research, pp. 9448–9457, 2020. URL http://proceedings.mlr.press/v119/teru20a.html. Kristina Toutanova and Danqi Chen. Observed versus latent features for knowledge base and text in- ference. In Proceedings of the 3rd workshop on continuous vector space models and their compo- sitionality (CVSC), pp. 57–66, 2015. URL https://doi.org/10.18653/v1/W15-4007. 11 A neuro-symbolic framework for answering conjunctive queries Th ́eo Trouillon, Johannes Welbl, Sebastian Riedel, ́Eric Gaussier, and Guillaume Bouchard. Com- plex embeddings for simple link prediction. In Proceedings of the International Conference on International Conference on Machine Learning (ICML), volume 48 of Proceedings of Machine Learning Research, pp. 2071–2080, 2016. URL http://proceedings.mlr.press/ v48/trouillon16.html. Shikhar Vashishth, Soumya Sanyal, Vikram Nitin, and Partha P. Talukdar. Composition-based multi- relational graph convolutional networks. In International Conference on Learning Representa- tions (ICLR), 2020. URL https://openreview.net/forum?id=BylA_C4tPr. Wenhan Xiong, Thien Hoang, and William Yang Wang. DeepPath: A reinforcement learn- In Proceedings of the Conference on Empiri- ing method for knowledge graph reasoning. cal Methods in Natural Language Processing (EMNLP), pp. 564–573, 2017. URL https: //doi.org/10.18653/v1/d17-1060. Bishan Yang, Wen-tau Yih, Xiaodong He, Jianfeng Gao, and Li Deng. Embedding entities and relations for learning and inference in knowledge bases. In International Conference on Learning Representations (ICLR), 2015. URL http://arxiv.org/abs/1412.6575. Hang Yin, Zihao Wang, and Yangqiu Song. Rethinking existential first order queries and their inference on knowledge graphs, 2023. URL https://arxiv.org/abs/2304.07063. Zhanqiu Zhang, Jie Wang, Jiajun Chen, Shuiwang Ji, and Feng Wu. embeddings for multi-hop reasoning over knowledge graphs. ral volume 2021. a0160709701140704575d499c997b6ca-Abstract.html. Cone: Cone In Advances in Neu- 19172–19183, https://proceedings.neurips.cc/paper/2021/hash/ Information Processing (NEURIPS), Systems URL pp. 34, Zhaocheng Zhu, Zuobai Zhang, Louis-Pascal Xhonneux, Bellman-Ford Networks: A general graph neural network framework for tion. 29490, 2021. f6a673f09493afcd8b129a0bcf1cd5bc-Abstract.html. Neural link predic- (NEURIPS), 34:29476– URL https://proceedings.neurips.cc/paper/2021/hash/ Information Processing Systems and Jian Tang. in Neural Advances Zhaocheng Zhu, Mikhail Galkin, Zuobai Zhang, and Jian Tang. Neural-symbolic models for logical queries on knowledge graphs. In International Conference on Machine Learning (ICML), PMLR, pp. 27454–27478, 2022. URL https://proceedings.mlr.press/v162/zhu22c. html. A MISSING DETAILS FROM SECTION 4 Proposition A.1 (Proposition 4.1 in the body of the paper). Let q be a CQ and d unraveling ̃qd is a complete tree-like approximation of q. Moreover, ̃qd+1 ⊆ Proof. We first show that ̃qd is a complete tree-like approximation of q. By definition, ̃qd is tree- like and hence it suffices to show that ̃qd contains q, that is, that there exists a homomorphism Con(q) such that h from ̃qd to q. Consider the mapping h : Var( ̃qd) ∪ Var( ̃qd). We claim Con( ̃qd) and h(zP ) = end(P ) h(a) = a for all a that h is a homomorphism. Take an atom R(oP , oP ′) in ̃qd. By construction, R(end(P ), end(P ′)) is an atom in q. For any valid path W , end(W ) = h(oW ). Indeed, if W is unanchored, then h(oW ) = h(zW ) = end(W ). If W is anchored, h(oW ) = h(end(W )) = end(W ). It follows that R(h(oP ), h(oP ′)) is an atom in q as required. Con( ̃qd) Var(q) for all zP ̃qd holds. 1. The Var(q) ∪ ∈ → ≥ ∈ ∈ For the second part of the proposition, note that, by construction, the atoms of ̃qd are contained in the atoms of ̃qd+1. In particular, the identity mapping from Var( ̃qd) Con( ̃qd+1) ∪ ̃qd. is a homomorphism from ̃qd to ̃qd+1. It follows that ̃qd+1 ⊆ Theorem A.1 (Theorem 4.1 in the body of the paper). Let q be a CQ and d complete tree-like approximation of depth at most d. Then ̃qd Con( ̃qd) to Var( ̃qd+1) 1. Suppose q′ is a q′ holds. ≥ ∪ ⊆ Proof. We define a path of q(x) as a sequence x0, A1, x1, . . . , Ak, xk, for k 0, such that: ≥ 12 A neuro-symbolic framework for answering conjunctive queries Table 4: Statistic of unanchored query set for each dataset: FB15k-237, FB15k and NELL. FB15k-237 FB15k NELL Split train valid test train valid test train valid test 1p 474 288 295 2690 1182 1240 400 346 342 2p 13139 2514 2475 51378 5246 5302 8713 2118 2050 3p 62826 4213 4234 172943 7481 7433 35045 3239 3192 2i 117688 3763 3792 231273 6499 6527 50076 2731 1596 3i 147721 3368 3471 271760 5072 5252 37010 2342 897 2in 11644 2272 2259 22250 3592 3558 4458 1721 474 3in 12790 4255 4219 23759 6908 6902 3015 3193 1725 inp 5719 3330 3272 11016 5825 5815 1035 2643 1568 pin 12286 4080 3941 23337 6506 6442 4218 2884 1097 pni 13358 1970 1975 25222 3173 2979 5026 1410 373 ip - 4135 3903 - 6620 6306 - 2772 1542 pi - 4396 4312 - 7093 7125 - 3421 1841 2u - 2905 2901 - 4916 4906 - 2428 922 up - 1613 1604 - 2559 2565 - 1249 241 • x0 = x, each xi • for each 1 i ≤ the atom), or R(xi, xi ∈ ≤ Con(q), and each Ai is an atom of q. Var(q) k, the atom Ai is either of the form R(xi − 1) (a backward traversal of the atom). ∪ − 1, xi) (a forward traversal of In other words, a path is a valid path without the validity condition on consecutive atoms. As for valid paths, we denote by end(P ) the element at the end of the path P . Note that every path P that is not valid define a unique valid path valid(P ) such that end(P ) = end(valid(P )). Indeed, whenever we have a subsequence in the path P of form y, A, z, A, y violating validity, we can replace it by y. By iteratively, applying this simplification, we always obtain a unique valid path valid(P ) with end(P ) = end(valid(P )). ⊆ q′ as required. For w Now suppose q′(x) is a complete tree-like approximation of q(x) of depth at most d. In particular, there exists a homomorphism h from q′ to q. We shall define a homomorphism g from q′ to ̃qd, Var(q′), we define the path Pw in q as follows. which would imply ̃qd ∈ Take the unique path from the root x to w in q′. As h is a homomorphism, the image of this path Con(q′) to via h produces a path in q, which we denote Pw. Consider the mapping g from Var(q′) Var( ̃qd) Var(q′). Recall that oW = zW if W is a unanchored valid path and oW = end(W ) otherwise. Note g is well- d, then the lengths of the paths Pw, and hence valid(Pw), are always defined: as the depth of q′ is d. We claim that g is a homomorphism. Take an atom R(t, t′) in q′ and suppose t is the parent of ∪ Con(q′), and g(w) = ovalid(Pw) for all w ≤ ≤ t′ in q′ (the other case is analogous). We consider some cases: Con( ̃qd) such that g(a) = a for all a ∈ ∪ ∈ • t, t′ ∈ that Var(q′): Note that either valid(Pt′) extends valid(Pt), is, valid(Pt′) = valid(Pt), A′, w′, or valid(Pt) extends valid(Pt′). Indeed, if the last atom A′ of Pt′ is different from the last atom of valid(Pt) then valid(Pt′) = valid(Pt), A, w′. Otherwise, if the last atom A′ of Pt′ coincides with the last atom of valid(Pt), then valid(Pt′) is the subsequence of valid(Pt) that ends just before traversing the last atom A′. In particu- lar, valid(Pt) = valid(Pt′), A′, w. Suppose valid(Pt′) = valid(Pt), A′, w′ (the other case is analogous). Note that A′ = R(h(t), h(t′)) = R(end(valid(Pt)), end(valid(Pt′))) and w′ = h(t′). By construction, the atom R(ovalid(Pt), ovalid(Pt′ )) is in ̃qd. It follows that R(g(t), g(t′)) belongs to ̃qd as required. • t ∈ Con(q′) or t′ Con(q′): Suppose t Con(q′) (the other cases are analogous). Let P ′ be the path in q′ moving from the root x to t and then going through the atom R(t, t′) and ending at the constant t′. Let P be the path in q that is the image via h of the path P ′ in q′. We can repeat the argument above by replacing Pt′ with P . Var(q′) and t′ ∈ ∈ ∈ B EXPERIMENTAL DETAILS B.1 NEW QUERY SET We use both the query set provided by Ren & Leskovec (2020) and a new set of general tree like queries. Statistic of the new query set are provided in Table 4. 13 A neuro-symbolic framework for answering conjunctive queries Table 5: Learning hyperparameters of Hyperparameter Batch size Optimizer Learning rate Adv. temperature #Batches GNN-QE for FB15k237, FB15k and NELL. ∃ FB15k-237 FB15k NELL 24 24 Adam Adam 5e-3 5e-3 0.2 0.2 10.000 10.000 6 Adam 5e-3 0.2 18.000 Figure 6: Cyclic queries used for testing the method. Double paths where unravelled up to depth 2 and 3, triangles where unravelled up to depth 3 and 4, and squares where unravelled up to depths 4 and 6. For testing our approximation scheme, we also generated 500 triangles and 500 squares on FB15k- 237 and NELL and their corresponding unravelings. B.2 TRAINING HYPERPARAMETERS The training hyperparameters utilized in this study closely follow those detailed in the GNN-QE paper (Zhu et al. (2022)). However, in order to accommodate the specific hardware constraints of our computational setup, we made adjustments to the batch size while keeping all other hyperparameters consistent. Table 5 show the learning hyperparameters we used3. It's important to note that while working with the NELL dataset, we ran into hardware limitations that unfortunately made it challenging to completely replicate the results outlined in the original GNN-QE paper. A comparison of the results we replicated and the ones reported in the paper can be found in Table 7. C ADDITIONAL EXPERIMENTAL RESULTS C.1 ANCHORED TREE-LIKE Table 6 presents H@1 and MAPE for FB15k-237 and FB15k. Table 7 presents H@1, MRR, MAPE and Spearman's rank correlation for NELL. Due to different training hyperparameters, we report both the metrics showed in GNN-QE paper Zhu et al. (2022) and GNN-QE trained under the parameters in Table 5 C.2 QUERIES WITHOUT ANCHOR Table 8 shows H@1, MAPE and MRR on test unanchored queries for both GNN-QE and GNN-QE ∃ 3To ensure a fair comparison, we maintained the architecture hyperparameters, including the number of layers and hidden dimensions, as specified in the original GNN-QE paper. 14 xyzxyzxyzw(a) Double paths(b) Triangle(c) Square A neuro-symbolic framework for answering conjunctive queries Table 6: Hits@1 and MAPE of test evaluation over FB15k-237 and FB15k. Metrics of GNN-QE are retrieved from its original paper. Metric Model 1p 2p 3p 2i 3i hits@1 mape hits@1 mape GNN-QE 0.328 GNN-QE 0.228 0.409 GNN-QE 0.425 ∃ GNN-QE ∃ GNN-QE 0.861 GNN-QE 0.831 0.344 GNN-QE 0.264 ∃ GNN-QE ∃ 0.082 0.056 0.236 0.249 0.635 0.643 0.297 0.293 0.065 0.051 0.274 0.334 0.525 0.533 0.347 0.340 0.277 0.231 0.348 0.383 0.748 0.759 0.391 0.367 0.446 0.401 0.534 0.573 0.801 0.791 0.573 0.540 ip pi FB15k-237 0.123 0.095 0.600 0.414 FB15k 0.651 0.566 0.346 0.386 0.224 0.187 0.399 0.410 0.636 0.668 0.478 0.453 2in 3in inp pin pni 2u up 0.041 0.022 0.403 0.408 0.354 0.308 0.314 0.346 0.081 0.058 0.526 0.512 0.331 0.297 0.503 0.480 0.041 0.034 0.496 0.463 0.338 0.315 0.503 0.457 0.025 0.016 0.448 0.468 0.186 0.189 0.394 0.426 0.027 0.014 0.290 0.333 0.218 0.219 0.298 0.292 0.098 0.067 0.278 0.314 0.671 0.704 0.135 0.106 0.076 0.054 0.203 0.292 0.530 0.540 0.265 0.239 Table 7: Spearman's rank correlation and MRR of test queries over NELL dataset (the results under GNN-QE corresponds to the ones in GNN-QE's paper. GNN-QE* denotes the results using training hyperparameters of Table 5) Metric Model 1p 2p 3p 2i 3i spearmanr mrr GNN-QE GNN-QE(*) GNN-QE ∃ GNN-QE GNN-QE(*) GNN-QE ∃ 0.913 0.942 0.951 0.533 0.492 0.479 0.851 0.843 0.829 0.189 0.175 0.160 0.780 0.752 0.714 0.149 0.138 0.119 0.974 0.972 0.971 0.424 0.394 0.378 0.935 0.942 0.944 0.525 0.499 0.484 ip NELL 0.737 0.725 0.650 0.189 0.169 0.140 pi 2in 3in inp pin pni 2u up 0.825 0.812 0.801 0.308 0.284 0.269 0.994 0.988 0.985 0.159 0.086 0.086 0.980 0.974 0.974 0.126 0.131 0.128 0.882 0.828 0.843 0.099 0.111 0.111 0.848 0.813 0.821 0.146 0.054 0.055 0.976 0.971 0.967 0.114 0.052 0.053 - 0.991 0.995 0.063 0.150 0.141 - 0.938 0.939 0.063 0.116 0.107 C.3 CYCLIC CONJUNCTIVE QUERIES Figures 7 and 8 show the MRR and spearman rank correlation for squares using unravelings of differents depths. Figure 7: MRR versus depth of square unravel- ings. Figure 8: Spearman rank correlation versus depth of square unravelings. Tables 9 and 10 show H@1, MAPE and MRR for different unravelings for both triangles and squares respectively. 15 A neuro-symbolic framework for answering conjunctive queries Table 8: Results of evaluation of GNN-QE and GNN-QE over test set of unanchored queries. GNN-QE metrics are retrived from our training of GNN-QE following hyperparameters in Table 5 ∃ Metric Model 1p 2p 3p 2i 3i hits@1 mape hits@1 mape hits@1 mape mrr spearmanr GNN-QE 0.001 GNN-QE 0.015 3.22 GNN-QE 0.626 ∃ GNN-QE ∃ GNN-QE 0.075 GNN-QE 0.171 11.18 ∃ GNN-QE GNN-QE 5.99 ∃ GNN-QE ∃ GNN-QE 0.004 GNN-QE 0.010 2.698 GNN-QE 0.325 0.007 GNN-QE 0.028 0.589 GNN-QE 0.924 ∃ GNN-QE ∃ GNN-QE ∃ 0.044 0.045 0.340 0.178 0.315 0.353 0.488 0.29 0.022 0.029 0.571 0.428 0.052 0.067 0.732 0.789 0.045 0.042 0.332 0.199 0.387 0.426 0.517 0.306 0.033 0.038 0.609 0.524 0.069 0.075 0.591 0.660 0.151 0.143 0.489 0.245 0.552 0.628 0.459 0.280 0.130 0.142 0.518 0.461 0.211 0.228 0.928 0.957 ip FB15k-237 0.064 0.055 0.366 0.307 FB15k 0.511 0.523 0.478 0.351 NELL 0.057 0,056 0.583 0.476 0.110 0.107 0.520 0.539 0.205 0.196 0.431 0.333 0.620 0.661 0.547 0.395 0.183 0.190 0.641 0.581 0.276 0.290 0.922 0.959 pi 2in 3in inp pin pni 2u up 0.105 0.100 0.454 0.291 0.470 0.511 0.551 0.370 0.082 0.084 0.554 0.478 0.139 0.137 0.731 0.803 0.004 0.008 0.763 0.440 0.054 0.103 0.778 0.447 0.066 0.097 0.689 0.314 0.023 0.034 0.922 0.964 0.048 0.041 0.652 0.514 0.178 0.209 0.604 0.453 0.021 0.022 0.635 0.458 0.075 0.080 0.833 0.971 0.025 0.027 0.681 0.501 0.162 0.181 0.638 0.454 0.025 0.027 0.697 0.534 0.059 0.066 0.655 0.804 0.011 0.011 0.623 0.496 0.074 0.094 0.533 0.442 0.004 0.006 0.594 0.432 0.025 0.033 0.646 0.824 0.005 0.006 0.734 0.347 0.050 0.081 0.645 0.317 0.004 0.006 0.825 0.287 0.018 0.024 0.907 0.967 0.009 0.034 2.329 0.793 0.084 0.209 0.926 0.361 0.005 0.012 1.328 0.213 0.012 0.033 0.735 0.967 0.044 0.051 0.263 0.159 0.347 0.373 0.383 0.205 0.017 0.012 0.345 0.302 0.043 0.047 0.913 0.897 Table 9: Hits@1 and MAPE test results for triangle's unravelings of depth 2 to 10 over FB15k-237. Depth hits@1 mape 2 0.060 2.148 3 0.078 1.134 4 0.068 0.914 5 0.066 0.789 6 0.076 0.748 7 0.073 0.734 8 0.072 0.724 9 0.076 0.710 10 0.073 0.711 Table 10: Hits@1 and MAPE test results for square's unravelings of depth 2 to 14 over FB15k-237. Depth hits@1 mape 2 0.005 5.364 3 0.010 3.837 4 0.005 3.377 5 0.010 3.053 6 0.014 2.923 7 0.010 2.849 8 0.010 2.675 9 0.010 2.637 10 0.010 2.684 11 0.010 2.845 12 0.010 2.840 13 0.010 2.834 14 0.010 2.834 16
http://arxiv.org/abs/2310.04590v1
"2023-10-06T21:11:52"
"2023-10-06T21:11:52"
Deep Model Predictive Optimization
A major challenge in robotics is to design robust policies which enable complex and agile behaviors in the real world. On one end of the spectrum, we have model-free reinforcement learning (MFRL), which is incredibly flexible and general but often results in brittle policies. In contrast, model predictive control (MPC) continually re-plans at each time step to remain robust to perturbations and model inaccuracies. However, despite its real-world successes, MPC often under-performs the optimal strategy. This is due to model quality, myopic behavior from short planning horizons, and approximations due to computational constraints. And even with a perfect model and enough compute, MPC can get stuck in bad local optima, depending heavily on the quality of the optimization algorithm. To this end, we propose Deep Model Predictive Optimization (DMPO), which learns the inner-loop of an MPC optimization algorithm directly via experience, specifically tailored to the needs of the control problem. We evaluate DMPO on a real quadrotor agile trajectory tracking task, on which it improves performance over a baseline MPC algorithm for a given computational budget. It can outperform the best MPC algorithm by up to 27% with fewer samples and an end-to-end policy trained with MFRL by 19%. Moreover, because DMPO requires fewer samples, it can also achieve these benefits with 4.3X less memory. When we subject the quadrotor to turbulent wind fields with an attached drag plate, DMPO can adapt zero-shot while still outperforming all baselines. Additional results can be found at https://tinyurl.com/mr2ywmnw.
[ "Jacob Sacks", "Rwik Rana", "Kevin Huang", "Alex Spitzer", "Guanya Shi", "Byron Boots" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04590v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04590v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.RO", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.RO", "cs.LG" ]
Deep Model Predictive Optimization Jacob Sacks∗, Rwik Rana∗, Kevin Huang∗, Alex Spitzer∗, Guanya Shi†, and Byron Boots∗ 3 2 0 2 t c O 6 ] O R . s c [ 1 v 0 9 5 4 0 . 0 1 3 2 : v i X r a Abstract- A major challenge in robotics is to design robust policies which enable complex and agile behaviors in the real world. On one end of the spectrum, we have model-free reinforcement learning (MFRL), which is incredibly flexible and general but often results in brittle policies. In contrast, model predictive control (MPC) continually re-plans at each time step to remain robust to perturbations and model inaccuracies. However, despite its real-world successes, MPC often under-performs the optimal strategy. This is due to model quality, myopic behavior from short planning horizons, and approximations due to computational constraints. And even with a perfect model and enough compute, MPC can get stuck in bad local optima, depending heavily on the quality of the optimization algorithm. To this end, we propose Deep Model Predictive Optimization (DMPO), which learns the inner-loop of an MPC optimization algorithm directly via experience, specifically tailored to the needs of the control problem. We evaluate DMPO on a real quadrotor agile trajectory tracking task, on which it improves performance over a baseline MPC algorithm for a given computational budget. It can outperform the best MPC algorithm by up to 27% with fewer samples and an end-to-end policy trained with MFRL by 19%. Moreover, because DMPO requires fewer samples, it can also achieve these benefits with 4.3× less memory. When we subject the quadrotor to turbulent wind fields with an attached drag plate, DMPO can adapt zero- shot while still outperforming all baselines. Additional results can be found at https://tinyurl.com/mr2ywmnw. I. INTRODUCTION For robots to perform complex and agile behaviors in the real world, it is crucial to design control policies that remain robust while pushing the limits of the system. Model-free reinforcement learning (MFRL) is a general approach that makes minimal assumptions on the problem and has been successfully deployed in the real world [1]–[3]. However, policies trained with these methods are often brittle and do not generalize to out-of-distribution disturbances. For instance, consider an uninhabited aerial vehicle (UAV) following an aggressive trajectory in uncertain environments [4, 5]. If the UAV encounters unknown wind gusts that were not experienced in training, the policy will likely not be able to account for the change in dynamics and lead to a crash. Furthermore, due to the sample inefficiency of MFRL methods, they often train policies in simulation. This can create a sim-to-real gap due to the mismatch between the simulator and the true system. Even if the policies succeed in simulation, they often fail in the real world. We can partially remedy this issue using domain randomization (DR) [6]– [8]. However, its efficacy is dependant on the parameter distributions we select and the nature of the problem. ∗University of Washington, Seattle WA 98105, USA. †Robotics In- stitute, Carnegie Mellon University, Pittsburgh PA 15213, USA. Email: jsacks6@cs.washington.edu Alternatively, model predictive control (MPC) is a powerful framework which leverages a model to iteratively re-plan a finite-horizon control sequence at each time step [9]–[11]. The first control from this plan is applied to the system and the process repeats. Although the planned sequence is often open- loop, because we are updating it using the current state, MPC effectively yields a state-feedback policy. By re-solving this optimization problem online, we can improve the robustness of MPC to perturbations and model inaccuracies. However, this also leads to increased computational demands compared to MFRL. In practice, we approximate the solution at each time step to run in real time. This involves warm-starting with the solution from the previous time step, which works well when the two problems are similar [12]. But if our system encounters a large perturbation, this warm-starting procedure can bias us towards a poor solution [13]. The performance of MPC also depends on the model quality and prediction horizon length [11, 14]–[16]. And even with a perfect model and enough computation, the optimization algorithm may get stuck in bad local optima [17]. Altogether, these issues often lead to MPC under-performing the optimal policy. To improve the performance of MPC while retaining its robustness, we propose Deep Model Predictive Opti- mization (DMPO), which learns an optimizer and warm- starting procedure directly via experience. That is, DMPO learns how to perform model-based planning more effectively while considering the computational demands for real-time deployment. Our key contributions are: 1) We develop DMPO, a general approach for learning the inner-loop of the MPC optimizer and warm-starting procedure via reinforcement learning by viewing MPC as a structured recurrent policy class; 2) On a real quadrotor platform (Crazyflie 2.1 with up- graded motors) tracking infeasible zig-zag trajectories, we show that DMPO can outperform an end-to-end (E2E) policy trained with MFRL by 19%; 3) Tracking zig-zag trajectories with alternating 180o flips in the desired yaw, DMPO can improve error over a baseline MPC algorithm by up to 27% with 16 fewer memory requirements; samples, saving 4.3 × 4) By exposing the quadrotor to turbulent wind fields with an attached cardboard drag plate, we show that DMPO can adapt zero-shot, matching the performance of the MPC baseline and outperforming E2E by 14%. × II. PRELIMINARIES A. Reinforcement Learning We consider controlling a discrete-time stochastic dynami- cal system as an infinite-horizon discounted Markov decision X = ( is the state space, , P, r, ρ0, γ), , X U is the control space, xt+1 ∼ xt, ut) is the transition dynamics, r(x, u) is the reward (0, 1) x), process (MDP) defined by the tuple where P ( function, ρ0(x0) is the initial state distribution, and γ is the discount factor. Given a closed-loop policy, u its value function is defined as ∈ π( M ∼ U *| *| V π(x) = EP,π (cid:34) ∞(cid:88) t=0 (cid:12) (cid:12) γtr(xt, ut) (cid:12)x0 = x (cid:35) . (1) The goal of reinforcement learning (RL) is to find a policy which maximizes the expected discounted reward, which is equivalent to maximizing the value function: samples and compute an update via dynamic mirror descent (DMD) [12] to arrive at the MPPI update rule: μt+h = (1 − t ) ̃μt+h + γμ γμ t N (cid:88) i=1 wi ˆu(i) t+h, (5) Σt+h = (1 − t ) ̃Σt+h + γσ γσ t N (cid:88) i=1 wim(i) t+hm(i)T t+h , (6) where ̃μt+h and ̃Σt+h are the current mean and covariance t and γσ matrix for each time step, mt+h = ut+h − t are the corresponding step sizes, and the weights are: μt+h, γμ π∗ = arg max π (cid:104) V π(x0) (cid:105) . Ex0 ρ0 ∼ (2) wi = 1 β C(ˆx(i) t e− , ˆu(i) t ) (cid:80)N j=1 e− 1 β C(ˆx(j) t . , ˆu(j) t ) (7) A common approach is to directly find π with policy gradient methods, which perform gradient descent with a zeroth- order approximation of the gradient using a finite number of samples. State-of-the-art approaches include actor-critic algorithms [18, 19], which in addition to learning π (actor), learn an estimate of Vπ (critic) and use it as a baseline to reduce the gradient estimator variance. If we wish to train our policy over a range of tasks, we can additionally condition both π and Vπ on task parameters, such as a goal state. Despite its robustness, MPC often requires a large num- ber of sampled trajectories or multiple update iterations, which is infeasible due to real-time constraints. To improve convergence, we can initialize the current parameters of the optimization problem as a function of the previous approximate solution, ̃θt+1 = Φ(θt), where Φ is called the shift model. A common choice is to shift the parameter sequence forward by one time step. For instance, due to 1) and ̃θt+1 = Equation (3), θt = (θt, θt+1, . . . , θt+H − (θt+1, θt+2, . . . , θt+H 1, ̄θ), where ̄θ is a hyperparameter. − B. Sampling-based Model Predictive Control C. Learned Optimization for MPC πθt( ), where ˆut ≜ (ˆut, ˆut+1, . . . , ˆut+H * Rather than find a single, globally optimal policy, MPC re-optimizes a local policy at each time step. It accomplishes this by predicting the system's behavior over a finite horizon H using an approximate model ˆP . In sampling-based MPC, this local policy is often a distribution over open-loop control sequences, ˆut ∼ 1) and θt ∈ Θ are some set of feasible parameters. At each time ˆJ(θ; xt), where ˆJ(θ; xt) is step, we solve θt ← ∈ a statistic defined on C(ˆxt, ˆut), the total cost of our predicted trajectory over the finite horizon H. After finding the solution, we sample a control sequence from our new policy and apply the first control, ut = ˆut. Despite the plan being open-loop, the MPC procedure can be thought of as outlining a state- feedback policy. This is because we are updating the open- loop sequence using information about the current state. arg minθ − Θ A popular sampling-based approach to MPC is Model Predictive Path Integral (MPPI) control [10, 20], which assumes that our policy is a factorized Gaussian of the form πθ(ˆu) = H 1 (cid:89) − h=0 πθh (ˆut+h) = H 1 (cid:89) − N h=0 (ˆut+h; μt+h, Σt+h). (3) MPPI also assumes that we optimize the exponential utility of our cost function, defined as: ˆJ(θ; xt) = log E πθ , ˆP − (cid:104) exp (cid:16) 1 β − (cid:17)(cid:105) C(ˆxt, ˆut) , (4) where β > 0 is a scaling parameter, known as the temperature. We can approximate the gradient of this objective with Given these approximations, the performance of MPC algorithms depends heavily on the computational budget available. And even with sufficient resources, MPC can be sub-optimal relative to a globally optimal policy due to how we optimize our policy at each time step. The update rule in Equation (5) and Equation (6) does not optimality make use of the information from the sampled trajectories. One reason is that the update at each time step and for each control input is independent and are only coupled together via the weights from Equation (7). Moreover, taking a weighted sum of the samples is a fairly simple operation and may potentially throw away useful information. The choice of a static step size may also be limiting, and how much we update our policy may be better treated in an adaptive way. In general, there is structure in the problem which we can leverage to construct a better update rule. Rather than hand-design the optimization algorithm, we can learn it via experience by parameterizing the update rule. In the context of MPC, Sacks et al. [21] proposed an update of the form θt = mφ( ̃θt, C (1:N ) , ˆu(i) t ), (8) t t = C( ˆx(i) where C (i) t ) and φ are the network parameters. Unlike the MPPI update, Equation (8) jointly optimizes all parameters across controls and time step. For this to work, they generate samples from a standard Gaussian and keep them fixed. They then use the reparameterization trick to shift and scale these samples by the current mean and standard deviation, respectively. This makes all samples a deterministic function of our current policy parameters, which is already Fig. 1: The DMPO architecture consists of two learnable modules, the shift model and optimizer. The fixed rollout model module performs rollouts of the sampled control sequences. provided to the network. This means we can remove the samples from the update altogether. III. DEEP MODEL PREDICTIVE OPTIMIZATION A. Problem Formulation In DMPO, we learn an update rule of the form in Equa- tion (8) with RL, treating MPC as a structured policy class. However, the common shift-forward operation used to warm- start the optimization only works well when problems at adjacent time steps are similar, which may not be true if there are substantial perturbations. This choice of warm-start is also independent of the value of each decision variable. Therefore, DMPO additionally learns a shift model of the form ̃θt+1 = Φφ(θt). (9) Such a shift model is joint across time steps and control dimensions. It also provides us with a parameter-dependent shift operation, which can take advantage of structure and the types of perturbations known to effect the system. ( πM P C θt To learn these components with RL, we need to actually consider two different policies. There is the local policy output by MPC at each time step, ˆut ∼ ), which we call the * optimizee. Additionally, the optimizer defines a policy over the parameters of the optimizee, θt ∼ ). From the perspective of RL, πφ is the policy we wish to learn, while πM P C is part of the environment dynamics. This means we θt have to consider both the state of the system and optimizer, , Θ, ˆP , r, ˆρ0, γ). We forming an auxiliary MDP ˆ M have auxiliary states h 1), actions θt ∈ Θ, which are the optimizer outputs, and dynamics H , where ht = (xt, θt πφ( ̃θt, C (1:N ) ∈ H = ( − t ht+1 = (cid:21) (cid:20)xt+1 θt ˆP ( ht, θt) = *| ∼ (cid:20)P ( (cid:21) xt, ut) *| δ(θt) , (10) where the control of the original system, ut, is a function of the auxiliary action, θt, via ut = ˆut, ˆut ∼ πθt( ). * (11) From the perspective of the original MDP, the current parameters of the MPC policy actually form a recurrent state. Therefore, even if DMPO is parameterized with feedforward networks, we are still effectively forming a recurrent policy. The initial state distribution ˆρ0 now samples both an initial system state and set of optimizer parameters. And the reward function is still defined on the original state-control space, r(xt, ut), but now ut is a function of the optimizer action θt due to Equation (11). Finally, in actor-critic algorithms, we also simultaneously learn the value function of the policy, which in this case is the optimizer, πφ. This means the critic should be defined on the auxiliary state, V π(ht), making it a function of both the state of the system and optimizer. Note that the optimizer never directly receives the system state xt. While we could condition on state as well, we found that this actually hurts generalization performance, especially for sim-to-real transfer. Intuitively, there may be multiple states for which we have the same cost distribution. This means that the optimizer may encounter out-of-distribution states during testing which have in-distribution trajectory costs. B. Algorithm Overview A valid instantiation of DMPO is to learn both the optimizer and shift model from scratch. Instead, we learn residuals on the MPPI update and shift-forward operation. While the closed-form MPPI update may be sub-optimal, it still can be fairly robust and generalize well to different tasks. By learning each component as a residual operation, it can alter the reward landscape in a way that can simplify exploration. If the MPPI controller is already good, it allows us to potentially inherit its robustness and generalization capabilities, with the residual providing small corrections. But even if the proposed MPPI update is far from optimal, such as in the case when the controller has access to few samples, it can still provide a hint about a good direction to search. We illustrate each module of DMPO in Figure 1, which we describe below: Shift Model. Let us define ̃θt = ( ̃μt, ̃Σt) as the shifted parameters of our optimizee policy. Then we implement the shift model, Φφ, as a residual update: (12) ̃μt = μSHIF T t ˆμt, ˆΣt = Φφ(θt) + ˆμt, ̃Σt = ΣSHIF T t ˆΣt, t and ΣSHIF T t ⊙ where μSHIF T are the mean and covariance following the normal shift forward operation and is the Hadamard product. While both updates could be additive, we found that the multiplicative update for the covariance worked better in practice. ⊙ Rollout Model. We use fixed samples from a standard Gaussian, scaling and shifting them by ̃Σt and ̃μt, respec- tively, to get ˆu(1:N ) . Additionally, we always include the t OptimizerRollout ModelShift ForwardShift Residual<latexit sha1_base64="QmUG8FJYNbs+qYyZhSvhzeU9KSU=">AAAB83icbVDLSgNBEOyNrxhfUY9eBoPgxbAbfB0DXjxGMA/ILmF2MkmGzM4uM71CWPIbXjwo4tWf8ebfOEn2oIkFDUVVN91dYSKFQdf9dgpr6xubW8Xt0s7u3v5B+fCoZeJUM95ksYx1J6SGS6F4EwVK3kk0p1EoeTsc38389hPXRsTqEScJDyI6VGIgGEUr+T6OONJehhfetFeuuFV3DrJKvJxUIEejV/7y+zFLI66QSWpM13MTDDKqUTDJpyU/NTyhbEyHvGupohE3QTa/eUrOrNIng1jbUkjm6u+JjEbGTKLQdkYUR2bZm4n/ed0UB7dBJlSSIldssWiQSoIxmQVA+kJzhnJiCWVa2FsJG1FNGdqYSjYEb/nlVdKqVb3r6tXDZaVey+Mowgmcwjl4cAN1uIcGNIFBAs/wCm9O6rw4787HorXg5DPH8AfO5w/a05GH</latexit>✓t1+<latexit sha1_base64="QoDlTeAwdgXceYJZRDS6KwONCQU=">AAAB+3icbVDLSsNAFJ34rPUV69JNsAiuSlJ8LQtuXFawD2hCmExu26GTBzM3Ygn5FTcuFHHrj7jzb5y2WWjrgQuHc+7l3nuCVHCFtv1trK1vbG5tV3aqu3v7B4fmUa2rkkwy6LBEJLIfUAWCx9BBjgL6qQQaBQJ6weR25vceQSqexA84TcGL6CjmQ84oask3ay5yEULu4hiQFn6OhW/W7YY9h7VKnJLUSYm2b365YcKyCGJkgio1cOwUvZxK5ExAUXUzBSllEzqCgaYxjUB5+fz2wjrTSmgNE6krRmuu/p7IaaTUNAp0Z0RxrJa9mfifN8hweOPlPE4zhJgtFg0zYWFizYKwQi6BoZhqQpnk+laLjamkDHVcVR2Cs/zyKuk2G85V4/L+ot5qlnFUyAk5JefEIdekRe5Im3QII0/kmbySN6MwXox342PRumaUM8fkD4zPH+44lPw=</latexit> ̃✓t<latexit sha1_base64="9VoZw+Ka5oGqjq1E/UzNI78wZ64=">AAAB6nicbVDLSgNBEOz1GeMr6tHLYBA8hd3g6xjw4jGieUCyhNnJbDJkdnaZ6RXDkk/w4kERr36RN//GSbIHTSxoKKq66e4KEikMuu63s7K6tr6xWdgqbu/s7u2XDg6bJk414w0Wy1i3A2q4FIo3UKDk7URzGgWSt4LRzdRvPXJtRKwecJxwP6IDJULBKFrp/qmHvVLZrbgzkGXi5aQMOeq90le3H7M04gqZpMZ0PDdBP6MaBZN8UuymhieUjeiAdyxVNOLGz2anTsipVfokjLUthWSm/p7IaGTMOApsZ0RxaBa9qfif10kxvPYzoZIUuWLzRWEqCcZk+jfpC80ZyrEllGlhbyVsSDVlaNMp2hC8xZeXSbNa8S4rF3fn5Vo1j6MAx3ACZ+DBFdTgFurQAAYDeIZXeHOk8+K8Ox/z1hUnnzmCP3A+fwBvrI3d</latexit>xt<latexit sha1_base64="kWASksQEoy+uKmsi836dygNydxM=">AAAB8HicbVDLSgNBEOyNrxhfUY9eBoMQL2E3+MJTIBdPEsE8JFnD7GSSDJmZXWZmhbDkK7x4UMSrn+PNv3GS7EETCxqKqm66u4KIM21c99vJrKyurW9kN3Nb2zu7e/n9g4YOY0VonYQ8VK0Aa8qZpHXDDKetSFEsAk6bwag69ZtPVGkWynszjqgv8ECyPiPYWOmh+pgUvevb00k3X3BL7gxomXgpKUCKWjf/1emFJBZUGsKx1m3PjYyfYGUY4XSS68SaRpiM8IC2LZVYUO0ns4Mn6MQqPdQPlS1p0Ez9PZFgofVYBLZTYDPUi95U/M9rx6Z/5SdMRrGhkswX9WOOTIim36MeU5QYPrYEE8XsrYgMscLE2IxyNgRv8eVl0iiXvIvS+d1ZoVJO48jCERxDETy4hArcQA3qQEDAM7zCm6OcF+fd+Zi3Zpx05hD+wPn8AWADj3E=</latexit>C(1:N)MPPI UpdateOptimizer Residual+<latexit sha1_base64="wkBfZG7iGGQQFFd08aMUKKgkFYA=">AAAB73icbVDLSgNBEOyNrxhfUY9eBoPgKewGX8eAF48RzAOSJcxOZpMhs7PrTK8QlvyEFw+KePV3vPk3TpI9aGJBQ1HVTXdXkEhh0HW/ncLa+sbmVnG7tLO7t39QPjxqmTjVjDdZLGPdCajhUijeRIGSdxLNaRRI3g7GtzO//cS1EbF6wEnC/YgOlQgFo2ilTg9HHGkf++WKW3XnIKvEy0kFcjT65a/eIGZpxBUySY3pem6CfkY1Cib5tNRLDU8oG9Mh71qqaMSNn83vnZIzqwxIGGtbCslc/T2R0ciYSRTYzojiyCx7M/E/r5tieONnQiUpcsUWi8JUEozJ7HkyEJozlBNLKNPC3krYiGrK0EZUsiF4yy+vklat6l1VL+8vKvVaHkcRTuAUzsGDa6jDHTSgCQwkPMMrvDmPzovz7nwsWgtOPnMMf+B8/gAxcpAJ</latexit>✓t<latexit sha1_base64="jwAMXAUFC3a/7n7rSxXgrO+xX0I=">AAACBnicbVDLSsNAFJ34rPUVdSnCYBFclaT4Wha6cSNUsA9oYphMJ+3QyYOZG6GErNz4K25cKOLWb3Dn3zhts9DWAxcO59zLvff4ieAKLOvbWFpeWV1bL22UN7e2d3bNvf22ilNJWYvGIpZdnygmeMRawEGwbiIZCX3BOv6oMfE7D0wqHkd3ME6YG5JBxANOCWjJM49SD7CjeIidhHuZA0MGxIP8PrtpNnLPrFhVawq8SOyCVFCBpmd+Of2YpiGLgAqiVM+2EnAzIoFTwfKykyqWEDoiA9bTNCIhU242fSPHJ1rp4yCWuiLAU/X3REZCpcahrztDAkM1703E/7xeCsGVm/EoSYFFdLYoSAWGGE8ywX0uGQUx1oRQyfWtmA6JJBR0cmUdgj3/8iJp16r2RfX89qxSrxVxlNAhOkanyEaXqI6uURO1EEWP6Bm9ojfjyXgx3o2PWeuSUcwcoD8wPn8ASteY+w==</latexit>ut⇠⇡MPC✓tShift Model<latexit sha1_base64="Y4GWNJIuBiyZIAL4mdWT7VqnHx8=">AAACA3icbVDLSsNAFJ34rPUVdaebYBHqpiTiC1dFN66kgn1AE8NkOmmHTh7M3AglBNz4K25cKOLWn3Dn3zhps9DWAxcO59zLvfd4MWcSTPNbm5tfWFxaLq2UV9fWNzb1re2WjBJBaJNEPBIdD0vKWUibwIDTTiwoDjxO297wKvfbD1RIFoV3MIqpE+B+yHxGMCjJ1XftAYbUDjAMPD9NssyF+7RqXdwcZq5eMWvmGMYssQpSQQUarv5l9yKSBDQEwrGUXcuMwUmxAEY4zcp2ImmMyRD3aVfREAdUOun4h8w4UErP8COhKgRjrP6eSHEg5SjwVGd+rJz2cvE/r5uAf+6kLIwToCGZLPITbkBk5IEYPSYoAT5SBBPB1K0GGWCBCajYyioEa/rlWdI6qlmntZPb40r9soijhPbQPqoiC52hOrpGDdREBD2iZ/SK3rQn7UV71z4mrXNaMbOD/kD7/AH1X5e4</latexit>ˆu(1:N)t current mean as one of the samples. After this reparameter- ization, we roll out the open-loop control sequences with our dynamics model to get a set of N scalar total trajectory costs concatenated into a vector C (1:N ). Since we also run the MPPI update, we compute weights using Equation (7). Importantly, this is the only module which makes use of the current system state xt. Optimizer. We compute the normal MPPI update us- = to get θM P C ing Equation (5) and Equation (6) (μM P C t , ΣM P C t t ). The DMPO update for the mean is then φ( ̃θt, C 1:N ) + gt ⊙ ˆμt, gt, σμ t = mμ gt) μM P C t ˆμt, ⊙ − t μt = (1 (13) where gt is a gating term, which has the same dimension as the mean and is passed through a sigmoid to ensure it is between zero and one. It allows the network to modulate how much it relies on MPC versus the network output. Since we are using PPO [18] to train the components of DMPO, we actually need a distribution over proposed mean and covariance updates. Therefore, the network also outputs a standard deviation σμ t , which then defines our optimizer policy for the mean, πμ t ). During training, we φ = sample the mean update from this policy, but simply use the mean at test time. Similarly, for the covariance matrix: (μt, σμ N ˆΣt, σΣ t = mΣ φ ( ̃θt, C 1:N t ), Σt = ΣM P C t ˆΣt, ⊙ (14) φ = where the optimizer scales the covariance matrix proposed by MPC. Our optimizer policy for the covariance is then πΣ t ). It is also important to note that these mean and covariance updates jointly depend on all the current parameters values, ̃θt. This means that we consider the current covariance while updating the mean, and vice versa. (Σt, σΣ N IV. RELATED WORK Learned Optimization. There is a large body of work on L2O in the context of training neural networks [22]–[34]. Another thrust learns how to perform reinforcement learning more efficiently [35, 36, 36]–[40]. These approaches still ultimately use standard stochastic gradient descent optimizers to update the policy and value functions. Combining MPC with Learning. Common strategies to boosting the performance of MPC involve learning a dynamics model [10, 41]–[53], terminal value functions [54]– [58], cost-shaping terms [15], the entire controller end-to-end [15, 59]–[64], or improving the sampling distribution [65]– [74]. However, these methods all leverage the structure of the optimization solver, learning components of the model or objective, rather than training a new update rule. Sacks et al. [21] explored learned optimization in the context of MPC. However, they do not learn a shift model or a residual, and their optimizer is trained with imitation learning. This limits their performance to the quality of the expert, which was an MPC controller with many samples. Residual Policy Learning. Prior work has explored learning residual policies on a hand-designed controller with RL [75]–[79]. However, unlike DMPO, these methods do not leverage structure in the policy class. Additionally, there is nothing specific in DMPO necessitating a residual update. MPC and RL for Quadrotor Control. Researchers have successfully deployed sampling-based [2, 80, 81] and gradient- based [82]–[85] MPC on quadrotors. A growing body of literature has applied RL for quadrotor stabilization [86]– [88], trajectory tracking [2, 89], and high-speed drone racing [3]. More closely related to our work, Romero et al. [90] embed differentiable MPC [62] into an actor-critic pipeline. Song et al. [91] use RL to tune the hyperparameters of MPC in an adaptive, state-dependent fashion. However, both treat the MPC optimizer as a fixed component, instead learning how to tweak its hyperparameters and objective. V. EXPERIMENTS A. Task and Implementation Details. Quadrotor Trajectory Tracking. We perform all evalu- ations on a quadrotor trajectory tracking problem in which the desired trajectories are infeasible zig-zags with and without yaw flips. These zig-zags linearly connect a series of random waypoints, while the yaw flips are a 180o change to the desired yaw at each waypoint. For the real hardware experiments, we use the Bitcraze Crazyflie 2.1 equipped with the longer 20 mm motors from the thrust upgrade bundle. State estimation for position and velocity is provided by an OptiTrack motion capture system, while the Crazyflie provides orientation estimates via a 2.4 GHz radio. An offboard computer receives the state estimates and runs all controllers at a rate of 50 Hz. All controllers operate on desired body thrust fdes and angular velocity ωdes commands. We convert these commands to motor thrusts using a low-level controller. For training and the MPC dynamics model, we use the following dynamics with a dt = 0.02: ̇p = v, m ̇v = mg + Re3f, ̇R = RS(ω), (15) ∈ ∈ → R3 are the position, velocity, and gravity where p, v, g ∈ vectors in the world frame, R SO(3) is the attitude rotation R3 is the angular velocity in the body frame, matrix, ω ) : R3 so(3) maps a vector to its skew-symmetric S( * matrix form, e3 is a unit vector in the Z direction, and m is the mass. The state of the system is then x = (p, v, q, ω), where q is the quaternion representation of R, and u = (fdes, ωdes). Rather than explicitly model the angular velocity dynamics and low-level controller, we convert u to the actual thrust f and angular velocity ω using a first-order time delay model: ωt 1 + k(ωdes − ft 1 + k(fdes − The cost function includes terms defined on position and orientation tracking performance. Additionally, a control penalty was necessary for sim-to-real transfer. Without it, DMPO would exploit the simulator and learn aggressive commands which are difficult to perform on the real system. Hyperparameters and Training. The optimizer, shift model, and value function were all parameterized with multi- layer perceptrons (MLPs) with a single hidden layer of 256 ωt = ωt ft = ft 1) − 1). (16) − − − Unperturbed Wind + Drag Plate Setup Fig. 2: Position tracking error of DMPO versus MPPI and E2E on tracking random infeasible zig-zag trajectories without any environmental disturbances (left) and with an attached plate and wind (middle), with the setup shown on the right. Fig. 3: Example zig-zag trajectory with a 180o yaw flip performed by MPPI (8192 samples) and DMPO (512 samples). N and ReLU activation functions implemented in PyTorch [92]. Since the value function operates on the full auxiliary state, we needed to make it aware of the reference trajectory. Therefore, we give it the desired trajectory for the next 32 time steps with a stride of 4, forming a 56-dimensional conditioning vector. However, we note that this is not necessary for the optimizer or shift model, as they do not operate on states. For the network initialization, we set the last layer of each MLP to have a weight distribution of (0, 0.001). This made each residual term effectively zero, allowing us to start with the MPPI update and shift-forward operation for warm-starting. We trained the optimizers with PPO [18] and Generalized Advantage Estimation (GAE) [93] on an NVIDIA RTX 3080 GPU with a γ = 0.99 and λ = 0.95. To update DMPO, we 4 for used Adam [94] with a learning rate of 10− the actor and critic, respectively. Learning the DMPO residual optimizers only took up to 1000 iterations of PPO to achieve good performance. To improve performance, we used domain randomization (DR) [6]–[8] on the mass, randomly scaling it by a factor in [0.7 ], and the delay coefficient k, selecting it in [0.2, 0.6]. We also applied a constant force perturbation with a randomized direction and magnitude at the beginning of each episode in [ 3.5 N, 3.5 N ]. 6 and 10− , 1.3 × × Baselines. Our two baselines are MPPI and an end-to-end (E2E) 3-layer MLP policy operating on states, conditioned on desired trajectories. The desired trajectories consist of the 10 desired positions up to 0.6 seconds in the future, evenly spaced in time. E2E was also trained with PPO using DR, 4 and took about 107 but with a learning rate of 3 iterations to converge. We used a custom implementation of MPPI in PyTorch [92], which used Halton sequences [95] for generating the fixed samples from a standard Gaussian. We tune all hyperparameters of the MPPI controller using a grid 10− × − search in simulation on a fixed set of desired trajectories. B. Tracking Performance on Infeasible Zig-Zags We begin by evaluating the performance of DMPO compared to MPPI and E2E on random zig-zag trajectories without the presence of additional disturbances. For each controller, we evaluate the performance across 5 different fixed trajectory seeds. Figure 2 (left) reports the position tracking error of each controller, varying the number of samples for DMPO and MPPI. The box plots represent the median and quartiles of the total episode costs. Given 512 or less samples, MPPI would consistently crash, while DMPO is able to successfully complete the task with as few as 64 samples. We found that increasing the number of samples for MPPI only helps to a point, after which performance can suffer. However, increasing the number of samples generally improves the median performance of DMPO. And DMPO with 1024 samples outperforms the best MPPI controller (with 4096 samples) by 7% and E2E by 19% in terms of the median error. In order to gauge whether DMPO retains the robustness of MPC, we test the Crazyflie in a scenario with an unknown wind field generated by three fans. Additionally, we attached a soft cardboard plate hanging below the chassis, which creates drag and adds additional mass (see the right of Figure 2). The combination of the fans and cardboard plate creates highly dynamic and state-dependent disturbances which are not encountered during training. We report the results of these perturbations on the right of Figure 2. The performance of all three controllers got worse, although DMPO can still remain in the air with as few as 64 samples. DMPO with 1024 samples nearly matches the performance of the best MPPI controller with 8192 samples. And it still surpasses the performance of E2E by 14%, with the improvement growing with samples. 641282565121024204840961024204840968192E2EDMPOMPPI0.060.080.100.120.140.160.18Position Error (m)641282565121024204840961024204840968192E2EDMPOMPPI0.100.150.200.25Position Error (m)ZXX axis orientation of quadrotorDesired trajectoryMPPI 8192 SamplesDMPO512 Samples d e b r u t r e p n U e t a l P g a r D + d n i W Fig. 4: Total cost (left), position error in meters (middle), and orientation error (right) of DMPO versus MPPI on tracking random yaw flip trajectories without any environmental disturbances (top) and with an attached plate and wind (bottom). TABLE I: Relative memory usage between MPPI with 4096 samples and DMPO. # DMPO Samples Memory Reduction 256 4.3 × 512 3.1 × 1024 1.9 × 2048 1.1 × C. Tracking Performance on Yaw Flips Next, we evaluate performance on zig-zags with yaw flips. The E2E baseline could not successfully transfer to the real system on this task. The top row of Figure 4 reports the performance of DMPO and MPPI without the presence of additional disturbances. Again, with 512 samples or fewer, MPPI would consistently crash, while DMPO with as few as 128 can successfully stay in the air. At 256 samples, DMPO outperforms the best MPPI controller with 4096 samples by over 27%. And in this much harder scenario, DMPO with 4096 samples is 64% better than MPPI. Breaking down the cost, we see that DMPO with 256 or more samples does a much better job in tracking both desired position and orientation. Figure 3 illustrates an example trajectory and how DMPO has much better position tracking (especially in the Z direction) and rotates more rapidly to improving orientation tracking. We report the perturbation results in the bottom row of Figure 4. In this scenario, MPPI needed 8192 samples to avoid crashing, while DMPO remained robust at 512 samples, outperforming MPPI by 7%. And given 4096 samples, DMPO is over 57% better than MPPI. We again see that position error is substantially lower for DMPO. In contrast, DMPO at 512 samples was slightly worse than MPPI for orientation error. Yet, DMPO quickly got better at tracking orientation with 1024 or more samples. Comparing DMPO in this case to the unperturbed scenario, we see that its performance is markedly similar. In fact, it only got worse by about 7% on average, while MPPI incurred about 11% more cost. The median position and orientation errors are only slightly larger with disturbances, except for the 512-sample DMPO. Together, these results indicate the zero-shot generalization capability of DMPO in the presence of unknown disturbances. Additional results can be found at https://tinyurl.com/mr2ywmnw. D. Compute Requirements × DMPO with 256 samples is 1.2 faster than MPPI with 4096 samples on our offboard computer while outperforming it on the yaw flip task. And the savings may be even greater for on-board compute which is more constrained. We report the memory usage of DMPO for various samples compared to MPPI with 4096 samples in Table I. With 256 samples, DMPO requires 4.3 less memory. Altogether, this means that we can achieve better performance while using less compute and memory compared to MPPI. × VI. CONCLUSION We devised DMPO, a method for jointly learning the optimizer and warm-starting procedure for MPC. By framing the optimizer as a policy in an auxiliary MDP, we showed how MPC could be treated as a structured policy class and learned via MFRL. We evaluated DMPO on a real quadrotor platform tracking infeasible zig-zag trajectories and showed it can outperform E2E and MPPI controllers with far fewer samples. And DMPO is even more robust than MPPI to unseen disturbances, such as unknown wind fields and an attached cardboard drag plate. Moreover, since DMPO can accomplish this level of performance with fewer samples, it can save up to 4.3 compared to MPPI. This indicates DMPO is a viable strategy to leverage the robustness of MPC while improving upon these hand- designed controllers and better match the optimal policy. memory and reduce runtime by 1.2 × × 1282565121024204840961024204840968192DMPOMPPI0.200.250.300.350.400.45Costs1282565121024204840961024204840968192DMPOMPPI0.100.150.200.25Position Error (m)1282565121024204840961024204840968192DMPOMPPI0.120.140.160.180.200.220.24Orientation Error5121024204840968192DMPOMPPI0.2000.2250.2500.2750.3000.3250.350Costs5121024204840968192DMPOMPPI0.080.100.120.140.16Position Error (m)5121024204840968192DMPOMPPI0.100.120.140.160.180.20Orientation Error REFERENCES [1] M. A. OpenAI, B. Baker, M. Chociej, R. J ́ozefowicz, B. McGrew, J. W. Pachocki, J. Pachocki, A. Petron, M. Plappert, G. Powell, et al., "Learning Dexterous In-Hand Manipulation," arXiv preprint arXiv:1808.00177, 2018. [2] K. Huang, R. Rana, G. Shi, A. Spitzer, and B. Boots, "DATT: Deep Adaptive Trajectory Tracking for Quadrotor Control," in Conference on Robot Learning (CoRL), 2023. [3] E. Kaufmann, L. Bauersfeld, A. Loquercio, M. M ̈uller, V. Koltun, and D. Scaramuzza, "Champion-Level Drone Racing Using Deep Reinforcement Learning," Nature, vol. 620, no. 7976, pp. 982–987, 2023. [4] M. O'Connell, G. Shi, X. Shi, K. Azizzadenesheli, A. Anandkumar, Y. Yue, and S.-J. Chung, "Neural-fly enables rapid learning for agile flight in strong winds," Science Robotics, vol. 7, no. 66, p. eabm6597, 2022. [5] G. Shi, X. Shi, M. O'Connell, R. Yu, K. Azizzadenesheli, A. Anand- kumar, Y. Yue, and S.-J. Chung, "Neural lander: Stable drone landing control using learned dynamics," in 2019 international conference on robotics and automation (icra). IEEE, 2019, pp. 9784–9790. [6] J. Tobin, R. Fong, A. Ray, J. Schneider, W. Zaremba, and P. Abbeel, "Domain Randomization for Transferring Deep Neural Networks from Simulation to the Real World," in IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2017, pp. 23–30. [7] X. B. Peng, M. Andrychowicz, W. Zaremba, and P. Abbeel, "Sim-to- Real Transfer of Robotic Control with Dynamics Randomization," in IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2018, pp. 3803–3810. [8] X. Chen, J. Hu, C. Jin, L. Li, and L. Wang, "Understanding Domain Randomization for Sim-to-Real Transfer," arXiv preprint arXiv:2110.03239, 2021. [9] M. Morari and J. H. Lee, "Model predictive control: past, present and future," Computers & chemical engineering, vol. 23, no. 4-5, pp. 667–682, 1999. [10] G. Williams, N. Wagener, B. Goldfain, P. Drews, J. M. Rehg, B. Boots, and E. A. Theodorou, "Information theoretic MPC for model-based reinforcement learning," in IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2017, pp. 1714–1721. [11] C. Yu, G. Shi, S.-J. Chung, Y. Yue, and A. Wierman, "The power of predictions in online control," Advances in Neural Information Processing Systems, vol. 33, pp. 1994–2004, 2020. [12] N. Wagener, C.-A. Cheng, J. Sacks, and B. Boots, "An Online Learning Approach to Model Predictive Control," arXiv preprint arXiv:1902.08967, 2019. [13] T. Erez, Y. Tassa, and E. Todorov, "Infinite-Horizon Model Predictive Control for Periodic Tasks with Contacts," Robotics: Science and systems VII, p. 73, 2012. [14] N. Jiang, A. Kulesza, S. Singh, and R. Lewis, "The Dependence of Effective Planning Horizon on Model Accuracy," in Proceedings of the 2015 International Conference on Autonomous Agents and Multiagent Systems, 2015, pp. 1181–1189. [15] A. Tamar, G. Thomas, T. Zhang, S. Levine, and P. Abbeel, "Learning from the Hindsight Plan - Episodic MPC Improvement," in IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2017, pp. 336–343. [16] T. Li, R. Yang, G. Qu, G. Shi, C. Yu, A. Wierman, and S. Low, "Robustness and consistency in linear quadratic control with untrusted predictions," Proceedings of the ACM on Measurement and Analysis of Computing Systems, vol. 6, no. 1, pp. 1–35, 2022. [17] A. Jain, L. Chan, D. S. Brown, and A. D. Dragan, "Optimal Cost Design for Model Predictive Control," in Learning for Dynamics and Control. PMLR, 2021, pp. 1205–1217. [18] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov, "Proxi- mal Policy Optimization Algorithms," arXiv preprint arXiv:1707.06347, 2017. [19] J. Schulman, S. Levine, P. Abbeel, M. Jordan, and P. Moritz, "Trust Region Policy Optimization," in International Conference on Machine Learning (ICML). PMLR, 2015, pp. 1889–1897. [20] G. Williams, P. Drews, B. Goldfain, J. M. Rehg, and E. A. Theodorou, "Aggressive driving with model predictive path integral control," in IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2016, pp. 1433–1440. [21] J. Sacks and B. Boots, "Learning to Optimize in Model Predictive Control," in IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2022, pp. 10 549–10 556. [22] M. Andrychowicz, M. Denil, S. Gomez, M. W. Hoffman, D. Pfau, T. Schaul, B. Shillingford, and N. De Freitas, "Learning to learn by gradient descent by gradient descent," in Advances in Neural Information Processing Systems (NeurIPS), 2016, pp. 3981–3989. [23] S. Ravi and H. Larochelle, "Optimization as a Model for Few-Shot Learning," International Conference on Learning Representations (ICLR), 2016. [24] K. Lv, S. Jiang, and J. Li, "Learning Gradient Descent: Better Generalization and Longer Horizons," in International Conference on Machine Learning (ICML). PMLR, 2017, pp. 2247–2255. [25] T. Chen, W. Zhang, Z. Jingyang, S. Chang, S. Liu, L. Amini, and Z. Wang, "Training Stronger Baselines for Learning to Optimize," Advances in Neural Information Processing Systems (NeurIPS), vol. 33, 2020. [26] S. Flennerhag, Y. Schroecker, T. Zahavy, H. van Hasselt, D. Sil- ver, and S. Singh, "Bootstrapped Meta-Learning," arXiv preprint arXiv:2109.04504, 2021. [27] J. Yang, T. Chen, M. Zhu, F. He, D. Tao, Y. Liang, and Z. Wang, "Learning to Generalize Provably in Learning to Optimize," in Inter- national Conference on Artificial Intelligence and Statistics. PMLR, 2023, pp. 9807–9825. [28] X. Chen, T. Chen, Y. Cheng, W. Chen, A. Awadallah, and Z. Wang, "Scalable Learning to Optimize: A Learned Optimizer Can Train Big Models," in European Conference on Computer Vision. Springer, 2022, pp. 389–405. [29] L. Metz, C. D. Freeman, N. Maheswaranathan, and J. Sohl-Dickstein, "Training Learned Optimizers with Randomly Initialized Learned Optimizers," arXiv preprint arXiv:2101.07367, 2021. [30] L. Metz, N. Maheswaranathan, C. D. Freeman, B. Poole, and J. Sohl- Dickstein, "Tasks, Stability, Architecture, and Compute: Training More Effective Learned Optimizers, and Using Them to Train Themselves," arXiv preprint arXiv:2009.11243, 2020. [31] O. Wichrowska, N. Maheswaranathan, M. W. Hoffman, S. G. Col- menarejo, M. Denil, N. Freitas, and J. Sohl-Dickstein, "Learned Optimizers that Scale and Generalize," in International Conference on Machine Learning (ICML). PMLR, 2017, pp. 3751–3760. [32] L. Metz, N. Maheswaranathan, J. Nixon, D. Freeman, and J. Sohl- Dickstein, "Understanding and Correcting Pathologies in the Training of Learned Optimizers," in International Conference on Machine Learning (ICML). PMLR, 2019, pp. 4556–4565. [33] K. Li and J. Malik, "Learning to Optimize," arXiv preprint arXiv:1606.01885, 2016. [34] --, "Learning to Optimize Neural Nets," arXiv preprint arXiv:1703.00441, 2017. [35] C. Lu, J. Kuba, A. Letcher, L. Metz, C. Schroeder de Witt, and J. Foerster, "Discovered Policy Optimisation," Advances in Neural Information Processing Systems (NeurIPS), vol. 35, pp. 16 455–16 468, 2022. [36] J. Oh, M. Hessel, W. M. Czarnecki, Z. Xu, H. P. van Hasselt, S. Singh, and D. Silver, "Discovering Reinforcement Learning Algorithms," Advances in Neural Information Processing Systems, vol. 33, pp. 1060– 1070, 2020. [37] L. Kirsch, S. van Steenkiste, and J. Schmidhuber, "Improving General- ization in Meta Reinforcement Learning Using Learned Objectives," arXiv preprint arXiv:1910.04098, 2019. [38] R. Houthooft, Y. Chen, P. Isola, B. Stadie, F. Wolski, O. Jonathan Ho, and P. Abbeel, "Evolved Policy Gradients," Advances in Neural Information Processing Systems, vol. 31, 2018. [39] J. D. Co-Reyes, Y. Miao, D. Peng, E. Real, S. Levine, Q. V. Le, H. Lee, and A. Faust, "Evolving Reinforcement Learning Algorithms," arXiv preprint arXiv:2101.03958, 2021. [40] J. X. Wang, Z. Kurth-Nelson, D. Tirumala, H. Soyer, J. Z. Leibo, R. Munos, C. Blundell, D. Kumaran, and M. Botvinick, "Learning to reinforcement learn," arXiv preprint arXiv:1611.05763, 2016. [41] Z. Erickson, H. M. Clever, G. Turk, C. K. Liu, and C. C. Kemp, "Deep Haptic Model Predictive Control for Robot-Assisted Dressing," in IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2018, pp. 4437–4444. [42] I. Lenz, R. A. Knepper, and A. Saxena, "DeepMPC: Learning Deep Latent Features for Model Predictive Control," in Robotics: Science and Systems (R:SS). Rome, Italy, 2015. [43] J. Kocijan, R. Murray-Smith, C. E. Rasmussen, and A. Girard, "Gaussian process model based predictive control," in American Control Conference (ACC), vol. 3. IEEE, 2004, pp. 2214–2219. [44] J. Fu, S. Levine, and P. Abbeel, "One-Shot Learning of Manipulation Skills with Online Dynamics Adaptation and Neural Network Priors," in IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2016, pp. 4019–4026. [45] K. Chua, R. Calandra, R. McAllister, and S. Levine, "Deep Reinforce- ment Learning in a Handful of Trials using Probabilistic Dynamics Models," arXiv preprint arXiv:1805.12114, 2018. [46] A. Nagabandi, G. Kahn, R. S. Fearing, and S. Levine, "Neural Network Dynamics for Model-Based Deep Reinforcement Learning with Model- Free Fine-Tuning," in IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2018, pp. 7559–7566. [47] C. Finn and S. Levine, "Deep Visual Foresight for Planning Robot Motion," in IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2017, pp. 2786–2793. [48] N. Wahlstr ̈om, T. B. Sch ̈on, and M. P. Deisenroth, "From Pixels to Torques: Policy Learning with Deep Dynamical Models," arXiv preprint arXiv:1502.02251, 2015. [49] M. Watter, J. T. Springenberg, J. Boedecker, and M. Riedmiller, "Embed to Control: A Locally Linear Latent Dynamics Model for Control from Raw Images," arXiv preprint arXiv:1506.07365, 2015. [50] E. Banijamali, R. Shu, H. Bui, and A. Ghodsi, "Robust Locally-Linear Controllable Embedding," in International Conference on Artificial Intelligence and Statistics (AISTATS). PMLR, 2018, pp. 1751–1759. [51] F. Ebert, C. Finn, S. Dasari, A. Xie, A. Lee, and S. Levine, "Visual Foresight: Model-Based Deep Reinforcement Learning for Vision- Based Robotic Control," arXiv preprint arXiv:1812.00568, 2018. [52] J.-S. Ha, Y.-J. Park, H.-J. Chae, S.-S. Park, and H.-L. Choi, "Adaptive Path-Integral Autoencoder: Representation Learning and Planning for Dynamical Systems," Advances in Neural Information Processing Systems (NeurIPS), 2018. [53] D. Hafner, T. Lillicrap, I. Fischer, R. Villegas, D. Ha, H. Lee, and J. Davidson, "Learning Latent Dynamics for Planning from Pixels," in International Conference on Machine Learning (ICML). PMLR, 2019, pp. 2555–2565. [54] M. Zhong, M. Johnson, Y. Tassa, T. Erez, and E. Todorov, "Value Function Approximation and Model Predictive Control," in IEEE Symposium on Adaptive Dynamic Programming and Reinforcement Learning (ADPRL). IEEE, 2013, pp. 100–107. [55] U. Rosolia and F. Borrelli, "Learning Model Predictive Control for Iterative Tasks. A Data-Driven Control Framework," IEEE Transactions on Automatic Control, vol. 63, no. 7, pp. 1883–1896, 2017. [56] K. Lowrey, A. Rajeswaran, S. Kakade, E. Todorov, and I. Mordatch, "Plan Online, Learn Offline: Efficient Learning and Exploration via Model-Based Control," arXiv preprint arXiv:1811.01848, 2018. [57] M. Bhardwaj, S. Choudhury, and B. Boots, "Blending MPC & Value Function Approximation for Efficient Reinforcement Learning," arXiv preprint arXiv:2012.05909, 2020. [58] M. Bhardwaj, A. Handa, D. Fox, and B. Boots, "Information Theoretic Model Predictive Q-Learning," in Learning for Dynamics & Control (L4DC). PMLR, 2020, pp. 840–850. [59] B. Amos and D. Yarats, "The Differentiable Cross-Entropy Method," in International Conference on Machine Learning (ICML). PMLR, 2020, pp. 291–302. [60] P. Karkus, D. Hsu, and W. S. Lee, "QMDP-Net: Deep Learning for Planning under Partial Observability," arXiv preprint arXiv:1703.06692, 2017. [61] M. Okada, L. Rigazio, and T. Aoshima, "Path Integral Networks: End-to- End Differentiable Optimal Control," arXiv preprint arXiv:1706.09597, 2017. [62] B. Amos, I. D. J. Rodriguez, J. Sacks, B. Boots, and J. Z. Kolter, "Differentiable MPC for End-to-end Planning and Control," arXiv preprint arXiv:1810.13400, 2018. [63] M. Okada and T. Taniguchi, "Acceleration of Gradient-based Path Integral Method for Efficient Optimal and Inverse Optimal Control," in IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2018, pp. 3013–3020. [64] M. Pereira, D. D. Fan, G. N. An, and E. Theodorou, "MPC-Inspired Neural Network Policies for Sequential Decision Making," arXiv preprint arXiv:1802.05803, 2018. [65] T. Power and D. Berenson, "Variational Inference MPC for Robot Motion with Normalizing Flows," Advances in Neural Information Processing Systems (NeurIPS) Workshop on Robot Learning: Self- Supervised and Lifelong Learning, 2021. [66] --, "Variational Inference MPC using Normalizing Flows and Out- of-Distribution Projection," arXiv preprint arXiv:2205.04667, 2022. [67] J. Sacks and B. Boots, "Learning Sampling Distributions for Model Predictive Control," in Conference on Robot Learning (CoRL). PMLR, 2023, pp. 1733–1742. [68] M. Okada and T. Taniguchi, "Variational Inference MPC for Bayesian Model-based Reinforcement Learning," in Conference on Robot Learning (CoRL). PMLR, 2020, pp. 258–272. [69] A. Lambert, A. Fishman, D. Fox, B. Boots, and F. Ramos, "Stein Variational Model Predictive Control," arXiv preprint arXiv:2011.07641, 2020. [70] T. Power and D. Berenson, "Constrained Stein Variational Trajectory Optimization," arXiv preprint arXiv:2308.12110, 2023. [71] D. M. Asmar, R. Senanayake, S. Manuel, and M. J. Kochenderfer, "Model Predictive Optimized Path Integral Strategies," in IEEE Interna- tional Conference on Robotics and Automation (ICRA). IEEE, 2023, pp. 3182–3188. [72] J. Yin, Z. Zhang, E. Theodorou, and P. Tsiotras, "Trajectory Dis- tribution Control for Model Predictive Path Integral Control Using Covariance Steering," in 2022 International Conference on Robotics and Automation (ICRA). IEEE, 2022, pp. 1478–1484. [73] I. S. Mohamed, J. Xu, G. Sukhatme, and L. Liu, "Towards Efficient MPPI Trajectory Generation with Unscented Guidance: U-MPPI Control Strategy," arXiv preprint arXiv:2306.12369, 2023. [74] K. Honda, N. Akai, K. Suzuki, M. Aoki, H. Hosogaya, H. Okuda, and T. Suzuki, "Stein Variational Guided Model Predictive Path Integral Control: Proposal and Experiments with Fast Maneuvering Vehicles," arXiv preprint arXiv:2309.11040, 2023. [75] G. Lee, B. Hou, S. Choudhury, and S. S. Srinivasa, "Bayesian Residual Policy Optimization:: Scalable Bayesian Reinforcement Learning with Clairvoyant Experts," in 2021 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2021, pp. 5611–5618. [76] T. Johannink, S. Bahl, A. Nair, J. Luo, A. Kumar, M. Loskyll, J. A. Ojea, E. Solowjow, and S. Levine, "Residual Reinforcement Learning for Robot Ccontrol," in 2019 International Conference on Robotics and Automation (ICRA). IEEE, 2019, pp. 6023–6029. [77] T. Silver, K. Allen, J. Tenenbaum, and L. Kaelbling, "Residual Policy Learning," arXiv preprint arXiv:1812.06298, 2018. [78] Y. Yang, X. Meng, W. Yu, T. Zhang, J. Tan, and B. Boots, "Continuous Versatile Jumping Using Learned Action Residuals," in Learning for Dynamics & Control (L4DC). PMLR, 2023, pp. 770–782. [79] Y. Yang, G. Shi, X. Meng, W. Yu, T. Zhang, J. Tan, and B. Boots, "Cajun: Continuous adaptive jumping using a learned centroidal controller," arXiv preprint arXiv:2306.09557, 2023. [80] J. Pravitra, K. A. Ackerman, C. Cao, N. Hovakimyan, and E. A. Theodorou, "L1-Adaptive MPPI Architecture for Robust and Agile Control of Multirotors," in 2020 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2020, pp. 7661–7666. [81] K. Lee, J. Gibson, and E. A. Theodorou, "Aggressive Perception-Aware Navigation Using Deep Optical Flow Dynamics and PixelMPC," IEEE Robotics and Automation Letters, vol. 5, no. 2, pp. 1207–1214, 2020. [82] D. Hanover, P. Foehn, S. Sun, E. Kaufmann, and D. Scaramuzza, "Performance, Precision, and Payloads: Adaptive Nonlinear MPC for Quadrotors," IEEE Robotics and Automation Letters, vol. 7, no. 2, pp. 690–697, 2021. [83] S. Sun, A. Romero, P. Foehn, E. Kaufmann, and D. Scaramuzza, "A Comparative Study of Nonlinear MPC and Differential-Flatness-Based Control for Quadrotor Agile Flight," IEEE Transactions on Robotics, vol. 38, no. 6, pp. 3357–3373, 2022. [84] E. Kaufmann, A. Loquercio, R. Ranftl, M. M ̈uller, V. Koltun, and D. Scaramuzza, "Deep Drone Acrobatics," arXiv preprint arXiv:2006.05768, 2020. [85] Y. Zhang, W. Wang, P. Huang, and Z. Jiang, "Monocular Vision-Based Sense and Avoid of UAV Using Nonlinear Model Predictive Control," Robotica, vol. 37, no. 9, pp. 1582–1594, 2019. [86] A. Molchanov, T. Chen, W. H ̈onig, J. A. Preiss, N. Ayanian, and G. S. Sukhatme, "Sim-to-(Multi)-Real: Transfer of Low-Level Robust Control Policies to Multiple Quadrotors," in 2019 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2019, pp. 59–66. [87] D. Zhang, A. Loquercio, X. Wu, A. Kumar, J. Malik, and M. W. Mueller, "Learning a Single Near-hover Position Controller for Vastly Different Quadcopters," in 2023 IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2023, pp. 1263–1269. [88] J. Hwangbo, I. Sa, R. Siegwart, and M. Hutter, "Control of a Quadrotor with Reinforcement Learning," IEEE Robotics and Automation Letters, vol. 2, no. 4, pp. 2096–2103, 2017. [89] E. Kaufmann, L. Bauersfeld, and D. Scaramuzza, "A Benchmark Comparison of Learned Control Policies for Agile Quadrotor Flight," in 2022 International Conference on Robotics and Automation (ICRA). IEEE, 2022, pp. 10 504–10 510. [90] A. Romero, Y. Song, and D. Scaramuzza, "Actor-Critic Model Predictive Control," arXiv preprint arXiv:2306.09852, 2023. [91] Y. Song and D. Scaramuzza, "Policy Search for Model Predictive Control with Application to Agile Drone Flight," IEEE Transactions on Robotics, vol. 38, no. 4, pp. 2114–2130, 2022. [92] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, et al., "PyTorch: An Imperative Style, High-Performance Deep Learning Library," Advances in Neural Information Processing Systems (NeurIPS), vol. 32, pp. 8026–8037, 2019. [93] J. Schulman, P. Moritz, S. Levine, M. Jordan, and P. Abbeel, "High-Dimensional Continuous Control Using Generalized Advantage Estimation," arXiv preprint arXiv:1506.02438, 2015. [94] D. P. Kingma and J. Ba, "Adam: A Method for Stochastic Optimization," arXiv preprint arXiv:1412.6980, 2014. [95] J. H. Halton, "Algorithm 247: Radical-inverse quasi-random point sequence," Communications of the ACM, vol. 7, no. 12, pp. 701–702, 1964.
http://arxiv.org/abs/2310.04585v1
"2023-10-06T20:57:34"
"2023-10-06T20:57:34"
The Impact of Equal Opportunity on Statistical Discrimination
I modify the canonical statistical discrimination model of Coate and Loury (1993) by assuming the firm's belief about an individual's unobserved class is machine learning-generated and, therefore, contractible. This expands the toolkit of a regulator beyond belief-free regulations like affirmative action. Contractible beliefs make it feasible to require the firm to select a decision policy that equalizes true positive rates across groups -- what the algorithmic fairness literature calls equal opportunity. While affirmative action does not necessarily end statistical discrimination, I show that imposing equal opportunity does.
[ "John Y. Zhu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04585v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04585v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "econ.TH", "@scheme": "http://arxiv.org/schemas/atom" }
[ "econ.TH", "cs.LG" ]
THE IMPACT OF EQUAL OPPORTUNITY ON STATISTICAL DISCRIMINATION JOHN Y. ZHU1 October 10, 2023 Abstract I modify the canonical statistical discrimination model of Coate and Loury (1993) by assuming the firm's belief about an individual's unobserved class is machine learning-generated and, therefore, contractible. This expands the toolkit of a regulator beyond belief-free regulations like affirmative action. Con- tractible beliefs make it feasible to require the firm to select a decision policy that equalizes true positive rates across groups – what the algorithmic fairness literature calls equal opportunity. While affirmative action does not necessarily end statistical discrimination, I show that imposing equal opportunity does. JEL Codes: C53, D86, J71, L51 Keywords: statistical discrimination, algorithmic fairness, equal opportunity 3 2 0 2 t c O 6 ] H T . n o c e [ 1 v 5 8 5 4 0 . 0 1 3 2 : v i X r a 1University of Kansas, johnzhuyiran@ku.edu. 1 Introduction In traditional economic models, beliefs exist in the minds of humans and are, there- fore, not contractible. In contrast, beliefs generated by machine learning algorithms in the form of predictions are, in principle, contractible. In this paper, I show how belief-contingent regulation can be used to end equilibrium statistical discrimination in the canonical model of Coate and Loury (1993) – referred to as CL from now on. Recall, in that model, applicants belonging to two ex-ante identical groups, i ∈ {w, b}, individually decide if they want to become qualified at iid cost. There is a firm that does not observe qualification status, but does observe each applicant's group identity i, and some signals, x, that are informative of qualification status and/or group identity. The observed (i, x) is the features vector of an applicant, and the unobserved qualification status is an applicant's class y ∈ {q, u}. Given an (i, x) applicant, the firm forms a belief, f (i, x), about the conditional probability that y = q. The firm then makes a binary accept-reject decision on the applicant. All applicants prefer accept, while the firm prefers accept if and only if y = q. Despite being ex-ante identical, the two groups of applicants can end up in a dis- criminatory equilibrium. Relative to the favored group, the discriminated group faces higher acceptance standards, which leads to fewer applicants from the discriminated group becoming qualified, which in turn rationalizes the higher standards they face. CL then impose an affirmative action control on the firm. A control is a regulation that limits the kinds of acceptance policies the firm can use. The affirmative action control requires the firm to accept applicants from different groups at equal rates. In any discriminatory equilibrium, affirmative action brings gains to the discriminated group by inducing the firm to shrink the acceptance rate gap. However, in the long run, these gains need not lead to a non-discriminatory equilibrium, that would allow Indeed, under affirmative action, there exist the control to be harmlessly lifted. steady states where the previously discriminated group is now patronized with lower acceptance standards. Without affirmative action, such a state is not in equilibrium. If the control is lifted, the patronizing lower standards revert to higher standards, and the original discriminatory equilibrium can re-emerge. This begs a natural question: Is there an ideal control that brings gains to the discriminated group in any discriminatory equilibrium and whose steady states coincide with the set of non-discriminatory equilibria? I show ideal controls exist if the firm's belief, f , is contractible. 1 In the traditional setting of CL, where one imagines the belief, f , as existing in the mind of a human, it makes sense to assume f is not contractible and focus on belief-free controls like affirmative action. However, when the firm uses a machine learning algorithm to compute f , a control ought to be able to depend on it. This introduces a new world of algorithmic controls that regulate the decisions of the firm based on its beliefs. In particular, consider what the algorithmic fairness literature calls the equal op- portunity control: Given a decision policy d, the distribution of features μ, and belief f , the true positive rate of a group i is (cid:80) x d(i, x)μ(i, x)f (i, x) (cid:80) x μ(i, x)f (i, x) , where d(i, x) is the probability an (i, x) applicant is accepted. The equal opportunity control requires the firm to choose a decision policy that equalizes true positive rates across groups. In contrast, the non-algorithmic affirmative action control requires the firm to choose a decision policy that equalizes acceptance rates, (cid:80) x d(i, x)μ(i, x) (cid:80) x μ(i, x) , across groups. In any discriminatory equilibrium, when either control is imposed, utility max- imization drives the firm to lower the acceptance rate of the favored group and to raise the acceptance rate of the discriminated group. This, by definition, brings gains to the discriminated group. In addition, as the firm starts raising the acceptance rate of the discriminated group, its incentive to invest in becoming qualified starts increasing, bringing it closer to that of the favored group. Under the equal opportunity control, the firm's utility is maximized precisely when incentives are equalized across groups. This ensures In contrast, that any steady state under equal opportunity is non-discriminatory. affirmative action's requirement to equalize acceptance rates causes the firm to push past the equal incentives point. The acceptance rate of the discriminated group can become so high that the incentive it faces starts declining – possibly dropping below that of the favored group again. This leads to the existence of discriminatory steady states under affirmative action where one group is patronized relative to the other. In practice, a regulator seeking to end statistical discrimination likely knows much 2 less about market conditions than the firm it is regulating. Moreover, political and legal considerations may constrain the regulator to act in a transparent way. The one thing a regulator has going for it is its authority to audit the firm's machine learning-generated belief. The equal opportunity control is ideally adapted to this situation. Implementing it requires no knowledge of model parameter values – only the firm's belief and the distribution of features are needed. Moreover, how this in- formation is used in regulating the firm is easily interpretable. The equal opportunity control demonstrates how, in a world where beliefs are contractible, a regulator can use belief-contingent regulation to end equilibrium statistical discrimination in a ro- bust and transparent way. Related Literature. So far, I have shown how ideas from the field of algorith- mic fairness, such as algorithmic audits and equal opportunity, can be used to tackle problems of statistical discrimination. Conversely, my work on statistical discrimina- tion can be viewed as a contribution to the field of algorithmic fairness. To begin, let us first review the basics of algorithmic decision-making, using the language of the statistical discrimination model sketched out in the introduction. There is a vector of random variables, (i, x, y), representing the distribution of ob- served group identity, observed other features, and unobserved class of a population of individuals. In addition, there is a set of available decisions D. Let ∆(D) de- note the set of all probability distributions on D. The goal is to find a decision policy d : (i, x) → ∆(D) that minimizes the expectation of some given loss function, l(y, d(i, x)). Given the distribution, μ, of features, computing Ei,x,yl(y, d(i, x)) requires es- timating the conditional distribution of y given (i, x). This is what a supervised machine learning algorithm does. Once the algorithm generates an estimate, f , an expected loss-minimizing d can be selected. Today, algorithmic decision-making is ubiquitous. See Agrawal et al. (2018). Kleinberg et al. (2018a) demonstrate how algorithmic decision-making can substan- tially outperform human decision-making in a high stakes setting. Nevertheless, there is concern that algorithmic decision-making can be unfair, reinforcing pre-existing dis- criminatory behavior. For example, in a study on household credit markets, Fuster et al. (2022) show how certain minority groups are adversely affected by the intro- duction of machine learning algorithms for predicting creditworthiness. The field of algorithmic fairness emerged in response to such concerns. It deals 3 with the disparate treatment of or impact to individuals with different group iden- tities under algorithmic decision-making. See Barocas et al. (2019) for a textbook treatment. The literature can be roughly classified into two areas depending on the focus – removing disparate treatment or removing disparate impact. Removing Disparate Treatment. Papers in this area aim to ensure that decisions do not "factor in" group identity. The most direct way to achieve that aim is to require that d not depend on group identity. However, such color-blind decisions can still factor in group identity indirectly through proxies. To mitigate proxy effects, Pope and Sydnor (2011) propose averaging out group identity by requiring that d depend on x only up to Eif (i, x). Similarly, Yang and Dobbie (2020) propose fixing a group identity – say, w – and requiring that d depend on x only up to f (w, x). Kusner et al. (2017) take as given a directed acyclic graph (DAG) modeling the causal relationships between i, x, and y, and then require that d not depend on any causal descendants of group identity. Dwork et al. (2012) take as given two similarity metrics, one on I × X and another on D, and then require that similar individuals receive similar decisions. Removing Disparate Impact. Papers in this area aim to ensure that the distribu- tions of decisions experienced by different groups are "fair" in some statistical sense. Removing disparate impact often requires that decision policies factor in group iden- tity. Common notions of fairness include statistical parity, equal opportunity, equal odds, group calibration, positive and negative class balance, predictive parity, and er- ror rate balance. Zemel et al. (2013), Feldman et al. (2015), and Hardt et al. (2016b) introduce ways of regulating algorithmic decision-making to guarantee that the se- lected decision policy satisfies statistical parity, equal opportunity, or equal odds. Recently, there have been calls to bring an economic perspective to the study of algorithmic fairness, as a complement to the purely statistical approaches surveyed above. See, for example, Cowgill and Tucker (2020). Such a reaction is driven in part by some issues of the purely statistical approaches: 1. Pareto-Inferiority. Corbett-Davies et al. (2023) show that, for a given applica- tion, if the loss function, l, already encodes the fairness concerns appropriate for that application, then imposing additional purely statistical fairness constraints like the ones described above can lead to all groups being made worse off. See also Hu and Chen (2020) for a similar finding. Moreover, even if l represents a 4 purely utilitarian social welfare function, imposing common algorithmic fairness regulations can not only reduce welfare but also reduce fairness as measured in an application-appropriate way. Corbett-Davies et al. (2017) show that such welfare losses can be large in real-life applications. 2. Agency Problems. In most applications, the agent engaged in algorithmic decision-making and the regulator with fairness concerns are different entities. Moreover, the regulator often has limited ability to control the agent's selec- tion of a decision policy – either because of information asymmetries or limited regulatory tools. Such agency problems are often ignored. 3. Endogenous Data. Regulations of algorithmic decision-making meant to en- hance fairness are often derived under the assumption that the joint distribution of (i, x, y) is exogenous. Ideally, the design of such regulations should anticipate how a regulation will affect the endogenous relationships between i, x, and y. Liu et al. (2018) introduce a reduced-form model of how the chosen decision policy affects (i, x, y), and show that imposing fairness constraints meant to improve welfare under the current distribution of (i, x, y) can lead to long-term changes in the distribution of (i, x, y) that make the protected group worse off. (a) Manipulable Data. A distinct but related issue concerns the fact that, in practice, data collected about (i, x, y) may be strategically manipulated by the population of individuals. Thus, the choice of a decision policy should take into account how that policy will affect the way (i, x, y) is manipulated. 4. Inconsistency. Without an economic model to discipline the choice of how to measure fairness, the literature on disparate impact has introduced a plethora of model-free statistical fairness conditions. Kleinberg et al. (2016) and Choulde- chova (2017) show that many of these fairness conditions are generically impos- sible to satisfy simultaneously. 5. Parameter-Dependency. In contrast, some of the methods for removing dis- parate treatment depend quite strongly on the regulator having detailed knowl- edge of an underlying model. To ensure counterfactual fairness and path-specific counterfactual fairness, Kusner et al. (2017) and Chiappa (2019) require the reg- ulator to know the causal DAG governing (i, x, y). Achieving fairness through awareness, as in Dwork et al. (2012), requires the regulator to know what it 5 means for different individuals and decisions to be similar, which depends on the application. New research in algorithmic fairness has begun to address these issues. Hei- dari et al. (2018) introduce a benefit function b(y, d(i, x)) meant to capture relevant welfare considerations, and argues for constraining the expected loss-minimization problem by requiring the expected benefit to be above some lower bound. Liang et al. (2023) introduce a limited-tools agency problem where the regulator can only use coarsifications of data to align the incentives of the agent. Blattner et al. (2021) introduce an information asymmetry agency problem where the regulator is unable to perfectly monitor the machine learning-generated f . Rambachan et al. (2020) intro- duce a regulator with a non-discriminatory social welfare function, while giving some agents taste-based preferences for discrimination, and then show how, by auditing the agents' machine learning-generated f , the regulator can achieve their first-best payoff. Perdomo et al. (2020) create an equilibrium predictions framework and study how retraining can converge to equilibria. Kleinberg and Raghavan (2020) consider a model where data is both manipulable and endogenous. Hu and Chen (2018) show how fairness-enhancing interventions in a short-term labor market can lead to fairness in a long-term market without intervention. Penn and Patty (2023) endow individuals of the population with preferences and the ability to choose their class, and then an- alyze the equilibrium distribution of (i, x, y). Hardt et al. (2016a), Eliaz and Spiegler (2019), and Frankel and Kartik (2022) model individuals strategically manipulating their data in response to how that data is used in algorithmic decision-making. My paper is based on the observation that Arrovian models of statistical discrim- ination – in which any differences in the conditional distribution of y across groups are derived in equilibrium – are ideal vessels through which to think about algo- rithmic fairness in a coherent way that addresses the issues brought up above. See Arrow (1971). Fang and Moro (2011) provide an excellent survey of statistical dis- crimination models. Patty and Penn (2023) also draw connections between statistical discrimination and algorithmic fairness. Consider the Arrovian statistical discrimination model of CL described in the introduction. Algorithmic bias emerges endogenously, in the form of discriminatory equilibria that feature both disparate treatment and disparate impact. Individuals of the population are endowed with preferences over decisions that yield a natural fairness goal for the regulator: To bring gains to the discriminated group in any discriminatory equilibrium. This goal addresses issue 1 by properly 6 orienting the regulator and ensuring that they do not unintentionally shoot for policies that end up making all groups worse off. In contrast, the agent firm simply wants to maximize its own utility. The regulator, unlike the firm, does not know the parameter values of the model, such as the utilities of various decisions and the distribution of qualification costs. This limits the regulator's ability to control the agent's algorithmic decision-making in a fine-tuned way, yielding a natural agency problem that addresses issue 2. In the model, individuals are not exogenously assigned classes. Instead, each individual chooses their class, taking into account the firm's decision policy. Thus, a natural way for the regulator to show awareness of the long-term impact on fairness from imposing a new regulation is by seeking to design controls under which steady states are non-discriminatory equilibria. This addresses issue 3, while introducing a second fairness goal. With two fairness goals to satisfy now, it is, a priori, not clear that a regulator can achieve both. This brings up issue 4. Indeed, CL's result, about how affirmative action achieves the first but not the second fairness goal, can be interpreted as sug- gesting the two fairness goals might be incompatible. By recasting CL's traditional human decision-making model as a modern model of algorithmic decision-making, I am able to leverage the insights of Kleinberg et al. (2018b, 2020), who argue that a fundamental difference between regulating human decision-making and regulating algorithmic decision-making is that in the latter case, algorithms can be audited – in particular, beliefs are contractible. This allows me to conceive of algorithmic controls as feasible regulations of the firm, eventually leading me to the discovery that the equal opportunity control achieves both fairness goals and, therefore, addresses issue 4. Finally, since the regulator does not know the parameter values of the model, any feasible control that achieves the regulator's fairness goals is necessarily non- parametric. Thus, ideal controls like the equal opportunity control address issue 5. 2 An Economic Model with Machine Learning I take the statistical discrimination model of CL and make one essential change: I replace the rational expectations firm with one that uses a machine learning algorithm to compute a prediction to serve as its contractible belief. There is a firm and a unit mass of applicants. Each applicant possesses a vector of publicly observable features (i, x) and an unobservable binary class y ∈ Y := {q, u}. Here, i ∈ I := {w, b} is the group identity (can generalize to more than two), and 7 x ∈ X := X1 × X2 × . . . × XN are the other features. Assume X is finite. The distribution of applicants over I × X × Y is the result of actions taken by the applicants. Initially, each applicant independently draws a group identity i and a cost c ∈ (−∞, ∞). Let λw and λb = 1 − λw be the positive probabilities of drawing w and b, respectively, and let G and g denote the CDF and PDF of c, respectively. After an applicant draws (i, c), they choose to join a class. Joining class q costs c, while joining class u costs 0. Assume g has full support. The assumption is not essential, but it does simplify the analysis by ensuring that, in equilibrium, there are applicants in both classes. Once an applicant joins a class, their other features, x, are realized according to the following statistical model: Assumption 1. There exists a nonempty Y ⊂ {1, 2, . . . N }, such that p(x|i, y) = p(xY|y)p(x−Y|i, xY) > 0 ∀(i, x, y) ∈ I × X × Y. Assumption 1 allows features to serve as proxies for group identity. CL considers the special case, Y = {1, 2, . . . N }, where there are no proxies for group identity. At this point, the distribution of applicants over I × X × Y is determined. Given that features are public, I assume the firm observes the distribution of applicants over I × X. In addition, the firm forms a contractible belief f : I × X → (0, 1) about the conditional probability that an applicant is of class q. The firm then makes a binary 1-0 decision (e.g., accept-reject, lend-deny, assign to high-low skill job) on each applicant, by choosing a decision policy, defined to be a map d : I × X → [0, 1]. Given an (i, x) applicant, d selects decision 1 with probability d(i, x). If the selected decision is 1, the firm's payoff depends on the applicant's class, vq > 0 or −vu < 0, while the applicant's payoff is ω > 0. If the selected decision is 0, both parties' payoffs are 0. 2.1 The Formal Game Clearly, if an i-applicant with cost c is weakly better off joining class q, then any i-applicant with strictly lower cost is strictly better off joining class q. Thus, for each group i, I imagine a representative i-applicant choosing a cost threshold c(i) so that an i-applicant with cost c joins class q if and only if c ≤ c(i). This allows us to treat the model as a simultaneous-move game, (X, λw, p, G, vq, vu, ω), between three players: A pair of representative applicants choose a pair of cost thresholds c = (c(w), c(b)) and the firm chooses a decision policy d. 8 Given c, the true distribution, μRE, of applicant features is μRE(i, x|c(i)) := λi [G(c(i))p(x|i, q) + (1 − G(c(i)))p(x|i, u)] ∀(i, x) ∈ I × X. Given c and d, the utility of the representative i-applicant, for each group i, is Ui(c(i), d(i)) = ω (cid:88) x∈X μRE(i, x|c(i)) λi d(i, x) − (cid:90) c(i) −∞ cg(c)dc, where d(i) is d restricted to i×X. To ensure Ui is well-defined, assume (cid:82) ∞ −∞ |c|g(c)dc < ∞. The utility of the firm depends on its observed distribution, μ, of applicant features and its machine learning-generated belief, f , UF (d, μ, f ) = (cid:88) (i,x)∈I×X d(i, x)μ(i, x) [f (i, x)vq − (1 − f (i, x))vu] . For now, let us assume the observed distribution is the true one, μ = μRE, and machine learning is perfectly rational (i.e. calibrated): f (i, x) = fRE(i, x|c(i)) := = G(c(i))p(x|q, i) G(c(i))p(x|q, i) + (1 − G(c(i)))p(x|u, i) G(c(i))p(xY|q) G(c(i))p(xY|q) + (1 − G(c(i)))p(xY|u) ∀(i, x) ∈ I × X. In Section 5, we will consider (μ, f ) within some small ε > 0 of (μRE, fRE). A word on notation: When working with a cost threshold pair, cα, that is indexed with some subscript α, we will write μRE,α and fRE,α to refer to μRE and fRE given cα. The same convention applies for superscripts. 2.2 Controls Given a set of other features X, let ∆o(I × X) denote the set of all full-support probability distributions over I × X. Definition. A control k specifies, for each X and (μ, f ) ∈ ∆o(I × X) × (0, 1)|I×X|, a nonempty compact set, k(X, μ, f ) ⊂ [0, 1]|I×X|, of decision policies. A control is a contract that limits the set of decision policies available to the firm based on what a hypothetical regulator is assumed to be able to observe: (X, μ, f ). 9 CL, on the other hand, implicitly assume that controls only depend on (X, μ) be- cause f is thought of as existing in the mind of a human rather than the output of a machine learning algorithm. In either case, controls do not depend on the prefer- ence parameters of the game, (G, vq, vu, ω), which are assumed to be unknown to a regulator. If controls could depend on all parameters of the game, then eliminating statistical discrimination would be a trivial task. Example. The un control specifies, for each X and (μ, f ) ∈ ∆o(I × X) × (0, 1)|I×X|, the set of all decision policies. Example. A decision policy, d, is color-blind if d(w, x) = d(b, x) ∀x ∈ X. The color- blind control specifies, for each X and (μ, f ) ∈ ∆o(I × X) × (0, 1)|I×X|, the set of all color-blind decision policies. Example. The affirmative action control specifies, for each X and (μ, f ) ∈ ∆o(I × X) × (0, 1)|I×X|, k(X, μ, f ) = (cid:26) d ∈ [0, 1]|I×X| (cid:12) (cid:12) (cid:12) (cid:12) AR(w, d, μ) = AR(b, d, μ) , (cid:27) where AR(i, d, μ) := (cid:80) x∈X d(i,x)μ(i,x) (cid:80) x∈X μ(i,x) is the acceptance rate of group i. Unlike the three controls described above, the following algorithmic control de- pends on the firm's machine learning-generated belief: Example. The equal opportunity control specifies, for each X and (μ, f ) ∈ ∆o(I × X) × (0, 1)|I×X|, k(X, μ, f ) = (cid:26) d ∈ [0, 1]|I×X| (cid:12) (cid:12) (cid:12) (cid:12) T P (w, d, μ, f ) = T P (b, d, μ, f ) , (cid:27) where T P (i, d, μ, f ) := (cid:80) x∈X d(i,x)μ(i,x)f (i,x) (cid:80) x∈X μ(i,x)f (i,x) is the true positive rate of group i. Definition. Given a control k and a game (X, λw, p, G, vq, vu, ω), a strategy profile (ck, dk) is a k-controlled equilibrium if 1. ck(i) = arg maxc(i)∈R Ui(c(i), dk(i)) for all groups i, 2. dk ∈ arg maxd∈k(X,μRE,k,fRE,k) UF (d, μRE,k, fRE,k). From now on, the term "equilibrium" will refer to an un-controlled equilibrium. 10 2.3 Characterizing Equilibria This part reviews CL Section I. Results are stated without proof. Fix a game (X, λw, p, G, vq, vu, ω) and let (c∗, d∗) be an equilibrium. (c∗, d∗) can be decomposed into a pair of within-group equilibria, {(c∗(i), d∗(i)) | i ∈ I}. Let us characterize within-group equilibria. Define the likelihood function l(x) := p(xY|q) p(xY|u) ∀x ∈ X. Since p(xY|y) > 0 for all (x, y) ∈ X × Y , l is a well-defined positive function taking finitely many values, 0 < l1 < l2 < . . . < ln for some n. Fix a group i. Given a within-group decision policy d(i), and a likelihood value lm, define (cid:80) d(i|lm) := x∈X,l(x)=lm (cid:80) x∈X,l(x)=lm (G(c(i))p(x|i, q) + (1 − G(c(i)))p(x|i, u))d(i, x) G(c(i))p(x|i, q) + (1 − G(c(i)))p(x|i, u) . d(i|lm) is the probability an i-applicant receives decision 1 under d(i) conditional on having a vector of other features with likelihood value lm. Note, d(i|lm) is independent of c(i) because all applicants in this subgroup, by definition, have vectors of other features with the same likelihood value: d(i|lm) = (cid:80) p(x|i, q)d(i, x) x∈X,l(x)=lm (cid:80) x∈X,l(x)=lm p(x|i, q) (cid:80) = p(x|i, u)d(i, x) x∈X,l(x)=lm (cid:80) x∈X,l(x)=lm p(x|i, u) . Introduce the auxiliary likelihood value l0 = 0. For each likelihood value lm, m ∈ {0, 1, 2, . . . n}, define W W (lm) := ω (cid:88) (p(xY|q) − p(xY|u)) ∈ [0, ω). xY ∈XY , p(xY |q) p(xY |u) >lm W W (lm) = 0 if and only if m ∈ {0, n}. Create the piecewise-linear function W W : [0, ln] → [0, ω) that connects the points {(lm, W W (lm)) | m = 0, 1, . . . n}. Figure 1a depicts an example W W with n = 3. W W is independent of group identity. Refer to any l ∈ [0, ln] as a likelihood mixture. For each likelihood mixture l, define ⌈l⌉ to be the smallest likelihood value ≥ l and ⌈l⌉− denote the next smallest 11 EE EE(l1) EE(l2) W W EE(l3) W W l1 l2 l3 (a) (b) Figure 1 likelihood value, if it exists. Associate to l the set of all within-group decision policies d(i) satisfying d(i|lm) =    1 ⌈l⌉−l ⌈l⌉−⌈l⌉− 0 if lm > ⌈l⌉ if lm = ⌈l⌉ if lm < ⌈l⌉, for each m ∈ {1, 2, . . . n}. Given l ∈ [0, ln], a d(i) associated with l has a threshold form, selecting decision 1/0 for i-applicants with likelihood value above/below ⌈l⌉. W W (l) is the best-response of the representative i-applicant. Definition. A decision policy is fair if both of its within-group decision policies are associated with the same likelihood mixture. Next, for each likelihood value lm, m ∈ {1, 2, . . . n}, define cost EE(lm) to satisfy G(EE(lm)) = 1 vq vu * lm + 1 . If the representative i-applicant chooses c(i) = EE(lm), then the firm is indifferent 12 between making decision 1 and 0 for any i-applicant with likelihood value lm. Since G is strictly increasing and continuous with range (0, 1), EE(lm) exists and is unique for each m ∈ {1, 2, . . . n}. Moreover, EE(l1) > EE(l2) > . . . > EE(ln). Create the correspondence EE : [0, ln] ⊂ R as follows: EE(l) =    [EE(l1), ∞) if l = 0 [EE(lm+1), EE(lm)] if l = lm for some m ∈ {1, 2, . . . n − 1} EE(lm) if l ∈ (lm−1, lm) for some m ∈ {1, 2, . . . n} (−∞, EE(ln)] if l = ln. Like W W , EE is also independent of group identity. Figure 1b depicts an EE su- perimposed on a W W . Each intersection, (l∗, W W (l∗)), of EE and W W is associated with a set of within-group equilibria, {(c∗(i) = W W (l∗), d∗(i))}, where d∗(i) is any within-group decision policy associated with the likelihood mixture l∗. Conversely, each within-group equilibrium is an element of one such set. The set of equilibria is the set of pairs of within-group equilibria, one for each group. Since EE and W W intersect, the set of equilibria is nonempty. Call two equilibria equivalent if they are associated with the same pair of intersections of EE and W W . This partitions the set of equilibria into equivalence classes. Assumption 2. W W is single-peaked. Assuming W W is single-peaked is equivalent to assuming that 1 is not a likelihood value, which is a generic property of games. The assumption ensures that there does not exist equilibria (c∗, d∗), where c∗(w) = c∗(b) but d∗ is unfair and acceptance rates differ across groups. The assumption is not crucial, but it does simplify the statements of some definitions and results, such as the following: Lemma 1. Given an equilibrium (c∗, d∗), the following are equivalent: 1. c∗(w) = c∗(b), 2. d∗ is fair, 3. AR(w, d∗, μ∗ RE) = AR(b, d∗, μ∗ RE). An equilibrium satisfying these equivalent conditions is called non-discriminatory. 13 3 Ideal Controls Definition. A control k is ideal if, for any game (X, λw, p, G, vq, vu, ω), the following two properties are satisfied: 1. (Gains to the Discriminated Group in Any Discriminatory Equilibrium.) If (c∗, d∗) is a discriminatory equilibrium, then ∀ ˆd ∈ arg max RE ,f ∗ d∈k(X,μ∗ RE ) UF (d, μ∗ RE, f ∗ RE), (cid:20) min i∈I AR(i, ˆd, μ∗ RE), max i∈I AR(i, ˆd, μ∗ (cid:21) RE) (cid:20) ⊊ min i∈I AR(i, d∗, μ∗ RE), max i∈I AR(i, d∗, μ∗ RE) (cid:21) . 2. (Steady States Coincide with the Set of Non-Discriminatory Equilibria.) The set of k-controlled equilibria is the set of non-discriminatory equilibria. The definition of an ideal control is motivated by CL, who write, A key question concerning affirmative action is whether the labor-market gains it brings to minorities can continue without it becoming a permanent fixture in the labor market. Essentially, CL are asking is the affirmative action control ideal? The control does bring gains to the discriminated group in any discriminatory equilibrium. However, CL construct affirmative action-controlled equilibria that are not non-discriminatory equilibria. In these equilibria, the previously discriminated group remains less qual- ified and permanently requires the support of affirmative action in order to not fall behind the previously favored group. Thus, the affirmative action control is not ideal. In contrast, an ideal control not only brings gains to the discriminated group in any discriminatory equilibrium, it also ensures that when the market reaches a steady state, that steady state will be a non-discriminatory equilibrium that renders obsolete the control that brought the market there. Theorem 1. The equal opportunity control is ideal. Let k be the equal opportunity control and fix a game (X, λw, p, G, vq, vu, ω) with likelihood values 0 = l0 < l1 < l2 < . . . < ln for some n. Given an arbitrary c, define Sk(μRE, fRE) := arg max UF (d, μRE, fRE), d∈k(X,μRE ,fRE ) 14 and let ˆd ∈ Sk(μRE, fRE). Let T P ( ˆd) be the true positive rate shared by both groups under ( ˆd, μRE, fRE). Then, for each group i, { ˆd(i, x)}x∈X is a solution to the following linear programming problem, {dx∈[0,1]}x∈X s.t. (cid:80) arg max x∈X dxμRE (i,x)fRE (i,x) x∈X μRE (i,x)fRE (i,x) =T P ( ˆd) (cid:80) (cid:88) x∈X dxμRE(i, x) [fRE(i, x)vq − (1 − fRE(i, x))vu] . It can be shown that the first-order conditions that characterize the solution imply that, for each group i, ˆd(i) is associated with some likelihood mixture. Equality of true positive rates then implies that ˆd is fair. Under a fair decision policy, d, the incentive to invest to be come qualified, (cid:88) ω x∈X d(i, x)(p(x|i, q) − p(x|i, u)), is equalized across groups. Thus, the equal opportunity control induces a utility- maximizing firm to equalize incentives – this is the crucial property of the equal opportunity control. Conversely, any fair decision policy equalizes true positive rates and is, therefore, allowed under the equal opportunity control. These observations can be summarized as follows: Lemma 2. Let k be the equal opportunity control. Given any cost threshold pair, c, Sk(μRE, fRE) ⊂ F ⊂ k(X, μRE, fRE). Proof. See appendix. We are now in a position to prove Theorem 1. First, consider a discriminatory equilibrium (c∗, d∗). Let l∗ i be the likelihood mixture associated with d∗(i). Without RE). By Lemma 2, ˆd is fair, b . Let ˆd ∈ Sk(μ∗ loss of generality, assume l∗ and so both within-group decision policies are associated with the same likelihood mixture – call it ˆl. w < l∗ RE, f ∗ b ∈ (lmb−1, lmb]. There exist integers mw ∈ {0, 1, . . . n − 1} and mb ∈ {1, 2, . . . n} such that l∗ w ∈ If ˆl > lmb, then the firm is strictly better off [lmw, lmw+1) and l∗ deviating to the fair decision policy associated with lmb. By Lemma 2, this deviation It makes the firm strictly better is feasible under the equal opportunity control. off because the additional w-applicants that receive decision 1 give the firm positive expected utility and the additional b-applicants that receive decision 1 give the firm nonnegative expected utility. Thus, ˆl ≤ lmb. 15 If l∗ w ≤ lmb−1. b < lmb, then l∗ In this case, if ˆl ∈ (lmb−1, lmb], then the firm is strictly better off deviating to the fair decision policy where both within-group decision policies are associated with lmb−1. Under this deviation, the additional w- applicants that receive decision 1 give the firm positive expected utility and the additional b-applicants that receive decision 1 give the firm zero expected utility. Thus, ˆl ≤ l∗ RE) ≥ AR(b, d∗, μ∗ RE). w and AR(w, ˆd, μ∗ w < b , so c∗(w) > c∗(b). And now, since ˆd is fair, we have AR(b, ˆd, μ∗ l∗ RE). Finally, since l∗ RE) > AR(b, d∗, μ∗ RE). This proves that the equal opportunity control brings gains to the discriminated group in any discriminatory equilibrium. b – in which case, AR(b, ˆd, μ∗ RE) < AR(w, d∗, μ∗ b , it must be the case that ˆl < l∗ w – in which case, AR(w, ˆd, μ∗ RE). Since l∗ RE) < AR(w, ˆd, μ∗ w < l∗ RE), or ˆl > l∗ RE) ≤ AR(w, d∗, μ∗ b and AR(b, ˆd, μ∗ By a symmetric argument ˆl ≥ l∗ Next, let (ck, dk) be an equal opportunity-controlled equilibrium. By Lemma 2, dk is fair, and so ck(w) = ck(b). Since ck(w) = ck(b), the set S(μRE,k, fRE,k) := arg max d∈[0,1]|I×X| UF (d, μRE,k, fRE,k) consists of a single fair decision policy, or it contains fair decision policies. Let d∗ k ∈ S(μRE,k, fRE,k) ∩ F. By Lemma 2, d∗ k ∈ k(X, μRE,k, fRE,k). This implies UF (dk, μRE,k, fRE,k) ≥ UF (d∗ k, μRE,k, fRE,k), which implies dk ∈ S(μRE,k, fRE,k). So, (ck, dk) is a non-discriminatory equilibrium. Clearly, all non-discriminatory equilib- ria are equal opportunity-controlled equilibria. This establishes that the set of equal opportunity-controlled equilibria is the set of non-discriminatory equilibria. Let k′ be any control with the property that, for each X and (μ, f ) ∈ ∆o(I × X) × (0, 1)|I×X|, F ⊂ k′(X, μ, f ) ⊂ k(X, μ, f ). Lemma 2 and the proof of Theorem 1 imply that k′ is also ideal. For example, the equal odds control, that equalizes both true and false positive rates, is ideal. Such controls are, by definition, more restrictive than the equal opportunity control. An interesting question is whether there exist ideal controls that are meaningfully less restrictive than the equal opportunity control. One family of controls that comes close is the following: Example. In a mistaken identity control, there exists a reference identity, i∗, such that, for each X and (μ, f ) ∈ ∆o(I × X) × (0, 1)|I×X|, k(X, μ, f ) = (cid:26) d ∈ [0, 1]|I×X| (cid:12) (cid:12) (cid:12) (cid:12) d is a threshold function of f (i∗, x) (cid:27) . 16 A decision policy d is a threshold function of f (i∗, x) if d depends on (i, x) only up to f (i∗, x) – in particular, d is color-blind – and there exists an f ∈ (0, 1) such that f (i∗, x) > f (< f ) ⇒ d(w, x) = d(b, x) = 1 (= 0). Roughly speaking, mistaken identity controls force the firm to act as if it thinks all groups have the same identity. They are similar to the minority-as-whites proposal of Yang and Dobbie (2020) and are also related to the proposal studied by Pope and Sydnor (2011). An attractive property of mistaken identity controls is that, unlike the equal opportunity control, they do not depend on μ. Mistaken identity controls are almost ideal in the sense that they satisfy the first property of being ideal and a slightly relaxed version of the second property where the requirement that every non-discriminatory equilibrium be a k-controlled equilibrium is changed to every equivalence class of non-discriminatory equilibria contains a k-controlled equilibrium. In Section 5, I will introduce another control that does not depend on μ and is also almost ideal. However, we will see that issues can arise with both of these controls when the firm's machine learning algorithm is not perfectly rational. 4 Not Ideal Controls CL showed that the affirmative action control is not ideal by constructing affirmative action-controlled equilibria that are not non-discriminatory equilibria. In this section and the next, I consider other controls that are not ideal, in order to provide additional context for ideal controls. Let us begin by constructing a useful family of games. Fix a cost distribution with 3], and consider G and g satisfying G(0) = 1 − G( 2 the following family of games parameterized by constants γ ∈ (0, 1 6 and g(c) = 1 for all c ∈ [0, 2 3) = 1 6) and δ ∈ (0, 1): • X = X1 × X2 = {L, H−, H+} × {W, B}, • λw = 1 2, • p(x|i, y) = p(x1|y)p(x2|i) where – p(x1|q) = 1 – p(L|u) = 2 3 for all x1 ∈ X1, 3, p(H−|u) = 1 – p(W |w) = p(B|b) = 1 − δ, 6 + γ, p(H+|u) = 1 6 − γ, 17 EE Eq1 EE(l1) = G−1( 2 3) 1 3 = G−1( 1 2) EE(l2) = G−1( 1+6γ 3+6γ ) 1 6 + γ = G−1( 1 3 + γ) EE(l3) = G−1( 1−6γ 3−6γ ) W W Eq5 l1 = 1 2 l2 = 2 1+6γ l3 = 2 1−6γ Figure 2 • vq = vu = ω = 1. For any game in this family, EE and W W intersect five times as in Figure 2. To begin, consider the limit "game" where γ = δ = 0. Technically speaking, this is not a game because δ = 0 implies the full support condition of Assumption 1 is violated. Let c∗(w) = 1 3 and c∗(b) = 0. The tables for (μ∗ RE(i, x), f ∗ RE(i, x)) for (i, x) ∈ w × X1 × W ∪ b × X1 × B are: W w H+ 1/8 H− 1/8 1/4 L 2/3 2/3 1/3 b H+ H− L B 7/72 7/72 22/72 2/7 2/7 1/11 Definition. Given a game (X, λw, p, G, vq, vu, ω) and a pair of cost thresholds c = 18 (c(w), c(b)), the color-blind true distribution, μcb,RE, of applicant features is μcb,RE(x|c) := μRE(w, x|c(w)) + μRE(b, x|c(b)) ∀x ∈ X, and the color-blind true conditional probability, fcb,RE, is fcb,RE(x|c) := μRE(w, x|c(w))fRE(w, x|c(w)) + μRE(b, x|c(b))fRE(b, x|c(b)) μcb,RE(x|c) ∀x ∈ X. The tables for (μ∗ RE(i, x), f ∗ RE(i, x)) yield the table for (μ∗ cb,RE, f ∗ cb,RE): W B H+ 1/8 H− 1/8 1/4 L 2/3 2/3 1/3 7/72 7/72 22/72 2/7 2/7 1/11 In particular, f ∗ otherwise. cb,RE(x) > vu vq+vu = 1 2 for x ∈ {(H+, W ), (H−, W )} and f ∗ cb,RE(x) < 1 2 Define the color-blind decision policy d∗ where d∗(i, x) = 1 if x ∈ {(H+, W ), (H−, W )} and d∗(i, x) = 0 otherwise. Continuity now implies, for all sufficiently small γ, δ > 0, γ,δ to d∗ in the (γ, δ)-game is sufficiently close to c∗ so that the best-response c∗ cb,RE,γ,δ(x) > 1 f ∗ 2 otherwise. This implies that in these (γ, δ)-games, (c∗ cb,RE,γ,δ(x) < 1 γ,δ, d∗) is a color-blind-controlled equilibrium. 2 for x ∈ {(H+, W ), (H−, W )} and f ∗ Clearly, (c∗ γ,δ, d∗) is not a non-discriminatory equilibrium. In fact, holding γ fixed, as δ goes to zero, (c∗ γ,δ, d∗) converges in payoff to one of the two most discriminatory equilibria, where the within-group equilibrium of w is associated with Eq1 and the within-group equilibrium of b is associated with Eq5. Thus, we have proved Proposition 1. The color-blind control is not ideal. 4.1 Color-Blind Data Attempts to remove disparate treatment often begin with making data color-blind. In this section, I argue that regulating machine learning by making data color-blind I extend the definition of an ideal control to when data is is counterproductive. color-blind and then prove that no such control exists. Given a game (X, λw, p, G, vq, vu, ω), let us extend the definitions of a number of previously introduced concepts to when data is color-blind. 19 When data is color-blind, a distribution of features μcb is an element of ∆o(X), a belief fcb is an element of (0, 1)|X|, and a decision policy dcb is an element of [0, 1]|X|. In the rest of this section, I will not add the qualifier "when data is color-blind" when discussing concepts for when data is color-blind. The only exception is in formal definitions and results, where I will continue to add the qualifier. When referring to the originally defined versions of concepts, I will add the qualifier "when data is not color-blind." A strategy profile is a pair (c, dcb). Each dcb can be identified with the color-blind decision policy d = (d(w), d(b)) = (dcb, dcb) in the original setting when data is not color-blind. This allows us to identify (c, dcb) with a strategy profile when data is not color-blind. Given c, dcb, and fcb, define Ucb,i(c(i), dcb) := Ui(c(i), dcb) for each i ∈ I, and define Ucb,F (dcb, μcb, fcb) in the obvious way. A control specifies, for each X and (μcb, fcb) ∈ ∆o(X) × (0, 1)|X|, a nonempty compact set, kcb(X, μcb, fcb) ⊂ [0, 1]|X|, of decision policies. Define a kcb-controlled equilibrium (ccb,k, dcb,k) in the obvious way. An equilibrium is non-discriminatory if, when viewed as a strategy profile when data is not color-blind, it is a non-discriminatory equilibrium. Definition. When data is color-blind, a control kcb is ideal if, for any game (X, λw, p, G, vq, vu, ω), the following two properties are satisfied: 1. (Gains to the Discriminated Group in Any Discriminatory Equilibrium.) If (c∗, d∗ cb) is a discriminatory equilibrium, then ∀ ˆdcb ∈ arg max cb,RE ,f ∗ dcb∈k(X,μ∗ cb,RE ) UF (dcb, μ∗ cb,RE, f ∗ cb,RE), (cid:20) min i∈I AR(i, ( ˆdcb, ˆdcb), μ∗ (cid:20) RE), max i∈I AR(i, ( ˆdcb, ˆdcb), μ∗ (cid:21) RE) ⊊ AR(i, (d∗ cb, d∗ cb), μ∗ RE), max i∈I AR(i, (d∗ cb, d∗ cb), μ∗ RE) (cid:21) . min i∈I 2. (Steady States Coincide with the Set of Non-Discriminatory Equilibria.) The set of k-controlled equilibria is the set of non-discriminatory equilibria. Theorem 2. When data is color-blind, there does not exist an ideal control. To prove Theorem 2, it suffices to find two different games such that a discrim- inatory equilibrium of one game and a non-discriminatory equilibrium of the other game share the same (X, d∗ cb,RE). This puts the two properties of being cb,RE, f ∗ cb, μ∗ 20 ideal in conflict with each other: Let kcb be ideal. Since (X, d∗ from a discriminatory equilibrium, both properties imply d∗ Since (X, d∗ property implies d∗ cb,RE) arises cb,RE, f ∗ cb,RE). cb,RE) arises from a non-discriminatory equilibrium, the second cb,RE, f ∗ cb, μ∗ cb /∈ kcb(X, μ∗ cb,RE, f ∗ cb,RE). Contradiction. cb ∈ kcb(X, μ∗ cb,RE, f ∗ cb, μ∗ We now construct two such games. The shared X is the one shared by the family of (γ, δ)-games considered earlier, X1 × X2 = {L, H−, H+} × {W, B}. Recall, in the analysis of that family of games, we introduced the decision policy d∗, when data is not color-blind, where d∗(i, x) = 1 if x ∈ {(H+, W ), (H−, W )} and d∗(i, x) = 0 otherwise, and its best-response cost threshold pair, c∗ γ,δ. One game is a (γ, δ)-game, with γ and δ sufficiently close to zero so that f ∗ 2 for x ∈ {(H+, W ), (H−, W )} and f ∗ cb), where d∗ cb,RE,γ,δ in the sense that, there exists a threshold ( 1 cb takes value 1/0 when f ∗ cb,RE,γ,δ is above/below that threshold, respectively. Once Lemma 3 below is proved, the existence of a game with the same X featuring a non-discriminatory equilibrium with the same firm decision policy, true distribution of applicant features, and true conditional probability is guaranteed, and Theorem 2 is proved. cb,RE,γ,δ(x) > 1 2 otherwise. This yields the discriminatory equilibrium (c∗ 2, for example), such that d∗ cb := d∗(w) = d∗(b). Notice, d∗ cb is a threshold function of f ∗ cb,RE,γ,δ(x) < 1 γ,δ, d∗ Lemma 3. Given an X and a (dcb, μcb, fcb) ∈ [0, 1]|X| × ∆o(X) × (0, 1)|X|, where dcb is a threshold function of fcb, there exists a game (X, λw, p, G, vq, vu, ω) with the property that, when data is color-blind, (μcb, fcb) is the true distribution of applicant features and true conditional probability of a non-discriminatory equilibrium with decision policy dcb. The proof of Lemma 3 is constructive. Fix X and (dcb, μcb, fcb) ∈ [0, 1]|X|×∆o(X)× (0, 1)|X|, where dcb is a threshold function of fcb with some threshold f . Let {G} ∪ {(qx, ux)}x∈X be a collection of variables satisfying the following system of equations: • μcb(x) = Gqx + (1 − G)ux for all x ∈ X, • fcb(x) = Gqx Gqx+(1−G)ux for all x ∈ X, • (cid:80) x∈X qx = (cid:80) x∈X ux = 1. There exists a unique solution: • G = (cid:80) x∈X μcb(x)fcb(x) ∈ (0, 1), 21 – which implies 1 − G = (cid:80) x∈X μcb(x)(1 − fcb(x)) since (cid:80) x∈X μcb(x) = 1, • qx = μcb(x)fcb(x) G ∈ (0, 1) for all x ∈ X, • ux = μcb(x)(1−fcb(x)) 1−G ∈ (0, 1) for all x ∈ X. Define the following game: • λw can be any value, • G satisfies G(c(w)) = G(c(b)) = G, – where c(w) = c(b) = (cid:80) x∈X dcb(x)(qx − ux), • p(x|i, q) = qx and p(x|i, u) = ux for all (i, x) ∈ I × X, • vq, vu satisfy f = vu vq+vu , • ω = 1. It is straightforward to check that (c, dcb) is a non-discriminatory equilibrium with true distribution of applicant features, μcb, and true conditional probability, fcb. 5 Beyond Perfect Rationality Given a set of other features X and a belief f defined over I × X, a subset, ˆY, of the other features indices has the property that f depends on I × X only up to I × X ˆY if x ˆY = x′ ˆY ⇒ f (i, x) = f (i, x′) ∀x, x′ ∈ X, i ∈ I. Let ˆY1 and ˆY2 be two such subsets, then ˆY1 ∩ ˆY2 also has the property: Let x, x′ . Let x′′ satisfy x′′ satisfy x ˆY1∩ ˆY2 . Then f (i, x) = ˆY1 f (i, x′′) = f (i, x′). Thus, there exists a unique, possibly empty, minimal subset, ˆY(f ), with the property. and x′′ ˆY2 = x ˆY1 = x′ = x′ ˆY1∩ ˆY2 ˆY2 Example. The no proxies control k specifies, for each X and (μ, f ) ∈ ∆o(I × X) × (0, 1)|I×X|, k(X, μ, f ) = (cid:110) d ∈ [0, 1]|I×X| (cid:12) (cid:12) d depends on I × X only up to X ˆY(f ) (cid:111) . 22 When machine learning is perfectly rational, the no proxies control excludes all features that are proxies for group identity. It is similar to the counterfactual fairness proposal of Kusner et al. (2017). Like the mistaken identity controls, it depends only on f and is almost ideal. However, it is clear that arbitrarily small deviations from perfect rationality can cause the no proxies control to fail to exclude any features for being a group identity proxy. This suggests that the ideal-ness of the no proxies control is fragile. One may try to remedy this fragility by strengthening the definition of ˆY(f ) to exclude any features along which f is "almost constant," rather than just "constant." The problem with such an approach is that, without knowing the parameters of the model, it is impossible to know what constitutes almost constant. I now make precise in what sense the no proxies control is fragile. I then show that, in contrast, the equal opportunity control is not fragile. Definition. Given a control k, a game (X, λw, p, G, vq, vu, ω), and an ε > 0, a strategy profile (ck,ε, dk,ε) is a k-controlled ε-equilibrium if there exists a (μk,ε, fk,ε) satisfying ∥(μk,ε, fk,ε) − (μRE,k,ε, fRE,k,ε)∥2 ≤ ε, such that 1. ck,ε(i) = arg maxc(i)∈R Ui(c(i), dk,ε(i)) for all i ∈ I, 2. dk,ε ∈ arg maxd∈k(X,μk,ε,fk,ε) UF (d, μk,ε, fk,ε). Definition. A control k is not fragile if, for any game (X, λw, p, G, vq, vu, ω) and any δ > 0, there exists an ε > 0 such that the following two properties are satisfied: 1. If (c∗, d∗) is a discriminatory equilibrium and ∥(μ∗, f ∗) − (μ∗ for every ˆd ∈ Sk(μ∗, f ∗), there exists a ˆd∗ ∈ Sk(μ∗ δ. RE, f ∗ RE)∥2 ≤ ε, then RE) such that ∥ ˆd − ˆd∗∥2 ≤ RE, f ∗ 2. If (ck,ε, dk,ε) is a k-controlled ε-equilibrium, then there exists a k-controlled equi- librium (ck, dk), such that ∥(ck,ε, dk,ε) − (ck, dk)∥2 ≤ δ. Let k be the no proxies control and let us reconsider the (γ, δ)-games intro- duced in the previous section. Again, assume γ, δ > 0 are sufficiently small so that cb,RE,γ,δ(x) > 1 f ∗ 2 otherwise. Recall, this implies (c∗ γ,δ, d∗) is not a 2 for x ∈ {(H+, W ), (H−, W )} and f ∗ γ,δ, d∗) is a color-blind-controlled equilibrium. Note, (c∗ cb,RE,γ,δ(x) < 1 23 no proxies-controlled equilibrium because when machine learning is perfectly rational, d∗ /∈ k(X, μ∗ RE,γ,δ), since d∗ depends on the excluded feature X2. RE,γ,δ, f ∗ However, for any ε > 0, it is possible to perturb the perfectly rational belief f ∗ RE,γ,δ to some f ∗ γ,δ so that 1. ∥(μ∗ RE,γ,δ, f ∗ γ,δ) − (μ∗ RE,γ,δ, f ∗ RE,γ,δ)∥2 ≤ ε, 2. d∗ remains the best-response color-blind decision policy, 3. f ∗ γ,δ is injective. f ∗ γ,δ injective implies no feature except group identity is excluded, in which case k(X, μ∗ γ,δ) is the set of color-blind decision policies and d∗ ∈ k(X, μ∗ RE,γ,δ, f ∗ γ,δ). This implies that (c∗ γ,δ, d∗) is a no proxies-controlled ε-equilibrium and implies, RE,γ,δ, f ∗ Proposition 2. The no proxies control is fragile. Unlike the no proxies control, the equal opportunity control is continuous – it is both an upper hemicontinuous and a lower hemicontinuous correspondence. The Maximum Theorem implies that small deviations from perfect rationality do not significantly compromise the ideal-ness of continuous controls. Theorem 3. Any continuous control is not fragile. Proof. See appendix. And what about the mistaken identity controls? It turns out they are fragile as well – but not as fragile as the no proxies control. Take the definition of being not fragile, remove "and any δ > 0," replace ''∥ ˆd − ˆd∗∥2 ≤ δ" with " ˆd∗(i|lm) = 0 (= 1) ⇒ ˆd(i|lm) = 0 (= 1) for all groups i and likelihood values lm," and replace "∥(ck,ε, dk,ε) − (ck, dk)∥2 ≤ δ" with "dk(i|lm) = 0 (= 1) ⇒ dk,ε(i|lm) = 0 (= 1) for all groups i and likelihood values lm." This yields a definition for being almost not fragile that, depending on the application, could be quite reasonable. For example, when ˆd∗(i) and dk(i) are associated with likelihood mixtures – as will be the case when k is a mistaken identity control, the above conditions imply that, at worst, ˆd(i) differs from ˆd∗(i) and dk,ε(i) differs from dk(i) on i-applicants associated with a single likelihood value. It can be shown that mistaken identity controls are almost not fragile. The reason is that mistaken identity controls are, in an intuitive sense, almost continuous. 24 6 Conclusion This paper recasts the Arrovian statistical discrimination model of CL as a model of algorithmic decision-making. The model's discriminatory and non-discriminatory equilibria serve as the basis for two natural algorithmic fairness goals: Bring gains to the discriminated group in any discriminatory equilibrium and ensure that the steady states under regulation are the non-discriminatory equilibria. I then search for a control that achieves both fairness goals. CL showed that the affirmative action control achieves the first but not the second fairness goal. I discover that the equal opportunity control, that requires the firm to equalize true positive rates across groups, achieves both fairness goals. A crucial step leading to that discovery is the realization that, with algorithmic decision-making, beliefs are contractible. This expands the set of feasible regulations of the firm to include algorithmic controls – like the equal opportunity control – that regulate the I also find that a firm's decisions based on its machine learning-generated belief. common method of regulating machine learning – making data color-blind – can make it impossible to achieve both fairness goals. The equal opportunity control has attractive robustness properties. It only de- pends on the distribution of features and the firm's machine learning-generated belief, and not on the model's parameter values. Also, its ability to achieve both fairness goals can withstand deviations from perfect rationality. Finally, I evaluate a number of other controls in terms of their ability to achieve both fairness goals and their robustness properties. I find the mistaken identity controls to be promising. 7 Appendix Proof of Lemma 2. It is obvious F ⊂ k(X, μRE, fRE). I now prove Sk(μRE, fRE) ⊂ F. Let ˆd ∈ Sk(μRE, fRE). Define T P ( ˆd) := (cid:80) x∈X (cid:80) ˆd(w, x)μRE(w, x)fRE(w, x) x∈X μRE(w, x)fRE(w, x) = (cid:80) x∈X (cid:80) ˆd(b, x)μRE(b, x)fRE(b, x) x∈X μRE(b, x)fRE(b, x) . That ˆd ∈ Sk(μRE, fRE) means that the firm cannot be made strictly better off by swapping out ˆd(i) with a different d(i) with the same true positive rate. Thus, for 25 each i ∈ I, { ˆd(i, x)}x∈X is an element of (cid:80) arg max x∈X dxμRE (i,x)fRE (i,x) x∈X μRE (i,x)fRE (i,x) =T P ( ˆd) (cid:80) (cid:88) x∈X {dx}x∈X s.t. dxμRE(i, x) [fRE(i, x)vq − (1 − fRE(i, x))vu] s.t. dx ≥ 0 ∀x ∈ X dx ≤ 1 ∀x ∈ X. The Kuhn-Tucker conditions imply there exists a λ∗ i ≥ 0 such that, for each x ∈ X, ˆd(i, x) =  0  1  if μRE (i,x)[fRE (i,x)vq−(1−fRE (i,x))vu] (cid:80) μRE (i,x)fRE (i,x) x′∈X μRE (i,x′)fRE (i,x′) if μRE (i,x)[fRE (i,x)vq−(1−fRE (i,x))vu] (cid:80) μRE (i,x)fRE (i,x) x′∈X μRE (i,x′)fRE (i,x′) < λ∗ i > λ∗ i . Simplifying the fraction appearing in the first order condition yields μRE(i, x) [fRE(i, x)vq − (1 − fRE(i, x))vu] μRE (i,x)fRE (i,x) x′∈X μRE (i,x′)fRE (i,x′) (cid:80) = = (cid:88) x′∈X (cid:88) x′∈X μRE(i, x′)fRE(i, x′) (cid:20) vq − 1 − fRE(i, x) fRE(i, x) vu (cid:21) μRE(i, x′)fRE(i, x′) (cid:20) vq − (1 − G(c(i))) G(c(i))l(x) (cid:21) vu . This means there exists a likelihood value lmi, mi ∈ {1, 2, . . . n}, such that ˆd(i, x) =   0  1 if if l(x) < lmi l(x) > lmi. This implies that ˆd(i) is a within-group decision policy associated with the likelihood mixture ˆd(i|lmi)lmi−1 + (1 − ˆd(i|lmi))lmi. With this characterization of ˆd(i), we can express the shared true positive rate as (cid:80) (cid:80) T P ( ˆd) = = x∈X (cid:80) ˆd(i, x)μRE(i, x)fRE(i, x) x∈X μRE(i, x)fRE(i, x) ˆd(i, x)μRE(i, x)fRE(i, x) (cid:80) x∈X,l(x)=lmi (cid:80) x∈X μRE(i, x)fRE(i, x) μRE(i, x)fRE(i, x) + x∈X,l(x)>lmi (cid:80) x∈X μRE(i, x)fRE(i, x) 26 (cid:88) = ˆd(i, x)p(x|i, q) + (cid:88) p(x|i, q) x∈X,l(x)=lmi = ˆd(i|lmi) (cid:88) x∈X,l(x)>lmi (cid:88) p(x|i, q) + (cid:88) p(x|i, q) = ˆd(i|lmi) x∈X,l(x)=lmi (cid:88) x∈X, p(xY |q) p(xY |u) =lmi m∈{mi+1,mi+2,...n} x∈X,l(x)=lm p(xY|q)p(x−Y|i, xY)+ (cid:88) (cid:88) p(xY|q)p(x−Y|i, xY) m∈{mi+1,mi+2,...n} x∈X, p(xY |q) p(xY |u) =lm = ˆd(i|lmi) (cid:88) (cid:88) p(xY|q)p(x−Y|i, xY)+ xY ∈XY , x−Y ∈X−Y p(xY |q) p(xY |u) =lmi (cid:88) (cid:88) (cid:88) p(xY|q)p(x−Y|i, xY) m∈{mi+1,mi+2,...n} xY ∈XY , = ˆd(i|lmi) (cid:88) p(xY|q) + x−Y ∈X−Y p(xY |q) p(xY |u) =lm (cid:88) (cid:88) p(xY|q). xY ∈XY , p(xY |q) p(xY |u) =lmi m∈{mi+1,mi+2,...n} xY ∈XY , p(xY |q) p(xY |u) =lm If mw ≷ mb, then clearly the true positive rate of group b ≷ the true positive rate of group w. So mw = mb. Now equality of true positive rates implies ˆd(w|lmw) (cid:88) p(xY|q) = ˆd(b|lmb) (cid:88) p(xY|q), xY ∈XY , p(xY |q) p(xY |u) =lmw xY ∈XY , p(xY |q) p(xY |u) =lmb which implies ˆd(w|lmw) = ˆd(b|lmb), which implies ˆd ∈ F. (cid:17) t , f ∗ t , f ∗ a sequence (cid:16) ˆdt, (μ∗ t ), εt > 0 t ), ∥ ˆdt − ˆd∗∥ ≥ δ for all ˆd∗ ∈ Sk(μ∗ Proof of Theorem 3. Let k be a continuous control. Fix a game (X, λw, p, G, vq, vu, ω). Let (c∗, d∗) be a discriminatory equilibrium. Suppose there exists a δ > 0 and such that limt→∞ εt = 0 and, for all t, ˆdt ∈ t , f ∗ Sk(μ∗ RE)∥ ≤ εt. Since [0, 1]|I×X| is compact, ( ˆdt)t∈Z+ has a convergent subsequence. By picking such a subsequence and relabelling, it is without loss of generality to assume there exists a decision policy ˆd such that limt→∞ RE), so ˆd /∈ Sk(μ∗ ˆdt = ˆd. Since ∥ ˆd− ˆd∗∥ ≥ δ for all ˆd∗ ∈ Sk(μ∗ RE), and ∥(μ∗ t ) − (μ∗ RE, f ∗ RE, f ∗ RE, f ∗ t∈Z+ RE, f ∗ RE). Since UF (d, μ, f ) is continuous and k(X, μ, f ) is compact-valued and continu- ous in (μ, f ), by the Maximum Theorem, Sk(μ, f ) is upper hemicontinuous. So ˆd ∈ Sk(μ∗ RE). Contradiction. This implies, for every δ > 0, there exists an RE, f ∗ 27 RE, f ∗ RE)∥2 ≤ ε, then for every ˆd ∈ Sk(μ∗, f ∗), there ε > 0 such that, if ∥(μ∗, f ∗) − (μ∗ exists a ˆd∗ ∈ Sk(μ∗ RE) such that ∥ ˆd − ˆd∗∥ ≤ δ. Right now, the ε depends on (c∗, d∗). However, since the number of equivalence classes of equilibria is finite, ε can be chosen independently of (c∗, d∗). This proves that k satisfies the first property of not being fragile. RE, f ∗ Claim. Define cmax := maxx∈X W W (l(x)). for some d∗(i), then c∗(i) ∈ [−cmax, cmax]. If c∗(i) = arg maxc(i)∈R Ui(c(i), d∗(i)) Proof of Claim. By definition, c∗(i) = ω (cid:80) (i,x)∈I×X[p(x|i, q) − p(x|i, u)]d∗(i, x). The right hand side of the equation achieves its highest value, cmax, when d(i, x) = 1 (= 0) if l(x) > 1 (< 1), respectively. Likewise, it is achieves its lowest value, −cmax, when d(i, x) = 0 (= 1) if l(x) > 1 (< 1), respectively. Now, suppose there exists a δ > 0 and a sequence ((ck,εt, dk,εt), (μk,εt, fk,εt), εt > 0)t∈Z+ such that limt→∞ εt = 0 and, for all t, (ck,εt, dk,εt) is a k-controlled εt-equilibrium supported by (μk,εt, fk,εt) and ∥(ck,εt, dk,εt) − (c∗, d∗)∥ ≥ δ for all k-controlled equi- libria (c∗, d∗). By the claim, ck,εt ∈ [−cmax, cmax]2 for all t. So, just like before, ((ck,εt, dk,εt), (μk,εt, fk,εt))t∈Z+ has a convergent subsequence, and it is without loss of generality to assume there exists a (ck, dk) such that limt→∞ ((ck,εt, dk,εt), (μk,εt, fk,εt)) = ((ck, dk), (μRE,k, fRE,k)). Since ∥(ck, dk) − (c∗, d∗)∥ ≥ δ for all k-controlled equilibria (c∗, d∗), so (ck, dk) is not a k-controlled equilibrium. The Maximum Theorem now implies dk ∈ Sk(μRE,k, fRE,k) and ck is a best response to dk. Thus, (ck, dk) is a k-controlled equilibrium. Contradiction. This proves that k satisfies the second prop- erty of not being fragile. References Agrawal, Ajay, Joshua Gans, and Avi Goldfarb (2018) Prediction machines: the simple economics of artificial intelligence: Harvard Business Press. Arrow, Kenneth (1971) "The theory of discrimination." Barocas, Solon, Moritz Hardt, and Arvind Narayanan (2019) Fairness and Ma- fairmlbook.org, http://www. chine Learning: Limitations and Opportunities: fairmlbook.org. 28 Blattner, Laura, Scott Nelson, and Jann Spiess (2021) "Unpacking the black box: Regulating algorithmic decisions," arXiv preprint arXiv:2110.03443. Chiappa, Silvia (2019) "Path-specific counterfactual fairness," in Proceedings of the AAAI conference on artificial intelligence, 33, 7801–7808. Chouldechova, Alexandra (2017) "Fair prediction with disparate impact: A study of bias in recidivism prediction instruments," Big data, 5 (2), 153–163. Coate, Stephen and Glenn C Loury (1993) "Will affirmative-action policies eliminate negative stereotypes?" The American Economic Review, 1220–1240. Corbett-Davies, Sam, J Gaebler, Hamed Nilforoshan, Ravi Shroff, and Sharad Goel (2023) "The measure and mismeasure of fairness," J. Mach. Learn. Res. Corbett-Davies, Sam, Emma Pierson, Avi Feller, Sharad Goel, and Aziz Huq (2017) "Algorithmic decision making and the cost of fairness," in Proceedings of the 23rd acm sigkdd international conference on knowledge discovery and data mining, 797– 806. Cowgill, Bo and Catherine E Tucker (2020) "Algorithmic fairness and economics," Columbia Business School Research Paper. Dwork, Cynthia, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Richard Zemel (2012) "Fairness through awareness," in Proceedings of the 3rd innovations in the- oretical computer science conference, 214–226. Eliaz, Kfir and Ran Spiegler (2019) "The model selection curse," American Economic Review: Insights, 1 (2), 127–140. Fang, Hanming and Andrea Moro (2011) "Theories of statistical discrimination and affirmative action: A survey," Handbook of social economics, 1, 133–200. Feldman, Michael, Sorelle A Friedler, John Moeller, Carlos Scheidegger, and Suresh Venkatasubramanian (2015) "Certifying and removing disparate impact," in pro- ceedings of the 21th ACM SIGKDD international conference on knowledge discovery and data mining, 259–268. Frankel, Alex and Navin Kartik (2022) "Improving information from manipulable data," Journal of the European Economic Association, 20 (1), 79–115. 29 Fuster, Andreas, Paul Goldsmith-Pinkham, Tarun Ramadorai, and Ansgar Walther (2022) "Predictably unequal? The effects of machine learning on credit markets," The Journal of Finance, 77 (1), 5–47. Hardt, Moritz, Nimrod Megiddo, Christos Papadimitriou, and Mary Wootters (2016a) "Strategic classification," in Proceedings of the 2016 ACM conference on innova- tions in theoretical computer science, 111–122. Hardt, Moritz, Eric Price, and Nati Srebro (2016b) "Equality of opportunity in su- pervised learning," Advances in neural information processing systems, 29. Heidari, Hoda, Claudio Ferrari, Krishna Gummadi, and Andreas Krause (2018) "Fair- ness behind a veil of ignorance: A welfare analysis for automated decision making," Advances in neural information processing systems, 31. Hu, Lily and Yiling Chen (2018) "A short-term intervention for long-term fairness in the labor market," in Proceedings of the 2018 World Wide Web Conference, 1389–1398. (2020) "Fair classification and social welfare," in Proceedings of the 2020 conference on fairness, accountability, and transparency, 535–545. Kleinberg, Jon, Himabindu Lakkaraju, Jure Leskovec, Jens Ludwig, and Sendhil Mullainathan (2018a) "Human decisions and machine predictions," The Quarterly Journal of Economics, 133 (1), 237–293. Kleinberg, Jon, Jens Ludwig, Sendhil Mullainathan, and Cass R Sunstein (2018b) "Discrimination in the Age of Algorithms," Journal of Legal Analysis, 10, 113–174. (2020) "Algorithms as discrimination detectors," Proceedings of the National Academy of Sciences, 117 (48), 30096–30100. Kleinberg, Jon, Sendhil Mullainathan, and Manish Raghavan (2016) "Inherent trade- offs in the fair determination of risk scores," arXiv preprint arXiv:1609.05807. Kleinberg, Jon and Manish Raghavan (2020) "How do classifiers induce agents to invest effort strategically?" ACM Transactions on Economics and Computation (TEAC), 8 (4), 1–23. Kusner, Matt J, Joshua Loftus, Chris Russell, and Ricardo Silva (2017) "Counterfac- tual fairness," Advances in neural information processing systems, 30. 30 Liang, Annie, Jay Lu, and Xiaosheng Mu (2023) "Algorithm Design: A Fairness- Accuracy Frontier," arXiv preprint arXiv:2112.09975. Liu, Lydia T, Sarah Dean, Esther Rolf, Max Simchowitz, and Moritz Hardt (2018) "Delayed impact of fair machine learning," in International Conference on Machine Learning, 3150–3158, PMLR. Patty, John W and Elizabeth Maggie Penn (2023) "Algorithmic fairness and statis- tical discrimination," Philosophy Compass, 18 (1), e12891. Penn, Elizabeth Maggie and John W Patty (2023) "Algorithms, Incentives, and Democracy," arXiv preprint arXiv:2307.02319. Perdomo, Juan, Tijana Zrnic, Celestine Mendler-D ̈unner, and Moritz Hardt (2020) "Performative prediction," in International Conference on Machine Learning, 7599–7609, PMLR. Pope, Devin G and Justin R Sydnor (2011) "Implementing anti-discrimination poli- cies in statistical profiling models," American Economic Journal: Economic Policy, 3 (3), 206–231. Rambachan, Ashesh, Jon Kleinberg, Sendhil Mullainathan, and Jens Ludwig (2020) "An economic approach to regulating algorithms,"Technical report, National Bu- reau of Economic Research. Yang, Crystal S and Will Dobbie (2020) "Equal protection under algorithms: A new statistical and legal framework," Mich. L. Rev., 119, 291. Zemel, Rich, Yu Wu, Kevin Swersky, Toni Pitassi, and Cynthia Dwork (2013) "Learn- ing fair representations," in International conference on machine learning, 325–333, PMLR. 31
http://arxiv.org/abs/2310.04579v1
"2023-10-06T20:43:08"
"2023-10-06T20:43:08"
Self-Confirming Transformer for Locally Consistent Online Adaptation in Multi-Agent Reinforcement Learning
Offline reinforcement learning (RL) leverages previously collected data to extract policies that return satisfying performance in online environments. However, offline RL suffers from the distribution shift between the offline dataset and the online environment. In the multi-agent RL (MARL) setting, this distribution shift may arise from the nonstationary opponents (exogenous agents beyond control) in the online testing who display distinct behaviors from those recorded in the offline dataset. Hence, the key to the broader deployment of offline MARL is the online adaptation to nonstationary opponents. Recent advances in large language models have demonstrated the surprising generalization ability of the transformer architecture in sequence modeling, which prompts one to wonder \textit{whether the offline-trained transformer policy adapts to nonstationary opponents during online testing}. This work proposes the self-confirming loss (SCL) in offline transformer training to address the online nonstationarity, which is motivated by the self-confirming equilibrium (SCE) in game theory. The gist is that the transformer learns to predict the opponents' future moves based on which it acts accordingly. As a weaker variant of Nash equilibrium (NE), SCE (equivalently, SCL) only requires local consistency: the agent's local observations do not deviate from its conjectures, leading to a more adaptable policy than the one dictated by NE focusing on global optimality. We evaluate the online adaptability of the self-confirming transformer (SCT) by playing against nonstationary opponents employing a variety of policies, from the random one to the benchmark MARL policies. Experimental results demonstrate that SCT can adapt to nonstationary opponents online, achieving higher returns than vanilla transformers and offline MARL baselines.
[ "Tao Li", "Juan Guevara", "Xinghong Xie", "Quanyan Zhu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04579v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04579v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.MA" ]
Self-Confirming Transformer for Locally Consistent Online Adaptation in Multi-Agent Reinforcement Learning Tao Li*, Juan Guevara, Xinghong Xie, and Quanyan Zhu Department of Electrical and Computer Engineering, New York University {tl2636,jdg8833,xx2233, qz494}@nyu.edu 3 2 0 2 t c O 6 ] G L . s c [ 1 v 9 7 5 4 0 . 0 1 3 2 : v i X r a Abstract Offline reinforcement learning (RL) leverages previously col- lected data to extract policies that return satisfying perfor- mance in online environments. However, offline RL suffers from the distribution shift between the offline dataset and the online environment. In the multi-agent RL (MARL) set- ting, this distribution shift may arise from the nonstationary opponents (exogenous agents beyond control) in the online testing who display distinct behaviors from those recorded in the offline dataset. Hence, the key to the broader deploy- ment of offline MARL is the online adaptation to nonsta- tionary opponents. Recent advances in large language mod- els have demonstrated the surprising generalization ability of the transformer architecture in sequence modeling, which prompts one to wonder whether the offline-trained trans- former policy adapts to nonstationary opponents during on- line testing. This work proposes the self-confirming loss (SCL) in offline transformer training to address the online nonstationarity, which is motivated by the self-confirming equilibrium (SCE) in game theory. The gist is that the trans- former learns to predict the opponents' future moves based on which it acts accordingly. As a weaker variant of Nash equilibrium (NE), SCE (equivalently, SCL) only requires lo- cal consistency: the agent's local observations do not devi- ate from its conjectures, leading to a more adaptable policy than the one dictated by NE focusing on global optimality. We evaluate the online adaptability of the self-confirming transformer (SCT) by playing against nonstationary oppo- nents employing a variety of policies, from the random one to the benchmark MARL policies. Experimental results demon- strate that SCT can adapt to nonstationary opponents online, achieving higher returns than vanilla transformers and offline MARL baselines. Introduction Offline reinforcement learning (RL) has recently emerged as a promising alternative to online RL (Levine et al. 2020), which extracts policies purely from the previously collected dataset without any interaction with the environment. As such, offline RL avoids online explorations required by on- line RL algorithms, which can be expensive (e.g., end-to-end robotic control (K ́aroly et al. 2021)), dangerous (e.g., self- driving (Li, Lei, and Zhu 2023)), and sometimes infeasible (e.g., healthcare (Yu et al. 2021)). *Corresponding author Figure 1: Self-Confirming Transformer (SCT) architecture. SCT first generates a conjecture on the opponent's action at −i (the green block) based on the hidden state hot i of the observation ot i produced by the transformer. This conjecture (or equivalently, its hidden state hat −i), together with the ob- servation hidden state hot i, leads to the agent's action gener- ation at i (the green arrow). The offline trained SCT enables the agent to reason its opponent's move in online testing. Yet, a fundamental challenge of offline RL is the dis- tribution shift between the offline training dataset and the online testing environment (Levine et al. 2020). In plain words, the offline RL agent needs to properly handle un- seen state-action pairs in the dataset during testing (Bannon et al. 2020). When extending this offline RL framework to multi-agent RL (MARL) settings, the distribution shift may be caused by exogenous agents who are beyond the preview of the trained MARL policy. We refer to these exogenous agents as the opponents. When opponents display a behavior pattern different from those included in the offline dataset, the ego agents, controlled by the learned MARL policy, are unprepared for these unseen state-action pairs resulting from opponents' unexpected moves. We refer to such an oppo- nent as nonstationary, as it employs a different and possibly time-varying policy in testing, as opposed to the stationary policy used to collect offline data. As shown in one motivat- ing example presented in Figure 3, blindly applying offline MARL policy gives degrading performance when playing with a nonstationary opponent. We refer to such a phenomenon as the curse of the nonsta- tionary opponent, which we believe is relevant to many of- fline MARL problems. Take human-robot interaction (HRI) as an example. In this context, the robot acts as the peer, companion, or even adversary (Mutlu, Roy, and ˇSabanovi ́c 2016) of humans who are beyond the robot's direct control. Moreover, as personalities, capabilities, and cognitive levels vary across different people, it is intractable to build a uni- versal human behavioral model that can be used in offline training. Hence, the human becomes the nonstationary op- ponent in HRI, if the robot is exposed to one whose behavior pattern is missing in the dataset. Given the significance and relevance of this curse in MARL, this work explores the possibility of transform- ing offline MARL into a sequence modeling problem and addresses this curse using the Transformer architecture (Vaswani et al. 2017) that has exhibited surprising general- ization in large language models (Radford et al. 2018). The question we ask is whether the transformer policy learned from offline data can generalize/ adapt to the nonstationary opponent online. This work answers this question affirmatively by intro- ducing the self-confirming transformer (SCT) that learns to predict the opponent's move from the partial observation, which is then fed to the transformer itself to generate the ego agent's action, as depicted in Figure 1. The SCT is inspired by the self-confirming equilibrium (SCE) (Fudenberg and Levine 1993), a weaker variant of the seminal Nash equilib- rium (NE) (Nash 1951). NE is a global notion built on col- lective rationality (see (1)), requiring every agent's compli- ance to deliver optimality. In contrast, SCE rests on subjec- tive rationality, focusing on local consistency between one's observations and subjective conjectures on the opponent's future move, which leads to the term "self-confirming" (see Definition 1). The intuition of adopting SCT is that offline data is collected using benchmark MARL policies (assumed to be NE), from which the transformer learns to play the equilibrium policy online under the wrong belief that other agents also use NE policies. In contrast, local consistency learned offline helps adjust the agent's belief according to the online observations. From an offline RL perspective, lo- cal consistency prevents the transformer from overfitting the offline data, creating online adaptability. Our contributions are as follows. • We empirically present the curse of the nonstationary op- ponent that degrades offline MARL policies. • We propose the self-confirming transformer (SCT) with the learning objective shifted from global optimality in- dicated by NE to local consistency of SCE to address the curse of the nonstationary opponent. • We conduct extensive experiments in benchmark MARL environments to compare SCT with offline MARL base- lines and recent transformer-based methods, where SCT demonstrates comparatively decent online adaptability. Related Works MARL A large body of prior MARL works has investi- gated the online paradigm, where multiple agents can in- teract with the environment. To address the learning in- stability brought by this multi-agent simultaneous interac- tion, the framework of centralized training with decentral- ized execution (CTDE) is introduced in (Lowe et al. 2017), where a centralized critic is trained to gather all agents' local information and evaluate individual policies. CTDE leads to many successful MARL developments, including multi- agent policy gradient methods (Foerster et al. 2018; Lowe et al. 2017) and value-decomposition methods (Rashid et al. 2020; Sunehag et al. 2018). Offline RL Unlike online RL, such as TD-learning (Sut- ton, Maei, and Szepesv ́ari 2009; Li and Zhu 2019), requiring repeated interactions, offline RL policy is learned from an offline dataset collected by CTDE. One fundamental ques- tion in offline RL is the distribution shift (Levine et al. 2020). To address this issue, recent progress utilizes the conser- vatism idea (Levine et al. 2020) that compels the policy (Fu- jimoto and Gu 2021) or value function estimation (Kumar et al. 2020; Fujimoto, Meger, and Precup 2019) to the data manifold. Our work focuses on a particular case of the dis- tribution shift caused by the nonstationary opponent. Instead of incorporating conservatism into offline training as in (Pan et al. 2022), we explore a game-theoretic approach to equip the agent with online adaptability, harnessing the generaliza- tion power of the transformer architecture. Transformer The transformer is originally proposed for sequence modeling problems in natural language processing (Vaswani et al. 2017). The recent trend of treating offline RL as a sequence modeling problem and applying transformer policies has produced encouraging success. The decision transformer (Chen et al. 2021) and the trajectory transformer (Janner, Li, and Levine 2022) outperform many state-of-the- art offline RL algorithms, which tackle the credit assign- ment and trajectory prediction problems using self-attention (Vaswani et al. 2017). The current multi-agent transformer research (Wen et al. 2022; Meng et al. 2023) concentrates on cooperative tasks: all agents are controlled by a central transformer. We leverage a novel transformer to handle non- stationary opponents in noncooperative settings. Offline Multi-Agent Reinforcement Learning Multi-Agent Reinforcement Learning MARL as Markov Games Consider learning in a multi- agent decision process described by a partially observable Markov game (POMG). A POMG with N agents indexed by i ∈ {1, 2, . . . , N } := [N ] includes a global state space S, each agent's action space Ai, and a set of observations Oi for each individual. The typical elements of these spaces are denoted by the corresponding uncapitalized letters. The time step is denoted by t ∈ N+ appearing as the super- script in the sequel. Unaware of the global state st, each agent receives a local observation ot i ∈ Oi and chooses an action at i. Then, with the joint actions of all agents, de- noted by the bold symbol at = (at N ), the en- vironment transits to the next state st+1 according to the transition kernel P : S × (cid:81) i∈[N ] Ai → ∆(S), and the decision-making process repeat. We assume all involved sets in this work are Borel sets (either discrete or continuous), and ∆(*) denotes the Borel probability measure. To be spe- cific, P(st+1|st, at) give the distribution of the next state. 2, . . . , at 1, at Agent's performance is evaluated through the reward i∈[N ] Ai → R, and each agent aims function ri : S × (cid:81) t=1 γtrt to maximize its own discounted return (cid:80)T i, where rt i = ri(st, at), and T denotes the horizon length. The agent's information set or structure I t i captures the environ- mental feedback that helps the agent identify the policy im- provement direction (Li, Zhao, and Zhu 2022). We consider the conventional decentralized information set, consisting i, at of local feedback: I t i} in a non-cooperative multi-agent environment, including competitive and mixed cooperative-competitive scenarios (Lowe et al. 2017), where agents may have distinct reward signals, i.e., ri ̸= rj for some i, j ∈ [N ]. i = {ot i, rt Each agent aims to find a policy πi ∈ Πi that maps the in- formation set to some action at each time step: at i ∼ πi(*|I t i ) to maximize the discounted return, where πi is assumed to be a stochastic policy yielding a distribution on Ai. We use πi and θi interchangeably to refer to the agent's policy. Let π = (π1, π2, . . . , πN ) be the joint policy of all agents, where each policy πi is parameterized by θi ∈ Θi, i ∈ [N ]. The following discussion uses bold symbols, such as a and o, to denote the joint quantities. In addition, we use the sub- script −i (e.g., π−i and a−i) to denote some joint quantity of all but the agent i. i, at i , θ∗ i∼πi,at Ji(θ∗ −i) ≥ Ji(θ′ t=1 ri(st, at −i), ∀i ∈ [N ], ∀θ′ Centralized Training with Decentralized Execution Given the joint policy θ, the agent i's expected return is −i∼π−i [(cid:80)T Ji(θi, θ−i) = Eat −i)], where the other agents' policies also play a part. Hence, when determining the optimal policy, one must consider other agents' policies, as one's performance intertwines with oth- ers' moves. This interdependency leads to Nash equilibrium (NE) (Nash 1951) as the solution concept in non-cooperative settings, where the agents' optimal policy π∗ i or θ∗ i is char- acterized by the "no-incentive-to-deviate" principle: i, θ∗ i ∈ Θi. (1) As one can see from (1), NE indicates the global op- timality in the sense that the optimality of each individ- ual policy θ∗ from (1) rests on the assumption that every other agent conforms with NE as well. We refer to this as- sumption as collective rationality. The collective rational- ity originates from the interdependent nature of multi-agent decision-making that prompts each agent to reason their opponents' decision-making so as to maximize the return. However, such reasoning needs global/centralized informa- tion set than the decentralized one considered above, which includes observations of opponents. Using RL language, in- corporating global information I t i)i∈[N ]} helps each agent cope with the environmental nonstationar- ity resulting from other agents' actions in the training phase. The idea of augmenting agent's information set with global information leads to the widely received MARL frame- work of centralized training with decentralized execution (CTDE). In CTDE, agents are trained in a centralized man- ner where they can access I t g to learn a decentralized policy to be implemented during testing, which only requires local feedback, e.g., πi(*|ot g = {s, (ot i, at i, rt Even though CTDE belongs to the online MARL paradigm, seemingly detached from our offline RL study, we observe that CTDE has been widely adopted to col- lect datasets for offline MARL research (Pan et al. 2022; i). Meng et al. 2023; Tseng et al. 2022). The common practice of collecting offline data using CTDE proceeds as follows. First, one selects a benchmark onine MARL algorithm, such as MADDPG (Lowe et al. 2017) and MATD3 (Ackermann et al. 2019), and launches the training using CTDE. Then, when the training stabilizes, recording the sample trajec- tories in the replay buffer produces the desired dataset, re- ferred to as the expert-level dataset, as the recorded trajec- tories are generated by the optimal policies with benchmark performance. To diversify the offline data, one can also start recording the sample trajectories midway when the policy displays a medium level of performance. Both expert and medium-level datasets are utilized in our experiments. To facilitate our discussion, we assume that the data collected under CTDE corresponds to the Nash play in the sense that the trajectories follow the equilibrium distribution induced by NE according to the Ionescu-Tulcea extension theorem (Ash and Dol ́eans-Dade 2000, Chapter 2). Assumption 1 (CTDE follows NE ) The sample trajectory in the expert-level dataset τ = {(st, (ot t=1} follows the equilibrium trajectory distribution, denoted by qN E, comprised of the NE policies π∗ i , i ∈ [N ] and the tran- sition kernel P. i)i∈[N ])T i, at We admit that the above is a rather strong assumption. Ex- cept for a few value-based algorithms (Hu and Wellman 2003; Greenwald and Hall 2003; Li et al. 2022; Li, Peng, and Zhu 2021) with equilibrium convergence, most policy- based MARL algorithms only prove to be convergent to sta- tionary points (Zhang, Yang, and Bas ̧ar 2021; Li, Lei, and Zhu 2022). Yet, our key observation is that the resulting benchmark RL policies produced a fixed trajectory distri- bution corresponding to the stationary point in the offline dataset, which, if imitated, would also suffer the curse of the nonstationary opponent. Offline MARL as Sequence Modeling Inspired by the recent success of Decision Transformer (Chen et al. 2021) and Trajectory Transformer (Janner, Li, and Levine 2022) in dealing with offline (single-agent) RL tasks, there emerges a research thrust trying to extend the transformer to the offline MARL paradigm. At the core of these transformer-based approaches is the treatment of a tra- jectory as a sequence for modeling by the Transformer archi- tecture (Vaswani et al. 2017). The following takes the multi- agent decision transformer (MADT) in (Meng et al. 2023) as an example to illustrate the connection between offline MARL and sequence modeling. Consider a trajectory τ from the CTDE dataset given by τ = {s1, o1, a1, s2, o2, a2, . . . , sT , oT , aT }. (2) The MADT, parameterized by a decoder network qφ, pre- dicts sequential actions at each time step autoregressively. Let ˆτ t = {s1, o1, ˆa1, . . . , s1, ot, ˆat} be the truncated tra- jectory up to time t with previous action predictions. Then, the MADT's sequential prediction proceeds as follows. ˆat = arg max a qθ(a|ˆτ t−1, st, ot) (3) The learning objective of the MADT is to minimize the distribution discrepancy between the prediction qφ and the ground truth qN E. Toward this end, one can consider the cross entropy (CE) loss to train the MADT for discrete cases. Given predictions {ˆat}, the CE loss is defined as LCE(θ) = 1/T T (cid:88) t=1 qN E(at) log qθ(ˆat|ˆτ t−1, st, ot). For continuous control tasks, the mean-squared error ∥ˆat − at∥2 leads to decent transformer policies as observed in (Chen et al. 2021). Self-Confirming Transformer The current explorations of transformer-based offline MARL mainly focus on the cooperative setting, where a central transformer policy, trained using the CTDE dataset, controls every agent in the environment. Alternatively, to achieve decentralized execution, one can first train a teacher transformer using global information and then distill the teacher's knowledge into a collection of student transformer policies, each of which controls an individual agent (Tseng et al. 2022). Nevertheless, the transformers have full control over agents' behaviors in a cooperative task. This work investigates the non-cooperative MARL set- ting, where some of the agents are beyond the transformer's control during testing. Such a setting fits human-robot inter- action scenarios where the robots act as companions, assis- tants, or even adversaries (Mutlu, Roy, and ˇSabanovi ́c 2016) of humans who are beyond the robot's direct control. In such non-cooperative multi-agent environments, chances are that independent agents (opponents) may assume a behavior pat- tern distinct from what is recorded in the offline dataset. Taking the NE strategy recorded in offline data as the refer- ence point, opponents who employ different strategies dur- ing testing are referred to as nonstationary. One naturally wonders whether the transformer policy, controlling a single or a subset of agents, is capable of dealing with such on- line nonstationarity, as the transformer's learning objective is only to mimic qN E. The following numerical example provides a negative answer, demonstrating that the MADT returns a degrading performance when facing a nonstation- ary opponent. The Motivating Example: Nonstationary Opponent We consider the predator-prey task (a.k.a simple-tag) in- cluded in the multi-agent particle environment (MPE) (Lowe et al. 2017), one of the benchmark environments in MARL. As shown in Figure 2a, the environment includes a prey who moves faster and aims to evade the three predators. The predators are slower and try to hit the prey, while avoiding obstacles. The predators observe the relative positions and veloci- ties of the prey, while the prey can only observe the relative positions of the other agents. All agents' actions are two- dimensional velocity vectors. Each time any one of the three predators collides with the prey, the former gets rewarded while the latter is penalized. The predator-prey is a mixed (a) simple-tag: the three slow-moving predators aim to catch the fast-moving prey while avoiding the obstacles. (b) simple-world: a vari- ant of simple-tag with two food particles added to the en- vironment. The prey is rewarded when hitting the food. Figure 2: The predator-prey tasks in multi-agent particle en- vironment. cooperative-competitive task, where the predators cooper- ate with each other to encircle the prey so that the rewards get tripled, while the game between the prey and preda- tors is zero-sum like. Another environment we consider is simple-world shown in Figure 2b, a more complicated variant of simple-tag as it includes 2 food particles that prey is rewarded for being close to. More details on the two environments are included in the appendix. We here briefly touch upon the training and the testing procedure, while the detailed experiment setup is included in the experiment section and the appendix. We use MATD3 to train the four agents (three predators and one prey) and collect expert-level data, with which the MADT is trained offline. The MADT is trained using offline trajectories of the three predators. The prey employs the following base- line policies during the testing: 1) πM , the same MATD3 policy used to collect the data; 3) πR, the random policy; and 4) πB, a blend of the random and the MATD3 policy. The random policy takes a uniform distribution over the action set regardless of the observation input. The blending policy works like a bang-bang controller: at each time step, the prey flips a coin first; if heads up, then it chooses πM , otherwise πR. This blend can be written as πB = p×πM +(1−p)×πR, where the parameter p is the success probability of the bino- mial distribution, capturing the opponent's nonstationarity through the discrepancy between πB and πM . The purpose of this numerical example is to examine the MADT's online adaptability when facing a nonstation- ary opponent in testing. Since the nonstationary opponent utilizes a distinct policy, the resulting trajectory deviates from the offline data. This adaptability concerns whether the MADT adjusts its action prediction according to the chang- ing trajectory distribution. The evaluation metric is the nor- malized score, a customary metric indicating the discounted returns (Fu et al. 2020). The testing results are reported in Figure 3, from which one can see that the MADT's per- formance gradually degrades as the opponent deviates from πM , or equivalently, as the trajectory distribution in testing deviates from qN E. Yet, one interesting phenomenon we observe is that the ploys an equilibrium policy in testing. This wrong belief is rooted in the centralized critic and, subsequently, the offline data. From a game-theoretic viewpoint, the curse of nonstation- ary opponents arises from the collective rationality indicated by NE. For any individual agent, employing the equilibrium policy π∗ i is rational, which maximizes the return defined in (1), only if everyone else is rational, i.e., taking the equilib- rium policies π∗ −i. Had anyone deviated from its equilibrium policy, it would be meaningless for the rest to stick to theirs. Hence, the question to be addressed is how to correct the wrong belief if the opponent violates collective rationality. Self-Confirming Equilibrium and Local Consistency To facilitate the discussion, we introduce the following nota- tions. Given a joint policy π = (πi, π−i), the corresponding trajectory distribution is denoted by qπ. An information set I t i is said to be realizable under π if there exists a trajec- tory τ such that I t i ⊂ τ and qπ(τ ) > 0. In other words, I t i occurs with strictly positive probability, which is written as qπ(I t i ) > 0 with a slight abuse of notation. We define μi as the agent i's conjecture (or belief; the two are used inter- changeably) on others' strategies as a probability measure over Π−i. We denote by ˆπ−i = (ˆπj)j̸=i,j∈[N ] to distinguish the subjective conjecture from the true strategies employed by other agents. The following present the self-confirming equilibrium for the POMG adapted from (Fudenberg and Levine 1993, Definition 1). Definition 1 (Self-Confirming Equilibrium) A joint pol- icy π is a self-confirming equilibrium of the POMG if, for each agent i, there exists a conjecture μi such that πi ∈ arg max Eˆπ−i∼μ−i Eπi,ˆπ−i[ T (cid:88) t γtrt i], (4a) μi[{ˆπ−i|ˆπj(I t j) = πj(I t j)}] = 1, ∀j ̸= i, qπ(I t j) > 0, t ∈ [T ]. (4b) One can see from (4) that SCE embodies subjective ratio- nality, where the agent maximizes its expected utility in (4a) subject to the conjecture of its opponents' strategies. Such a conjecture is locally consistent in the sense that the prob- ability measure μi concentrates all probability mass on the joint policy ˆπ−i that coincides with the true distribution at information sets I t j that are reached with positive probabil- ity. As a comparison, if one drops the positivity condition qπ(I t j) > 0, and the equation in (4b) holds for every possi- ble information set, even those never realize (hence, global), the resulting SCE reduces to NE (Fudenberg and Levine 1993). The key message to be conveyed to the reader through the argument above is that SCE is more flexible than NE: the agent's decision-making is legitimate as long as there exists a conjecture matching the opponent's realized actions. Self-Confirming Loss We now articulate how the self-confirming equilibrium helps address the curse of the nonstationary opponent. The fol- lowing presents the offline training procedure for a self- confirming transformer of an individual agent to ease the Figure 3: The normalized scores (the higher, the better) of playing the MADT and the MATD3 policy against the nonstationary opponent in simple-tag (left) and simple-world (right). The opponent employs a blend of the benchmark MATD3 and the random policy, with the blending rate p (shown on the x-axis) chosen from {1, 0.7, 0.5, 0.3, 0}. The smaller p is, the more discrepant the blending policy is from the offline dataset. The green dashed line indicates the benchmark performance of the testing task. transformer-based policy does exhibit online adaptability compared with the pre-trained MARL policy, though to a limited extent. We equip the three predators with the MATD3 policies that are used in the data collection and let them play with the three baseline prey policies mentioned above. We denote the predators' MATD3 policies by πM pred. Note that πM pred includes three MATD3 policies and one for each predator. Figure 3 summarizes the testing results, from which one can see that πM pred gives even lower scores than the MADT does. We believe this adaptability originates from the generalization ability of the transformer architec- ture, which is also observed in large language models (Rad- ford et al. 2018) and robotic transformers (Reed et al. 2022). This motivating example prompts one to ask: can transform- ers learn an adaptable policy from the CTDE dataset that generalizes to non-Nash plays during online testing? Before answering this question, we first revisit the CTDE practice and the intuition behind NE whose limitation motivates our self-confirming approach. Reflection on CTDE and Nash Equilibrium CTDE, originally designed from online MARL, provides a viable approach to address learning instability in multi-agent environments. With access to global information, each agent can properly evaluate its policy quality conditional on oth- ers' policies based on the centralized critic (a Q-function of joint actions and observations) (Lowe et al. 2017), leading to an effective policy improvement that finally reaches the equilibrium. When moving to the offline MARL paradigm, without online interactions, the critic receives no updates and is fixed. Consequently, the equilibrium policy π∗ associ- ated with this critic can only reproduce the trajectory for the data collection, which follows qN E as assumed in Assump- tion 1. The transformer policy trained using this equilib- rium data inevitably suffers the distribution shift caused by the nonstationary opponent, as shown in the motivating ex- ample. Using game theory language, the transformer agent holds the wrong belief that the opponent is rational and em- exposition. The proposed method is later extended to con- trolling multiple agents in the experiment section. Taking inspiration from SCE, we decompose the agent's decision-making into belief generation and policy gener- ation. The intuition is that we explicitly equip the agent with a reasoning module that can be trained to conjecture on the opponent's move online. For belief generation, the agent conjectures the opponent's future move based on the information set I t i . Using notations in subsection "Offline MARL as Sequence Modeling," the conjecture is given by ˆat −i = μi(I t i ), which shall match the realized opponent's ac- tion at −i, guaranteeing local consistency. Based on the gen- erated belief, the agent's policy ˆat i ) generates the action ˆat i to be implemented at time t. i = πi(ˆat −i, I t In the offline training phase, we utilize the CTDE data to train the belief and the policy generation model. For sim- plicity, we consider the continuous-action case and use the mean-squared error. As suggested in (4), the belief genera- tion needs to be locally consistent, and the policy generation is required to be the maximizer. Towards this end, we use the MSE between the opponent's action in the dataset and the conjecture as the belief loss: ∥at −i∥2. As for the pol- icy loss, note that we assume CTDE follows NE plays, and hence, the agent's optimal actions are exactly those recorded i∥2, the MSE between in the dataset. Consequently, ∥at the agent's action in the dataset and the generated one gives a substitute to (4a). −i − ˆat i − ˆat Even though SCE introduces this belief generation in addition to the policy generation, one single transformer suffices to represent both, as the two generation processes take a sequential order: the agent first conjecture. Hence, we use a causal transformer (Chen et al. 2021) parameter- ized by θi to represent the compound function of the two: qSC(θi) = πi ◦ μi. Consisting of both the belief loss moti- vated by local consistency (4b) and the policy loss by (4a), the proposed self-confirming loss is as below. i∥2 i − ˆat + ∥at (cid:124) (cid:125) (cid:123)(cid:122) policy loss,(4a) −i∥2 −i − ˆat (cid:125) (cid:123)(cid:122) belief loss,(4b) LSC(θi) = ∥at (5) (cid:124) . Experiments This section presents a series of experiments to evaluate the online performance of the proposed SCT. Our experi- ments seek to empirically answer the question we raise at the beginning of this paper: can SCT adapt to nonstationary opponents online? Relatedly, one may wonder whether the offline-trained belief generation produces consistent conjec- tures online. If so, to what extent, does SCT's success de- pend on the conjecture (ablation)? Baselines To address these questions, we conduct a com- parative study between SCT and existing approaches based on imitation learning, offline MARL, and sequence model- ing. Specifically, we consider the following baselines. The implementation details are in the appendix. BC: behavior cloning, an imitation learning algorithm. MA-BCQ: multi- agent batch-constrained Q-learning (Fujimoto, Meger, and Precup 2019), which impose constraints on the action space to compel the agent to align more closely with on-policy behavior regarding a subset of the provided data. OMAR: Offline MARL with Actor Rectification (Pan et al. 2022), which uses zeroth-order information to rectify the critic so as to update the actor conservatively. In addition to BCQ and OMAR, there exist many other competitive baselines, such as CQL (Kumar et al. 2020) and ICQ (Yang et al. 2021). However, it is reported in (Pan et al. 2022) that OMAR outperforms CQL and ICQ in the MPE environments con- sidered in this paper, i.e., the simple-tag and simple-world environments to be introduced later. Hence, we pick MA- BCQ, which is not included in (Pan et al. 2022), as the rep- resentative offline MARL algorithm to be evaluated, in addi- tion to OMAR. Finally, we consider transformer-based mod- els for the ablation studies, which include the MADT dis- cussed in the motivating example and Conjectural-MADT (CMADT), a variant of MADT we construct with the train- ing loss augmented by the belief loss. The connections among the three transformer models (inclduing SCT) are highlight in the ablation part. i)i∈[N ], (at i, (ot i is replaced by the reward-to-go ˆRt Environments and Offline Dataset In accordance with the benchmarking testbed in the literature, e.g., (Pan et al. 2022; Tseng et al. 2022), we consider simple-tag and simple-world discussed in the motivating example. The detailed environment setup is in the appendix. Our SCT and the baseline algorithms are trained using the offline dataset offered by (Pan et al. 2022). Slightly different from the rep- resentation in (2), the trajectory in the dataset takes the fol- lowing form: τ = { ˆRt i)i∈[N ]}, where the re- ward rt k=t rk i . Such a rearrangement follows the practice in (Chen et al. 2021), equipping the agent with forward-looking. The of- fline trajectories representing random, medium, and expert levels of play are divided into three datasets, where each dataset consists of 1 million transitions. The random dataset is obtained from unrolling episodes of a randomly initialized policy. The medium dataset is obtained from early stopping the training phase of a MATD3 algorithm once it reaches a medium level of play, and then unrolling the episodes. The final dataset is given by collecting transitions from the MATD3 algorithm once it is fully trained. := (cid:80)T i Nonstationary Opponent To evaluate the adaptability of the predators, the prey is controlled by five distinct poli- cies for each task. These opponent policies include 1) the MATD3 policy, the one used to collect the training data, 2) MADDPG policy, an actor-critic policy trained for each en- vironment, 3) Random policy: a heuristic-based policy de- signed to randomly sample feasible actions, 4) Still policy: a simple policy that freezes the prey at the initialized loca- tion, 5) Blend policy, the blending policy introduced in the motivating example with 50% blending rate. . Quantitive Results First, to complete the story in the moti- vating example, we add SCT's normalized scores to the bar plots in Figure 3, leading to Figure 4. The figure suggests that SCT adapts better to nonstationary opponents in testing than MADT. Due to the page limit, we mainly report the experimental results of simple-tag, and those of simple-world are deferred to the appendix, as they display similar patterns. For all the experiments, Table 1: The normalized scores of SCT and baseline algorithms trained under the expert, medium, and random datasets. SCT exhibits greater online adaptability than those baselines. Simple-Tag MATD3 prey MADDPG prey Still prey Random prey Blend prey OMAR BC 103.19 ± 8.29 9.05 ± 1.62 38.80 ± 7.54 24.13 ± 4.08 58.02 ± 4.95 121.11 ± 7.81 11.22 ± 3.24 44.57 ± 6.8 35.7 ± 4.95 73.65 ± 5.04 MA-BCQ 113.92 ± 8.16 10.52 ± 1.52 31.67 ± 6.83 31.26 ± 5.25 67.39 ± 5.97 MADT CMADT SCT OMAR BC 123.32 ± 8.04 8.16 ± 1.57 44.10 ± 7.9 32.83 ± 5.48 76.90 ± 5.23 122.94 ± 4.50 7.53 ± 1.80 32.52 ± 2.74 38.28 ± 4.29 70.04 ± 20.87 126.20 ± 7.48 11.94 ± 1.79 54.87 ± 7.54 38.98 ± 4.97 92.87 ± 5.92 72.61 ± 6.69 10.78 ± 1.21 42.49 ± 6.67 24.68 ± 3.73 44.14 ± 4.78 77.49 ± 6.93 11.60 ± 2.72 43.20 ± 6.39 31.41 ± 4.11 54.05 ± 4.35 MA-BCQ 56.08 ± 6.05 10.36 ± 1.39 33.75 ± 6.27 25.65 ± 3.98 49.51 ± 4.6 MADT CMADT SCT OMAR BC 73.96 ± 5.76 11.98 ± 1.60 37.81 ± 5.96 27.58 ± 4.05 50.47 ± 4.42 74.67 ± 3.5 8.90 ± 1.31 29.21 ± 1.93 50.77 ± 3.46 44.15 ± 2.10 79.33 ± 5.80 12.22 ± 1.55 52.87 ± 6.02 34.78 ± 3.52 61.54 ± 5.05 6.71 ± 3.03 −1.48 ± 0.43 1.53 ± 2.06 1.50 ± 1.11 3.53 ± 1.51 −0.31 ± 1.13 −3.27 ± 0.94 −1.48 ± 0.86 −1.48 ± 1.09 0.03 ± 1.08 MA-BCQ 32.86 ± 5.73 3.79 ± 1.16 28.1 ± 6.94 6.18 ± 2.94 12.9 ± 3.16 MADT CMADT SCT 9.94 ± 2.56 −0.23 ± 0.63 4.31 ± 2.01 3.07 ± 1.49 4.97 ± 1.65 8.76 ± 1.36 −2.43 ± 0.20 3.44 ± 1.23 0.71 ± 4.25 4.93 ± 0.88 24.75 ± 2.73 −0.03 ± 0.78 6.36 ± 1.73 5.03 ± 1.51 6.37 ± 1.57 t r e p x E m u i d e M m o d n a R Table 2: The prediction accuracy of SCT and CMADT in simple-tag. Accuracy MATD3 MADDPG Still Random Blend Figure 4: The normalized scores of SCT in simple-tag and simple-world environments. SCT outperforms MADT when facing nonstationary opponents. d SCT n a R CMADT p SCT x E CMADT e d SCT M CMADT 1.000 1.000 1.000 1.000 1.000 1.000 0.086 0.092 0.095 0.116 0.217 0.204 0.978 0.310 0.980 0.292 0.996 0.300 0.988 0.324 1.000 0.301 1.000 0.308 0.803 0.780 0.888 0.872 0.865 0.792 we report in Table 1 the mean and standard deviation of normalized scores based on 100 runs using different random seeds. We observe that SCT consistently outperforms both MA-BCQ and OMAR across all experiments, except for the random dataset case where MA-BCQ leads extensively. Furthermore, SCT's performance is on par with or superior to the BC approach. Notably, SCT exhibits greater adaptability compared to its basic counterpart, as indicated by higher mean rewards in most experiments. Ablation We compare SCT with MADT and CMADT to see to what extent the belief generation contributes to the SCT's success. MADT is trained to generate predators' action us- ing the predators' offline trajectories without any conjecture on the prey. In contrast, CMADT also learns to reason the its sequential generation is opponent's move. Similar to (3), prey, ˆat ˆat pred) and the associated loss follows L(θ) = ∥ˆat pred∥2. What distinguishes SCT from CMADT is that CMADT outputs the con- pred = arg maxa qθ(a|ˆτ t−1, ot prey∥2 + ∥ˆat pred − at prey − at prey and the action ˆat jecture ˆat pred simultaneously based on past observations, whereas SCT first generates the conjecture that later serves as the input to the action generation, see Figure 1 for vi- sualization of SCT (CMADT is visualized in the appendix). Intu- itively, the belief generation is equally important as the policy gen- eration in SCT, considering the transformer's sequence-modeling nature. While in CMADT, the belief generation barely regularizes the policy generation, which is referred to as belief regularization. We record the opponent's action prediction accuracy of SCT and CMADT in simple-tag testing, which indicates the number of steps over an episode at which is prediction is close to the truth (the exact definition is in the appendix). As shown in Table 2, SCT and CMADT return comparable results, suggesting that the two acquire similar forecasting abilities. Hence, the superiority of SCT, as in- dicated in Table 1, shows that belief generation plays a bigger part than regularization, validating the self-confirming intuition. References Ackermann, J.; Gabler, V.; Osa, T.; and Sugiyama, M. 2019. Re- ducing overestimation bias in multi-agent domains using double centralized critics. arXiv preprint arXiv:1910.01465. Ash, R. B.; and Dol ́eans-Dade, C. 2000. Probability and Measure Theory. Academic Press. Academic Press. ISBN 9780120652020. Bannon, J.; Windsor, B.; Song, W.; and Li, T. 2020. Causality and Batch Reinforcement Learning: Complementary Approaches To Planning In Unknown Domains. arXiv preprint arXiv: 2006.02579. Chen, L.; Lu, K.; Rajeswaran, A.; Lee, K.; Grover, A.; Laskin, M.; Abbeel, P.; Srinivas, A.; and Mordatch, I. 2021. Decision trans- former: Reinforcement learning via sequence modeling. Advances in neural information processing systems, 34: 15084–15097. Foerster, J.; Farquhar, G.; Afouras, T.; Nardelli, N.; and Whiteson, S. 2018. Counterfactual multi-agent policy gradients. In Proceed- ings of the AAAI conference on artificial intelligence, volume 32. Fu, J.; Kumar, A.; Nachum, O.; Tucker, G.; and Levine, S. 2020. D4rl: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219. Fudenberg, D.; and Levine, D. K. 1993. Self-Confirming Equilib- rium. Econometrica, 61(3): 523. Fujimoto, S.; and Gu, S. S. 2021. A minimalist approach to offline reinforcement learning. Advances in neural information processing systems, 34: 20132–20145. Fujimoto, S.; Meger, D.; and Precup, D. 2019. Off-policy deep reinforcement learning without exploration. In International con- ference on machine learning, 2052–2062. PMLR. Greenwald, A.; and Hall, K. 2003. Correlated-Q Learning. In Proceedings of the Twentieth International Conference on Machine Learning, volume 20 of ICML'03, 242. Hu, J.; and Wellman, M. P. 2003. Nash Q-learning for general-sum stochastic games. Journal of machine learning research, 4(Nov): 1039-1069. Janner, M.; Li, Q.; and Levine, S. 2022. Offline Reinforcement Learning as One Big Sequence Modeling Problem. In Advances in Neural Information Processing Systems, volume 34, 1273–1286. Curran Associates, Inc. Kumar, A.; Zhou, A.; Tucker, G.; and Levine, S. 2020. Conser- vative q-learning for offline reinforcement learning. Advances in Neural Information Processing Systems, 33: 1179–1191. K ́aroly, A. I.; Galambos, P.; Kuti, J.; and Rudas, I. J. 2021. Deep Learning in Robotics: Survey on Model Structures and Training Strategies. IEEE Transactions on Systems, Man, and Cybernetics: Systems, 51(1): 266–279. Levine, S.; Kumar, A.; Tucker, G.; and Fu, J. 2020. Offline Re- inforcement Learning: Tutorial, Review, and Perspectives on Open Problems. arXiv. Li, T.; Lei, H.; and Zhu, Q. 2022. Sampling Attacks on Meta Re- inforcement Learning: A Minimax Formulation and Complexity Analysis. arXiv preprint arXiv: 2208.00081. Li, T.; Lei, H.; and Zhu, Q. 2023. Self-Adaptive Driving in Non- stationary Environments through Conjectural Online Lookahead Adaptation. 2023 IEEE International Conference on Robotics and Automation (ICRA), 00: 7205–7211. Li, T.; Peng, G.; and Zhu, Q. 2021. Blackwell Online Learning for Markov Decision Processes. 2021 55th Annual Conference on Information Sciences and Systems (CISS), 00: 1–6. Li, T.; Peng, G.; Zhu, Q.; and Baar, T. 2022. The Confluence of Networks, Games, and Learning a Game-Theoretic Framework for Multiagent Decision Making Over Networks. IEEE Control Sys- tems, 42(4): 35–67. Li, T.; Zhao, Y.; and Zhu, Q. 2022. The role of information struc- tures in game-theoretic multi-agent learning. Annual Reviews in Control, 53: 296–314. Li, T.; and Zhu, Q. 2019. On Convergence Rate of Adaptive Multi- scale Value Function Approximation for Reinforcement Learning. 2019 IEEE 29th International Workshop on Machine Learning for Signal Processing (MLSP), 1–6. Lowe, R.; WU, Y.; Tamar, A.; Harb, J.; Abbeel, O. P.; and Mor- datch, I. 2017. Multi-Agent Actor-Critic for Mixed Cooperative- In Advances in Neural Information Competitive Environments. Processing Systems 30, Advances in Neural Information Process- ing Systems, 6379–6390. Curran Associates, Inc. Meng, L.; Wen, M.; Le, C.; Li, X.; Xing, D.; Zhang, W.; Wen, Y.; Zhang, H.; Wang, J.; Yang, Y.; and Xu, B. 2023. Offline Pre-trained Multi-agent Decision Transformer. Machine Intelligence Research, 20(2): 233–248. Mutlu, B.; Roy, N.; and ˇSabanovi ́c, S. 2016. Springer Handbook of Robotics. Springer Handbooks, 1907–1934. Nash, J. 1951. Non-Cooperative Games. The Annals of Mathemat- ics, 54(2): 286–295. Pan, L.; Huang, L.; Ma, T.; and Xu, H. 2022. Plan better amid conservatism: Offline multi-agent reinforcement learning with ac- tor rectification. In International Conference on Machine Learning, 17221–17237. PMLR. Radford, A.; Narasimhan, K.; Salimans, T.; Sutskever, I.; et al. 2018. Improving language understanding by generative pre- training. Rashid, T.; Samvelyan, M.; De Witt, C. S.; Farquhar, G.; Foerster, J.; and Whiteson, S. 2020. Monotonic value function factorisation for deep multi-agent reinforcement learning. The Journal of Ma- chine Learning Research, 21(1): 7234–7284. Reed, S.; Zolna, K.; Parisotto, E.; Colmenarejo, S. G.; Novikov, A.; Barth-maron, G.; Gim ́enez, M.; Sulsky, Y.; Kay, J.; Springenberg, J. T.; et al. 2022. A Generalist Agent. Transactions on Machine Learning Research. Sunehag, P.; Lever, G.; Gruslys, A.; Czarnecki, W. M.; Zambaldi, V.; Jaderberg, M.; Lanctot, M.; Sonnerat, N.; Leibo, J. Z.; Tuyls, K.; and Graepel, T. 2018. Value-Decomposition Networks For In Cooperative Multi-Agent Learning Based On Team Reward. Proceedings of the 17th International Conference on Autonomous Agents and MultiAgent Systems, AAMAS '18, 2085–2087. Rich- land, SC: International Foundation for Autonomous Agents and Multiagent Systems. Sutton, R. S.; Maei, H. R.; and Szepesv ́ari, C. 2009. A Convergent $ O (n) $ Temporal-difference Algorithm for Off-policy Learning with Linear Function Approximation. Advances in Neural Infor- mation Processing Systems, 1609–1616. Tseng, W.-C.; Wang, T.-H. J.; Lin, Y.-C.; and Isola, P. 2022. Of- fline Multi-Agent Reinforcement Learning with Knowledge Dis- tillation. In Advances in Neural Information Processing Systems, volume 35, 226–237. Curran Associates, Inc. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A. N.; Kaiser, L.; and Polosukhin, I. 2017. Attention is All you Need. In Advances in Neural Information Processing Sys- tems, volume 30 of NeuriPS. Curran Associates, Inc. Wen, M.; Kuba, J.; Lin, R.; Zhang, W.; Wen, Y.; Wang, J.; and Yang, Y. 2022. Multi-Agent Reinforcement Learning is a Sequence Modeling Problem. In Advances in Neural Information Processing Systems, volume 35, 16509–16521. Curran Associates, Inc. Yang, Y.; Ma, X.; Li, C.; Zheng, Z.; Zhang, Q.; Huang, G.; Yang, J.; and Zhao, Q. 2021. Believe What You See: Implicit Constraint Ap- proach for Offline Multi-Agent Reinforcement Learning. In Neural Information Processing Systems. Yu, C.; Liu, J.; Nemati, S.; and Yin, G. 2021. Reinforcement Learn- ing in Healthcare: A Survey. ACM Comput. Surv., 55(1). Zhang, K.; Yang, Z.; and Bas ̧ar, T. 2021. Multi-agent reinforcement learning: A selective overview of theories and algorithms. Hand- book of reinforcement learning and control, 321–384. Transformer Architecture The transformer architecture (Vaswani et al. 2017) has shown out- standing generalization capabilities in natural language processing (Radford et al. 2018). Its success is mainly due to the model's at- tention block, which effectively captures long-range temporal de- pendencies. The raw inputs of the transformer (which we will call tokens) are initially embedded to vectors of dimension dmodel. Each input embedding generates a query, key, and value vector of dimensions dk, dk, and dv. Vectors of the same type are stacked column-wise to produce three matrices Q ∈ Rl×dk , K ∈ Rl×dk , and V ∈ Rl×dv , with l the maximum context length (i.e., the lenght of the input sequence, defined as a hyperparameter). The attention score is then calculated with the formula Attention(Q, K, V ) = softmax (cid:19) (cid:18) QK ⊺ √ dk V. √ √ The matrix QK ⊺ is divided by dk to prevent the vanishing gradient problem when applying the soft-max row-wise (Vaswani et al. 2017). After the soft-max computation, the upper off-diagonal triangle part of the resulting matrix softmax(QK ⊺/ dk) ∈ Rl×l is masked with 0s. This causal mask prevents future tokens from influencing the prediction of the current target, and is the defining feature of a causal transformer, distinctive from other variations. It is common practice in transformer research to divide the at- tention into several, smaller heads, to later concatenate them in the final attention score. This strategy, called "multi-head atten- tion," (Vaswani et al. 2017) however, is not incorporated in our self-confirming transformer model, as we didn't observe any per- formance enhancement through its implementation. Another essential component of the transformer architecture is the feed-forward neural network proceeding the attention mecha- nism. The computation is as follows. FFN(x) = (max(0, x * W1 + b1)) * W2 + b2, where W 1 ∈ Rdv×df and W 2 ∈ Rdf ×dmodel are the weights, and b1 ∈ Rdf and b2 ∈ Rdmodel are the biases, with df = 4dk. The input of this network is the computed attention score. Note that all of the operations above are permutation invariant, so to consider the sequential and time-dependent nature of the data, we inject positional encoding learned as an embedding table to the input embeddings. A causal transformer block comprises layer normalization, an attention module featuring causal masking, and a feed forward neu- ral network, applied in sequence. A causal transformer typically in- corporates more than one of these blocks, where the output of one block serves as the input for the subsequent block. We refer to each column of the matrix returned by the final transformer block as a hidden state, denoted by the pre-subscript h. This matrix is of size dv × l. Each transformer hidden state can be one-to-one mapped to an input token, following the order of the original sequence. Hence, we write hai t to denote the hidden state that is in the same position as at i in the original input sequence. Thanks to the causal masking, each hidden state only contains information preceding that token. Environments Our experiments adopt the Multi-Agent Particle Environment (MPE) (Lowe et al. 2017) to evaluate the proposed SCT. We im- port two tasks from MPE, which are simple-tag and simple-world. These two environments are very interesting because they cap- ture elements of both competition (between good agents and ad- versaries) and collaboration (among the good agents themselves to avoid being tagged). The following gives more details about these two environments. Simple-Tag Simple-tag includes three entities: the prey, the predator, and the obstacle. The ensuing discussion presents the environment setup, including the observation, action, and reward of each entity. The partial observation of the prey contains its own velocity and position, and its relative positions to obstacles and other agents. The action variable of the prey is a two-dimensional vector, each entry of which ranges from -1 to 1. As the prey aims to escape from predators, it gets a positive reward proportional (the factor is 0.1) to the sum of its distance from each predator, while it is penalized for being caught by any of the predators (-10 reward). Since the prey moves faster than predators, to keep the game balanced, it is penalized for being out of the map. The purpose of introducing such a penalty is to prevent the prey from moving in one direction without any restriction. The partial observation of one predator consists of its own ve- locity and position, its relative positions to the obstacles and other agents, and the prey's velocity. The predator's action space is the same as the prey's. The predator is rewarded +10 after hitting the prey, otherwise penalized by the relative distance to the prey. The obstacles are introduced to complicate the environment. Observable to all agents, obstacles are stationary once initialized within an episode. As its name suggests, agents cannot move through the obstacle, which requires them to maneuver strategi- cally around these obstacles to evade (the prey) or ambush (the predator). We set one prey, three predators, and two obstacles in this en- vironment. Consequently, the observation space of prey is 14- dimensional: 2 for its velocity, 2 for its position, 4 for the relative position to obstacles, and 6 for other relative positions to agents. Similarly, the observation space of predators is 16-dimensional, and the additional 2 entries correspond to the prey's velocity. Simple-World Simple-world is a more challenging variation of the previous en- vironment. In this scenario, there are additional food particles that the prey is rewarded for being close to. Each predator receives a re- ward of +5 if one of them hits the prey. On the contrary, the prey is penalized by -5 for each collision. Simple-world relies on the same reward setup as simple-tag. Additionally, the prey is rewarded +2 points for every time it hits a food particle. The environment in- cludes only one obstacle. For the two environments, the episode length is T = 25. Yet, when training the transformer models, the context length is 20, i.e., the past 20 steps are used to calculate the loss. Implementations Details: Training and Testing This section presents the detailed experiment setup, and the asso- ciated source code are included in the supplementary material. Table 3: Self-confirming transformer hyperparameters Hyperparameter Value Maximum context Length Batch Size Hidden Dimensions # of Layers # of Attention Heads Activation function Dropout # Steps per epoch # Warmup Steps Epochs Learning Rate Weight Decay 20 64 128 3 1 ReLU 0.1 10000 10000 1 for Medium and Expert 10 for Random 1e-4 1e-4 Self-Confirming Transformer 1:3) and actions (at As shown in Figure 5, SCT receives the predators' observations 1:3) and the rewards-to-go signal ( ˆRt) as in- (ot put at each time step. To account for the different dimensions of the input, actions, states, and rewards-to-go are embedded by dif- ferent linear layers. Then, we introduce positional encoding using a learned embedding table to encode the time-step, so that trans- former knows the order of the input. These tokens are then fed into a causal transformer, generating hidden states for each input token. The hidden states corresponding to the observations are concate- nated and sent through a linear layer that predicts the opponent's actions. During training, this actions is trained via MSE loss with the dataset as ground truth. During testing time, we are not going to use ground truth (the opponent's action) as input, instead, we just trust the predicted action, and take it as a new component of our input stream. This process of emebedding, encoding, and hidden state genera- tion is repeated, in auto-regressive fashion. For each agent, we con- catenate the hidden state related to its observation with the hidden state of the opponent's predicted action. This concatenated input is then passed through a linear layer, converting it into the agent's own action. This is carried out for each predator. We note that the concatenation step makes explicit the self-confirming nature of the model. The hyperparameters are summarized in Table 3. BC We implement the Behavior Cloning to imitate the three preda- tors behavior recorded in the dataset. It consists of a Multilayer Perceptron with ReLu activation and dropout. The input consists of the 3 predator's observation history concatenated and flattened. Since our context-length is 20, the network's inputs are 20 × 16 × 3 = 960-dimensional for simple tag and 20 × 24 × 3 = 1440- dimensional for simple-world. The output are 6 dimensional (three 2-dimensional actions). We utilize Mean Squared Error (MSE) loss during training, with dataset's actions as ground truth. The hyper- parameters are summarized in Table 4. MA-BCQ 1,h ot Figure 5: In SCT's multi-agent implementation, the three predators' observation hidden states hot 3 are con- catenated (Cat) and passed through a linear layer (LL) to predict the opponent's action (the green block), which be- comes part of the input stream. Then, the prey's action hid- den state hat prey is concatenated with the corresponding hot i and passed through a linear layer for each predator's action generation. 2,h ot Table 4: Behavior Cloning hyperparameters Hyperparameter Maximum Context Length Batch Size Hidden Dimensions # of Layers Activation Function Dropout # Steps per Epoch # Linear Warm-up Steps Epochs Learning Rate Weight Decay Value 20 64 128 3 ReLU 0.1 10000 10000 15 1e-4 1e-4 MA-BCQ takes in six Q values and outputs one Q value to evaluate the joint actions of predators. In the training, we calculate the Q-target value with Q values given by critic-target and calculate Q-current with Q values given by the critic-current, and then, we obtain the following loss: LBCQ Q (φ, ψ) = Eτ ∼B,a∼μ[(r(τ , a) + γ max ̃a[j] Qπ(τ ′ , ̃a[j]; φ ′ ′ ) , ψ − Qπ(τ , a; φ, ψ)2], ̃a[j] = a[j] + ξ(τ , a[j]), where φ means the parameter of Q network, and ψ represents the parameters of Mixer network, the ξ(τ , a[j]) represents the pertur- bation model. We follow the hyperparameter setup in (Fujimoto, Meger, and Precup 2019). OMAR We follow the official implementation of OMAR offered by the authors (Pan et al. 2022). We implement MA-BCQ based on the BCQ implementation pro- vided by (Yang et al. 2021). Considering the fact that BCE employs two Q networks for a single-agent, MA-BCQ includes six Q net- works as each predator needs two critics. The QMixer network in Ablation Baselines Explained In order to validate the self-confirming equilibrium intuition be- hind our proposed model, we compare the performance of SCT with two transformer-based models, namely (offline) Multiagent Decision Transformer (MADT) and Conjectural Multiagent Deci- sion Transformer (CMADT). Their details are presented below. To better illustrate the their differences from and connection to the SCT structure, we provide visualizations of MADT and CMADT in Figure 6 and Figure 7, respectively. MADT The MADT(Meng et al. 2023) is akin to the original Decision Transformer (Chen et al. 2021), in that it takes agent's observa- tions and rewards-to-go signals as inputs, generating actions in au- toregressive fashion. Particularly, in this architecture the opponents actions are not considered neither during training nor testing, so it is not equipped with tools for self-confirming play. Its hyperparam- eters are the same as those of SCT, summarized in Table 3. Figure 6: In MADT, the opponent's actions are not consid- ered neither in training nor inference. Instead, we directly generate the actions from the predators' observation hidden states hot 1:3. CMADT We propose the Conjectural Multiagent Decision Transformer (CMADT). This architecture takes as inputs predators' observation and action history and the rewards-to-go signal. In a forward pass of this architecture, the opponent's and the agents actions are pre- dicted in parallel, contrary to our SCT, where the opponent's con- jectured action and agents' actions decision happen in sequence. The opponent's conjectured action becomes part of the context for future actions, but is not considered for the current decision pro- cess; hence, the self-confirming nature of this model is limited. Additional Results This section reports experiments conducted on simple-world, and the results are summarized in Table 6. We observe that SCT dis- plays higher adaptability than it does in simple-tag. SCT still out- performs all baselines when trained on the expert and medium data, as it does in simple-tag environment. Figure 8 presents the asso- ciated bar plots. Furthermore, the SCT trained with random data adapts more effectively to the MATD3, MADDPG, and the ran- dom prey than its counterpart in simple-tag (see Table 1). Only un- der the still and blend prey cases do MA-BCQ and CMADT claim an upper-hand, respectively. Similar to the ablation study presented in Table 1, we compare SCT and CMADT regrading the opponent's action prediciton. Be- fore presenting the result, we first give an exact definition on the prediciton accuracy. We regard an opponent's action prediction ˆat −i Figure 7: In CMADT, the opponent's actions are inferred similarly to our SCT, but hat prey is not considered for action generation at timestep t. It becomes part of the context for future actions. Figure 8: The normalized scores of SCT in simple-tag and simple-world environments. SCT outperforms MADT and CMADT when facing nonstationary opponents. accurate if it falls within an ε-neighborhood of the ground truth: ˆat −i ∈ {a : ∥a−at −i∥ < ε}. The prediction accuracy of an episode indicates the number of steps at which the prediction is accurate. Accuracy = #steps with accurate predictions #total steps . Table 5 summarizes prediction accuracy in the simple-world. We observe patterns similar to Table 1. SCT produces decent predic- tions for the MATD3 and Still preys, and its prediction accuracy generally matches the blending rate when playing against the Blend prey. Nevertheless, CMADT and SCT acquires indistinguishable prediction abilities, and hence, the success of SCT is rooted in the self-confirming intuition. Table 5: The prediction accuracy in simple-world experi- ments. Accuracy MATD3 MADDPG Still Random Blend p SCT x E CMADT e d SCT M CMADT n SCT a R CMADT 1.000 1.000 1.000 1.000 1.000 0.998 0.082 0.088 0.102 0.088 0.092 0.082 1.000 1.000 1.000 1.000 1.000 1.000 0.285 0.282 0.293 0.229 0.285 0.294 0.713 0.661 0.650 0.577 0.707 0.657 Table 6: The normalized scores of SCT and baseline algorithms trained under the expert, medium, and random datasets. SCT exhibits greater online adaptability than those baselines in most simple-world experiments. Simple World MATD3 prey MADDPG prey Still prey Random prey Blend prey OMAR BC MA-BCQ MADT CMADT SCT OMAR BC MA-BCQ MADT CMADT SCT OMAR BC MA-BCQ MADT CMADT SCT 114.26 ± 3.52 −4.29 ± 8.33 34.52 ± 3.76 23.58 ± 2.21 48.33 ± 2.82 111.08 ± 3.12 −9.05 ± 6.10 37.73 ± 3.68 25.31 ± 2.16 53.14 ± 2.52 106.59 ± 3.38 −2.75 ± 6.79 45.33 ± 2.96 21.62 ± 1.63 51.07 ± 2.81 105.83 ± 3.18 −2.85 ± 6.76 31.69 ± 3.33 23.34 ± 21.3 48.61 ± 2.66 110.44 ± 3.42 −1.54 ± 7.70 41.76 ± 3.98 23.69 ± 2.13 75.90 ± 3.58 115.20 ± 3.38 −1.32 ± 7.15 53.31 ± 3.39 28.28 ± 2.29 92.87 ± 5.92 73.81 ± 4.46 −0.84 ± 7.23 58.67 ± 3.73 31.37 ± 1.73 42.23 ± 2.55 86.23 ± 2.39 −5.48 ± 10.47 41.11 ± 3.38 29.84 ± 2.06 43.45 ± 2.32 76.99 ± 3.31 −3.00 ± 9.88 36.02 ± 3.71 30.12 ± 1.99 40.92 ± 2.38 81.70 ± 2.84 0.54 ± 6.51 28.92 ± 2.82 26.07 ± 1.95 43.32 ± 2.22 86.87 ± 2.93 0.96 ± 8.11 30.25 ± 3.79 28.52 ± 2.13 55.78 ± 2.92 87.13 ± 2.97 1.30 ± 5.51 33.41 ± 3.02 31.87 ± 1.96 57.87 ± 2.66 8.37 ± 1.16 −5.51 ± 0.87 4.54 ± 1.01 5.41 ± 0.77 6.39 ± 0.85 −0.62 ± 0.62 −13.41 ± 5.28 −0.75 ± 0.58 0.06 ± 0.69 0.15 ± 0.68 6.52 ± 1.42 −3.11 ± 7.98 6.59 ± 1.38 3.40 ± 0.81 4.01 ± 0.85 5.28 ± 1.10 8.36 ± 1.27 −7.21 ± 5.87 1.27 ± 0.96 4.85 ± 0.89 4.28 ± 0.80 −7.54 ± 5.96 2.93 ± 1.01 4.61 ± 0.82 8.12 ± 0.93 8.95 ± 1.42 −4.47 ± 5.80 4.93 ± 0.81 6.09 ± 0.91 6.37 ± 1.57 t r e p x E m u i d e M m o d n a R
http://arxiv.org/abs/2310.04573v1
"2023-10-06T20:28:32"
"2023-10-06T20:28:32"
Can pruning make Large Language Models more efficient?
Transformer models have revolutionized natural language processing with their unparalleled ability to grasp complex contextual relationships. However, the vast number of parameters in these models has raised concerns regarding computational efficiency, environmental impact, and deployability on resource-limited platforms. To address these challenges, this paper investigates the application of weight pruning-a strategic reduction of model parameters based on their significance-as an optimization strategy for Transformer architectures. Through extensive experimentation, we explore various pruning methodologies, highlighting their impact on model performance, size, and computational demands. Our findings suggest that with judicious selection of pruning hyperparameters, significant reductions in model size are attainable without considerable compromise on performance. Moreover, when coupled with post-pruning fine-tuning strategies, some pruned models even exhibit enhanced generalization capabilities. This work seeks to bridge the gap between model efficiency and performance, paving the way for more scalable and environmentally responsible deep learning applications.
[ "Sia Gholami", "Marwan Omar" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04573v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04573v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.CL" ]
3 2 0 2 t c O 6 ] G L . s c [ 1 v 3 7 5 4 0 . 0 1 3 2 : v i X r a Can pruning make Large Language Models more efficient? Sia Gholami The Institute of Electrical and Electronics Engineers, Member IEEE gholami@ieee.org Marwan Omar Illinois Institute of Technology momar3@iit.edu Abstract Transformer models have revolutionized natural language processing with their unparalleled ability to grasp complex contextual relationships. However, the vast number of parameters in these models has raised concerns regarding computational efficiency, environmental impact, and deployability on resource-limited platforms. To address these challenges, this paper investigates the application of weight prun- ing-a strategic reduction of model parameters based on their significance-as an optimization strategy for Transformer architectures. Through extensive experi- mentation, we explore various pruning methodologies, highlighting their impact on model performance, size, and computational demands. Our findings suggest that with judicious selection of pruning hyperparameters, significant reductions in model size are attainable without considerable compromise on performance. Moreover, when coupled with post-pruning fine-tuning strategies, some pruned models even exhibit enhanced generalization capabilities. This work seeks to bridge the gap between model efficiency and performance, paving the way for more scalable and environmentally responsible deep learning applications. 1 Introduction In the burgeoning domain of deep learning, Transformer models [Vaswani et al., 2017] have indis- putably reshaped the landscape of natural language processing tasks. Their unprecedented capabilities in capturing intricate contextual information and establishing novel benchmarks across a myriad of applications have made them a vanguard in modern artificial intelligence [Devlin et al., 2018]. However, with great power comes inherent complexity. These models, characterized by their mas- sive parameter counts, have posed significant challenges for real-time applications, deployment on resource-constrained devices, and even exacerbated the environmental concerns of large-scale computations [Strubell et al., 2019]. Given the pressing demand for efficient and scalable deep learning solutions, model optimization techniques have emerged as pivotal endeavors in contemporary research. Among these, weight pruning stands out for its intuitive appeal and empirical success [Han et al., 2015]. By strategi- cally eliminating certain weights or connections based on their significance, pruning endeavors to retain, or even enhance, model performance while substantially reducing computational and memory footprints [Zhu and Gupta, 2017]. Yet, the journey of weight pruning in the vast sea of Transformer architectures is still nascent, with its potentials and pitfalls only beginning to be explored. This paper delves into the intricate interplay between weight pruning and Transformer models, investigating the nuances of different pruning Preprint. Under review. strategies, their ramifications on model performance, and charting the way forward for more efficient and environmentally responsible neural network architectures [Gale et al., 2019]. Through systematic analyses and comprehensive experiments, we aim to bridge the chasm between the desideratum of model efficiency and the inexorable demand for superior performance. The implementation of weight pruning in Transformer models can have both positive and negative impacts on their performance, and these effects often depend on various factors, such as the degree of pruning, the specific pruning strategy used, and the complexity of the task at hand. 1. Computational Efficiency: One of the primary benefits of weight pruning is the reduction in the number of parameters in the model, which can lead to increased computational efficiency. Fewer weights mean fewer operations during the forward and backward passes, resulting in less computation time. This advantage is particularly important when deploying models on resource-constrained devices or when processing large datasets. 2. Model Size: Weight pruning can significantly reduce the model's size, making it more suitable for deployment in environments with limited storage capacity. This reduced footprint does not only benefit deployment, but also makes it easier and faster to transfer models across different platforms or networks [Han et al., 2016]. 3. Overfitting: Weight pruning can act as a form of regularization, helping to reduce overfitting. By removing less important weights, the model's capacity is reduced, making it less likely to overfit to the training data [LeCun et al., 1998]. This can lead to better generalization performance on unseen data. 4. Performance Trade-off: Despite these benefits, weight pruning must be carefully managed to avoid a significant drop in model performance. If too many weights are pruned, or if the pruning is not conducted carefully, the model can suffer a loss in its capacity to capture complex patterns in the data, resulting in reduced accuracy or other performance metrics [Zhou et al., 2018]. 5. Fine-tuning Requirement: After pruning, the model often needs to be fine-tuned on the task- specific data to recover any potential loss in performance. This fine-tuning step introduces an additional computational cost and requires careful hyperparameter tuning. In summary, while weight pruning can lead to increased computational efficiency, reduced model size, and potentially better generalization, it can also introduce a performance trade-off and additional computational costs associated with fine-tuning. It's crucial to carefully consider these factors when implementing weight pruning in Transformer models, ensuring that the pruning strategy aligns well with the specific requirements and constraints of the task and deployment environment. 2 Related Works Natural Language Processing (NLP) has been a major area of research in Artificial Intelligence and Machine Learning since the early days of computer science [Voorhees et al., 1999, Moldovan et al., 2000, Brill et al., 2002, Ferrucci et al., 2010, Gholami and Noori, 2021, 2022, Gholami et al., 2022, Gholami and Khashe, 2022a,b, Brand et al., 2022, Gholami and Omar, 2023a,b]. There are several examples of using pruning to create efficient Transformer models in the literature. In this section we go over a few notable cases. In addition to being quicker and lightweight than more comprehensive frameworks, more straight- forward neural nets are likely to transfer well since it ostensibly retrieves all genuine focus, mainly elements with minimal duplication. Following training, weights with low saliency-those whose removal seems to have a negligible impact upon that loss-can be dropped from extensive systems to shrink their capacity. Approaches that take individual scores into account were considered unorga- nized, whereas techniques that take attentive units or core networks into account were referred to as organized. There have been numerous suggested unstructured and structured pruning systems, some of which were utilized in Transformers. It is common practice to choose the weights to prune while addressing transformers systems depending on its size or by calculating a significance score using a first - order technique. While some techniques significantly reduce the model complexity, the resultant unorganized sparse vectors cannot be used to accelerate inference without dedicated hardware. When pruning pretrained algorithms with challenge tweaking, Sanh et al. [Sanh et al., 2020] contrast the 2 zeroth- as well as the first pruning techniques. They demonstrate that a straightforward approach for load pruning relying on plain variations is efficient for such a challenge, and it changes by employing a first-order significance score. They use a transformer-based structure to implement this mobility trimming, and empirical results demonstrate that, in high-sparsity regimes, their approach routinely produces significant gains above current approaches. Sajjat et al. [Sajjad et al., 2023] discussed various methods for de-layering pre-trained networks and examined the algorithms' overall behavior upon subtasks. To use several pre-trained systems and then a wide range of data sets, researchers ran tests that demonstrated that it is possible to decrease the model complexity and size by nearly 40% while still retaining close to 98% of past performance on tasks. The performance of their trimmed algorithms was comparable to that of knowledge-distilled algorithms. Furthermore, their method avoids the need for learning, works with a wide variety of pre-trained versions, especially distilling concepts, and gives users the freedom to choose how much precision and accuracy percent they compromise. Lagunas et al. [Lagunas et al., 2021] have demonstrated that it is possible to obtain tiny trimmed networks equivalent to or superior to distillation systems. This method does not require pre-training and can be utilized while fine-tuning. This solution operates on a wide range of projects or baseline concepts without relying on methods like preprocessing or architectural discovery. Researchers may count on a straightforward and reliable approach for sharing such simulations while maintaining the majority of the actual design correctness when newer and bigger versions are produced at an increased pace. Structured pruning, on the other hand, eliminates cohesive score groupings. Recent research demon- strates how certain heads may be eliminated while significantly degrading efficiency, indicating that the majority of heads convey unnecessary features. Regularizing algorithms with structured dropping makes them increasingly resistant to implementing structured pruning at the moment of inference. Fan et al. [Fan et al., 2019] concentrate on a scenario in which frameworks were layered, allowing for the pruning of shallower as well as procedures at any appropriate depth. They demonstrate that LayerDrop facilitates and remains stable in ongoing learning on significantly deeper systems inside a range of text creation or pre-training activities. Several scientists have experimented with integrating weight pruning with matrix factorization. Although researchers mix unstructured pruning and Sparsity matrix factorization, Wang et al. [Wang et al., 2019] propose another all-structural pruning technique in their research that is dependent on adaptable reduced factorization. They assess and evaluate how well this strategy performs on substantial language models. In contrast to existing strategies, such as unstructured amplitude pruning, researchers show that their approach would significantly speed up and condense speeds for extensive systems with no performance degradation. Michel et al. [Michel et al., 2019] showed how particular layers might be lowered only to one heading and that numerous units could be deleted into capable transformer systems exhibiting statistical significance efficiency reduction. Furthermore, they demonstrated that the encoder-decoder attention levels in language translation systems were significantly greater dependent on inter-head than in the self-attention stages. Researchers presented proof that the significance of every unit is established during the initial phases. They anticipate that findings might deepen current knowledge of MHA and motivate simulations to use its characteristics and recognition better. Voita et al. [Voita et al., 2019] assess how each attention unit affects the translational efficiency of the Transformer framework. Only a limited selection of units seems crucial for the translated process, as demonstrated by layer-wise significance transmission, which they employ to demonstrate the proportional involvement of units fluctuates. Significant heads perform one or even more decipherable tasks in the framework, such as monitoring certain linguistic relationships and paying attention to nearby words. Researchers offer a novel method for attention head pruning and investigate whether the leftover fewer intelligible units were critical to the architecture efficiency. 3 Approach The approach here emphasizes the elimination of particular weights or connections within the model that have a relatively minimal impact on its performance. By doing so, it is possible to significantly reduce the model's size and enhance computational efficiency, which could also lead to decreased overfitting. Transformers predominantly consist of self-attention and feed-forward layers. Consequently, these are the primary targets for the application of weight pruning techniques. In this study, we focus on 3 magnitude-based weight pruning and we used the model introduced by Gholami and Omar [2023a] (GPT-Efficio) as the baseline along with bigger GPT-3 [Brown et al., 2020] model. Magnitude-Based Weight Pruning: This technique focuses on the ranking of weights within the Transformer model according to their absolute magnitudes. Those weights exhibiting the smallest magnitudes (i.e., falling beneath a defined threshold) are zeroed or excluded entirely. This approach is premised on the hypothesis that the impact of small-magnitude weights on the model's output is insignificant, and their removal should, therefore, result in a negligible impact on the overall model performance. Subsequent to the pruning process, the model typically undergoes a fine-tuning phase in an attempt to rectify any performance degradation that may have occurred [Molchanov et al., 2016]. In the context of applying weight pruning to Transformer models, it is common practice to prune a minor proportion of weights at any one time, subsequently fine-tuning the model. This iterative pruning process is repeated until the desired degree of sparsity or compression is attained. Such an approach allows the model to incrementally adjust to the removal of various components, thereby mitigating the risk of a significant performance decline. While weight pruning can assist in reducing the size of the model and the computational demands, it also introduces an additional set of hyperparameters, such as the pruning threshold or rate. These need to be carefully managed to avoid any detrimental impacts [Li et al., 2016]. Furthermore, aggressive pruning can lead to a substantial decrease in model performance. As a result, it is of paramount importance to balance the degree of pruning against the performance of the model. 4 Experiments In this section we present the results of our approach in the context of language modeling (i.e. completion tasks) and question answering. 4.1 Results Table 1: Performance of pruning technique on completion tasks Model nparams LAMBADA GPT-3 Zero-Shot GPT-3 One-Shot GPT-3 Few-Shot GPT-Efficio GPT-Efficio (.3 pruned) 175B 175B 175B 950M 665M (acc) 76.2 72.5 86.4 67.1 61.83 LAMBADA (ppl) StoryCloze (acc) HellaSwag (acc) 3.00 3.35 1.92 9.2 10.5 83.2 84.7 87.7 80.5 74.68 78.9 78.1 79.3 72.6 64.43 Table 1 demonstrates the GPT-Efficio and pruned GPT-Efficio's performance in comparison with GPT-3. Table 2: Performance of pruning technique on QA tasks Model nparams NQ GPT-3 Zero-Shot GPT-3 One-Shot GPT-3 Few-Shot GPT-Efficio GPT-Efficio (.3 pruned) 175B 175B 175B 950M 665M 14.6 23.0 29.9 27.5 20.35 WebQ 14.4 25.3 41.5 40.6 32.72 TriviaQA 64.3 68.0 71.2 69.2 65.43 Table 2 shows the GPT-Efficio and pruned GPT-Efficio's performance in comparison with GPT-3. 5 Analysis The hyperparameters related to weight pruning in large language models can significantly influence the outcome of the pruning process and ultimately the performance of the pruned model. Here are some of the key hyperparameters: 4 LAMBADA StoryCloze HellaSwag 2 . 3 8 9 . 8 7 2 . 6 7 7 . 4 8 1 . 8 7 5 . 2 7 7 . 7 8 4 . 6 8 3 . 9 7 5 . 0 8 6 . 2 7 1 . 7 6 8 6 . 4 7 3 4 . 4 6 3 8 . 1 6 100 80 60 40 20 ) % ( y c a r u c c A 0 G P T - 3 Z e r o - S h o t G P T - 3 O n e - S h o t G P T - 3 F e w - S h o t G P T - E f fi c i o G P T - E f fi c i o ( . 3 p r u n e d ) Model Figure 1: Performance of pruning technique on completion tasks 64.3 68 71.2 69.2 65.43 y c a r u c c A 60 40 20 25.3 23 14.6 14.4 41.5 29.9 40.6 27.5 32.72 20.35 0 GPT-3 Zero-Shot GPT-3 One-Shot GPT-3 Few-Shot GPT-Efficio GPT-Efficio (.3 pruned) NQ WebQ TriviaQA Figure 2: Performance of pruning technique on QA tasks 1. Pruning Threshold: This is a hyperparameter that determines the cutoff point for weights to be pruned. For magnitude-based pruning, weights whose absolute values are below this threshold will be pruned. The choice of threshold will directly affect the degree of pruning and consequently the size and speed of the model. However, a too aggressive threshold could remove important weights and degrade model performance [Han et al., 2015]. 2. Pruning Rate: This hyperparameter defines the proportion of weights to be pruned in each pruning iteration. For example, a pruning rate of 0.2 would mean that 20% of the weights are pruned in each iteration. The pruning rate affects the speed at which pruning is performed and the final level of sparsity in the model [Molchanov et al., 2016]. Similar to the pruning threshold, a high pruning rate may lead to faster model size reduction but could also result in significant performance loss if it's too high. 3. Pruning Schedule: This parameter dictates how pruning is carried out over the course of training or fine-tuning. It could be constant, linear, or exponential, among others. For instance, in a linear pruning schedule, an increasing proportion of weights would be pruned 5 as training progresses. The pruning schedule can influence how the model adapts to the pruning process and can have a substantial impact on the final model performance. 4. Regularization Parameter: In regularization-based pruning methods, the regularization parameter (usually denoted as lambda in L1 regularization) controls the degree of penalty applied to the weights. A larger regularization parameter encourages sparser weight matrices but might also lead to performance degradation if set too high. 5. Retraining or Fine-tuning epochs: After each pruning iteration, the model is typically retrained or fine-tuned for a certain number of epochs. The number of these epochs is also a hyperparameter that can influence how well the model recovers from the pruning process. Too few epochs might not allow the model to adequately adapt to the pruned structure, while too many epochs can be computationally expensive [Li et al., 2016]. 6. Initial Sparsity and Target Sparsity: These hyperparameters are typically used in iterative pruning methods. Initial sparsity is the proportion of weights to prune at the beginning, and target sparsity is the final desired proportion of weights to prune. The values of these hyperparameters can directly affect the efficiency and performance of the pruned model. All these hyperparameters must be carefully tuned to strike a balance between model size, com- putational efficiency, and model performance. It's crucial to conduct systematic experiments or leverage hyperparameter optimization techniques to find the optimal configuration for these param- eters. The optimal set of hyperparameters can be task-specific and might vary depending on the specific requirements and constraints of the task and deployment environment. In this section, we focus on the pruning rate hyperparameter. The pruning rate, one of the primary hyperparameters in weight pruning techniques, significantly influences the performance of a language model such as a Transformer. The pruning rate essentially determines the proportion of weights to be pruned in each pruning iteration. For example, if you set a pruning rate of 0.1, it means that in each pruning step, 10% of the weights (usually the ones with the smallest magnitudes) will be eliminated. The effect of the pruning rate on the performance of the language model can be viewed from several angles: 1. Model Performance: Higher pruning rates might lead to a more substantial reduction in the model size, which is beneficial for computational efficiency [Neklyudov et al., 2017]. However, pruning a large number of weights at once can potentially result in the loss of important information that the model needs to make accurate predictions. As such, if the pruning rate is set too high, it can substantially drop model performance. Conversely, a lower pruning rate can preserve more information, reducing the risk of performance degradation but resulting in a less compact model. 2. Fine-tuning Requirements: The higher the pruning rate, the more dramatic the change to the model structure, meaning the model may require more extensive fine-tuning to recover from the pruning process. Therefore, a high pruning rate may increase the computational cost of the fine-tuning process and the complexity of finding the right fine-tuning hyperparameters. 3. Overfitting: In certain scenarios, a higher pruning rate can act as a form of regularization. By reducing the number of parameters, the model's capacity to memorize the training data is reduced, potentially mitigating overfitting and improving the model's ability to generalize to unseen data. However, it's important to note that this effect has its limits – pruning too aggressively can degrade model performance by removing too much capacity. 4. Convergence Speed: Typically, with a lower pruning rate, the model's convergence speed during training or fine-tuning can be maintained since the model changes less drastically between iterations. On the other hand, a high pruning rate can potentially disrupt the learning process and slow down convergence, as the model needs to adapt to more substantial changes at each step. In conclusion, the choice of pruning rate involves a trade-off between model performance, computa- tional efficiency, fine-tuning requirements, and the potential for regularization. Careful experimenta- tion and tuning are required to select an optimal pruning rate that suits the specific demands of your task and environment. 6 Table 3: Analysis of the effects of hyperparameter pruning rate on completion tasks Model pr% nparams LAMBADA GPT-3 Zero-Shot GPT-3 One-Shot GPT-3 Few-Shot GPT-Efficio GPT-Efficio GPT-Efficio GPT-Efficio - - - - .1 .3 .5 (acc) 76.2 175B 72.5 175B 175B 86.4 950M 67.1 855M 67.05 665M 61.83 475M 55.38 LAMBADA (ppl) StoryCloze (acc) HellaSwag (acc) 3.00 3.35 1.92 9.2 9.4 10.5 12.64 83.2 84.7 87.7 80.5 80.21 74.68 65.50 78.9 78.1 79.3 72.6 72.16 64.43 52.68 Table 3 demonstrates the GPT-Efficio and pruned GPT-Efficio's performance in comparison with GPT-3. LAMBADA (acc) StoryCloze (acc) HellaSwag (acc) 2 . 3 8 9 . 8 7 2 . 6 7 7 . 4 8 1 . 8 7 5 . 2 7 7 . 7 8 4 . 6 8 3 . 9 7 5 . 0 8 6 . 2 7 1 . 7 6 1 2 . 0 8 6 1 . 2 7 5 0 . 7 6 8 6 . 4 7 3 4 . 4 6 3 8 . 1 6 5 . 5 6 8 3 . 5 5 8 6 . 2 5 100 90 80 70 60 50 40 30 20 10 ) % ( y c a r u c c A o r Z e t o - S h G P T - e 3 O n t o - S h G P T - 3 t o F e w - S h 3 G P T - G P T - E f fi c o i model G P T - E f fi c o i ) ( . 1 G P T - E f fi c o i ) ( . 3 G P T - E f fi c ) ( . 5 o i Figure 3: Analysis of the effects of the pruning approach on completion tasks. Table 4: Analysis of the effects of hyperparameter pruning rate on QA tasks Model pr% nparams NQ GPT-3 Zero-Shot GPT-3 One-Shot GPT-3 Few-Shot GPT-Efficio GPT-Efficio GPT-Efficio GPT-Efficio - - - - .1 .3 .5 14.6 175B 23.0 175B 175B 29.9 950M 27.5 855M 26.35 665M 22.39 475M 19.83 WebQ 14.4 25.3 41.5 40.6 39.56 37.43 32.76 TriviaQA 64.3 68.0 71.2 69.2 68.76 65.91 60.84 Table 4 shows the GPT-Efficio and pruned GPT-Efficio's performance in comparison with GPT-3. 7 3 . 4 6 8 6 2 . 1 7 2 . 9 6 6 7 . 8 6 NQ WebQ TriviaQA 1 9 . 5 6 4 8 . 0 6 5 . 1 4 9 . 9 2 6 . 0 4 5 . 7 2 6 5 . 9 3 5 3 . 6 2 3 4 . 7 3 9 3 . 2 2 6 7 . 2 3 3 8 . 9 1 3 . 5 2 3 2 6 . 4 1 4 . 4 1 ) % ( y c a r u c c A 70 60 50 40 30 20 10 Zero-Shot O ne-Shot Few-Shot G P T-3 G P T-3 G P T-3 Model G P T-Efficio(-) G P T-Efficio(0.1) G P T-Efficio(0.3) G P T-Efficio(0.5) Figure 4: Analysis of the effects of hyperparameter pruning rate on QA tasks 6 Limitations While weight pruning in Transformer models can lead to significant benefits in terms of model size reduction and computational efficiency, it does come with a set of limitations: 1. Performance Trade-off: One of the major limitations of pruning is the trade-off between model size and performance. Although pruning can reduce the number of parameters in the model, it also reduces the model's capacity, which can lead to a drop in performance. If pruning is too aggressive, it can result in substantial information loss and significantly degrade the model's accuracy. 2. Complexity in Hyperparameter Tuning: Pruning introduces additional hyperparameters such as the pruning rate, threshold, and schedule, which need to be tuned carefully. Incorrect setting of these hyperparameters can lead to ineffective pruning or significant performance degradation. Determining the optimal values for these hyperparameters can be a com- plex and resource-intensive task that requires systematic experimentation or sophisticated optimization strategies. 3. Post-Pruning Fine-Tuning: After pruning, the model usually needs to be fine-tuned to recover any performance loss caused by the pruning process. This fine-tuning step introduces an additional computational cost and requires careful hyperparameter tuning. 4. Sparsity-Induced Inefficiency: Standard deep learning frameworks and hardware accelerators are optimized for dense matrix operations. While pruning introduces sparsity in the weight matrices, which theoretically should speed up computation, these sparse operations are not as efficiently supported, leading to a potential under-utilization of computational resources. This issue is being addressed by ongoing research and development in hardware and software for sparse computations. 5. Irregular Sparsity Patterns: Pruning often leads to irregular sparsity patterns that are hard to exploit for computational efficiency. In contrast, structured pruning methods (which prune entire neurons, layers, or channels) create regular sparsity patterns but are more restrictive and might result in higher accuracy loss. 8 6. Dependence on Initial Training: The effectiveness of pruning can heavily depend on the initial training of the model. If the model is not well trained before pruning, the pruning process may remove important weights, leading to substantial performance degradation. While pruning can provide significant advantages, these limitations indicate that it's not a silver bullet. The benefits of pruning must be carefully weighed against its potential downsides, and the process must be carefully managed to ensure optimal performance. 7 Future Work While weight pruning has demonstrated effectiveness in reducing the size and improving the efficiency of Transformer models, there's much scope for future work to further enhance this approach and overcome its limitations. Here are a few suggestions: • Advanced Pruning Strategies: Develop more advanced and nuanced pruning strategies that can better balance model size reduction and performance. This could involve new methods for deciding which weights to prune, beyond just considering weight magnitude. • Pruning with Context: Investigate context-aware pruning strategies that take into account the importance of weights in relation to specific inputs or tasks. For example, certain weights may be more critical for specific types of inputs or tasks and should be preserved. • Regularization Techniques: Explore the integration of pruning with other regularization techniques to limit the performance drop after pruning. This could help enhance the model's robustness and generalization capability while also reducing its size. • Improved Fine-tuning Strategies: Develop more effective fine-tuning strategies for post- pruning model recovery. This could involve adaptive learning rates or other methods to accelerate the fine-tuning process and reduce its computational cost. • Sparse Training: Investigate methods for sparse training, which involves introducing sparsity during the initial training process rather than post hoc. Sparse training could lead to models that are naturally smaller and more efficient, and potentially avoid some of the performance degradation associated with pruning. • Hardware and Software for Sparse Computations: Contribute to the development of hardware and software that can more effectively handle the sparse computations resulting from pruning. This would help to realize the computational benefits of pruning and make pruned models more efficient to run on various devices. • Structured Pruning: Expand on structured pruning methods, which remove larger, coherent parts of the model, such as entire neurons or layers. While these methods can lead to more significant size reductions and are more amenable to existing hardware accelerators, they often result in a greater loss in accuracy and require further research. • Pruning with Knowledge Distillation: Combining pruning with knowledge distillation, where the knowledge from a larger model (teacher) is transferred to a smaller model (student), could be a promising avenue for maintaining performance while reducing model size. • Understanding Pruning: Improve our theoretical understanding of why and how pruning works. Despite its empirical success, the underlying theory of why pruning does not drastically harm model performance and sometimes even improves it is not fully understood. These suggestions highlight the potential to further improve pruning techniques and better integrate them into the deep learning pipeline, increasing the efficiency and practicality of Transformer models. 8 Conclusion The allure of Transformer models lies in their unmatched prowess in modeling intricate patterns and relationships in data, especially within the realm of natural language processing. Nevertheless, their expansive parameterization has given rise to palpable challenges in computational efficiency, scalability, and ecological sustainability. Through the lens of this research, we have navigated the intricate landscape of weight pruning as a potential panacea to these challenges. Our systematic 9 exploration affirms that with an astute pruning strategy, it is indeed feasible to achieve a harmonious balance between model size reduction and performance retention. Notably, post-pruning fine-tuning emerged as a salient phase, occasionally enhancing the generalization capabilities of pruned models beyond their dense counterparts. As the deep learning community continues its relentless pursuit of excellence, considerations of model efficiency and environmental stewardship must ascend to the forefront of our collective consciousness. Weight pruning, as showcased in this paper, offers a promising avenue in this regard. However, it is not a terminal solution. It beckons further refinement and needs to be integrated with other optimization techniques for holistic model improvement. As we stand on the cusp of this research frontier, the call is clear: the future of deep learning not only demands models that think more profoundly but also those that think more efficiently. References Ryan Brand, Sia Gholami, Daniel Horowitz, Liutong Zhou, and Sourav Bhabesh. Text classification for online conversations with machine learning on aws. AWS Machine Learning Blog, 2022. Eric Brill, Susan Dumais, and Michele Banko. An analysis of the askmsr question-answering system. In Proceedings of the 2002 Conference on Empirical Methods in Natural Language Processing (EMNLP 2002), pages 257–264, 2002. Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. Angela Fan, Edouard Grave, and Armand Joulin. Reducing transformer depth on demand with structured dropout. arXiv preprint arXiv:1909.11556, 2019. David Ferrucci, Eric Brown, Jennifer Chu-Carroll, James Fan, David Gondek, Aditya A Kalyanpur, Adam Lally, J William Murdock, Eric Nyberg, John Prager, et al. Building watson: An overview of the deepqa project. AI magazine, 31(3):59–79, 2010. Trevor Gale, Erich Elsen, and Sara Hooker. The state of sparsity in deep neural networks. arXiv preprint arXiv:1902.09574, 2019. Sia Gholami and Saba Khashe. Alexa, predict my flight delay. arXiv preprint arXiv:2208.09921, 2022a. Sia Gholami and Saba Khashe. Flight delay prediction using deep learning and conversational voice-based agents. American Academic Scientific Research Journal for Engineering, Technology, and Sciences, 89(1):60–72, 2022b. Sia Gholami and Mehdi Noori. Zero-shot open-book question answering. arXiv preprint arXiv:2111.11520, 2021. Sia Gholami and Mehdi Noori. You don't need labeled data for open-book question answering. Applied Sciences, 12(1):111, 2022. Sia Gholami and Marwan Omar. Do generative large language models need billions of parameters? arXiv preprint arXiv:2309.06589, 2023a. Sia Gholami and Marwan Omar. Can a student large language model perform as well as it's teacher?, 2023b. Sia Gholami, Danny Byrd, Francisco Calderon Rodriguez, Muhyun Kim, Yohei Nakayama, Mehdi Noori, and Nathalie Rauschmayr. Create, train, and deploy a billion-parameter language model on terabytes of data with tensorflow and amazon sagemaker. AWS Machine Learning Blog, 2022. Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015. 10 Song Han, Xingyu Liu, Huizi Mao, Jing Pu, Ardavan Pedram, Mark A Horowitz, and William J Dally. Eie: Efficient inference engine on compressed deep neural network. ACM SIGARCH Computer Architecture News, 44(3):243–254, 2016. François Lagunas, Ella Charlaix, Victor Sanh, and Alexander M. Rush. Block pruning for faster transformers, 2021. URL https://arxiv.org/abs/2109.04838. Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. arXiv preprint arXiv:1608.08710, 2016. Paul Michel, Omer Levy, and Graham Neubig. Are sixteen heads really better than one? Advances in neural information processing systems, 32, 2019. Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila, and Jan Kautz. Pruning convolutional neural networks for resource efficient inference. arXiv preprint arXiv:1611.06440, 2016. Dan Moldovan, Sanda Harabagiu, Marius Pasca, Rada Mihalcea, Roxana Girju, Richard Goodrum, and Vasile Rus. The structure and performance of an open-domain question answering system. In Proceedings of the 38th annual meeting of the Association for Computational Linguistics, pages 563–570, 2000. Kirill Neklyudov, Dmitry Molchanov, Arsenii Ashukha, and Dmitry P Vetrov. Structured bayesian pruning via log-normal multiplicative noise. Advances in Neural Information Processing Systems, 30, 2017. Hassan Sajjad, Fahim Dalvi, Nadir Durrani, and Preslav Nakov. On the effect of dropping layers of pre-trained transformer models. Computer Speech & Language, 77:101429, 2023. Victor Sanh, Thomas Wolf, and Alexander Rush. Movement pruning: Adaptive sparsity by fine-tuning. Advances in Neural Information Processing Systems, 33:20378–20389, 2020. Emma Strubell, Ananya Ganesh, and Andrew McCallum. Energy and policy considerations for deep learning in nlp. arXiv preprint arXiv:1906.02243, 2019. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz In Advances in neural information Kaiser, and Illia Polosukhin. Attention is all you need. processing systems, pages 5998–6008, 2017. Elena Voita, David Talbot, Fedor Moiseev, Rico Sennrich, and Ivan Titov. Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned. arXiv preprint arXiv:1905.09418, 2019. Ellen M Voorhees et al. The trec-8 question answering track report. In Trec, volume 99, pages 77–82. Citeseer, 1999. Ziheng Wang, Jeremy Wohlwend, and Tao Lei. Structured pruning of large language models. arXiv preprint arXiv:1910.04732, 2019. Guorui Zhou, Ying Fan, Runpeng Cui, Weijie Bian, Xiaoqiang Zhu, and Kun Gai. Rocket launching: A universal and efficient framework for training well-performing light net. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018. Michael Zhu and Suyog Gupta. To prune, or not to prune: exploring the efficacy of pruning for model compression. arXiv preprint arXiv:1710.01878, 2017. 11
http://arxiv.org/abs/2310.04570v2
"2023-10-10T13:32:55"
"2023-10-06T20:17:40"
Transformer-Based Neural Surrogate for Link-Level Path Loss Prediction from Variable-Sized Maps
Estimating path loss for a transmitter-receiver location is key to many use-cases including network planning and handover. Machine learning has become a popular tool to predict wireless channel properties based on map data. In this work, we present a transformer-based neural network architecture that enables predicting link-level properties from maps of various dimensions and from sparse measurements. The map contains information about buildings and foliage. The transformer model attends to the regions that are relevant for path loss prediction and, therefore, scales efficiently to maps of different size. Further, our approach works with continuous transmitter and receiver coordinates without relying on discretization. In experiments, we show that the proposed model is able to efficiently learn dominant path losses from sparse training data and generalizes well when tested on novel maps.
[ "Thomas M. Hehn", "Tribhuvanesh Orekondy", "Ori Shental", "Arash Behboodi", "Juan Bucheli", "Akash Doshi", "June Namgoong", "Taesang Yoo", "Ashwin Sampath", "Joseph B. Soriaga" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04570v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04570v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
Transformer-Based Neural Surrogate for Link-Level Path Loss Prediction from Variable-Sized Maps Thomas M. Hehn†, Tribhuvanesh Orekondy‡, Ori Shental∗, Arash Behboodi†, Juan Bucheli§, Akash Doshi∗, June Namgoong∗, Taesang Yoo∗, Ashwin Sampath∗, Joseph B. Soriaga∗ ∗Qualcomm Technologies, Inc. †Qualcomm Technologies Netherlands B.V. ‡Qualcomm Wireless GmbH §Qualcomm France S.A.R.L. 3 2 0 2 t c O 0 1 ] G L . s c [ 2 v 0 7 5 4 0 . 0 1 3 2 : v i X r a Abstract-Estimating path loss for a transmitter-receiver loca- tion is key to many use-cases including network planning and handover. Machine learning has become a popular tool to predict wireless channel properties based on map data. In this work, we present a transformer-based neural network architecture that enables predicting link-level properties from maps of various dimensions and from sparse measurements. The map contains information about buildings and foliage. The transformer model attends to the regions that are relevant for path loss prediction and, therefore, scales efficiently to maps of different size. Further, our approach works with continuous transmitter and receiver coordinates without relying on discretization. In experiments, we show that the proposed model is able to efficiently learn dominant path losses from sparse training data and generalizes well when tested on novel maps. I. INTRODUCTION Machine learning (ML) techniques have demonstrated great success in solving various modeling- and simulation-based problems in sciences, such as in molecular dynamics simu- lations [1], [2] and other applications [3]–[5]. Specifically to- wards wireless simulations, ML-based techniques have shown to offer many advantages: scaling to high-dimensional prob- lems [4], data-driven simulations [6], [7], differentiability which enables solving inverse problems [8], [9] and end-to- end learning. ML can help build better models using real measurements by either learning parameters on an existing mathematical model or replacing and augmenting existing models. On the other hand, the general purpose simulators, for instance ray tracers, are designed to solve the modeling problem in a general setting, and because of that they utilize details that might not be relevant for a particular task. For example, the professional ray tracers require a detailed model of the environment and its materials and provide path level details of propagation between a transmitter-receiver pair. This level of details might not be necessary for many tasks, for example, in case of line-of-sight (LOS) blockage detection. We would like to be able to curate models that balance accuracy-complexity for particular tasks. ML can help building such surrogate models. Surrogate models come with benefits typically not available for general purpose simulators, such as integrating them in the system design loop. For problems like network planning and sensing, the simulator is queried multiple times during the design process, and surrogate models can improve latency of such operations. Surrogate models can be built in a differentiable way and therefore, be used for an end-to-end design and optimization. Surrogate models can rely only on what is needed for a particular simulation task and reduce drastically the need for detailed environment descriptions. Sur- rogate models can therefore be seen as specialized simulators. In this paper, we focus on the problem of path loss pre- diction. Instead of utilizing detailed environment 3D maps, we rely on crude digital twin (DT) creations consisting of simple building and foliage layouts to solve this problem. There are many works on ML-based path loss prediction (see Section II for detailed review of previous works). The main motivation of our work is to accommodate the following capabilities in our design. The model should be built from sparse real measurements given the overhead of gathering dense measurements for new environments. The model is off- grid, which means that the model can work with arbitrary transmitter and receiver locations and does not need an initial quantization to a grid (which is the case for example in [10]). In that way, the model can be seen as a differentiable function of transmitter and receiver locations and be used in a design loop (for example as a part of an optimization problem). Once the model is trained on a set of maps and transmitter-receiver locations, it should be usable for unseen maps and location pairs. Finally, the model should be scalable to different map sizes and transmitter-receiver distances and do that efficiently by attending to part of the map that matters for path loss prediction of a given transmitter-receiver pair. For example, since millimeter wave (mmWave) path loss prediction is dominated by LOS path, the model needs to focus on the area around the line connecting the transmitter and receiver. In this work, we propose a transformer-based model that satisfies all these desiderata. We evaluate our model on an outdoor dataset for mmWave carrier frequency. The paper is organized as follows. After reviewing related works in Section II, we introduce our proposed model in Section III. We provide experiments to substantiate the benefits of our approach in Section IV and conclude in Section V. II. RELATED WORKS ML approaches for path loss prediction can generally be divided in two categories: image-to-image translation (radio maps) and link-level prediction. The image-to-image trans- lation approach represents different locations on the pixel space of the input map. The output of the model is the same TABLE I: Summary of selected previous works on path loss prediction Authors Carrier frequency Approach Map generalization Foliage Architecture Data Levie et al. [10] Ratnam et al. [11] Bakirtzis et al. [12] Tian et al. [13] Qiu et al. [14] Gupta et al. [15] Sousa et al. [7] Lee et al. [16] Ours 5.9 GHz 28 GHz 868 MHz 5.8 GHz 30 GHz 28 GHz 2.6 GHz 28 GHz 28 GHz Image-to-Image Image-to-Image Image-to-Image Image-to-Image Image-to-Image Per-link Per-link Per-link Per-link ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✗ ✓ ✗ ✓ ✗ ✓ ✗ ✓ ✓(Satellite) ✗ ✓ UNet UNet UNet (atrous convolution) Transformer SegNet CNN + Classic ML ResNet+MLP CNN+MLP Transformer Simulation Simulation Simulation (indoor) Simulation Simulation Real Real (Drive test) Simulation Simulation input map annotated with path loss information. Therefore, the model provides path loss prediction for all locations at the output at inference time. On the other hand, link-level prediction models provide path loss prediction only for a given transmitter-receiver location. In this sense, link-level based predictions conform more to conventional path loss functions that act directly on the location information, are expected to be more computationally efficient and can be used naturally in design loops. There are many works on ML-based channel modeling and prediction (see [15], [17] for a survey). We will focus on some of these works. The seminal work on ML-based path loss prediction [10] casts the problem as image-to-image translation and uses a UNet based architecture to solve the problem. UNet ap- proaches have been also been adopted in [11], [12], [18] while [14] has employed a variant of SegNet, framing the problem as a segmentation problem. The latter model uses a fully convolutional backbone, which enables applying maps of different sizes. In contrast to these works, our model performs link-level prediction. Another line of works has focused on using vision models, such as CNNs [7], [15], [16] and transformers [13], for feature extraction. These features are then either passed to another neural network [7], [13], [16] or other classical ML algorithms [15]. The work in [15] also addresses the problem of model building from sparse measure- ments and generalization to unseen scenarios. However, the feature extraction using convolutional models is not scalable to different map sizes. The authors in [13] propose a grid-based embedding instead of conventional positional embedding in transformer architecture. This method is still radio map- based, and the transformer-based architecture is still applied on the whole image. Our proposed transformer architecture is link-level based, embeds location information with image patches and selects the number of patches according to the distance. Therefore, it is more efficient for shorter distances. Similar to our work, the authors in [19] used deep vision transformer model for link-level based path loss prediction. The transformer model is used only for feature extraction and the final estimation is done by another neural network. They focus on federated training setup, use the full satellite maps and do not study generalization of their model. Using satellite images directly can harm the generalization in general, as the model can overfit to scene specificities. In our work, the core prediction model is transformer based where the number of patches are adaptively selected based on the locations. We do not use satellite images and explicitly disentangle the effects of foliage and buildings in the input space. The authors in [7] consider a ResNet backbone for link-level based prediction, and therefore, cannot adapt to different map sizes. Table I shows an overview of existing related works on path loss prediction. To the best of our knowledge, this is the first work that proposes a model for link-level path loss prediction unifying scalability to different map sizes and generalizeability to unseen environments. III. PROPOSED APPROACH The goal of our approach is to obtain a link-level prediction model that accepts map input of varying size. In our case, the size is dependent on the distance between transmitter and receiver. Typically, in CNNs that predict a single value for an image, for example, the class of the image, the features of the convolutional layers have to be combined. If this is done by the means of a fully connected layer, the fully connected layer cannot scale adaptively with different sized inputs. Thus, the entire model is restricted to fixed sized inputs. In deep learning, the attention mechanism has proven to be useful to process sequences of variable lengths, yet at the same time considering the interaction of all the elements in the sequence. Vision transformers (ViT) [20] have successfully applied this idea to image classification. Inspired by this success, we designed a transformer architecture that takes a map of variable size and the distance between transmitter and receiver as input and predicts the path loss along the dominant path. In this section, we first describe how the map data is pre-processed based on the transmitter and receiver locations, and second, we provide the details of our transformer architecture. A. Map alignment and extraction Suppose a coarse extract of a map that includes the trans- mitter location xt and receiver location xr is given as an image, we use the following procedure to align and crop the map. First, the map is rotated around the transmitter location such that the receiver is located along the vertical y-axis of the image, with the receiver closer to top of the map than the transmitter. After this alignment, the map is cropped to a size appropriate for the given task and to have a final image with height and width being multiples of a chosen patch size P . For this purpose, we start at the transmitter and define the transmitter patch such that the pixel corresponding to the transmitter is located in the center of that patch. Note that this requires an odd patch size. Given the transmitter patch, Fig. 1: Our proposed transformer architecture where the number of patches can change adaptively to the size of the input map. the other patches are also defined in a grid, and the receiver is generally not located in the center pixel of the receiver patch. All patches between the transmitter and receiver patch are included in the final map extract. In addition, depending on the task, we can choose to include additional padding patches around those patches. B. Transformer architecture Overall, our architecture choices are close to those in [20] and are illustrated in Fig. 1. The model expects an input image of which the height and width are multiples of the chosen patch size P . The input image is then split up into R × C (rows × columns) patches of size P . Each patch pr,c (r ∈ {1, ..., R} and c ∈ {1, ..., C}) is passed through the same linear patch projection layer which projects the patch pixel values to the initial latent feature vectors hr,c ∈ RD of dimension D. Similarly, the scalar distance between transmitter and receiver ∆x = (cid:112)(xr − xt)2 is projected to the latent vector h0 ∈ RD through a separate linear projection layer. The positional embedding is added to the latent vector h0 r,c of each patch, before applying the transformer layers. In contrast to ViT, the vertical is separate from the horizontal positional embedding. In our specific case, we assume that the number of horizontal input patches is fixed, while the number of vertical patches, i.e., the height of the image may vary per input sample. The horizontal positional embeddings uc ∈ RD are learned as in ViT. The vertical positional embeddings vr ∈ RD are based on sine and cosine functions, as in [21], (cid:16) vr,d+1 = sin vr,d+2 = cos r/10000d/D(cid:17) r/10000d/D(cid:17) (cid:16) , (1) , (2) where d ∈ {0, 2, ..., D − 2}. The positional embeddings are then added to each element of the latent vectors Fig. 2: An example of the dataset for a single pole showing building footprints in black, foliage heights through green shades, the pole location in red, and receiver locations in blue. ViT [20], a transformer layer consists of a multi-head self- attention layer with residual connection followed by a multi- layer perceptron (MLP) with residual connection. Before the input is passed to the multi-head self-attention, the input is normalized using layer norm. The same is done for the MLP. The original ViT was designed for image classification, while in our case, we aim to solve a regression problem. There- fore, the head network takes the final transformed distance embedding zL 0 and applies a linear layer to project it to the target space, which is R in our case. IV. EXPERIMENTS To demonstrate the value of our approach, we compare its performance to widely adopted ML approaches for path loss prediction. For this purpose, we simulate the path loss of mmWave propagation between a transmitter with receivers in an urban environment. We first describe the dataset generation, then compare our approach quantitatively to the baselines, and discuss qualitative visualizations of predicted radio maps. z0 r,c = hr,c + vr + uc. (3) A. Dataset Note that the distance embedding does not require a positional embedding, thus z0 0 = h0. For notational simplicity, we will use z0 = (z0 r,c) unless the distinction is necessary. The transformer consists of L transformer layers. Each layer l ∈ {1, ...L} takes zl−1 to compute the output zl. As in 0,0, ..., z0 0, z0 The dataset used in our experiments is based on ray tracing simulation using an RF-relevant DT model of an urban area of about 1.5 km2 in downtown Philadelphia, Pennsylvania, USA. The DT includes several associated geographic information system (GIS) data layers of: (1,1)(2,1)(R,C).........Patch projection layerSplit image into R×CpatchesTransformer Encoder (Llayers)Path loss yLinear Regression head+++...Convert to top-UE aligned representationInput map (overlaid with receiverand transmitterlocations)ΔxDistance projection layerAdd 2D positional encodingz00z1,10z2,10zR,C0z0L (a) LOS known maps (b) NLOS known maps (c) LOS novel maps (d) NLOS novel maps Fig. 3: Cumulative distribution functions over absolute prediction errors (LOS vs. NLOS). • Building polygons footprint and their corresponding heights (in meters) curated from OpenStreetMap.org. • Tree foliage contours and heights (with a maximum of 30m) obtained from publicly available GIS data sources. • Terrain model of topographic elevation data based on the U.S. Geological Survey's gmted2010 model. The dataset also includes two types of entities: 1) Latitude, longitude and height, fixed to about 9m (30 feet) above the ground level, of 402 outdoor pole lo- cations which are identified as compatible to serve as transceiver-bearers. 2) Latitude, longitude and height, fixed to 1.5m above the ground level, of 196, 750 possible user equipment (UE) locations uniformly distributed across the outdoor (non- building) space. Based on the generated DT, MATLAB's ray-tracing tool is utilized to infer path losses for mmWave propagation at 28 GHz for any connectivity link between pole-to-UE pairs. For each three-dimensional (3D) ray drawn by the ray tracer the free-space propagation model is adopted as the ray traverses from the transmitter node to the receiver node along the 3D path generated by the ray-tracing tool1. A ray reflected from a building is assumed to be attenuated by an additional 6.4dB2 on top of the free-space propagation loss. Each ray is associated with defining end-to-end geometric coordinates and a DT-based path loss estimate, and is also accompanied with a LOS vs. non-LOS (NLOS) flag and its propagation distance. Since the Matlab ray tracer currently does not support the input of a foliage data layer, the effect of tree obstruction is incorporated as a post-processing stage, as described in the following. For the two strongest rays per connectivity link, the fraction of these rays traversing through tree canopies is calculated based on the foliage information, such that it is assumed that any segment of a ray passing through the top 75% of the estimated height of an identified tree (i.e., within the expected volume of the tree canopy), experiences a foliage loss at a rate of 2.5 dB/m in addition to the free-space propagation loss. The ray, out of two, with the lesser total (that is free space and foliage attenuated) propagation loss is 1Due to run-time constraints the ray tracing is limited to a single reflection per ray (i.e., diminishing rays with two or more reflections are omitted) and no diffraction is modeled. 2This is a slightly conservative loss w.r.t. the reflection loss typically measured for common exterior building materials such as concrete and glass. Furthermore, zero ground reflection loss is assumed. declared as the reported path loss associated with the pole-to- UE link. There are in total 2, 394, 230 such connectivity links in the dataset. To evaluate the generalization capabilities of our approach, we divide the covered area in four distinct, non-overlapping areas based on the transmitter locations, each with approxi- mately the same number of connectivity links. The links of one area are used as test set for the final performance evaluation, and the second area is used for validation during model design and training. We refer to links of those areas as novel maps data as the map data of those areas has not been used during training. The last two areas are further split to obtain additional indicators of the performance on known maps data, i.e., the maps were available during training, but the receiver locations differ. This split results in a training, test, and validation set consisting of approximately 16%, 80%, and 4%, respectively, of the total links in the known maps area. As a result, we only have sparse training data akin to real measurement campaigns. For the ML approaches evaluated in this paper, the map is converted to images where one pixel corresponds to 1m2. The building footprints are represented as binary masks, since transmitter and receiver are generally located lower than the building height in our scenarios. Foliage, however, is often less tall and its height in each pixel is indicated relative to the maximum height described above. The transmitter and receiver locations are given in a local Cartesian coordinate system for the link-level algorithms. Fig. 2 illustrates the sparse receiver locations for a single pole as a discretized radio map. B. Baseline models and training To evaluate the performance of our approach, we compare it with three baselines of popular approaches, namely UNet, CNN+MLP, and 3GPP w/ LOS oracle. In the following we describe the baselines and our architecture in detail. All ML models were trained using a mean squared error (MSE) loss. 1) UNet: This model is the RadioUNet neural network from [10] adapted to work with an additional foliage input channel in the first convolutional layer. The data has been transformed to sparse radio maps for this purpose, such as shown in Fig. 2, and pixels that do not have target path loss values are ignored in the loss function. Although the radio maps are cropped as much as possible, less than 0.4% of the pixels in the training set have valid path loss values. We followed the same two-stage training approach as in [10], training one UNet first directly on the sparse radio maps. Then, in the next step, a second UNet is trained using the map and the 0510152025303500.20.40.60.81OursUNetCNN+MLP3GPP w/ LOS oracleAbsolute Error [dB]CDF0510152025303500.20.40.60.81OursUNetCNN+MLP3GPP w/ LOS oracleAbsolute Error [dB]0510152025303500.20.40.60.81OursUNetCNN+MLP3GPP w/ LOS oracleAbsolute Error [dB]0510152025303500.20.40.60.81OursUNetCNN+MLP3GPP w/ LOS oracleAbsolute Error [dB] output of the first UNet as input while the weights of the first UNet are frozen. Since the original dataset presented in [10] does not include foliage information and considers a lower carrier frequency, the dataset was not used for pretraining. 2) CNN+MLP: This algorithm combines the map features obtained from a CNN with the direct beeline distance of transmitter and receiver in an MLP to predict their path loss. We use the popular ResNet 18 backbone [22] as CNN and concatenate the features of the final fully connected layer with the scalar distance value. The output of the ResNet is a vector is of size 512, resulting in a feature vector of 513 elements. This feature vector then serves as input to a final MLP of 3 linear layers with output dimension 512 followed by the common ReLU activation function. Then, another final linear layer projects the hidden features to the scalar path loss value. Note, this ResNet backbone is designed for inputs of size 256x256. We use squared crops of the map data with the transmitter in the center, rotate them such that the receiver is vertically aligned with transmitter, and finally, resize them to the required input size. Of crop sizes corresponding to 800m2, 400m2, and 200m2, we have found 400m2 to work best. 3) 3GPP w/ LOS oracle: This model adopts the path loss equations of table 7.4.1-1 from [23] in the Urban Micro Street Canyon (UMi) scenario and thus, is not a ML model. The carrier frequency is set to fc = 28GHz while the heights and distances are computed from the 3D transmitter and receiver locations. Instead of computing a distance dependent LOS probability as in [23], we provide an LOS oracle, such that based on this LOS-flag, the correct model equations are used. 4) Scalable transformer (our approach): The architecture choices of our approach largely follow those of ViT-32 [20], except for the patch size which we set to P = 33. We employ 12 hidden layers, each with 12 headed multi-head attention on latent vectors of size D = 768 and no dropout. The MLP fol- lowing each attention layer has dimension 3072. As described in Section III, we add one patch in each direction around the transmitter and receiver patches as padding, resulting in input images of R × 3 patches. C. Generalization from sparse data The dataset contains only sparse training samples and thus poses special challenges to learning algorithms to generalize to novel maps, not seen during training. Table II shows the root mean squared error (RMSE) and the mean absolute error (MAE) on our two test sets, the known maps and the novel maps test data. In all cases, our approach outperforms the other algorithms on this sparse dataset. While the performance of 3GPP w/ LOS oracle between the known maps and the novel maps data only differ marginally, the performance of other algorithms varies strongly across the data splits. The difference arise from the fact that the novel maps data was not available during training of the models. Therefore, it is an indicator of the models' capabilities to generalizes to previously unseen maps. 3GPP w/ LOS oracle only gets the LOS-flag as geo- metric feature and therefore its performance remains constant. Despite the challenges of generalization, taking map infor- mation into account is beneficial to the performance as seen by the improvements of UNet, CNN+MLP, and our approach compared to 3GPP w/ LOS oracle. As CNN+MLP is designed for dense training target, such as radio maps, its performance on our data is likely suffering from the sparseness. Link-level prediction approaches, such as CNN+MLP and ours, provide a more promising performance for sparse training data compared to image-to-image translation approaches, such as UNet. The generalization behavior is also reflected in the CDFs shown in Fig. 3 as novel maps appears more challenging than known maps for the learning-based algorithms. In addition, we can inspect the difference between LOS and NLOS scenarios. While our approach and CNN+MLP perform well for both LOS and NLOS cases, the 3GPP w/ LOS oracle performance drops severely in the NLOS case indicating that modeling NLOS behavior requires more geometric information than the LOS-flag. Interestingly, the independence of the geometry seems to benefit 3GPP w/ LOS oracle in the LOS scenarios of novel maps (Fig. 3c) such that it partially outperforms the other algorithms. TABLE II: Comparison to the baselines on known maps with unknown receiver locations, and on novel maps where map and receiver locations were not available during training/validation. Algorithm 3GPP w/ LOS oracle UNet CNN+MLP Ours known maps RMSE MAE 6.86 10.18 6.72 8.82 1.72 2.89 1.15 2.27 novel maps RMSE MAE 6.97 10.28 7.77 9.83 3.62 5.58 3.29 5.31 D. Prediction of dense radio maps While the models were trained on sparse data, we can generate dense radio maps by predicting the path loss for each pixel given a desired resolution. For this purpose, we assume that the transmitter is located at the center of the radio map and the receivers at the center of each pixel. Fig. 4 shows examples of such radio maps for CNN+MLP and our approach. The radio maps illustrate how both models take both foliage and building information into account and adapt their prediction accordingly. In figures 4a and 4b, one can see sharp edges in the prediction at building corners and attenuation due to foliage in the top half of the images. In figures 4c and 4d, the circle of trees in the top half of the images shows how the height of the trees indicated by the green color influences the prediction. The predicted radio maps also highlight the challenges of highly sparse data. In areas of low coverage, such as when buildings obstruct the direct path, the data density for training was low. As a direct result, the models may have challenges to reflect the low coverage as it was not captured in the training data. V. CONCLUSIONS We have presented a transformer-based model for link-level path loss prediction that can be trained from sparse data, works on continuous transmitter and receiver locations and dB (a) CNN+MLP known maps (b) Ours known maps (c) CNN+MLP novel maps (d) Ours novel maps Fig. 4: Visualization of predictions (blue) as radio maps overlaid with the building (black) and foliage information (green). generalizes better to novel maps than commonly used machine learning models for path loss prediction. A key feature of our model is that it can adaptively process map input of various sizes, allowing us to increase the map size for larger connectivity link distances without changing the resolution of the map. We argue that this property is especially useful for mmWave and shorter wavelengths in urban areas as the path loss of relevant links is often LOS dominated. A limitation of the model is that it does currently not take terrain information and building height into account for its prediction. While in our dataset the buildings are usually taller and the terrain varies little in the relevant area around a single transmitter, this can easily be addressed in future, for example, by encoding the building height and terrain as additional channels of the map. REFERENCES [1] D. Schwalbe-Koda, A. R. Tan, and R. G ́omez-Bombarelli, "Differen- tiable sampling of molecular geometries with uncertainty-based adver- sarial attacks," Nature Communications, vol. 12, no. 1, Aug. 2021. [2] X. Fu, Z. Wu, W. Wang, T. Xie, S. Keten, R. Gomez-Bombarelli, and T. S. Jaakkola, "Forces are not Enough: Benchmark and Critical Evalu- ation for Machine Learning Force Fields with Molecular Simulations," in NeurIPS 2022 AI for Science: Progress and Promises, Nov. 2022. [3] N. Ruiz, S. Schulter, and M. Chandraker, "Learning To Simulate," in International Conference on Learning Representations, 2022. [4] J. Brandstetter, D. E. Worrall, and M. Welling, "Message Passing Neural PDE Solvers," in International Conference on Learning Representations, Sep. 2021. [5] Y. Hu, L. Anderson, T.-M. Li, Q. Sun, N. Carr, J. Ragan-Kelley, and F. Durand, "DiffTaichi: Differentiable Programming for Physical Simulation," in International Conference on Learning Representations, 2020. [6] T. Orekondy, A. Behboodi, and J. B. Soriaga, "MIMO-GAN: Generative MIMO Channel Modeling," in ICC 2022 - IEEE International Confer- ence on Communications, May 2022, pp. 5322–5328. [7] M. Sousa, P. Vieira, M. P. Queluz, and A. Rodrigues, "An Ubiquitous 2.6 GHz Radio Propagation Model for Wireless Networks using Self- Supervised Learning from Satellite Images," IEEE Access, vol. 10, pp. 78 597–78 615, 2022. [8] T. Orekondy, P. Kumar, S. Kadambi, H. Ye, J. Soriaga, and A. Behboodi, "WiNeRT: Towards Neural Ray Tracing for Wireless Channel Modelling and Differentiable Simulations," in The Eleventh International Confer- ence on Learning Representations, 2023. [9] J. Hoydis, F. A. Aoudia, S. Cammerer, M. Nimier-David, N. Binder, G. Marcus, and A. Keller, "Sionna RT: Differentiable Ray Tracing for Radio Propagation Modeling," Mar. 2023, arXiv:2303.11103 [cs, math]. [Online]. Available: http://arxiv.org/abs/2303.11103 [10] R. Levie, C. Yapar, G. Kutyniok, and G. Caire, "RadioUNet: Fast Radio Map Estimation With Convolutional Neural Networks," IEEE Trans. Wireless Commun., vol. 20, no. 6, pp. 4001–4015, 2021. [11] V. V. Ratnam, H. Chen, S. Pawar, B. Zhang, C. J. Zhang, Y.-J. Kim, S. Lee, M. Cho, and S.-R. Yoon, "FadeNet: Deep Learning-Based mm- Wave Large-Scale Channel Fading Prediction and its Applications," IEEE Access, vol. 9, pp. 3278–3290, 2021. [12] S. Bakirtzis, K. Qiu, J. Zhang, and I. Wassell, "DeepRay: Deep Learning Meets Ray-Tracing," in 2022 16th European Conference on Antennas and Propagation (EuCAP), 2022, pp. 1–5. [13] Y. Tian, S. Yuan, W. Chen, and N. Liu, "Transformer based Radio Map Prediction Model for Dense Urban Environments," in 2021 13th International Symposium on Antennas, Propagation and EM Theory (ISAPE), vol. Volume1, 2021, pp. 1–3. [14] K. Qiu, S. Bakirtzis, H. Song, J. Zhang, and I. Wassell, "Pseudo Ray-Tracing: Deep Leaning Assisted Outdoor mm-Wave Path Loss Prediction," IEEE Wireless Communications Letters, vol. 11, no. 8, pp. 1699–1702, 2022. [15] A. Gupta, J. Du, D. Chizhik, R. A. Valenzuela, and M. Sellathurai, "Machine Learning-Based Urban Canyon Path Loss Prediction Using 28 GHz Manhattan Measurements," IEEE Trans. Antennas Propag., vol. 70, no. 6, pp. 4096–4111, 2022. [16] J.-Y. Lee, M. Y. Kang, and S.-C. Kim, "Path Loss Exponent Prediction for Outdoor Millimeter Wave Channels through Deep Learning," in 2019 IEEE Wireless Communications and Networking Conference (WCNC), 2019, pp. 1–5. [17] C. Huang, R. He, B. Ai, A. F. Molisch, B. K. Lau, K. Haneda, B. Liu, C.-X. Wang, M. Yang, C. Oestges, and Z. Zhong, "Artificial Intelligence Enabled Radio Propagation for Communications-Part II: Scenario Identification and Channel Modeling," IEEE Transactions on Antennas and Propagation, vol. 70, no. 6, pp. 3955–3969, Jun. 2022, conference Name: IEEE Transactions on Antennas and Propagation. [18] O. Ozyegen, S. Mohammadjafari, M. Cevik, K. El Mokhtari, J. Ethier, and A. Basar, "An empirical study on using CNNs for fast radio signal prediction," SN Computer Science, vol. 3, no. 2, p. 131, 2022. [19] H. Yu, Z. Hou, Y. Gu, P. Cheng, W. Ouyang, Y. Li, and B. Vucetic, "Distributed Signal Strength Prediction using Satellite Map empowered by Deep Vision Transformer," in 2021 IEEE Globecom Workshops (GC Wkshps), 2021, pp. 1–6. [20] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, J. Uszkoreit, and N. Houlsby, "An Image is Worth 16x16 Words: Trans- formers for Image Recognition at Scale," in International Conference on Learning Representations, 2021. [21] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. u. Kaiser, and I. Polosukhin, "Attention is All you Need," in Advances in Neural Information Processing Systems, I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, Eds., vol. 30. Curran Associates, Inc., 2017. [22] K. He, X. Zhang, S. Ren, and J. Sun, "Deep Residual Learning for Image Recognition," in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016. [23] 3GPP, "Study on Channel Model for Frequencies from 0.5 to 100 GHz," 3rd Generation Partnership Project (3GPP), Technical Report (TR) 38.901. [Online]. Available: http://www.3gpp.org/DynaReport/ 38901.htm
http://arxiv.org/abs/2310.04566v1
"2023-10-06T20:13:07"
"2023-10-06T20:13:07"
Knolling bot: A Transformer-based Approach to Organizing a Messy Table
In this study, we propose an approach to equip domestic robots with the ability to perform simple household tidying tasks. We focus specifically on 'knolling,' an activity related to organizing scattered items into neat and space-efficient arrangements. Unlike the uniformity of industrial environments, household settings present unique challenges due to their diverse array of items and the subjectivity of tidiness. Here, we draw inspiration from natural language processing (NLP) and utilize a transformer-based approach that predicts the next position of an item in a sequence of neatly positioned items. We integrate the knolling model with a visual perception model and a physical robot arm to demonstrate a machine that declutters and organizes a dozen freeform items of various shapes and sizes.
[ "Yuhang Hu", "Zhizhuo Zhang", "Ruibo Liu", "Philippe Wyder", "Hod Lipson" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04566v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04566v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.RO", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.RO", "cs.AI", "cs.CV", "cs.LG" ]
Knolling bot: A Transformer-based Approach to Organizing a Messy Table Yuhang Hu* Zhizhuo Zhang Philippe Wyder Hod Lipson Ruibo Liu Columbia University 3 2 0 2 t c O 6 ] O R . s c [ 1 v 6 6 5 4 0 . 0 1 3 2 : v i X r a Abstract- In this study, we propose an approach to equip domestic robots with the ability to perform simple household tidying tasks. We focus specifically on 'knolling,' an activity related to organizing scattered items into neat and space- efficient arrangements. Unlike the uniformity of industrial environments, household settings present unique challenges due to their diverse array of items and the subjectivity of tidiness. Here, we draw inspiration from natural language processing (NLP) and utilize a transformer-based approach that predicts the next position of an item in a sequence of neatly positioned items. We integrate the knolling model with a visual perception model and a physical robot arm to demonstrate a machine that declutters and organizes a dozen freeform items of various shapes and sizes. I. INTRODUCTION Designing a robot for household tasks has always pre- sented unique challenges [1]–[3]. Unlike industrial settings characterized by uniformity and limited object variety, house- hold environments are filled with a diverse array of items of various shapes and sizes. The challenge of designing a robot to perform household tasks is not merely about learning some policies to perform specific tasks [4], [5]. It necessitates the embodiment of a semblance of human-like cognition within the robot, particularly concerning abstract concepts such as tidiness and neatness. One such concept intrinsic to humans is 'knolling' - the intuitive ability to organize items in a manner that is both aesthetically pleasing and space-efficient(Fig.1a). However, imparting this understanding to a robot is no easy feat. Given the subjective of tidiness and the multiple optimal solutions that could satisfy different individuals' preferences, knolling becomes an abstract problem without any definitive stan- dards. Excessive definitions of the objective function and pre- defined object position will lead to a lack of generalizability. Our solution lies in decoupling the consciousness model – which encapsulates the essence of knolling – from other crucial robotic system components, such as the visual per- ception system and controllers [6]. This division enhances the modularity and versatility of each component, allowing them to be combined in different configurations to cater to unique knolling preferences. Our focus in this work primarily rests on the size of the objects for knolling tasks. Nonetheless, other factors, such as object color and material, can also influence the knolling result. By training different knolling models, a variety of preferred knolling results can This work was supported in part by the US National Science Founda- tion (NSF) AI Institute for Dynamical Systems (DynamicsAI.org), grant 2112085. *yuhang.hu@columbia.edu be achieved. Figure 1b provides a visual illustration of a robot arm transforming a clutter of objects on a table into a well-organized layout using our proposed method. To model the consciousness of neatness and tidiness, we take inspiration from the field of natural language processing (NLP) and adapt it to the context of object arrangement. We draw parallels between knolling objects and language, where objects act as individual "words" that can be com- bined in various ways to form a coherent "sentence." Also, transformer architecture can handle varying input and output sizes with autoregression, which fits the knolling task as the number of objects in the environment is arbitrary [7], [8]. Leveraging a transformer-based autoregressive model, we address the challenges of multi-label prediction and enable precise target state generation to perform the knolling task. This research aims to contribute to bridging this gap by imbuing a robot with an understanding of the human concept of neatness and developing an integrated pipeline to demonstrate how to deploy it to perform real-world knolling tasks. The pipeline is composed of three stages: a knolling model, a visual perception model, and a robot arm controller. The knolling model, based on a transformer architecture, predicts the target positions of objects. The visual perception model, based on our customized YOLO v8, detects object key points from an RGB image [9]. Finally, the robot arm controller, leveraging the outputs from the previous stages, guides the robot arm to execute the knolling tasks. This paper outlines several key contributions to the field of robotics, especially concerning household tasks. First, it presents a novel conceptualization of knolling consciousness, inspired by NLP and transformer-based models, that enables a robot to understand and perform knolling tasks. Second, we provide a scalable modular pipeline architecture consisting of three components - a knolling model, a visual percep- tion model, and a robot arm controller. This architecture augments the system's versatility and adaptability, allowing customization to meet unique knolling preferences. It serves as a flexible and scalable framework that is primed for future advancements in robot cognition and adaptability. II. RELATED WORK A. Robot learning in manipulation tasks The domain of robot learning and manipulation tasks has seen significant advancements in recent years. Various manipulation tasks, such as wiping and polishing, stacking, peg-in-hole, and pick-and-place tasks, have been explored [10]–[14]. In the realm of stacking tasks, Lee et al. used Fig. 1. a) Knolling is the process of arranging items neatly in a flat layout. Popular applications range from tools to food and fashion. b) Knolling pipeline in the real world. The left side of the figure displays a cluttered desktop strewn with a variety of items such as batteries, erasers, electronic components, and other daily necessities in the lab. Our robot initiates the knolling process after detecting and identifying these objects through a camera. The right side of the figure depicts the outcome of this process, presenting a tidy, well-organized desktop. This transformation exemplifies the robot's ability to apply the knolling model, execute a tidying task, and create a pleasing and space-efficient arrangement, all while demonstrating the potential for domestic robotics. offline reinforcement learning (RL) to improve upon existing policies for robotic stacking of objects with complex geome- try, while Furrer et al. proposed an algorithm for suggesting stable poses for stacking, validated through a real-world autonomous stacking workflow [15], [16]. For pick-and-place tasks, Gualtieri et al. proposed a deep reinforcement learning approach, and Zeng et al. introduced the Transporter Network for vision-based manipulation tasks [17], [18]. While these works have contributed significantly to robot manipulation, our work aims to design a knolling bot that can arrange messy objects on a desktop into a neat layout, adding a new dimension to the field. B. Object Recognition Visual perception in robotics, particularly object recog- nition, constitutes a critical component when it comes to managing domestic environments. The complexities and di- versity within human households necessitate a robust visual perception model capable of discerning between a vast array of items. Among the various models employed for object recognition, the You Only Look Once (YOLO) model has emerged as a favored choice for its efficiency and effec- tiveness. YOLO's unique capacity to estimate classification scores and bounding boxes directly from input images has made it a valuable tool in several applications [9]. It trans- forms the traditionally two-step process of object detection into a single-step regression problem, thereby streamlining and accelerating the process. Its flexibility and performance have been demonstrated in diverse applications, such as grasping texture-less industrial parts [19], underwater trash removal [20], and hands-free assistive manipulation [21]. These applications highlight the wide range of scenarios where YOLO can facilitate object detection and recognition. In our work, we have specifically adapted the YOLO- v8 model to not just identify objects but also re-train to detect four key points on each object. These points, providing critical geometric data, enable us to infer essential parameters such as the position, orientation, width, and length of each item. This customization enhances the model's utility beyond mere object recognition, contributing to a more comprehen- sive understanding of the object's spatial characteristics for the knolling task. C. Transformers for robot learning In the domain of machine learning models, transformers have revolutionized many fields with their attention-based architecture [22]–[27]. The success of transformer models in NLP has prompted exploration in their application to robotic tasks [28], [29]. Jangir et al. proposed the use of transformers with a cross-view attention mechanism for effective fusion of visual information from both cameras for RL policies [30]. Zhu et al. introduced VIOLA, which used a transformer-based policy to improve the robustness of deep imitation learning algorithms [31]. Shridhar et al. proposed PerAct, which uses the preceiver transformer to encode language goals and RGB-D voxel observations [32]. Jain et al. proposed the Transformer Task Planner, which could be pre-trained on multiple preferences, and Dasari et al. explored one-shot visual imitation learning using the Transformer architecture [29], [33]. Drawing from these applications and harnessing the power of Transformer-based models, our approach uniquely applies the autoregressive nature of Transformers to the knolling task. This novel application allows for the handling of varying object types, sizes, and quantities, thus enabling the robot to generate an aesthetically pleasing and space-efficient arrangement of items, similar to human performance. III. METHOD Our knolling pipeline is composed of three stages: a knolling model, a visual perception model, and the robot arm controller for executing the pick and place task. A. Knolling Model The knolling model is a transformer-based architecture composed of an encoder-decoder mechanism capable of handling varying input sizes. The input of the encoder is Fig. 2. Knolling model learning framework: The first step in our pipeline involves recognizing and identifying the objects present on a table using the visual perception model. This model takes the input image and outputs n objects' size (width and length) and position presented as a list. The Knolling Model utilizes a transformer-based model that takes the high-dimensional object state data produced by Positional Encoding as input. The model predicts N target positions after N iterative process. a list of object state information, specifically, each object's width and length. Each list represents one unique scenario. Therefore, the input size directly corresponds to the number of objects on the table. The knolling pipeline we presented is shown in Fig. 2 Leveraging the autoregression of the transformer model, we initialize the model with fully-masked data (Mn in the Fig.2), which is then combined with the encoder's output to predict the target position of the first object. Once the first object's position is predicted, it replaces the first element of the masked data, and the model proceeds to predict the target position for the second object. This iterative process continues until all object positions are predicted. Our model training procedure involves two crucial steps: pre-training and fine-tuning. Pre-training serves as a founda- tional step, where the model is trained on simpler knolling tasks with fewer objects and partially pre-knolled scenarios. This allows the model to grasp the fundamental structure and semantics of knolling tasks. During this phase, we employ the Adam optimizer with a learning rate of 1e-4. We recognize that there can be multiple viable placements for an object, and employing solely an MSE loss might indeed lead the model to predict an averaged, and potentially incorrect, pose. To counteract this, our model's output uses Gaussian mixture models (GMM). During the forward pass of our model, we employ a temperature variable to regulate the randomness of the output. For the training phase, we set the temperature variable to 1. Consequently, the model yields five means, standard deviations, and weights. We utilize these weights to select the appropriate distribution, and then sample the position (x, y) from the corresponding normal distribution. The fine-tuning phase focuses on training the model on full knolling tasks, where it needs to organize all objects from scratch. The model can accumulate errors due to predictions based on previously predicted values. This can make it challenging for the model to learn distinct target positions for each object, often resulting in the generation of similar expectation values for all of them. This is why the pre- training process is crucial, as it prepares the model to handle more complex tasks more accurately. During fine-tuning, we maintain the same optimizer but reduce the learning rate to 1e-5. Moreover, to replicate scenarios involving different numbers of objects on the table, we mask the encoder input. Both training procedures use the same dataset with 1 million data pairs. The merit of this approach lies in the unique capabilities of the transformer architecture. Its encoder-decoder mechanism and autoregressive properties allow our model to effectively and iteratively predict object positions, making it well-suited for complex knolling tasks. Our data collection process, conducted in the Pybullet physics simulation environment. To achieve this, we employ an optimization strategy that mini- mizes the square area occupied by all objects on the table. We randomly select a batch of 10 objects for each data collection iteration and categorize them based on their shapes. These objects are then subjected to an optimization process, which runs for 10,000 iterations. During this process, the placement of objects on the table is continually adjusted in order to minimize the total square area they occupy. Given the inherently stochastic nature of our optimization process, even with the same batch of objects, we can generate a diverse array of knolling outcomes. This variability aids in exposing the model to a wide range of potential real-world scenarios, thereby enhancing its ability to generalize and adapt. Moreover, it ensures that the model is equipped with a robust understanding of the concept of neatness as it pertains to the knolling task, echoing the human capacity for aesthetic organization. B. Visual Perception Model The visual perception model is a customized YOLO v8 model [9], fine-tuned to predict the key points of detected objects. It ingests a single (480, 640) RGB image and outputs an (N, 4, 2) format dataset, where N represents the number of objects detected, and each object has four key points with two coordinates (x, y). The data required for training our models is collected and generated within the Pybullet simulation environment. In this environment, we create diverse scenarios by positioning objects randomly across various virtual tabletop settings. The object states, including their dimensions and positions, are stored for training the knolling model. To prepare our Visual Perception model for real-world deployment and address the simulation-to-reality gap, we apply the visual domain randomization technique to our data collection process [34]. This technique helps in enhancing the model's adaptability and robustness by introducing vari- ations and uncertainties that mimic real-world conditions. We manipulate several factors within the Pybullet environment, such as brightness and ground textures. Additionally, we also vary the appearance of the objects with different colors. Using this approach, we train our model to disregard extra- neous noise and focus on essential features. Thus, despite potential variations and unpredictable noise in real-world scenarios, the model can accurately detect and predict the key points or corners of the objects. Once the Visual Perception Model successfully identifies the object corners, the central positions and orientations of the objects are calculated based on the key points. This data is essential for the subsequent pick-and-place tasks performed by the robot arm controller. C. Implementation of Robot Manipulation for Knolling Tasks This final stage leverages the information from the previ- ous two stages to control the robot arm for knolling tasks. The controller operates in four modes: 1) Movement between locations, 2) Grasping and releasing objects, 3) Table sweep- ing, and 4) Object separation. The knolling model guides the arm by providing the target positions for each object, while the visual perception model assists by supplying the current positions. To generate smooth trajectories and avoid a potential collision, we use Cartesian Control to ensure the robot arm executes smooth pick-and-place tasks. If a target position is occupied, the arm initiates a sweeping motion to clear the area, avoiding collisions before object placement. When the object to be grasped is too closely positioned to another object, the separation mode activates to ensure a safe and accurate grasp. This robotic manipulation control system is vital for actualizing the knolling tasks and real- world implementation. D. Position Encodering Our model utilizes two position encoding methods to pro- cess the input data effectively. The first method, aligned with the original transformer paper's approach, assigns unique tokens to each position in the list. This gives the data a sense of order, enabling the model to predict the target position of the initial objects and apply autoregression for the remaining objects. The second position encoding method maps the input data into a higher-dimensional space via sinusoidal functions. This method allows the model to handle higher frequency representations that potentially improve performance [35]. The input, originally a 2-dimensional vector representing object length and width, is transformed into a 21-dimensional feature vector through this encoding method. By varying the wavelength at five different frequencies, the position encoding captures fine-grained patterns in the data, leading to more accurate predictions. IV. EXPERIMENTAL RESULTS In this section, we first perform experiments in our real- world setup. We also evaluate the performance of each component in the simulation. A. Knolling in the Real World In the real environment, we randomly place ten boxes of random sizes and colors in the robot arm workspace to simulate a messy table. We use a 5-DOF low-cost robot arm (WidowX 200) to complete the knolling task. An Intel Realsense D435 camera fixed on the center top of the workspace captures a picture of the objects (Fig. 1). The visual perception model trained in the simulation with domain randomization is used to predict the state of each object, including the position, width, and length. We use simple objects for our experiments since our key contribution is learning a high-level consciousness of organizing objects. The shape of the objects can be varied in future work using a better grasping approach. The knolling model trained in the simulation outputs the object positions. The controller generates each individual trajectory for every object and controls the robot arm to pick the objects and place them in the target position to finish knolling. Figure 3b showcases this process with four different setups, varying the number of objects in each setup. The first column illustrates the scenario with six objects, comparing the original disordered state with the well-organized arrangement post-knolling. In all the visual perception model successfully detected all the objects, and the knolling model accurately generated their target positions. This practical application validates our model's ability to execute real-world knolling tasks effectively using the proposed method. To fully evaluate the execution and effectiveness of our knolling tasks in a real-world setting, we encourage readers to view our supplementary video. these cases, B. Simulation Experiment We conducted two simulation experiments to validate the knolling model's flexibility and capability to reflect personal preferences. In the first simulated environment, three distinct table setups were shown in Fig.4, each with its unique clutter pattern. For every setup, the same input object states were fed a) Box knolling in the real world. In each test, we show four columns. Column 1: The initial state of the objects on a table, as captured by Fig. 3. the overhead camera. Column 2: The same scenario as Column 1, with added key points and contour outlines indicating the detected objects. Column 3: Action snapshot of the robot executing the knolling task. Column 4: The final state of the workspace post-knolling, presenting an organized table. b) Real-world Knolling Process with Different Object Numbers. This figure exhibits the practical application of our knolling model in four diverse scenarios. Each column corresponds to a different setup with a distinct number of objects (6, 8, 10, and 10). We show the initial messy state captured by the overhead camera and the organized layout after the knolling task is completed by the robot arm. These comparative visuals underline our robot's proficiency in performing real-world knolling tasks across varied object quantities. Please refer to the supplementary video for demonstrations of the complete process. to the model, but by altering the input order, we demonstrated that our knolling model could generate different, tidy table layouts. Fig. 4. Examples of knolling the same set of objects. The figure showcases the simulation environment and three examples of tables before and after the knolling process. Each row represents a different scenario, and the columns exhibit the initial state and four variations of the final state based on different input orders. To further demonstrate our knolling model's capability to reflect personal preferences in the knolling process. Here, we maintained a consistent set of objects across tests but manipulated their input order based on different criteria: prioritizing by object area (large or small), size ratios, color similarity, and object functionality in Fig5. The experiment utilized the same set of objects, but by adjusting their sequence of input, we were able to influence the knolling output to produce different results. Through these simula- tions, we aim to showcase the model's robustness and wide applicability across varying user demands and preferences. C. Knolling Model Quantitive Evaluations In our experiment, we evaluate the performance of our proposed knolling model. The knolling model's design uti- lizes a transformer-based architecture with a self-attention Fig. 5. Personalized Knolling through Input Order Control. This figure presents five distinct layouts achieved by manually controlling the input order based on different criteria: large area priority, small area priority, size ratio, color grouping, and functionality grouping. mechanism and auto-regression, addressing the challenges of varying input and output sizes and multi-label problems. The evaluation metric for this task is the L1 distance, which measures the absolute differences between the ground truth and the predicted positions generated by the knolling model. In the testing phase, for deterministic results, we set the temperature variable to 0. We used a test dataset consisting of different object sets, each ranging from 2 to 10 objects. Each set had a total of 200,000 test samples to ensure a comprehensive and robust evaluation of our model. This allowed us to evaluate our model's performance across different situations, representing a variety of real-world knolling scenarios. To provide a holistic evaluation, we not only compared the average L1 error but also considered the standard deviation, minimum error, and maximum error of our model's results. Two baseline models were established to enable a relative performance comparison. The first baseline model utilized TABLE I COMPARISONS BETWEEN OUR METHODS AND BASELINES OM LSTM MLP N objs. MEAN STD MIN MAX MEAN STD MIN MAX MEAN STD MIN MAX 2 3.38E-04 2.03E-04 8.52E-05 1.74E-03 1.72E-02 3.78E-03 8.37E-03 2.65E-02 2.17E-01 1.91E-03 2.14E-01 2.23E-01 4 2.40E-04 2.71E-04 2.60E-06 2.16E-03 2.09E-02 3.53E-03 1.20E-02 3.10E-02 1.45E-02 4.68E-03 6.98E-03 3.07E-02 6 1.72E-04 2.94E-04 3.40E-07 3.83E-03 2.35E-02 4.15E-03 1.43E-02 3.47E-02 1.90E-01 2.42E-03 1.81E-01 2.00E-01 8 2.08E-04 4.13E-04 3.88E-06 4.95E-03 2.62E-02 3.88E-03 1.63E-02 4.37E-02 2.55E-01 7.97E-03 2.38E-01 2.83E-01 10 3.06E-04 5.51E-04 1.36E-05 7.77E-03 2.98E-02 6.36E-03 1.86E-02 4.99E-02 3.26E-01 8.95E-03 3.07E-01 3.57E-01 a Multilayer Perceptron (MLP) architecture, and the second baseline was designed based on the Long Short-Term Mem- ory (LSTM) model. We use LSTM as a baseline because knolling can also be viewed as a sequence prediction problem where the arrangement of objects depends on their sequence. LSTMs have been extensively used for various sequence prediction tasks and have shown good performance. Thus, LSTMs serve as a more challenging baseline to benchmark the performance of our transformer-based model. Moreover, comparing our model with LSTM helps to highlight the benefits of using self-attention and auto-regression in the transformer for handling variable input and output sizes and multi-label problems. Just as we did with our model, we measured the L1 distance between the actual and predicted positions for each baseline model, with the results detailed to a fair evaluation, we in Table I. As a commitment have ensured that each model utilizes a similar amount of parameters: our model incorporates 87,458 parameters, the LSTM baseline uses 86,858 parameters, and the MLP base- line operates with 87,788 parameters. Our knolling model consistently outperforms the MLP and LSTM baselines in terms of the L1 error. This superiority of our model is evident in all parameters: mean L1 error, standard deviation, and minimum and maximum error. These results validate the effectiveness of our transformer-based model, which em- ploys self-attention and auto-regression in handling varying input sizes and multi-label problems in knolling tasks. They demonstrate that our model is not only a reliable solution but also outperforms traditional architectures, paving the way for more efficient knolling solutions. D. Transformer Performance across Dataset Sizes This experiment aimed to evaluate the performance of our knolling model across different scales of data. Four dataset sizes were selected for this study: 125k, 250k, 500k, and 1M. Each variant of the knolling model was trained inde- pendently until convergence. Following training, all models were evaluated using a consistent test dataset to maintain uniformity in the assessment. The test errors obtained for each dataset size are shown in TabII. The results highlight a consistent decline in error as the dataset size augments. This trend validates the widely accepted belief that transformers excel with the increase in data volume. E. Ablation Experiment on Pre-training Effectiveness To delve deeper into the efficacy of the pre-training process and its impact on the performance of our knolling model, we carried out an ablation study. This experiment was designed to discern the value added by the pre-training step in our model's pipeline. Dataset and Training: We used the most extensive dataset of 1M samples for this experiment to ensure the results were derived from a comprehensive data pool. Two distinct training methodologies were adopted. Direct Training: The model was trained directly on the target task without any pre-training. Pre-training + Fine-tuning: In this approach, the model was first pre-trained on an auxiliary task and subse- quently fine-tuned on the target knolling task, as described in the methodology section. The performance metrics obtained from the two training methods are presented in TabII. The model that using the pre-training and fine-tuning process outperformed the model trained without pre-training. TABLE II TEST ERROR VS DATASET SIZE 125K 250K 500K 1M 1M-Fine Mean 6.46E-04 5.81E-04 5.18E-04 4.29E-04 3.57E-04 Std 1.82E-03 1.81E-03 1.79E-03 1.61E-03 1.54E-03 Min 1.39E-15 0.00E+00 1.39E-15 0.00E+00 0.00E+00 Max 3.17E-02 3.21E-02 3.53E-02 3.49E-02 3.44E-02 V. CONCLUSIONS This research provides insights into a robot's ability to perform knolling tasks. However, several specific limitations are inherent to our approach: First, the current performance is mainly constrained by the capabilities of the robot arm hardware and the visual perception system. Second, our model uses an autoregressive approach, which may lead to the accumulation of errors. If initial predictions are off-mark, it can adversely affect subsequent predictions, potentially leading to inaccuracies. Besides, the current keypoint-based to objects with methodology might not generalize well intricate contours. We believe that our research contributes to the field of robotics, particularly in enhancing robot performance in household environments. By enabling robots to grasp the essence of knolling, we pave the way for more intelligent, adaptable machines capable of performing tasks in a way that aligns with human expectations of neatness and tidi- ness. While our current experiments have shown capabili- ties beyond a simple grid pattern with human preference, integrating semantic labels and employing segmented image representations for objects can further refine and elevate the capabilities of the knolling bot. Furthermore, our pipeline is modular and offers a flexible framework for future research and development. [19] H. Zhang and Q. Cao, "Detect in rgb, optimize in edge: Accurate 6d pose estimation for texture-less industrial parts," in 2019 International Conference on Robotics and Automation (ICRA), 2019, pp. 3486– 3492. [20] M. Fulton, J. Hong, M. J. Islam, and J. Sattar, "Robotic detection of marine litter using deep visual detection models," in 2019 international conference on robotics and automation (ICRA). IEEE, 2019, pp. 5752–5758. [21] F.-J. Chu, R. Xu, Z. Zhang, P. A. Vela, and M. Ghovanloo, "Hands- free assistive manipulator using augmented reality and tongue drive system," in 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), 2018, pp. 5463–5468. [22] A. Radford, K. Narasimhan, T. Salimans, I. Sutskever, et al., "Improv- ing language understanding by generative pre-training," 2018. [23] S. Khan, M. Naseer, M. Hayat, S. W. Zamir, F. S. Khan, and M. Shah, "Transformers in vision: A survey," ACM computing surveys (CSUR), vol. 54, no. 10s, pp. 1–41, 2022. [24] W. Liu, C. Paxton, T. Hermans, and D. Fox, "Structformer: Learning spatial structure for language-guided semantic rearrangement of novel objects," in 2022 International Conference on Robotics and Automa- tion (ICRA). IEEE, 2022, pp. 6322–6329. [25] I. Kapelyukh, V. Vosylius, and E. Johns, "Dall-e-bot: Introducing web- scale diffusion models to robotics," IEEE Robotics and Automation Letters, 2023. [26] Q. A. Wei, S. Ding, J. J. Park, R. Sajnani, A. Poulenard, S. Sridhar, and L. Guibas, "Lego-net: Learning regular rearrangements of objects in rooms," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2023, pp. 19 037–19 047. [27] W. Liu, T. Hermans, S. Chernova, and C. Paxton, "Structdiffusion: Object-centric diffusion for semantic rearrangement of novel objects," arXiv preprint arXiv:2211.04604, 2022. [28] H. Kim, Y. Ohmura, and Y. Kuniyoshi, "Transformer-based deep imitation learning for dual-arm robot manipulation," in 2021 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2021, pp. 8965–8972. [29] S. Dasari and A. Gupta, "Transformers for one-shot visual imitation," in Conference on Robot Learning. PMLR, 2021, pp. 2071–2084. [30] R. Jangir, N. Hansen, S. Ghosal, M. Jain, and X. Wang, "Look closer: Bridging egocentric and third-person views with transformers for robotic manipulation," IEEE Robotics and Automation Letters, vol. 7, no. 2, pp. 3046–3053, 2022. [31] Y. Zhu, A. Joshi, P. Stone, and Y. Zhu, "Viola: Object-centric imitation learning for vision-based robot manipulation," in Conference on Robot Learning. PMLR, 2023, pp. 1199–1210. [32] M. Shridhar, L. Manuelli, and D. Fox, "Perceiver-actor: A multi- task transformer for robotic manipulation," in Conference on Robot Learning. PMLR, 2023, pp. 785–799. [33] V. Jain, Y. Lin, E. Undersander, Y. Bisk, and A. Rai, "Transformers are adaptable task planners," in Conference on Robot Learning. PMLR, 2023, pp. 1011–1037. [34] J. Tremblay, A. Prakash, D. Acuna, M. Brophy, V. Jampani, C. Anil, T. To, E. Cameracci, S. Boochoon, and S. Birchfield, "Training deep networks with synthetic data: Bridging the reality gap by domain randomization," in Proceedings of the IEEE conference on computer vision and pattern recognition workshops, 2018, pp. 969–977. [35] N. Rahaman, A. Baratin, D. Arpit, F. Draxler, M. Lin, F. Hamprecht, Y. Bengio, and A. Courville, "On the spectral bias of neural networks," in International Conference on Machine Learning. PMLR, 2019, pp. 5301–5310. REFERENCES [1] G. A. Zachiotis, G. Andrikopoulos, R. Gornez, K. Nakamura, and G. Nikolakopoulos, "A survey on the application trends of home service robotics," in 2018 IEEE international conference on Robotics and Biomimetics (ROBIO). IEEE, 2018, pp. 1999–2006. [2] J. Kim, A. K. Mishra, R. Limosani, M. Scafuro, N. Cauli, J. Santos- Victor, B. Mazzolai, and F. Cavallo, "Control strategies for cleaning robots in domestic applications: A comprehensive review," Inter- national Journal of Advanced Robotic Systems, vol. 16, no. 4, p. 1729881419857432, 2019. [3] J. Zhong, C. Ling, A. Cangelosi, A. Lotfi, and X. Liu, "On the gap be- tween domestic robotic applications and computational intelligence," Electronics, vol. 10, no. 7, p. 793, 2021. [4] H. Nguyen and H. La, "Review of deep reinforcement learning for robot manipulation," in 2019 Third IEEE International Conference on Robotic Computing (IRC). IEEE, 2019, pp. 590–595. [5] J. Kober, J. A. Bagnell, and J. Peters, "Reinforcement learning in robotics: A survey," The International Journal of Robotics Research, vol. 32, no. 11, pp. 1238–1274, 2013. [6] B. Chen, Y. Hu, R. Kwiatkowski, S. Song, and H. Lipson, "Visual perspective taking for opponent behavior modeling," in 2021 IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2021, pp. 13 678–13 685. [7] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, "Attention is all you need," Advances in neural information processing systems, vol. 30, 2017. [8] A. Gillioz, J. Casas, E. Mugellini, and O. Abou Khaled, "Overview of the transformer-based models for nlp tasks," in 2020 15th Conference on Computer Science and Information Systems (FedCSIS). IEEE, 2020, pp. 179–183. [9] D. Reis, J. Kupec, J. Hong, and A. Daoudi, "Real-time flying object detection with yolov8," arXiv preprint arXiv:2305.09972, 2023. [10] L. Berscheid, P. Meissner, and T. Kr ̈oger, "Robot learning of shifting objects for grasping in cluttered environments," in 2019 IEEE/RSJ international conference on intelligent robots and systems (IROS). IEEE, 2019, pp. 612–618. [11] Y. Zhu, J. Wong, A. Mandlekar, R. Mart ́ın-Mart ́ın, A. Joshi, S. Nasiri- any, and Y. Zhu, "robosuite: A modular simulation framework and learning," arXiv preprint arXiv:2009.12293, benchmark for robot 2020. [12] D. Leidner, G. Bartels, W. Bejjani, A. Albu-Sch ̈affer, and M. Beetz, "Cognition-enabled robotic wiping: Representation, planning, execu- tion, and interpretation," Robotics and Autonomous Systems, vol. 114, pp. 199–216, 2019. [13] A. Kramberger, E. Shahriari, A. Gams, B. Nemec, A. Ude, and S. Haddadin, "Passivity based iterative learning of admittance-coupled dynamic movement primitives for interaction with changing environ- ments," in 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), 2018, pp. 6023–6028. [14] W. Amanhoud, M. Khoramshahi, M. Bonnesoeur, and A. Billard, "Force adaptation in contact tasks with dynamical systems," in 2020 IEEE International Conference on Robotics and Automation (ICRA), 2020, pp. 6841–6847. [15] A. X. Lee, C. M. Devin, Y. Zhou, T. Lampe, K. Bousmalis, J. T. Springenberg, A. Byravan, A. Abdolmaleki, N. Gileadi, D. Khosid, et al., "Beyond pick-and-place: Tackling robotic stacking of diverse shapes," in 5th Annual Conference on Robot Learning, 2021. [16] F. Furrer, M. Wermelinger, H. Yoshida, F. Gramazio, M. Kohler, R. Siegwart, and M. Hutter, "Autonomous robotic stone stacking with online next best object target pose planning," in 2017 IEEE International Conference on Robotics and Automation (ICRA), 2017, pp. 2350–2356. [17] G. Schoettler, A. Nair, J. A. Ojea, S. Levine, and E. Solowjow, "Meta- reinforcement learning for robotic industrial insertion tasks," in 2020 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2020, pp. 9728–9735. [18] A. Zeng, P. Florence, J. Tompson, S. Welker, J. Chien, M. Attarian, T. Armstrong, I. Krasin, D. Duong, V. Sindhwani, et al., "Transporter networks: Rearranging the visual world for robotic manipulation," in Conference on Robot Learning. PMLR, 2021, pp. 726–747.
http://arxiv.org/abs/2310.04565v1
"2023-10-06T20:11:27"
"2023-10-06T20:11:27"
Binary Quantification and Dataset Shift: An Experimental Investigation
Quantification is the supervised learning task that consists of training predictors of the class prevalence values of sets of unlabelled data, and is of special interest when the labelled data on which the predictor has been trained and the unlabelled data are not IID, i.e., suffer from dataset shift. To date, quantification methods have mostly been tested only on a special case of dataset shift, i.e., prior probability shift; the relationship between quantification and other types of dataset shift remains, by and large, unexplored. In this work we carry out an experimental analysis of how current quantification algorithms behave under different types of dataset shift, in order to identify limitations of current approaches and hopefully pave the way for the development of more broadly applicable methods. We do this by proposing a fine-grained taxonomy of types of dataset shift, by establishing protocols for the generation of datasets affected by these types of shift, and by testing existing quantification methods on the datasets thus generated. One finding that results from this investigation is that many existing quantification methods that had been found robust to prior probability shift are not necessarily robust to other types of dataset shift. A second finding is that no existing quantification method seems to be robust enough to dealing with all the types of dataset shift we simulate in our experiments. The code needed to reproduce all our experiments is publicly available at https://github.com/pglez82/quant_datasetshift.
[ "Pablo González", "Alejandro Moreo", "Fabrizio Sebastiani" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04565v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04565v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI" ]
Noname manuscript No. (will be inserted by the editor) Binary Quantification and Dataset Shift: An Experimental Investigation Pablo Gonz ́alez ⋅ Alejandro Moreo ⋅ Fabrizio Sebastiani 3 2 0 2 t c O 6 ] G L . s c [ 1 v 5 6 5 4 0 . 0 1 3 2 : v i X r a Received: October 2023 / Accepted: date Abstract Quantification is the supervised learning task that consists of train- ing predictors of the class prevalence values of sets of unlabelled data, and is of special interest when the labelled data on which the predictor has been trained and the unlabelled data are not IID, i.e., suffer from dataset shift. To date, quantification methods have mostly been tested only on a special case of dataset shift, i.e., prior probability shift; the relationship between quantifica- tion and other types of dataset shift remains, by and large, unexplored. In this work we carry out an experimental analysis of how current quantification algo- rithms behave under different types of dataset shift, in order to identify limita- tions of current approaches and hopefully pave the way for the development of more broadly applicable methods. We do this by proposing a fine-grained tax- onomy of types of dataset shift, by establishing protocols for the generation of datasets affected by these types of shift, and by testing existing quantification methods on the datasets thus generated. One finding that results from this in- vestigation is that many existing quantification methods that had been found robust to prior probability shift are not necessarily robust to other types of dataset shift. A second finding is that no existing quantification method seems to be robust enough to dealing with all the types of dataset shift we simulate in our experiments. The code needed to reproduce all our experiments is publicly available at https://github.com/pglez82/quant_datasetshift. Pablo Gonz ́alez Artificial Intelligence Center, University of Oviedo 33204 Gij ́on, Spain E-mail: gonzalezgpablo@uniovi.es Alejandro Moreo and Fabrizio Sebastiani Istituto di Scienza e Tecnologie dell'Informazione, Consiglio Nazionale delle Ricerche 56124 Pisa, Italy E-mail: alejandro.moreo@isti.cnr.it, fabrizio.sebastiani@isti.cnr.it 2 P. Gonz ́alez, A. Moreo, F. Sebastiani Keywords Quantification ⋅ Learning to Quantify ⋅ Supervised Prevalence Estimation ⋅ Dataset Shift ⋅ Covariate Shift ⋅ Prior Probability Shift ⋅ Concept Shift 1 Introduction Quantification (variously called learning to quantify, or class prior estimation, or class distribution estimation – see (Esuli et al., 2023; Gonz ́alez et al., 2017) for overviews) is a supervised learning task concerned with estimating the prevalence values (or relative frequencies, or prior probabilities) of the classes in a sample of unlabelled datapoints, using a predictive model (the quantifier ) trained on labelled datapoints. A straightforward solution to the quantification problem can be obtained by (i) using a classifier to issue label predictions for the unlabelled datapoints in the sample, (ii) counting how many datapoints have been attributed to each class, and (iii) reporting the relative frequencies. This method is typically known as Classify and Count (CC). However, unless the classifier is a perfect one, CC is known to deliver suboptimal solutions (Forman, 2005). One reason (but not the only one) is that CC tends to inherit the bias of the classifier; for example, in binary quantification problems (i.e., when there are only two mutually exclusive classes), if the classifier has a tendency to produce more (resp., fewer) false positives than false negatives, CC tends to overestimate (resp., underestimate) the prevalence of the positive class. Since the term "quantification" was coined by Forman (2005), quantifica- tion has come to be recognised as a task in its own right and is, by now, no longer considered as a mere by-product of classification. Quantification finds applications in many areas whose primary focus is the analysis of data at the aggregate level (rather at the level of the individual datapoint), such as market research (Esuli and Sebastiani, 2010), the social sciences (Hopkins and King, 2010), ecological modelling (Beijbom et al., 2015), and epidemiology (King and Lu, 2008), among many others. A common trait of all these applications is that all of them emerge from the need to monitor evolving class distributions, i.e., situations in which the class distribution of the unlabelled data may differ from the one of the training data. In other words, these situations are characterised by a type of dataset shift (Moreno-Torres et al., 2012; Qui ̃nonero-Candela et al., 2009), i.e., the phenomenon according to which, in a supervised learning context, the training data and the unlabelled data are not IID. Dataset shift comes in different flavours; the ones that have mostly been discussed in the literature are (i) prior probability shift, which has to do with changes in the class prevalence values; (ii) covariate shift, which concerns changes in the distribution of the covariates (i.e., features); and (iii) concept shift, which has to do with changes in the functional relationship between covariates and classes. We provide more formal definitions of dataset shift and its subtypes in the sections to come. Binary Quantification and Dataset Shift 3 Since quantification aims at estimating class prevalence, most experimental evaluations of quantification systems (see, e.g., (Barranquero et al., 2015; Bella et al., 2010; Esuli et al., 2018; Forman, 2008; Hassan et al., 2020; Milli et al., 2013; Moreo and Sebastiani, 2022; P ́erez-G ́allego et al., 2019; Schumacher et al., 2021)) have focused on situations characterised by prior probability shift, while the other two types of shift mentioned above have not received comparable attention. A question then naturally arises: How do existing quan- tification methods fare when confronted with types of dataset shift other than prior probability shift? This paper offers a systematic exploration of the performance of existing quantification methods under different types of dataset shift. To this aim we first propose a fine-grained taxonomy of dataset shift types; in particular, we pay special attention to the case of covariate shift, and identify variants of it (mostly having to do with additional changes in the priors) that we contend to be of special relevance in quantification endeavours, and that are under- studied. We then follow an empirical approach, devising specific experimental protocols for simulating all the types of dataset shift that we have identified, at various degrees of intensity and in a tightly controlled manner. Using the experimental setups generated by means of these protocols, we then test a number of existing quantification methods; here, the ultimate goal we pursue is to better understand the relative merits and limitations of existing quan- tification algorithms, to understand the conditions under which they tend to perform well, and to identify the situations in which they instead tend to generate unreliable predictions. The rest of this paper is organised as follows. In Section 2, we discuss previous work on establishing protocols to recreate different types of dataset shift, with special attention to work done in the quantification arena, and the (still scarce) work aimed at drawing connections between quantification and different types of dataset shift. In Section 3, we illustrate our notation and provide definitions of relevant concepts and of the quantification methods we use in this study. Section 4 goes on by introducing formal definitions of the types of shift we investigate. Section 5 illustrates the experimental protocols we propose for simulating the above types of shift, and discusses the results we have obtained by generating datasets via these protocols and using them for testing quantification systems. Section 6 wraps up, summarising our main findings and also pointing to interesting directions for future work. 2 Related Work Since quantification targets the estimation of class frequencies, it is fairly natu- ral that prior probability shift has been, in the related literature, the dominant type of dataset shift on which the robustness of quantification methods has been tested. Indeed, when Forman (2005) first proposed (along with novel quantification methods) to consider quantification as a task in its own right (and proposed "quantification" as the name for this task), he also proposed an 4 P. Gonz ́alez, A. Moreo, F. Sebastiani experimental protocol for testing quantification systems. This protocol con- sisted of generating a number of test samples, to be used for evaluating a quantification method, characterised by prior probability shift. Given a dataset consisting of a set L of labelled datapoints and a set U of unlabelled datapoints (both with binary labels), the protocol consists of drawing from U a number of test samples each characterised by a prevalence value (of the "positive class") lying on a predefined grid (say, G = [0.00, 0.05, . . . , 0.95, 1.00]). This protocol has come to be known as the "artificial prevalence protocol" (APP), and has since been at the heart of most empirical evaluations conducted in the quantifi- cation literature; see, e.g., (Barranquero et al., 2015; Bella et al., 2010; Moreo and Sebastiani, 2022; Moreo et al., 2021; Schumacher et al., 2021).1 Actually, the protocol proposed by Forman (2005) also simulates different prevalence values in the training set, drawing from L a number of training samples char- acterised by prevalence values lying on grid G. In such a way, by systematically varying both the training prevalence and the test prevalence of the positive class across the entire grid, one could subject a quantification method to the widest possible range of scenarios characterised by prior probability shift. Some empirical evaluations conducted nowadays only extract test samples from U , while others extract training samples from L and test samples from U . The APP has sometimes been criticised (see e.g., (Esuli and Sebastiani, 2015; Hassan et al., 2021)) for generating training-test sample pairs exhibiting "unrealistic" or "implausible" class prevalence values and/or degrees of prior probability shift. For instance, Esuli and Sebastiani (2015) and Gonz ́alez et al. (2019) indeed renounce to using the APP in favour of using datasets contain- ing a large amount of timestamped test datapoints, which allows splitting the test data into sizeable enough, temporally coherent chunks, in which the class prevalence values naturally fluctuate over time. However, this practice is rarely used in the literature, since it has to overcome at least three important obsta- cles: (i) the amount of test samples thus available is often too limited to allow statistically significant conclusions, (ii) datasets with the above characteristics are rare (and expensive to create, if not available), and (iii) the degree of shift which the quantifiers must confront is (as in (Esuli and Sebastiani, 2015)) sometimes limited. Conversely, the other two types of shift that we have mentioned above (covariate shift and concept shift) have received essentially no attention in the quantification literature. An exception to this includes the theoretical analysis performed in (Tasche, 2022, 2023), and the work on classifier calibration of Card and Smith (2018), both of them having to do with covariate shift. More in general, we are unaware of the existence of specific evaluation protocols for quantification, or quantification methods, that explicitly address covariate shift or concept shift. Some discussion of protocols for simulating different kinds of prior prob- ability shift can be found in the work of Lipton et al. (2018), who propose 1 Although the protocol was originally proposed for binary quantification problems only, an extension to the multiclass regime based on so-called Kraemer sampling was later pro- posed by Esuli et al. (2022). Binary Quantification and Dataset Shift 5 protocols for generating prior probability shift in multiclass datasets. They propose protocols for addressing "knock-out shift", which they define as the shift generated by subsampling a specific class out of the n classes; "tweak-one shift", that generates samples in which a specific class out of the n classes has a predefined prevalence value while the rest of the probability mass is evenly distributed across the remaining classes; and "Dirichlet shift", in which a dis- tribution P (Y ) across the classes is picked from a Dirichlet distribution with concentration parameter α, after which samples are drawn according to P (Y ). Other works (Alexandari et al., 2020; Azizzadenesheli et al., 2019; Rabanser et al., 2019) have come to subsequently adopt these protocols. We do not ex- plore "knock-out shift" nor "tweak-one shift" since these sample generation protocols are only meaningful in the multiclass regime, and since we here ad- dress the binary case only. The protocol we end up adopting (the APP) is similar in spirit to the "Dirichlet shift" protocol (i.e., both are designed to cover the entire spectrum of legitimate prevalence values), although the APP allows for a tighter control on the test prevalence values being generated. Using image datasets for their experiments, Rabanser et al. (2019) bring into play (and define protocols for) other types of shift having to do with covariate shift, such as "adversarial shift", in which a fraction of the unlabelled samples are adversarial samples (i.e., images that have been manipulated with the aim of confounding a neural model, by means of modifications that are imperceptible to the human eye); "image shift", in which the unlabelled images result from the application of a series of random transformations (rotation, translation, zoom-in); "Gaussian noise shift", in which Gaussian noise affects a fraction of the unlabelled images; and combinations of all these. We do not explore these types of shift since they are specific to the world of images and computer vision. Dataset shift has been widely studied in the field of classification in order to support the development of models robust to the presence of shift. In the machine learning literature this problem is also known as domain adaptation. For instance, the combination of covariate shift and prior probability shift has recently been studied by Chen et al. (2022), who focus on detecting the presence of shift in the data and on predicting classifier performance on non- IID (a.k.a. "out-of-distribution") unlabelled data. This and other similar works are mostly concerned with improving the performance of a classifier on non- IID unlabelled data (a concern that goes back at least to (Saerens et al., 2002; Vucetic and Obradovic, 2001), and that has given rise to works such as (Ala ́ız-Rodr ́ıguez et al., 2011; Bickel et al., 2009; Chan and Ng, 2006)); in these works, estimating class prevalence in non-IID unlabelled data is merely an intermediate step for calculating the class weights needed for adapting the classifier to these data, and not a primary concern in itself. As a final note, we should mention that, despite several efforts for unifying the terminology related to dataset shift (see (Moreno-Torres et al., 2012) for an example), this terminology is still somewhat confusing. For example, prior probability shift (Storkey, 2009) is sometimes called "distribution drift" (Moreo and Sebastiani, 2022), "class-distribution shift" (Beijbom et al., 2015), "class- 6 P. Gonz ́alez, A. Moreo, F. Sebastiani prior change" (du Plessis and Sugiyama, 2012; Iyer et al., 2014), "global drift" Hofer and Krempl (2012), "target shift" (Nguyen et al., 2015; Zhang et al., 2013), "label shift" (Alexandari et al., 2020; Azizzadenesheli et al., 2019; Lip- ton et al., 2018; Rabanser et al., 2019), or "prior shift" (ˇSipka et al., 2022). The terms "shift" and "drift" are often used interchangeably (in this paper we will stick to the former), although some authors (e.g., Souza et al. (2020)) establish a difference between "concept shift" and "concept drift"; in Section 4.3 we will precisely define what we mean by concept shift. Note also that, until recently, most works in the quantification literature hardly even mentioned (any type of) "shift" or "drift" (despite using an experimental protocol that recreated prior probability shift), certainly due to the fact that the awareness of dataset shift and the problems it entails has become widespread only in recent years. 3 Preliminaries 3.1 Notation and Definitions In this paper we restrict our attention to the case of binary quantification, and adopt the following notation. By x we indicate a datapoint drawn from a domain X . By y we indicate a class drawn from a set Y = {0, 1}, which we call the classification scheme (or codeframe), and by y we indicate the complement of y in Y. Without loss of generality, we assume 0 to represent the "negative" class and 1 to represent the "positive" class. By L we denote a collection of k k labelled datapoints {(xi, yi)} i=1, where xi ∈ X is a datapoint and yi ∈ Y is a class label, that we use for training purposes. By U we instead denote a collection {(x′ i whose label y′ i is unknown, that we typically use for testing purposes. We hereafter refer to L and U as "the training set" and "the test set", respectively. k′ i=1 of k′ unlabelled datapoints, i.e., datapoints x′ i, y′ i)} We use symbol σ to denote a sample, i.e., a non-empty set of (labelled or unlabelled) datapoints from X . We use pσ(y) to denote the (true) prevalence of class y in sample σ (i.e., the fraction of items in σ that belong to y), and we use ˆpq σ(y) to denote the estimate of pσ(y) as computed by a quantification method q; note that pσ(y) is just a shorthand of P (Y = y ∣ x ∈ σ), where P indicates probability and Y is a random variable that ranges on Y. Since in the binary case it holds that pσ(y) = 1−pσ(y), binary quantification reduces to estimating the prevalence of the positive class only. Throughout this paper we will simply write pσ instead of pσ(1), i.e., as a shortcut for the true prevalence of the positive class in sample σ; similarly, we will shorten ˆpσ(1) as ˆpσ. We define a binary quantifier as a function q ∶ 2X → [0, 1], i.e., one that acts as a predictor of the prevalence pσ of the positive class in sample σ. Quantifiers are generated by means of an inductive learning algorithm trained on L. We take a (binary) hard classifier to be a function h ∶ X → Y, i.e., a predictor of the class label of a datapoint x ∈ X which returns 1 if h predicts x to belong to the positive class and 0 otherwise. Classifier h is trained by means of an inductive learning algorithm that uses a set L of labelled datapoints, and Binary Quantification and Dataset Shift 7 usually returns crisp decisions by thresholding the output of an underlying real-valued decision function f whose internal parameters have been tuned to fit the training data. Likewise, we take a (binary) soft classifier to be a function s ∶ X → [0, 1], i.e., a function mapping a datapoint x into a posterior probability s(x) ≡ P (Y = 1∣X = x) and represents the probability that s subjectively attributes to the fact that x belongs to the positive class. Classifier s is either trained on L by a probabilistic inductive algorithm, or obtained by calibrating a (possibly non-probabilistic) classifier s′ also trained on L.2 We take an evaluation measure for binary quantification to be a real-valued function D ∶ [0, 1] × [0, 1] → R which measures the amount of discrepancy between the true distribution and the predicted distribution of Y in σ; higher values of D represent higher discrepancy, and the distributions are represented (since we are in the binary case) by the prevalence values of the positive class. In the quantification literature, these measures are typically divergences, i.e., functions that, given two distributions p′, p′′, satisfy (i) D(p′, p′′ ) ≥ 0, and (ii) D(p′, p′′ σ) we thus denote the divergence between the true class distribution in sample σ and the estimate of this distribution returned by binary quantifier q. ) = 0 if and only if p′ = p′′. By D(pσ, ˆpq 3.2 The IID Assumption, Dataset Shift, and Quantification One of the main reasons why we study quantification is the fact that most scenarios in which estimating class prevalence values via supervised learning is of interest, violate the IID assumption, i.e., the fundamental assumption (that most machine learning endeavours are based on) according to which the labelled datapoints used for training and the unlabelled datapoints we want to issue predictions for, are assumed to be drawn independently and identically from the same (unknown) distribution.3 If the IID assumption were not violated, the supervised class prevalence estimation problem would admit a trivial solution, consisting of returning, as the estimated prevalence ˆpq σ for any sample σ of unlabelled datapoints, the true prevalence pL that characterises 2 A binary soft classifier s is said to be well calibrated (Flach, 2017) for a given sample σ if, for every α ∈ [0, 1], it holds that ∣{(x, y) ∈ σ ∣ s(x) = α, y = 1}∣ ∣{(x, y) ∈ σ ∣ s(x) = α}∣ = α (1) Note that calibration is defined with respect to a sample σ, which means that a classifier cannot, in general, be well calibrated for two different samples (e.g., for L and U ) that are affected by prior probability shift. 3 For example, we might be interested in monitoring through time the degree of support for a certain politician by estimating the prevalence values of classes "Positive" and "Nega- tive" in tweets that express opinions about this politician (this is an instance of sentiment quantification (Moreo and Sebastiani, 2022)). The very fact that we want to monitor these prevalence values through time is an implicit assumption that these prevalence values may vary, i.e., may take values different from the prevalence values that these classes had in the training data. In other words, it is an implicit assumption that we may be in the presence of some form of dataset shift. 8 P. Gonz ́alez, A. Moreo, F. Sebastiani the training set, since both L and σ would be expected to display the same prevalence values. This "method" is called, in the quantification literature, the maximum likelihood prevalence estimator (MLPE), and is considered a trivial baseline that any genuine quantification system is expected to beat in situations characterised by dataset shift. We will thus assume the existence of two unknown joint probability distri- butions PL(X, Y ) and PU (X, Y ) such that PL(X, Y ) ≠ PU (X, Y ) (the dataset shift assumption). The ways in which the training distribution and the test distribution may differ, and the effect these differences can have on the per- formance of quantification systems, will be the main subject of the following sections. 3.3 Quantification Methods The six quantification methods that we use in the experiments of Section 5 are the following. Classify and Count (CC), already hinted at in the introduction, is the na ̈ıve quantification method, and the one that is used as a baseline that all genuine quantification methods are supposed to beat. Given a hard classifier h and a sample σ, CC is formally defined as ˆpCC σ = 1 ∣σ∣ ∑ x∈σ h(x) (2) In other words, the prevalence of the positive class is estimated by classifying all the unlabelled datapoints, counting the number of datapoints that have been assigned to the positive class, and dividing the result by the total number of datapoints in the sample. The Adjusted Classify and Count (ACC) method (see (Forman, 2008)) attempts to correct the estimates returned by CC by relying on the law of total probability, according to which, for any x ∈ X , it holds that P (h(x) = 1) = P (h(x) = 1∣Y = 1) ⋅ p + P (h(x) = 1∣Y = 0) ⋅ (1 − p) (3) which can be more conveniently rewritten as ˆpCC σ = tprh ⋅pσ + fprh ⋅(1 − pσ) (4) where tprh and fprh are the true positive rate and the false positive rate, respectively, that h has on samples of unseen datapoints. From Equation 4 we can obtain pσ = ˆpCC σ − fprh tprh − fprh (5) The values of tprh and fprh are unknown, but their estimates ˆtprh and ˆfprh can be obtained by performing k-fold cross-validation on the training set L, or by Binary Quantification and Dataset Shift 9 using a held-out validation set. The ACC method thus consists of estimating pσ by plugging the estimates of tpr and fpr into Equation 5, to obtain = ˆfprh ˆfprh ˆpACC σ ˆpCC σ − ˆtprh − While CC and ACC rely on the crisp counts returned by a hard classifier h, it is possible to define variants of them that use instead the expected counts com- puted from the posterior probabilities returned by a calibrated probabilistic classifier s (Bella et al., 2010). This is the core idea behind Probabilistic Clas- sify and Count (PCC) and Probabilistic Adjusted Classify and Count (PACC). PCC is defined as (6) while PACC is defined as ˆpPCC σ = = 1 ∣σ∣ 1 ∣σ∣ ∑ x∈σ ∑ x∈σ s(x) P (Y = 1∣x) ˆpPACC σ = ˆfprs ˆpPCC − σ ˆfprs ˆtprs − (7) (8) Equation 8 is identical to Equation 6, but for the fact that the estimate ˆpCC is replaced with the estimate ˆpPCC , and for the fact that the true positive rate and the false positive rate of the probabilistic classifier s (i.e., the rates computed as expectations using the posterior probabilities) are used in place of their crisp counterparts. σ σ Distribution y-Similarity (DyS) (Maletzke et al., 2019) is instead a gener- alisation of the HDy quantification method of Gonz ́alez-Castro et al. (2013). HDy is a probabilistic binary quantification method that views quantifica- tion as the problem of minimising the divergence (measured in terms of the Hellinger Distance, from which the name of the method derives) between two distributions of posterior probabilities returned by a soft classifier s, one com- ing from the unlabelled examples and the other coming from a validation set. HDy looks for the mixture parameter α (since we are considering a mixture of two distributions, one of examples of the positive class and one of examples of the negative class) that best fits the validation distribution to the unlabelled distribution, and returns α as the estimated prevalence of the positive class. Here, robustness to distribution shift is achieved by the analysis of the dis- tribution of the posterior probabilities in the unlabelled set, that reveals how conditions have changed with respect to the training data. DyS generalises HDy by viewing the divergence function to be used as a parameter. A further, very popular aggregative quantification method is the one pro- posed by Saerens et al. (2002) and often called SLD, from the names of its proposers. SLD was the best performer in a recent data challenge devoted to quantification (Esuli et al., 2022), and consists of training a (calibrated) soft classifier and then using expectation maximisation (Dempster et al., 1977) (i) 10 P. Gonz ́alez, A. Moreo, F. Sebastiani to tune the posterior probabilities that the classifier returns, and (ii) to re- estimate the prevalence of the positive class in the unlabelled set. Steps (i) and (ii) are carried out in an iterative, mutually recursive way, until convergence (when the estimated prior gets fairly close to the mean of the recalibrated posteriors). 4 Types of Dataset Shift Any joint probability distribution P (X, Y ) can be factorised, alternatively and equivalently, as: – P (X, Y ) = P (X∣Y )P (Y ), in which the marginal distribution P (Y ) is the distribution of the class labels, and the conditional distribution P (X∣Y ) is the class-conditional distribution of the covariates. This factorization is convenient in anti-causal learning (i.e., when predicting causes from effects) (Sch ̈olkopf et al., 2012), i.e., in problems of type Y → X (Fawcett and Flach, 2005). – P (X, Y ) = P (Y ∣X)P (X), in which the marginal distribution P (X) is the distribution of the covariates and the conditional distribution P (Y ∣X) is the distribution of the labels conditional on the covariates. This factor- ization is convenient in causal learning (i.e., when predicting effects from causes) (Sch ̈olkopf et al., 2012), i.e., in problems of type X → Y (Fawcett and Flach, 2005). Which of these four ingredients (i.e., P (X), P (Y ), P (X∣Y ), P (Y ∣X)) change or remain the same across L and U , gives rise to different types of shift, as discussed in (Moreno-Torres et al., 2012; Storkey, 2009). In this section we turn to describing the types of shift that we consider in this study. To this aim, also recalling that the related terminology is sometimes confusing in this respect (as also noticed by Moreno-Torres et al. (2012)), we clearly define each type of shift that we consider. When training a model, using our labelled data, to issue predictions about unlabelled data, we expect some relevant general conditions to be invariant across the training distribution and the unlabelled distribution, since otherwise the problem would be unlearnable. In Table 1, we list the three main types of dataset shift that have been discussed in the literature. For each such type, we indicate which distributions are assumed (according to general consensus in the field) to vary across L and U , and which others are assumed to remain constant. In the following sections, we will thoroughly discuss the relationships between these three types of shift and quantification. It is immediate to note from Table 1 that, for any given type of shift, there are some distributions (corresponding to the blank cells in the table – e.g., P (X) for prior probability shift) for which it is not specified if they change or not across L and U ; indeed, concerning what happens in these cases, the literature is often silent. In the next sections, we will try to fill these gaps. We will identify applicatively interesting subtypes of dataset shift based on Binary Quantification and Dataset Shift 11 Prior probability shift Covariate shift Concept shift P (X) ≠ P (Y ) ≠ P (X∣Y ) = ≠ P (Y ∣X) = ≠ Section §4.1 §4.2 §4.3 Table 1 Main types of dataset shift discussed in the literature. For the type of dataset shift on the row, symbol "≠" indicates that the distribution on the column is assumed to change across L and U , while symbol = indicates that the distribution is assumed to remain invariant. The last column indicates the section of the present paper where this type of shift is discussed in detail. different ways to fill the blank cells of Table 1, and will propose experimental protocols that recreate them in order for quantification systems to be tested under those conditions. 4.1 Prior Probability Shift Prior probability shift (see Figure 1 for a graphical example) describes a sit- uation in which (a) there is a change in the distribution P (Y ) of the class labels (i.e., PL(Y ) ≠ PU (Y )) while (b) the class-conditional distribution of the covariates remains constant (i.e., PL(X∣Y ) = PU (X∣Y )). In this type of shift, no further assumption is usually made as to whether the distribution P (X) of the covariates and the conditional distribution P (Y ∣X) change or not across L and U . Notwithstanding this, it is reasonable to think that the change in P (Y ) indeed causes a variation in P (X), i.e., that PL(X) /= PU (X); if this were not the case, the class-conditional distributions P (X∣Y = 1) and P (X∣Y = 0) would be indistinguishable, i.e., the problem would not be learnable. We will thus assume that prior probability shift does indeed imply a change in P (X) across L and U . The following is an example of this scenario. Example 1 Assume our application is one of handwritten digit recognition. Here, the classes are all the possible types of digits and the covariates are features of the handwritten realizations of these digits. Assume our training data are (labelled) handwritten digits in the decimal system (digits from 0 to 9) while our unlabelled data are handwritten digits in the binary system (0 or 1); assume also that all other properties of the data (e.g., authors of these handwritings, etc.) are the same as in the training data. In this scenario, it is the case that PL(Y ) ≠ PU (Y ) (since, e.g., the prevalence values in U of the digits from 2 to 9 are all equal to 0, unlike in L), and it is the case that PL(X∣Y ) = PU (X∣Y ) (since the 0's and 1's in the unlabelled data look the same as the 0's and 1's in the training data). Therefore, this is an example of prior probability shift. Note that it is also the case that PL(X) /= PU (X), since in PU (X) the values of the covariates are just those typical of 0's and 1's, unlike in PL(Y ), and it is also the case that PL(Y ∣X) = PU (Y ∣X), since nothing in the functional relationship between X and Y has changed. ⊓⊔ Concerning the issue of whether, in prior probability shift, the posterior dis- tribution P (Y ∣X) is invariant or not across L and U , it seems, at first glance, 12 P. Gonz ́alez, A. Moreo, F. Sebastiani Fig. 1 Example of prior probability shift generated with synthetic data using a normal distribution for each class. Scenario A (1st row): original data distribution, in which the positive class (orange) and the negative class (blue) have the same prevalence, i.e., pA = 0.5. Scenario B (2nd row): with respect to Scenario A there is a shift in the prevalence such that pB = 0.1. Dashed lines represent linear hypotheses learnt from the corresponding empirical distributions. Note that, although the positive class and the negative class may have not changed in meaning between A and B, i.e., PA(Y ∣X) = PB(Y ∣X), the posteriors we would obtain by calibrating two soft classifiers trained from the two empirical distributions would likely differ. Note also that PA(X) ≠ PB(X) (2nd column) but PA(X∣Y ) = PB(X∣Y ) (3rd column). sensible to assume that it indeed is, i.e., PL(Y ∣X) = PU (Y ∣X), since there is nothing in prior probability shift that implies a change in the functional relationship between X and Y (in the binary case: in what being a member of the positive class or of the negative class actually means). However, it turns out that a change in the priors has an impact on the a posteriori distribu- tion of the response variable Y , i.e., that PL(Y ∣X) ≠ PU (Y ∣X). This is indeed the reason why the posterior probabilities issued by a probabilistic classifier s (which has been trained and calibrated for the training distribution) would need to be recalibrated for the target distribution before attempting to esti- 1 ∣U ∣ ∑x∈U s(x). This is exactly the rationale behind the SLD mate PU (Y ) as method proposed by Saerens et al. (2002). Following this assumption, prior probability shift is defined as in Row 1 of Table 2. Prior probability shift is the type of shift which quantification methods have mostly been tested on, and the invariance assumption PL(X∣Y ) = PU (X∣Y ) that is made in prior probability shift indeed guarantees that a number of quantification methods work well in these scenarios. In order to show this, let us take ACC as an example. The correction implemented in Equation 6 does not attempt to counter prior probability shift, but attempts to counter classi- PA=0.5RealizationsP(X)P(X|Y)PB=0.1 Binary Quantification and Dataset Shift 13 fier bias (indeed, note that this correction is meaningful even in the absence of prior probability shift). This adjustment relies on Equation 4, which depends on two quantities, the tpr and the fpr of classifier h, that must be estimated on the training data L. Since h(x) is the same for L and U , the fact that PL(X∣Y ) = PU (X∣Y ) (which is assumed to hold under probability shift) im- plies that ˆtprh = tprh and ˆfprh = fprh. In other words, under prior probability shift ACC works well, since the assumption that the class-conditional distri- bution P (X∣Y ) is invariant across L and U guarantees that our estimates of tpr and fpr are good estimates. Similar considerations apply to different quantification methods as well. Prior probability shift has been widely studied in the quantification litera- ture, both from a theoretical point of view (Fernandes Vaz et al., 2019; Tasche, 2017) and from an empirical point of view (Schumacher et al., 2021). Indeed, note that the artificial prevalence protocol (APP – see Section 2), on which most experimentation of quantification systems has been based, does nothing else than generate a set of samples characterised by prior probability shift with respect to the set from which they have been extracted; the APP recreates the PL(Y ) ≠ PU (Y ) condition by subsampling one of the two classes, and recre- ates the PL(X∣Y ) = PU (X∣Y ) condition by performing this subsampling in a random fashion. Most of the quantification literature is concerned with ways of devising robust estimators of class prevalence values in the presence of prior probabil- ity shift. Tasche (2017) proves that, when PL(Y ) ≠ PU (Y ) and PL(X∣Y ) = PU (X∣Y ) (i.e., when we are in the presence of prior probability shift) the method ACC is Fisher-consistent, i.e., the error of ACC tends to zero when the size of the sample increases. Unfortunately, in practice, the condition of an unchanging P (X∣Y ) is difficult to fulfil or verify. At this point, it may be worth stressing that not every change in P (Y ) can be considered an instance of prior probability shift. Indeed, in Section 4.2 we present different cases of shift in the priors that are not instances of prior prob- ability shift, and that we deem of particular interest for realistic applications of quantification. 4.2 Covariate Shift Covariate shift (see Figure 3 for a graphical example) describes a situation in which (a) there is a change in the distribution P (X) of the covariates (i.e., PL(X) ≠ PU (X)), while (b) the distribution of the classes conditional on the covariates remains constant (i.e., PL(Y ∣X) = PU (Y ∣X)). In this type of shift, no further assumption is usually made as to whether the distribution P (Y ) of the classes and the class-conditional distribution P (X∣Y ) change across L and U . In this paper, we are going to assume that also a change in the class- conditional distribution takes place, i.e., PL(X∣Y ) ≠ PU (X∣Y ). The rationale of this choice is that, without this assumption, there would be a possible 14 P. Gonz ́alez, A. Moreo, F. Sebastiani Fig. 2 Possible overlap between the notions of prior probability shift and covariate shift, unless we assume that PL(X∣Y ) ≠ PU (X∣Y ) in covariate shift. overlap between the notion of prior probability shift and the notion of covariate shift. To see why, imagine a situation in which the positive and the negative examples are numerical univariate data each following a uniform distribution U(a, b) and U(c, d), with different parameters a < b < c < d. A change in the priors (i.e., PL(Y ) ≠ PU (Y )) would not cause any modification in the class-conditional distribution (i.e., PL(X∣Y ) = PU (X∣Y ) would hold). Thus, by definition, this would squarely count as an example of prior probability shift, since these are the same conditions listed in Row 1 of Table 2. However, at the same time, the distribution of the covariates has also changed (i.e., PL(X) ≠ PU (X)), since P (X) = U(a, b)P (Y = 1) + U(c, d)P (Y = 0) and since the priors have changed, with the posterior distribution P (Y ∣X) remaining stable across L and U . Thus, this would also count as an example of covariate shift; see Figure 2 for a graphical explanation. For this reason, and for the sake of clarity in the exposition, in this work we will break the ambiguity by assuming that covariate shift implies that P (X∣Y ) is not invariant across L and U . As a final observation, note that the conditions of covariate shift are incompatible with a situation in which both P (Y ) and P (X∣Y ) remain invariant. The reason is that P (X) is assumed to change under the covariate shift assumptions, but, since P (X) = P (X∣Y = 1)P (Y = 1)+P (X∣Y = 0)P (Y = 0), the only way in which this condition can hold true comes down to assuming either a change in P (Y ) or in P (X∣Y ). We will further distinguish between two types of covariate shift, i.e., (i) global covariate shift, in which the changes in the covariates occur globally, i.e., affect the entire population, and (ii) local covariate shift, in which the changes in the covariates occur locally, i.e., only affect certain subregions of the entire population. These two types of covariate shift will be the subject of Sections 4.2.1 and 4.2.2, respectively. abcd0.00.20.40.60.81.0abcd Binary Quantification and Dataset Shift 15 4.2.1 Global Covariate Shift Global covariate shift occurs when there is an overall change in the representa- tion function. We will study two variants of it that differ in terms of whether P (Y ) is invariant or not across L and U : global pure covariate shift, in which PL(Y ) = PU (Y ), and global mixed covariate shift, in which PL(Y ) ≠ PU (Y ) (the name "mixed" of course refers to the fact that there is a change in the dis- tribution of the covariates and in the distribution of the labels). Both scenarios are interesting to test quantification methods on, but the latter is probably even more interesting, since changes in the priors are something that quantifi- cation methods are expected to be robust to. Global pure covariate shift might occur when, for example, a sensor (in charge of generating the covariates) experiences a change (e.g., a partial dam- age, or a change in the lighting conditions for a camera); in this case, the prevalence values of the classes of interest do not change, but the measure- ments (covariates) might have been affected.4 Global mixed covariate shift might occur when, for example, a quantifier is trained to monitor the proportion of positive opinions on a certain politician on Twitter on a daily basis and, after the quantifier has been deployed to production, there is a change in Twitter's policy that allows for longer tweets.5 In this case, there is a variation in P (X), since longer tweets become more likely; there is variation in P (X∣Y ), since there will likely be longer positive tweets and longer negative tweets; P (Y ∣X) will remain constant, since a change in the length of tweets does not make positive comments more likely or less likely; and P (Y ) can change too (because opinions on politicians do change in time), although not as a result of the change in tweet length. By taking into account the underlying conditions of pure covariate shift, it seems pretty clear that PCC (see Section 3.3) would represent the best possible choice. The reason is that PCC computes the estimate of the class prevalence values by relying on the posterior probabilities returned by a soft classifier s (see Equation 7). Inasmuch as these posterior probabilities are reliable enough (i.e., when the soft classifier is well calibrated (Card and Smith, 2018)), the class prevalence values would be well estimated without further manipulations (i.e., there is no need to adjust for possible changes in the priors since, in the pure version, we assume P (Y ) has not changed); see Figure 3, 2nd row. However, in practice, the posterior probabilities returned by s might not align well with the underlying concept of the positive class (the soft classifier s might not be well calibrated for the unlabelled distribution). This might be due to several reasons, but a relevant possibility is due to the inability of the learning device to find good parameters for the classifier. This might happen whenever the hypothesis (i.e., the soft classifier s) learnt by means of an inductive learning method (e.g., logistic regression) comes from an empirical distribution in which certain regions of the input space were insufficiently 4 This example is what Kull and Flach (2014) called covariate observation shift. 5 This actually happened in 2017, when Twitter raised the maximum allowed size of tweets from 140 to 280 characters. 16 P. Gonz ́alez, A. Moreo, F. Sebastiani Fig. 3 Example of global pure covariate shift generated with synthetic data using a normal distribution for each cluster. Situation (a) (1st row): original data distribution. Each class consists on two clusters of data (for example positive or negative opinions of two different categories: Electronics and Books). Situation (b) (2nd row): there is a shift in the number of opinions of one category, that affects both classes. P (X) changes (see 2nd column) but P (Y ∣X) remains invariant. Situation C (3rd row), P (X) changes abruptly, affecting the posterior probabilities s(x) that a soft classifier, trained via induction on this scenario, would issue. represented during training, and have later become more prevalent during test as a result of a change in P (X); see Figure 2, 3rd row. This situation is certainly problematic, and would lead to a deterioration in performance of most aggregative quantifiers (including PCC). An in-depth theoretical analysis of the implications of pure covariate shift is offered by Tasche (2022), in which the author concludes that in order for PCC to prove resilient to covariate shift, the test distribution should be absolutely continuous with respect to the training distribution. This assumption also restricts the amount of divergence PA=0.5RealizationsP(X)P(X|Y)PB=0.5PC=0.5 Binary Quantification and Dataset Shift 17 between training and test samples distributions. However, these are theoretical considerations that are hard (if not impossible) to verify in practice. 4.2.2 Local Covariate Shift Consider a binary problem in which the positive class is a mixture of two (differently parameterised) Gaussians N1 and N2, i.e., that P (X∣Y = 1) = αN1 + (1 − α)N2. Assume there are analogous Gaussians N3 and N4 governing the distribution of negatives; see Figure 4. Assume now that there is a change (say, an increase) in the prevalence of datapoints from N1 leading to an overall change in the priors P (Y ). Note that this also implies an overall change in P (X). There is also a change in P (X∣Y = 1) (therefore, in P (X∣Y )) since the parameter α of the mixture has changed (it is now more likely to find positive examples from N1). However, the change in the covariates is asymmetric, i.e., P (X∣Y = 0) has not changed. Situations like this naturally occur in real scenarios of interest for quantifi- cation. For example, in ecological modelling, researchers might be interested in estimating the prevalence of, e.g., different species of plankton in the sea. To do so, they analyse pictures of water samples taken by an automatic optical device, identify individual examplars of plankton, and estimate the prevalence of the different species via a quantifier (Gonz ́alez et al., 2019). However, these plankton species are typically grouped, because of their high number, into coarse-grained superclasses (i.e., parent nodes from a taxonomy of classes), which means that no prevalence estimation for the subclasss is attempted. An increase in the prevalence value of one of the (super-)classes is often the consequence of an increase in the prevalence value of only one of its (hidden) subclasses. A similar example may be found in seabed cover mapping for coral reef monitoring (Beijbom et al., 2015); here, ecologists are interested in quan- tifying the presence of different species in images, often grouping the coral species and algae species into coarser-grained classes. In contrast to global covariate shift, local covariate shift does not occur due to a variation in the feature representation function (e.g., an alteration of the device in charge of taking measurements, which would impact on the covariates) but due to changes in the priors of (sub-)classes that remain hidden. The most important implication for quantification concerns the fact that this shift would reduce to prior probability shift if the subclasses (the original species in our examples) were observed in place of the superclasses.6 We will only consider the case in which P (Y ) changes, since it is hard to think of any realistic scenario for asymmetric covariate shift in which the class prevalence values remain unaltered. Note also that, in extreme cases, an abrupt change in P (Y ) can end up compromising the condition PL(Y ∣X) = PU (Y ∣X), for the same reasons why P (Y ∣X) is altered in prior probability shift. However, 6 Technically speaking, any distribution can be expressed as a (potentially infinite) mix- ture of Gaussians; thus, in theory, one could always reduce the problem to prior probability shift. In our definition, however, we assume the existence of a limited set of real subpopu- lations with unobserved labels, and not of an infinite such set. 18 P. Gonz ́alez, A. Moreo, F. Sebastiani Fig. 4 Example of local covariate shift generated with synthetic data using a normal distri- bution for each cluster. Situation (a) (1st row): original data distribution with two positive (orange) Gaussians N1, N2 and two negative (blue) Gaussians N3, N4. Situation (b) (2nd row): the prevalence of N1 grows. under mild conditions, we can assume P (Y ∣X) does not change, or does not change significantly. 4.3 Concept Shift Concept shift arises when the boundaries of the classes change, i.e., when the underlying concepts of interest change across the training and the testing conditions. Concept shift is characterised by a change in the class-conditional distribution PL(X∣Y ) ≠ PU (X∣Y ), as well as a change in the posterior dis- tribution PL(Y ∣X) ≠ PU (Y ∣X). Another way of saying this is that there is a change in the functional relationship between the covariates and the class labels; see Figure 5. Figure 5 depicts a situation in which each of the two classes (say, documents relevant and non relevant, respectively, to a certain user information need) subsumes two subclasses, and one of the subclasses "switches class", i.e., the documents contained in the subclass were once considered relevant to the information need and are now not relevant any more. Yet another example along these lines could be due to a change in the sensitivity of a response variable. So, for example, a change in the threshold above which the value of a continuous response variable indicates a positive example, is a change in the concept of "being positive", which implies (i) a change in P (Y ∣X), since some among the positive examples have now become negative, (ii) a change PA=0.5RealizationsP(X)P(X|Y)PB=0.75 Binary Quantification and Dataset Shift 19 Prior probability shift Global pure covariate shift Global mixed covariate shift Local covariate shift Concept shift P (X) ≠ ≠ ≠ ≠ = P (Y ) ≠ = ≠ ≠ ≠ P (X∣Y ) = ≠ ≠ ≠ ≠ P (Y ∣X) ≠ = = =∗ ≠ Definition §4.1 §4.2.1 §4.2.1 §4.2.2 §4.3 Experiments §5.3 §5.4 §5.4 §5.5 §5.6 Table 2 The types of shift we consider. Greyed-out cells indicate assumptions we make (and that we discuss and justify in Section 4). Symbol * indicates a condition that can get compromised in extreme situations. in P (X∣Y ), since the positive and negative classes are inevitably distributed differently, and (iii) even a change in P (Y ), since the higher the threshold, the fewer the positive examples; however, the above does not imply any change in the marginal distribution P (X). There are other examples of concept shift which may, instead, lead to a change in P (X) as well. Take, for example, the case of epidemiology (one of the quintessential applications of quantification) in which the spread of a disease (e.g., by a viral infection) is now manifested in the population by means of different symptoms (the covariates) due to a change in the pathogenic source (e.g., a mutation). In this paper, though, we will only be considering instances of concept shift in which the marginal distribution P (X) does not change, since otherwise none of the four distributions of interest (P (X), P (Y ), P (X∣Y ), P (Y ∣X)) would be invariant across L and U , which would make the problem essentially unlearnable. Needless to say, concept shift represents the hardest type of shift for any quantification system (and, more in general, for any inductive inference model), since changes in the concept being modelled are external to the learning proce- dure, and since there is no possibility of behaving robustly to arbitrary changes in the functional relationship between the covariates and the labels. Attempts to tackle concept shift should inevitably entail a later phase of learning (as in continuous learning) in which the model is informed, possibly by means of new labelled examples, of the changes in the functional relationship between co- variates and classes. To date, we are unaware of the existence of quantification methods devised to counter concept shift. 4.4 Recapitulation In light of the considerations above, in Table 2 we present the specific types of shift that we consider in this paper. Concretely, this comes down to exploring plausible ways of filling out the blank cells of Table 1, which are indicated in grey in Table 2. 5 Experiments In this section we describe experiments that we have carried out in which we simulate the different types of dataset shift described in the previous sections. 20 P. Gonz ́alez, A. Moreo, F. Sebastiani Fig. 5 Example of concept shift generated with synthetic data using a normal distribution for each cluster. Situation (a) (1st row): original data distribution. Situation (b) (2nd row): the concept "negative" (blue) has changed in a way that it now encompasses one of the originally "positive" (orange) clusters, thus implying a change in P (X∣Y ) and in P (Y ∣X) but not in P (X) (2nd column). For simplicity, we have simulated all these types of shift by using the same base datasets, which we describe in the following section. 5.1 Datasets We extract the datasets we use for the experiments from a large crawl of 233.1M Amazon product reviews made available by McAuley et al. (2015);7 we use different datasets for simulating different types of shift. In order to extract these datasets from this crawl we first remove (a) all product reviews shorter than 200 characters and (b) all product reviews that have not been recognised as "useful" by any users. We concentrate our attention on two mer- chandise categories, Books and Electronics, since these are the two most populated categories in the corpus; in the next sections these two categories will sometimes be referred to as category A and category B. Every review comes with a (true) label, consisting of the number of stars (according to a "5-star rating", with 1 star standing for "poor" and 5 stars standing for "excellent") that the author herself has attributed to the product being reviewed. Note that the classes are ordered, and thus we can define Y⋆ = {s1, s2, s3, s4, s5}, with si meaning "i stars", and s1 ≺ s2 ≺ s3 ≺ s4 ≺ s5. Since we deal with binary quantification, we exploit this order to generate, at desired 7 http://jmcauley.ucsd.edu/data/amazon/links.html PA=0.5RealizationsP(X)P(X|Y)PB=0.25 Binary Quantification and Dataset Shift 21 instances ★ ☆ ☆ ☆ ☆ ★ ★ ☆ ☆ ☆ ★ ★ ★ ☆ ☆ ★ ★ ★ ★ ☆ ★ ★ ★ ★ ★ Books Electronics 7,813,813 1,889,965 0.093 0.193 0.071 0.079 0.094 0.093 0.160 0.178 0.582 0.457 Table 3 Dataset information for categories Books and Electronics, along with the preva- lence for each different star rating. "cut points" (i.e., thresholds below which a review is considered negative and above which is considered positive), binary versions of the dataset. We thus define the function "binarise dataset", that takes a dataset labelled according to Y⋆ and a cut point c, and returns a new version of the dataset labelled according to a binary codeframe Y = {0, 1}; here, every labelled datapoint (x, si), with si ∈ Y⋆, is converted into a datapoint (x, y), with y ∈ Y, such that y = 1 (the positive class) if i > c, or y = 0 (the negative class) if i < c; note that we filter out datapoints for which i = c. In the cases in which we want to retain all datapoints labelled with all possible numbers of stars, we simply specify c as a real value intermediate between two integers (e.g., c = 2.5). 5.2 General Experimental Setup In all the experiments carried out in this study we fix the size of the training set to 5,000 and the size of each test sample to 500. For a given experiment we evaluate all quantification methods with the same test samples, but different experiments may involve different samples depending on the type of shift be- ing simulated. We run different experiments, each targeting a specific type of dataset shift; within each experiment we simulate the presence, in a systematic and controlled manner, of different degrees of shift. When testing with different degrees of a given type of shift, for every such degree we randomly generate 50 test samples. In order to account for stochastic fluctuations in the results due to the random selection of a particular training set, we repeat each experiment 10 times. We carry out all the experiments by using the QuaPy open-source quantification library (Moreo et al., 2021).8 All the code for reproducing our experiments is available from a dedicated GitHub repository.9 In order to turn raw documents into vectors, as the features we use tfidf- weighted words; we compute idf independently for each experiment by only taking into account the 5,000 training documents selected for that experiment. We only retain the words appearing at least 3 times in the training set, meaning that the number of different words (hence, the number of dimensions in the vector space) can vary across experiments. As the evaluation measure we use absolute error (AE), since it is one of the most satisfactory (see (Sebastiani, 2020) for a discussion) and frequently used measures in quantification experiments, and since it is very easily interpretable. 8 https://github.com/HLT-ISTI/QuaPy 9 https://github.com/pglez82/quant_datasetshift 22 P. Gonz ́alez, A. Moreo, F. Sebastiani In the binary case, AE is defined as AE(pσ, ˆpσ) = ∣pσ − ˆpσ∣ (9) For each experiment we report the mean absolute error (MAE), where the mean is computed across all the samples with the same degree of shift and all the repetitions thereof. We perform statistical significance tests at different confidence levels in order to check for the differences in performance between the best method (highlighted in boldface in all tables) and all other competing methods. All methods whose scores are not statistically significantly different from the best one, according to a Wilcoxon signed-rank test on paired samples, are marked with a special symbol. We use superscript † to indicate that 0.001 < p-value < 0.05 (loosely speaking, that the scores are "somewhat similar"), while superscript ‡ indicates that 0.05 ≤ p-value (loosely speaking, that the scores are "very similar"); the absence of any such symbol thus indicates that p-value ≤ 0.001 (loosely speaking, that the scores are "fairly different"). All the quantification methods considered in this study are of the aggrega- tive type and are described in Section 3.3. In addition to these methods, we had initially also considered the Sample Mean Matching (SMM) method (Hassan et al., 2020), but we removed this method from the experiments as we found it to be equivalent to the PACC method (we give a formal proof of this equiv- alence in Appendix A). For the sake of fairness, underlying all quantification methods we use the same type of classifier. (All the quantification methods we use are aggrega- tive, so all of them use an underlying classifier.) As our classifier of choice we use logistic regression, since it is a well-known classifier which also delivers "soft" predictions and is known to deliver reasonably well-calibrated posterior probabilities (these two characteristics are required for PCC, PACC, DyS, and SLD). We optimise the hyperparameters of the quantifier following Moreo and Sebastiani (2021), i.e., minimising a quantification-oriented loss function (here: MAE) via a quantification-oriented parameter optimisation protocol; we explore the values C ∈ {0.1, 1, 10, 100, 100} (where C is the inverse of the regularization strength), and the values class weight ∈ {Balanced, None} (where class weight indicates the relative importance of each class), via grid search. We evaluate each configuration of hyperparameters in terms of MAE over artificially generated samples using a held-out stratified validation set consisting of 40% of the training documents. This means that we optimise each classifier specifically for each quantifier, and the parameters we choose are the ones that best suit this particular quantifier. Once we have chosen the optimal values for the hyperparameters, we retrain the quantifier using the entire training set. The quantification methods used in this study do not have any additional hyperparameters, except for DyS that has two, i.e., (i) the number of bins used to build the histograms and (ii) the distance function. In this work we fix these values to (i) 10 bins and (ii) the Topsoe distance, since these are the values that gave the best results in the work that originally introduced DyS (Maletzke et al., 2019). Binary Quantification and Dataset Shift 23 Algorithm 1 Protocol for generating prior probability shift. Input: Datasets A and B; Quantification learner Q ∈ {0.02, 0.1, 0.2, ..., 0.8, 0.9, 0.98} do for pL 1: D ← A ∪ B 2: D ← binarise dataset(D, cut point = 3) 3: L, U ← split stratified(D) 4: for 10 repetitions do 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: /* Generating test samples */ for pU /* Generate a sample from L with prevalence pL */ L ∼ L with pL = pL and ∣L∣ = 5000 /* Use algorithm Q to learn a quantifier q on L */ q ← Q.f it(L) for 50 repetitions do ∈ {0.0, 0.1, ..., 0.9, 1.0} do U ∼ U with pU = pU and ∣U ∣ = 500 ˆpq U ← q. quantify(U ) error ← AE(pU , ˆpq U ) 5.3 Prior Probability Shift 5.3.1 Evaluation Protocol For generating prior probability shift we consider all the reviews from cat- egories Electronics and Books. Algorithm 1 describes the experimental setup for this type of shift. For binarising the dataset we follow the approach described in Section 5.1, using a cut point of 3. We sample 5,000 training documents from the dataset using prevalence values of the positive class with values ranging from 0 to 1, at steps of 0.1. (Since it is not possible to generate a classifier with no positive examples or no negative examples, we actually replace pL = 0 and pL = 1 with pL = 0.02 and pL = 0.98, respectively.) We draw test samples from the dataset varying, here too, the prevalence of the positive class using values in {0.0, 0.1, .., 0.9, 1.0}. In order to give a quantita- tive indication of the degree of prior probability shift in each experiment, we compute the signed difference (pL − pU ) rounded to one decimal, resulting in a real value in the range [−1, 1]; to this respect, note that negative degrees of shift do not indicate an absence of shift, but indicate a presence of shift in which pU is greater than pL (for positive degrees, pU is lower than pL). For this experiment the number of test samples used for evaluation amounts to 11 × 11 × 50 × 10 = 60,500 for each quantification algorithm we test. 5.3.2 Results Table 4 and Figure 6 present the results of the prior probability shift exper- iments in the form of boxplots (blue boxes), where the outliers are indicated by black dots. In this case the SLD method stands out as the best performer, closely followed by DyS and PACC. These methods perform very well when the 24 P. Gonz ́alez, A. Moreo, F. Sebastiani CC ACC PCC PACC DyS SLD -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 .737 .479 .355 .271 .213 .166 .126 .091 .064 .047 .035 .048 .064 .092 .127 .167 .213 .272 .355 .478 .742 .000 .049 .088 .099 .094 .086 .071 .055 .041 .032 .026 .034 .046 .063 .077 .089 .096 .095 .081 .052 .020 .548 .439 .352 .278 .216 .162 .115 .093 .085 .091 .111 .090 .084 .089 .112 .160 .213 .276 .351 .440 .551 .001 .044 .077 .069 .054 .042 .031 .025 .023 .022 .017 .021 .023 .025 .029 .036 .045 .053 .058 .039 .002 .063 ‡.053 .045 .040 .032 .028 †.024 .021 .019 .017 .016 .018 †.019 .022 .026 .030 .035 .043 .053 .062 .076 .001 .041 .049 ‡.041 †.034 ‡.029 .023 .020 .017 .015 .014 .017 .018 .020 .022 .024 .025 .027 .030 .029 .016 Table 4 Results for prior probability shift experiments in terms of MAE. Each row corre- sponds to a given degree of shift, measured as (pU − pL) (rounded to one decimal). degree of shift is moderate,10 while their performance degrades as this degree increases. On the other hand, CC and PCC are clearly the worst performers; the reason is that, as stated previously, CC and PCC naturally inherit the bias of the underlying classifier, so when the divergence between the distri- bution they are biased towards (i.e., the training distribution) and the test distribution increases, their performance tends to decrease. These results are in line with previous studies in the quantification literature (e.g., (Maletzke et al., 2019; Moreo and Sebastiani, 2022; Moreo et al., 2021; Schumacher et al., 2021)), most of which has indeed focused on prior probability shift. One interesting observation that emerges from Figure 6 has to do with the stability of the methods. ACC shows a tendency to sporadically yield anomalously high levels of error. Those levels of error correspond to cases in which the training sample is severely imbalanced (pL = 0.02 or pL = 0.98). Note that, the correction implemented by Equation 4 may turn unreliable when the estimation of tpr itself is unreliable (this is likely to occur when the amount of positives is 2%, i.e., when pL = 0.02) and/or when the estimation of fpr is unreliable (this is likely to occur when the amount of negatives is 2%, i.e., when pL = 0.98). Yet another cause might include the instability of the denominator (this happens when tpr ≈ fpr), which could, in turn, require 10 Here and in the rest of the paper, when speaking of "high" or "low" degrees of shift we actually refer to the absolute value of this degree (e.g., a degree of shift of -1 counts as as a "high" degree of shift). This will be the case not only for prior probability shift but also for other types of shift. Binary Quantification and Dataset Shift 25 Fig. 6 Results obtained for prior probability shift; the error measure is MAE and the degree of shift is computed as (pU − pL) (rounded to one decimal). clipping the output in the range [0, 1]. After analyzing the 100 worst cases, we verified that in 36% of the cases involved clipping, in 46% of the cases the denominator turned out to be smaller than 0.05. Note that, if these extreme cases were to be removed, the average scores obtained by ACC would not substantially differ from those obtained by other quantification methods such as PACC or DyS. 5.4 Global Covariate Shift 5.4.1 Evaluation Protocol For generating global covariate shift, we modify the ratio between the docu- ments in category A (Books) and those in category B (Electronics), across the training data and the test samples. We binarise the dataset at a cut point of 3, as described in Section 5.1. We vary the prevalence α of category A (the -1.0-0.50.00.51.0Degree of prior probability shift0.00.20.40.60.81.0MAECC (MAE: 0.145)-1.0-0.50.00.51.0Degree of prior probability shift0.00.20.40.60.81.0MAEACC (MAE: 0.060)-1.0-0.50.00.51.0Degree of prior probability shift0.00.20.40.60.81.0MAEPCC (MAE: 0.156)-1.0-0.50.00.51.0Degree of prior probability shift0.00.20.40.60.81.0MAEPACC (MAE: 0.032)-1.0-0.50.00.51.0Degree of prior probability shift0.00.20.40.60.81.0MAEDyS (MAE: 0.027)-1.0-0.50.00.51.0Degree of prior probability shift0.00.20.40.60.81.0MAESLD (MAE: 0.022) 26 P. Gonz ́alez, A. Moreo, F. Sebastiani Algorithm 2 Protocol for generating global covariate shift. Input: Datasets A and B; Quantification algorithm Q ∈ {0.0, 0.1, ..., 0.9, 1.0} do for pL for αL ∈ {0.25, 0.50, 0.75} do 1: A ← binarise dataset(A, cut point = 3) 2: B ← binarise dataset(B, cut point = 3) 3: LA, UA ← split stratified(A) 4: LB, UB ← split stratified(B) 5: for 10 repetitions do 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: for αU /* Generating test samples */ for pU ∈ {0.25, 0.50, 0.75} do /* Generate a training sample L from LA and LB with prevalence pL and a proportion αL of documents from LA */ LA ∼ LA with pLA = pL and ∣LA∣ = ⌈αL LB ∼ LB with pLB = pL and ∣LB∣ = ⌊(1 − αL L ← LA ∪ LB /* Use quantification algorithm Q to learn a quantifier q on L */ q ← Q.f it(L) for 50 repetitions do ) ⋅ 5000⌋ ⋅ 5000⌉ ∈ {0.0, 0.1, ..., 0.9, 1.0} do UA ∼ UA with pUA = pU and ∣UA∣ = ⌈αU ⋅ 500⌉ UB ∼ UB with pUB = pU and ∣UB∣ = ⌊(1 − αU U ← UA ∪ UB ˆpq U ← q. quantify(U ) error ← AE(pU , ˆpq U ) ) ⋅ 500⌋ prevalence of category B is (1 − α)), in the training data (αL) and in the test samples (αU ), in the range [0, 1] with steps of 0.1, thus giving rise to 121 pos- sible combinations. For the sake of a clear exposition, we present the results for different degrees of global covariate shift, measured as the signed difference between αL and αU , resulting in a real value in the range [−1, +1]. We vary the priors of the positive class using the values {0.25, 0.50, 0.75} in both the training data and the test samples, in order to simulate cases of global pure covariate shift, where PL(Y ) = PU (Y ), and global mixed covariate shift, where PL(Y ) ≠ PU (Y ). Note that even if the global pure covariate shift scenario is particularly awkward for a quantification setting (since the prevalence of the positive class in the training data coincides with the one in the test data), it is interesting because it shows how quantifiers react just to a mere change in the covariates. Algorithm 2 describes the experimental setup for this type of shift. For this experiment the number of test samples used for evaluation amounts to 3 × 3 × 11 × 11 × 50 × 10 = 544,500 for each quantification algorithm we test. 5.4.2 Results We now report the results for the scenario in which the data exhibits global pure covariate shift (see Tables 5, 6, 7, where global pure covariate shift is represented by the columns with a grey background, and Figures 7, 8, 9). As Binary Quantification and Dataset Shift 27 pU = 0.5 CC ACC PCC PACC DyS SLD CC ACC PCC PACC DyS SLD CC ACC PCC PACC DyS SLD pU = 0.25 pU = 0.75 -1.0 .029 .069 .085 .046 .098 -0.9 .052 .034 .101 -0.8 .060 .029 .102 -0.7 .065 .025 .103 -0.6 .068 -0.5 .070 .022 .101 -0.4 .072 †.021 .102 .020 .101 -0.3 .074 .019 .101 -0.2 .074 .019 .101 -0.1 .076 .018 .102 0.0 .077 .019 .104 0.1 .080 .022 .108 0.2 .084 .025 .112 0.3 .087 .030 .117 0.4 .092 .035 .122 0.5 .097 .044 .130 0.6 .105 .056 .139 0.7 .114 .075 .152 0.8 .127 .105 .170 0.9 .148 .168 .212 1.0 .194 .133 .107 .147 .065 .044 .080 .078 .061 .083 .037 .033 .052 .052 .042 .057 .025 .025 .037 .039 .033 .044 .020 .023 .031 .030 .025 .034 .015 .021 .025 .020 .022 .024 .021 .029 .014 ‡.020 .020 ‡.020 .018 .025 .012 .020 ‡.019 .018 .016 .023 .011 .018 .016 .015 .020 .010 .019 .017 .015 .014 .019 .010 .019 .017 .015 .014 .018 .009 .017 .018 .015 .014 .019 .010 .017 .020 .016 .015 .020 .011 .020 .024 .017 .016 .021 .011 .023 .028 .020 .018 .023 .012 .028 .033 .023 .019 .025 .013 .035 .042 .027 .022 .028 .015 .045 .053 .034 .025 .032 .018 .060 .074 .044 .031 .040 .022 .082 .112 .063 .040 .052 .030 .115 .203 .124 .070 .090 .055 .183 .225 .213 .109 .142 .200 .231 .132 .169 .064 .084 .110 .166 .090 .145 .043 .055 .071 .137 .064 .130 .035 .043 .051 .117 .047 .120 .027 .033 .037 .103 .038 .113 .024 .028 .030 .093 .032 .109 .021 .024 .025 .085 .027 .105 .019 .021 .021 .080 .023 .102 .017 .019 .018 .075 .021 .100 .017 .018 .016 .072 .019 .098 .016 .017 .015 .068 .019 .099 .016 .018 .016 .068 .020 .100 .018 .020 .017 .068 .020 .102 .019 .023 .019 .069 .020 .026 .021 .070 .021 .105 .022 .030 .023 .073 ‡.022 .108 .025 .037 .027 .075 .025 .112 .029 .046 .033 .077 .028 .114 .036 .061 .044 .078 .033 .117 .047 .089 .061 .078 .041 .118 .087 .155 .115 .066 .053 .107 ‡.190 .188 .236 ‡.114 .112 .128 †.076 .074 .082 ‡.054 .053 ‡.055 .039 ‡.039 ‡.040 .032 .031 .032 .026 .025 .029 .022 .021 .025 .020 .018 .022 .018 .016 .020 .017 .015 .018 .018 .016 .019 .019 .019 .017 .019 .020 ‡.019 .020 .022 †.021 .022 .025 ‡.022 .030 ‡.026 .026 .030 .036 .032 .039 .046 .041 .050 .060 .052 †.056 .086 .093 Table 5 Results for global covariate shift when pL = 0.5 in terms of MAE. Each row contains the results for a degree in covariate shift computed as (αL ). Results are presented in three groups, depending on the prevalence used for the positive class in the test samples pU . Columns with a grey background represent cases of of global pure covariate shift, in which PL(Y ) = PU (Y ). − αU can be expected, the bigger the degree of such shift, the worse the performance of the methods. Note that a degree of global pure covariate shift equal to 1 (resp., -1) means that the system was trained with documents only from category A (resp., B) while the testing samples only have documents from category B (resp., A). On the other hand, low degrees of global pure covariate shift represent the situation in which similar values of αL and αU were used. The experiments show that the method most robust to global pure covariate shift is PCC, which is consistent with the theoretical results of Tasche (2022). PCC is able to provide good results, beating the other methods consistently, even when the degree of global pure covariate shift is high. On the other hand, methods like SLD, that show excellent performance under prior probability shift, perform poorly under high values of global pure covariate shift. The situation changes drastically when analysing the results for global mixed covariate shift (which in the tables are represented by the columns with a white background), i.e., when also P (Y ) changes across training data and test data. In these cases, the performance of methods like PCC or CC (methods that performed very well under the presence of global pure covariate shift) degrades, due to the fact that these methods do not attempt any adjustment to the prevalence of the test data. In this case, methods designed to deal with prior probability shift, such as SLD, stand as the best performers. This is interesting, since this experiment represents a situation in which a change in the covariates happens along with a change in the priors, thus harming the calibration of the posterior probabilities on which PCC rests upon. 28 P. Gonz ́alez, A. Moreo, F. Sebastiani pU = 0.5 CC ACC PCC PACC DyS SLD CC ACC PCC PACC DyS SLD CC ACC PCC PACC DyS SLD pU = 0.75 pU = 0.25 -1.0 .059 .083 .040 -0.9 .035 .053 .024 -0.8 .029 .038 .018 -0.7 .025 .031 .016 -0.6 .024 .026 .014 -0.5 .023 .024 .013 -0.4 .022 .023 .012 -0.3 .022 .022 .012 -0.2 .022 .021 .012 -0.1 .021 .021 .012 0.0 .021 .021 .013 0.1 .022 .021 .013 0.2 .022 .022 .013 0.3 .022 .021 .014 0.4 .022 .022 .015 0.5 .022 .024 .016 0.6 .023 .026 .016 0.7 .026 .029 .019 0.8 .030 .036 .022 0.9 .036 .045 .030 1.0 .057 .069 .049 .067 .127 .115 .200 .175 .195 .043 .081 .075 .145 .107 .158 .032 .060 .050 .114 .070 .136 .027 .044 .037 .096 .053 .122 .022 .034 .029 .083 .041 .112 .020 .028 .023 .075 .035 .106 .019 .024 .019 .070 .032 .100 .018 .022 .018 .065 .030 .098 .017 .020 .016 .062 .027 .094 .017 .018 .015 .061 .026 .093 .017 .017 .015 .060 .025 .092 .017 .018 .015 .061 .025 .094 .018 .019 .016 .063 .025 .096 .019 .020 .018 .067 .024 .098 .020 .023 .020 .072 .025 .102 .022 .026 .023 .079 .028 .107 .024 .031 .028 .085 .033 .112 .029 .038 .035 .090 .040 .118 .035 .048 .046 .098 .053 .121 .048 .066 .065 .104 .070 .127 .081 .099 .116 .090 .090 .118 .174 .340 .267 .351 .160 .221 .107 .265 .168 .296 .097 .138 .063 .096 .068 .221 .111 .265 .048 .069 ‡.049 .195 .078 .242 .038 .051 .035 .175 .058 .226 .033 .041 .028 .163 .048 .215 .030 .034 .024 .154 .042 .207 .029 .028 .021 .146 .039 .203 .026 .024 .019 .142 .034 .197 .025 .021 .017 .140 .031 .195 .024 .020 .017 .138 .030 .193 .024 .020 .018 .140 .029 .197 .023 .021 .020 .144 .029 .201 .022 .024 .021 .151 .029 .207 .023 .028 .023 .160 .033 .214 .026 .034 .025 .171 .039 .224 .031 .040 .029 .182 .049 .235 .039 .051 .034 .195 .066 .248 .053 .067 .046 .209 .089 .256 .068 .088 .064 .223 .119 .272 .112 .218 .148 .275 .082 .108 .253 .290 .207 .158 .180 .123 .103 .126 .080 .073 .090 .054 .056 .065 .038 .048 .051 .029 .045 .040 .024 .043 .033 .021 .039 .028 .018 .036 .023 .017 .034 .021 .017 .032 .022 .019 .030 .024 .020 .029 .027 .022 .032 .033 .023 .039 .039 .024 .052 .048 .027 .073 .061 .031 .099 .081 .038 .126 .103 .051 .141 .110 .084 Table 6 Results for global covariate shift when pL = 0.25 in terms of MAE. Each row contains the results for a degree in covariate shift computed as (αL ). Results are presented in three groups, depending on the prevalence used for the positive class in the test samples pU . Columns with a grey background represent cases of global pure covariate shift, in which PL(Y ) = PU (Y ). − αU pU = 0.25 pU = 0.5 pU = 0.75 CC ACC PCC PACC DyS SLD CC ACC PCC PACC DyS SLD CC ACC PCC PACC DyS SLD .057 .218 -1.0 .171 -0.9 .168 .046 .218 .035 .215 -0.8 .165 -0.7 .159 .032 .211 -0.6 .154 ‡.030 .207 -0.5 .149 .032 .202 .032 .199 -0.4 .146 .032 .198 -0.3 .145 .032 .195 -0.2 .144 -0.1 .145 .030 .196 .028 .196 0.0 .146 .027 .201 0.1 .150 .030 .208 0.2 .156 0.3 .164 .034 .215 .043 .224 0.4 .173 .054 .235 0.5 .185 .071 .248 0.6 .201 .097 .266 0.7 .223 0.8 .244 .130 .284 .178 .317 0.9 .284 .255 .361 1.0 .345 .047 .070 .115 .054 .085 .075 .036 .052 .075 .063 .054 .089 .028 .040 .054 .066 .042 .094 .028 .039 .042 .066 .035 .096 .030 .035 .033 .065 .032 .096 .033 .031 .028 .063 .031 .095 .035 .029 .024 .062 .029 .094 .035 .025 .022 .064 .029 .094 .036 .023 .021 .064 .027 .094 .033 .022 .019 .066 .025 .095 .030 .021 .019 .068 .024 .096 .028 .022 .018 .070 .023 .099 .029 .026 .019 .073 .025 .102 .033 .032 .020 .078 .026 .107 .042 .040 .021 .084 .030 .112 .054 .050 .025 .091 .036 .117 .073 .064 .030 .101 .045 .125 .102 .082 .037 .116 .060 .136 .139 .111 .050 .128 .078 .146 .186 .161 .074 .155 .106 .166 .265 .228 .149 .196 .158 .194 ‡.062 .116 .169 .074 .135 .067 .040 .074 .100 .052 .083 .042 .033 .052 .069 .041 .062 .031 .029 .046 .050 .033 .046 .023 .028 .038 .039 .030 .038 .019 .027 .033 .031 .028 .033 .017 .027 .029 .026 .026 .029 .015 .026 .025 .023 .023 .026 .014 .025 .022 .020 .022 .024 .012 .023 .020 .018 .020 .022 .012 .022 .020 .017 .019 .020 .011 .021 .021 .017 .019 .019 .011 .022 .024 .018 .019 .020 .011 .024 .028 .019 .020 .020 .012 .028 .033 .022 .020 .021 .012 .033 .040 .025 .021 .023 .013 .042 .050 .029 .023 .025 .014 .057 .063 .037 .026 .030 .017 .076 .086 .050 .030 .035 .020 .102 .120 .074 .037 .043 .026 .153 .172 .140 .059 .069 .043 .122 .160 .194 .076 .097 .111 .054 .066 .075 .040 .052 .052 .032 .040 .039 .028 .034 .031 .025 .029 .025 .022 .025 .021 .019 .021 .018 .018 .019 .016 .016 .018 .015 .016 .018 .016 .017 .020 .017 .017 .023 .018 .018 .026 .021 .019 .029 .023 .021 .035 .028 .024 .041 .034 .029 .055 .044 .035 .070 .060 .059 .100 .106 Table 7 Results for global covariate shift when pL = 0.75 in terms of MAE. Each row contains the results for a degree in covariate shift computed as (αL ). Results are presented in three groups, depending on the prevalence used for the positive class in the test samples pU . Columns with a grey background represent cases of global pure covariate shift, in which PL(Y ) = PU (Y ). − αU Binary Quantification and Dataset Shift 29 Fig. 7 Results for global covariate shift with pL = 0.5. The error measure is MAE and the degree of covariate shift is computed as (αL −αU ). Figures with a grey background represent cases of global pure covariate shift, in which PL(Y ) = PU (Y ). 5.5 Local Covariate Shift 5.5.1 Evaluation Protocol For simulating local covariate shift we generate a shift in the class conditional distribution of only one of the classes. In order to do so, categories A and B are treated as subclasses, or clusters, of the positive and negative classes. Figure 10 might help in understanding this protocol. The main idea is to alter the prevalence P (Y ) of the test samples by just changing the prevalence of posi- tive documents of one of the subclasses (e.g., of category A) while maintaining -1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0pL=0.50, pU=0.25PCC (MAE: 0.110)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0SLD (MAE: 0.025)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0pL=0.50, pU=0.50PCC (MAE: 0.014)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0SLD (MAE: 0.028)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0pL=0.50, pU=0.75PCC (MAE: 0.109)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0SLD (MAE: 0.029) 30 P. Gonz ́alez, A. Moreo, F. Sebastiani Fig. 8 Results for global covariate shift with pL = 0.25. Error measure is MAE and the degree of covariate shift is computed as (αL −αU ). Figures with a grey background represent cases of global pure covariate shift, in which PL(Y ) = PU (Y ). the rest (e.g., positives and negatives in B and the negatives of A) unchanged. Following this procedure, we let the class-conditional distribution of the posi- tive examples P (X∣Y = 1) vary, while the class-conditional distribution of the negative examples P (X∣Y = 0) remains constant. For this experiment, we keep the training prevalence fixed at pL = 0.5, while we vary the test prevalence pU artificially. To allow for a wider exploration of the range of the prevalence values pU that can be achieved by varying only the number of positives in category A, we start from a configuration in which 2 3 of the positives in the training set are from category A and the remaining 1 3 are -1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0pL=0.25, pU=0.25PCC (MAE: 0.015)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0SLD (MAE: 0.025)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0pL=0.25, pU=0.50PCC (MAE: 0.104)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0SLD (MAE: 0.029)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0pL=0.25, pU=0.75PCC (MAE: 0.216)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0SLD (MAE: 0.029) Binary Quantification and Dataset Shift 31 Fig. 9 Results for global covariate shift with pL = 0.75. Error measure is MAE and the degree of covariate shift is computed as (αL −αU ). Figures with a grey background represent cases of global pure covariate shift, in which PL(Y ) = PU (Y ). from category B. Both categories contribute to the training set with exactly the same number of documents (2,500 each, since the training set contains 5,000 documents, as before). The set of negative examples is composed of 1 3 documents from A and 2 3 documents from B. In the test samples all these proportions are kept fixed except for the positive documents from category A, so that a desired prevalence value is reached by removing, or adding, positives of this category. Note that this process generates test samples of varying sizes. In particular, when the test size is equal to 500, the proportions of positive and negative documents, as well as the proportion of documents from A and -1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0pL=0.75, pU=0.25PCC (MAE: 0.215)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0SLD (MAE: 0.028)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0pL=0.75, pU=0.50PCC (MAE: 0.104)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0SLD (MAE: 0.030)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0pL=0.75, pU=0.75PCC (MAE: 0.015)-1.0-0.50.00.51.0Degree of global covariate shift0.00.20.40.60.81.0SLD (MAE: 0.028) 32 P. Gonz ́alez, A. Moreo, F. Sebastiani Fig. 10 Conceptual diagram illustrating our local covariate shift protocol. Algorithm 3 The protocol for generating local covariate shift. Input: Datasets A and B; Quantification algorithm Q /* Note pL = 1 2 and ∣L∣ = 5000 */ 2 3 and ∣LA∣ = 2500 1 3 and ∣LB∣ = 2500 1: A ← binarise dataset(A, cut point = 3) 2: B ← binarise dataset(B, cut point = 3) 3: LA, UA ← split stratified(A) 4: LB, UB ← split stratified(B) 5: for 10 repetitions do 6: 7: 8: 9: 10: 11: 12: LA ∼ LA with pLA = LB ∼ LB with pLB = L ← LA ∪ LB /* Use quantification algorithm Q to learn a quantifier q on L */ q ← Q.f it(L) for 50 repetitions do A ∼ UA with pU ⊖ UB ∼ UB with pUB = ∪UB } = 1 /* Note p {U ⊖ A for pU ∈ {0.25, 0.3, 0.35, . . . , 0.75} do solve for POS the equation pU = U ⊕ = 1 and ∣U ⊕ A ∼ UA with pU ⊕ U ← U ⊕ A ∪ U ⊖ A ∪ UB ˆpq U ← q. quantify(U ) error ← AE(pU , ˆpq U ) 13: 14: 15: 16: 17: 18: 19: 20: 1 3 and ∣UA∣ = 250 250 +POS 3 +250+POS = 0 and ∣U ⊖ A∣ = POS 250 3 A∣ = U ⊖ 4 */ 250 3 A A B, match the proportions used in the training set. Using this procedure we explore pU in the range [0.25, 0.75] at steps of 0.05 (see Algorithm 3). For this experiment the number of test samples used for evaluation amounts to 11 × 11 × 50 × 10 = 60,500 for each quantification algorithm we test. PositivesNegativesCategory ACategory BTest samples2/31/3......2/31/3333 instancesp = 0.25UTraining set1/21/22/31/32/31/35000 instancesp = 0.5L2/31/3500 instances1/21/2p = 0.5U1000 instancesp = 0.75U Binary Quantification and Dataset Shift 33 Fig. 11 Results for local covariate shift expressed in terms of MAE. Blue boxes represent the situation in which PL(X∣Y ) = PU (X∣Y ) while orange boxes represent the situation in which PL(X∣Y ) ≠ PU (X∣Y ) because PL(X∣Y = 1) ≠ PU (X∣Y = 1). The degree of shift in the priors is shown along the x-axis and is computed as (pU − pL) rounded to two decimals. 5.5.2 Results The results we have obtained for local covariate shift (orange boxes) are dis- played in Figure 11. For easier comparison, this plot also shows results for the cases in which the class-conditional distributions are constant across the training data and the test data (blue boxes), i.e., when the type of shift is prior probability shift. Consistently with the results of Section 5.3.2, most quantification algo- rithms (except for CC and PCC) work reasonably well (see the blue boxes) when the class-conditional distributions are invariant across the training and the test data. Instead, when the class-conditional distributions change, the per- formance of these algorithms tends to degrade. This should come at no surprise -0.25-0.15-0.050.050.150.25pU−pL0.0000.0250.0500.0750.1000.1250.1500.1750.200MAECC-0.25-0.15-0.050.050.150.25pU−pL0.0000.0250.0500.0750.1000.1250.1500.1750.200MAEACC-0.25-0.15-0.050.050.150.25pU−pL0.0000.0250.0500.0750.1000.1250.1500.1750.200MAEPCC-0.25-0.15-0.050.050.150.25pU−pL0.0000.0250.0500.0750.1000.1250.1500.1750.200MAEPACC-0.25-0.15-0.050.050.150.25pU−pL0.0000.0250.0500.0750.1000.1250.1500.1750.200MAEDyS-0.25-0.15-0.050.050.150.25pU−pL0.0000.0250.0500.0750.1000.1250.1500.1750.200MAESLD 34 P. Gonz ́alez, A. Moreo, F. Sebastiani given that all the adjustments implemented in the quantification methods we consider (as well as in all other methods we are aware of) rely on the assump- tion that the class-conditional distributions are invariant. The exception to this are CC and PCC, the only methods that do not attempt to adjust the priors. What comes instead as a surprise is not only that the performance of CC and PCC does not degrade, but that this performance seems to improve (i.e., the orange boxes in the extremes are systematically below the blue boxes for CC and PCC). This apparently strange behaviour can be explained as fol- lows. When pU ≪ pL, CC and PCC will naturally tend to overestimate the true prevalence. However, in this case, the positive examples in the test sam- ple happen to mostly be from category B. Since the underlying classifier has been trained on a dataset in which the positives from category A were more abundant ( 2 3 ), the classifier has more problems in classifying positives from B than from category A. This has the consequence that the overestimation brought about by CC and PCC is par- tially compensated (that is, positive examples from B tend to be misclassified as negatives more often), and thus the final ˆpU gets closer to the real value pU . On the other side, when pU ≫ pL, CC and PCC will tend to underestimate ˆp. However, in this scenario positive examples mostly belong to category A, which the classifier identifies as positives more easily (since it has been trained on a relatively higher number of positives from A), thus increasing the value of ˆpU and making it closer to the actual value pU . 3 ) than the positives from category B ( 1 A fundamental conclusion of this experiment is that, when the class-condi- tional distributions change, the adjustment implemented by the most sophisti- cated quantification methods can become detrimental. This is important since, in real applications, there is no guarantee that the type of shift a system is confronted with is prior probability shift, nor is there any general way for reliably identifying the type of shift involved. This experiment also shows how the bias inherited by CC and PCC can, under some circumstances, be "serendipitously" mitigated, at least in part. (We will see a similar example when studying concept shift in Section 5.6.) 5.6 Concept Shift 5.6.1 Evaluation Protocol In order to simulate concept shift we exploit the ordinal nature of the original 5-star ratings. Specifically, we simulate changes in the concept of "being posi- tive" by varying, in a controlled manner, the threshold above which a review is considered positive. The protocol we propose thus comes down to varying the cut points in the training set (cL) and in the test set (cU ) independently, so that the notion of what is considered positive differs between the two sets. For example, by imposing a training cut point of cL = 1.5 we are mapping 1-star to the negative class, and 2-, 3-, 4-, and 5-stars to the positive class. In other words, everything but strongly negative reviews are considered positive in the Binary Quantification and Dataset Shift 35 Algorithm 4 Protocol for generating concept shift. Input: Categories A and B; Quantification algorithm Q for cL ∈ {1.5, 2.5, 3.5, 4.5} do /* Generate a sample from L */ L ∼ L with ∣L∣ = 5000 /* Binarising using this specific cut point */ L ← binarise dataset(L, cut point = cL /* Use quantification algorithm Q to learn q on L */ q ← Q.f it(L) for 50 repetitions do 1: /* Sample D balanced with respect to number of stars */ 2: D ∼ A ∪ B with pD(Y⋆) = (0.2, 0.2, 0.2, 0.2, 0.2) 3: L, U ← split stratified(D) 4: for 10 repetitions do 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: U ∼ U with ∣U ∣ = 500 /* Binarising using this specific cut point */ U ← binarise dataset(U, cut point = cU ˆpq U ← q. quantify(U ) error ← AE(pU , ˆpq U ) /* Generating test samples */ for cU ∈ {1.5, 2.5, 3.5, 4.5} do ) ) training set. If, at the same time, we set the test cut point at cU = 4.5, we are generating a large shift in the concept of "being positive", since in the test set only strongly positive reviews (5 stars) will be considered positive. For 5 classes there are 4 possible cut points {1.5, 2.5, 3.5, 4.5}; the protocol explores all combinations systematically (see Algorithm 4). We use the signed difference (cL − cU ) as an indication of the degree of concept shift, resulting in an integer value in the range [−3, 3]; note that (cL − cU ) = 0 corresponds to a situation in which there is no concept shift. It is also worth noting that this protocol does not affect P (X), which remains constant across the training distribution and the test distribution. Conversely, varying the cut point has a direct effect on P (Y ), which means that by establishing different cut points for the training and the test datasets we are indirectly inducing a change in the priors. In order to allow for controlled variations in the priors, we depart from a situation in which all five ratings have the same number of examples, i.e, we impose p(Y⋆) = (0.2, 0.2, 0.2, 0.2, 0.2) onto both the training set and the test set. This guarantees that a change in a cut point c ∈ {1.5, 2.5, 3.5, 4.5} gives rise to a binary set with (positive) prevalence values in {0.2, 0.4, 0.6, 0.8}, which in turn implies a difference in priors (pL − pU ) ∈ {−0.6, −0.4, . . . , 0.4, 0.6}. For this experiment, the number of test samples used for evaluation amounts to 4 × 4 × 50 × 10 = 8,000 for each quantification algorithm we test. 5.6.2 Results The results for our simulation of concept shift are shown in Figure 12. The performance of all methods decreases as the degree of concept shift increases, 36 P. Gonz ́alez, A. Moreo, F. Sebastiani Fig. 12 Results for concept shift. The error measure is MAE and the degree of concept shift is computed as ctr − ctst. < cU (resp., cL i.e., when cL > cU ) all methods tend to overestimate (resp., underestimate) the true prevalence. That no method could fare well under concept shift was expected, for the simple reason that none of these methods has been designed to confront arbitrary changes in the functional relationship between covariates and classes. These results deserve no further discussion, and are here reported only for the sake of completeness (we omit the corresponding table, though). What instead deserves some discussion is the fact that concept shift might, under certain circumstances, lead to erroneous interpretations of the relative merits of quantification methods. This confusion might arise when the bias of a quantifier gets partially compensated by the variation in the prior resulting from the change in the concept. This situation is reproduced in Figure 13, where we impose pL = 0.5 and pU = 0.75.11 Take a look at the errors produced 11 As a consequence of resampling, P (X) changes across the training and the test data. -3-2-10123Degree of concept shift0.00.20.40.60.81.0MAECC (MAE: 0.249371)-3-2-10123Degree of concept shift0.00.20.40.60.81.0MAEACC (MAE: 0.251351)-3-2-10123Degree of concept shift0.00.20.40.60.81.0MAEPCC (MAE: 0.253579)-3-2-10123Degree of concept shift0.00.20.40.60.81.0MAEPACC (MAE: 0.256263)-3-2-10123Degree of concept shift0.00.20.40.60.81.0MAEDyS (MAE: 0.259665)-3-2-10123Degree of concept shift0.00.20.40.60.81.0MAESLD (MAE: 0.256219) Binary Quantification and Dataset Shift 37 Fig. 13 Results for concept shift with forced values for pL = 0.5 and pU = 0.75. The error measure is MAE and the degree of concept shift is computed as (ctr − ctst). − cU = cU . Note that in this case, ) = 0, i.e., when cL by both methods when (cL there is no concept shift, but there is prior probability shift. (Recall that we chose pL = 0.5 and pU = 0.75 for this experiment). We know that PCC tends to deliver biased estimators, while SLD instead does not. This is witnessed by the fact that PCC yields an error close to MAE=0.15 (it tends to underestimate the test prevalence), while SLD obtains a very low error instead; let us call this bias the "global" bias. As we separate the cut points, we introduce a form of bias (a "local" bias) that interacts with the global one. For instance, imagine we train our classifier with 1-star and 2-stars acting as negative labels and (3, 4, 5) acting as positive ones. Assume that in test we instead have (1, 2, 3) stars acting as the negative labels and only (4, 5) as the positives. In this case, the classifier will now tend to classify as positive the test examples with 3 stars. This local overestimation will partially compensate for the global underestimation. (An analogous reasoning applies in the other direction as well.) Note that such an improvement is accidental, and attributing any merit to the quantifier for this would be misleading. 6 Conclusions Since the goal of quantification is estimating class prevalence, most previous efforts in the field have focused on assessing the performance of quantifica- tion systems in situations characterised by a shift in class prevalence values, i.e., by prior probability shift; in the quantification literature other types of dataset shift have received less attention, if any. In this paper we have pro- posed new evaluation protocols for simulating different types of dataset shift in a controlled manner, and we have used them to test the robustness to these types of shift of several representative methods from the quantification liter- ature. The experimental evaluation we have carried out has brought about some interesting findings. -3-2-10123Degree of concept shift0.00.20.40.60.81.0MAEPCC-3-2-10123Degree of concept shift0.00.20.40.60.81.0MAESLD 38 P. Gonz ́alez, A. Moreo, F. Sebastiani The first such finding is that many quantification methods are robust to prior probability shift but not to other types of dataset shift. When the sim- plifying assumptions that characterise prior probability shift (e.g., that the class-conditional densities remain unaltered) are not satisfied, all the tested methods (including SLD, a top performer under prior probability shift) expe- rience a marked degradation in performance. A second observation is that, while previous theoretical studies indicate that PCC should be the best quantification method for dealing with covariate shift, our experiments reveal that its use should only be recommended when the class label proportions are expected not to change substantially (a setting that we refer to as pure covariate shift). Such a setting, though, is fairly uninteresting in real-life applications, and our experiments show that other methods (particularly: SLD and PACC) are preferable to PCC when covariate shift is accompanied by a change in the priors. However, even SLD becomes unstable under certain conditions in which both covariates and labels change. We argue that such a setting, which we have called local covariate shift, shows up in many applications of interest (e.g., prevalence estimation of plankton subspecies in sea water samples (Gonz ́alez et al., 2019), or seabed cover mapping (Beijbom et al., 2015), in which finer- grained unobserved classes are grouped into coarser-grained observed classes. Finally, our results highlight the limitations that all quantification meth- ods exhibit when coping with concept shift. This was to be expected since no method can adapt to arbitrary changes in the functional relationship between covariates and classes without the aid of external information. The same batch of experiments also shows that concept shift may induce a change in the priors that can partially compensate the bias of a quantifier; however, such an im- provement is illusory and accidental, and it is difficult to envision clever ways for taking advantage of this phenomenon. Possible directions for future work include extending the protocols we have devised to other specific types of shift that may be application-dependent (e.g., shifts due to transductive active learning (Kottke et al., 2022), to over- sampling of positive training examples in imbalanced data scenarios (Moreo et al., 2016), to concept shifts in cross-lingual applications), and to types of quantification other than binary (e.g., multiclass, ordinal, multi-label). The goal of such research, as well of the research presented in this paper, is to allow a correct evaluation of the potential of different quantification methods when confronted with the different ways in which the unlabelled data we want to quantify on differs from the training data, and to stimulate research in new quantification methods capable of tackling the types of shift that current methods are insufficiently equipped for. Acknowledgments The work of the 1st author hast been funded by MINECO (Ministerio de Econom ́ıa y Competitividad) and FEDER (Fondo Europeo de Desarrollo Re- Binary Quantification and Dataset Shift 39 gional), grant PID2019-110742RB-I00 (MINECO/FEDER), and by Campus de Excelencia Internacional in collaboration with Santander Bank in the frame- work of the financial aid for mobility of excellence for teachers and researchers at the University of Oviedo. The work by the 2nd and 3rd authors has been supported by the SoBigData++ project, funded by the European Commis- sion (Grant 871042) under the H2020 Programme INFRAIA-2019-1, by the AI4Media project, funded by the European Commission (Grant 951911) un- der the H2020 Programme ICT-48-2020, and by the SoBigData.it, FAIR, and QuaDaSh projects funded by the Italian Ministry of University and Re- search under the NextGenerationEU program. The authors' opinions do not necessarily reflect those of the funding bodies. References Ala ́ız-Rodr ́ıguez R, Guerrero-Curieses A, Cid-Sueiro J (2011) Class and sub- class probability re-estimation to adapt a classifier in the presence of con- cept drift. Neurocomputing 74(16):2614–2623, DOI 10.1016/j.neucom.2011. 03.019 Alexandari A, Kundaje A, Shrikumar A (2020) Maximum likelihood with bias-corrected calibration is hard-to-beat at label shift adaptation. In: Pro- ceedings of the 37th International Conference on Machine Learning (ICML 2020), Virtual Event, pp 222–232 Azizzadenesheli K, Liu A, Yang F, Anandkumar A (2019) Regularized learn- ing for domain adaptation under label shifts. In: Proceedings of the 7th International Conference on Learning Representations (ICLR 2019), New Orleans, US Barranquero J, D ́ıez J, del Coz JJ (2015) Quantification-oriented learning based on reliable classifiers. Pattern Recognition 48(2):591–604, DOI 10. 1016/j.patcog.2014.07.032 Beijbom O, Hoffman J, Yao E, Darrell T, Rodriguez-Ramirez A, Gonzalez- Rivero M, Hoegh-Guldberg O (2015) Quantification in-the-wild: Data-sets and baselines, coRR abs/1510.04811 (2015). Presented at the NIPS 2015 Workshop on Transfer and Multi-Task Learning, Montreal, CA Bella A, Ferri C, Hern ́andez-Orallo J, Ram ́ırez-Quintana MJ (2010) Quantifi- cation via probability estimators. In: Proceedings of the 11th IEEE Interna- tional Conference on Data Mining (ICDM 2010), Sydney, AU, pp 737–742, DOI 10.1109/icdm.2010.75 Bickel S, Br ̈uckner M, Scheffer T (2009) Discriminative learning under co- variate shift. Journal of Machine Learning Research 10:2137–2155, DOI 10.5555/1577069.1755858 Card D, Smith NA (2018) The importance of calibration for estimating propor- tions from annotations. In: Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics (HLT- NAACL 2018), New Orleans, US, pp 1636–1646, DOI 10.18653/v1/n18-1148 40 P. Gonz ́alez, A. Moreo, F. Sebastiani Casta ̃no A, Alonso J, Gonz ́alez P, del Coz JJ (2023) An equivalence analysis of binary quantification methods. In: Proceedings of the 37th AAAI Conference on Artificial Intelligence (AAAI-23), Washington, US, pp 6944–6952 Chan YS, Ng HT (2006) Estimating class priors in domain adaptation for word sense disambiguation. In: Proceedings of the 44th Annual Meeting of the Association for Computational Linguistics (ACL 2006), Sydney, AU, pp 89–96 Chen L, Zaharia M, Zou J (2022) Estimating and explaining model perfor- mance when both covariates and labels shift. arXiv:2209.08436 [stat.ML] Dempster AP, Laird NM, Rubin DB (1977) Maximum likelihood from incom- plete data via the EM algorithm. Journal of the Royal Statistical Society, B 39(1):1–38 du Plessis MC, Sugiyama M (2012) Semi-supervised learning of class balance under class-prior change by distribution matching. In: Proceedings of the 29th International Conference on Machine Learning (ICML 2012), Edin- burgh, UK Esuli A, Sebastiani F (2010) Machines that learn how to code open-ended survey data. International Journal of Market Research 52(6):775–800, DOI 10.2501/s147078531020165x Esuli A, Sebastiani F (2015) Optimizing text quantifiers for multivariate loss functions. ACM Transactions on Knowledge Discovery and Data 9(4):Article 27, DOI 10.1145/2700406 Esuli A, Moreo A, Sebastiani F (2018) A recurrent neural network for senti- ment quantification. In: Proceedings of the 27th ACM International Con- ference on Information and Knowledge Management (CIKM 2018), Torino, IT, pp 1775–1778, DOI 10.1145/3269206.3269287 Esuli A, Moreo A, Sebastiani F, Sperduti G (2022) A detailed overview of LeQua 2022: Learning to quantify. In: Working Notes of the 13th Conference and Labs of the Evaluation Forum (CLEF 2022), Bologna, IT Esuli A, Fabris A, Moreo A, Sebastiani F (2023) Learning to quantify. Springer Nature, Cham, CH Fawcett T, Flach P (2005) A response to Webb and Ting's 'On the ap- plication of ROC analysis to predict classification performance under varying class distributions'. Machine Learning 58(1):33–38, DOI 10.1007/ s10994-005-5256-4 Fernandes Vaz A, Izbicki R, Bassi Stern R (2019) Quantification under prior probability shift: The ratio estimator and its extensions. Journal of Machine Learning Research 20:79:1–79:33 Flach PA (2017) Classifier calibration. In: Sammut C, Webb GI (eds) Encyclo- pedia of Machine Learning, 2nd edn, Springer, Heidelberg, DE, pp 212–219 Forman G (2005) Counting positives accurately despite inaccurate classifica- tion. In: Proceedings of the 16th European Conference on Machine Learning (ECML 2005), Porto, PT, pp 564–575, DOI 10.1007/11564096/ 55 Forman G (2008) Quantifying counts and costs via classification. Data Mining and Knowledge Discovery 17(2):164–206, DOI 10.1007/s10618-008-0097-y Binary Quantification and Dataset Shift 41 Gonz ́alez P, Casta ̃no A, Chawla NV, del Coz JJ (2017) A review on quantifi- cation learning. ACM Computing Surveys 50(5):74:1–74:40, DOI 10.1145/ 3117807 Gonz ́alez P, Casta ̃no A, Peacock EE, D ́ıez J, Del Coz JJ, Sosik HM (2019) Automatic plankton quantification using deep features. Journal of Plankton Research 41(4):449–463 Gonz ́alez-Castro V, Alaiz-Rodr ́ıguez R, Alegre E (2013) Class distribution estimation based on the Hellinger distance. Information Sciences 218:146– 164, DOI 10.1016/j.ins.2012.05.028 Hassan W, Maletzke AG, Batista GE (2020) Accurately quantifying a billion instances per second. In: Proceedings of the 7th IEEE International Confer- ence on Data Science and Advanced Analytics (DSAA 2020), Sydney, AU, pp 1–10, DOI 10.1109/DSAA49011.2020.00012 Hassan W, Maletzke A, Batista G (2021) The risks of using classification datasets in quantification assessment. In: Proceedings of the 1st Interna- tional Workshop on Learning to Quantify (LQ 2021), Gold Coast, AU Hofer V, Krempl G (2012) Drift mining in data: A framework for addressing drift in classification. Computational Statistics & Data Analysis 57(1):377– 391 Hopkins DJ, King G (2010) A method of automated nonparametric content analysis for social science. American Journal of Political Science 54(1):229– 247, DOI 10.1111/j.1540-5907.2009.00428.x Iyer A, Nath S, Sarawagi S (2014) Maximum mean discrepancy for class ratio estimation: Convergence bounds and kernel selection. In: Proceedings of the 31st International Conference on Machine Learning (ICML 2014), Beijing, CN, pp 530–538 King G, Lu Y (2008) Verbal autopsy methods with multiple causes of death. Statistical Science 23(1):78–91, DOI 10.1214/07-sts247 Kottke D, Sandrock C, Krempl G, Sick B (2022) A stopping criterion for trans- ductive active learning. In: Proceedings of the 33rd European Conference on Machine Learning and Principles and Practice of Knowledge Discovery in Databases (ECML / PKDD 2022), Grenoble, FR, pp 468–484, DOI 10.1007/978-3-031-26412-2/ 29 Kull M, Flach P (2014) Patterns of dataset shift. In: First international work- shop on learning over multiple contexts (LMCE) at ECML-PKDD, vol 5 Lipton ZC, Wang Y, Smola AJ (2018) Detecting and correcting for label shift with black box predictors. In: Proceedings of the 35th International Confer- ence on Machine Learning (ICML 2018), Stockholm, SE, pp 3128–3136 Maletzke A, Moreira dos Reis D, Cherman E, Batista G (2019) DyS: A frame- work for mixture models in quantification. In: Proceedings of the 33rd AAAI Conference on Artificial Intelligence (AAAI 2019), Honolulu, US, pp 4552– 4560 McAuley JJ, Targett C, Shi Q, van den Hengel A (2015) Image-based rec- ommendations on styles and substitutes. In: Proceedings of the 38th Inter- national ACM Conference on Research and Development in Information Retrieval (SIGIR 2015), Santiago, CL, pp 43–52, DOI 10.1145/2766462. 42 2767755 P. Gonz ́alez, A. Moreo, F. Sebastiani Milli L, Monreale A, Rossetti G, Giannotti F, Pedreschi D, Sebastiani F (2013) Quantification trees. In: Proceedings of the 13th IEEE International Conference on Data Mining (ICDM 2013), Dallas, US, pp 528–536, DOI 10.1109/icdm.2013.122 Moreno-Torres JG, Raeder T, Ala ́ız-Rodr ́ıguez R, Chawla NV, Herrera F (2012) A unifying view on dataset shift in classification. Pattern Recog- nition 45(1):521–530, DOI 10.1016/j.patcog.2011.06.019 Moreo A, Sebastiani F (2021) Re-assessing the "classify and count" quantifi- cation method. In: Proceedings of the 43rd European Conference on Infor- mation Retrieval (ECIR 2021), Lucca, IT, vol II, pp 75–91 Moreo A, Sebastiani F (2022) Tweet sentiment quantification: An experi- mental re-evaluation. PLOS ONE 17(9):1–23, DOI 10.1371/journal.pone. 0263449 Moreo A, Esuli A, Sebastiani F (2016) Distributional random oversampling for imbalanced text classification. In: Proceedings of the 39th ACM Conference on Research and Development in Information Retrieval (SIGIR 2016), Pisa, IT, pp 805–808, DOI 10.1145/2911451.2914722 Moreo A, Esuli A, Sebastiani F (2021) QuaPy: A Python-based framework for quantification. In: Proceedings of the 30th ACM International Conference on Knowledge Management (CIKM 2021), Gold Coast, AU, pp 4534–4543, DOI 10.1145/3459637.3482015 Nguyen TD, du Plessis MC, Sugiyama M (2015) Continuous target shift adap- tation in supervised learning. In: Proceedings of the 7th Asian Conference on Machine Learning (ACML 2015), Hong Kong, CN, pp 285–300 P ́erez-G ́allego P, Casta ̃no A, Quevedo JR, del Coz JJ (2019) Dynamic en- semble selection for quantification tasks. Information Fusion 45:1–15, DOI 10.1016/j.inffus.2018.01.001 Qui ̃nonero-Candela J, Sugiyama M, Schwaighofer A, Lawrence ND (eds) (2009) Dataset shift in machine learning. The MIT Press, Cambridge, US, DOI 10.7551/mitpress/9780262170055.001.0001 Rabanser S, G ̈unnemann S, Lipton ZC (2019) Failing loudly: An empirical study of methods for detecting dataset shift. In: Proceedings of the 32nd Conference on Neural Information Processing Systems (NeurIPS 2019), Van- couver, CA, pp 1394–1406 Saerens M, Latinne P, Decaestecker C (2002) Adjusting the outputs of a clas- sifier to new a priori probabilities: A simple procedure. Neural Computation 14(1):21–41, DOI 10.1162/089976602753284446 Sch ̈olkopf B, Janzing D, Peters J, Sgouritsa E, Zhang K, Mooij JM (2012) On causal and anticausal learning. In: Proceedings of the 29th International Conference on Machine Learning (ICML 2012), Edinburgh, UK Schumacher T, Strohmaier M, Lemmerich F (2021) A comparative evaluation of quantification methods. arXiv:2103.03223v1 [cs.LG] Sebastiani F (2020) Evaluation measures for quantification: An axiomatic approach. Information Retrieval Journal 23(3):255–288, DOI 10.1007/ s10791-019-09363-y Binary Quantification and Dataset Shift 43 ˇSipka T, ˇSulc M, Matas J (2022) The hitchhiker's guide to prior-shift adap- tation. In: Proceedings of the IEEE Winter Conference on Applications of Computer Vision (WACV 2022), Waikoloa, US, pp 1516–1524 Souza V, dos Reis DM, Maletzke AG, Batista GE (2020) Challenges in bench- marking stream learning algorithms with real-world data. Data Mining and Knowledge Discovery 34(6):1805–1858 Storkey A (2009) When training and test sets are different: Characterizing learning transfer. In: Qui ̃nonero-Candela J, Sugiyama M, Schwaighofer A, Lawrence ND (eds) Dataset shift in machine learning, The MIT Press, Cam- bridge, US, pp 3–28 Tasche D (2017) Fisher consistency for prior probability shift. Journal of Ma- chine Learning Research 18:95:1–95:32 Tasche D (2022) Class prior estimation under covariate shift: No problem? arXiv:2206.02449 [stat.ML] Tasche D (2023) Invariance assumptions for class distribution estimation. In: Proceedings of the 3rd International Workshop on Learning to Quantify (LQ 2023), Torino, IT, pp 56–71 Vucetic S, Obradovic Z (2001) Classification on data with biased class distribu- tion. In: Proceedings of the 12th European Conference on Machine Learning (ECML 2001), Freiburg, DE, pp 527–538 Zhang K, Sch ̈olkopf B, Muandet K, Wang Z (2013) Domain adaptation un- der target and conditional shift. In: Proceedings of the 30th International Conference on Machine Learning (ICML 2013), Atlanta, US, pp 819–827 44 P. Gonz ́alez, A. Moreo, F. Sebastiani A The Equivalence of SMM and PACC In this section we prove that the method Sample Mean Matching (SMM) proposed by Hassan et al. (2020) is equivalent to the method Probabilistic Adjusted Classify & Count (PACC) presented by Bella et al. (2010). This equivalence between the two methods was already hinted at in (Casta ̃no et al., 2023) but no formal proof was provided. SMM fits in the DyS framework of Maletzke et al. (2019), replacing histograms, binning the posterior probabilities issued by a soft classifier s, with the mean of these posteriors, and adopting L1 as the dissimilarity function DS: ˆpSMM σ = argmin 0≤α≤1 ∣(α E x∈L⊕ [s(x)] + (1 − α) E x∈L⊖ [s(x)]) − Ex∈σ [s(x)] ∣ (10) Solving for α when the L1 distance is equal to 0 we obtain ˆpSMM σ = Ex∈σ [s(x)] − E x∈L⊕ [s(x)] − E E x∈L⊖ [s(x)] x∈L⊖ [s(x)] . On the other hand PACC solves the following equation to compute ˆpPACC: ˆpPACC σ = ˆfprs ˆpPCC − σ ˆfprs ˆtprs − Both Equations 11 and 12 are equal, as all their terms are equivalent: Ex∈σ [s(x)] = E x∈L⊖ [s(x)] = E x∈L⊕ [s(x)] = 1 ∣σ∣ 1 ∣L⊖ 1 ∣L⊕ s(x) ≡ ˆpPCC σ ∑ x∈σ s(x) ≡ ˆfprs s(x) ≡ ˆtprs ∑ x∈L⊖ ∑ x∈L⊕ ∣ ∣ (11) (12) (13) (14) (15)
http://arxiv.org/abs/2310.04564v1
"2023-10-06T20:01:33"
"2023-10-06T20:01:33"
ReLU Strikes Back: Exploiting Activation Sparsity in Large Language Models
Large Language Models (LLMs) with billions of parameters have drastically transformed AI applications. However, their demanding computation during inference has raised significant challenges for deployment on resource-constrained devices. Despite recent trends favoring alternative activation functions such as GELU or SiLU, known for increased computation, this study strongly advocates for reinstating ReLU activation in LLMs. We demonstrate that using the ReLU activation function has a negligible impact on convergence and performance while significantly reducing computation and weight transfer. This reduction is particularly valuable during the memory-bound inference step, where efficiency is paramount. Exploring sparsity patterns in ReLU-based LLMs, we unveil the reutilization of activated neurons for generating new tokens and leveraging these insights, we propose practical strategies to substantially reduce LLM inference computation up to three times, using ReLU activations with minimal performance trade-offs.
[ "Iman Mirzadeh", "Keivan Alizadeh", "Sachin Mehta", "Carlo C Del Mundo", "Oncel Tuzel", "Golnoosh Samei", "Mohammad Rastegari", "Mehrdad Farajtabar" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04564v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04564v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI" ]
3 2 0 2 t c O 6 ] G L . s c [ 1 v 4 6 5 4 0 . 0 1 3 2 : v i X r a ReLU Strikes Back: Exploiting Activation Sparsity in Large Language Models Iman Mirzadeh† Keivan Alizadeh Sachin Mehta Carlo C Del Mundo Oncel Tuzel Golnoosh Samei Mohammad Rastegari Mehrdad Farajtabar† Apple ABSTRACT Large Language Models (LLMs) with billions of parameters have drastically transformed AI appli- cations. However, their demanding computation during inference has raised significant challenges for deployment on resource-constrained devices. Despite recent trends favoring alternative acti- vation functions such as GELU or SiLU, known for increased computation, this study strongly advocates for reinstating ReLU activation in LLMs. We demonstrate that using the ReLU activa- tion function has a negligible impact on convergence and performance while significantly reducing computation and weight transfer. This reduction is particularly valuable during the memory-bound inference step, where efficiency is paramount. Exploring sparsity patterns in ReLU-based LLMs, we unveil the reutilization of activated neurons for generating new tokens and leveraging these insights, we propose practical strategies to substantially reduce LLM inference computation up to three times, using ReLU activations with minimal performance trade-offs. 1 Introduction The widespread excitement surrounding Large Language Models (LLMs) has sparked significant interest in leveraging AI across diverse domains [5, 9, 6]. However, realizing the potential of LLMs is challenged by their significant computational and memory requirements during inference [60, 40, 3]. To enhance the inference efficiency1, various techniques have been explored, including quantization [12, 50], speculative decoding [41], pruning [53, 71], and weight sparsification [20, 15]. Among these techniques, achieving activation sparsity offers a compelling advantage by providing a favorable balance between accuracy and speedup, especially on modern hardware like GPUs [51]. Notably, employing the Rectified Linear Unit (ReLU) activation function [22] in neural networks is recognized for inducing sparse activations and has been adopted in various prior works [27, 44, 48, 69]. To reaffirm this property, we employ the OPT model [80], utilizing ReLU, and measure the sparsity of activations in the Feed Forward Network (FFN) between the fully connected layers. As illustrated in Fig. 1a, all layers exhibit sparsity exceeding 90%. On average, across all layers, this activation sparsity results in substantial weight transfer (I/O) savings between the GPU and CPU, impacting 95% of the rows of the down projection layer's weights (Fig. 1b). This reduction directly translates to computation savings, as for these rows, the result of the matrix multiplication operation will be zero. Furthermore, unlike unstructured sparsity (e.g., weight pruning), this type of sparsity is more hardware-friendly due to zeroing more extensive and structured chunks, such as rows or columns [36, 51]. For OPT models, this sparsity reduces the computation required for inference from 6.6G FLOPS (Floating Point Operations Per Second) to 4.5G FLOPS per token, resulting in a 32% computation saving (Fig. 1c). †Corresponding authors: {imirzadeh,farajtabar}@apple.com 1In this work, we use FLOPS as a proxy for inference efficiency. In Appendix B, we demonstrate that for LLMs with activation sparsity, FLOPS can serve as a good approximation of real-world efficiency due to the structure inherent in activation sparsity (e.g., skipping the entire row corresponding to zero activations). A PREPRINT (a) Sparsity of different models (b) Sparsity for Efficiency (c) Accuracy vs. Computation Figure 1: (a) Activation Sparsity of different pretrained models: ReLU-based OPTs show significantly higher sparsity. (b) Zeroed out entries after ReLU save compute in large semi-structured chunks (e.g., rows). (c) Comparison of inference efficiency and performance of the different models with different activation functions after fine-tuning: The choice of activation function does not significantly impact the accuracy, as any of GELU, SiLU, or ReLU can be used on all three models and achieve the same level of accuracy as the original activation function. However, using ReLU can provide an additional benefit of leading to activation sparsity and faster inference. However, a recent trend has emerged, favoring variations of ReLU that are smoother but more complex [28, 64]. These alternatives have gained popularity due to their slightly faster convergence and improved final accuracy [66]. For example, PaLM [9] and Llama models [73] adopt SiLU2 [28, 17, 64], while MPT [56] and Falcon models [2] use GELU [28]. Nonetheless, as demonstrated in Fig. 1c, when we finetune several pretrained LLMs with different activation functions, their performance does not change significantly (within a specific model), while ReLU models require much less computation. In this paper, we re-evaluate using ReLU for LLMs. We are motivated by the pragmatic consideration that, in many real-world applications and computational platforms capable of supporting sparse vector-matrix multiplications, com- putational efficiency during inference outweighs the one-time computational cost incurred during training. We make the following contributions: • We demonstrate that when trained from scratch, there is no significant difference in terms of performance between different activation functions. However, in terms of computational requirements during inference, ReLU activations prove significantly lighter (Sec. 3). • Considering that many modern LLMs (e.g., Llama and Falcon) have been trained with non-ReLU activations, and it is not cost-effective to train them from scratch, we investigate fine-tuning these models with ReLU activations. We show that the models quickly regain their original performance across various reasoning and reading comprehension tasks (Sec. 4.1). Moreover, we show that by leveraging the activation sparsity of ReLU layers and inserting additional ReLU layers after normalization layers, we can further reduce inference FLOPS by up to threefold (Sec. 4.2). • In addition to their computational benefits, we present two promising applications of activation sparsity that can inspire future work. Firstly, we demonstrate that LLMs with ReLU activations reuse a significant portion of already activated neurons during token generation, a phenomenon we term aggregated sparsity (Sec. 5.1). This reusability leads to an inference speedup for speculative decoding (Sec. 5.2). Additionally, we show that studying the pre-activations of pretrained LLMs can guide the selection of unconventional activation functions (e.g., shifted ReLU), achieving up to 90% sparsity while maintaining performance similar to ReLU activation (Sec. 5.3). Overall, we believe our work represents a significant step toward leveraging the potential of sparse activation functions for faster and more efficient inference in large language models. 2To be more precise, the mentioned models use SwiGLU activation function, but in this work, we focus on the gating module that uses SiLU (Swish) function. 2 051015202530Layers020406080100ActivationSparsityOPT6.7B(ReLU)Llama7B(SiLU)Falcon7B(GELU)Up ProjDown ProjNormalizationNormalizationDown ProjActivationsUp ProjAttentionReLU00004.14.54.86.6GFLOPSPerToken59.566.068.0Average0-shotAccuarcyOPT6.7B(ReLU)OPT6.7B(GELU)OPT6.7B(SiLU)Falcon7B(GELU)Falcon7B(ReLU)Falcon7B(SiLU)Llama7B(SiLU)Llama7B(ReLU)Llama7B(GELU) A PREPRINT 2 Related Works Activation Functions in Transformers. The original Transformer architecture [74] was proposed with the ReLU activation function [22], following the popularity of ReLU at the time. Later, several studies aimed to improve the ReLU activation function by increasing its smoothness [28] and/or including parameterized gating mechanisms, such as GELU, SiLU, GLU, and SwiGLU [11, 64]. Earlier studies demonstrated the benefits of these alternatives to ReLU for transformers [66, 57], but on a small scale (e.g., they trained models up to a couple of 100M parameters with at most 35B tokens, while in this work, we train 1B parameter models on more than 100B tokens). However, we believe the impact of activation functions on performance is marginal, following scaling laws [37, 31], which state that architectural changes do not significantly impact performance. Activation Sparsity. Existing research shows increased sparsity reduces inference and training times [44, 25, 70, 81, 47, 51]. For instance, Jaszczur et al. [36] uses ReLU and added a controller to both promote and predict sparsity, while other works only use prediction modules to predict the activation masks [51]. We note that the mentioned works assume the pretrained model has already been using a sparse ReLU activation, and hence, only training a separate module to predict sparsity could be enough. However, we note that most LLMs pretrained these days do not use ReLU, and we aim to bridge this gap. Moreover, these works focus only on a single transformer architecture while we focus on various architectures so our findings can be practical. Finally, we show that there is no need to train a separate prediction module that complicates the computation graph, and using efficient ReLU layers can be enough. Speculative Decoding and Sparsity. Speculative decoding combats latency under memory constraints using a smaller model for token prediction and a larger model for verification [46, 41]. Investigating its integration with sparsity, we find activation sparsity exhibits a temporal pattern, enhancing speculative decoding. We provide guidelines for parameter selection when incorporating sparsity. We defer other lines of related works that are orthogonal to our work, such as model compression techniques, sparse attention methods, and Mixture of Experts (MoE) to Appendix A. 3 Does the Activation Function Impact Performance? This section first overviews our experimental setup, including models, data, and evaluations. Then, by training various models from scratch with different activation functions, we demonstrate that changing activation functions minimally impacts performance. However, the impact on inference efficiency is substantial. 3.1 Experimental setup Models. We use open source pretrained models such as OPT [80], Llama (v1) [73], and Falcon [2] as they use different architectures and pretraining setup (e.g., attention/FFN structure/normalization, activation functions), allowing our study covers a wider range of models. Datasets. We use the RefinedWeb dataset [59], for our pretraining in Sec. 3.2 and finetuning pretrained models in Sec. 4. We chose RefinedWeb because it is a high-quality subset of Common Crawl, which is often used in the pre- training phase of LLMs, including Llama, Falcon, and OPT. We also use the validation split of WikiText [54] for measuring the sparsity and recording preactivation distributions of various pretrained models. However, our conclu- sions hold for other datasets we have tested. Training and Finetuning. For finetuning the pretrained models, we follow the original pretraining recipe, except we use a fixed learning rate of 1.5e-5 for Llama 7B, Falcon 7B, and OPT 6.7B models. In addition, we use the AdamW optimizer [52] for our finetuning with ZeRO stage 1 [62], where we shard the optimizer states across different GPUs. For pretraining OPT 1.3B models from scratch in Sec. 3.2, we follow the OPT training recipe. Evaluation. For our performance evaluation, we use the few-shot tasks from Language Model Evaluation Har- ness [23]. We select these tasks such that they can measure various abilities of the models (e.g., reading compre- hension, reasoning, etc.), and we aim to be consistent with other works in the literature to make the comparison easier. Consistent with the other sections, we compare activation sparsity as a measure of efficiency. Further details regarding the relationship between activation sparsity, FLOPS, and inference efficiency are discussed in Appendix B. 3 A PREPRINT (a) (d) (b) (e) (c) (f) Figure 2: (top) (a) Shapes of different gating functions over [-5, 5]; (b) Continuation of (a) where SiLU is comparably larger compared to others; (c) Sparsity of the FFN with different activations: increasing β increases sparsity. (bottom) when trained from scratch, OPT 1.3 B models using different activation functions achieve similar performance. 3.2 Training from scratch: performance and sparsity While the previous literature suggests that non-ReLU variants can improve the performance of transformers [66, 57], we argue the impact is marginal at best. To support our claim, we train the OPT 1.3B model from scratch on a hundred billion tokens of the RefinedWeb datasets with different activation functions, including ReLU, SiLU, and GELU. All σ(βx), where β controls the gating part (smoothed cutoff these activation functions can be viewed as f(x) = x threshold) of the activation function (see Fig. 2a). For β = 1, we will have SiLU(x σ(x)), and β = 1.7 is a good approximation of GELU. Finally, as β , the activation function becomes closer to ReLU. To further explore the spectrum of ReLU to SiLUwe add another one with β = 8. → ∞ * * As shown in the bottom row of Fig. 2, the performance of the models is very similar when using different activation functions. This is consistent with the scaling laws literature ([37, 31]), which suggests that the performance of suffi- ciently large models trained on sufficiently large data depends heavily on compute and data, not architectural details. While the performance levels of the different activations are similar, their activation sparsity levels differ. Here, we define sparsity as the average sparsity level across all layers for each model. As shown in Fig. 2c, as we transition from SiLUto ReLU (increasing β), the sparsity also increases. This results from the different gating thresholds, as ReLU drops significantly more values compared to GELU and SiLU (see Fig. 2b). In Appendix D, we illustrate the evolution of the pre-activation distribution throughout training. Overall, the results support our initial claim: non-ReLU activations result in a negligible performance gain (if any) but a substantial loss in sparsity and efficiency. While, at times, the performance of GeLU or SiLU might be slightly higher, ReLU can match it with slightly longer training. We acknowledge that to compensate for the small gap in performance, we need to pay the one-time cost of longer training. However, in return, we get a significantly more sparsity. 4 Relufication While in the previous section, we have seen that the performance does not depend on the activation function, we note that most of the available pretrained LLMs are trained with activation functions other than ReLU. Hence, to incorporate the computational benefits of ReLU activations at inference time, we perform various architectural surgeries and study the consequences of such changes. 4 −4−2024x0.00.20.40.60.81.0σ(βx)β=1.0(SiLU)β=1.7(GELU)β=8β→∞(ReLU)−10−9−8−7−6−5x0.0000.0020.0040.0060.0080.010σ(βx)β=1.0(SiLU)β=1.7(GELU)β=8β→∞(ReLU)020406080100BillionTokensTrained020406080100AverageActivationSparsityβ=1.0(SiLU)β=1.7(GELU)β=8β→∞(ReLU)020406080100BillionTokensTrained253035404550ARC-EasyAccuracyActivation:xσ(βx)β=1.0(SiLU)β=1.7(GeLU)β=8β→∞(ReLU)020406080100BillionTokensTrained262830323436HellaSwagAccuracyActivation:xσ(βx)β=1.0(SiLU)β=1.7(GeLU)β=8β→∞(ReLU)020406080100BillionTokensTrained010203040LAMBADAAccuracyActivation:xσ(βx)β=1.0(SiLU)β=1.7(GeLU)β=8β→∞(ReLU) A PREPRINT Figure 3: Architectural surgeries for relufication. In stage 1 we keep the existing ReLUs (in the case of OPT) or replace the activation function between up projection and down projections from GELU (Falcon) and SiLU (Llama) to ReLU. In stage 2, we insert new ReLUs after normalization layers. (a) Falcon 7B (GELU) (b) Falcon 7B (ReLU) (c) Llama 7B (SiLU) (d) Llama 7B (ReLU) Figure 4: Activation sparsity of Falcon and Llama models improves significantly after relufication. We present our findings about incorporating ReLU activations into the pretrained LLMs, a process we refer to as relufication. More specifically, we show that replacing the activation functions of pretrained LLMs with ReLU is possible, and the performance can be recovered very rapidly during finetuning. Moreover, we show that we can exploit the sparse ReLU activations, and by inserting additional ReLU layers after normalization layers, we can improve inference efficiency, as FLOPS indicates. Finally, we show these modifications, which are easy to implement, lead to lighter models at inference time while maintaining comparable performance to the original pretrained models. 4.1 Stage 1: replacing non-ReLU activations The process of relufication for different pretrained architectures is shown in Fig. 3. This process can be done in multiple stages, as we describe here. The first and more intuitive stage replaces non-ReLU activations with ReLU in the FFN layer. For the Falcon and Llama models, this means replacing GELU and SiLU, respectively. We note that since OPT models already use ReLU activations, we keep those unchanged. After finetuning on 30 billion tokens of the RefinedWeb, Fig. 4 shows that the modified models have significantly more sparsity in their activations. In addition to the drastic improvement in activation sparsity, we can make several notable observations. First, while the shape of preactivation depends on the pretraining dynamics and architecture, in Fig. 5, we show that it does not change significantly during the relatively short finetuning stage. As a result, we can predict the activation sparsity before finetuning, knowing it will not change significantly. Later in Sec. 5.3 we build on this observation and propose shifting the preactivation values before applying ReLU and further increasing the activation sparsity. The stability of the preactivation distribution may suggest that the behavior of the network does not change while creating sparse representations. Indeed, we show that after replacing the activation function with ReLU, finetuned models quickly recover their performance in Fig. 6. We believe optimizing this process even further (e.g., using better finetuning data) is an exciting follow-up direction. 5 AttentionReLUUp ProjDown ProjNormalizationNormalizationReLUOPT LayerReLUAttentionUp ProjDown ProjNormalizationReLUFalcon LayerReLUInserted ReLUReplaced with ReLUKept ReLUAttentionReLUUp ProjDown ProjNormalizationNormalizationReLULlama LayerGate ProjReLUstage 2stage 10100200Tokens0.02.55.07.510.0ActivationSparsity(%)18162432Layer0100200Tokens708090100ActivationSparsity(%)18162432Layer0100200Tokens0.000.100.250.500.751.00ActivationSparsity(%)18162432Layer050100150200Tokens3040506070ActivationSparsity(%)18162432Layer A PREPRINT (a) Falcon 7B (GELU) (b) Falcon 7B (ReLU) (c) Llama 7B (SiLU) (d) Llama 7B (ReLU) Figure 5: The preactivation distribution of pretrained models for Falcon and Llama does not change significantly during the short finetuning stage of relufication. The dashed line shows the cutoff point before which the output is almost zero. Table 1: Comparing zero-shot performance across several tasks: After relufication, the activation sparsity of models increases significantly, hence increased efficiency measured by FLOPS. Within each group, the performance levels are comparable. Model (stage) OPT 1.3B OPT 2.7B (s2) OPT 2.7B OPT 6.7B (s2) OPT 6.7B Falcon 7B (s2) Falcon 7B (s1) Falcon 7B Llama 7B (s2) Llama 7B (s1) Llama 7B Input Sparsity (%) QKV DownProj UpProj FLOPS (G) Avg Arc-E Arc-C Hellaswag BoolQ PIQA LAMBADA TriviaQA WinoGrande SciQ Zero-Shot Accuracy (%) 0 50 0 50 0 56 0 0 51 0 0 96 96 96 97 97 95 94 1 65 62 0 0 35 0 40 0 56 0 0 67 0 0 1.3 1.1 1.8 2.8 4.5 2.2 4.1 6.6 2.9 4.8 6.6 50.7 53.1 54.5 58.6 59.8 64.8 65.2 66.8 66.4 67.1 68.4 57.3 60.3 63.3 66.5 68.0 73.6 72.2 74.6 73.8 75.2 75.5 22.9 26.8 29.2 32.2 32.4 38.6 39.1 40.2 39.6 40.1 42.1 41.3 44.9 45.8 49.1 50.2 55.3 55.4 57.7 54.8 55.2 69.9 57.0 55.4 57.6 63.0 68.4 68.4 70.6 73.5 69.9 73.4 74.8 71.8 73.9 74.2 76.4 75.8 78.9 78.4 79.4 77.9 77.7 78.7 56.0 57.6 61.4 63.3 67.2 67.6 69.2 74.5 70.7 71.5 73.1 6.1 12.4 12.3 23.8 20.9 40.4 40.5 40.4 48.5 49.6 49.9 58.9 59.6 60.8 63.1 65.3 67.1 67.5 67.2 68.6 67.1 69.8 84.6 86.7 85.9 90.3 90.2 93.4 93.1 94.0 93.8 94.2 95.4 4.2 Stage 2: Pushing for more sparsity In the previous stage, we replaced non-ReLU activations to gain more sparsity. This leads to the input of down projection layer be- ing sparse, roughly 30% of the total computation. However, there are other matrix-vector multiplications in the decoder layer of trans- formers besides the down projection. For instance, before the up projection and gate projections of FFN layer, and QKV projections in the attention layer (see Fig. 3). Together, the mentioned matrix- vector multiplications consume about 55% of the total computation. To this end, we utilize the fact that in modern transformer layers, the input to both the attention and FFN layers come from a normal- ization layer, e.g., LayerNorm [4] or RMSNorm [78]. These layers can be viewed as a specific form of MLP, where, instead of applying arbitrary learnable parameters, they learn to scale inputs. Therefore, we apply ReLU to obtain sparse activations after normalization lay- ers which we call the second stage of relufication in Fig. 3. Tab. 1 shows that different stages of the relufication process do not significantly reduce zero-shot accuracy while using significantly less compute. The sparsity is broken down into three categories: up, down, and QKV projections. Notably, the input to QKV is less sparse than FFN projections, which opens an interesting avenue for future research. We note that the small gap in performance between the original vs. relufied models may be partially due to the finetuning process and not necessarily the activation func- tion. Our finetuning is applied only for 30B and 50B tokens for stages 1 and 2, respectively. Putting into prospect and comparing it with 1T tokens of Llama, for example, this is equivalent to 3-5% of the original training duration. As discussed in Sec. 3.2, according to the scaling properties of LLMs, the gap will be further bridged by additional finetuning steps. Figure 6: Evolution of zero-shot accuracy dur- ing finetuning: The model quickly recovers most of its lost performance due to the archi- tecture surgery. 6 −15−10−5051015Pre-ActivationValue020406080100Ratio(%)GELU(x)6=018162432Layer−15−10−5051015Pre-ActivationValue020406080100Ratio(%)ReLU(x)6=018162432Layer−15−10−5051015Pre-ActivationValue020406080100Ratio(%)SiLU(x)6=018162432Layer−15−10−5051015Pre-ActivationValue020406080100Ratio(%)ReLU(x)6=018162432Layer051015202530BillionTokensFinetuned3040506070Average0-shotAccuarcyLlama(ReLU)Llama(SiLU)Falcon(ReLU)Falcon(GELU) A PREPRINT Table 2: MMLU five-shot accuracy. Models finetuned with different activation functions have similar performance.* Denotes we replace the SiLU function in Llama's SwiGLU activation function with ReLU. Model Activation FLOPS(%) Avg Humanities STEM Social Sciences Other Falcon 7B Falcon 7B Falcon 7B Llama 7B Llama 7B Llama 7B SiLU GELU ReLU SiLU* GELU ReLU 100 100 62 100 100 72 26.4 27.7 27.9 35.1 35.9 34.7 24.8 28.1 26.0 37.9 38.4 34.8 27.4 26.0 26.5 30.2 29.4 31.2 27.2 28.0 31.8 37 37.6 36.3 26.2 29.4 27.9 37.1 39.5 37.8 We also assess the in-context learning ability of the relufied models with the Massive Multitask Language Understand- ing (MMLU) [29] benchmark in Tab. 2. Our results show that when we augment the original LLMs with different activations and finetune, the few-shot performance does not change significantly either. Moreover, Sec. E in the appendix shows that a larger but relufied model performs better than an original smaller model of the same FLOPS. Overall, the results affirm that the proposed relufication procedure can decrease the inference FLOPS at various stages and rates while maintaining on-par performance on various tasks. 5 Applications In this section, we discuss promising directions motivated by our investigation in Sec. 4. First, we introduce aggregated sparsity, showing that ReLU networks reuse previously activated neurons when generating tokens. Hence, we can leverage this to increase the generation speed. Next, we relate aggregated sparsity with speculative decoding to further improve speculative decoding's inference time. Finally, we briefly discuss a promising direction of using the shifted ReLU activation function to improve the sparsity further. 5.1 Aggregated Sparsity: reusing previously activated neurons A consequence of using only a small subset of neurons for each token is that if these neurons are shared to some degree, the model still does not use all of the neurons until many tokens are processed. We refer to this as aggregated sparsity, which we defined as the ratio of neurons that have not been used up to processing the first t token. Note that this metric will always be non-increasing. Intuitively, it measures the unused capacity of feed-forward neurons for processing a specific prompt. Here in Fig. 7a we show that for the OPT-6.7B model, on average, about 50% of all the neurons will be unused across the first 150 tokens of prompts coming from the WikiText dataset. Our empirical results hold for other ReLU models and other datasets. Additionally, in Fig. 7b, we show that this pattern is far from random activation of neurons during the token generation with a rate equal to the average rate of activation usage per token. Let si be the activation sparsity of layer i averaged over all tokens. Then, the probability of an activation not used in generating the first t tokens in uniformly random selection is st i . Fig. 7b shows this quantity for two layers i = 8, 24 for the first 256 tokens in dashed line. It also shows the real (observed) number of activations being used in the solid line. The fact that the random aggregated sparsity (referred to as random sparsity) is lower than the observed aggregated sparsity (we refer to it as aggregated sparsity) shows a clear pattern of reusing activations. We can benefit from the overlapping activations by utilizing previously loaded weights from the down projection layer for upcoming tokens. To test this, we initiate with reading 128 tokens. For the subsequent 128 tokens, we intermittently avoid loading new weights for every γ token. Using γ = 16 as an example, tokens 129-145 are generated conventionally. However, for tokens 146-161, we retain the existing weight without introducing any new weight. This pattern continues, with every next set of γ tokens alternating between conventional generation and weight reuse. In Fig. 7c, we observe only a slight increase in perplexity when using this approximation to address the memory and I/O- intensive nature of LLM inference. This figure contrasts the perplexity obtained from reused activations and random selections. The reuse strategy aligns well with the baseline, whereas random selection notably increases perplexity, highlighting the effectiveness of reusing the already loaded activations for subsequent tokens. 5.2 Activation sparsity and speculative decoding As highlighted in Sec. 5.1, activation reuse happens for multiple consecutive tokens. When multiple consecutive tokens are processed together, we can save the I/O (i.e., transferring weights to GPU/CPU as discussed in Appendix B) 7 A PREPRINT (a) (b) (c) (d) Figure 7: (a) Aggregated sparsity of different layers and their mean. (b) Aggregated sparsity during token generation and comparison with a random sparsity. (c) Perplexity, based on the number of tokens for which loaded weights from previous tokens are reused. The dashed line represents no reuse, the solid blue line shows the case with activation reuse according to aggregated sparsity, and the orange line depicts the perplexity when activations are reused according to (d) The inference speedup of speculative decoding with aggregated sparsity and with random a random sparsity. sparsity. Speedup equal to 1.0 is the standard version of speculative decoding. associated with activations that are not used in any of them. If the reuse was not happening, and the sparsity of all tokens was purely random, the aggregated sparsity would shrink exponentially and quickly diminish. Speculative decoding [46] is a related technique that uses a smaller model Mq to propose γ tokens and a larger model Mp to verify those tokens and select matching ones. It improves the runtime of the model by avoiding running Mp sequentially. To improve speculative decoding, aggregated sparsity can trim down the portion of the model that needs to be run. Instead of running the full model, only the non-sparse parts need to be evaluated, which will reduce I/O and compute latency. Suppose the average aggregated sparsity of Mp for γ tokens is ̄sagg(γ), and cost of running Mq over Mp is c. Then the expected latency speedup when going from standard speculative decoding to sparse speculative decoding is cγ+1 cγ+(1− ̄sagg(γ)) . Fig. 7d compares sparse speculative decoding to the standard version for OPT 6.7B model. As a case study, for γ = 16, the sparse version has a 1.27x speedup over the standard speculative decoding. If the aggregated sparsity was random over different tokens, the speedup would have been only 1.20x. Note that even random sparsity will lead to speedup over standard speculative decoding. This further shows the value of relufication. However, the speedup due to random sparsity would diminish quickly in comparison to aggregated sparsity as we go for larger γ. For example, for γ = 64 the speedup is almost negligible, while the speedup for the aggregated sparsity is around 1.14x. Further discussion and details are postponed to Appendix C, where we compare sparse speculative decoding, standard speculative decoding, and autoregressive decoding and discuss optimal γ in the case of sparse speculative decoding. 5.3 The shifted ReLU activation Our work in this section is motivated by the observation from Sec. 4, where, comparing Fig. 4d with Fig. 4b revealed that the relufied Llama has much less sparsity (65%) than the relufied Falcon model (95%). In addition, we build on two of our previous findings. First, the preactivation distribution of the relufied Llama (Fig. 5c) includes a considerable mass after the cutoff value at zero. Second, the shape of the preactivation distribution does not change before and after the relufication process (Fig. 5c and Fig. 5d). Therefore, we may be able to shift the preactivation distribution to the left to put more volume before the cutoff at 0. R is a constant To this end, for preactivation input x, rather than applying ReLU(x), we use ReLU(x scalar. We propose to set the value b based on the preactivation distribution. For instance, based on the distribution in Fig. 5d, setting b = 1 and hence using ReLU(x 1) as our activation function will result in dropping 95% of the preactivations and make it significantly sparser. Another benefit of this approach is simplicity, as this does not require changing the loss function or the training regime. b) where b − − ∈ Figure 8a shows that the shifted ReLU activation function has on-par accuracy with the ReLU activation function. Moreover, similar to our observation in Sec. 4, the shifted ReLU activation quickly recovers the lost performance due to the drastic change of activation function, while it also maintains a very high-level activation sparsity during the finetuning stage. The gap between shifted ReLU and ReLU is wider in the early stages of training, and it narrows down when more tokens are seen. A deeper investigation of ReLU-variants that can promote sparsity without sacrificing performance is an appealing future direction. Moreover, it will be interesting to study the impact of the shifted ReLU for stage-2 of our relufication process where the sparsity level is usually not very high. 8 050100150200250Tokens0102030405060708090100AggregatedSparsity(%)mean18162432Layer050100150200250Tokens020406080100AggregatedSparsity(%)Layer8,actual8,random24,actual24,random248163264γ1050100200350WikitextPerplexity15.116.718.824.7AggregatedReuseRandomReuseNoReuse248163264γ1.01.11.21.31.41.5SpeedupAggregatedSparsityRandomSparsityNoSparsity A PREPRINT (a) (b) Figure 8: The effect of shifted ReLU on Llama model. (a) The performance is almost the same as the original ReLU. (b) Shifted ReLU (i.e., ReLU(x 1)) is much sparser than the original ReLU. − 6 Conclusion In this study, we conducted a large-scale investigation of the activation functions, and we have shown that the choice of activation functions during pretraining and finetuning does not have a significant impact on performance while using ReLU can provide an additional benefit of leading to activation sparsity and more efficient inference. To bridge the gap between existing pre-trained models and our work, we have relufied several models to incorporate the ReLU activation function into the architecture of these already pre-trained models. We have shown that across several zero- shot and few-shot tasks, the ReLU-based LLMs perform similarly to their non-ReLU models at a significantly reduced computation. In addition, after observing sparsity patterns in ReLU LLMs, we explored a few promising directions to improve the token generation speed through aggregated sparsity and achieve greater efficiency using ReLU-based activation functions like shifted ReLU. We believe our work is among the few studies that investigate changes in the architectural components of LLMs on a large scale. We hope our findings motivate the community to further investigate the advantages of well-structured activation sparsity, ultimately enhancing the efficiency of these models. Acknowledgments The authors would like to thank Fartash Faghri, Minsik Cho, Thomas Merth, and Mohammad Samragh for their invaluable discussions and feedback on this project. 9 01251015BillionTokensFinetuned3040506070Average0-shotAccuarcyLlamaActivationSiLUReLUShiftedReLU01251015BillionTokensFinetuned02040608095100AverageActivationSparsityLlamaActivationShiftedReLUReLUSiLU A PREPRINT References [1] Rishabh Agarwal, Nino Vieillard, Piotr Stanczyk, Sabela Ramos, Matthieu Geist, and Olivier Bachem. Gkd: Generalized knowledge distillation for auto-regressive sequence models. CoRR, 2023. [2] Ebtesam Almazrouei, Hamza Alobeidli, Abdulaziz Alshamsi, Alessandro Cappelli, Ruxandra Cojocaru, Maitha Alhammadi, Mazzotta Daniele, Daniel Heslow, Julien Launay, Quentin Malartic, Badreddine Noune, Baptiste Pannier, and Guilherme Penedo. The falcon series of language models: Towards open frontier models. 2023. [3] Reza Yazdani Aminabadi, Samyam Rajbhandari, Ammar Ahmad Awan, Cheng Li, Du Li, Elton Zheng, Olatunji Ruwase, Shaden Smith, Minjia Zhang, Jeff Rasley, et al. Deepspeed-inference: enabling efficient inference of transformer models at unprecedented scale. In SC22: International Conference for High Performance Comput- ing, Networking, Storage and Analysis, pages 1–15. IEEE, 2022. [4] Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. Layer normalization, 2016. [5] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Nee- lakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. [6] S ́ebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023. [7] Jerry Chee, Yaohui Cai, Volodymyr Kuleshov, and Christopher De Sa. Quip: 2-bit quantization of large language models with guarantees. CoRR, abs/2307.13304, 2023. doi: 10.48550/arXiv.2307.13304. [8] Tianyu Chen, Shaohan Huang, Yuan Xie, Binxing Jiao, Daxin Jiang, Haoyi Zhou, Jianxin Li, and Furu Wei. Task-specific expert pruning for sparse mixture-of-experts. ArXiv, abs/2206.00277, 2022. [9] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022. [10] Djork-Arn ́e Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network learning by exponential linear units (elus). In Yoshua Bengio and Yann LeCun, editors, 4th International Conference on Learning Representations, ICLR 2016, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, 2016. [11] Yann N. Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. In Proceedings of the 34th International Conference on Machine Learning - Volume 70, ICML'17, page 933–941. JMLR.org, 2017. [12] Tim Dettmers, Mike Lewis, Younes Belkada, and Luke Zettlemoyer. Llm. int8 (): 8-bit matrix multiplication for transformers at scale. arXiv preprint arXiv:2208.07339, 2022. [13] Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. Qlora: Efficient finetuning of quantized llms. CoRR, 2023. [14] Tim Dettmers, Ruslan Svirschevski, Vage Egiazarian, Denis Kuznedelev, Elias Frantar, Saleh Ashkboos, Alexan- der Borzunov, Torsten Hoefler, and Dan Alistarh. Spqr: A sparse-quantized representation for near-lossless LLM weight compression. CoRR, abs/2306.03078, 2023. doi: 10.48550/arXiv.2306.03078. [15] Gaochen Dong and Wei Chen. Blockwise compression of transformer-based models without retraining. arXiv preprint arXiv:2304.01483, 2023. [16] Nan Du, Yanping Huang, Andrew M. Dai, Simon Tong, Dmitry Lepikhin, Yuanzhong Xu, Maxim Krikun, Yanqi Zhou, Adams Wei Yu, Orhan Firat, Barret Zoph, Liam Fedus, Maarten P. Bosma, Zongwei Zhou, Tao Wang, Yu Emma Wang, Kellie Webster, Marie Pellat, Kevin Robinson, Kathleen S. Meier-Hellstern, Toju Duke, Lucas Dixon, Kun Zhang, Quoc V. Le, Yonghui Wu, Zhifeng Chen, and Claire Cui. Glam: Efficient scaling of language models with mixture-of-experts. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesv ́ari, Gang Niu, and Sivan Sabato, editors, International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, volume 162 of Proceedings of Machine Learning Research, pages 5547–5569. PMLR, 2022. [17] Stefan Elfwing, Eiji Uchibe, and Kenji Doya. Sigmoid-weighted linear units for neural network function approx- imation in reinforcement learning. Neural networks, 107:3–11, 2018. [18] William Fedus, Jeff Dean, and Barret Zoph. A review of sparse expert models in deep learning. ArXiv, abs/2209.01667, 2022. 10 A PREPRINT [19] William Fedus, Barret Zoph, and Noam Shazeer. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. J. Mach. Learn. Res., 23:120:1–120:39, 2022. [20] Elias Frantar and Dan Alistarh. Sparsegpt: Massive language models can be accurately pruned in one- In International Conference on Machine Learning, ICML 2023, 23-29 July 2023, Honolulu, Hawaii, shot. USA, volume 202 of Proceedings of Machine Learning Research, pages 10323–10337. PMLR, 2023. URL https://proceedings.mlr.press/v202/frantar23a.html. [21] Elias Frantar, Saleh Ashkboos, Torsten Hoefler, and Dan Alistarh. GPTQ: accurate post-training quantization for generative pre-trained transformers. CoRR, abs/2210.17323, 2022. doi: 10.48550/arXiv.2210.17323. [22] Kunihiko Fukushima. Visual feature extraction by a multilayered network of analog threshold elements. IEEE Trans. Syst. Sci. Cybern., 5:322–333, 1969. [23] Leo Gao, Jonathan Tow, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Golding, Jeffrey Hsu, Kyle McDonell, Niklas Muennighoff, Jason Phang, Laria Reynolds, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, September 2021. URL https://doi.org/10.5281/zenodo.5371628. [24] Yuxian Gu, Li Dong, Furu Wei, and Minlie Huang. Knowledge distillation of large language models. CoRR, 2023. [25] Song Han, Xingyu Liu, Huizi Mao, Jing Pu, Ardavan Pedram, Mark A. Horowitz, and William J. Dally. Retro- spective: Eie: Efficient inference engine on sparse and compressed neural network, 2023. [26] Hussein Hazimeh, Zhe Zhao, Aakanksha Chowdhery, Maheswaran Sathiamoorthy, Yihua Chen, Rahul Mazumder, Lichan Hong, and Ed H. Chi. Dselect-k: Differentiable selection in the mixture of experts with applications to multi-task learning. In Neural Information Processing Systems, 2021. [27] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016. [28] Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016. [29] Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Stein- In 9th International Conference on Learning hardt. Measuring massive multitask language understanding. Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. URL https: //openreview.net/forum?id=d7KBjmI3GmQ. [30] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. CoRR, 2015. [31] Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, Tom Hennigan, Eric Noland, Katie Milli- can, George van den Driessche, Bogdan Damoc, Aurelia Guy, Simon Osindero, Karen Simonyan, Erich Elsen, Jack W. Rae, Oriol Vinyals, and Laurent Sifre. Training compute-optimal large language models. CoRR, abs/2203.15556, 2022. doi: 10.48550/arXiv.2203.15556. [32] Jiri Hron, Yasaman Bahri, Jascha Sohl-Dickstein, and Roman Novak. Infinite attention: NNGP and NTK for deep attention networks. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pages 4376–4386. PMLR, 2020. [33] Cheng-Yu Hsieh, Chun-Liang Li, Chih-Kuan Yeh, Hootan Nakhost, Yasuhisa Fujii, Alex Ratner, Ranjay Krishna, Chen-Yu Lee, and Tomas Pfister. Distilling step-by-step! outperforming larger language models with less training data and smaller model sizes. In Findings of the Association for Computational Linguistics: ACL 2023, Toronto, Canada, July 9-14, 2023, pages 8003–8017. Association for Computational Linguistics, 2023. URL https: //doi.org/10.18653/v1/2023.findings-acl.507. [34] Ranggi Hwang, Jianyu Wei, Shijie Cao, Changho Hwang, Xiaohu Tang, Ting Cao, Mao Yang, and Minsoo Rhu. Pre-gated moe: An algorithm-system co-design for fast and scalable mixture-of-expert inference. arXiv preprint arXiv:2308.12066, 2023. [35] Ajay Jaiswal, Shiwei Liu, Tianlong Chen, and Zhangyang Wang. The emergence of essential sparsity in large pre-trained models: The weights that matter. CoRR, 2023. [36] Sebastian Jaszczur, Aakanksha Chowdhery, Afroz Mohiuddin, Lukasz Kaiser, Wojciech Gajewski, Henryk Michalewski, and Jonni Kanerva. Sparse is enough in scaling transformers. In Advances in Neural Informa- tion Processing Systems, 2021. URL https://openreview.net/forum?id=-b5OSCydOMe. [37] Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. CoRR, abs/2001.08361, 2020. URL https://arxiv.org/abs/2001.08361. 11 A PREPRINT [38] Jeonghoon Kim, Jung Hyun Lee, Sungdong Kim, Joonsuk Park, Kang Min Yoo, Se Jung Kwon, and Dongsoo Lee. Memory-efficient fine-tuning of compressed large language models via sub-4-bit integer quantization. CoRR, abs/2305.14152, 2023. doi: 10.48550/arXiv.2305.14152. URL https://doi.org/10.48550/arXiv. 2305.14152. [39] Sehoon Kim, Coleman Hooper, Amir Gholami, Zhen Dong, Xiuyu Li, Sheng Shen, Michael W. Mahoney, and Kurt Keutzer. Squeezellm: Dense-and-sparse quantization. CoRR, abs/2306.07629, 2023. doi: 10.48550/arXiv. 2306.07629. [40] Sehoon Kim, Coleman Hooper, Thanakul Wattanawong, Minwoo Kang, Ruohan Yan, Hasan Genc, Grace Dinh, Qijing Huang, Kurt Keutzer, Michael W Mahoney, et al. Full stack optimization of transformer inference. In Architecture and System Support for Transformer Models (ASSYST@ ISCA 2023), 2023. [41] Sehoon Kim, Karttikeya Mangalam, Suhong Moon, John Canny, Jitendra Malik, Michael W. Mahoney, Amir Gholami, and Kurt Keutzer. Speculative decoding with big little decoder, 2023. [42] G ̈unter Klambauer, Thomas Unterthiner, Andreas Mayr, and Sepp Hochreiter. Self-normalizing neural networks. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett, editors, Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 971–980, 2017. [43] Rui Kong, Yuanchun Li, Qingtian Feng, Weijun Wang, Linghe Kong, and Yunxin Liu. Serving moe models on resource-constrained edge devices via dynamic expert swapping, 2023. [44] Mark Kurtz, Justin Kopinsky, Rati Gelashvili, Alexander Matveev, John Carr, Michael Goin, William Leiserson, Sage Moore, Nir Shavit, and Dan Alistarh. Inducing and exploiting activation sparsity for fast inference on deep neural networks. In International Conference on Machine Learning, pages 5533–5543. PMLR, 2020. [45] Changhun Lee, Jungyu Jin, Taesu Kim, Hyungjun Kim, and Eunhyeok Park. OWQ: lessons learned from activation outliers for weight quantization in large language models. CoRR, abs/2306.02272, 2023. doi: 10.48550/arXiv.2306.02272. [46] Yaniv Leviathan, Matan Kalman, and Yossi Matias. Fast inference from transformers via speculative decoding. In Andreas Krause, Emma Brunskill, Kyunghyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett, editors, International Conference on Machine Learning, ICML 2023, 23-29 July 2023, Honolulu, Hawaii, USA, volume 202 of Proceedings of Machine Learning Research, pages 19274–19286. PMLR, 2023. [47] Zonglin Li, Chong You, Srinadh Bhojanapalli, Daliang Li, Ankit Singh Rawat, Sashank J Reddi, Ke Ye, Felix Chern, Felix Yu, Ruiqi Guo, et al. Large models are parsimonious learners: Activation sparsity in trained transformers. arXiv preprint arXiv:2210.06313, 2022. [48] Zonglin Li, Chong You, Srinadh Bhojanapalli, Daliang Li, Ankit Singh Rawat, Sashank J. Reddi, Ke Ye, Felix Chern, Felix X. Yu, Ruiqi Guo, and Sanjiv Kumar. The lazy neuron phenomenon: On emergence of activation sparsity in transformers. In The Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023. OpenReview.net, 2023. [49] Ji Lin, Jiaming Tang, Haotian Tang, Shang Yang, Xingyu Dang, and Song Han. AWQ: activation-aware weight quantization for LLM compression and acceleration. CoRR, abs/2306.00978, 2023. doi: 10.48550/arXiv.2306. 00978. [50] Zechun Liu, Barlas Oguz, Changsheng Zhao, Ernie Chang, Pierre Stock, Yashar Mehdad, Yangyang Shi, Raghu- raman Krishnamoorthi, and Vikas Chandra. Llm-qat: Data-free quantization aware training for large language models. CoRR, 2023. [51] Zichang Liu, Jue Wang, Tri Dao, Tianyi Zhou, Binhang Yuan, Zhao Song, Anshumali Shrivastava, Ce Zhang, Yuandong Tian, Christopher Re, et al. Deja vu: Contextual sparsity for efficient llms at inference time. In International Conference on Machine Learning, pages 22137–22176. PMLR, 2023. [52] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019. URL https://openreview.net/forum?id=Bkg6RiCqY7. [53] Xinyin Ma, Gongfan Fang, and Xinchao Wang. Llm-pruner: On the structural pruning of large language models. arXiv preprint arXiv:2305.11627, 2023. [54] Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Confer- ence Track Proceedings. OpenReview.net, 2017. 12 A PREPRINT [55] Seyed Iman Mirzadeh, Mehrdad Farajtabar, Ang Li, Nir Levine, Akihiro Matsukawa, and Hassan Ghasemzadeh. Improved knowledge distillation via teacher assistant. In Proceedings of the AAAI conference on artificial intel- ligence, volume 34, pages 5191–5198, 2020. [56] NLP Team MosaicML. Introducing mpt-7b: A new standard for open-source, commercially usable llms, 2023. URL www.mosaicml.com/blog/mpt-7b. [57] Sharan Narang, Hyung Won Chung, Yi Tay, Liam Fedus, Thibault F ́evry, Michael Matena, Karishma Malkan, Noah Fiedel, Noam Shazeer, Zhenzhong Lan, Yanqi Zhou, Wei Li, Nan Ding, Jake Marcus, Adam Roberts, and Colin Raffel. Do transformer modifications transfer across implementations and applications? In Marie-Francine Moens, Xuanjing Huang, Lucia Specia, and Scott Wen-tau Yih, editors, Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, EMNLP 2021, Virtual Event / Punta Cana, Dominican Republic, 7-11 November, 2021, pages 5758–5773. Association for Computational Linguistics, 2021. [58] Gunho Park, Baeseong Park, Minsub Kim, Sungjae Lee, Jeonghoon Kim, Beomseok Kwon, Se Jung Kwon, Byeongwook Kim, Youngjoo Lee, and Dongsoo Lee. Lut-gemm: Quantized matrix multiplication based on luts for efficient inference in large-scale generative language models. CoRR, 2023. [59] Guilherme Penedo, Quentin Malartic, Daniel Hesslow, Ruxandra Cojocaru, Alessandro Cappelli, Hamza Alobei- dli, Baptiste Pannier, Ebtesam Almazrouei, and Julien Launay. The refinedweb dataset for falcon LLM: outperforming curated corpora with web data, and web data only. CoRR, abs/2306.01116, 2023. doi: 10.48550/arXiv.2306.01116. [60] Reiner Pope, Sholto Douglas, Aakanksha Chowdhery, Jacob Devlin, James Bradbury, Jonathan Heek, Kefan Xiao, Shivani Agrawal, and Jeff Dean. Efficiently scaling transformer inference. Proceedings of Machine Learn- ing and Systems, 5, 2023. [61] Joan Puigcerver, Carlos Riquelme, Basil Mustafa, and Neil Houlsby. From sparse to soft mixtures of experts. arXiv preprint arXiv:2308.00951, 2023. [62] Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. Zero: memory optimizations toward train- ing trillion parameter models. In Christine Cuicchi, Irene Qualters, and William T. Kramer, editors, Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, SC 2020, Virtual Event / Atlanta, Georgia, USA, November 9-19, 2020, page 20. IEEE/ACM, 2020. [63] Samyam Rajbhandari, Conglong Li, Zhewei Yao, Minjia Zhang, Reza Yazdani Aminabadi, Ammar Ahmad Awan, Jeff Rasley, and Yuxiong He. Deepspeed-moe: Advancing mixture-of-experts inference and training to power next-generation AI scale. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesv ́ari, Gang Niu, and Sivan Sabato, editors, International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, volume 162 of Proceedings of Machine Learning Research, pages 18332–18346. PMLR, 2022. [64] Prajit Ramachandran, Barret Zoph, and Quoc V Le. Searching for activation functions. arXiv preprint arXiv:1710.05941, 2017. [65] Michael Santacroce, Zixin Wen, Yelong Shen, and Yuanzhi Li. What matters in the structured pruning of gener- ative language models? CoRR, 2023. [66] Noam Shazeer. Glu variants improve transformer, 2020. [67] Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc V. Le, Geoffrey E. Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017. [68] Kai Shen, Junliang Guo, Xu Tan, Siliang Tang, Rui Wang, and Jiang Bian. A study on relu and softmax in transformer. CoRR, 2023. [69] Ying Sheng, Lianmin Zheng, Binhang Yuan, Zhuohan Li, Max Ryabinin, Beidi Chen, Percy Liang, Christopher R ́e, Ion Stoica, and Ce Zhang. Flexgen: High-throughput generative inference of large language models with a single GPU. In Andreas Krause, Emma Brunskill, Kyunghyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett, editors, International Conference on Machine Learning, ICML 2023, 23-29 July 2023, Hon- olulu, Hawaii, USA, volume 202 of Proceedings of Machine Learning Research, pages 31094–31116. PMLR, 2023. [70] Zhao Song, Lichen Zhang, and Ruizhe Zhang. Training multi-layer over-parametrized neural network in sub- quadratic time, 2021. [71] Mingjie Sun, Zhuang Liu, Anna Bair, and J. Zico Kolter. A simple and effective pruning approach for large language models. CoRR, 2023. 13 A PREPRINT [72] NLLB Team, Marta R. Costa-juss`a, James Cross, Onur C ̧ elebi, Maha Elbayad, Kenneth Heafield, Kevin Hef- fernan, Elahe Kalbassi, Janice Lam, Daniel Licht, Jean Maillard, Anna Sun, Skyler Wang, Guillaume Wenzek, Al Youngblood, Bapi Akula, Loic Barrault, Gabriel Mejia Gonzalez, Prangthip Hansanti, John Hoffman, Se- marley Jarrett, Kaushik Ram Sadagopan, Dirk Rowe, Shannon Spruit, Chau Tran, Pierre Andrews, Necip Fazil Ayan, Shruti Bhosale, Sergey Edunov, Angela Fan, Cynthia Gao, Vedanuj Goswami, Francisco Guzm ́an, Philipp Koehn, Alexandre Mourachko, Christophe Ropers, Safiyyah Saleem, Holger Schwenk, and Jeff Wang. No lan- guage left behind: Scaling human-centered machine translation, 2022. [73] Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timoth ́ee Lacroix, Bap- tiste Rozi`ere, Naman Goyal, Eric Hambro, Faisal Azhar, Aur ́elien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models. CoRR, abs/2302.13971, 2023. [74] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett, editors, Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 5998–6008, 2017. [75] Mitchell Wortsman, Jaehoon Lee, Justin Gilmer, and Simon Kornblith. Replacing softmax with relu in vision transformers, 2023. [76] Guangxuan Xiao, Ji Lin, Micka ̈el Seznec, Hao Wu, Julien Demouth, and Song Han. Smoothquant: Accurate and efficient post-training quantization for large language models. In Andreas Krause, Emma Brunskill, Kyunghyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett, editors, International Conference on Machine Learning, ICML 2023, 23-29 July 2023, Honolulu, Hawaii, USA, volume 202 of Proceedings of Machine Learn- ing Research, pages 38087–38099. PMLR, 2023. [77] Rongjie Yi, Liwei Guo, Shiyun Wei, Ao Zhou, Shangguang Wang, and Mengwei Xu. Edgemoe: Fast on-device inference of moe-based large language models. arXiv preprint arXiv:2308.14352, 2023. [78] Biao Zhang and Rico Sennrich. Root mean square layer normalization. In Hanna M. Wallach, Hugo Larochelle, Alina Beygelzimer, Florence d'Alch ́e-Buc, Emily B. Fox, and Roman Garnett, editors, Advances in Neural In- formation Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pages 12360–12371, 2019. [79] Mingyang Zhang, Hao Chen, Chunhua Shen, Zhen Yang, Linlin Ou, Xinyi Yu, and Bohan Zhuang. Pruning meets low-rank parameter-efficient fine-tuning. CoRR, 2023. [80] Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona T. Diab, Xian Li, Xi Victoria Lin, Todor Mihaylov, Myle Ott, Sam Shleifer, Kurt Shuster, Daniel Simig, Punit Singh Koura, Anjali Sridhar, Tianlu Wang, and Luke Zettlemoyer. OPT: open pre-trained transformer language models. CoRR, abs/2205.01068, 2022. [81] Zhengyan Zhang, Yankai Lin, Zhiyuan Liu, Peng Li, Maosong Sun, and Jie Zhou. Moefication: Transformer feed-forward layers are mixtures of experts. In Smaranda Muresan, Preslav Nakov, and Aline Villavicencio, editors, Findings of the Association for Computational Linguistics: ACL 2022, Dublin, Ireland, May 22-27, 2022, pages 877–890. Association for Computational Linguistics, 2022. [82] Xunyu Zhu, Jian Li, Yong Liu, Can Ma, and Weiping Wang. A survey on model compression for large language models. CoRR, 2023. [83] Barret Zoph, Irwan Bello, Sameer Kumar, Nan Du, Yanping Huang, Jeff Dean, Noam Shazeer, and William Fedus. St-moe: Designing stable and transferable sparse expert models. arXiv preprint arXiv:2202.08906, 2022. 14 A PREPRINT Appendix A Extended Related Works Activation Functions. ReLU, introduced by [22], remains a predominant activation function for deep neural networks and was notably utilized in the original transformers work [74]. SwiGLU [66] has been shown to enhance performance when replacing ReLU in feedforward layers and is a feature in models like Llama [73]. Narang et al. [57] conducted an extensive comparison of various activation functions, such as GeLU, SiLU [28, 17], ELU [10], SeLU [42], and GLU variants [11], identifying certain advantages over ReLU. Our paper and results differ from theirs by training billion scale models and data as opposed to their smaller scale ones. Furthermore, our results indicate that extended training can diminish the performance gap between ReLU and these other functions, also leading to savings in computational costs. Activation Sparsity. A body of prior research [44, 25, 70] has demonstrated that increasing sparsity can lead to reductions in both inference and training times. Dejavu [51] and [47] observed pronounced sparsity in activations when using the ReLU function in feedforward layers. These studies propose that predicting this sparsity can further boost inference speeds. Similarly, [36] employed ReLU activations and introduced a controller to actively promote sparsity. Notably, these studies predominantly focus on networks employing ReLU activations, leaving out those with alternative activation functions. In contrast, our approach modifies networks by substituting other activation functions with ReLU. We then fine-tune these networks to achieve activation sparsity in the MLP layer post-ReLUfication. We further illustrate that inserting ReLU prior to the QKV and Feedforward layers can substantially reduce FLOPS, albeit at a minor cost to accuracy. Unlike the aforementioned studies, we do not utilize a sparsity predictor to minimize FLOPS. ReLU in Attention Mechanisms. Beyond the activation function in the MLPs of large language models, a softmax activation is often employed within the attention module. Prior studies have indicated that it's feasible to replace this softmax with ReLU without compromising accuracy [75, 68, 32]. This avenue of research is distinct from our approach of Relufication, which specifically focuses on activations preceding weight multiplications. Model compression for efficient inference Quantization, pruning and distillation are the main three techniques for compressing neural networks [82]. Quantization has been used to reduce model size and faster inference [13, 50, 58, 12, 49, 45, 14, 39, 7, 76]. The quantized model occupies less space reducing the memory latency [21, 38]. Reluification is orthogonal to quantization and reduces the amount of memory required to be loaded and can further decrease the memory latency. Distillation [33, 30, 24, 55, 1] is another technique to train smaller models. This is orthogonal to using ReLU activations as any activation can be used in distillation methods. Sparsifying or pruning weights of neural networks [20, 35, 79, 71, 65, 53] can reduce computation and inference time. Weight sparsity is usually unstructured and hard to implement for hardware, but the sparsity induced by ReLU can easily be implemented as a matrix multiplication of non zero rows. Weight sparse models can be combined with our relufication for further decrease in compute. Mixture of Experts. Mixture of Experts (MoE) LLMs usually subdivide the feed-forward layer into multiple experts. A router is then employed to selectively and sparsely activate these experts [67, 19, 72]. Similar to our work, MoE is a form of activation sparsity but in a group form and can be seen as a subset of sparse activation. Subsequent studies have further refined the inference and training methodologies for MoE models [61, 34, 77, 16, 43, 63, 83, 8, 26]. MoE can be also combined with Relufication, having sparsity inside FFN of each expert. Another line of work is MoEfication of networks that have sparse activations by subdividing neurons [81]. Relufication can also help MoEfication be applicable to a wider range of networks by increasing sparsity of FFNs. For a more in depth review of mixture of expert models we refer the reader to [18]. Speculative Decoding and Sparsity. Speculative decoding is a method that aims to improve model latency when faced with memory bandwidth constraints [46, 41]. It involves using a smaller model to predict the next tokens, with a larger model subsequently verifying multiple tokens in a single operation. In this work, we examine the direct effects of incorporating sparsity into speculative decoding. We show that adding sparsity can lead to performance improvements in speculative decoding. Additionally, we provide guidelines on selecting parameters for speculative decoding when sparsity is introduced. B Discussion on Activation Sparsity and Inference Efficiency The primary motivation behind our work is to enhance efficiency, and we believe it is essential to provide a precise definition of this term. Throughout the main text, we predominantly use FLOPS as our efficiency metric. In this 15 A PREPRINT section, we argue why, in the presence of activation sparsity, FLOPS can serve as a suitable proxy for measuring various efficiency metrics. Firstly, it is important to be reminded of the two major factors contributing to the efficiency of Large Language Models (LLMs): (1) the total amount of computation and (2) input/output (IO) transfer-i.e., transferring parameters from RAM to CPU/GPU for calculations. Notably, for today's large models, factor (2) acts as the major bottleneck during the inference phase. We refer the reader to the detailed analysis by Liu et al. [51]. Ultimately, for a specific target device and assuming an efficient implementation, we believe that the most practical measure of efficiency is latency (e.g., the average time to generate a token). However, each device possesses its unique properties, necessitating a more ubiquitous proxy metric. (a) sparse vector, dense matrix multiplication: by skipping rows, we reduce both the weight transfer (i.e., loading these rows for computation) and com- putation (i.e., the result will be zero). (b) Comparing FLOPS versus real latency for OPT model (FFN). Figure 9: For LLMs that have sparse activations, FLOPS is a good approximation of the real latency. We argue that the way we calculated FLOPS in our paper and is greatly influenced by activation sparsity can reason- ably approximate efficiency. Here are our reasons: • Reduced Computation: As shown in Fig. 9a, with activation sparsity, we have a sparse vector-dense matrix multi- plication at inference, while this will be a sparse-matrix-dense matrix multiplication during training. It is important to note that this is a semi-structured sparsity (unlike magnitude weight pruning), and we can leverage the fact that we are transferring weights in large chunks (i.e., rows). Modern accelerators already support sparse operations3 and we can build on these existing tools. • Reduced IO Transfer: During inference, weights need to be transferred to the device cache for computation (e.g., from RAM to CPU cache or GPU VRAM to GPU cache). This step constitutes the main bottleneck during token generation. For instance, approximately 99.3% of the total latency is attributed to IO, as indicated by Liu et al. [51]. However, by storing matrices in a row-major order, we can skip loading unnecessary rows as the output will be zero. Overall, as depicted in Figure 9b based on the calculations by Liu et al. [51], we demonstrate that for the OPT model on an NVIDIA A100 node, counting FLOPS provides a reasonable approximation to and is highly correlated with the time needs to generate tokens, especially, for LLMs with activation sparsity. C Activation Sparsity and Speculative Decoding Speculative decoding [46] is a technique that uses a smaller model Mq to propose γ tokens and a larger model Mp to verify those tokens and selects matching ones. This technique improves the runtime of the model by avoiding running Mp sequentially per all tokens. To further improve the speculative decoding inference, we can leverage sparsity as follows. Latency model. We assume a simple conceptual model for latency in speculative decoding. Following Deja Vu [51] latency can be broken down into compute and I/O latency. The compute latency is negligible to I/O. Also, notice that the Speculative decoding is meant for the constraints that memory bandwidth is the bottleneck. Therefore we only compare I/O latency between sparse and non-sparse models. If the average aggregated sparsity of Mp for γ 3For example, both cuSPARSE on NVIDIA CUDA® and Accelerate on Apple devices. 16 T*T*=102030405060708090100ActivationSparsity(%)255075100125150175200Latency(ms)MethodRealFLOPSApproximation A PREPRINT − tokens is ̄sagg(γ), and runtime of Mp is T , we approximate the latency of running Mp for γ consecutive tokens with (1 ̄sagg(γ))T . As discussed in the previous section, this is a good approximation of real latency. Theoretical latency improvement. Assume the smaller model Mq operates c times faster than the cumbersome model Mp. As per the primary text, token acceptances are assumed to follow an independent and identically distributed (i.i.d.) behavior. Denote α as the expected probability of a token generated by Mq being approved by Mp. The following theorems hold: Theorem 1. The expected improvement factor in latency for speculative decoding with sparsity, over standard specu- lative decoding is cγ+1 cγ+(1− ̄sagg(γ)) . Proof. The amount of time required to run sparsified model is quantified as T cγ + (1 ̄sagg(γ))T . It is the time of running a smaller model plus a larger model's non-sparse portion. Run time of speculative decoding without sparsity is T cγ + T . The number of generated tokens in both is the same. Therefore the relative speedup of using sparsity is given by: − T cγ+T T cγ+(1− ̄sagg(γ))T . Theorem 2. The expected improvement factor in latency, when combining sparsity with speculative decoding against normal (autoregressive) decoding using only Mp, is 1−αγ+1 (cγ+(1− ̄sagg(γ)))(1−α) . Proof. Similar to theorem above T cγ + (1 ̄sagg(γ))T gives the time required for sparse speculative decoding. According to the original paper, the standard speculative decoding yields an average of 1−αγ+1 tokens generated 1−α per each run [46]. Thus, the anticipated run time when generating tokens with sparsity during speculative decoding becomes (cγ+(1− ̄sagg(γ)))(1−α) T . Given the runtime for producing a single token via an autoregressive approach is T , the inverse of this fraction gives the desired results. 1−αγ+1 − Optimal γ. The optimal γ for speculative decoding can be found by optimizing the speedup factor equation in Theorem 2. When sparsity is not present, the equation can be solved numerically, but for reluified networks, the aggregated sparsity for different γ's will affect the final results. We have found optimal γs based on ̄sagg(γ) for OPT 6.7B and presented the results in figure 10a. The chosen γ for sparse speculative decoding is smaller than standard speculative decoding since higher γ will result in less sparsity. The gap in γ is always less than 20%. Also, in figure 10b, it can be seen for the specific case of α = 0.8, c = 0.02, the sparse speculative decoding has the highest speed- up factor over autoregressive at γ = 10s vs standard version's optimal point which happens for γ = 12. Sparse speculative decoding at γ = 12 is better than standard speculative decoding at γ = 12, while sparse speculative decoding at γ = 10 beats both. Another observation from 10b is for the case of purely random sparsity, the benefit of sparse speculative decoding would diminish over standard speculative decoding in higher γs. In contrast, the benefits of aggregated sparsity would last for larger values of γ. (a) (b) Figure 10: (a) optimal γ for sparse speculative decoding (b) speed up of sparse speculative decoding and standard speculative decoding over autoregressive decoding when α = 0.8 and c = 0.02 17 0.500.550.600.650.700.750.800.850.90α510152025Optimalγc=0.01SparseSpeculativec=0.01StandardSpeculativec=0.05SparseSpeculativec=0.05StandardSpeculative01020304050γ1.01.52.02.53.03.54.04.55.0Speedupα=0.8AggregatedSparsityRandomSparsityStandardSpeculativeDecoding A PREPRINT D Pre-activation Distribution of OPT models trained from scratch The distribution of pre-activation inputs is suspected to be the main factor determining the amount of sparsity. As we saw in Sec. 4.1, the pre-activation distribution for Llama and Falcon differs a lot. One may wonder that if we control for the training data and optimization algorithm, would the shapes of the distribution differ? To this end, we train OPT 1.3B models from scratch using our four variants of the activation function and depicted the pre-activation distribution along the training in Fig. 11. They start from the exact figure but gradually diverge. From SiLU to ReLU (increasing β), the pre-activation distribution becomes more concentrated around 0 and would be almost uni-modal. Further investigations on the dynamics of pre- and post-activations and their relation to efficiency and accuracy are left as an exciting future direction for research. Figure 11: Pre-activation distributions of various OPT 1.3B models with all four types of activations trained from scratch at various number of seen tokens during training. E Is a sparsified large model better than dense smaller ones? When it comes to deploying efficient models, one may naturally use an original smaller-size (dense) model. The argument would be the performance of the relufied larger model might be already equal to or less than the smaller dense model. To study the above question, we plotted the performance vs. efficiency of the original and the relufied OPT models in Fig. 12. Taking the relufied OPT 6.7B model as an example, it operates at 2.8 GFLPOPs per token. Interpolating the blue line (that can be seen as a scaling plot of the OPT model), a dense model with equivalent FLOPS falls more than 2% short in zero-shot performance. Similarly, compared to the relufied OPT 2.7B model, the equivalent (in FLOPS) dense model performs almost 2% lower. Indeed, the fact that the relufied models lie well above the scaling graph of the original OPT models, shows the effectiveness of relufication processes as a method to get better but more efficient models. As a side benefit, it makes the efficiency spectrum of the available LLMs more continuous. For example, consider a combination of hardware and use case that only allows deploying LLMs with lower than 3 GFLOPS during inference. Going with standard pretrained models, the only available option is OPT 2.7B with almost 1 GFLOPS, as the 6.7B does not satisfy the hardware constraint. In this situation, our relufied model not only falls in the limited inference budget but is also very 18 −10010Pre-ActivationValue01020304050Ratio(%)β→∞(ReLU)init−10010Pre-ActivationValue01020304050Ratio(%)β→∞(ReLU)25B−10010Pre-ActivationValue01020304050Ratio(%)β→∞(ReLU)50B−10010Pre-ActivationValue01020304050Ratio(%)β→∞(ReLU)100B181624Layer−10010Pre-ActivationValue01020304050Ratio(%)β=8−10010Pre-ActivationValue01020304050Ratio(%)β=8−10010Pre-ActivationValue01020304050Ratio(%)β=8−10010Pre-ActivationValue01020304050Ratio(%)β=8181624Layer−10010Pre-ActivationValue01020304050Ratio(%)β≈1.7(GELU)−10010Pre-ActivationValue01020304050Ratio(%)β≈1.7(GELU)−10010Pre-ActivationValue01020304050Ratio(%)β≈1.7(GELU)−10010Pre-ActivationValue01020304050Ratio(%)β≈1.7(GELU)181624Layer−10010Pre-ActivationValue01020304050Ratio(%)β=1(SiLU)−10010Pre-ActivationValue01020304050Ratio(%)β=1(SiLU)−10010Pre-ActivationValue01020304050Ratio(%)β=1(SiLU)−10010Pre-ActivationValue01020304050Ratio(%)β=1(SiLU)181624Layer close to the next largest available model in terms of accraucy. An exciting and timely direction for future research is finding methods, that, given an LLM (or a family of LLMs), are able to produce the best performing model matching the specified inference computation budget. A PREPRINT Figure 12: Performance of sparse large models vs. dense smaller models: The relufied large models (red stars) are above the scaling curve of original dense models (blue circles and dashed line). 19 1.01.82.84.5GFLOPSPerToken50.554.059.0Average0-shotAccuarcyOPT1.3BOPT2.7BOPT2.7B(stage-1)OPT6.7BOPT6.7B(stage-2)
http://arxiv.org/abs/2310.04561v1
"2023-10-06T19:55:40"
"2023-10-06T19:55:40"
DragD3D: Vertex-based Editing for Realistic Mesh Deformations using 2D Diffusion Priors
Direct mesh editing and deformation are key components in the geometric modeling and animation pipeline. Direct mesh editing methods are typically framed as optimization problems combining user-specified vertex constraints with a regularizer that determines the position of the rest of the vertices. The choice of the regularizer is key to the realism and authenticity of the final result. Physics and geometry-based regularizers are not aware of the global context and semantics of the object, and the more recent deep learning priors are limited to a specific class of 3D object deformations. In this work, our main contribution is a local mesh editing method called DragD3D for global context-aware realistic deformation through direct manipulation of a few vertices. DragD3D is not restricted to any class of objects. It achieves this by combining the classic geometric ARAP (as rigid as possible) regularizer with 2D priors obtained from a large-scale diffusion model. Specifically, we render the objects from multiple viewpoints through a differentiable renderer and use the recently introduced DDS loss which scores the faithfulness of the rendered image to one from a diffusion model. DragD3D combines the approximate gradients of the DDS with gradients from the ARAP loss to modify the mesh vertices via neural Jacobian field, while also satisfying vertex constraints. We show that our deformations are realistic and aware of the global context of the objects, and provide better results than just using geometric regularizers.
[ "Tianhao Xie", "Eugene Belilovsky", "Sudhir Mudur", "Tiberiu Popa" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04561v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04561v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.GR", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.GR", "cs.LG" ]
Preprint DragD3D: Vertex-based Editing for Realistic Mesh Deformations using 2D Diffusion Priors Tianhao Xie1, Eugene Belilovsky1,2, Sudhir Mudur1 and Tiberiu Popa1 1Concordia University, Montréal, Canada 2MILA, Montréal, Canada Figure 1: Our vertex-based local editing achieves realistic global context-aware mesh deformation using a few handle points. The user specifies a few mesh vertices (red) as handles, their target positions (blue), and a region of influence (light green). Abstract Direct mesh editing and deformation are key components in the geometric modeling and animation pipeline. Direct mesh editing methods are typically framed as optimization problems combining user-specified vertex constraints with a regularizer that determines the position of the rest of the vertices. The choice of the regularizer is key to the realism and authenticity of the final result. Physics and geometry-based regularizers are not aware of the global context and semantics of the object, and the more recent deep learning priors are limited to a specific class of 3D object deformations. In this work, our main contribution is a local mesh editing method called DragD3D for global context-aware realistic deformation through direct manipulation of a few vertices. DragD3D is not restricted to any class of objects. It achieves this by combining the classic geometric ARAP (as rigid as possible) regularizer with 2D priors obtained from a large-scale diffusion model. Specifically, we render the objects from multiple viewpoints through a differentiable renderer and use the recently introduced DDS loss which scores the faithfulness of the rendered image to one from a diffusion model. DragD3D combines the approximate gradients of the DDS with gradients from the ARAP loss to modify the mesh vertices via neural Jacobian field, while also satisfying vertex constraints. We show that our deformations are realistic and aware of the global context of the objects, and provide better results than just using geometric regularizers. CCS Concepts • Computing methodologies → Mesh geometry models; Machine learning; 3 2 0 2 t c O 6 ] R G . s c [ 1 v 1 6 5 4 0 . 0 1 3 2 : v i X r a 2 1. Introduction T. Xie, E. Belilovsky, S. Mudur & T. Popa / DragD3D Geometric deformation and editing are fundamental operations in the geometric modeling pipeline that have received a lot of attention over the years. Among the many varieties of geometric represen- tations and editing modalities, vertex-based mesh editing through direct manipulation of mesh vertices is particularly appealing for many applications and this constitutes the main focus of this work. Classical direct mesh editing methods [BS07,YLW∗21] employ an optimization framework where the user vertex constraints are com- plemented by a regularizer whose main goal is to keep the rest of the shape realistic. To accomplish this, regularizers either use elas- ticity or geometric priors. These regularizers try to minimize locally computed energies and they often fail for large deformations be- cause: (1) they assume the deformation behavior is homogeneous across the object, which is not true in practice [SZGP05, PJS07] and (2), especially for CAD models, there are global semantic re- lationships between different parts that are lost when only local regularizers are considered. Methods such as iWires [GSMCO09] attempted to address this issue by first analyzing the shape to ex- tract global relationships between parts using a network of curves, but this is not a general solution. One way to address these shortcomings is to use data-driven methods. Data-driven methods use three main strategies: (1) learn the shape space of certain classes of objects and use it to guide the deformations [YM16, WCMN19, YAK∗20, JTM∗21, DYT21, LZZ∗21, YZX∗21, SHM∗22, HHK∗23] (2) learn the deformation behavior from a set of example defor- mations in a supervised manner [SZGP05, PJS07, TMW∗22]. The biggest challenge in these first two strategies is the reliance on real 3D data. While the collection of 3D datasets available for research has greatly improved in the last few years, it is minuscule compared to the richness of 2D images available; it can be argued that a large gap between these two will always exist due to the inherent chal- lenges in 3D acquisition compared to 2D acquisition. (3) Another strategy is to rely on optimizing the shape using 2D priors obtained from large pre-trained 2D models such as CLIP [MKXBP22,GAG∗23,SFL∗23] or stable diffusion [PJBM22, MPCOMA23,TMT∗23], and guide the deformation through differ- ential rendering. This strategy has only been relatively recently ex- plored in the context of 3D shape synthesis from a text prompt, but presently none of these can accommodate user-specified geometric constraints, and it is not obvious how to extend these methods to do so. As a result, in this category, there is very little work in the context of surface editing. In this work, we propose a mesh editing method that allows for direct editing of vertices and combines a local geometric regular- izer with global guidance based on a large-scale image generative model. This novel formulation supports realistic shape deformation of dense meshes through vertex level editing of a small number of vertices. More specifically, given a number of vertex constraints, a region of influence in the model, and a very brief text descrip- tion of the object (could just be the object name, like chair, car, etc.), we optimize deformation for the 3D mesh using the neural Jacobian field for mesh representation and a loss which combines user supplied vertex constraints and ARAP [SA07] for geometric rigidity, and a DDS score obtained from multiple renderings of the object scored against large scale 2D priors to provide the global context. Geometry changes are restricted to the region of influence. We show that our method produces realistic and meaningful defor- mations with just a few user constraints yielding better results than traditional methods. Further, it is not restricted to any specific class or classes of geometric shapes. Our main contribution is a direct 3D mesh editing algorithm that yields a global context-aware realistically deformed mesh by drag- ging just a few mesh vertices. More specific contributions are: • We are the first to integrate the requirement of satisfying user- specified geometric constraints while utilizing the global context obtained through the use of 2D priors from a large-scale genera- tive model. • A novel loss function defined as a weighted combination of user- specified vertex constraints, ARAP, and a DDS score using the 2D prior, collectively optimizes for geometry and realism in the deformed shape. • We introduce a dynamic weighting strategy for the optimiza- tion that gradually accommodates the user constraint in a global context-aware manner. 2. Related Work In basic terms, geometric editing techniques can be divided into data-driven and non-data-driven methods. Non-data-driven shape deformation techniques typically frame the editing operation as an optimization problem [YLW∗21] where user constraints are cou- pled with a regularizer that guides the rest of the shape. Shape regularizers come in two flavors: physically-based regularizers that try to minimize physically-based energy functions, often based on elastic energies [CZW23] and geometric regularizers that try to pre- serve the original shape of the object and are often based on shape differential operators [BS07, SA07, CPSS10]. With the introduction of neural representations of geometry Yang et al. [YBHK21] proposed a neural implicit level set rep- resentation that supports editing operations, but the edited shapes are obtained using an optimization framework with physically- based losses and not data-driven constraints. Yuan et al. [YSL∗22, YSL∗23] proposed a geometric editing method based on the NERF representation. However, the editing is performed using the clas- sical as-rigid-as-possible (ARAP) method applied on a mesh ob- tained from the NERF and which is converted back to the NERF representation afterwards. Regardless of representation, one of the shortcomings of these methods is the lack of a high-level semantic understanding of the object; so they often result in unrealistic deformations. To ad- dress such shortcomings, some papers rely on additional heuristics: [KSSCO08,GSMCO09] such as maintaining the proportion of geo- metric features taking inspiration from CAD design or say, editing the object using a set of salient curves on the object. However, a more general solution is to use a data-driven mechanism to guide the deformation. 2.1. Data-driven Geometric Editing Data-driven geometric editing methods are tailored to the repre- sentation of the underlying geometry. Implicit neural representa- T. Xie, E. Belilovsky, S. Mudur & T. Popa / DragD3D 3 Figure 2: Overview of our method. Input: The user specifies constraints (red vertices moved to new positions in blue). Our approach combines these constraints with a shape regularizer and DDS score (natural image prior) applied on multiple views to perform the mesh deformation. Output: resulting deformation tions such as DeepSDF [PFS∗19] or NERF [MST∗21] are popu- lar due to their generative prowess. Yumar et al. [YM16] proposed a method that uses an implicit occupancy grid to learn the space of shapes from a set of 3D data. Deng et al. [DYT21] propose a method that uses a neural signed distance function representation that also learns a neural shape model from a collection of 3D ob- jects. Both of these methods are limited to a small and specific set of objects. Liu et al. [LZZ∗21] introduced a method that learns a conditional radiance field over an entire object class to guide the deformation behavior. However, all the above methods are subject to the same limitation of being reliant on the availability of relevant 3D data which is much less accessible as compared to 2D images. One way to overcome this limitation is to leverage large-scale image-based models such as CLIP [RKH∗21] or stable diffu- sion [PJBM22]. Since models like CLIP and stable diffusion use text prompts as a controlling mechanism, it has opened the door to text-based 3D generation methods [PJBM22, MKXBP22]. For purposes of shape editing, Hyung et al. [HHK∗23] propose a purely text-based editing framework using a NERF representation and Mikaeili et al. [MPCOMA23] propose a sketch-based editing method using a NERF representation. The latter method is close to ours in spirit in that it uses the SDS loss [PJBM22] to guide the deformation using a sketch-based interface. However, this method does not allow for direct control over the geometry, an operation that is very challenging when using an implicit representation and would also necessitate user interaction in several views. Despite the popularity of the neural implicit representations mentioned above, 3D triangular meshes are still very much in use in many real life applications due to their simplicity, efficiency, and downstream hardware processing support through GPUs. Wang et al. [WCMN19] propose a method that trains an end-to-end network that deforms the source model to resemble the target. Because the method infers per-vertex offset displacements, it is not suited for vertex-based mesh editing say, by specifying only a few vertex con- straints. Wang et al. [YAK∗20] propose a neural cage network that infers cage coordinates of the points inside. Both these networks are trained by combining shape-based Laplacian losses and other heuristics tailored towards generic man-made objects. Therefore despite being neural methods, the deformation behaviour learned is not driven directly by 3D or deformation data. Early data-driven methods [SZGP05, PJS07] focus on learning a deformation behavior from a set of sample poses in terms of de- formation gradients. More recently Tang et al. [TMW∗22] used su- pervision to learn the prior deformation of a specific class of ob- jects, mostly animals from an existing database. All of the above approaches rely not only on the availability of 3D data, but also the availability of sample deformations of the same mesh for super- vised learning. Jakab et al. [JTM∗21] discover key feature points in a dataset of objects and cast the problem as transforming a source 3D object to a target 3D object from the same object category. The feature points used for deformation are not user selected. Further- more, these mesh based methods have similar limitations to their neural counterparts in that they rely on a 3D database of objects of a certain class. To overcome this limitation Gao et al. [GAG∗23] edit a trian- gular mesh using only a text prompt using CLIP embeddings. One major challenge with the CLIP methods is that CLIP embeddings do not encode a viewing direction resulting in ambiguities denoted as the Janus effect [GAG∗23]. The other major challenge is that it seems difficult to accommodate the satisfaction of user-specified geometric constraints. The use of large scale pre-trained models for 2D image editing has been explored in several works. Pan et al. [PTL∗23] propose a method for point-based image editing by optimizing in the la- tent space of the StyleGAN2 generator [KLA∗20]. Similarly, Shi et al. [SXP∗23] and Mou et al. [MWS∗23] achieve something sim- ilar by optimizing the diffusion latent space. In [GSW∗22], 3D textured meshes are generated from the learned latent space of im- ages. Unfortunately, these methods cannot be extended to direct vertex editing of a given 3D mesh, as they are completely reliant 4 T. Xie, E. Belilovsky, S. Mudur & T. Popa / DragD3D on locating the deformed representation in the rich latent space of 2D images. As already mentioned, we do not have that luxury of such a rich latent space for 3D shapes. In our work, we also use the latent space of images, but we use it regularize the 3D geometry by enforcing it to result in a natural image when rendered from an arbitrary view. In summary, our main goal in this work is to provide a general mesh editing method with user-specified vertex constraints that do not involve supervision, hence does not rely on 3D data for training, and produces realistic results without being restricted to a specific class of objects. We achieve this by harnessing the rich and vast knowledge about natural and human-made objects that are repre- sented in today's pre-trained large-scale models in the image for- mat. Our method is described in the following section. 3. Method 3.1. Overview The overview of our proposed method is shown in Figure 2. The user specifies: a set of mesh vertices (red) as handles to drag, paired with a corresponding set of target 3D positions (blue), an optional mask to specify the part of the mesh that is allowed to be modified, and a short (typically one word) prompt generally describing the object (e.g., a car, a chair, etc.). We optimize the modifiable part of the mesh in the gradient do- main [GAG∗23] guided by three losses: (1) l2 distance of the user constraint loss, (2) Delta Denoising Score (DDS) loss which makes the deformed mesh have realistic appearances when rendered from random viewpoints and provides global guidance to our 3D model, and (3) ARAP loss to control the local geometric behavior. The remainder of the paper is organized as follows. Sections 3.2- 3.4 review the neural jacobian fields, the space in which we do the optimization, the Delta Denoising Score, and the As-Rigid-as- possible regularizer respectively. Section 3.5 explains how every- thing fits together and provides additional implementation details. Section 4 presents our experiments and analysis of the method in- cluding ablation studies related to our design decisions, and finally, Section 5 has conclusions, limitations, and future work. 3.2. Neural Jacobian field The neural Jacobian field [AGK∗22] operates in the intrinsic gradi- ent domain of triangular meshes to learn highly-accurate mappings between meshes. For triangular mesh vertices Φ, the per-face Jaco- bian Ji ∈ R3×3 is defined as Ji = Φ∇T i , (1) where ∇T is the gradient operator of triangle ti. Given matrices i Mi ∈ R3×3 for every triangle, we can compute vertex positions Φ∗ whose Jacobians Ji = Φ∗∇T i are least-square closest to Mi by solv- ing the Poisson equation. The solution is obtained by solving the following linear system Φ∗ = L−1A∇T M, (2) where A is the mesh's mass matrix, L is the mesh's Laplacian, and M is the stacking of the input matrices Mi. (For a detailed mathe- matical definition of the Jacobian field, please refer to [AGK∗22]). In another result of interest to this work [GAG∗23], Gao et.al found that when deforming a triangular mesh with guidance from text- to-image models, such as CLIP [RKH∗21], instead of working di- rectly with vertex positions, optimizing the Jacobian field of the mesh can produce a more smoothly-deforming mesh and avoid en- tanglement. 3.3. Delta Denoising Score Score Distillation Sampling(SDS) was introduced in [PJBM22] to use a 2D prior to guide the synthesis of 3D shapes. Delta Denois- ing Score(DDS) [HACO23] extended the SDS mechanism for guid- ance in image editing. Given an input image x, a text embedding z, a denoising model εφ with parameters φ, a randomly sampled time step t ∼ U(0, 1) drawn from the uniform distribution, and noise ε ∼ N (0, I) following a normal distribution, the weighted denois- ing score can be expressed as LDi f f (φ, x, z, ε,t) = w(t)∥εφ(xt , z,t) − ε∥2 2 (3) where w(t) is a weighting function that depends on the time step t, and xt is the x added the noise at time step t. For text-conditioned diffusion models that use classifier-free guidance [HS22], the de- noised image is expressed as ˆεφ(xt , z,t) = (1 + w)εφ(xt , z,t) − wεφ(xt ,t), (4) which is a weighted sum of conditioned and unconditioned denois- ing. Thus, as shown in [PJBM22], given an arbitrary differentiable parametric function gθ that renders images, the gradient of the SDS guidance is given by ∇θLSDS(x, z, ε,t) = ˆεφ((xt , z,t) − ε) ∂xt ∂θ . (5) Using that gradient to optimize the gθ can produce images that look natural. However, for image editing, [HACO23] has shown that SDS can produce non-detailed and blurry outputs due to the noisy gradient. To overcome this problem, DDS was introduced which does two SDS processes for the edited image and refer- ence image respectively, and retrieves the gradient by subtraction of these two, ∇θLDDS = ∇θLSDS(xedit , zedit ) − ∇θLSDS(xre f , zre f ), (6) where xedit and xre f are the edited image and reference image, zedit and zre f are the text prompts of the edited image and reference image. It shows that the DDS has a less noisy gradient and can produce a higher fidelity image in the image editing task. 3.4. As-Rigid-As-Possible Regularizer The ARAP regularizer [SA07] does not penalize any isometric de- formations allowing local rotations, but it penalizes local stretches. More specifically: Lreg = ∑ i ∑ j∈N(i) ′ wi j∥(V i −V ′ j ) − Ri(Vi −Vj)∥2, (7) T. Xie, E. Belilovsky, S. Mudur & T. Popa / DragD3D 5 Figure 3: Gallery of results 1 ′ where Vi is the initial vertex position, V i is the deformed vertex po- sition, N(i) is the set of vertices adjacent to Vi, and Ri is the local estimation rotation matrix for the one ring of vertices around ver- tex i. wi j is the standard cotangent Laplacian weight [MDSB03]. At every iteration, Ri can be computed analytically using SVD de- composition on the local co-variance matrix [Ume91]. 3.5. Putting it all together: DragD3D Suppose a user constraint start point is ci, and target point is c then the user constraint loss is given by ′ i , Luser = N ∑ i=0 ′ ∥c i − ci∥2 2, (8) where N is the number of user-specified handles. The DDS gradient is computed as per equation 6. In our case, suppose the undeformed mesh is Φ, the deformed mesh is ˆΦ, the random viewpoint is vp, the differentiable renderer is g(*), and the text prompt is z, the DDS score of the deformed mesh can be expressed as ∇ ˆΦLDDS = ∇ ˆΦLSDS(g( ˆΦ, vp), z) − ∇ΦLSDS(g(Φ, vp), z). (9) For the denoising model εφ, we use the Stable Diffusion [RBL∗22]. We also applied the As-Rigid-As-Possible energy on the deformed mesh as a regularizer by evaluating the equation 7, to preserve the local structure of the mesh and improve the smooth- ness, especially when a mask is specified. Overall, we optimize for Ltotal = λuserLuser + λDDSLDDS + λregLreg, (10) where the weight of the user constraint λuser was set to dynamically increase in a linear fashion from 1 to 50 over the whole optimiza- tion process. For DDS guidance, we use Stable Diffusion 2.1 [RBL∗22] as the backbone along with the Perp − Neg algorithm [AZS∗23]. The guidance scale is 100, and the gradient scale is 0.00002. The weight of the ARAP regularizer can be set in the range of 0.04 to 0.2, de- pending on the deformation and mesh quality desired. For all examples in this paper except the car, we optimize for 2000 iterations. With our prototype implementation, it takes around 40 minutes on an Nvidia RTX 3090. However, with code optimiza- tion and hyperparameter tuning, we can expect significant improve- ments in execution times. Since the deformation of the car is larger, we optimized for 4000 iterations. We use Adan [XZL∗22] as the optimizer with a learning rate set to 0.005. As noted in [MKXBP22] such a large-scale optimization prob- lem can easily get stuck in an undesired local minimum, so in order to minimize this possibility we do the following to help the op- timization process. In every iteration, four camera positions were 6 T. Xie, E. Belilovsky, S. Mudur & T. Popa / DragD3D Figure 4: Gallery of results 2 sampled randomly with azimuth ∈ [−180◦, 180◦], elevation angle ∈ [0◦, 90◦], camera distance∈ [d0, d0 + 2], where d0 is the camera distance of specifying handles. 4. Experiments and Discussion 4.1. Results We demonstrate the effectiveness of our method on a variety of meshes belonging to different object classes, natural and human- made. This clearly demonstrates that our editing method is not lim- ited to any class or classes of objects. A gallery of results is shown in the Figures 1,3 and 4. In figures 3 and 4, the left three columns are the input to the pipeline, and the right two columns are the out- put of the pipeline. A 360 degree view of our models as well as time lapse video of the optimization is provided in the accompa- nying video. All the meshes were rendered with and without tex- ture to show the geometry clearly. The meshes were obtained from TurboSquid, Thingi10K [ZJ16], and TEXTure [RMA∗23]. For the meshes without texture (car, cat, chair, spaceship, castle, and snow monster), we generated the texture using [RMA∗23]. As can be seen from all result figures, the deformation results are realistic while satisfying the user constraints and, as shown in Figure 5, clearly outperform the results from pure geometric deformations that are not aware of the global structure of the object. 4.2. Comparison with optimization-based methods Our main goal is to provide a general mesh editing method that provides realistic results by leveraging the large-scale 2D models developed with millions of images of vast classes of objects from multiple views. Unlike many others, who are able to do this only for a specific class of objects or a given set of deformations to pro- vide the guidance to the method. Therefore, our comparison is with a method that does not use any data-driven guidance for the de- formations. There are a multitude of such methods, we refer to two state-of-the-art reviews [BS07,YLW∗21]. For practical reasons (i.e. nonavailability of code, no clear winner in terms of deforma- tion quality), from this multitude of methods we pick the as rigid as possible as a representative of the optimization-based class of methods [YLW∗21]. In figure 5, we compare our method with the improved version of As-Rigid-As-Possible(ARAP) [CPSS10], which was implemented by Libigl [JP∗18]. As noted in [YLW∗21] the ARAP deformation model is representative of the optimization-based methods. Although ARAP is an efficient geometry deformation energy computation, it introduces some artifacts, e.g. bending, and is not able to deform the mesh symmetrically when the handle is not sym- metric, which makes the deformed shape look unnatural. For in- stance, in Figure5, (a), the car roof was only lifted on the handle side non-smoothly; (c), the nose of the cat was bent and the mouth was stretched; (e) only the areas around the handles were lifted, T. Xie, E. Belilovsky, S. Mudur & T. Popa / DragD3D 7 Figure 5: Comparison with ARAP shows the more natural results of DragD3D compared to ARAP: symmetric deformation of the car even when only one anchor is used, detail preservation of the cat's face, a more natural extension of the back of the chair and a more natural deformation of the elephant's trunk. the chair top and the armrest were bent; and (g) the trunk of the elephant was bent and twisted unnaturally. On the other hand, our method can mitigate problems, such as bending and tilting, pro- duced by ARAP energy, and as a result, yielding far more realistic deformations. For example, in Figure5, (b), the roof of the car was lifted on both sides, and all the other parts of the car were also deformed to make it look natural; (d), the cat's nose and mouth are deformed without bending and stretching, and the left ear isn't notched for the silhouette; ( f ), the top of the chair was deformed to a headrest which has a small arc and the armrest was kept hor- izontal; (h), rather than only deform the trunk as in (g), the head of the elephant was also lifted, making the deformation look more realistic. 4.3. Design decisions Weighting of ARAP vs. DDS. One way to understand the ef- fects of these two losses is to look at them as complementing each other. The DDS loss is very noisy and it affects the low-frequency part of the shape while the ARAP loss regularizes better the high- frequency part of the shape. Therefore the ARAP weight balances the local shape behaviour against the global semantics of the ob- ject and the choice depends on the magnitude of the deformation. Large deformations have the benefit of a larger influence of the global DDS. Therefore a smaller ARAP loss works better. Figure 6 illustrates the influence of the weight. The top result is better with higher ARAP loss Figure 6a) to keep the geometry locally con- sistent as small dents like those shown in Figure 6-top-b) are not Figure 6: Effectiveness of ARAP regularizer's weight λreg. (a) λreg = 0.2, (b) λreg = 0.04 . Note the geometric artifact in top-b) and the nose and mouth distortion in bottom-a). captured by the noisy DDS loss. Figure 6-bottom shows a result that works better if we allow a larger influence of the DDS loss (Figure 6-bottom-b), which translates into a low ARAP weight. A high ARAP loss will result in unwanted distortions on the face (Fig- ure 6-bottom-a) Dynamic User Loss Given that the user specified constraint is the more important one to be satisfied in local mesh editing, the user constraint needs to be appropriately weighted in our loss func- tion. If a very large weight value is set for this from the very be- ginning, then Luser will dominate the gradient and reduce the ef- fectiveness of the other losses (i.e. the ARAP regularizer and DDS guidance). This, in turn, will lead to drastic deformation from the beginning. As shown in Figure 8 (a), in the early stages of the op- timization, this drastic deformation can produce artifacts and non- smooth mesh which then are difficult to remedy by the ARAP reg- ularizer and DDS guidance in later optimization stages. The dy- namic weighting approach we have introduced helps mitigate this problem, as can be seen in Figure 8 (b). Ablation Studies. We perform various experiments to show the effectiveness of the Jacobian fields, ARAP regularizer, random camera views, guidance, texture, and dynamic weight strategy. As can be seen in Figure 7, if we optimize for vertex displacement directly, the mesh structure cannot be kept. Without ARAP regu- larizer, the local structure of the connection part between the mask and unmasked area cannot be maintained, and the mesh is not as smooth if we do not include the ARAP regularizer. If the camera was fixed on four canonical views, front, back, and sides, and with- out any change in the elevation angle, the deformation was overfit- ted to these four views, which produced non-smooth deformation. As shown in Figure 7, if we replace the DDS guidance with the SDS guidance in our pipeline, due to the noisy gradient of SDS, the edited mesh is less smooth and has more distortion. Without tex- ture, the guidance of the 2D diffusion priors is not as efficient as before, which makes for lower-quality editing. What's more, with- out dynamic weighting for user constraint, we observed that user 8 T. Xie, E. Belilovsky, S. Mudur & T. Popa / DragD3D Figure 7: Ablation study. a-f: removing one by one the various features of our method. g: our method Figure 8: The deformed mesh in the early stage of optimization with and without the dynamic weighting strategy. Figure 9: Same deformation with different prompts. The prompts need not be very precise. constraint loss decreased so fast that the mesh was deformed in a very distorted way and it made the DDS guidance incapable of remedying the distortion. Lastly, we test dependence on the precision of the text prompt given by the user. As Figure 9 shows, the description does not need to be very precise, as long as it matches the object. This is clear as the prompt is used only in the DDS loss and primarily serves to provide the global context for this object's shape. 5. Conclusions, Limitations and Future work Dragging 3D mesh vertices in space has been used in practice to provide the fine control that designers seek in shape design. For dense meshes this poses the problem of having to automatically determine how all other vertices should change. Pre-trained large scale image models incorporate vast knowledge about the appear- ance of shapes in the real world. Recovering very specific shapes from this generalized knowledge is very challenging. Tapping into this knowledge for fine level mesh editing is the challenge we have successfully addressed in this work. Our method has a few limitations. As with most mesh based methods, the quality of the triangulation can affect the result. The run-time of the algorithm is large compared to traditional mesh deformation methods, but is still aligned with other optimizations based on similar kinds of losses. In future work, we will look at ways to speed up the optimization. Our deformation method re- quires a simple prompt to accompany the rest of the constraints. This is easy to provide and in the future, we could use automatic prompting [LRLJ23]. Our method still has some issues dealing with very large deformations. The DDS loss is very noisy and is not sensitive to small geometric artifacts. These artifacts are usu- ally corrected by the ARAP loss, but large deformations rely more on the DDS loss and as a consequence may experience geometric artifacts. References [AGK∗22] AIGERMAN N., GUPTA K., KIM V. G., CHAUDHURI S., SAITO J., GROUEIX T.: Neural jacobian fields: Learning intrinsic map- pings of arbitrary meshes. arXiv preprint arXiv:2205.02904 (2022). 4 [AZS∗23] ARMANDPOUR M., SADEGHIAN A., SADEGHIAN A., ZHOU M.: Re-imagine the negative prompt al- gorithm: Transform 2d diffusion into 3d, alleviate janus problem and beyond. arXiv preprint arXiv:2304.04968 (2023). 5 ZHENG H., [BS07] BOTSCH M., SORKINE O.: On linear variational surface de- IEEE transactions on visualization and computer formation methods. graphics 14, 1 (2007), 213–230. 2, 6 [CPSS10] CHAO I., PINKALL U., SANAN P., SCHRÖDER P.: A simple geometric model for elastic deformations. ACM transactions on graphics (TOG) 29, 4 (2010), 1–6. 2, 6 [CZW23] CHEN H., ZHENG C., WAMPLER K.: Local deformation for interactive shape editing. arXiv preprint arXiv:2306.06550 (2023). 2 [DYT21] DENG Y., YANG J., TONG X.: Deformed implicit field: Mod- eling 3d shapes with learned dense correspondence. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (2021), pp. 10286–10296. 2, 3 T. Xie, E. Belilovsky, S. Mudur & T. Popa / DragD3D 9 [GAG∗23] GAO W., AIGERMAN N., GROUEIX T., KIM V., HANOCKA R.: Textdeformer: Geometry manipulation using text guidance. In ACM SIGGRAPH 2023 Conference Proceedings (2023), pp. 1–11. 2, 3, 4 [GSMCO09] GAL R., SORKINE O., MITRA N. J., COHEN-OR D.: In ACM iwires: An analyze-and-edit approach to shape manipulation. SIGGRAPH 2009 papers. 2009, pp. 1–10. 2 [GSW∗22] GAO J., SHEN T., WANG Z., CHEN W., YIN K., LI D., LITANY O., GOJCIC Z., FIDLER S.: Get3d: A generative model of high quality 3d textured shapes learned from images. In Advances In Neural Information Processing Systems (2022). 3 [HACO23] HERTZ A., ABERMAN K., COHEN-OR D.: Delta denoising score. arXiv preprint arXiv:2304.07090 (2023). 4 [HHK∗23] HYUNG J., HWANG S., KIM D., LEE H., CHOO J.: Lo- cal 3d editing via 3d distillation of clip knowledge. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (2023), pp. 12674–12684. 2, 3 [HS22] HO J., SALIMANS T.: Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598 (2022). 4 [JP∗18] JACOBSON A., PANOZZO D., ET AL.: libigl: A simple C++ geometry processing library, 2018. https://libigl.github.io/. 6 [JTM∗21] JAKAB T., TUCKER R., MAKADIA A., WU J., SNAVELY N., KANAZAWA A.: Keypointdeformer: Unsupervised 3d keypoint discov- ery for shape control. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (2021), pp. 12783–12792. 2, 3 [KLA∗20] KARRAS T., LAINE S., AITTALA M., HELLSTEN J., LEHTI- NEN J., AILA T.: Analyzing and improving the image quality of style- In Proceedings of the IEEE/CVF conference on computer vision gan. and pattern recognition (2020), pp. 8110–8119. 3 [KSSCO08] KRAEVOY V., SHEFFER A., SHAMIR A., COHEN-OR D.: Non-homogeneous resizing of complex models. ACM Transactions on Graphics (TOG) 27, 5 (2008), 1–9. 2 [LRLJ23] LUO T., ROCKWELL C., LEE H., JOHNSON J.: Scalable 3d captioning with pretrained models. arXiv preprint arXiv:2306.07279 (2023). 8 [LZZ∗21] LIU S., ZHANG X., ZHANG Z., ZHANG R., ZHU J.-Y., In Proceedings RUSSELL B.: Editing conditional radiance fields. of the IEEE/CVF international conference on computer vision (2021), pp. 5773–5783. 2, 3 [MDSB03] MEYER M., DESBRUN M., SCHRÖDER P., BARR A. H.: Discrete differential-geometry operators for triangulated 2-manifolds. In Visualization and mathematics III. Springer, 2003, pp. 35–57. 5 [MKXBP22] MOHAMMAD KHALID N., XIE T., BELILOVSKY E., POPA T.: Clip-mesh: Generating textured meshes from text using pre- trained image-text models. In SIGGRAPH Asia 2022 conference papers (2022), pp. 1–8. 2, 3, 5 [MPCOMA23] MIKAEILI A., PEREL O., COHEN-OR D., MAHDAVI- AMIRI A.: Sked: Sketch-guided text-based 3d editing. arXiv preprint arXiv:2303.10735 (2023). 2, 3 [MST∗21] MILDENHALL B., SRINIVASAN P. P., TANCIK M., BARRON J. T., RAMAMOORTHI R., NG R.: Nerf: Representing scenes as neural radiance fields for view synthesis. Communications of the ACM 65, 1 (2021), 99–106. 3 [MWS∗23] MOU C., WANG X., SONG J., SHAN Y., ZHANG J.: Drag- ondiffusion: Enabling drag-style manipulation on diffusion models. arXiv preprint arXiv:2307.02421 (2023). 3 [PFS∗19] PARK J. J., FLORENCE P., STRAUB J., NEWCOMBE R., LOVEGROVE S.: Deepsdf: Learning continuous signed distance func- tions for shape representation. In Proceedings of the IEEE/CVF confer- ence on computer vision and pattern recognition (2019), pp. 165–174. 3 [PJBM22] POOLE B., B.: Dreamfusion: Text-to-3d using 2d diffusion. arXiv:2209.14988 (2022). 2, 3, 4 JAIN A., BARRON J. T., MILDENHALL arXiv preprint [PJS07] POPA T., JULIUS D., SHEFFER A.: Interactive and linear mate- rial aware deformations. International Journal of Shape modeling 13, 01 (2007), 73–100. 2, 3 [PTL∗23] PAN X., TEWARI A., LEIMKÜHLER T., LIU L., MEKA A., THEOBALT C.: Drag your gan: Interactive point-based manipulation on the generative image manifold. In ACM SIGGRAPH 2023 Conference Proceedings (2023), pp. 1–11. 3 [RBL∗22] ROMBACH R., BLATTMANN A., LORENZ D., ESSER P., OMMER B.: High-resolution image synthesis with latent diffusion mod- els. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (2022), pp. 10684–10695. 5 [RKH∗21] RADFORD A., KIM J. W., HALLACY C., RAMESH A., GOH G., AGARWAL S., SASTRY G., ASKELL A., MISHKIN P., CLARK J., ET AL.: Learning transferable visual models from natural language In International conference on machine learning (2021), supervision. PMLR, pp. 8748–8763. 3, 4 [RMA∗23] RICHARDSON E., METZER G., ALALUF Y., GIRYES R., COHEN-OR D.: Texture: Text-guided texturing of 3d shapes. arXiv preprint arXiv:2302.01721 (2023). 6 [SA07] SORKINE O., ALEXA M.: As-rigid-as-possible surface model- ing. In Symposium on Geometry processing (2007), vol. 4, pp. 109–116. 2, 4 [SFL∗23] SANGHI A., FU R., LIU V., WILLIS K. D., SHAYANI H., KHASAHMADI A. H., SRIDHAR S., RITCHIE D.: Clip-sculptor: Zero- shot generation of high-fidelity and diverse shapes from natural lan- guage. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (2023), pp. 18339–18348. 2 [SHM∗22] SHECHTER M., HANOCKA R., METZER G., GIRYES R., COHEN-OR D.: Neuralmls: Geometry-aware control point deformation. arXiv preprint arXiv:2201.01873 (2022). 2 [SXP∗23] SHI Y., XUE C., PAN J., ZHANG W., TAN V. Y., BAI S.: Dragdiffusion: Harnessing diffusion models for interactive point-based image editing. arXiv preprint arXiv:2306.14435 (2023). 3 [SZGP05] SUMNER R. W., ZWICKER M., GOTSMAN C., POPOVI ́C J.: Mesh-based inverse kinematics. ACM transactions on graphics (TOG) 24, 3 (2005), 488–495. 2, 3 [TMT∗23] TSALICOGLOU C., MANHARDT F., TONIONI A., NIEMEYER M., TOMBARI F.: Textmesh: Generation of realistic 3d meshes from text prompts. arXiv preprint arXiv:2304.12439 (2023). 2 [TMW∗22] TANG J., MARKHASIN L., WANG B., THIES J., NIESSNER M.: Neural shape deformation priors. Advances in Neural Information Processing Systems 35 (2022), 17117–17132. 2, 3 [Ume91] UMEYAMA S.: Least-squares estimation of transformation pa- IEEE Transactions on Pattern rameters between two point patterns. Analysis & Machine Intelligence 13, 04 (1991), 376–380. 5 [WCMN19] WANG W., CEYLAN D., MECH R., NEUMANN U.: 3dn: 3d deformation network. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (2019), pp. 1038–1046. 2, 3 [XZL∗22] XIE X., ZHOU P., LI H., LIN Z., YAN S.: Adan: Adaptive nesterov momentum algorithm for faster optimizing deep models. arXiv preprint arXiv:2208.06677 (2022). 5 [YAK∗20] YIFAN W., AIGERMAN N., KIM V. G., CHAUDHURI S., SORKINE-HORNUNG O.: Neural cages for detail-preserving 3d defor- mations. In Proceedings of the IEEE/CVF Conference on Computer Vi- sion and Pattern Recognition (2020), pp. 75–83. 2, 3 [YBHK21] YANG G., BELONGIE S., HARIHARAN B., KOLTUN V.: Ge- ometry processing with neural fields. Advances in Neural Information Processing Systems 34 (2021), 22483–22497. 2 [YLW∗21] YUAN Y.-J., LAI Y.-K., WU T., GAO L., LIU L.: A revisit of shape editing techniques: From the geometric to the neural viewpoint. Journal of Computer Science and Technology 36, 3 (2021), 520–554. 2, 6 10 T. Xie, E. Belilovsky, S. Mudur & T. Popa / DragD3D [YM16] YUMER M. E., MITRA N. J.: Learning semantic deformation flows with 3d convolutional networks. In European Conference on Com- puter Vision (2016), Springer, pp. 294–311. 2, 3 [YSL∗22] YUAN Y.-J., SUN Y.-T., LAI Y.-K., MA Y., JIA R., GAO L.: Nerf-editing: geometry editing of neural radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recogni- tion (2022), pp. 18353–18364. 2 [YSL∗23] YUAN Y.-J., SUN Y.-T., LAI Y.-K., MA Y., JIA R., KOBBELT L., GAO L.: Interactive nerf geometry editing with shape priors. IEEE Transactions on Pattern Analysis and Machine Intelligence (2023). 2 [YZX∗21] YANG B., ZHANG Y., XU Y., LI Y., ZHOU H., BAO H., ZHANG G., CUI Z.: Learning object-compositional neural radiance field for editable scene rendering. In Proceedings of the IEEE/CVF Interna- tional Conference on Computer Vision (2021), pp. 13779–13788. 2 [ZJ16] ZHOU Q., JACOBSON A.: Thingi10k: A dataset of 10,000 3d- printing models. arXiv preprint arXiv:1605.04797 (2016). 6
http://arxiv.org/abs/2310.04560v1
"2023-10-06T19:55:21"
"2023-10-06T19:55:21"
Talk like a Graph: Encoding Graphs for Large Language Models
Graphs are a powerful tool for representing and analyzing complex relationships in real-world applications such as social networks, recommender systems, and computational finance. Reasoning on graphs is essential for drawing inferences about the relationships between entities in a complex system, and to identify hidden patterns and trends. Despite the remarkable progress in automated reasoning with natural text, reasoning on graphs with large language models (LLMs) remains an understudied problem. In this work, we perform the first comprehensive study of encoding graph-structured data as text for consumption by LLMs. We show that LLM performance on graph reasoning tasks varies on three fundamental levels: (1) the graph encoding method, (2) the nature of the graph task itself, and (3) interestingly, the very structure of the graph considered. These novel results provide valuable insight on strategies for encoding graphs as text. Using these insights we illustrate how the correct choice of encoders can boost performance on graph reasoning tasks inside LLMs by 4.8% to 61.8%, depending on the task.
[ "Bahare Fatemi", "Jonathan Halcrow", "Bryan Perozzi" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04560v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04560v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 t c O 6 ] G L . s c [ 1 v 0 6 5 4 0 . 0 1 3 2 : v i X r a TALK LIKE A GRAPH: ENCODING GRAPHS FOR LARGE LANGUAGE MODELS Bahare Fatemi, Jonathan Halcrow, Bryan Perozzi Google Research {baharef,halcrow,bperozzi}@google.com ABSTRACT Graphs are a powerful tool for representing and analyzing complex relationships in real-world applications such as social networks, recommender systems, and com- putational finance. Reasoning on graphs is essential for drawing inferences about the relationships between entities in a complex system, and to identify hidden pat- terns and trends. Despite the remarkable progress in automated reasoning with natural text, reasoning on graphs with large language models (LLMs) remains an understudied problem. In this work, we perform the first comprehensive study of encoding graph-structured data as text for consumption by LLMs. We show that LLM performance on graph reasoning tasks varies on three fundamental levels: (1) the graph encoding method, (2) the nature of the graph task itself, and (3) in- terestingly, the very structure of the graph considered. These novel results provide valuable insight on strategies for encoding graphs as text. Using these insights we illustrate how the correct choice of encoders can boost performance on graph reasoning tasks inside LLMs by 4.8% to 61.8%, depending on the task. 1 INTRODUCTION There has been remarkable recent progress in the research and applications of large language mod- els (LLMs) (Vaswani et al., 2017; Devlin et al., 2018; Brown et al., 2020a; Ouyang et al., 2022). These generative models have captivated the artificial intelligence community and a plethora of models trained on a variety of tasks and modalities have recently been released (Zhao et al., 2023). All of these advancements have led to a growing consensus that LLMs are a pivotal advancement on the path to artificial general intelligence (AGI) (Bubeck et al., 2023). However, despite all their successes, there are a number of limitations with the current methodology of design and implementation of LLMs. One of the most obvious limitations is their reliance on unstructured text, causing the models to sometimes miss obvious logical entailments or hallucinate incorrect conclusions (Zhang et al., 2023b). Another is that LLMs are fundamentally limited by when they were trained, and it can be difficult to incorporate 'fresh' information about the state of the world which has changed (Lewis et al., 2020). Graph-structured data is one of the most flexible ways to represent information and could be a promising solution to both challenges (Schneider et al., 2022; Pan et al., 2023). Interestingly, despite this promise, the intersection of graphs and LLMs has been relatively under- studied. For example, while much work has focused on LLMs and graph databases (or knowledge graphs (Guu et al., 2020; Lewis et al., 2020)) there has not been much study about general purpose use of graph-structured data. More recently, Wang et al. (2023) have sought to address this by de- signing a graph benchmarking task for language models. While their task represents an exciting initial foray into measuring LLMs graph reasoning capabilities, there are still many open questions due to the omission of several natural graph tasks and a lack of variety in the type of graph structure considered. Other recent work seeks to replace graph-structured data with LLMs (Ye et al., 2023), but this does not address fundamental challenges with LLMs. In this work, we perform the first comprehensive study about reasoning over graph-structured data as text for consumption by LLMs. To analyze graph reasoning more closely, we decompose the problem into graph encoding and graph prompt engineering. Varying graph encoding methods allows us to understand how LLM's learned representations are leveraged in graph tasks. While 1 Figure 1: Overview of our framework for reasoning with graphs using LLMs. studying prompt engineering techniques finds the most suitable way to get a desired solution to a question from an LLM. Our experimental results seek to uncover the situations where different prompt heuristics work well. To that end, we propose a new set of benchmarks GraphQA for measuring LLM performance reasoning over graph data. GraphQA is distinguished by using graphs with much more varied and realistic graph structure than has previously been studied with LLMs. Our Contributions: Specifically, the contributions of our work are the following: 1. An extensive study of graph-structure prompting techniques for use in LLMs. 2. Insights and best practices for encoding graphs as text for use in LLMs. 3. A new graph benchmark (GraphQA) to aid the community in studying the effects of graph structure on LLM prompting further. 2 PROMPTING LLMS FOR GRAPH REASONING Notation. Let f be the interface function to a generative AI model, which takes high-dimensional discrete input tokens W and produces output in the same token space (f : W (cid:55)→ W ). Without loss of generality, we will colloquially refer to f as a pre-trained Large Language Model (LLM) throughout this work, but note that our discussion here applies to any generative AI model with such a discrete interface. In this work, we consider encoding graphs G = (V, E), where V is the set of vertices (or nodes) and E ∈ (V × V ) is the set of edges connecting them. 2.1 PROMPT ENGINEERING The goal in prompt engineering is to find the correct way to phrase a question Q such that an LLM f (or other generative model) will return the corresponding answer A, (Q ∈ W, A ∈ W ). In other words: A = f (Q) In this work, our goal is to provide the LLM f with graph information, so that it can better reason about question/answer pairs that require access to arbitrarily structured relational information. A = f (G, Q) A variety of approaches exist for modifying the LLM f (.) so that it could better perform on tasks with graph data such as fine-tuning (Clark et al., 2020), soft prompting (Lester et al., 2021), and LoRA (Hu et al., 2021). In addition, many approaches modify the model to include graph informa- tion (M ̈uller et al., 2023; Zhang et al., 2020; Dwivedi & Bresson, 2020). However, these methods all require access to the internals of the model (either its weights or gradients), which can limit their applicability in many real-world settings. In this work, we are instead interested in the case where f (.) and its parameters are fixed, and the system is available only for use in a black box setup where the LLM only consumes and produces text (i.e., the LLM f : W (cid:55)→ W ). We believe this setting to be particularly valuable as the number of proprietary models available and their hardware demands increase. To this end, we introduce the graph encoding function g(G) and question rephrasing function q(Q), where g : G (cid:55)→ W and q : W (cid:55)→ W (where W is the large discrete domain of tokens used to train the LLM). A = f (g(G), q(Q)) (1) Our training input D to the graph-based prompt system is a set of G, Q, S triples, where G is a graph, Q is a question, and S, S ∈ W , is a solution to Q. We seek to find a g(.) and q(.) that maximize the expected score from the model (scoref ) of the answers over the training dataset D. max g,q EG,Q,S∈D scoref (g(G), q(Q), S) (2) 2 Graph GLLM: fGraph taskGraph encoder function: gPrompt question: QPromptG describes a graph among nodes 0, 1, 2, 3, 4, 5, 6, 7, and 8. In this graph: Node 0 is connected to nodes 2 and 3. Node 1 is connected to nodes 2 and 8....Question: What is the degree of node 4? Answer: A As W is a very large discrete space, many current approaches use heuristics for this optimization (by changing the prompt Q). The novel contribution of this work is to consider the role of the graph en- coding function g(.), q(.) question rephrasing function, and the graph structure G in the optimization of Equation (2). 2.2 PROMPTING HEURISTICS The vast majority of prompting heuristics operate by optimizing the prompt text Q used to query the model. We briefly introduce the methods we examine further in the paper here: Zero-shot prompting (ZERO-SHOT): This approach simply provides the model with a task descrip- tion and asks it to generate the desired output, without any prior training on the task. Few-shot in-context learning (FEW-SHOT) (Brown et al., 2020b): This approach provides the model with a small number of examples of the task, along with the desired outputs. The model then learns from these examples to perform the task on new inputs. Chain-of-thought (CoT) prompting (COT) (Wei et al., 2022): This approach provides the model with a sequence of examples, each of which shows how to solve the task step-by-step. The model then learns to generate its CoTs to solve new prob- lems. Zero-shot CoT prompting (ZERO-COT) (Kojima et al., 2022): This approach is similar to CoT prompting, but it does not require any prior training examples. Instead, the model uses a sim- ple prompt to generate its own CoTs. As suggested by the original paper, we used "Let's think step by step". Bag prompting (COT-BAG) (Wang et al., 2023): This technique is proposed to improve the performance of LLMs on graph-related tasks. It works by appending "Let's construct a graph with the nodes and edges first" to the graph description. We note that there is also a popular recent extension of this family of methods, based on iterative prompting. These methods use a series of iterative LLM queries to optimize the prompt ques- tion (e.g., (Zhou et al., 2022b; Pryzant et al., 2023; Yang et al., 2023)). However, our initial ex- periments showed that iterative prompting methods performed much worse for our tasks, due to cascading errors. Consequently, we chose to concentrate our efforts on the methods outlined above. In this study, the goal is to optimize the graph encoding function on basic graph tasks. Such basic tasks are essential intermediate steps for more complex reasoning tasks on graphs. We conduct ex- tensive experiments on graph encoding function, question, and graph generator functions, providing a study of graph encoding methods for black-box LLM usage. 3 TALK LIKE A GRAPH: ENCODING GRAPHS VIA TEXT Graph encoding is a necessary step for turning graph-structured information into a sequence for consumption by language models. In this section, we will study the details of a graph encoding function g(.) which maps graph data into tokens for consumption by an LLM. Our experimental results in this section seek to understand the best form of graph encoding and prompt engineering to maximize the performance on graph reasoning tasks. We begin by highlighting some of the most exciting results from our analysis here: • R1: LLMs perform poorly on basic graph tasks (§3.1). • R2: The graph encoding function has a significant impact on LLM graph reasoning (§3.1). • R3: Model capacity has a significant effect on graph reasoning capabilities of LLMs (§3.4). Graph encoding function. This section is an investigation into various methodologies for rep- resenting graphs as text. This process of encoding graphs as text can be separated into two key inquiries: First, the encoding of nodes in the graph, and second the encoding of edges between the nodes. Regarding the encoding of nodes and edges, we examine several techniques. Figure 2 shows an overview of the graph encoding functions used. For brevity's sake, a full description and examples of the graph encoding functions considered are explained in Appendix A.1. Graph structure. We briefly note that the design of this experiment follows that of Wang et al. (2023), who use Erd ̋os-R ́enyi (ER) graphs (Erd ̋os & R ́enyi, 1959). One contribution of our work is to consider the effect of more complex graph structures on reasoning in LLMs (covered in Section 4). 3 Figure 2: Overview of our framework for encoding graphs via text. 3.1 EXPERIMENT 1: VARYING GRAPH ENCODING FUNCTIONS In this experiment, we measure the performance of pre-trained LLMs on graph tasks: edge existence, node degree, node count, edge count, connected nodes, and cycle check. We describe these tasks and our graph benchmark that contains them (GraphQA) in detail in Appendix A.2. 3.1.1 RESULTS Table 1 shows the results of this experiment varying graph encoding and prompting techniques. These results show several interesting conclusions, which we briefly summarize here: LLMs perform poorly on basic graph tasks. Let's start by examining the overall results. LLMs performed poorly on almost all the basic graph tasks we experimented with. This is especially interesting for the edge existence and cycle check tasks, where there is not an edge 53.96% of the time for the edge existence task and there is a cycle 81.96% of the time for the cycle check task. Therefore. LLMs perform worse than the majority baseline. Note that we experimented with ER graphs in this experiment, and it is very likely for an ER graph to have a cycle. Simple prompts are best for simple tasks. We see that ZERO-COT prompting has worse model performance than ZERO-SHOT prompting on basic graph tasks. This is likely because ZERO-SHOT prompting is sufficient for these tasks, which do not require multi-hop reasoning. ZERO-COT prompting can be effective for tasks that require multi-hop reasoning, such as arithmetic problems, but it is not necessary for most basic graph tasks, which only require the LLM to have an under- standing of the graph structure (nodes, edges, paths, etc.) and the graph task. However for more complex tasks, adding few-shot examples and CoT prompting generally improved the performance of the model. This is mainly because few-shot examples provide the LLM with a better understand- ing of the task it is solving. CoT prompting can also improve performance by helping the LLM to find out how to get to the answer to the problem. graph encoding functions have significant impact on LLM reasoning. As the results indicate, the choice of the graph encoding function has a significant impact on the performance of LLMs on graph-related tasks. This is because different encoder functions capture different aspects of the graph structure. For instance, for finding connected nodes to a node in a graph, adjacency achieves 19.8% accuracy and incident achieves 53.8% accuracy. For both node degree and connected nodes, incident encoding outperforms the rest of the encoder functions. This is likely because the incident encoder encodes the graph structure in a way that makes the relevant information more accessible, i.e., in close proximity, to the LLM. Integer node encoding improves arithmetic performance. Another finding here is that integer encoding of nodes (e.g., node 0) can improve the performance of LLMs on integer output tasks, such as predicting node degree, node count, and edge count. This is because the input and output of the LLM are then in the same space, making it easier for the model to learn the relationship between the two. Interestingly however, encoder functions with specific names (e.g., David) worked better in non-integer output tasks such as GOT for edge existence or Friendship for cycle check. Summary: Choosing the right graph encoding function significantly affects the performance of LLMs on basic graph algorithms. Therefore, it is important to select a function carefully and ap- propriately for the specific task. This finding is especially important because many reasoning tasks 4 Expert: You are a graph analyst and you have been given a graph G among A, B, C, D, E, F, G, H, and I. G has the following undirected edges: A -> B, A -> C, ..., H -> I.Graph GAdjacency: In an undirected graph, (i,j) means that node i and node j are connected with an undirected edge. G describes a graph among nodes 0, 1, 2, 3, 4, 5, 6, 7, and 8.The edges in G are: (0, 1) (0, 2) ... (6, 7) (7, 8).Incident: G describes a graph among nodes 0, 1, 2, 3, 4, 5, 6, 7, and 8. In this graph: Node 0 is connected to nodes 1, 2. Node 1 is connected to nodes 0, 2. Node 2 is connected to nodes 0, 1, 3, 4, 5, 7. ... Node 8 is connected to nodes 3, 7.Friendship: G describes a friendship graph among James, Robert, John, Michael, David, Mary, Patricia, Jennifer, and Linda. We have the following edges in G: James and Robert are friends. ... Jennifer and Linda are friends.Politician: G describes a social network graph among Barack, Jimmy, Arnold, Bernie, Bill, Kamala, Hillary, Elizabeth, and John. We have the following edges in G: Barack and Jimmy are connected. ... Elizabeth and John are connected.Social network: G describes a social network graph among James, Robert, John, Michael, David, Mary, Patricia, Jennifer, and Linda. We have the following edges in G: James and Robert are connected. ... Jennifer and Linda are connected.SP: G describes a friendship graph among Eric, Kenny, Kyle, Stan, Tolkien, Heidi, Bebe, Liane, and Sharon. In this friendship graph: Eric and Kenny are friends, Eric and Kyle are friends ..., Heidi and Bebe are friends, Bebe and Liane are friends, Liane and Sharon are friends.GOT: G describes a friendship graph among Ned, Cat, Daenerys, Jon, Bran, Sansa, Arya, Cersei, and Jaime.In this friendship graph: Ned and Cat are friends, Ned and Daenerys are friends, Cat and Daenerys are friends, ..., Cersei and Jaime are friends.Co-authorship: G describes a co-authorship graph among James, Robert, John, Michael, David, Mary, Patricia, Jennifer, and Linda. In this co-authorship graph: James and Robert wrote a paper together. ... Jennifer and Linda wrote a paper together.. Method T O H S - O R E Z T O C - O R E Z T O H S - W E F T O C G A B - T O C Encoding Overall (μ/δ) Adjacency Incident Co-authorship Friendship SP GOT Social network Politician Expert Overall (μ/δ) Adjacency Incident Co-authorship Friendship SP GOT Social network Politician Expert Overall (μ/δ) Adjacency Incident Co-authorship Friendship SP GOT Social network Politician Expert Overall (μ/δ) Adjacency Incident Co-authorship Friendship SP GOT Social network Politician Expert Overall (μ/δ) Adjacency Incident Co-authorship Friendship SP GOT Social network Politician Expert Edge Existence Node degree Node count Edge count Connected nodes Cycle check 76.0 / 13.2 71.6 68.8 70.8 82.0 80.4 79.0 81.2 81.0 69.6 32.3 / 23.2 46.2 39.0 28.2 31.2 34.8 33.4 26.0 23.0 28.8 37.4 / 24.0 47.8 45.0 46.8 41.4 38.2 28.6 34.2 30.8 23.8 58.0 / 16.4 56.6 62.6 54.8 61.8 59.4 60.4 60.6 59.4 46.2 52.1 / 26.0 56.8 63.0 37.0 52.0 52.2 54.6 51.2 57.2 45.0 14.7 / 11.0 19.8 53.8 7.6 4.0 6.2 7.6 8.2 8.8 16.4 8.8 / 9.2 6.0 35.2 3.0 3.0 5.0 5.4 3.8 3.2 14.2 12.4 / 15.2 22.2 36.6 9.0 6.4 6.8 3.4 7.8 7.8 11.8 13.1 / 18.0 22.4 30.2 8.4 9.6 8.2 7.2 8.0 9.4 14.4 15.8 / 31.8 20.6 41.0 9.2 9.8 11.4 10.0 10.0 10.2 20.4 21.73 / 8.6 18.8 15.6 22.0 23.0 22.4 22.8 22.8 24.2 24.0 14.6 / 9.4 11.0 10.0 15.6 19.4 15.6 16.2 14.0 14.6 14.8 25.3 / 35.6 47.2 51.2 15.6 18.4 18.0 14.2 21.2 21.4 20.4 27.6 / 42.4 57.0 57.6 15.2 23.0 17.0 16.2 21.6 22.6 18.0 26.9 / 33.8 48.6 51.2 17.4 21.8 21.6 18.0 19.6 22.8 20.8 14.0/16.0 12.4 25.0 13.8 11.2 9.0 13.6 16.0 15.2 10.0 10.4 / 22.4 15.4 26.6 9.8 7.0 9.2 8.4 6.6 4.2 6.0 17.4 / 23.4 15.4 33.6 15.6 12.2 18.0 17.2 15.0 13.4 16.6 29.2 / 60.4 71.2 75.0 16.4 14.6 17.4 17.8 16.4 16.6 17.4 28.0 / 61.8 66.8 75.2 14.6 16.2 17.0 15.6 13.4 17.6 15.8 12.4 / 4.8 14.0 10.6 11.4 10.2 15.0 13.2 10.8 11.6 14.8 9.4 / 4.8 12.2 12.2 8.2 7.4 8.4 8.4 9.2 8.6 10.0 12.0 / 9.0 18.6 14.6 10.2 9.8 12.0 12.0 10.2 9.6 11.2 12.8 / 17.4 25.2 21.4 8.8 7.8 10.6 11.8 8.4 9.2 12.4 12.5 / 17.8 25.0 21.8 7.2 7.4 11.4 11.0 9.0 8.2 11.6 44.5 / 9.4 45.8 39.6 44.0 46.6 46.4 49.0 43.2 44.6 41.2 33.5 / 11.6 34.2 41.4 29.8 28.4 32.6 34.6 30.8 38.0 31.6 36.8 / 13.8 42.8 38.8 29.4 40.6 34.6 40.6 37.4 38.0 29.0 42.8 / 7.0 42.8 41.6 43.2 46.6 42.6 44.0 42.6 42.2 39.6 37.3 / 16.6 45.8 45.6 25.0 39.0 33.6 32.6 44.8 40.4 29.2 Table 1: Comparison of various graph encoder functions based on their accuracy on different graph tasks using PaLM 62B. The most effective prompting heuristic is highlighted with an underline, and the top-performing graph encoder function for it is highlighted in bold. The overall result is represented its average (μ) and an absolute difference (δ) of its best and worst graph encoder. involve graph problems. For example, finding influential nodes in a social network is similar to finding the degree of the nodes in the graph. Encoding such graphs in the right way for the task can improve the task. We examine the relative rankings of graph encodings more in Appendix A.3. 3.2 EXPERIMENT 2: VARYING PROMPT QUESTIONS In this experiment, we maintained the graph encoding function as a constant for the concept of friendship and conducted experiments using two distinct question encoder functions: the graph ques- tion encoder and the application question encoder. The graph question encoder is responsible for encoding graph-related tasks, such as determining the degree of a specific node (e.g., "What is the degree of node i?"). This encoder is used for obtaining results in Section 3.1. On the other hand, the application question encoder interprets graph questions in a more practical, day-to-day context. 5 Method Question encoder ZERO-SHOT COT Graph Application Graph Application Graph Application Graph Application LLM PaLM 2-XXS PaLM 2-XXS PaLM 62B PaLM 62B PaLM2 XXS PaLM2 XXS PaLM 62B PaLM 62B Edge Existence Node degree Node count Edge count Connected nodes 5.4 9.4 23.0 17.8 8.4 8.6 23.0 16.0 42.8 60.8 46.6 47.8 50.4 56.4 46.6 38.6 5.6 4.4 10.2 13.2 4.2 5.4 7.8 12.2 1.6 11.4 4.0 6.0 10.2 11.0 9.6 10.0 10.8 14.0 11.2 16.6 8.8 12.2 14.6 16.6 Table 2: Comparing two question encoders based on their accuracy for PaLM 2 XXS and PaLM 62B. The top-performing question encoder for the respective LLM is highlighted in bold. Task O H S - O R E Z T Edge Existence Node degree Node count Edge count Connected nodes Cycle Check Edge Existence Node degree Node count Edge count Connected nodes Cycle Check T O C Same relation 42.8 10.8 5.4 5.6 1.6 65.2 50.4 8.8 8.4 4.2 10.2 77.4 Multiple relations 39.8 11.6 6.6 5.4 3.4 84.4 50.8 10.0 5.8 5.0 7.2 74.4 Table 3: Results on multiple relations for edge encoding with PaLM 2 XXS. Figure 3: Effect of Model Capacity on graph rea- soning task for PaLM 2-XXS, XS, S, and L. In the application scenario, we used a friendship-based scenario where we transformed the tasks as follows: edge existence became "assessing friendship existence", node degree became "counting the number of friends for an individual", node count became "counting the number of people men- tioned", edge count became "counting the number of friendships mentioned", and connected nodes became "listing friends". Results: Table 2 summarizes the results of our experiment on question encoder functions. As the results show, the application encoder outperforms the graph encoding on almost all tasks, despite both encoders having the same graph encoding function and only differing slightly in how they ask the question. For example, on the ZERO-SHOT edge existence task using PALM 2 XXS, the graph encoding obtained 42.8% accuracy, while the application encoder obtained 60.8%. Summary: The selection of the question encoder function affects the performance of LLMs when handling basic graph algorithms. As a result, it becomes important to translate a given task into more contextually meaningful textual information when employing LLMs for inference. 3.3 EXPERIMENT 3: MULTIPLE RELATION ENCODING In this experimental setup, we introduce a modification to the friendship graph encoding function, which characterizes edges based on a range of distinct relation types, including friends, colleagues, spouses, siblings, neighbors, acquaintances, teammates, classmates, coworkers, or roommates. The selection of the relation type is randomized from this predefined set, thereby using multiple words to reference the existence of a relationship between nodes. This is a departure from using the same token(s) for edge representation in prior graph encoding experiments. Results: As Table 3 shows, using multiple words to represent relationships did not hurt LLM per- formance and even improved it in some cases. This improvement is likely because the diverse set of relations provides the LLM with more textual information to perform the task, and the final encoding is closer to the text that the LLM may have seen during training, compared to the prior setup. 6 0255075100Accuracy (%)Edge ExistenceNode DegreeNode CountXXSXSSLPaLM 2 Size0255075100Accuracy (%)Edge CountXXSXSSLPaLM 2 SizeConnected NodesXXSXSSLPaLM 2 SizeCycle CheckZero-shotZero-COTFew-shotCOTCOT-BagBaseline Figure 4: Samples of graphs generated with different graph generators in our framework. 3.4 EXPERIMENT 4: MODEL CAPACITY AND GRAPH REASONING ABILITY In this experiment, we measure the effect of model capacity on the graph tasks. We compare the results of PaLM 2 (Anil et al., 2023) XXS, XS, S, and L, which have different number of parameters and therefore different capacity. We report the majority baseline for reference. Results: Model capacity has a significant effect on the graph reasoning ability of an LLM. The results of this experiment, reported in Figure 3, show the larger model is generally better at graph reasoning tasks. This is because it has more capacity to learn and store complex information. The model capacity has less effect on edge existence. The results also show that the model was not able to beat the majority baseline for edge existence even with a large capacity. 3.5 EXPERIMENT 5: REASONING IN THE ABSENCE OF EDGES In this experiment, we evaluate the performance of LLMs on the disconnected nodes task. This task differs from the previous ones in that it requires reasoning about information that is implicit in the graph, i.e., information that is not explicitly mentioned in the output of the graph encoding function. Results: LLMs lack a global model of a graph. The ZERO-SHOT prompting method achieved an accuracy of 0.5%, while the ZERO-COT, FEW-SHOT, COT, and COT-BAG methods achieved close to 0.0% accuracy. These results suggest that LLMs perform significantly worse on the disconnected nodes task than on the connected nodes task. We believe that this is because the graph encoding functions primarily encode information about connected nodes, while not explicitly encoding infor- mation about nodes that are not connected. As a result, LLMs are better at processing relationships among connected nodes than at capturing the absence of connections, leading to sub-optimal per- formance in disconnectivity-related tasks. 4 DOES THE STRUCTURE OF THE GRAPH MATTER FOR THE LLM? It is natural to wonder if the structure of the graph itself might effect LLM's ability to reason over it. Inspired by recent work in analyzing graph neural networks (Palowitch et al., 2022; Yasir et al., 2023) this section seeks to measure a LLM's reasoning capabilities over graph with distinct struc- tures. In this section, we show that graph structure can have significance influence on an LLM's reasoning performance. Figure 4 illustrates graphs created through different generative processes. 4.1 RANDOM GRAPH GENERATION To be able to experiment with LLMs on graphs, we generate random graphs using various graph generator algorithms. This allows us to: Cover a wide range of properties. Different graph generators produce graphs with different prop- erties. For example, Erd ̋os-R ́enyi graphs tend to be sparse and have a small average degree, while Barab ́asi-Albert graphs tend to be dense and have a power-law degree distribution. By using a di- verse set of generators, we ensure that the GraphQA benchmark includes graphs with a wide range of properties. Avoid bias in graph problem evaluation. The goal of generating such graphs is to test the ability of LLMs to solve graph problems. Graph problems can vary in difficulty depending on the properties of the graphs, so we use a diverse set of graphs to avoid bias. Provide realistic benchmarks. Real-world graphs exhibit a wide range of properties, and no single graph generator can capture all of these properties perfectly. By using a diverse set of generators, we create a benchmark that is more representative of real-world graphs. 7 ERBASBMSFNPathCompleteStar Method Graph generator Edge Existence Node degree Node count Edge count Connected nodes Cycle check T O H S - O R E Z T O C Overall ER BA SBM Star SFN Path Complete Overall ER BA SBM Star SFN Path Complete 49.1 45.1 50.2 45.0 58.0 57.6 60.9 19.8 40.4 41.2 40.0 40.3 40.3 40.2 42.0 39.6 17.6 13.6 18.0 13.8 34.0 23.1 14.8 12.6 29.6 28.4 30.0 26.5 38.0 32.2 35.1 21.9 23.0 22.1 24.9 21.9 32.8 19.9 31.9 20.7 31.7 28.8 35.0 30.2 41.8 30.8 35.3 28.9 12.1 11.7 13.6 9.2 31.7 8.0 28.8 6.2 12.2 12.6 14.3 8.7 31.6 7.1 31.1 3.9 23.3 14.9 20.1 13.8 61.7 38.1 26.6 13.3 24.3 12.8 20.8 13.0 68.6 43.2 27.6 14.6 75.2 76.3 72.0 86.5 8.1 90.0 5.9 91.7 59.5 61.2 58.5 65.8 21.3 66.0 19.7 69.3 Table 4: Comparing different graph generators on different graph tasks on PaLM 62B. The most ef- fective prompting heuristic is highlighted with an underline, and the top-performing graph generator algorithm for the respective heuristic is highlighted in bold. To generate random graphs, we use Erd ̋os-R ́enyi (ER) graphs (Erd ̋os & R ́enyi, 1959), scale-free networks (SFN) (Barab ́asi & Albert, 1999), Barab ́asi–Albert (BA) model (Albert & Barab ́asi, 2002), and stochastic block model (SBM) (Holland et al., 1983), in addition to star, path, and complete graph generators. We use NetworkX (Hagberg et al., 2008) to generate the random graphs. The details are reported in Appendix A.4. 4.2 RESULTS ON RANDOM GRAPH GENERATORS Previous experiments have studied the performance of LLMs on basic graph tasks using random graphs generated using the Erd ̋os-R ́enyi (ER) model. However, ER graphs often do not accurately represent the characteristics of real-world graphs. In this experiment, we investigate the effect of different random graph generators on the performance of LLMs on graph reasoning tasks. To make the experiment more realistic, we sample the few-shot examples randomly from graphs generated using different algorithms. We report the results of this experiment in Table 4. Graph structure has a significant impact on the LLM's performance. The results show that the algorithm used to generate the graph has a significant impact on the performance of the LLM on graph tasks. For example, the cycle check task achieves 91.7% accuracy on complete graphs and 5.9% accuracy on path graphs. This is because the LLM has a strong prior towards graphs having cycles. Therefore, the accuracy is high for complete graphs, which always have cycles, and very low for path graphs, which never have cycles. By adding few-shot examples some having a cycle and some not, the accuracy of cycle check on path graphs increased from 5.9% to 19.7%. As another example, on the edge existence task, the LLM achieves 60.0% accuracy on path graphs, which are less likely to have an edge between two nodes, and 19.8% accuracy on complete graphs, which have edges between all pairs of nodes. This shows that the LLM has a prior that two nodes in a graph are more likely to be disconnected. Distractive statements in the graph encoding function disrupt the performance of the LLM. The accuracy of node degree, node count, and connected nodes tasks is highest for star and path graphs. This is likely because the star and path graphs are more likely to have fewer edges and their graph encoding is most likely shorter with less distracting statements to these tasks. This is also evident from the accuracy of these tasks being among the lowest in complete graphs, which have many edges to specify and therefore many distractors. Adding out-of-distribution few-shot examples helped the LLM. Similarly to the experiment in Section 3.1, adding few-shot examples and their chain of thought in COT prompting helped on most tasks. The key difference between the few-shot examples in this experiment and the previous one is that in this case, the examples are not required to come from the same graph generator algorithm. This shows that few-shot examples do not need to come from the same generator for the LLM to be helpful, and their main role is to explain the task to the LLM. 8 Summary: The performance of large language models (LLMs) on graph tasks is significantly im- pacted by the graph structure and the distracting statements in the graph encoding function. Graphs with fewer edges and less complex encodings tend to perform better on most tasks. Adding few-shot examples, even if they are out-of-distribution, can help the LLM to perform better on most tasks. 5 RELATED WORK In-context learning. One common approach for reasoning with LLMs is to pre-train it on a large corpus of text that is closely related to the reasoning task. This has been shown to improve the performance (Hendrycks et al., 2021; Shen et al., 2021), but it can be computationally expensive, especially for larger models. Additionally, fine-tuning often demands domain-specific data and human expertise, adding to the cost. Brown et al. (2020b) has demonstrated the capabilities of LLMs in tackling novel tasks with little or no training data. The FEW-SHOT method inserts k in- context input-output pairs before the test input and has been shown to significantly improve the performance of the LLM on unseen tasks. Recent research has proposed strategies to improve the selection of in-context demonstrations, such as retrieving semantically similar examples (Liu et al., 2021), employing chain-of-thought reasoning (Wei et al., 2022), and decomposing tasks into sub- problems using least-to-most prompting (Zhou et al., 2022a). In this work, we focus on evaluating and enhancing LLMs on basic graph reasoning tasks. We exploit some of the ideas in the literature and compare their results. Text-based reasoning with LLMs. Numerous models have been proposed for text-based reasoning employing LLMs (see (Huang & Chang, 2022) for a survey). One approach to reasoning with LLMs is modular reasoning. This methodology divides the problem into smaller modules, utilizing distinct LMs to address each module (Zhou et al., 2022a; Kazemi et al., 2022; Khot et al., 2022). Another approach to reasoning with LLMs aims to predict the output of a question in a single LM call. This study primarily focuses on the latter method. Knowledge-Augmented LLMs. Another body of work is concerned with the use of knowledge (frequently stored in knowledge graphs (KGs)) to improve LLM understanding of the world (Pan et al., 2023). Several different methodologies have been proposed which range from generating additional training data from KGs (Guu et al., 2020; Lewis et al., 2020; Agarwal et al., 2021) to extending pretraining (Yasunaga et al., 2022; Jin et al., 2023). Reasoning on graphs using LLMs. The combination of graph learning and reasoning with LLMs is a rapidly growing area. InstructGLM (Ye et al., 2023) proposed an instruction-finetuned LLM for performing node classification. Chen et al. (2023) used LLMs as enhancers to exploit text attributes to be used in a graph learning model or as predictors for node classification on text-attributed graphs. The closest work to ours is Wang et al. (2023), which proposed a set of tasks for benchmarking LLMs on graphs. However, this work omitted several natural graph tasks, lacked variety in the type of graph structure considered, and fixed the graph and question encoder function. They conclude that LLMs have preliminary graph reasoning abilities on somewhat complex graph tasks. Present work. In this study, we focus on basic graph tasks, which are essential intermediate steps for more complex reasoning tasks on graphs. We conduct extensive experiments on graph and question encoder functions, as well as a wide range of graph generator functions. We provide an extensive study of graph encoding methods for black-box LLM usage, and introduce GraphQA, a new graph benchmark that illustrates the effect of graph structure on LLM encoding. We also provide insights and best practices for encoding graphs as text for use in LLMs. 6 CONCLUSIONS In this work, we have presented the first comprehensive study of encoding graph-structured data as text for consumption by LLMs. We show that LLM performance on graph reasoning tasks varies on three fundamental levels: (1) the graph encoding method, (2) the nature of the graph task it- self, and (3) interestingly, the very structure of the graph considered. These novel results provide valuable insight on strategies for encoding graphs as text – which can boost performance on graph reasoning tasks inside LLMs by 4.8% to 61.8%. We believe that this is a fruitful avenue for further investigation, and hope that our GraphQA benchmark tasks inspire additional work in the area. 9 REFERENCES Oshin Agarwal, Heming Ge, Siamak Shakeri, and Rami Al-Rfou. Knowledge graph based synthetic corpus generation for knowledge-enhanced language model pre-training, 2021. R ́eka Albert and Albert-L ́aszl ́o Barab ́asi. Statistical mechanics of complex networks. Reviews of modern physics, 74(1):47, 2002. Rohan Anil, Andrew M Dai, Orhan Firat, Melvin Johnson, Dmitry Lepikhin, Alexandre Passos, Siamak Shakeri, Emanuel Taropa, Paige Bailey, Zhifeng Chen, et al. Palm 2 technical report. arXiv preprint arXiv:2305.10403, 2023. Albert-L ́aszl ́o Barab ́asi and R ́eka Albert. Emergence of scaling in random networks. science, 286 (5439):509–512, 1999. Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020a. Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020b. S ́ebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Ka- mar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023. Zhikai Chen, Haitao Mao, Hang Li, Wei Jin, Hongzhi Wen, Xiaochi Wei, Shuaiqiang Wang, Dawei Yin, Wenqi Fan, Hui Liu, et al. Exploring the potential of large language models (llms) in learning on graphs. arXiv preprint arXiv:2307.03393, 2023. Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022. Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language mod- els. arXiv preprint arXiv:2210.11416, 2022. Peter Clark, Oyvind Tafjord, and Kyle Richardson. Transformers as soft reasoners over language. arXiv preprint arXiv:2002.05867, 2020. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. Vijay Prakash Dwivedi and Xavier Bresson. A generalization of transformer networks to graphs. arXiv preprint arXiv:2012.09699, 2020. Paul Erd ̋os and Alfred R ́enyi. On random graphs. Publicationes Mathematicae Debrecen, 6:290– 297, 1959. Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Mingwei Chang. Retrieval augmented language model pre-training. In International conference on machine learning, pp. 3929–3938. PMLR, 2020. Aric Hagberg, Pieter Swart, and Daniel S Chult. Exploring network structure, dynamics, and func- tion using networkx. Technical report, Los Alamos National Lab.(LANL), Los Alamos, NM (United States), 2008. Dan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, Dawn Song, and Jacob Steinhardt. Measuring mathematical problem solving with the math dataset. arXiv preprint arXiv:2103.03874, 2021. Paul W Holland, Kathryn Blackmond Laskey, and Samuel Leinhardt. Stochastic blockmodels: First steps. Social networks, 5(2):109–137, 1983. 10 Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, arXiv preprint and Weizhu Chen. Lora: Low-rank adaptation of large language models. arXiv:2106.09685, 2021. Jie Huang and Kevin Chen-Chuan Chang. Towards reasoning in large language models: A survey. arXiv preprint arXiv:2212.10403, 2022. Bowen Jin, Wentao Zhang, Yu Zhang, Yu Meng, Xinyang Zhang, Qi Zhu, and Jiawei Han. Patton: Language model pretraining on text-rich networks. arXiv preprint arXiv:2305.12268, 2023. Seyed Mehran Kazemi, Najoung Kim, Deepti Bhatia, Xin Xu, and Deepak Ramachandran. Lambada: Backward chaining for automated reasoning in natural language. arXiv preprint arXiv:2212.13894, 2022. Tushar Khot, Harsh Trivedi, Matthew Finlayson, Yao Fu, Kyle Richardson, Peter Clark, and Ashish Sabharwal. Decomposed prompting: A modular approach for solving complex tasks. arXiv preprint arXiv:2210.02406, 2022. Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. Advances in neural information processing systems, 35:22199–22213, 2022. Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. arXiv preprint arXiv:2104.08691, 2021. Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich K ̈uttler, Mike Lewis, Wen-tau Yih, Tim Rockt ̈aschel, et al. Retrieval-augmented genera- tion for knowledge-intensive nlp tasks. Advances in Neural Information Processing Systems, 33: 9459–9474, 2020. Jiachang Liu, Dinghan Shen, Yizhe Zhang, Bill Dolan, Lawrence Carin, and Weizhu Chen. What makes good in-context examples for gpt-3? arXiv preprint arXiv:2101.06804, 2021. Luis M ̈uller, Mikhail Galkin, Christopher Morris, and Ladislav Ramp ́aˇsek. Attending to graph transformers. arXiv preprint arXiv:2302.04181, 2023. Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35: 27730–27744, 2022. John Palowitch, Anton Tsitsulin, Brandon Mayer, and Bryan Perozzi. Graphworld: Fake graphs bring real insights for gnns. In Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pp. 3691–3701, 2022. Shirui Pan, Linhao Luo, Yufei Wang, Chen Chen, Jiapu Wang, and Xindong Wu. Unifying large language models and knowledge graphs: A roadmap, 2023. Reid Pryzant, Dan Iter, Jerry Li, Yin Tat Lee, Chenguang Zhu, and Michael Zeng. Automatic prompt optimization with" gradient descent" and beam search. arXiv preprint arXiv:2305.03495, 2023. Phillip Schneider, Tim Schopf, Juraj Vladika, Mikhail Galkin, Elena Simperl, and Florian Matthes. arXiv preprint A decade of knowledge graphs in natural language processing: A survey. arXiv:2210.00105, 2022. Jianhao Shen, Yichun Yin, Lin Li, Lifeng Shang, Xin Jiang, Ming Zhang, and Qun Liu. Generate & rank: A multi-task framework for math word problems. arXiv preprint arXiv:2109.03034, 2021. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural informa- tion processing systems, 30, 2017. Heng Wang, Shangbin Feng, Tianxing He, Zhaoxuan Tan, Xiaochuang Han, and Yulia arXiv preprint Tsvetkov. Can language models solve graph problems in natural language? arXiv:2305.10037, 2023. 11 Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Fei Xia, Ed Chi, Quoc V Le, Denny Zhou, et al. Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35:24824–24837, 2022. Chengrun Yang, Xuezhi Wang, Yifeng Lu, Hanxiao Liu, Quoc V Le, Denny Zhou, and Xinyun Chen. Large language models as optimizers. arXiv preprint arXiv:2309.03409, 2023. Mustafa Yasir, John Palowitch, Anton Tsitsulin, Long Tran-Thanh, and Bryan Perozzi. Examining the effects of degree distribution and homophily in graph learning models, 2023. Michihiro Yasunaga, Antoine Bosselut, Hongyu Ren, Xikun Zhang, Christopher D Manning, Percy Liang, and Jure Leskovec. Deep bidirectional language-knowledge graph pretraining, 2022. Ruosong Ye, Caiqi Zhang, Runhui Wang, Shuyuan Xu, and Yongfeng Zhang. Natural language is all a graph needs. arXiv preprint arXiv:2308.07134, 2023. Jiawei Zhang, Haopeng Zhang, Congying Xia, and Li Sun. Graph-bert: Only attention is needed for learning graph representations. arXiv preprint arXiv:2001.05140, 2020. Sarah J Zhang, Samuel Florin, Ariel N Lee, Eamon Niknafs, Andrei Marginean, Annie Wang, Keith Tyser, Zad Chin, Yann Hicke, Nikhil Singh, et al. Exploring the mit mathematics and eecs cur- riculum using large language models. arXiv preprint arXiv:2306.08997, 2023a. Yue Zhang, Yafu Li, Leyang Cui, Deng Cai, Lemao Liu, Tingchen Fu, Xinting Huang, Enbo Zhao, Yu Zhang, Yulong Chen, et al. Siren's song in the ai ocean: A survey on hallucination in large language models. arXiv preprint arXiv:2309.01219, 2023b. Wayne Xin Zhao, Kun Zhou, Junyi Li, Tianyi Tang, Xiaolei Wang, Yupeng Hou, Yingqian Min, Beichen Zhang, Junjie Zhang, Zican Dong, et al. A survey of large language models. arXiv preprint arXiv:2303.18223, 2023. Denny Zhou, Nathanael Sch ̈arli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuur- mans, Claire Cui, Olivier Bousquet, Quoc Le, et al. Least-to-most prompting enables complex reasoning in large language models. arXiv preprint arXiv:2205.10625, 2022a. Yongchao Zhou, Andrei Ioan Muresanu, Ziwen Han, Keiran Paster, Silviu Pitis, Harris Chan, and Jimmy Ba. Large language models are human-level prompt engineers. arXiv preprint arXiv:2211.01910, 2022b. 12 A APPENDIX A.1 GRAPH ENCODING FUNCTION We conducted an investigation into various methodologies for representing graphs as text. This process of encoding graphs as text can be separated into two key inquiries: First, the encoding of nodes within the graph, and second the encoding of edges between the nodes. Encoding Nodes. Regarding the encoding of nodes, we examined several techniques, including: • Integer encoding (e.g., Node 0). • Utilizing well-known English first names (e.g., David). • Utilizing popular character names in television series Game of Thrones and South Park. • Incorporating the first names of American politicians. • Employing alphabet letters for representation. Representing Edges. Regarding the encoding of the edges, we examined the following techniques: • Parenthesis: describing edges as (source node, target node). • Friendship: source node and target node are friends. • Coauthorship: source node and target node wrote a paper together. • Social network: source node and target node are connected. • Arrows: source node −→ target node. • Incident: source node is connected to target nodes. Combining the node and edge encoding, we start with the following list of graph encoding functions: • Adjacency. using integer node encoding and parenthesis edge encoding. • Incident. using integer node encoding and incident edge encoding. • Friendship. using well-known english first names as node encoding and friendship edge encoding. • Co-authorship. using well-known english first names as node encoding and coauthorship edge encoding. • SP. using South Park character names as node encoding and friendship as edge encoding. • GOT. using Game of Thrones character names as node encoding and friendship as edge encoding. • Social network. using well-known English first names and social network edge encoding. • Politician. using politician American politician first names and social network edge en- coding. • Expert. employing alphabet letters for node encoding and arrows as edge encoding. The encoding starts with "You are a graph analyst" (expert prompting (Zhang et al., 2023a)). Here, we provide the full details for the graph encoding functions for the graph example in Figure 5. Adjacency: In an undirected graph, (i,j) means that node i and node j are connected with an undi- rected edge. G describes a graph among nodes 0, 1, 2, 3, 4, 5, 6, 7, and 8. The edges in G are: (0, 1) (0, 2) (1, 2) (2, 3) (2, 4) (2, 5) (2, 7) (3, 8) (5, 6) (6, 7) (7, 8). 13 Figure 5: Running example graph for all graph encoding functions. Incident: G describes a graph among 0, 1, 2, 3, 4, 5, 6, 7, and 8. In this graph: Node 0 is connected to nodes 1, 2. Node 1 is connected to nodes 0, 2. Node 2 is connected to nodes 0, 1, 3, 4, 5, 7. Node 3 is connected to nodes 2, 8. Node 4 is connected to node 2. Node 5 is connected to nodes 2, 6. Node 6 is connected to nodes 7, 5. Node 7 is connected to nodes 2, 8, 6. Node 8 is connected to nodes 3, 7. Co-authorship: G describes a co-authorship graph among James, Robert, John, Michael, David, Mary, Patricia, Jennifer, and Linda. In this co-authorship graph: James and Robert wrote a paper together. James and John wrote a paper together. Robert and John wrote a paper together. John and Michael wrote a paper together. John and David wrote a paper together. John and Mary wrote a paper together. John and Jennifer wrote a paper together. Michael and Linda wrote a paper together. Mary and Patricia wrote a paper together. Patricia and Jennifer wrote a paper together. Jennifer and Linda wrote a paper together. Friendship: G describes a friendship graph among James, Robert, John, Michael, David, Mary, Patricia, Jennifer, and Linda. We have the following edges in G: James and Robert are friends. James and John are friends. Robert and John are friends. John and Michael are friends. John and David are friends. John and Mary are friends. John and Jennifer are friends. Michael and Linda are friends. Mary and Patricia are friends. Patricia and Jennifer are friends. Jennifer and Linda are friends. 14 SP: G describes a friendship graph among Eric, Kenny, Kyle, Stan, Tolkien, Heidi, Bebe, Liane, and Sharon. In this friendship graph: Eric and Kenny are friends, Eric and Kyle are friends, Kenny and Kyle are friends, Kyle and Stan are friends, Kyle and Tolkien are friends, Kyle and Heidi are friends, Kyle and Liane are friends, Stan and Sharon are friends, Heidi and Bebe are friends, Bebe and Liane are friends, Liane and Sharon are friends. GOT: G describes a friendship graph among Ned, Cat, Daenerys, Jon, Bran, Sansa, Arya, Cersei, and Jaime. In this friendship graph: Ned and Cat are friends, Ned and Daenerys are friends, Cat and Daenerys are friends, Daenerys and Jon are friends, Daenerys and Bran are friends, Daenerys and Sansa are friends, Daenerys and Cersei are friends, Jon and Jaime are friends, Sansa and Arya are friends, Arya and Cersei are friends, Cersei and Jaime are friends. Social Network: G describes a social network graph among James, Robert, John, Michael, David, Mary, Patricia, Jennifer, and Linda. We have the following edges in G: James and Robert are connected. James and John are connected. Robert and John are connected. John and Michael are connected. John and David are connected. John and Mary are connected. John and Jennifer are connected. Michael and Linda are connected. Mary and Patricia are connected. Patricia and Jennifer are connected. Jennifer and Linda are connected. Politician: G describes a social network graph among Barack, Jimmy, Arnold, Bernie, Bill, Kamala, Hillary, Elizabeth, and John. We have the following edges in G: Barack and Jimmy are connected. Barack and Arnold are connected. Jimmy and Arnold are connected. Arnold and Bernie are connected. Arnold and Bill are connected. Arnold and Kamala are connected. Arnold and Elizabeth are connected. Bernie and John are connected. Kamala and Hillary are connected. Hillary and Elizabeth are connected. Elizabeth and John are connected. Expert: You are a graph analyst and you have been given a graph G among A, B, C, D, E, F, G, H, and I. G has the following undirected edges: A -> B A -> C B -> C C -> D C -> E C -> F C -> H D -> I F -> G G -> H H -> I 15 A.2 GRAPH TASKS GraphQA consists of a diverse set of basic graph problems, including: • Edge existence. Determine whether a given edge exists in a graph. • Node degree. Calculate the degree of a given node in a graph. • Node count. Count the number of nodes in a graph. • Edge count. Count the number of edges in a graph. • Connected nodes. Find all the nodes that are connected to a given node in a graph. • Cycle check. Determine whether a graph contains a cycle. • Disconnected nodes. Find all the nodes that are not connected to a given node in a graph. These tasks are all relatively simple, but they require LLMs to be able to reason about the rela- tionships between nodes and edges in a graph. While adhering to basic graph tasks, we aimed for a diverse set of tasks, including discriminative (e.g., cycle check) and generative (e.g., connected or disconnected nodes) challenges. These tasks covered various aspects of graph analysis, from existence checks (e.g., edge existence) to quantitative assessments (e.g., node count), path analysis (e.g., cycle check), recall-based tasks (e.g., connected nodes), and null space exploration (e.g., dis- connected nodes). The basic graph tasks listed above are all essential intermediate steps for more complex reasoning tasks on graphs. For example, to determine the shortest path between two nodes in a graph, we must first be able to find all the nodes that are connected to a given node. To detect communities in a graph, we must first be able to identify all the cycles in the graph. To find the most influential node in a graph, we must first be able to calculate the degree of each node. These tasks are essential building blocks for more complex reasoning tasks on graphs. A.3 GRAPH ENCODING RANKINGS To provide recommendations about the best graph encoding function to use for each prompt type, we rank the encoders by their average standing (in rank order) on each graph task. The results are presented in Table 5, where a lower number is better (the encoder ranked higher on average). We note that for most prompting methods, incident encoding performed the best. However, for ZERO- SHOT graph prompting, node tokens with more established representations (such as politicians or popular fantasy characters) outperformed incident encoding. graph encoding ZERO-SHOT ZERO-COT FEW-SHOT Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert 4.83 6.16 6.08 5.16 5.16 4.33 4.58 3.50 5.16 3.25 2.58 6.33 6.41 4.50 4.08 6.50 6.33 5.00 2.16 2.00 5.58 6.25 5.25 5.83 5.83 6.25 5.83 COT 3.00 2.33 6.75 4.66 5.75 5.00 6.16 5.58 5.75 COT-BAG 1.83 1.33 8.83 6.00 4.66 6.25 6.41 4.00 5.66 Table 5: Ranking of graph encodings from experiment in Section 3.1 (lower better). A.4 IMPLEMENTATION DETAILS For our experiments, we used PaLM 62B and PaLM 2 (various sizes) served on a 4 × 4 TPU v4 architecture. The decoding temperature was set to zero. We used the NetworkX library (Hag- berg et al., 2008) to generate the random graphs and to find the answers to the graph tasks. To generate random graphs, we use Erd ̋os-R ́enyi (ER) graphs (Erd ̋os & R ́enyi, 1959), scale-free net- works (SFN) (Barab ́asi & Albert, 1999), Barab ́asi–Albert model (BA) (Albert & Barab ́asi, 2002), 16 and stochastic block model (SBM) (Holland et al., 1983), in addition to star, path, and complete graph generators. To generate graphs, we sampled 500 graphs for each of the following algorithms: ER, BA, SFN, and SBM. We sampled 100 graphs for path, complete, and star graphs, as these have less variety. All graphs had between 5 and 20 nodes. For ER graphs, we sampled the probability for edge creation from [0, 1]. For SBM graphs, number of communities has been sampled from 2 to 10. We are committed to open-sourcing both our code and data upon the acceptance of our paper. A.5 EVALUATING MORE LLMS FOR GRAPH TASKS WITH DIFFERENT GRAPH ENCODING FUNCTIONS We compared different graph encoding functions on a PaLM 62B (Chowdhery et al., 2022) in Sec- tion 3.1. Here, we provide the results of the same experiment on PaLM 2 XXS, XS, S, and L (Anil et al., 2023) in Tables 6, 8, 10 and 11. We also provide results for some instruction-finetuned Flan (Chung et al., 2022) checkpoints of the same models in Tables 7 and 9. 17 Method Encoding function Edge Existence Node degree Node count Edge count Connected nodes Cycle check T O H S - O R E Z T O C - O R E Z T O H S - W E F T O C G A B - T O C Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert 47.2 48.4 45.2 45.4 42.8 56.6 56.4 51.2 40.6 38.0 34.1 20.2 45.0 48.8 43.2 30.8 21.8 39.4 40.6 16.8 42.7 50.2 46.6 44.2 42.8 29.4 26.0 40.4 50.6 54.0 50.6 51.0 48.6 51.4 50.4 52.2 51.4 53.8 47.0 49.6 50.3 49.6 49.6 50.4 48.8 50.4 51.8 55.8 49.2 47.4 11.3 14.4 13.4 10.8 10.8 11.0 7.8 11.0 12.0 10.4 8.6 19.0 36.0 22.0 0.2 0 0 0 0 0 10.3 11.8 12.8 7.6 9.6 10.4 10.0 9.4 8.2 12.6 24.7 80.8 55.0 31.2 8.8 9.4 9.2 8.6 9.4 10.2 23.7 73.0 53.4 30.4 8.4 7.0 11.0 10.6 9.4 10.2 8.7 6.2 7.2 7.4 5.4 7.2 6.0 7.8 9.4 21.4 1.7 2.4 1.2 0.8 0.6 1.2 1.2 5.0 2.2 0.4 23.9 77.6 58.4 31.0 8.8 9.6 8.2 8.4 7.2 6.0 22.8 72.2 54.4 29.8 8.4 10.0 8.0 7.8 8.4 6.4 19.4 57.8 46.6 28.4 6.2 6.8 6.0 9.4 6.0 7.4 6.4 4.0 5.2 4.6 5.6 5.8 7.0 5.4 6.8 12.8 2.2 2.0 6.0 4.4 1.6 0.6 0.6 1.8 2.6 0.6 10.2 27.0 19.8 11.8 7.4 4.6 5.4 4.2 6.0 6.0 9.3 22.0 17.2 10.0 4.2 6.6 5.6 5.8 6.4 5.6 9.2 22.8 17.6 10.2 5.2 5.0 5.0 4.6 6.6 6.2 7.2 17.6 11.2 5.2 1.6 3.0 2.0 5.2 10.0 9.0 6.0 9.0 16.0 11.8 2.0 1.0 2.6 4.8 5.2 1.6 13.3 17.4 18.4 11.4 11.8 11.6 9.0 12.0 12.6 15.8 13.3 19.6 17.2 12.2 10.2 12.0 10.4 8.4 13.8 15.6 13.6 17.6 14.4 14.6 9.2 12.4 13.2 11.0 16.0 14.2 61.5 82.6 68.4 66.4 65.2 26.6 51.8 74.4 73.2 45.2 13.7 16.4 37.8 31.6 10.8 3.0 4.8 6.2 7.0 6.0 26.0 83.4 57.8 31.0 7.2 7.0 9.8 11.2 12.0 14.6 77.0 84.0 81.6 80.6 77.4 74.6 70.4 76.0 75.8 72.6 68.4 82.4 77.2 74.0 65.8 61.2 57.2 59.4 69.6 68.6 Table 6: Comparing different graph encoding functions on different graph tasks for PaLM 2 XXS. The most effective prompting heuristic is highlighted with an underline, and the top-performing graph function encoder for the respective heuristic is highlighted in bold. 18 Method Encoding function Edge Existence Node degree Node count Edge count Connected nodes Cycle check T O H S - O R E Z T O C - O R E Z T O H S - W E F T O C G A B - T O C Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert 56.6 57.6 59.8 58.2 57.2 54.8 51.2 54.4 55.8 60.2 45.9 51.2 52.4 47.0 47.2 39.4 40.8 47.2 48.2 39.8 54.1 53.2 53.2 54.2 56.0 59.0 52.8 50.6 51.4 56.6 56.4 57.4 56.4 54.4 58.0 62.4 54.4 56.0 53.8 55.2 52.6 53.4 49.4 52.4 50.8 56.6 52.6 54.0 51.0 53.2 11.1 10.4 12.2 10.8 11.0 11.4 9.0 11.8 12.2 11.0 17.6 26.2 38.8 25.0 10.0 9.0 9.4 10.0 13.0 16.8 10.0 11.2 11.4 10.8 8.4 9.0 8.8 9.8 7.6 12.8 20.0 51.6 41.0 28.6 11.0 10.4 11.2 8.2 8.4 9.8 19.6 50.2 44.0 26.4 10.2 8.8 11.0 8.0 9.2 9.0 11.7 10.0 11.8 9.8 11.6 15.4 16.2 11.0 8.0 11.8 11.2 5.2 6.0 10.8 16.6 12.8 11.6 12.4 13.6 11.6 11.9 16.2 23.0 13.0 9.4 10.4 9.4 8.8 7.8 9.2 17.3 31.8 37.0 19.6 11.6 12.2 13.2 12.4 9.6 8.6 17.7 30.4 33.2 22.6 12.6 13.4 12.8 12.6 10.8 10.6 3.9 4.6 4.2 5.0 2.6 3.0 3.4 3.2 4.8 4.0 9.7 16.6 13.6 12.4 9.2 9.2 7.8 7.2 6.2 4.8 4.9 4.6 5.6 4.6 4.8 5.4 5.8 4.2 5.2 3.8 6.6 14.8 10.8 7.2 4.0 3.4 4.2 3.8 6.4 5.0 8.1 17.4 16.6 8.4 4.6 4.0 5.4 5.4 5.0 5.8 8.2 15.6 11.6 6.8 3.0 5.8 5.2 6.6 7.6 11.4 14.4 19.2 16.8 13.8 11.4 14.2 11.0 11.6 12.8 19.0 8.6 9.2 9.0 8.4 8.4 8.8 8.6 7.8 9.4 8.0 8.0 10.4 11.2 7.6 6.0 5.4 5.4 6.0 8.2 11.6 8.1 10.2 9.0 7.0 5.2 5.8 6.4 7.8 9.2 12.6 20.8 23.4 32.4 25.8 18.4 17.0 16.6 15.2 18.4 19.6 33.9 70.6 46.4 32.8 21.4 22.6 17.4 15.2 22.8 56.2 82.6 82.8 80.2 84.4 81.0 84.2 84.6 85.4 80.2 80.8 82.7 80.0 80.8 83.4 81.6 84.4 84.0 86.0 80.8 83.0 82.1 81.2 79.8 85.2 80.0 82.4 82.4 82.2 83.0 82.8 Table 7: Comparing different graph encoding functions on different graph tasks for Flan-PaLM 2 XXS. The most effective prompting heuristic is highlighted with an underline, and the top- performing graph function encoder for the respective heuristic is highlighted in bold. 19 Method Encoding function Edge Existence Node degree Node count Edge count Connected nodes Cycle check T O H S - O R E Z T O C - O R E Z T O H S - W E F T O C G A B - T O C Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert 49.9 50.8 50.6 48.2 49.2 52.4 53.8 44.6 49.0 50.2 43.7 48.2 53.6 46.8 32.8 40.2 41.2 47.2 47.0 36.0 40.4 42.2 48.6 42.6 45.0 36.6 32.4 41.6 43.0 31.4 57.8 43.4 55.8 59.6 64.2 62.0 62.4 61.0 55.2 56.4 58.9 49.8 57.4 59.0 66.2 61.2 61.2 60.6 54.8 60.0 23.0 22.4 36.6 21.4 20.6 22.6 17.8 22.4 21.4 22.0 3.8 16.6 10.6 2.6 0.4 0.4 0.2 0 0.8 3.0 22.3 23.2 35.4 24.0 17.4 23.6 19.6 20.8 16.2 20.2 30.2 63.0 63.8 27.2 19.0 19.2 19.6 21.4 18.4 20.0 29.6 57.8 61.8 27.0 22.6 18.4 20.4 19.2 17.8 21.4 28.7 11.4 11.2 31.0 36.2 38.4 32.2 35.8 32.8 29.6 16.9 3.0 2.6 9.2 18.4 21.4 20.8 25.4 27.6 23.8 26.0 43.2 58.8 22.2 16.8 16.2 17.2 18.4 17.6 23.2 28.2 43.0 54.4 25.2 20.2 18.0 20.6 23.0 21.4 27.6 30.0 43.0 50.0 25.8 22.6 23.8 27.2 24.8 23.2 29.6 21.3 22.2 11.0 17.8 24.0 25.8 25.8 24.4 21.8 18.6 9.9 18.4 6.2 2.2 12.6 4.0 3.8 12.4 15.6 14.0 18.7 29.6 31.8 18.2 13.8 16.0 17.8 14.4 12.8 13.8 17.0 26.8 24.6 13.4 12.8 16.6 17.4 13.2 14.0 14.4 15.8 26.4 23.8 15.6 10.0 15.2 15.0 10.8 11.2 14.4 10.1 25.8 31.0 11.6 4.2 2.8 1.8 2.0 5.2 6.6 15.2 26.6 50.8 19.6 3.2 4.8 3.6 3.8 4.8 19.4 16.5 21.4 34.0 15.2 13.2 13.0 10.6 12.8 11.6 17.0 19.7 33.0 44.2 17.2 13.0 15.0 12.2 10.4 13.6 18.8 20.0 32.8 41.8 17.6 10.2 13.4 13.6 13.4 15.4 21.8 15.6 21.8 30.6 6.8 0 0.4 0 0 15.2 65.4 14.2 40.4 43.6 8.6 3.6 7.6 2.8 1.4 10.0 10.2 27.2 58.0 41.2 29.4 18.2 20.2 17.0 21.0 26.0 13.4 36.4 69.8 38.8 40.6 40.8 10.2 6.2 42.6 61.4 17.4 37.1 71.2 55.8 34.8 38.2 15.6 9.8 35.8 53.6 19.2 Table 8: Comparing different graph encoding functions on different graph tasks for PaLM 2 XS. The most effective prompting heuristic is highlighted with an underline, and the top-performing graph function encoder for the respective heuristic is highlighted in bold. 20 Method Encoding function Edge Existence Node degree Node count Edge count Connected nodes Cycle check T O H S - O R E Z T O C - O R E Z T O H S - W E F T O C G A B - T O C Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert 68.4 78.0 76.2 64.8 63.4 59.2 62.6 72.0 69.0 70.6 54.3 68.6 59.4 51.8 53.8 49.4 47.0 51.4 55.6 51.8 70.9 72.0 81.8 68.0 66.8 67.6 67.6 70.6 71.2 72.4 71.9 76.0 77.0 67.4 69.0 71.2 71.0 75.0 72.4 68.2 74.7 73.0 80.0 72.4 74.6 74.4 75.6 76.8 71.2 74.4 10.2 17.6 29.6 11.2 5.4 5.4 4.6 4.4 5.6 7.6 16.4 34.8 51.2 15.0 6.2 5.8 7.6 8.0 8.8 10.6 13.2 22.4 27.0 17.8 7.2 7.0 5.0 10.2 8.6 13.6 23.8 72.4 63.4 22.6 7.4 7.4 9.8 6.8 10.2 14.6 25.0 73.8 63.4 25.2 8.6 9.0 8.0 9.2 12.6 15.4 26.8 39.0 46.0 23.6 23.4 16.8 19.6 17.6 20.0 35.4 32.2 23.0 24.2 25.8 41.6 33.6 27.6 34.4 35.6 44.2 21.4 33.2 33.6 20.2 17.0 15.8 15.2 14.6 16.4 26.2 20.7 30.2 32.8 19.0 17.6 15.4 16.4 11.4 15.4 28.4 27.9 37.8 35.0 28.8 25.0 23.6 24.8 19.6 22.2 34.6 4.4 7.2 3.8 3.4 3.2 2.8 3.2 4.0 4.4 7.2 13.4 16.6 11.0 11.8 12.2 13.8 12.8 12.4 12.8 17.0 10.0 14.4 7.2 11.2 9.0 10.0 9.2 9.0 9.0 11.2 12.6 25.6 18.0 13.8 7.8 9.6 7.4 8.0 11.0 11.8 14.1 25.8 19.8 13.8 11.4 10.6 10.2 9.6 11.8 13.8 23.0 34.4 45.8 20.8 15.2 16.0 18.2 17.8 17.2 21.4 25.1 36.8 55.8 26.6 19.6 14.4 16.6 18.4 14.6 23.2 10.4 12.2 22.0 8.0 4.8 6.0 6.8 6.6 6.6 20.8 14.0 16.6 23.2 9.4 10.2 9.4 10.2 8.0 13.4 25.2 14.8 16.2 23.4 11.2 8.6 9.6 12.4 12.2 13.4 26.6 84.4 87.2 84.4 84.6 84.0 84.0 83.2 84.0 84.6 84.0 59.9 82.0 67.4 41.4 70.6 37.0 38.6 74.0 53.8 74.6 87.2 86.6 83.4 89.4 86.8 88.6 88.0 88.2 87.6 86.4 86.7 85.4 82.2 84.2 88.8 87.4 89.4 88.4 89.8 84.8 88.8 86.4 84.2 86.0 90.4 90.0 91.8 90.4 91.8 88.0 Table 9: Comparing different graph encoding functions on different graph tasks for Flan-PaLM 2 XS. The most effective prompting heuristic is highlighted with an underline, and the top-performing graph function encoder for the respective heuristic is highlighted in bold. 21 Method Encoding function Edge Existence Node degree Node count Edge count Connected nodes Cycle check T O H S - O R E Z T O C - O R E Z T O H S - W E F T O C G A B - T O C Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert 48.2 47.2 44.0 49.2 50.4 50.0 51.6 47.0 49.0 45.8 37.0 46.0 51.2 53.6 34.6 43.8 18.0 35.2 30.4 20.0 47.5 61.4 69.4 28.2 47.2 45.6 26.2 50.4 39.4 60.0 57.6 62.6 68.2 46.8 66.2 66.4 50.6 52.2 43.6 62.0 55.2 54.0 59.4 41.8 66.0 63.8 59.2 49.8 47.8 55.4 41.4 33.6 68.8 36.2 36.8 35.6 36.4 42.0 41.2 41.8 7.4 36.0 26.8 0.6 0.4 2.6 0 0 0 0.4 36.9 37.2 61.2 33.4 36.0 30.6 29.2 35.8 30.4 38.2 44.3 69.4 78.4 36.0 38.0 32.4 30.4 40.4 32.2 41.8 43.7 66.2 77.2 38.4 36.8 30.2 32.2 39.4 32.4 40.6 36.5 14.0 15.0 41.6 46.6 51.6 49.0 48.4 37.8 24.8 31.3 20.4 7.8 44.2 36.4 44.6 43.0 38.0 30.2 17.0 40.0 81.2 83.2 31.2 25.6 29.4 27.4 30.8 27.6 23.4 41.7 82.0 80.8 35.2 29.0 29.2 28.0 31.4 30.8 28.8 44.4 85.2 89.0 35.0 31.8 31.0 31.0 34.0 32.8 30.0 12.1 19.0 19.8 12.6 8.6 8.0 11.2 9.6 7.6 12.4 13.1 20.4 12.0 9.8 15.8 14.8 12.4 22.6 7.0 3.0 16.9 18.4 20.4 15.8 17.4 15.8 18.2 16.6 15.6 14.2 19.4 23.8 26.6 16.6 17.4 17.6 19.2 17.0 16.4 20.2 20.8 25.8 24.8 18.8 22.2 17.8 19.4 20.6 16.8 21.0 25.0 32.8 72.2 14.0 17.0 18.2 15.8 19.0 14.2 22.0 14.7 15.6 72.4 16.2 5.2 5.6 2.8 2.6 2.2 9.6 22.9 37.8 80.4 12.2 12.8 13.8 12.0 13.8 13.6 10.0 23.0 41.8 79.6 12.8 9.6 13.8 8.2 11.0 8.0 22.0 22.7 40.6 81.6 11.8 6.6 10.2 10.0 12.2 6.2 25.4 74.7 83.6 82.2 57.8 83.4 40.6 75.0 83.2 83.6 82.6 16.5 69.6 46.6 5.8 4.8 0.6 0.2 3.4 1.4 16.4 40.4 43.8 45.8 20.2 47.2 46.4 37.8 42.4 35.4 45.0 42.5 41.0 44.4 34.6 46.4 45.6 24.2 50.4 44.8 51.0 39.6 41.6 42.8 29.4 48.8 33.8 21.4 47.6 38.6 52.8 Table 10: Comparing different graph encoding functions on different graph tasks for PaLM 2 S. The most effective prompting heuristic is highlighted with an underline, and the top-performing graph function encoder for the respective heuristic is highlighted in bold. 22 Method Encoding function Edge Existence Node degree Node count Edge count Connected nodes Cycle check T O H S - O R E Z T O C - O R E Z T O H S - W E F T O C G A B - T O C Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert Overall Adjacency Incident Co-authorship Friendship SP GOT Social Network Politician Expert 47.5 43.6 48.6 48.0 48.0 49.2 51.0 46.0 50.0 43.0 41.6 31.6 52.0 43.4 46.0 38.6 38.8 47.8 51.4 24.8 41.5 49.2 73.2 16.4 32.6 33.2 30.0 40.4 39.4 59.2 52.2 53.6 72.4 42.4 55.0 54.4 51.4 42.8 36.8 60.8 60.4 64.6 71.6 52.0 64.8 65.8 65.0 48.4 50.4 61.2 55.1 49.6 85.0 55.2 50.8 49.8 52.6 50.2 52.8 50.2 7.9 13.2 54.8 0.8 0.6 0 0.4 0 1.2 0.2 55.8 61.0 82.4 51.4 53.0 45.6 48.6 51.4 53.6 55.0 59.7 81.4 94.6 55.0 48.8 48.4 51.2 51.4 53.0 53.2 60.0 78.0 95.4 55.8 49.6 51.6 50.2 53.6 53.0 52.6 76.3 100.0 98.6 67.4 63.2 56.4 70.6 61.0 70.8 98.6 73.9 66.4 75.0 81.8 80.2 78.6 68.6 78.4 66.6 69.4 60.3 97.6 99.2 45.4 45.6 40.6 41.6 44.0 46.2 82.8 62.2 98.0 98.8 45.0 45.0 44.6 46.2 43.6 50.4 88.4 63.1 98.6 99.4 48.6 45.6 44.2 44.6 46.4 51.0 89.6 30.6 36.8 6.6 32.4 31.2 30.8 34.8 31.6 32.2 39.4 24.4 25.2 9.8 31.6 26.2 27.6 30.0 30.2 29.2 9.6 35.9 43.2 37.4 32.2 35.2 35.2 38.2 32.4 35.2 34.0 34.4 42.2 29.8 33.8 33.4 34.2 35.2 32.4 33.0 35.8 34.6 39.4 32.2 33.0 32.6 33.0 38.6 31.2 33.8 37.2 19.5 55.6 88.0 1.6 0.2 6.6 6.2 0 1.0 16.0 39.5 61.6 84.4 27.8 20.4 41.0 29.8 28.2 17.2 45.0 46.1 66.4 85.6 36.8 44.2 30.6 36.0 38.2 32.2 45.0 45.2 66.6 87.2 37.0 40.8 26.2 29.4 39.8 30.2 49.6 45.0 64.2 89.0 36.8 36.4 26.4 29.6 45.6 24.2 52.8 83.3 83.8 83.2 83.2 83.2 83.2 83.2 83.2 83.2 83.2 22.4 52.0 55.2 9.0 8.4 0.2 1.0 6.4 11.6 57.4 73.8 78.4 78.4 73.6 79.4 57.8 61.4 79.0 77.6 78.6 72.7 66.8 68.6 69.4 80.6 71.0 65.4 77.0 76.8 78.6 69.2 70.4 70.8 63.0 71.8 69.4 64.0 72.0 63.4 78.4 Table 11: Comparing different graph encoding functions on different graph tasks for PaLM 2 L. The most effective prompting heuristic is highlighted with an underline, and the top-performing graph function encoder for the respective heuristic is highlighted in bold. 23
http://arxiv.org/abs/2310.04558v1
"2023-10-06T19:47:20"
"2023-10-06T19:47:20"
VTON-IT: Virtual Try-On using Image Translation
Virtual Try-On (trying clothes virtually) is a promising application of the Generative Adversarial Network (GAN). However, it is an arduous task to transfer the desired clothing item onto the corresponding regions of a human body because of varying body size, pose, and occlusions like hair and overlapped clothes. In this paper, we try to produce photo-realistic translated images through semantic segmentation and a generative adversarial architecture-based image translation network. We present a novel image-based Virtual Try-On application VTON-IT that takes an RGB image, segments desired body part, and overlays target cloth over the segmented body region. Most state-of-the-art GAN-based Virtual Try-On applications produce unaligned pixelated synthesis images on real-life test images. However, our approach generates high-resolution natural images with detailed textures on such variant images.
[ "Santosh Adhikari", "Bishnu Bhusal", "Prashant Ghimire", "Anil Shrestha" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04558v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04558v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.LG" ]
VTON-IT: Virtual Try-On using Image Translation Santosh Adhikari 1*, Bishnu Bhusal 2*, Prashant Ghimire 3 and Anil Shrestha 3 1*VIBOT, Universit ́e de Bourgogne, Le Creusot, France. 2*EECS, University of Missouri, Columbia, 65211, MO, USA. 3 IKebana Solutions LLC, Japan. *Corresponding author(s). E-mail(s): santosh adhikari@etu.u-bourgogne.fr ; bhusalb@mail.missouri.edu; Contributing authors: ghimireprashant.p@gmail.com; anilkumarshrestha.cs@gmail.com; Abstract Virtual Try-On (trying clothes virtually) is a promising application of the Gener- ative Adversarial Network (GAN). However, it is an arduous task to transfer the desired clothing item onto the corresponding regions of a human body because of varying body size, pose, and occlusions like hair and overlapped clothes. In this paper, we try to produce photo-realistic translated images through semantic segmentation and a generative adversarial architecture-based image translation network. We present a novel image-based Virtual Try-On application VTON-IT that takes an RGB image, segments desired body part, and overlays target cloth over the segmented body region. Most state-of-the-art GAN-based Virtual Try- On applications produce unaligned pixelated synthesis images on real-life test images. However, our approach generates high-resolution natural images with detailed textures on such variant images. ∗ Keywords: Virtual Try On, Human Part Segmentation, Image Translation, Semantic Segmentation, Generative Adversarial Network ∗ Details of the implementation, algorithms and codes, are publicly available on Github: https://github.com/shuntos/VITON-IT 1 3 2 0 2 t c O 6 ] V C . s c [ 1 v 8 5 5 4 0 . 0 1 3 2 : v i X r a 1 Introduction Research and Development on Virtual Try-On applications is getting popular as the fashion e-commerce market is rapidly growing. With a virtual try-on application, customers can try the desired cloth virtually before purchasing and sellers can benefit from an increased online marketplace. In addition, this application can reduce the uncertainty of size and appearance that most online shoppers are afraid of. Problems of traditional 3D-based virtual try-on are computational complexity, tedious hardware dependent data acquisition process and less user-friendly [1]. Image based 2D virtual try-on application, if integrated into existing e-commerce or digital marketplace, will be more scalable and memory sufficient as compared to 3D approach. With the recent development in the GAN, Image-to-image translation on the conditional setting is possible [2]. Improved discriminator and generation architec- ture made cross-domain high-resolution image translation possible [3]. Which makes transformation of styles and textures from one domain to another possible. In this paper, we mainly focus on solving the problems of 2D virtual try on appli- cations by leveraging state-of-the-art deep learning network for semantic segmentation and robust image translation network for translating the input image into target domain. In previous works like VVT [4] there are problems with semantic segmenta- tion because of plain backgrounds in training datasets. To solve this issue we trained a UNet-like semantic segmentation architecture on diverse images manually picked from the FGV6 dataset [5]. For image translation tasks residual mapping generator and the multi-scale discriminator is used which takes a semantic mask from the seg- mentation network and translates it into a wrapped RGB cloth with fine details. The previous methods only worked on an image with a single person on it [6]. Therefore, to make it applicable for multi-person cases, we used a pre-trained human detection Yolov5 model [7] trained on COCO dataset [8] to generate a bounding box for each human body and crop the overlaying cloth on it. VTON-IT architecture offers pose, background, and occlusion invariant application for the online fashion industry with a wide range of applications. Rigorous testing and experiments have shown that our approach generates more visually promising overlayed images as compared to existing methods. 2 Related Works There are a number of image based virtual try-on approaches that have been tried in the prior researches, those relevant in our study are discussed here. 2.1 VITON Han et al. presented an image-based Virtual Try-On Network (VITON) [9]: a coarse- to-fine framework that seamlessly transferred a target clothing item in a product image to the corresponding region of a clothed person in a 2D image. The warped target clothing-to match the pose of the clothed person was generated using a thin-plate spline (TPS) transformation which is ultimately fused with the person's image. 2 2.2 CP-VTON A similar structure to VITON is adopted by CPVTON [10], but it uses a neural network to learn the spatial transformation parameters of the TPS transformation present in its Geometric Matching Module (GMM). Therefore, the GMM will create a warped cloth image and a try-on module will fuse the warped cloth image to the target image of the person, preserving the precise features of the clothes. 2.3 CP-VTON+ CP-VTON+ [11] proposed a framework that preserves both cloth shape and texture through a two-stage architecture. The first stage is the Clothing Warping Stage, which transfers the texture of the clothing from the clothing image to the target person image. The later stage is the Blending Stage, which introduces a refinement module to further improve the quality of the generated try-on image. The framework consists of four major components: a body parsing network, a spatial transformer network, a shape transfer network, and a texture transfer network. 2.4 VTNFP VTNFP [12] follows a three-stage design strategy by first generating warped clothing, followed by generating a body segmentation map of the person wearing the target clothing, and ending with a try-on synthesis module to fuse together all information for a final image synthesis. This method preserves target cloth and human body parts along with clothes that need no replacement. 2.5 Virtual Try-on auxiliary human segmentation Virtual Try-On using auxiliary human segmentation [13] was based on additional improvements on existing CP-VTON. Using the human semantic segmentation predic- tion as an auxiliary task helped improve the virtual try-on performance. A branched architecture was proposed to simultaneously predict the try-on result and the expected segmentation mask of the generated try-on output where the target model was now wearing the in-shop cloth. 3 Proposed Approach The network architecture proposed in this study is composed of three key components. The initial stage of the proposed architecture involves the implementation of a human body parsing network, which is followed by a body region segmentation network. Finally, an image translation network is employed to enable the wrapping of input clothing over the target body. 3.1 Human Parsing Network To parse the body part for translation, the input image is given as input to Yolov5 pre-trained model trained on the Microsoft COCO dataset [8] for object detection 3 Fig. 1 Proposed VITON-IT overview. First the human body is detected and cropped. Then, the desired body region is segmented through U 2-Net architecture and the segmented mask is fed to the image translation network to generate wrapped cloth. Finally, wrapped cloth is overlayed over the input image. tasks. This model outperforms existing object detection models in terms of latency and memory consumption. Model gives bounding boxes of humans in image and probability score. This allows the user to perform image translation on multiple objects. Pytorch implementation of the Yolov5-large model is used for inference. Input image of size (640 × 640) is fed into the network with confidence threshold = 0.25, Non-Maximum IOU threshold = 0.45, and max detection = 10 is used. 3.2 Human body Segmentation U 2-Net architecture has been implemented to generate masks of desired body parts for image translation tasks. While existing backbones, such as Alexnet [14], VGG [15], ResNet [16], and DenseNet [17], are utilized for semantic segmentation tasks, their feature maps have a lower resolution. For example, ResNet reduces the size of feature maps to one-fourth of the input size. However, feature map resolution is very crucial for salient object detection (SOD). The objective of SOD is to segment the most visually appealing object in an image. Similarly, another problem of such backbones is their complex architecture because of additional feature extractor modules for extracting multi-level saliency features. Nested UNet architecture, U 2-Net aims to go deeper while preserving feature map resolution. It can be trained from scratch and preserve the resolution of feature maps with the help of residual U-block (RSU). Top-level UNet-like architecture is followed by RSU which can extract Intra-stage multi-scale features. Architecture: For salient object detection tasks, both local and global contextual information plays an important role. Existing feature extractor backbones have small receptive fields as they use small convolution filters of size (1×1) or (3×3) for the sake of computational cost and storage space. Such small receptive fields are not capable of capturing global information. Large receptive fields can capture global information 4 from high-resolution feature maps. Dilated convolution operation results in an enlarged receptive field. However, performing multiple dilated convolution operations earlier with the original resolution needs high computational and memory resources. To tackle this problem RSU is used which has mainly three components. 1. Input Convolution layer: Transforms input feature map(H, W, Cin) to intermedi- ate feature map F 1(x) with cout. Local features are extracted from this plain convolution layer. 2. Input feature map F 1(x) is given as input to UNet like architecture of height L, higher value of L means deeper the network with large number of pooling layers and ranges of receptive fields and numbers of local and global features. During down- sampling multi-scale features are extracted and higher resolution features maps are encoded through progressive upsampling, concatenation and convolution. 3. Fusion of local and global features is done through RSU. H(x) = (F (x) + U (F (x)) Where F (x) = Intermediate feature map, U (F (x)) = Multi-Scale contextual information and H(x) = Desired mapping of input features. U 2-Net consists of two-level nested U structures. The first level consists of 11 well- configured RSU stages capable of extracting intra-stage multi-scale and inter-stage multi-level features. Architecture has main 3 parts: a six-stage encoder, a five-stage decoder, and a saliency map fusion module with a decoder stage and the last encoder stage. In the first four encoder stages RSU is used but in the 5th and 6th stage resolution of the feature map is relatively low, so further downsampling might lead to loss of contextual information. Thus in the 5th and 6th encoder stages dilated RSU (replaced upsampling and pooling with dilated convolution) is used to preserve the resolution of feature maps. Feature map resolution in the 4th to 6th stages is the same. In decoder stages, dilated RSU is used when each stage takes concatenated upsampled feature maps from the previous stage. Saliency map fuser inputs saliency probability maps from five decoders and the last stage (6th) encoder where each map is generated through (3×3) convolution and sigmoid function. These probability maps are concatenated and passed through (1 × 1) convolution and sigmoid function to generate the final saliency probability map Sf used. 3.3 Image Translation Masks generated by the human body segmentation network are passed through an image translation network (pix2pix). This network produces high-resolution photo- realistic synthesis RGB images from semantic label maps by leveraging a Generative Adversarial Network (GAN) in a conditional setting. Such visually appealing images are produced under adversarial training instead of any loss functions. Architecture: This GAN framework consists of generator G and discriminator D for image-image translation tasks. The task of generator G is to generate an image(RGB) of cloth given a binary semantic map generated by the human body segmentation network. Whereas, discriminator D tries to classify whether the generated image is real or synthesized. Dataset consists of a pair of images (Si and Xi) where Si is a mask and Xi is the corresponding real image. This architecture works in supervised 5 configuration to model the conditional distribution of real images with given binary masks with a min-max game. Where generator G and discriminator D try to win against each other. From [18], we have, min G max D V (D, G) = Ex∼pdata (x)[log D(x)] + Ez∼pz(z)[log(1 − D(G(z)))] (1) This architecture uses UNet as a generator and a patch-based network as a dis- criminator. The generator takes 3 channel mask whereas a concatenated channel-wise semantic label map and the corresponding image are fed to Discriminator. The main component of this architecture is a coarse-to-fine generator, multi-scale discriminator, and optimized adversarial objective function. The generator consists of a global gen- erator network G1 and a local enhancer network. Local generator outputs an image of resolution 4 times larger than the original, or in other words ( 2 times of width and height) greater than the previous one. To increase the resolution of the synthesis image additional local generators can be added. For instance, the output resolution of {G1, G2) is 1024 × 2048 whereas the output resolution of {G1, G2, G3} is 2048 × 4096. First global generator G1 is trained and then the local generator G2 is trained and so on, in the order of their resolution. Global generator G1 is trained on low-resolution images then another residual network G2 is added to G1 and a joint network is trained on higher-resolution images. Element wise sum of the feature map of G2 and the last feature map of G1 is fed into the next G2. To differentiate real image and synthesis image, the discriminator must have a greater receptive field to capture global contextual information and similarly be able to extract lower-level local features. Discriminator architecture consists of 3 different identical discriminators each working on different resolutions. The resolution of the real and synthesized image is downscaled by the factor of 2 to create an image pyramid of 3 scale. By this approach, a discriminator with the finest resolution helps the generator to produce an image with fine details. min G max D1D2D3 (cid:88) k=1,2,3 LGAN (G, Dk) (2) Where D1D2, D3 are 3 scale discriminators [3]. As this architecture uses a multi- scale discriminator it extracts features from its multiple layers thus the generator has to produce a natural image at multiple scales. By adding such feature loss in the discriminator this helps to stabilize training loss. Feature match loss is given by [3], LGM (G, Dk) = E(s,x) T (cid:88) i=1 1 Ni [||D(i) k (s, x) − D(i) k (s, G(s))||1] (3) Where Dk, D(i) k are feature extractor layers of discriminator, T represent total number of layers and N represent number of elements per layer. By adding feature match loss and GAN loss objective function becomes [3], 6   minG  maxD1,D2,D3   (cid:88) k=1,2,3 LGAN (G, Dk)  + λ (cid:88) k=1,2,3 LF M (G, Dk)  (4) This loss function works well for translating mask to cloth image with higher resolution and detail texture. Fig. 2 Virtual Try-On Architecture: An input image is first fed to the YOLOv5 object detection model to detect the human body, which is then cropped. The cropped image is then passed through the U 2-Net segmentation model to generate a body region mask. Finally, the mask is fed into the Pix2Pix generator, which synthesizes RGB-based clothing onto the masked body region, resulting in a virtual try-on of the clothing. The output image shows the synthesized clothing on the original human body image. 7 4 Implementation Details 4.1 Training Human Body Segmentation network For the training dataset, 6000 good quality images are selected manually from FGVC6 [5] dataset and labeled using Labelme tool [19] to generate desired body masks. The average resolution of training images is (630 × 1554). The model was trained through transfer learning using a pre-trained model trained on COCO dataset for general human body segmentation task with input Image size 320 × 320 with random flip and crop. Pytorch library is used for training and inference. Adam optimizer [20] is used to train our network and its hyperparameters are set to default (initial learning rate lr = 1e−3, betas = (0.9, 0.999), eps = 1e−8, weight decay = 0). And initially, the loss is set to 1. The total number of iterations was 400000 with a training loss of 0.109575. The model was trained on a custom dataset with unique ground truth. So per- formance was evaluated on a custom test dataset and we achieved M axF B = 0.865, Mean average Error (M AE) = 0.081, F Bw = 0.801, and SM = 0.854. 4.2 Training Image Translation Network Dataset was prepared manually by creating a pair of real images and corresponding mask. Images are labeled using the Labelme tool to generate a semantic label and apply a series of geometrical augmentation algorithms. We prepared training pair images through data augmentation. As deep neural networks involve millions of parameters, incorporating more training data that is relevant to the domain can effectively mit- igate the problem of overfitting. According to Zhao et. al [21], GAN performance is improved more by augmentations that cause spatial changes than by augmentations that just cause visual changes. Therefore, we have used several geometric augmentation techniques to augment the cloth image before training. These are namely Perspective Transform, Piecewise Affine Transform, Elastic Transformation, Shearing, and Scal- ing. We augmented both the image and its corresponding mask using the Imgaug library [22]. The image translation model was trained on a 3-channel input image of size (512 × 512) with a batch size of 4, without input label and instance map. The gen- erator generates output images with the same number of image channels and shapes. Final loss consists of three components: GAN loss, discriminator-based feature match- ing loss, and VGG perceptual loss. After training up to 100 epoch we got a GAN loss of 0.83, a GAN Feature loss of 2.123, and a VGG perceptual loss of 1.81. 4.3 Training Setup Both human segmentation and image translation network was trained on a Ubuntu 16.04 with 2 Nvidia GPU: GA102 [GeForce RTX 3090], 32 GB RAM and CPU: 20 core Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz. 8 Fig. 3 Example training image for human segmentation and image translation network 5 Experimental Results 5.1 Qualitative Results For evaluating the performance of VTON-IT through visual observation, we compared the final overlayed images with the output of CP-VTON+ [11]. Figure 4 shows that proposed virtual try-on application produces more realistic and convincing results in terms of texture transfer quality and pose preservation. Most of the existing virtual try on produce low-resolution output image. CP-VTON+ generates an output image with a fixed shape (192 × 256) but our proposed approach works on high-resolution images. Through a high-resolution image translation network wrapped cloth of shape (512 × 512) is generated. While experimenting with high-resolution input of shape (2448 × 3264) we got a perfectly aligned natural-looking overlayed image with the same shape as input. 5.1.1 Result on Outdoor Images Even though most of the images used for training body segmentation and translation are captured indoors with proper lighting conditions and predictable poses, both seg- mentation and translation models produce promising results on outdoor images with noisy backgrounds, unusual poses, and different lighting conditions. Figure 5 shows the results of the inference performed on outdoor images. However, the image on the right side has some artifacts in the unusual pose. 5.2 Quantitative Results We adopted Structural Similarity Index(SSIM) [23], Multi-Scale Structural Similarity (MS-SSIM), Fr ́echet Inception Distance (FID) [24] and Kernel Inspection Distance (KID) [25] scores to measure the similarity between ground truths and synthesized images. The ground truths were made by manually wrapping clothes over the models' images using various imaging tools and the synthesized images were the output of the model used. The result are shown in Table 1. 9 Reference Image Target Clothes Wrapped Clothes Final Result CP-VTON+ VTON-IT(proposed) Final Wrapped Result Clothes Fig. 4 Visualized comparison with CP-VTON+ 5.3 User Study Although SSIM, MS-SSIM, FID, and KID can be used to determine the quality of image synthesis, it cannot reflect the overall realism and visual quality as assessed by human evaluation. Thus we performed a user study with 60 volunteers. In order to evaluate realism, volunteers were provided with two sets of images: ground truth 10 Fig. 5 Result on outdoor images images (manually wrapped clothes on the human models) and the outputs generated by our model. They were asked to score based on how real the clothes looked on the person and how well the texture of clothing was preserved. Then, they were asked to independently rate the photo-realism of only our output images. The result shows that our result was 70% similar to the ground truth and 60% photo-realistic. Table 1 Quantitative evaluation of CP-VTON+ and VTON-IT in terms of SSIM, MS-SSIM, FID and KID scores. Methods CPVTON+ 0.83 0.93 VTON-IT SSIM MS-SSIM FID KID 0.077 0.019 0.60 0.87 393 50 6 Discussion The effectiveness of this approach has been demonstrated through experiments con- ducted on both male and female bodies, under different lighting conditions, and with occlusions such as hands and hair, as well as varying poses. The first stage of the human detection network plays a crucial role in enhancing the overall performance of the application by reducing the input image size for later stages and eliminating unnecessary input regions by cropping the human body. To create an accurate seg- mentation map that adheres to geometric principles, it is necessary to train a human body segmentation network using ground truth images that contain detailed wrist and neck regions. Problem with public dataset like LVIS [26], MS COCO [8] and, Pascal Person Part dataset [27] is improper ground truth, hence we tried different pre-trained models like CDCL [28] , GRAPHONY [29], U2NET [30] to generate ground truth but none of these generate precise body mask. So, we manually picked 6000 good images of both men and women from the FGC6 dataset and labeled them manually. We trained a Generative image translation model on conditional settings with a pair of images as input. In order to generate a pair of images, we utilize geometrical augmentation techniques on both the semantic mask generated by the segmentation network and the corresponding real RGB image. 11 7 Conclusion and Future Works The paper presents an innovative approach called VTON-IT (Virtual Try-On using Image Translation) that enables the transfer of desired clothing onto a person's image, while accounting for variations in body size, pose, and lighting conditions. The pro- posed method outperforms existing approaches, as evidenced by quantitative and qualitative results that demonstrate the generation of natural-looking synthesized images. The proposed architecture consists of three components: human detection, body part segmentation, and image translation network. The image translation net- work is trained in this paper to generate synthesized images of the same domain (sweatshirts). However, it can be adapted for cross-domain synthesis by incorporating control parameters as label features. Future work may extend this approach to differ- ent types of clothing such as trousers, shorts, shoes, and more. Acknowledgements: The authors would like to thank IKebana Solutions LLC for providing them with constant support for this research project. References [1] Hauswiesner, S., Straka, M., Reitmayr, G.: Free viewpoint virtual try-on with commodity depth cameras. In: Proceedings of the 10th International Conference on Virtual Reality Continuum and Its Applications in Industry, pp. 23–30 (2011) [2] Isola, P., Zhu, J.-Y., Zhou, T., Efros, A.A.: Image-to-image translation with condi- tional adversarial networks. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1125–1134 (2017) [3] Wang, T.-C., Liu, M.-Y., Zhu, J.-Y., Tao, A., Kautz, J., Catanzaro, B.: High- Resolution Image Synthesis and Semantic Manipulation with Conditional GANs. arXiv (2017). https://doi.org/10.48550/ARXIV.1711.11585 . https://arxiv.org/ abs/1711.11585 [4] Dong, H., Liang, X., Shen, X., Wu, B., Chen, B.-C., Yin, J.: Fw-gan: Flow- navigated warping gan for video virtual try-on. In: Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 1161–1170 (2019) [5] Guo, S., Huang, W., Zhang, X., Srikhanta, P., Cui, Y., Li, Y., Scott, M.R., Adam, H., Belongie, S.: The iMaterialist Fashion Attribute Dataset. arXiv (2019). https: //doi.org/10.48550/ARXIV.1906.05750 . https://arxiv.org/abs/1906.05750 [6] Liu, Y., Zhao, M., Zhang, Z., Zhang, H., Yan, S.: Arbitrary virtual try-on net- work: Characteristics preservation and trade-off between body and clothing. arXiv preprint arXiv:2111.12346 (2021) [7] Jocher, G., Stoken, A., Chaurasia, A., Borovec, J., NanoCode012, TaoXie, Kwon, Y., Michael, K., Changyu, L., Fang, J., V, A., Laughing, tkianai, yxNONG, Skalski, P., Hogan, A., Nadar, J., imyhxy, Mammana, L., AlexWang1900, Fati, C., Montes, D., Hajek, J., Diaconu, L., Minh, M.T., Marc, albinxavi, fatih, oleg, 12 wanghaoyang0106: ultralytics/yolov5: v6.0 - YOLOv5n 'Nano' models, Roboflow integration, TensorFlow export, OpenCV DNN support. Zenodo (2021). https: //doi.org/10.5281/zenodo.5563715 . https://doi.org/10.5281/zenodo.5563715 [8] Lin, T.-Y., Maire, M., Belongie, S., Hays, J., Perona, P., Ramanan, D., Doll ́ar, P., Zitnick, C.L.: Microsoft coco: Common objects in context. In: European Conference on Computer Vision, pp. 740–755 (2014). Springer [9] Han, X., Wu, Z., Wu, Z., Yu, R., Davis, L.S.: Viton: An image-based virtual try- on network. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7543–7552 (2018) [10] Wang, B., Zheng, H., Liang, X., Chen, Y., Lin, L., Yang, M.: Toward characteristic-preserving image-based virtual try-on network. In: Proceedings of the European Conference on Computer Vision (ECCV), pp. 589–604 (2018) [11] Minar, M.R., Tuan, T.T., Ahn, H., Rosin, P., Lai, Y.-K.: Cp-vton+: Clothing shape and texture preserving image-based virtual try-on. In: The IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops (2020) [12] Yu, R., Wang, X., Xie, X.: Vtnfp: An image-based virtual try-on network with body and clothing feature preservation. In: Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 10511–10520 (2019) [13] Ayush, K., Jandial, S., Chopra, A., Krishnamurthy, B.: Powering virtual try-on via auxiliary human segmentation learning. In: Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, pp. 0–0 (2019) [14] Krizhevsky, A., Sutskever, I., Hinton, G.E.: Imagenet classification with deep convolutional neural networks. Communications of the ACM 60(6), 84–90 (2017) [15] Simonyan, K., Zisserman, A.: Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556 (2014) [16] He, K., Zhang, X., Ren, S., Sun, J.: Deep residual learning for image recogni- tion. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 770–778 (2016) [17] Huang, G., Liu, Z., Van Der Maaten, L., Weinberger, K.Q.: Densely connected convolutional networks. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4700–4708 (2017) [18] Goodfellow, I.J., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., Bengio, Y.: Generative Adversarial Networks. arXiv (2014). https://doi.org/10.48550/ARXIV.1406.2661 . https://arxiv.org/abs/1406.2661 13 [19] Russell, B.C., Torralba, A., Murphy, K.P., Freeman, W.T.: Labelme: a database and web-based tool for image annotation. International journal of computer vision 77(1), 157–173 (2008) [20] Kingma, D.P., Ba, J.: Adam: A Method for Stochastic Optimization. arXiv (2014). https://doi.org/10.48550/ARXIV.1412.6980 . https://arxiv.org/ abs/1412.6980 [21] Zhao, Z., Zhang, Z., Chen, T., Singh, S., Zhang, H.: Image Augmentations for GAN Training. arXiv (2020). https://doi.org/10.48550/ARXIV.2006.02595 . https://arxiv.org/abs/2006.02595 [22] Jung, A.B., Wada, K., Crall, J., Tanaka, S., Graving, J., Reinders, C., Yadav, S., Banerjee, J., Vecsei, G., Kraft, A., Rui, Z., Borovec, J., Vallentin, C., Zhydenko, S., Pfeiffer, K., Cook, B., Fern ́andez, I., De Rainville, F.-M., Weng, C.-H., Ayala- Acevedo, A., Meudec, R., Laporte, M., et al.: imgaug. https://github.com/aleju/ imgaug. Online; accessed 01-Feb-2020 (2020) [23] Wang, Z., Bovik, A.C., Sheikh, H.R., Simoncelli, E.P.: Image quality assess- ment: from error visibility to structural similarity. IEEE transactions on image processing 13(4), 600–612 (2004) [24] Heusel, M., Ramsauer, H., Unterthiner, T., Nessler, B., 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) [25] Bi ́nkowski, M., Sutherland, D.J., Arbel, M., Gretton, A.: Demystifying mmd gans. arXiv preprint arXiv:1801.01401 (2018) [26] Gupta, A., Dollar, P., Girshick, R.: Lvis: A dataset for large vocabulary instance segmentation. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5356–5364 (2019) [27] Chen, X., Mottaghi, R., Liu, X., Fidler, S., Urtasun, R., Yuille, A.: Detect what you can: Detecting and representing objects using holistic models and body parts. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1971–1978 (2014) [28] Lin, K., Wang, L., Luo, K., Chen, Y., Liu, Z., Sun, M.-T.: Cross-domain complementary learning using pose for multi-person part segmentation. IEEE Transactions on Circuits and Systems for Video Technology 31(3), 1066–1078 (2020) [29] Gong, K., Gao, Y., Liang, X., Shen, X., Wang, M., Lin, L.: Graphonomy: Universal human parsing via graph transfer learning. In: CVPR (2019) [30] Qin, X., Zhang, Z., Huang, C., Dehghan, M., Zaiane, O., Jagersand, M.: U2-net: 14 Going deeper with nested u-structure for salient object detection, vol. 106, p. 107404 (2020) 15
http://arxiv.org/abs/2310.04550v1
"2023-10-06T19:24:00"
"2023-10-06T19:24:00"
Module-wise Adaptive Distillation for Multimodality Foundation Models
Pre-trained multimodal foundation models have demonstrated remarkable generalizability but pose challenges for deployment due to their large sizes. One effective approach to reducing their sizes is layerwise distillation, wherein small student models are trained to match the hidden representations of large teacher models at each layer. Motivated by our observation that certain architecture components, referred to as modules, contribute more significantly to the student's performance than others, we propose to track the contributions of individual modules by recording the loss decrement after distillation each module and choose the module with a greater contribution to distill more frequently. Such an approach can be naturally formulated as a multi-armed bandit (MAB) problem, where modules and loss decrements are considered as arms and rewards, respectively. We then develop a modified-Thompson sampling algorithm named OPTIMA to address the nonstationarity of module contributions resulting from model updating. Specifically, we leverage the observed contributions in recent history to estimate the changing contribution of each module and select modules based on these estimations to maximize the cumulative contribution. We evaluate the effectiveness of OPTIMA through distillation experiments on various multimodal understanding and image captioning tasks, using the CoCa-Large model (Yu et al., 2022) as the teacher model.
[ "Chen Liang", "Jiahui Yu", "Ming-Hsuan Yang", "Matthew Brown", "Yin Cui", "Tuo Zhao", "Boqing Gong", "Tianyi Zhou" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04550v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04550v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.CL", "cs.LG" ]
3 2 0 2 t c O 6 ] V C . s c [ 1 v 0 5 5 4 0 . 0 1 3 2 : v i X r a Module-wise Adaptive Distillation for Multimodality Foundation Models Chen Liang Georgia Tech cliang73@gatech.edu Jiahui Yu Google Research jiahuiyu@google.com Ming-Hsuan Yang UC Merced, Google Research minghsuan@google.com Matthew Brown Google Research mtbr@google.com Yin Cui NVIDIA Research richardaecn@gmail.com Tuo Zhao Georgia Tech tourzhao@gatech.edu Boqing Gong Google Research bgong@google.com Tianyi Zhou University of Maryland, College Park tianyi@umd.edu Abstract Pre-trained multimodal foundation models have demonstrated remarkable general- izability but pose challenges for deployment due to their large sizes. One effective approach to reducing their sizes is layerwise distillation, wherein small student models are trained to match the hidden representations of large teacher models at each layer. Motivated by our observation that certain architecture components, referred to as modules, contribute more significantly to the student's performance than others, we propose to track the contributions of individual modules by record- ing the loss decrement after distillation each module and choose the module with a greater contribution to distill more frequently. Such an approach can be naturally formulated as a multi-armed bandit (MAB) problem, where modules and loss decrements are considered as arms and rewards, respectively. We then develop a modified-Thompson sampling algorithm named OPTIMA to address the non- stationarity of module contributions resulting from model updating. Specifically, we leverage the observed contributions in recent history to estimate the changing contribution of each module and select modules based on these estimations to maximize the cumulative contribution. We evaluate the effectiveness of OPTIMA through distillation experiments on various multimodal understanding and image captioning tasks, using the CoCa-Large model [48] as the teacher model. 1 Introduction Large pre-trained multimodality foundation models have demonstrated remarkable generalizability on a wide range of tasks, e.g., image classification, image-text retrieval, and visual question answering [27, 18, 49, 46, 48]. These models often contain several architectural components (referred to as modules), each acquiring knowledge of one or more modalities through pre-training. For example, [27] introduce a dual-encoder architecture composed of an image encoder and a text encoder, which are jointly pre-trained to align an image with the corresponding text. This process equips each encoder with both the unimodal representation power and the crossmodal alignment capability. [48] further add a multimodal decoder on top of the dual-encoder architecture. The decoder learns a joint visual and textual representation and obtains the multimodal understanding knowledge. However, the sizes of these models have reached billions of parameters, and the number of modules will further scale to 37th Conference on Neural Information Processing Systems (NeurIPS 2023). accommodate new modalities. This poses a significant challenge for deployment in applications with latency and storage constraints. Layerwise distillation is a powerful approach to compressing large models (i.e., teacher models) into small ones (i.e., student models) with minimal loss of performance [16, 30]. This approach trains a student to match the hidden representations of the teacher at each layer. Given that the teacher's layerwise representations often contain rich semantic knowledge, they can significantly improve the student's generalizability [19, 45, 11]. Many existing works have demonstrated the effectiveness of this layerwise strategy in task-specific distillation, where a student is distilled from a teacher that has been fine-tuned on the target task [38, 17]. In task-specific distillation in multimodality models, however, matching the student's representations with those of the teacher at every layer does not always benefit the student's performance. Prior research has shown that improving the representations of a specific modality (i.e., image, text, or multimodality) tends to yield better fine-tuning results than others [51]. Therefore, we hypothesize that the representations of such a modality may contain more relevant knowledge to the target task. If the student focuses on mimicking these representations, it is more likely to achieve better performance on the target task. To verify this hypothesis, we distill multiple students from a CoCa-Large teacher [48], each only matching the teacher's layerwise representations in a single module (i.e., image encoder, text encoder, or multimodal decoder). As shown in Figure 1, distilling a specific module yields significantly better performance than distilling others. If all modules are distilled with equal weighting, interference from other modules may affect the training of this specific module, thereby compromising the student's fitting on the target task (Figure 3). Figure 1: Performances of CoCa-Tiny12 students distilled from a CoCa-Large teacher [48] on NLVR2 [37] and Microsoft COCO Caption [6]. Each bar represents the performance obtained by matching only the layerwise representations in a single module. See Details in Section 4. To mitigate this issue, we propose to track the individual modules' contributions to the distillation process on the target task and choose a module to distill at each step based on their contributions. In this way, we can more frequently distill the module with a greater contribution. To evaluate the contribution of a module, we distill it for a specific number of steps and observe the resulting ratio of decrement in the distillation loss. To track its contribution continually, we repeat this procedure throughout training. Hence, we need to explore different modules by repeatedly evaluating their contributions and, meanwhile, exploit the module with the greatest contribution by distilling it more frequently. Given a limited budget for training steps, we face a significant challenge in balancing exploration and exploitation. To address this challenge, we adopt a multi-armed bandit (MAB) approach [36, 41]. MAB targets an online decision-making problem that chooses an action (i.e., arm) and observes a reward in each round to maximize the cumulative reward over rounds. MAB algorithms are designed for balancing the evaluation of all arms and choosing the arm that maximizes the cumulative reward, hence can be leveraged to evaluate and choose modules. As illustrated in Figure 2, we consider each module as an arm and every P steps as one round. In each round, we choose a module to distill for P steps and evaluate its contribution as the reward. As more rewards are observed, we obtain a more accurate estimate of the underlying reward distribution for each module, which reflects the actual contribution of this module. Based on the reward distribution, we choose modules to maximize the cumulative loss decrement. However, the actual contribution of a module may change with model updating. For example, distilling the multimodal decoder may become more beneficial when its input, i.e., the image and text representations, are sufficiently optimized [39]. To estimate such a non-stationary underlying reward 2 ImgTxtMultiModules506070Test Accuracy (%)61.551.766.9NLVR2ImgTxtMultiModules6080100120CIDEr105.175.659.5COCO Caption Figure 2: An illustration of OPTIMA. distribution, we need to count more on rewards observed in recent history. This makes it challenging for us to adopt classical MAB algorithms because most of them are designed for stationary underlying reward distributions [4, 10, 40]. Therefore, they average the observed rewards over the whole history to estimate the underlying reward distribution. In our case, since the model is unlikely to change drastically within a few steps, and so is the underlying reward distribution, we tailor these stationary algorithms by replacing the simple average with the exponential moving average of the observed rewards. By discounting old rewards, the reward distribution can track the changing contribution in recent history and provide stable and up-to-date guidance for module selection [13, 15, 28]. By adapting MAB algorithms to the non-stationary environment of multimodality model distillation, we propose OPTIMA (Module-wise Adaptive Distillation with Multi-arm Bandit), a novel task- specific distillation method for multimodality foundation models. We exemplify OPTIMA using the Thompson Sampling algorithm for its strong empirical and theoretical performance [32, 1, 5, 31, 2]. We remark that OPTIMA can be generically combined with other MAB algorithms. We demonstrate the effectiveness of OPTIMA on various multimodality understanding and im- age captioning benchmarks [14, 47, 37, 6]. Specifically, we distill a CoCa-Tiny12 (102M) and a CoCa-Tiny6 (55M) from a CoCa-Large teacher (672M, [48]), a powerful pre-trained multimodality foundation model. For both students, OPTIMA substantially surpasses the layerwise distillation baseline. Moreover, CoCa-Tiny12 outperforms CoCa-Base in three out of four tasks with only 1/3 its number of layers. Extensive analysis verifies that OPTIMA can track the changing contributions of different modules and choose modules based on their contributions. 2 Preliminaries Architectures of Multimodality Foundation Models can be generally categorized into dual-encoder [27, 18, 49, 23], encoder-decoder [42, 46, 44], and Contrastive Captioners (CoCa, [48]). Dual- encoder models contain an image encoder and a text encoder. The two encoders take images and texts as inputs, respectively, and are jointly pre-trained to align an image and relevant text. This enables each encoder to learn both the unimodal representations and the crossmodal alignment knowledge. Encoder-decoder models contain a multimodal decoder on top of an image encoder. The decoder learns a joint visual and textual representation and obtains the multimodal understanding knowledge. To integrate the knowledge from the image encoder, the text encoder, and the multimodal decoder, CoCa combines all modules in a single Transformer and trains them jointly. Specifically, the multimodal decoder takes the representations generated by both the unimodal encoders and learns multimodal representations with the cross-attention mechanism. Knowledge Distillation trains a small model (i.e., student model) to match the output prediction of a large and well-trained model (i.e., teacher model) by minimizing their prediction discrepancy [16]. Specifically, we denote the teacher model as ft(θt) and the student model as fs(θs), and consider the 3 following optimization problem: min θs Ltrain(θs) + DKL(θs, θt), (1) where Ltrain(θs) is the prediction loss on the target task, e.g., the cross-entropy loss for a classification task; DKL(θs, θt) is the KL-Divergence between the probability distributions over their predictions, i.e., KL(fs(θs)||ft(θt)). In large Transformer-based models, distilling knowledge from only the output predictions neglects the rich semantic knowledge in the intermediate layers. To leverage such knowledge, researchers have proposed to match the hidden representations and attention scores at each layer of the teacher and the student [30, 19, 11, 45]. Thompson Sampling (TS) is a widely-used MAB algorithm with Bayesian assumption [32, 40, 31, 5, 1]. TS assumes a prior distribution on the parameters of the underlying reward distribution for each arm. To estimate the underlying reward distribution, TS updates a posterior reward distribution (often referred to as reward distribution) for each arm based on the statistics of the observed rewards in history. TS draws an arm from the posterior in each round to maximize the cumulative rewards in the long term. A typical example of TS is to set both the prior distribution and the reward distribution to be Gaussian distributions. In this case, the reward distribution of an arm is specified as (cid:18) D := N μ, (cid:19) , 1 n + 1 (2) where μ is often set as the average of the observed rewards in history and n is set as the number of rounds the arm has been chosen. 3 Method Problem Formulation. We consider both the teacher and the student models to be multimodality Transformers containing c > 1 modules. For example, they are CoCa models containing c = 3 modules in this work: an image encoder, a text encoder, and a multimodal decoder. We construct K = 2c − 1 arms, each associated with a unique, non-empty subset of modules selected from the c modules. The k-th arm is formed as a set of model layers, denoted as Sk, in its associated subset. We set T = T ′ P rounds, where T ′ is the total number of training steps and P ≥ 1 is the number of steps within each round. In this way, choosing the k-th arm in the t-th round is equivalent to distilling Sk for P steps in the range of ((t − 1)P, t * P ]. 1 For each arm k ∈ [K], we denote its reward distribution as Dk and set it as a Gaussian distribution specified as N (μk, nk+1 ) following Eq. 2. To set a proper prior, we first randomly choose each arm for T0 ≥ 0 rounds1, then initialize μk = μ0 k is the average of the observed rewards over T0 rounds. We explain why setting the reward distribution as a Gaussian distribution is feasible in Appendix A.1. k and nk = T0, where μ0 Remark 3.1 We consider all possible combinations of modules because, at a certain training stage, there might exist a combination such that distilling it leads to a higher reward than distilling any single module. Remark 3.2 Since the dependencies among modules are unclear, we should assume all arms to be dependent and model the reward distribution as a multivariate Gaussian over all arms. However, sam- pling from such a distribution requires decomposing the covariance matrix, which is computationally costly. To improve efficiency, we ignore the dependency assumption. In practice, we observe no clear disadvantage in the model performance. OPTIMA Algorithm. We initialize μk = μ0 k, nk = T0 (cid:18) and Dk = N μk, (cid:19) 1 nk + 1 for all arm k ∈ [K]. At the t-th round, we sample a reward (cid:98)rk for the k-th arm from its reward distribution Dk for all k ∈ [K]. The arm with the highest sampled reward is then chosen for this round, denoted as at. In this way, the arm is chosen according to the belief of it being the best arm. 1T0 is included in T . 4 We then play the at-th arm by distilling Sat for P steps. At any step t′ ∈ ((t − 1)P, tP ], we first compute the distillation losses on Sat. Specifically, we denote the hidden representations at the i-th s ∈ R|x|×ds, where dt and ds denote layer of the teacher and the student as H i the hidden dimension and |x| denotes the sequence length. Then the distillation loss on hidden representations is defined as2: t ∈ R|x|×dt and H i hidn(θ(t′) Lat s , θt) = 1 |Sat| (cid:88) MSE(H i t , H i sW i hidn), (3) i∈Sat hidn ∈ Rds×dt is a randomly initialized and learnable t . Similarly, the distillation loss on attention where MSE(*, *) is the mean-squared error, and W i linear projection that projects H i scores is defined as3: s into the same space as H i attn(θ(t′) Lat s , θt) = 1 |Sat| (cid:88) i∈Sat MSE(Ai t, Ai s), (4) t, Ai s ∈ R|x|×|x| are the attention score matrices averaged over the multiple attention heads where Ai at the i-th layer. The student model is then optimized based on a weighted sum of all distillation losses on Sat, i.e., total = Ltrain + α1DKL + α2Lat Lat hidn + α3Lat attn, (5) where Ltrain and DKL are defined in Eq. 1 and α1, α2, α3 ≥ 0 are hyper-parameters. Specifically, the student model is updated with an SGD-type algorithm [21]: total(θ(t′) s − η∇θsLat θ(t′+1) s ← θ(t′) , θt), s where η > 0 is the learning rate. The same procedure is then repeated for P steps. We then compute the reward rat for playing the at-th arm. Specifically, we design the reward as the averaged ratios of decrements over all types of distillation losses: rat = 1 |U | (cid:88) L(*)∈U (cid:32) max 0, L(θ((t−1)P ) s ) − L(θ(tP ) ) s L(θ((t−1)P ) s (cid:33) ) . (6) where U = {DKL(*), Lhidn(*), Lattn(*)}. Note that Lhidn(*) and Lattn(*) are defined in Eq. 3 and Eq. 4, respectively, but by replacing Sat with the set of all layers. They measure the change in the distillation loss on the full model; otherwise, the reward definition changes with the pulled arm and thus cannot provide an evaluation metric consistent across all arms. The numerator is the difference between L(θ((t−1)P ) ). This loss change is accumulated for P steps to reduce the uncertainty caused by noises in the stochastic gradients. As a result, it can reliably reflect the contribution of Sat to the distillation performance of the full model. We consider both the changes in output prediction discrepancy (DKL(*)) and the layerwise represen- tation distances (Lhidn(*) and Lattn(*)). This improves the robustness of the reward over different tasks because a specific distance metric may not consistently well reflect the distillation performance on all tasks (Figure 7). ) and L(θ(tP ) s s For all types of losses, we compute the ratio of the loss change to the loss in the previous round. Normalizing the loss changes prevents the reward from being biased by the scales of different losses. We further clip each ratio by zero to bound the reward between (0, 1), which is desirable for achieving a good performance guarantee in the Thompson Sampling (TS) algorithm. Finally, we average the rewards over all types of losses. After computing the reward rat, we update the reward distribution Dat. Specifically, we update the distribution mean, μat, as the exponential moving average of the observed rewards in the past: μat ← γμat + (1 − γ)rat , (7) 2We omit the "(t′)" superscript on {H i hidn}i∈Sat to simplify the notations. We assume the teacher and student have the same number of layers. The case of having different layers will be elaborated in Section 4.3. s, W i 3We omit the "(t′)" superscript on {Ai s}i∈Sat to simplify the notations. 5 where γ ∈ (0, 1) is a hyper-parameter. We then increase nat by one and update Dat following Eq. 2. Since the exponential moving average discounts the old rewards, μat tends to reflect the average of the rewards within recent rounds. Recall that the actual contribution of each module changes dynamically. By using μat as the distribution mean, Dat can capture the changing contribution and provides up-to-date guidance for module selection. The complete algorithm is shown in Alg. 14. Algorithm 1 OPTIMA: Module Adaptive Distillation 1: Input: T : the number of total rounds; P : the number of steps in each round; K = 2c − 1: the s , θt: the initialized student and the teacher models. number of arms; γ: a discounted factor. θ(0) s 2: Output: θ(T ′) 3: t′ = 0, nk = μk = 0 ∀k = 1, ..., K. 4: for t = 1, ..., T do 5: for k = 1, ..., K do 6: 7: 8: 9: 10: 11: Sample a reward for arm k: (cid:98)rk ∼ N end for Select arm at ← arg maxk (cid:98)rk. for p = 1, ..., P do Compute Lat ← θ(t′) θ(t′+1) s t′ ← t′ + 1. end for total(θ(t′) s s − η∇θs Lat , θt) following Eq. 5. total(θ(t′) , θt). s (cid:16) μk, 1 nk+1 (cid:17) . 12: 13: 14: 15: 16: 17: 18: 19: end for Compute rat following Eq. 6. Update μat following Eq. 7. nk ← nk + 1. 4 Experiments We verify the effectiveness of OPTIMA on popular multimodal understanding and image captioning benchmarks. 4.1 Data We conduct task-specific distillation on three multimodal understanding tasks: visual question answering (VQA, [14]), visual entailment (SNLI-VE, [47]), and visual reasoning (NLVR2, [37]). VQA is to answer an input question with a sentence based on an input image. It is formulated as a classification problem with 3129 classes where each class corresponds to an answer. SNLI-VE is a three-way classification problem to predict whether an input sentence entails the input image, contradicts it, or is neutral to it. NLVR2 is a binary classification problem to predict whether an input sentence is true or false about an input image pair. We further train and evaluate the model using the Microsoft COCO Caption dataset [6] and the Karpathy-test split, respectively. The task is to describe an input image with a sentence. See Appendix A.2 for details. 4.2 Models We evaluate OPTIMA on CoCa [48]. It is a powerful Transformer-based multimodality foundation model pre-trained on web-scale alt-texts [18] and image-text pairs [50]. Since CoCa consists of an image encoder, a text encoder, and a multimodal decoder, it provides a sufficiently large action space for OPTIMA. Furthermore, the decoder produces multimodal representations, which allows it to be directly fine-tuned without any extra step of multimodal pre-training, commonly needed for dual-encoder models [35, 49, 9]. 4We assume T0 = 0 for simplicity of demonstration. 6 For each target task, we fine-tune a pre-trained CoCa-Large as the teacher (672M, 48 layers (24/12/12 layers in image/text/multimodal modules), dt = 1024). We then distill a task-specific student from the fine-tuned teacher. Specifically, we consider two architectures: CoCa-Tiny12 (101.8M, 12 layers (6/3/3 layers), ds = 768) and CoCa-Tiny6 (54.5M, 6 layers (3/1/2 layers), ds = 768). The layers in each module of the student are initialized with the layers uniformly sampled from the corresponding module of a pre-trained CoCa-Base (293M, 36 layers, d = 768). 4.3 Implementation Details Teacher Initialization. We fine-tune a pre-trained CoCa-Large as the teacher for each target task. For multimodal understanding tasks, we attach a randomly initialized task-specific linear classifier on top of the multimodal decoder for answer prediction. We fine-tune both the model and the classifier using the cross-entropy loss. For the image captioning task, we directly fine-tune CoCa with the captioning loss [48], i.e., Lcap = (cid:80)|x| l=1 log Pθt(yl|y<l, x). We follow [48] for all fine-tuning hyper-parameters (See Appendix A.3 for details). Task-Specific Distillation. We fix the fine-tuned teacher and distill a student using OPTIMA on each task. For all tasks, we train the student for T ′ = 100k steps. We use Adafactor with decoupled weight decay [34] as the optimizer with β = (0.9, 0.999) and a learning rate of 1 × 10−3 with a linear decay schedule. We match the i-th layer of a student's module with the ⌈gi⌉-th layer of the corresponding teacher's module, where g is the ratio of the number of layers of the two modules. We randomly initialize Whidn ∈ Rds×dt. We set α1 = 0, α2 = 1 and α3 = 1 × 10−2 for all tasks. For OPTIMA, we set γ = 0.98, T0 = 10, P = 100 and T = T ′ P = 1k. Full details are deferred to Appendix A.4. 4.4 Baselines Pre-trained Vision-Language Models (VLMs). To compare with models with similar scales, we present the fine-tuning performance of existing pre-trained VLMs: UNITER [7], OSCAR [24], ViLT [20], VILLA [12], CLIP-ViLp [35] and ALBEF [23]. Different from foundation models, VLMs often contain a single backbone, e.g., a 12-layer Transformer. The backbone takes both image features and text embeddings as inputs and learns the multimodal representations. They then use an auxiliary model to predict the input image features, e.g., CLIP-ViLp uses a pre-trained CLIP encoder [27], ALBEF uses a pre-trained ViT-B/16 [8], and the rest use a pre-trained Faster R-CNN [3]. We exclude methods that outperform the CoCa-Large teacher. Multimodality Distillation Methods. We further compare OPTIMA with existing multimodality distillation methods: MiniVLM [43], DistilVLM [11] and DIDE [45]. Different from OPTIMA: 1) All methods conduct distillation in the pre-training stage. Pre-training distillation significantly improves the student's generalizability but requires much more computational resources than task- specific distillation. 2) All methods consider VLMs as the teachers. VLMs are much smaller than CoCa models, and a small teacher-student capacity gap often improves the effectiveness of distillation [26, 25]. However, VLMs are less generalizable and can only distill students on limited tasks. MiniVLM adopts knowledge distillation on additional unlabeled data (Eq. 1). DistilVLM adopts layerwise distillation. DIDE distills a dual-encoders student from a VLM teacher by aligning cross-modal attentions. We ignore concurrent methods with a teacher that significantly outperforms the CoCa-Large teacher. 4.5 Main Result Table 1 summarizes the evaluation results of layerwise distillation and OPTIMA. We report the median over five random seeds5. On both CoCa-Tiny6 and CoCa-Tiny12, OPTIMA can achieve consistent and notable improvements upon layerwise distillation over all tasks. The gains are most prominent in NLVR2 and COCO, e.g., the gains on CoCa-Tiny12 are 0.9 and 4.4, respectively. This may be explained by Figure 3, which shows the contributions of modules in these tasks exhibit high variances and the training of a specific module can impair the training of others. The gain is slightly smaller in CoCa-Tiny6 than CoCa-Tiny12. This might be because CoCa-Tiny6 converges slower, and that specific module is less likely to over-fit quickly and interfere with others. 5The standard deviations are reported in Appendix A.5. 7 Compared with pre-trained VLMs at the same scale, CoCa-Tiny12 (OPTIMA) can achieve simi- lar performance with a smaller size. Compared with CoCa-Base, OPTIMA can achieve notable improvements on three out of four tasks with only 1/3 its number of layers. Compared with MiniVLM, DistilVLM and DIDE, OPTIMA can achieve significantly better perfor- mance on CoCa-Tiny12 and similar performance on CoCa-Tiny6 over all tasks. Recall that these baseline methods use web-scale pre-training data for distillation and use single-backbone VLMs as teachers. In contrast, OPTIMA uses limited target task data and faces a much larger capacity gap, e.g., 5 times larger for CoCa-Tiny12. Nevertheless, the performance gaps between CoCa-Tiny12 (OPTIMA) and CoCa-Large are comparable to those in the baseline methods. Furthermore, while baseline methods demonstrate gains on limited tasks, OPTIMA shows well-rounded gains on all tasks. Table 1: The evaluation results of OPTIMA and baseline methods on VQA, SNLI-VE, NLVR2 and COCO Caption. The results of all baselines are reported from the original papers. The inference speedup is computed with respect to the batch-averaged inference time of the corresponding teacher model averaged across all tasks. We present the sizes of backbone parameters because the embedding sizes vary largely across methods depending on the implementation details. All sizes are counted based on the released checkpoints from the authors. Method Teacher Params. (million) Inference Speedup VQA test-std SNLI-VE NLVR2 COCO CIDEr test-p test UNITER-Base [7] OSCAR-Base [24] ViLT-Base [20] VILLA-Base [12] CLIP-ViLp [35] ALBEF [23] CoCa-Base [48] CoCa-Large [48] - - - - - - - - MiniVLM12×384 [43] DistilVLM12×384 [11] DIDE12 [45] OSCAR-Base OSCAR-Base ViLT-Base CoCa-Large CoCa-Tiny6 CoCa-Large CoCa-Tiny6 (OPTIMA) CoCa-Large CoCa-Tiny12 CoCa-Tiny12 (OPTIMA) CoCa-Large 146.5 146.5 85.6 146.5 187.7 241.0 293.1 672.1 30.0 30.0 171.3 54.5 54.5 101.8 101.8 - - - - - - - - 3.1× 3.1× 3.0× 6.2× 6.2× 3.4× 3.4× 72.9 73.4 - 73.7 74.1 74.7 69.2 75.3 68.1 69.2 69.2 68.7 69.0 71.2 71.6 78.3 - 76.4 79.0 79.0 80.3 83.6 85.6 - - 76.3 82.0 82.3 83.9 84.3 77.9 - 76.1 79.3 - 80.5 80.2 82.6 - - 75.6 76.5 77.0 80.4 81.3 - 137.6 - - 127.9 - 126.7 132.3 115.0 117.1 - 112.2 113.5 116.8 121.2 5 Analysis In this section, we verify that OPTIMA improves the student's performance, tracks the actual contributions of all modules, and chooses arms based on their contributions. We further investigate the design of the reward function in Appendix A.6 and study the discounted factor of the non- stationary reward distribution in Appendix A.7. 5.1 OPTIMA Improves the Student's Performance Figure 3 compares the performance of the students obtained by 1) fixed-arm distillation: distilling a fixed arm over rounds, 2) random-arm distillation: randomly choosing an arm to distill in each round, and 3) OPTIMA. The performance of fixed-arm distillation varies largely across tasks. Distilling an arm that contains more modules than other arms does not always improve the student performance, e.g., "Img+Txt+Multi" achieves 80.4 while "Img+Multi" achieves 81.1 in NLVR2. In contrast, OPTIMA demonstrates superiority over all fixed-arm and random-arm distillation baselines. This suggests that OPTIMA can find a better weighting for arm selection for each task. Figure 4 shows the prediction loss and the output layer prediction discrepancy (i.e., Ltrain and DKL defined Eq. 1) on the dev set are both lower in OPTIMA than in layerwise distillation. This suggests that the student achieves better generalization performance on both the distillation and the prediction of the target task. 8 Figure 3: A comparison of the performance of the students by 1) distilling a fixed arm over rounds (shown in solid colors, where each arm is denoted by its associated subset of modules); 2) randomly choosing an arm to distill in each round (denoted by "Random"); and 3) OPTIMA. Figure 4: The prediction loss and the output layer prediction discrepancy (i.e., Ltrain and DKL defined Eq. 1, respectively) in OPTIMA and layerwise distillation (denoted by "LWD"). 5.2 Reward Distributions Reflect the Contributions of Arms Figure 5 (Left) shows the means of the reward distributions of all arms through training. In all tasks, "Img+Txt+Multi" quickly dominates the others, while "Multi" and "Txt+Multi" remain incompetent. The reward distributions of all arms slowly evolve through training. For example, in COCO, the arms containing the image encoder all show a non-increasing trend in the later stage of training, while "Txt" shows an increasing trend. Figure 5 (Right) verifies such evolving reward distributions can correctly reflect the changing contributions of modules. We can observe a strong and positive correlation between the mean of the reward distribution of an arm and the accuracy obtained by distilling this fixed arm through training. Figure 5: Left: The means of the reward distributions of all arms (i.e., {μk}K k=1) through training. Right: The correlation between the means of the reward distributions of individual arms and the test accuracy obtained by distilling these arms through training. 5.3 OPTIMA Choose Arms Based on Reward Distributions Figure 6 visualizes the frequency of choosing each arm through training. In all tasks, we can observe that "Img+Txt+Multi" is the most frequently chosen arm. In COCO, the frequency distributions across arms are flatter than in SNLI-VE and NLVR2, which is consistent with Figure 5 that the means 9 ImgTxtMultiImg+TxtImg+MultiTxt+MultiImg+Txt+MultiRandomOPTIMAArm Selection Methods758085Test Accuracy (%)78.673.878.382.284.078.383.982.884.3SNLI-VEImgTxtMultiImg+TxtImg+MultiTxt+MultiImg+Txt+MultiRandomOPTIMAArm Selection Methods5060708090Test Accuracy (%)61.551.766.970.981.167.680.476.981.3NLVR2ImgTxtMultiImg+TxtImg+MultiTxt+MultiImg+Txt+MultiRandomOPTIMAArm Selection Methods6080100120CIDEr105.175.659.5106.7116.762.9116.8116.0121.2COCO Caption50100Training Steps (k)0.000.250.500.751.00LtrainNLVR250100Training Steps (k)246DKLNLVR2255075100Training Steps (k)1.01.1LtrainCOCO Caption255075100Training Steps (k)110012001300DKLCOCO CaptionMethods LWD OPTIMA 050100Training Steps (k)0.00.10.20.3SNLI-VE050100Training Steps (k)0.00.10.20.3NLVR2050100Training Steps (k)0.0000.0250.0500.075COCO Caption255075100Training Steps (k)0.00.51.0Corr.SNLI-VE NLVR2 COCO CaptionArmsImg+Txt+Multi Img+Multi Img+TxtImgTxtMultiTxt+MultiμkCorr. between μ and Test Acc. of the reward distributions are more concentrated across arms. This suggests OPTIMA can choose arms based on the reward distributions. Figure 6: A visualization of the frequency of each arm being chosen through training. A deeper color represents a higher frequency. 6 Discussion Application to Other Multi-module Multimodality Models. In this study, we primarily demonstrate the efficacy of OPTIMA when applied to models within the CoCa family. This initial success signifies that OPTIMA could be applicable in scenarios where one or more modules predominantly contribute to the target task, a phenomenon also observed in other multi-module models [35]. The exploration of the application of OPTIMA to other multi-module models is left for future research. Furthermore, OPTIMA does not incur computational and memory costs exceeding those of layerwise distillation, as it calculates only the necessary layerwise losses and gradients for distilling a subset of modules. This efficiency enables the exploration of OPTIMA's applicability to larger foundational models - those incorporating diverse modules to accommodate not only image and text modalities but also others such as audio and video. Design Fine-grained Action Space. In this study, we divide the CoCa model coarsely into three modules based on modalities, and design the action space to encompass all possible module com- binations. However, different layers within a single module could exhibit variable contributions to the target task. For example, lower layers tend to capture high-frequency signals crucial for feature extraction, while upper layers typically learn low-frequency signals, vital for semantic understand- ing. By further subdividing each module into groups of layers, we can refine the action space to encompass all possible combinations of layer groups, potentially enabling the finding of better arms. Additionally, this enhanced granularity enables the extension of our method to single-module VLMs and single-modality models, such as large language models (LLMs) and vision models. However, directly applying OPTIMA encounters challenges in this fine-grained scenario. Firstly, the dependencies among layer groups can substantially exceed those among modalities, conflicting with the current sampling strategy which assumes minimal dependencies between arms (See Remark 3.2 in Section 3). Secondly, expanding the action space prolongs exploration time and, consequently, increases training costs. Given these challenges, adapting OPTIMA to such a fine-grained scenario necessitates modifications in the sampling strategy and explorations into more efficient reinforcement learning algorithms, aspects we designate for future research. 7 Conclusion We propose OPTIMA, a module-wise adaptive distillation method for multimodality models. We employ a simple MAB algorithm to demonstrate that distillation based on the contributions of modalities represents a promising and intriguing research direction. We posit that adopting more sophisticated reinforcement learning algorithms can yield greater improvements, and we designate such explorations for future research. 10 ImgTxtMultiImg+TxtImg+MultiTxt+MultiImg+Txt+MultiArms20406080100Training Steps (k)VQAImgTxtMultiImg+TxtImg+MultiTxt+MultiImg+Txt+MultiArmsSNLI-VEImgTxtMultiImg+TxtImg+MultiTxt+MultiImg+Txt+MultiArmsNLVR2ImgTxtMultiImg+TxtImg+MultiTxt+MultiImg+Txt+MultiArmsCOCO Caption0.00.20.40.60.81.00.00.20.40.60.81.00.00.20.40.60.81.00.00.20.40.60.81.0 8 Acknowledgements This project was completed during a full-time internship at Google Research. We thank all collabora- tors from the Brain team and the Perception team for their insightful feedback and intellectual support. We also extend our thanks to the TPU team for providing abundant computational infrastructure and resources. References [1] Shipra Agrawal and Navin Goyal. Analysis of thompson sampling for the multi-armed bandit problem. In Conference on learning theory, pages 39–1. JMLR Workshop and Conference Proceedings, 2012. 3, 4 [2] Shipra Agrawal and Navin Goyal. Near-optimal regret bounds for thompson sampling. Journal of the ACM (JACM), 64(5):1–24, 2017. 3 [3] Peter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, and Lei Zhang. Bottom-up and top-down attention for image captioning and visual question answering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 6077–6086, 2018. 7 [4] Peter Auer, Nicolo Cesa-Bianchi, and Paul Fischer. Finite-time analysis of the multiarmed bandit problem. Machine learning, 47(2):235–256, 2002. 3 [5] Sébastien Bubeck and Che-Yu Liu. Prior-free and prior-dependent regret bounds for thompson sampling. Advances in neural information processing systems, 26, 2013. 3, 4 [6] Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015. 2, 3, 6, 15 [7] Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Universal image-text representation learning. In European conference on computer vision, pages 104–120. Springer, 2020. 7, 8 [8] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. 7 [9] Zi-Yi Dou, Yichong Xu, Zhe Gan, Jianfeng Wang, Shuohang Wang, Lijuan Wang, Chenguang Zhu, Pengchuan Zhang, Lu Yuan, Nanyun Peng, et al. An empirical study of training end-to-end vision-and-language transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 18166–18176, 2022. 6 [10] Eyal Even-Dar, Shie Mannor, and Yishay Mansour. Pac bounds for multi-armed bandit and markov decision processes. In International Conference on Computational Learning Theory, pages 255–270. Springer, 2002. 3 [11] Zhiyuan Fang, Jianfeng Wang, Xiaowei Hu, Lijuan Wang, Yezhou Yang, and Zicheng Liu. Com- pressing visual-linguistic model via knowledge distillation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1428–1438, 2021. 2, 4, 7, 8 [12] Zhe Gan, Yen-Chun Chen, Linjie Li, Chen Zhu, Yu Cheng, and Jingjing Liu. Large-scale adversarial training for vision-and-language representation learning. Advances in Neural Information Processing Systems, 33:6616–6628, 2020. 7, 8 [13] Aurélien Garivier and Eric Moulines. On upper-confidence bound policies for non-stationary bandit problems. arXiv preprint arXiv:0805.3415, 2008. 3 [14] Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 6904–6913, 2017. 3, 6, 15 11 [15] Neha Gupta, Ole-Christoffer Granmo, and Ashok Agrawala. Thompson sampling for dy- namic multi-armed bandits. In 2011 10th International Conference on Machine Learning and Applications and Workshops, volume 1, pages 484–489. IEEE, 2011. 3 [16] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. 2, 3 [17] Lu Hou, Zhiqi Huang, Lifeng Shang, Xin Jiang, Xiao Chen, and Qun Liu. Dynabert: Dynamic BERT with adaptive width and depth. In Hugo Larochelle, Marc'Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. 2 [18] Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc Le, Yun- Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In International Conference on Machine Learning, pages 4904–4916. PMLR, 2021. 1, 3, 6 [19] Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. Tinybert: Distilling bert for natural language understanding. arXiv preprint arXiv:1909.10351, 2019. 2, 4 [20] Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision. In International Conference on Machine Learning, pages 5583–5594. PMLR, 2021. 7, 8 [21] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. 5 [22] Taku Kudo. Subword regularization: Improving neural network translation models with multiple subword candidates. arXiv preprint arXiv:1804.10959, 2018. 15 [23] Junnan Li, Ramprasaath Selvaraju, Akhilesh Gotmare, Shafiq Joty, Caiming Xiong, and Steven Chu Hong Hoi. Align before fuse: Vision and language representation learning with momentum distillation. Advances in neural information processing systems, 34:9694–9705, 2021. 3, 7, 8 [24] Xiujun Li, Xi Yin, Chunyuan Li, Pengchuan Zhang, Xiaowei Hu, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, et al. Oscar: Object-semantics aligned pre-training for vision-language tasks. In European Conference on Computer Vision, pages 121–137. Springer, 2020. 7, 8 [25] Chen Liang, Simiao Zuo, Qingru Zhang, Pengcheng He, Weizhu Chen, and Tuo Zhao. Less is more: Task-aware layer-wise distillation for language model compression. arXiv preprint arXiv:2210.01351, 2022. 7 [26] Seyed Iman Mirzadeh, Mehrdad Farajtabar, Ang Li, Nir Levine, Akihiro Matsukawa, and Hassan Ghasemzadeh. Improved knowledge distillation via teacher assistant. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pages 5191–5198, 2020. 7, 16 [27] 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 International Conference on Machine Learning, pages 8748–8763. PMLR, 2021. 1, 3, 7 [28] Vishnu Raj and Sheetal Kalyani. Taming non-stationary bandits: A bayesian approach. arXiv preprint arXiv:1707.09727, 2017. 3 [29] Steven J Rennie, Etienne Marcheret, Youssef Mroueh, Jerret Ross, and Vaibhava Goel. Self- critical sequence training for image captioning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7008–7024, 2017. 15 [30] Adriana Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. Fitnets: Hints for thin deep nets. arXiv preprint arXiv:1412.6550, 2014. 2, 4 12 [31] Daniel Russo and Benjamin Van Roy. Learning to optimize via posterior sampling. Mathematics of Operations Research, 39(4):1221–1243, 2014. 3, 4 [32] Steven L Scott. A modern bayesian look at the multi-armed bandit. Applied Stochastic Models in Business and Industry, 26(6):639–658, 2010. 3, 4 [33] Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015. 15 [34] Noam Shazeer and Mitchell Stern. Adafactor: Adaptive learning rates with sublinear memory cost. In International Conference on Machine Learning, pages 4596–4604. PMLR, 2018. 7 [35] Sheng Shen, Liunian Harold Li, Hao Tan, Mohit Bansal, Anna Rohrbach, Kai-Wei Chang, Zhewei Yao, and Kurt Keutzer. How much can clip benefit vision-and-language tasks? arXiv preprint arXiv:2107.06383, 2021. 6, 7, 8, 10 [36] Aleksandrs Slivkins et al. Introduction to multi-armed bandits. Foundations and Trends® in Machine Learning, 12(1-2):1–286, 2019. 2 [37] Alane Suhr, Stephanie Zhou, Ally Zhang, Iris Zhang, Huajun Bai, and Yoav Artzi. A corpus for reasoning about natural language grounded in photographs. arXiv preprint arXiv:1811.00491, 2018. 2, 3, 6 [38] Siqi Sun, Yu Cheng, Zhe Gan, and Jingjing Liu. Patient knowledge distillation for bert model compression. arXiv preprint arXiv:1908.09355, 2019. 2 [39] Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou. arXiv preprint Mobilebert: a compact task-agnostic bert for resource-limited devices. arXiv:2004.02984, 2020. 2 [40] William R Thompson. On the likelihood that one unknown probability exceeds another in view of the evidence of two samples. Biometrika, 25(3-4):285–294, 1933. 3, 4 [41] Joannes Vermorel and Mehryar Mohri. Multi-armed bandit algorithms and empirical evaluation. In European conference on machine learning, pages 437–448. Springer, 2005. 2 [42] Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3156–3164, 2015. 3 [43] Jianfeng Wang, Xiaowei Hu, Pengchuan Zhang, Xiujun Li, Lijuan Wang, Lei Zhang, Jianfeng Gao, and Zicheng Liu. Minivlm: A smaller and faster vision-language model. arXiv preprint arXiv:2012.06946, 2020. 7, 8 [44] Peng Wang, An Yang, Rui Men, Junyang Lin, Shuai Bai, Zhikang Li, Jianxin Ma, Chang Zhou, Jingren Zhou, and Hongxia Yang. Unifying architectures, tasks, and modalities through a simple sequence-to-sequence learning framework. arXiv preprint arXiv:2202.03052, 2022. 3 [45] Zekun Wang, Wenhui Wang, Haichao Zhu, Ming Liu, Bing Qin, and Furu Wei. Distilled dual-encoder model for vision-language understanding. arXiv preprint arXiv:2112.08723, 2021. 2, 4, 7, 8 [46] Zirui Wang, Jiahui Yu, Adams Wei Yu, Zihang Dai, Yulia Tsvetkov, and Yuan Cao. Simvlm: Sim- ple visual language model pretraining with weak supervision. arXiv preprint arXiv:2108.10904, 2021. 1, 3 [47] Ning Xie, Farley Lai, Derek Doran, and Asim Kadav. Visual entailment: A novel task for fine-grained image understanding. arXiv preprint arXiv:1901.06706, 2019. 3, 6 [48] Jiahui Yu, Zirui Wang, Vijay Vasudevan, Legg Yeung, Mojtaba Seyedhosseini, and Yonghui arXiv preprint Wu. Coca: Contrastive captioners are image-text foundation models. arXiv:2205.01917, 2022. 1, 2, 3, 6, 7, 8, 15 13 [49] Lu Yuan, Dongdong Chen, Yi-Ling Chen, Noel Codella, Xiyang Dai, Jianfeng Gao, Houdong Hu, Xuedong Huang, Boxin Li, Chunyuan Li, et al. Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432, 2021. 1, 3, 6 [50] Xiaohua Zhai, Alexander Kolesnikov, Neil Houlsby, and Lucas Beyer. Scaling vision transform- ers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12104–12113, 2022. 6 [51] Pengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. Vinvl: Revisiting visual representations in vision-language models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5579–5588, 2021. 2 14 A Appendix A.1 Gaussian as the Posterior Here we explain why setting the reward distribution as a Gaussian distribution is feasible. Recall that we consider a non-stationary environment. We design the reward distribution to model the rewards observed in recent history. Within a small number of steps, the model is unlikely to change drastically. Therefore, the observed rewards, which are computed as the ratios of decrement in loss, are unlikely to be skewed. As a result, Gaussian is a feasible choice. A.2 Data For the VQA task, we conduct downstream fine-tuning and testing on the VQA 2.0 dataset [14], which consists of 83k images and 444k questions for training, 41k images, and 214k questions for validation. For the image captioning task on COCO, we use [6] for training and testing. It contains 11k images for training and 5k images for validation and 5k images for testing. A.3 Teacher Model Implementation Details We fine-tune a pre-trained CoCa-Large model [48] as the teacher. It contains 672M parameters in Transformer layers and contains a total of 787M parameters including the embedding size. It contains 24 layers in the image encoder, and 12 layers in the text encoder, and 12 layers in the multimodal decoder. We use a vocabulary size of 64k. We use 576 as the image resolution and 18 as the patch size for image inputs. We use 64 as the max sequence length for text inputs. We follow [48] for fine-tuning hyper-parameters for all tasks, as listed in Table 2. Table 2: Hyper-parameters for fine-tuning CoCa-Large teacher models. Hyper-parameters VQA SNLI-VE NLVR2 COCO Caption Optimizer Adam βs Gradient Clipping Learning Rate Schedule Warm-up Steps Weight Decay Rate Pooler Learning Rate Encoder Learning Rate RandAugment Training Steps Batch Size Dropout of Task Layer Adafactor with Decoupled Weight Decay (0.9, 0.999) 1.0 Linear Schedule Decaying to Zero 1k 0.1 5 × 10−3 2 × 10−5 None 50k 64 0.5 1 × 10−3 5 × 10−5 1, 10 50k 128 0.5 N/A 1 × 10−5 None 50k 128 N/A 5 × 10−4 2 × 10−5 1, 10 100k 64 0.5 For multimodal understanding tasks, we follow [48] to apply an attentional pooler with a single query to extract embedding from the decoder output, and train a linear classifier on top of the pooled embedding. For NLVR2, we construct two input sequences, each containing the concatenation of the description and one image. The two output representations are further concatenated as the input to the classifier. For image captioning, we apply the captioning loss proposed in [48]. We do not use the CIDEr metric-specific optimization [29]. We use a greedy strategy for decoding. A.4 Distillation Implementation Details For each task, we distill a CoCa-Tiny12 student and a CoCa-Tiny6 student from a fine-tuned CoCa- Large teacher on that task. CoCa-Tiny12 contains 102M parameters in the Transformer layers and contains a total of 152M parameters including the embedding size. CoCa-Tiny6 contains 55M parameters in the Transformer layers and contains a total of 105M parameters including the embedding size. We use 576 as the image resolution and 18 as the patch size for image inputs. To tokenize text input, we use a sentence-piece model [33, 22] with a vocabulary size of 64k trained on the sampled pre-training dataset. We use 64 as the max sequence length for text inputs. We follow [48] for fine-tuning hyper-parameters for all tasks, as listed in Table 3. We conduct a two-stage distillation for CoCa-Tiny6. We first distill CoCa-Tiny12 from CoCa-Large, then use the distilled CoCa-Tiny12 as the teacher to teach CoCa-Tiny6. Existing works have shown 15 that introducing an intermediate-sized teacher reduces the gap between the teacher and the student model, which allows the distillation to be more effective [26]. We distill the model for a total of T ′ steps, i.e., a total of T = T ′/P rounds. Among the T rounds, the first T0 * K rounds are used for initialization of the parameters of the reward distribution. Table 3: Hyper-parameters for distilling CoCa-Tiny student models. Hyper-parameters VQA SNLI-VE NLVR2 COCO Caption T0 P T γ αs Optimizer Adam βs Gradient Clipping Learning Rate Schedule Learning Rate Warm-up Steps Weight Decay Rate RandAugment Training Steps (T ′) Batch Size Dropout of Task Layer 10 100 1000 0.98 (0.0, 1.0, 1 × 10−2) Adafactor with Decoupled Weight Decay (0.9, 0.999) 1.0 Linear Schedule Decaying to Zero 1 × 10−3 1k 0.1 None 100k 256 0.5 None 100k 256 N/A 1, 10 100k 384 0.5 1, 10 125k 128 0.5 A.5 Statistics of Experimental Results We report the median of five random seeds for experiment results on CoCa-Tiny12 and CoCa-Tiny6. Table 4 show the standard deviations of the experimental results in Table 1. Table 4: The standard deviation of the experimental results in Table 1. Method VQA SNLI-VE NLVR2 COCO Caption Acc CIDEr Acc Acc CoCa-Tiny6 CoCa-Tiny6 (OPTIMA) CoCa-Tiny12 CoCa-Tiny12 (OPTIMA) 0.20 0.22 0.17 0.08 0.25 0.13 0.23 0.15 0.11 0.35 0.15 0.30 0.15 0.15 0.88 0.32 A.6 Design of Reward Recall that we design the reward (Eq. 6) as the averaged ratio of loss decrements over three types of distillation losses: DKL (Eq. 1), Lhidn (Eq. 3) and Lattn (Eq. 4). Figure 7 compares ours with two variants: 1) rKD: the ratio of loss decrement of DKL; 2) rLWD: the averaged ratio of loss decrements over Lhidn and Lattn. We can observe that rKD performs better than rLWD in NLVR2 but reversely in COCO. Since captioning tasks often rely more on contextual knowledge in the layerwise representations than classification tasks, the layerwise representation distance may better characterize the distillation performance in COCO. By taking both distance metrics into consideration, rOPTIMA performs well on both tasks. A.7 Design of the Reward Distribution Recall that we design the mean of the reward distribution (Eq. 7) as the exponential moving average (EMA) of the past rewards. Figure 8 shows a hyper-parameter study on the halflife of the EMA, computed as − 1 log2 γ . Halflife is the number of rounds the EMA decays by one-half. We can observe that a too-large or too-small halflife, meaning that counting too many old rewards or counting only instantaneous rewards can both be harmful to the student's performance. This corroborates that the actual contribution of each module is non-stationary in the long term and stationary in the short term, and using EMA with an appropriate γ can correctly track the changing contribution. 16 Figure 7: A comparison of three variants of reward: 1) rKD: the ratio of decrement of DKL; 2) rLWD: the averaged ratio of decrement over Lhidn and Lattn; 3) rOPTIMA. Figure 8: A hyper-parameter study on the halflife of the EMA, computed as − 1 log2 γ . 17 rKDrLWDrOPTIMAReward Types808182Test Accuracy (%)81.080.381.2NLVR2rKDrLWDrOPTIMAReward Types100110120130CIDEr108.4121.0121.2COCO Caption0204060Halflife of EMA (Rounds)83.584.0Test Accuracy (%)SNLI-VE
http://arxiv.org/abs/2310.04540v1
"2023-10-06T19:06:43"
"2023-10-06T19:06:43"
Multi-decadal Sea Level Prediction using Neural Networks and Spectral Clustering on Climate Model Large Ensembles and Satellite Altimeter Data
Sea surface height observations provided by satellite altimetry since 1993 show a rising rate (3.4 mm/year) for global mean sea level. While on average, sea level has risen 10 cm over the last 30 years, there is considerable regional variation in the sea level change. Through this work, we predict sea level trends 30 years into the future at a 2-degree spatial resolution and investigate the future patterns of the sea level change. We show the potential of machine learning (ML) in this challenging application of long-term sea level forecasting over the global ocean. Our approach incorporates sea level data from both altimeter observations and climate model simulations. We develop a supervised learning framework using fully connected neural networks (FCNNs) that can predict the sea level trend based on climate model projections. Alongside this, our method provides uncertainty estimates associated with the ML prediction. We also show the effectiveness of partitioning our spatial dataset and learning a dedicated ML model for each segmented region. We compare two partitioning strategies: one achieved using domain knowledge, and the other employing spectral clustering. Our results demonstrate that segmenting the spatial dataset with spectral clustering improves the ML predictions.
[ "Saumya Sinha", "John Fasullo", "R. Steven Nerem", "Claire Monteleoni" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04540v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04540v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
Multi-decadal Sea Level Prediction using Neural Networks and Spectral Clustering on Climate Model Large Ensembles and Satellite Altimeter Data Saumya Sinha,a John Fasullo,b R. Steven Nerem,a Claire Monteleonia,c a University of Colorado, Boulder, CO, USA b National Center for Atmospheric Research, Boulder, CO, USA c INRIA, Paris, France 3 2 0 2 t c O 6 ] G L . s c [ 1 v 0 4 5 4 0 . 0 1 3 2 : v i X r a Corresponding author: Saumya Sinha, saumya.sinha@colorado.edu 1 ABSTRACT: Sea surface height observations provided by satellite altimetry since 1993 show a rising rate (3.4 mm/year) for global mean sea level. While on average, sea level has risen 10 cm over the last 30 years, there is considerable regional variation in the sea level change. Through this work, we predict sea level trends 30 years into the future at a 2-degree spatial resolution and investigate the future patterns of the sea level change. We show the potential of machine learning (ML) in this challenging application of long-term sea level forecasting over the global ocean. Our approach incorporates sea level data from both altimeter observations and climate model simulations. We develop a supervised learning framework using fully connected neural networks (FCNNs) that can predict the sea level trend based on climate model projections. Alongside this, our method provides uncertainty estimates associated with the ML prediction. We also show the effectiveness of partitioning our spatial dataset and learning a dedicated ML model for each segmented region. We compare two partitioning strategies: one achieved using domain knowledge, and the other employing spectral clustering. Our results demonstrate that segmenting the spatial dataset with spectral clustering improves the ML predictions. 2 SIGNIFICANCE STATEMENT: Long-term projections are needed to help coastal communities adapt to sea level rise. Forecasting multi-decadal sea level change is a complex problem. In this paper, we show the promise of machine learning in producing such forecasts 30 years in advance and over the global ocean. Continued improvements in prediction skills that build on this work will be vital in sea level rise adaptation efforts. 1. Introduction Satellite altimeter observations since 1993 indicate that the global mean sea level is rising at a rate of 3.4 mm/year and accelerating by 0.08mm/year2, as shown in studies (Nerem et al. 2018; Hamlington et al. 2020a). Global mean sea level has risen 10 cm in the last 30 years. However, there is considerable regional variation in the amount of sea level rise (Hamlington et al. 2016) necessitating the need for a regional sea level change analysis. With three decades of satellite observations, we can now investigate the role played by anthropogenic climate change signals such as greenhouse gasses, aerosols, and biomass burning in this rising sea level. Climate model projections can be used to estimate the extent of the causal contributions from such factors and forecast future sea level changes. In (Fasullo and Nerem 2018; Fasullo et al. 2020b,a), two large ensembles of climate models were studied to show that the forced responses to greenhouse gas and aerosols have begun to emerge in the regional pattern of sea level rise in the altimeter data. This motivates us to utilize climate models in our framework. Our work uses machine learning to predict future regional patterns of sea level change. It is part of a longer-term research project that investigates the extent of contributions from anthropogenic climate-change signals to sea level change. Through our work, we show promising results demonstrating the potential of neural network-based ML models. Our framework uses both satellite observations and climate model simulations to predict sea level trends 30 years into the future at a 2-degree spatial resolution. Forecasting long-term sea level change is a complex problem given the natural variability of the ocean, the wide range of processes involved, and the complex non-linear interactions playing a role in sea level change. Some past studies have used satellite altimeter data and adopted ML techniques to perform sea level prediction. Tide-gauge data has also been used for similar tasks but it suffers from the influence of local coastal effects and poor spatial coverage, while satellite altimeter data provides nearly global coverage. Imani et al. (2017) make use of support vector regression for sea 3 level prediction in the tropical Pacific Ocean. In (Braakmann-Folgmann et al. 2017), they utilize a combination of CNN (Convolutional neural network) + ConvLSTM (Shi et al. 2015) layers to perform interannual sea level anomalies (SLA) prediction over the Pacific Ocean. Zhao et al. (2019) use a combination of least squares and neural networks to produce sea level anomalies prediction in the Yellow Sea. Sun et al. (2020) work with LSTM (Long short-term memory network) for the South China Sea. Through their work in (Liu et al. 2020), the authors employ an attention- based LSTM mechanism for sea surface height (SSH) forecasting in the South China Sea. Balogun and Adebisi (2021) include ocean-atmospheric features like sea surface temperature, salinity, and surface atmospheric pressure to build support vector and LSTM models for the West Peninsular Malaysia coastline. Nieves et al. (2021) make use of gaussian processes and LSTM to predict sea level variation along the regional coastal zones. In (Hassan et al. 2021), they compare various machine learning techniques to predict global mean sea level rise. An important part of the pipeline in (Wang et al. 2022) includes a ConvLSTM pipeline consisting of 3D convolutions and attention modules for forecasting altimeter SLA on the South China Sea. These techniques, however, are trained only on the altimeter dataset which to date is only 30 years in length, this can affect the performance of such data-driven models as brought up in this latest survey by Bahari et al. (2023). These approaches also do not use the insights provided by climate model projections that can potentially inform on contributions of anthropogenic climate-change signals. Moreover, these models address regional forecasting with a lead time of a few days to a few years ahead, but do not go so far as to forecast sea level change over the global ocean 30 years in advance. Our work utilizes the climate model projections and addresses the problem at a much bigger spatial scale that includes all the oceans and a much longer time horizon in the future. We work with 30-year linear trends of the sea level time series. We note that the climate models do not accurately reproduce all aspects of the trend pattern in altimeter data. There is also more variability in the altimeter trends compared to the climate models. We observed this in our previous work (Sinha et al. 2022), where a UNet (Ronneberger et al. 2015) model is trained on long periods of climate model simulations to produce spatiotemporal predictions 30 years ahead. This UNet model is then used to predict the future altimeter data. However, these predictions had much lower variability as compared to the altimeter observations. This underscores the challenge of combining modeled and observed fields in producing sea level predictions. 4 Working with multi-decadal global trends severely limits the ground-truth data we have. Thus we use the sea level trend values at every spatial grid point to create a training dataset for our ML model. With a 2-degree spatial resolution, we get a 180x90 (longitude x latitude) grid in our sea level trend maps. This gives us a reasonably large dataset for training an ML model even for a single 30-year-long trend for each grid point. We build a supervised learning framework using fully connected neural networks (FCNNs) that learns a non-linear mapping of the climate model trends to predict the altimeter trend while absorbing the biases that the climate models have away from the altimeter observations. This is accompanied by an interpretability study that explains the contributions of all the climate models to our final prediction. Given that the dominant factors driving sea level variability differ by region, we segment our spatial dataset and learn separate FCNNs for each segmented region. We compare a partition achieved using domain knowledge to a partition achieved via spectral clustering. We show that segmenting the spatial dataset improves the ML predictions. Spectral clustering shows promise by predicting future trends with ML such that their variability lies in the range we expect, given the variability of the past altimeter observations. Our predictions with spectral clustering also have lower uncertainties in impactful areas. 2. Method Our supervised learning pipeline is trained for the period 1993-2022. The spatial grid is flattened to create our dataset, where each data point corresponds to an oceanic grid point. For every grid point, a linear trend is computed over 1993-2022 for the climate model ensemble means, (described in 3), comprising the input features (X). The trends computed for the altimeter data (ground truth) make the label (Y) for our supervised ML training. So, we get the supervision from the altimeter trend, and the features to our ML model from the climate model hindcast trends. In the inference phase, we predict trends for 30 years later. This is done by taking the climate model projected trends for 2023-2052 and passing them through the learned ML model to predict the altimeter trend. See the overall ML framework in Figure 1. The ML model is a fully connected neural network (FCNN) trained with mean squared error (MSE) as the loss. The MSE is weighted, where the weights are the cosine of the latitude of the grid points. This gives spatial-weighting which essentially assigns more weight to the equatorial regions and less weight to polar regions. 5 Fig. 1: Overall machine learning pipeline for the task of sea level trend prediction using trends from climate models projections and altimeter observations. Clustering: We segment our spatial grid into partitions or clusters and observe the performance of the ML model when trained based on these clusters i.e. a separate FCNN is trained for each cluster. This is based on the hypothesis that learning ML model weights that are attuned to each cluster can be more optimal than a single ML model for the entire globe. Our study compares Spectral clustering against a Domain-specified partitioning that is derived from our physical knowledge of the data and proposed by the domain experts in the team. The time series of the altimeter sea-surface height (with the seasonality removed) serves as the features for Spectral clustering. Empirical evaluation with K-means clustering failed to perform close to Spectral clustering and is not included in the study. The spatial segmentations with Spectral clustering as well as the Domain-specified partition can be seen in Figure 2. The Spectral clustering, as observed by domain experts, seems to be influenced by the ENSO (El Ni ̃no–Southern Oscillation) phenomenon in the Pacific region. This could be because of the similarity between spectral decomposition and EOF (Empirical orthogonal function) analysis and the fact that ENSO is the leading mode of interannual climate variability (Vestergaard et al. 2010). This could be beneficial as creating 6 these clusters helps to treat ENSO-specific regions separately. These partitioning strategies are compared to each other and to a setup where the spatial grid is not segmented at all. We make use of k-fold cross-validation (k=5) to choose the best hyperparameters for each cluster, ending up with different FCNN architectures per cluster. To elaborate further, each of the orange and green clusters in the Spectral clustering setup as seen in Figure 2(a), learns an FCNN consisting of 3 hidden layers with 1024, 512, and 256 neurons respectively. For each of the other two smaller clusters, we use an FCNN with 2 hidden layers and 256, and 128 neurons respectively. Each hidden layer is followed by a relu activation. l2(0.000005) regularizer and a single dropout layer (0.2) are applied to avoid overfitting in each of the ML models. (a) Spectral clustering (b) Domain-specified partition Fig. 2: Spatial segmentations obtained from (a) Spectral clustering, and (b) a Domain-specified partition derived from our physical understanding of the data, where the North Atlantic Ocean (olive) and North Pacific Ocean (cyan) are assigned individual partitions, latitudes from south up to -30 is assigned another partition (brown), and the rest belong to the 4th partition (pink). 3. Dataset Two types of data are used in this study: altimeter data and climate model large ensemble (LE) experiments. The altimeter dataset is a monthly sea surface height (SSH) data at 1/4-degree spatial resolution for the time period 1993-2022. A spatialsmoothing1 is applied to reduce the influence of small-scale ocean eddies. For the same duration, we obtain monthly SSH at 1-degree spatial resolution from the ensemble means of six different climate model LEs produced with CESM1 (Kay et al. 2015), CESM2 (Danabasoglu et al. 2020), GFDLESM2M (Dunne et al. 2013), MPIGE (Maher et al. 2019), MPI-ESM1-2-HR (M ̈uller et al. 2018) and MPI-ESM1-2-LR (Giorgetta et al. 2013). These LEs provide simulations for the 20th and 21st centuries and are multi-member ensembles of 1https://www.ncl.ucar.edu/Document/Functions/Built-in/exp_tapersh.shtml 7 Fig. 3: Figure shows the sea level trend maps for the six climate model large ensembles for the period 1993-2022 with their global mean removed. Here the trend values are visualized in mm/year. Fig. 4: Figure shows the altimeter sea level trend map for the period 1993-2022 with the global mean removed. Here the trend values are visualized in mm/year. climate models run with small perturbations in the initial conditions to estimate the distribution of internal climate variability and forced climate change. Model simulations for individual members of the above large ensembles are averaged to create the sea surface height (SSH) variable. We do this since we expect internal variability to be inherently unpredictable while we expect the response to external forcings (influences considered external to the climate system that impact climate) to 8 be both predictable and slowly varying. This step removes noise but it also reduces variability in the climate model SSH data, while we have variability present in the altimeter SSH data as it is a single field. Some of the climate models operate under assumptions in which their global mean is by definition 0. We, therefore, remove the global mean in all the datasets including the altimeter. The spatial SSH fields for both the altimeter data and climate model output are regridded to a 2 degree, i.e. a 180x90 grid as it speeds up the computation while still keeping a reasonable resolution. For every ocean grid point, a linear trend is fitted to the monthly SSH time series for the 1993-2022 (30-year) time period. This way, a single trend map is obtained, for all the ensembles and the altimeter (see Figures 3 and 4). Working with trends helps to avoid the monthly variability of the SSH fields. We can observe the differences between the altimeter and the climate model trends, especially with respect to variability. The climate models do not accurately reproduce the trend pattern in altimeter data and there is a lot more variability in the altimeter trend as compared to the climate model trends. It is worth noting that altimeter records are not present for all latitudes. We have both altimeter and climate model trend values for 8, 001 global ocean points (excluding land grid points) that we use as the dataset for ML. We show trend values from the six climate models in Figure 3 that serve as the input features for our ML model and the altimeter trend value in Figure 4 that serves as the label for training the ML model. These trend values are computed in cm/year and are normalized by scaling them between 0 and 1 for training. After training, in the inference phase, trends are predicted for 30 years later. Climate model projected trends are computed in the same way for 30 years later, i.e. for 2023-2052. These are then passed through the learned ML model to predict the altimeter trend for 2023-2052. 4. Results We report our results using different evaluation metrics for the past and future time periods, since there is no ground truth with which to evaluate future predictions. 9 Method RMSE↓ Correlation↑ No Clustering Domain-specified partition Spectral Clustering 0.72 0.4 0.51 0.82 0.95 0.91 Table 1: Table comparing the ML prediction performance in terms of weighted RMSE (in mm/year) and correlation for different spatial segmentations for 1993-2022. a. 1993-2022 With the ground truth data available for this period, in Table 1, we report the RMSE scores on the historical (training) time period, for the two spatial segmentation strategies, compared to applying our supervised learning step directly to the entire spatial extent (No clustering). Table 1 also shows the Pearson correlation scores between the ML predicted trend and the true altimeter trend for 1993- 2022. The RMSE and correlation scores are spatially-weighted as described in Section 2. The Domain-specified partition is observed to have better scores (lower RMSE and higher correlation) for the training period as compared to Spectral clustering. Both the Domain-specified partition and Spectral clustering scores are considerably better than the No clustering setup. Each of the segmented regions is examined by looking at each cluster's RMSE and correlation scores. The trend predicted by ML is visualized and higher error zones are mostly observed in the green cluster of Figure 2(a) for Spectral clustering and the olive cluster of Figure 2(b) for Domain-specified partition. While these scores explain the ML's training performance, our interest mainly lies in the future period prediction which is detailed below. b. 2023-2052 It is harder to gauge the performance of any ML method without the ground truth. In this case, we do a qualitative analysis of the predicted trend in terms of cumulative variability, to evaluate the ability of the ML models to predict trends with variability similar to the variability of the 1993-2022 altimeter trend. Additionally, we compute the model uncertainty of the ML models in their prediction. As often done in the climate science domain, we also evaluate the ML models 10 solely with the climate model datasets (Monteleoni et al. 2011). These experiments are described later in this section. (a) ML predicted trend with no partitioning for 2023-2052 (RMS: 0.81mm/year). (b) ML predicted trend with the Domain-specified partition for 2023-2052 (RMS: 1.68mm/year). Fig. 5 11 (c) ML predicted trend with Spectral clustering for 2023-2052 (RMS: 1.05 mm/year). Fig. 5: The trend estimates are predictions for the future period: 2023-2052 in mm/year. Figures show the trend predicted with ML using (a) no partitioning of the spatial grid, (b) the Domain- specified partition, and (c) Spectral clustering. We use the root mean square (RMS) of the trend (spatially-weighted as in Section 2) to quantify the notion of variability in the trend. The RMS value is higher if the cumulative variability is higher and vice-versa. Figure 4 shows that the altimeter trend from 1993-2022 has a high variability. We computed the RMS value to be 1.23mm/year. This gives us the baseline variability of persistence, a standard baseline approach in climate and weather forecasting, i.e., considering this observed variability as an estimate of future variability. In Figures 5(a), (b), and (c), we show the future predicted trend obtained from the ML model without any partitioning (No clustering), with the Domain-specified partition, and with a partition obtained via Spectral clustering, respectively. We computed the RMS values associated with trend predictions obtained from the three strategies. Trend predicted with Spectral clustering (Figure 5(c)) shows a high variability with RMS as 1.05 mm/year for 2023-2052. It is very close, though still slightly less than the altimeter trend variability of the past. On the other hand, the trend predicted with the Domain-specified partition (Figure 5(b)) shows a much higher variability with RMS as 1.68mm/year. The high prediction red zone in the North Pacific Ocean could be dominating the overall RMS value of the Domain- 12 specified prediction. This emphasizes the need to use additional metrics and analyses to evaluate our predictions rather than relying on a single overall score expressing cumulative variability. Notably, the predicted variability of both Spectral clustering and the Domain-specified partition are higher as compared to the No clustering setting (RMS: 0.81mm/year). This result strengthens our hypothesis that segmenting the spatial grid and learning one ML model on each segmented region yields predictions that can better capture variability (with respect to persistence). Measuring the correlation between the persistence and future predicted trend is also useful as it is expected to be fairly high based on the climate model experiments which also show a high correlation between the past and future trend in their projections. This correlation is much higher (0.59) for Spectral clustering than the Domain-specified partition (0.45) and No clustering setup (0.27). 1) Model uncertainty Providing uncertainties of machine learning predictions can be extremely useful. For this application, we do so as another way to evaluate our ML model's future predictions. Gal and Ghahramani (2016) showed theoretically that neural networks with dropout layers can be interpreted as a Bayesian approximation of a deep Gaussian process. Thus we can obtain uncertainties with dropout neural networks without sacrificing accuracy and with lesser computation cost as compared to the Bayesian models. This Monte Carlo dropout approach can work with any existing neural networks trained with dropout (Gal and Ghahramani 2016). Our FCNN model includes dropout layers to reduce overfitting while training, thus allowing us to use the Monte Carlo dropout approach for uncertainty estimation. To do so, in the inference phase, we perform multiple forward passes (with different dropout masks) through our ML model. We then report the mean of the ensemble of predictions as the prediction outcome and their standard deviation as the prediction uncertainty. Figure 6 shows the prediction uncertainty plots for both Spectral clustering and the Domain-specified partition. The predictions with the Domain- specified partition (Figure 6(a)) show a higher overall variance in prediction. We observe higher uncertainties in key areas that are critical for socio-economic impacts such as important parts of the Pacific Ocean whereas Spectral clustering (Figure 6(b)) predictions are more confident in most of the Pacific Ocean and higher uncertainties are concentrated in the Southern Ocean and parts of the North Atlantic Ocean. We also studied the cumulative uncertainty by taking the root mean 13 (a) ML model uncertainty in terms of standard deviation (mm/year) over future prediction with the Domain-specified partition. (b) ML model uncertainty in terms of the standard deviation (mm/year) over future prediction with Spectral clustering. Fig. 6: Figure shows ML model uncertainty map over future prediction with (a) the Domain- specified partition, and (b) Spectral clustering. 14 square (RMS) of this model uncertainty over the global ocean. Lower RMS is better as it indicates lower cumulative uncertainty. The RMS for Spectral clustering (0.19mm/year) is better than the Domain-specified partition (0.24mm/year) and the No clustering scenario (0.3mm/year). We observe that the ML model is more certain with Spectral clustering. We also observed that some regions over which the ML model with Spectral clustering had higher uncertainties (Figure 6(b)) had high overlap with the regions where climate model projections for 2023-2052 had the highest disagreement (Figure 8(b)). 2) Interpretability Study Through this interpretability study, our goal was to understand the contribution of each climate model in the ML prediction. While complex machine learning models can predict accurate outcomes, it is extremely important to understand why the ML model makes a certain prediction in order to make it more interpretable. We use SHAP (SHapley Additive exPlanation) Lundberg and Lee (2017) to compute the contributions of each feature to a prediction outcome in order to explain the prediction. Lundberg and Lee (2017) in their work on SHAP show the value of a linear explanation model that is an interpretable approximation to the original complex model by proposing a class of methods: Additive feature attribution methods. They use x and f as the original inputs and prediction model, g as an explanation model, and x′ as a simplified input such that x = hx (x′), hx being a mapping function. Under the definition of Additive feature attribution methods as described in (Lundberg and Lee 2017), the explanation model g must satisfy g(z′) ≈ f (hx (z′)) where z′ ≈ x′, and can be written as g(z′) = φ0 + (cid:205)M i, z′ ∈ {0, 1}M indicates whether a particular feature (out of M features) is included or not with a binary value. Here, φi indicates feature attribution n=1 φiz′ or feature importance i.e. how much this feature contributed to the model's outcome. Lundberg et al. then show from the game theory literature that Shapley values as φi satisfy the definition and a few more desirable properties of this class of methods (Shapley et al. 1953; Young 1985). For the computation of Shapley values (Lipovetsky and Conklin 2001), marginal contribution of a feature i is computed by taking the difference between the model f 's output with and without that feature. The marginal contribution is computed for all possible subsets S ⊆ F \ {i} (F is the set of all features), and a weighted average over them gives the Shapley value as shown below (from 15 Lundberg and Lee (2017)). ∑︁ φi = S⊆F\{i} |S|!(|F | − |S| − 1)! |F |! [ fS∪{i} (xS∪{i}) − fS (xS)] (1) In most cases, ML models cannot handle missing features, so this is often approxi- mated by integrating out the feature using samples from a background dataset as discussed in ( ˇStrumbelj and Kononenko 2014; Lundberg and Lee 2017). The computation of SHAP i.e. SHapley Additive exPlanation becomes very challenging as number of features increase. In (Lund- berg and Lee 2017) they provide an approximation to obtaining the Shapley values via Kernel SHAP (a model agnostic approximation). Our interpretability analysis is based on SHAP as explained above. We use Kernel SHAP from Python's shap.KernelExplainer to compute the contributions or feature importance values of the climate models which are feature inputs to our FCNNs in order to explain the future prediction. We apply SHAP on each of the clusters since we learn different ML models for different clusters. Figure 7 shows a cluster level feature importance ranking of all the climate models for the Spectral clustering setup. SHAP assigns a feature importance to each climate model for the future prediction on each grid point in the cluster. These importance values are averaged over every cluster and shown in the bar plots in Figure 7. Given that we use scaling on the input features as well as the output labels when training the ML models, the importance values displayed in Figure 7 are scaled as well. Overall, the SHAP values indicate that the CESM1, CESM2, and MPIGE large ensembles are more important for all the clusters than others, suggesting that ML model relied more on these for future predictions. 3) Evaluation with climate models While we do not have observations for the future to validate our prediction outcomes, we do have climate model projections for the future. As often done in the climate science domain, we perform an evaluation of our predictions using only the climate model datasets. We train the same FCNN models for 1993-2022 again, but this time using one of the climate model hindcasts as the training label instead of the altimeter data, and the rest of the five climate models as input features (like in (Monteleoni et al. 2011)). We train six such ML models treating each of the six climate 16 (a) (b) Fig. 7: Figure shows (a) the clusters obtained from Spectral clustering, and (b) the plot showing the feature importance ranking of all the climate models based on their contribution to the future prediction as given by SHAP values. The map with the spectral clusters is added to provide more context. models as the training label one at a time. At the time of inference for 2023-2052, we have the ground truth i.e. climate model projections available for the future for each climate model, so we measure RMSE and correlation scores for the ML prediction of the climate model trend against the true climate model projected trend. We show the weighted correlation metrics in Table 2(a) and weighted RMSE scores in Table 2(b) for both the Spectral clustering and Domain-specified partition setups. They are evaluated against the persistence scores for each of the climate models (here, persistence is using the climate model hindcast from 1993-2022 as the prediction for the future 2023-2052). It should be noted that the climate model projections substantially differ from 17 each other which makes this prediction task harder for ML. Figure 8 shows the trend maps from all the climate models for the future period 2023-2052 and a standard deviation plot showing the variance in their projections. CESM1 LE CESM2 LE MPIGE 0.74 0.79 0.74 0.73 0.73 0.74 MPI- ESM1-2- HR 0.53 0.37 MPI- ESM1-2- LR 0.49 0.49 GFDL ESM2M Average 0.74 0.48 0.66 0.6 0.82 0.81 0.82 0.39 0.6 0.43 0.65 (a) Correlation↑ CESM1 LE CESM2 LE MPIGE 0.58 0.56 0.6 0.69 0.69 0.73 MPI- ESM1-2- HR 0.83 0.96 MPI- ESM1-2- LR 0.95 0.99 GFDL ESM2M Average 0.72 0.99 0.73 0.82 0.49 0.56 0.58 0.93 0.86 1.01 0.74 Persistence ML with Domain- specified partition ML with Spectral clustering Persistence ML with Domain- specified partition ML with Spectral clustering (b) RMSE↓ Table 2: An evaluation setup using climate models to simulate observation data so as to evaluate ML predictions for the future period 2023-2052. The table reports the performance score in terms of (a) correlation (higher the better) and (b) RMSE (in mm/year, lower the better) between the ML prediction of a climate model and the ground truth climate model projection. Results are computed for predicting each of the six climate models one at a time (shown as the columns in the table) using the rest of them as input features. The last column shows an average score obtained by averaging the scores over all climate models. Based on both the correlation and RMSE scores, it can be seen that ML with Spectral clustering outperforms the Domain-specified partition on nearly all the climate models, falling slightly behind only for the case of GFDLESM2M. It also performs better than the persistence on all the climate models except MPI-ESM1-2-HR and GFDLESM2M. We observed that the regions where MPI- ESM1-2-HR and GFDLESM2M predictions with the Spectral clustering setup have higher errors (in parts of the Southern Ocean and the North Atlantic Ocean) are some of the regions where these 18 two climate models have disagreement over with the remaining climate model projections (see Figure 8). Comparing the average correlation and RMSE scores (last column in Table 2) over all the six ML models based on the six climate model labels show Spectral clustering to be better than the Domain-specified partition and very close to the persistence. (a) (b) Fig. 8: Plot showing (a) the climate model projected trends in mm/year for 2023-2052, and (b) the standard deviation in their projections in mm/year. 4) Experiment with varying number of clusters We do a comparative study by varying the number of clusters (n-clusters) obtained with Spectral clustering and comparing their prediction performance based on the evaluation schemes discussed 19 before. Specifically, for n-clusters as 2, 4, 8, 16, 32, and 64, we present Table 3 where we compare their training error in terms of RMSE, cumulative variability of the future trend prediction in terms of its RMS, and the ML model uncertainty in prediction quantified by the RMS of model uncertainty. We also include the correlation of the predicted trend with the past altimeter trend (1993-2022). Additionally, we add another column which provides Spectral clustering's performance scores when evaluated solely with the climate models. This last column reports an average correlation score as derived in 4.b.3. n-clusters Training RMSE 2 4 8 16 32 64 0.62 0.51 0.43 0.34 0.38 0.29 of ML uncer- RMS of future predicted trend (cumulative vari- ability 0.99 1.05 1.11 1.5 1.29 1.61 RMS model tainty 0.23 0.19 0.17 0.17 0.24 0.25 Correlation of predicted trend with past altimeter trend 0.45 0.59 0.69 0.67 0.69 0.67 Avg correlation evaluation on climate with models 0.68 0.65 0.67 0.62 0.62 0.64 Table 3: Table comparing ML with Spectral clustering performance across n-clusters: 2, 4, 8, 16, 32, 64. It shows the training error (RMSE), RMS of the future predicted trend, RMS of the ML model uncertainty in prediction, correlation of the future predicted trend with the past altimeter trend, and an average correlation score when evaluated only with the climate model datasets as described in 4.b.3. All the scores are weighted and the RMSE and RMS measures are in mm/year. With an increase in the number of clusters, there are fewer data points per cluster, so the training data size for each ML model decreases. Table 3 indicates that the training RMSE decreases with increasing n-clusters. This is expected as the training process will tend to overfit more with smaller training data per cluster. The RMS that represents the cumulative variability of the future prediction outcome is observed to increase with the increase in n-clusters (except for a small drop for n-clusters = 32). Notably, the model uncertainty drops and then increases, especially when working with larger number of clusters like n-clusters = 32 or 64, as quantified by the RMS in the third column. For such high n-clusters, there is a huge decrease in the training data points per cluster and this can lead to more variance in ML's prediction, reducing its confidence. Higher n-clusters show predicted trends to be generally more correlated with the past altimeter trend. The last column based on evaluation with climate models doesn't show a significant performance change with n-clusters. The score, however, drops slowly with more n-clusters. For a qualitative 20 comparison, we plot the predicted trend for 2023-2052 as generated by the ML model with 4, 8, and 16 spectral clusters in Figure 9. While we observe slightly better predictions with 8 spectral clusters (from Table 3), we work extensively with the 4-cluster Spectral clustering setup in order to have a fair comparison with the Domain-specified partition with 4 partitions in our case. Having a higher number of clusters also makes it harder for the domain experts to interpret its physical implications. Additionally, upon examining the prediction maps closely from Figure 9, it can be noted that the difference across various clusters can mostly be seen in the predicted strength of the trends (higher for higher n- clusters which also contributes to its higher RMS), and notably not the general prediction patterns themselves. (a) Future predicted trend in mm/year with Spectral clustering - 4 clusters for 2023-2052. Fig. 9 21 (b) Future predicted trend in mm/year with Spectral clustering - 8 clusters for 2023-2052. (c) Future predicted trend in mm/year with Spectral clustering - 16 clusters for 2023-2052. Fig. 9: Figure shows the ML predicted trend for the future period 2023-2052 with Spectral clustering with (a) 4, (b) 8, and (c) 16 clusters. 22 5. Discussion In our framework, fully connected neural networks learn to map climate model projections to altimeter trends. We also present an interpretability study that uses SHAP values to explain the contributions of all the climate models to the final prediction. Spectral clustering shows promise in this application by generating future predictions with ML such that their variability lies in the range we expect, given the variability of the past altimeter observations. These ML predictions have lower uncertainties in impactful areas as shown before. Spectral clustering also shows robustness as it yields better predictions than the one with the Domain-specified partition when evaluated solely with climate models, as described in 4.b.3. The future predictions are expected to be correlated well with the past altimeter trend and a higher correlation is observed with the predictions obtained from Spectral clustering than the Domain-specified partition. Our prediction highlights the regional variation in the predicted sea level trend. It is worth noting that the climate model projections used in our framework are "RCP85" and "SSP370" scenarios. These mostly lie in the high level of emission scenarios where a few policies have been put in place to reduce emissions and warming and tackle climate change. Under such circumstances, our prediction outcomes indicate a rising sea level trend around certain important regions such as Japan, India, the South China Sea, the Maritime Continent, Australia, the Gulf Coast and the eastern seaboard of the US, and Mexico. Overall, these predictions suggest that many existing hot spots of sea level rise, including highly populated zones in the western Pacific Ocean and along the US Gulf Coast, will continue to experience rates of sea level rise in excess of the global average. Some of these areas may be limited in their ability to adapt to such changes which could increase the risk of major impacts of sea level rise in the coming decades. 6. Conclusion We show the effectiveness of neural networks in multi-decadal sea level trend prediction at a 2- degree spatial grid leveraging the projections from climate model large ensembles. We demonstrate that segmenting the spatial grid into partitions employing spectral clustering improves the ML predictions by learning a dedicated ML model per partition. We also supplement our predictions with uncertainty estimates which could be more helpful in interpreting the results. While our framework presents promising results, it is important to note that climate model projections become 23 less certain over time, making long-term predictions based on them challenging. The climate models used in our setup do not incorporate melting ice sheets and their effects on future sea level change (Hamlington et al. 2020b). It is pertinent to utilize this to improve the predictions further. The predictions can potentially also improve if we incorporate factors such as wind and temperature, harnessing deep neural networks' capabilities in handling this diverse data. 24 Acknowledgments. This work was supported by NASA Award 80NSSC21K1191. CM was supported in part by a Choose France Chair in AI grant from the French government, administered by INRIA. The author thanks Shivendra Agrawal for their valuable feedback on improving the quality of this work. Data availability statement. The climate model output used in this study can be accessed on the Earth System Grid at https://esgf-node.llnl.gov/search/cmip6/. The sea level altimeter data from JPL can be accessed at: https://sealevel.nasa.gov/data/dataset/ ?identifier=SLCP_SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_ JPL2205_2205. References Bahari, N. A. A. B. S., A. N. Ahmed, K. L. Chong, V. Lai, Y. F. Huang, C. H. Koo, J. L. Ng, and A. El-Shafie, 2023: Predicting sea level rise using artificial intelligence: A review. Archives of Computational Methods in Engineering, 1–18. Balogun, A.-L., and N. Adebisi, 2021: Sea level prediction using arima, svr and lstm neural network: assessing the impact of ensemble ocean-atmospheric processes on models' accuracy. Geomatics, Natural Hazards and Risk, 12 (1), 653–674. Braakmann-Folgmann, A., R. Roscher, S. Wenzel, B. Uebbing, and J. Kusche, 2017: Sea level anomaly prediction using recurrent neural networks. arXiv preprint arXiv:1710.07099. Danabasoglu, G., and Coauthors, 2020: The community earth system model version 2 (cesm2). Journal of Advances in Modeling Earth Systems, 12 (2), e2019MS001 916. Dunne, J. P., and Coauthors, 2013: Gfdl's esm2 global coupled climate–carbon earth system models. part ii: carbon system formulation and baseline simulation characteristics. Journal of Climate, 26 (7), 2247–2267. Fasullo, J. T., P. R. Gent, and R. Nerem, 2020a: Forced patterns of sea level rise in the community earth system model large ensemble from 1920 to 2100. Journal of Geophysical Research: Oceans, 125 (6), e2019JC016 030. 25 Fasullo, J. T., P. R. Gent, and R. S. Nerem, 2020b: Sea level rise in the cesm large ensemble: The role of individual climate forcings and consequences for the coming decades. Journal of Climate, 33 (16), 6911–6927. Fasullo, J. T., and R. S. Nerem, 2018: Altimeter-era emergence of the patterns of forced sea-level rise in climate models and implications for the future. Proceedings of the National Academy of Sciences, 115 (51), 12 944–12 949. Gal, Y., and Z. Ghahramani, 2016: Dropout as a bayesian approximation: Representing model uncertainty in deep learning. international conference on machine learning, PMLR, 1050–1059. Giorgetta, M. A., and Coauthors, 2013: Climate and carbon cycle changes from 1850 to 2100 in mpi-esm simulations for the coupled model intercomparison project phase 5. Journal of Advances in Modeling Earth Systems, 5 (3), 572–597. Hamlington, B., S. Cheon, P. Thompson, M. Merrifield, R. Nerem, R. Leben, and K.-Y. Kim, 2016: An ongoing shift in pacific ocean sea level. Journal of Geophysical Research: Oceans, 121 (7), 5084–5097. Hamlington, B. D., C. G. Piecuch, J. T. Reager, H. Chandanpurkar, T. Frederikse, R. S. Nerem, J. T. Fasullo, and S.-H. Cheon, 2020a: Origin of interannual variability in global mean sea level. Proceedings of the National Academy of Sciences, 117 (25), 13 983–13 990. Hamlington, B. D., and Coauthors, 2020b: Understanding of contemporary regional sea-level change and the implications for the future. Reviews of Geophysics, 58 (3), e2019RG000 672. Hassan, K. M. A., M. A. Haque, and S. Ahmed, 2021: Comparative study of forecasting global mean sea level rising using machine learning. 2021 International Conference on Electronics, Communications and Information Technology (ICECIT), IEEE, 1–4. Imani, M., Y.-C. Chen, R.-J. You, W.-H. Lan, C.-Y. Kuo, J.-C. Chang, and A. Rateb, 2017: Spatiotemporal prediction of satellite altimetry sea level anomalies in the tropical pacific ocean. IEEE Geoscience and Remote Sensing Letters, 14 (7), 1126–1130. Kay, J. E., and Coauthors, 2015: The community earth system model (cesm) large ensemble project: A community resource for studying climate change in the presence of internal climate variability. Bulletin of the American Meteorological Society, 96 (8), 1333–1349. 26 Lipovetsky, S., and M. Conklin, 2001: Analysis of regression in game theory approach. Applied Stochastic Models in Business and Industry, 17 (4), 319–330. Liu, J., B. Jin, L. Wang, and L. Xu, 2020: Sea surface height prediction with deep learning based on attention mechanism. IEEE Geoscience and Remote Sensing Letters. Lundberg, S. M., and S.-I. Lee, 2017: A unified approach to interpreting model predictions. Advances in neural information processing systems, 30. Maher, N., and Coauthors, 2019: The max planck institute grand ensemble: enabling the explo- ration of climate system variability. Journal of Advances in Modeling Earth Systems, 11 (7), 2050–2069. Monteleoni, C., G. A. Schmidt, S. Saroha, and E. Asplund, 2011: Tracking climate models. Statistical Analysis and Data Mining: The ASA Data Science Journal, 4 (4), 372–392. M ̈uller, W. A., and Coauthors, 2018: A higher-resolution version of the max planck institute earth system model (mpi-esm1. 2-hr). Journal of Advances in Modeling Earth Systems, 10 (7), 1383–1413. Nerem, R. S., B. D. Beckley, J. T. Fasullo, B. D. Hamlington, D. Masters, and G. T. Mitchum, 2018: Climate-change–driven accelerated sea-level rise detected in the altimeter era. Proceedings of the national academy of sciences, 115 (9), 2022–2025. Nieves, V., C. Radin, and G. Camps-Valls, 2021: Predicting regional coastal sea level changes with machine learning. Scientific Reports, 11 (1), 1–6. Ronneberger, O., P. Fischer, and T. Brox, 2015: U-net: Convolutional networks for biomedical image segmentation. International Conference on Medical image computing and computer- assisted intervention, Springer, 234–241. Shapley, L. S., and Coauthors, 1953: A value for n-person games. Shi, X., Z. Chen, H. Wang, D.-Y. Yeung, W.-K. Wong, and W.-c. Woo, 2015: Convolutional lstm network: A machine learning approach for precipitation nowcasting. Advances in neural information processing systems, 28. 27 Sinha, S., C. Monteleoni, J. Fasullo, and R. S. Nerem, 2022: Sea-Level Projections via Spatiotem- poral Deep Learning from Altimetry and CESM Large Ensembles. AGU Fall Meeting Abstracts, Vol. 2022, OS36A–05. ˇStrumbelj, E., and I. Kononenko, 2014: Explaining prediction models and individual predictions with feature contributions. Knowledge and information systems, 41, 647–665. Sun, Q., J. Wan, and S. Liu, 2020: Estimation of sea level variability in the china sea and its vicinity using the sarima and lstm models. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 13, 3317–3326. Vestergaard, J. S., A. A. Nielsen, and O. B. Andersen, 2010: Seventeen years of global ssh anomalies analyzed by a maximum information based extension to eof analysis. Power, 2, 1–54. Wang, G., X. Wang, X. Wu, K. Liu, Y. Qi, C. Sun, and H. Fu, 2022: A hybrid mul- tivariate deep learning network for multistep ahead sea level anomaly forecasting. Jour- nal of Atmospheric and Oceanic Technology, 39 (3), 285 – 301, https://doi.org/https://doi. org/10.1175/JTECH-D-21-0043.1, URL https://journals.ametsoc.org/view/journals/atot/39/3/ JTECH-D-21-0043.1.xml. Young, H. P., 1985: Monotonic solutions of cooperative games. International Journal of Game Theory, 14, 65–72, URL https://api.semanticscholar.org/CorpusID:122758426. Zhao, J., Y. Fan, and Y. Mu, 2019: Sea level prediction in the yellow sea from satellite altimetry with a combined least squares-neural network approach. Marine geodesy, 42 (4), 344–366. 28
http://arxiv.org/abs/2310.04539v1
"2023-10-06T19:06:13"
"2023-10-06T19:06:13"
Generating Less Certain Adversarial Examples Improves Robust Generalization
Recent studies have shown that deep neural networks are vulnerable to adversarial examples. Numerous defenses have been proposed to improve model robustness, among which adversarial training is most successful. In this work, we revisit the robust overfitting phenomenon. In particular, we argue that overconfident models produced during adversarial training could be a potential cause, supported by the empirical observation that the predicted labels of adversarial examples generated by models with better robust generalization ability tend to have significantly more even distributions. Based on the proposed definition of adversarial certainty, we incorporate an extragradient step in the adversarial training framework to search for models that can generate adversarially perturbed inputs with lower certainty, further improving robust generalization. Our approach is general and can be easily combined with other variants of adversarial training methods. Extensive experiments on image benchmarks demonstrate that our method effectively alleviates robust overfitting and is able to produce models with consistently improved robustness.
[ "Minxing Zhang", "Michael Backes", "Xiao Zhang" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04539v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04539v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 t c O 6 ] G L . s c [ 1 v 9 3 5 4 0 . 0 1 3 2 : v i X r a Generating Less Certain Adversarial Examples Improves Robust Generalization Minxing Zhang Michael Backes Xiao Zhang CISPA Helmholtz Center for Information Security Saarbrücken, Germany {minxing.zhang, backes, xiao.zhang}@cispa.de Abstract Recent studies have shown that deep neural networks are vulnerable to adversarial examples. Numerous defenses have been proposed to improve model robustness, among which adversarial training is most successful. In this work, we revisit the robust overfitting phenomenon. In particular, we argue that overconfident models produced during adversarial training could be a potential cause, supported by the empirical observation that the predicted labels of adversarial examples generated by models with better robust generalization ability tend to have significantly more even distributions. Based on the proposed definition of adversarial certainty, we incorporate an extragradient step in the adversarial training framework to search for models that can generate adversarially perturbed inputs with lower certainty, further improving robust generalization. Our approach is general and can be easily com- bined with other variants of adversarial training methods. Extensive experiments on image benchmarks demonstrate that our method effectively alleviates robust overfitting and is able to produce models with consistently improved robustness. 1 Introduction Deep neural networks (DNNs) have achieved exceptional performance and been widely adopted in various applications, including computer vision [17], natural language processing [12] and recom- mendation systems [8]. However, DNNs have been shown to be vulnerable to classifying inputs, also known as adversarial examples [16, 38], crafted with imperceptible perturbations that are designed to trick the model into making wrong predictions. The prevalence of adversarial examples has raised serious concerns regarding the robustness of DNNs, especially when deployed in security-critical and safety-critical applications such as self-driving cars [5], biometric facial recognition [22] and medical diagnosis [14, 25]. To improve the resilience of DNNs against adversarial examples, numerous defense mechanisms have been proposed, e.g., distillation [29], adversarial detection [24], feature denoising [47], randomized smoothing [7] and semi-supervised methods [1]. Among them, adversarial training [26, 51] is by far one of the most effective methods in producing adversarially robust models. However, even the state- of-the-art adversarial training methods [9, 31, 43] cannot achieve satisfactory robustness performance on simple classification tasks like classifying CIFAR-10 images. Witnessing the empirical challenges in further improving adversarial robustness, many recent studies focus on understanding the behavior of adversarial training [15, 41, 45, 49, 52]. In particular, Rice et al. observed that the testing-time model robustness immediately increases by a large margin after the first learning rate decay but keeps decreasing afterwards during adversarial training, termed as the robust overfitting phenomenon [32]. Robust overfitting has attracted a lot of attention since then, as overfitting is not an issue for standard deep learning but appears to be dominant for adversarially-trained DNNs. In addition, recognizing the fundamental cause of robust overfitting may provide us with important insights in designing better ways to produce more robust models. 1 This paper revisits the robust overfitting phenomenon to provide a different perspective on explaining why it happens and develop a new algorithmic solution inspired by the gained insight to enhance robust generalization. More specifically, we observe that models produced during adversarial training tend to be overconfident in predicting the label of the training-time adversarial examples generated by the model but not for adversarially-perturbed testing samples, where the gap potentially induces robust overfitting. Inspired by this observation, we propose an extragradient step in adversarial training to search models that can generate less certain adversarial examples. Contributions. By comparing the classwise distributions of predicted labels of adversarial examples generated at different epochs during adversarial training, we observe that models with better robust generalization ability exhibit more even distributions. In contrast, the final model produced by adversarial training is significantly overconfident in predicting the labels of training-time adversarial examples, resulting in robust overfitting (Figure 1). We introduce a general notion of adversarial certainty to capture a model's confidence in classifying adversarial examples generated by the model at a logit level (Definition 3.1), and show a similar trend that models with better robust generalization have lower adversarial certainty with respect to training examples, which motivates us to prevent adversarially-trained models from being overconfident (Section 3). Built upon the definition, we propose a novel Extragradient-type method to explicitly Decrease Adversarial Certainty (EDAC) for adversarial training (Section 4). EDAC first finds the steepest descent direction of model weights to decrease adversarial certainty, aiming to generate less certain adversarial examples during training, then the newly generated adversarial examples with lower certainty are used to optimize model robustness. As the model learns from less certain adversarial examples, the robust generalization gap between training and testing will then be shrunk. Experiments on image benchmark datasets demonstrate that our method consistently produces more robust models when combined with various adversarial training methods, confirming the importance of generating less certain adversarial examples, and that robust overfitting is significantly mitigated with the help of our EDAC (Section 5.1). Besides, we investigate the cooperation of adversarial certainty with other helpful insights for model robustness, where our method shows further generalizability by compatibly improving them (Section 5.2). In general, these improvements empirically depict the correlation with adversarial certainty, indicating that our method helps generate less certain adversarial examples and improves the robust generalization of adversarially-trained models. Related Work. Adversarial training is a promising defense framework for improving model ro- bustness against adversarial examples [2, 16, 20, 26, 34, 40, 42, 44, 51]. In particular, Goodfellow et al. [16] proposed to adversarially train models using perturbations generated by the fast gra- dient sign method (FGSM). Later on, Madry et al. [26] incorporated perturbations produced by iterative projected gradient decent (PGD) into adversarial training, which learns models with more reliable and robust performance. Other variants of adversarial training have been proposed, which typically modify the training objective but also use PGD. For instance, Zhang et al. [51] designed TRADES, which considers the standard classification loss and encourages the decision boundary to be smooth, while Wang et al. [42] proposed MART to emphasize the importance of misclassified examples during adversarial training. Besides improving adversarial training, several recent works focus on understanding robust generalization and leveraging the gained insight to build more robust models [6, 19, 32, 37, 48, 49]. In particular, Rice et al. [32] discovered that, unlike standard deep learning, robust overfitting is a dominant phenomenon for adversarially-trained DNNs that hinders robust generalization, and advocated the use of early stopping, while Wu et al. [45] discovered that the flatness of weight loss landscape is an important factor related to robust generalization, which inspires them to adversarially perturb the model weights during adversarial training. In addition, Tack et al. [39] proposed a consistency regularization term based on data augmentation to mitigate robust overfitting. Our work complements these methods, where we explain why overconfidence in generating adversarial examples is highly related to robust overfitting and illustrate how to improve robust generalization by promoting less certain perturbed inputs for adversarial training. We are also aware of two recent works that focus on improving adversarial training with the considera- tion of model overconfidence [33, 36]. These works are aligned with our insight for designing EDAC but target different objectives. Specifically, Stutz et al. developed a confidence-calibrated adversarial training method that achieves better robustness against unseen attacks [36], while Setlur et al. pro- posed a regularization technique to maximize the entropy of model predictions on out-of-distribution data with larger perturbations, thus improving model accuracy on unseen examples [33]. 2 2 Preliminaries This section presents the necessary notations and related concepts, including adversarial robustness, robust generalization and adversarial training. Notation. We use lowercase boldfaced letters to denote vectors, sgn(*) to denote the sign function, and 1(*) to denote the indicator function. For any vector x and finite-sample set S, let xk be the k-th element of x and |S| be the cardinality of S. Consider a metric space (X , ∆), where X is the input space and ∆ : X × X → R is a distance metric. For any x ∈ X and ε > 0, let Bε(x; ∆) = {x′ ∈ X : ∆(x′, x) ≤ ε} be the ball centered at x with radius ε and metric ∆, where we write Bε(x) = Bε(x; ∆) when ∆ is free of context. For any set C ⊆ X , let ΠC(x) = argminx′∈C ∆(x′, x) be the projection of x onto C. Let μ be a probability distribution on X . The empirical distribution of μ based on a sample set S is defined as: ˆμS (C) = (cid:80) 1(x ∈ C)/|S| for any C ⊆ X . x∈S Adversarial Robustness. Adversarial robustness captures the classifier's resilience to small adversar- ial perturbations. In particular, we work with the following definition of adversarial robustness: Definition 2.1 (Adversarial Robustness). Let X ⊆ Rn be input space, Y be label space, and μ be the underlying distribution of inputs and labels. Let ∆ be a distance metric on X and ε > 0. For any classifier Mθ : X → Y, the adversarial robustness of Mθ with respect to μ, ε and ∆ is defined as: Robε(Mθ; μ) = 1 − Pr (x,y)∼μ (cid:2)∃ x′ ∈ Bε(x) s.t. Mθ(x′) ̸= y(cid:3). (1) When ε = 0, Rob0(Mθ; μ) is equivalent to the clean accuracy of Mθ. In practice, the probability density function of the underlying distribution μ is typically unknown. Instead, we only have access to a set of test examples Ste sampled from μ, thus a classifier's adversarial robustness is estimated by replacing μ in Equation 1 with its empirical counterpart based on Ste. To be more specific, the testing-time adversarial robustness of Mθ with respect to Ste, ε and ∆ is given by: Robε(Mθ; ˆμSte) = 1 − 1 |Ste| (cid:88) (x,y)∈Ste max x′∈Bε(x) 1(cid:0)Mθ(x′) ̸= y(cid:1), (2) where ˆμSte denotes the empirical measure of μ based on Ste. We remark that robust generalization, the main subject of this study, captures how well a model can classify adversarially-perturbed inputs that are not used for training, which is essentially the testing-time adversarial robustness Robε(Mθ; ˆμSte ). In this work, we focus on the lp-norm distances as the perturbation metric ∆, since they are most widely-used in existing literature on adversarial examples. Although lp distances may not best reflect the human-perceptual similarity [35] and perturbation metrics beyond lp-norm such as geometrically transformed adversarial examples [21, 46] were also considered in literature, there is still a significant amount of interest in understanding and improving model robustness against lp perturbations. We hope that our insights gained from lp perturbations will shed light on how to learn better robust models for more realistic adversaries. Adversarial Training. Among all the existing defenses against adversarial examples, adversarial training [4, 26, 51] is most promising in producing robust models. Given a set of training examples Str sampled from μ, adversarial training aims to solve the following min-max optimization problem: min θ∈Θ Lrob(Mθ; Str), where Lrob(Mθ; Str) = 1 |Str| (cid:88) (x,y)∈Str max x′∈Bε(x) L(cid:0)Mθ, x′, y(cid:1). (3) Here, Θ denotes the set of model parameters, and L is typically set as a convex surrogate loss such that L(cid:0)Mθ, x, y(cid:1) is an upper bound on the 0-1 loss 1(cid:0)Mθ(x) ̸= y(cid:1) for any (x, y). For instance, L is set as the cross-entropy loss in vanilla adversarial training [26], whereas the combination of a cross-entropy loss for clean data and a regularization term for robustness is used in TRADES [51]. In theory, if Str well captures the underlying distribution μ and the robust loss Lrob(Mθ; Str) is sufficiently small, then Mθ is guaranteed to achieve high adversarial robustness Robε(Mθ; μ). However, directly solving the min-max optimization problem 3 for non-convex models such as neural networks is challenging. It is typical to resort to some good heuristic algorithm to approximately solve the problem, especially for the inner maximization problem. In particular, [26] proposed 3 (a) Last Model (Train) (b) Last Model (Test) (c) Best Model (Train) (d) Best Model (Test) Figure 1: Heatmaps of predicted class distribution of training-time and testing-time generated adversarial examples with respect to models produced from the last epoch and the best epoch of adversarial training, where darker colors indicate larger probabilities. to alternatively solve the inner maximization using an iterative projected gradient descent method (PGD-Attack) and solve the outer minimization using SGD, which is regarded as the go-to approach in the research community. We further explain its underlying mechanism below. For any intermediate model Mθ produced during adversarial training, the PGD-Attack updates the (perturbed) inputs according to the following update rule: xs+1 = ΠBε(x) (cid:0)xs + α * sgn(∇xsL(Mθ, xs, y)(cid:1) for any (x, y) and s ∈ {0, 1, . . . , S − 1}, (4) where x0 = x, α > 0 denotes the step size and S denotes the total number of iterations. For the ease of presentation, we use Apgd to denote the PGD-Attack such that for any example (x, y) and classifier Mθ, it generates x′ = xS = Apgd(x; y, Mθ, ε) based on the update rule 4. After generating the perturbed input for each example in a training batch, the model parameter θ is then updated by a single SGD step with respect to L(Mθ, x′, y) for the outer minimization problem in Equation 3. 3 Adversarial Training Produces Overconfident Models To gain a deeper understanding of the phenomenon, we plot the heatmaps of the predicted label distribution for the adversarially-perturbed CIFAR-10 images in Figure 1, respectively generated by the model with the best robust generalization during adversarial training, denoted as Best Model, 4 AirplaneAutoBirdCatDeerDogFrogHorseShipTruckPredictedLabelAirplaneAutoBirdCatDeerDogFrogHorseShipTruckGround-TruthLabel0.940.000.000.000.000.000.000.000.040.000.000.990.000.000.000.000.000.000.000.000.000.000.810.010.110.010.050.000.000.000.000.000.010.820.050.070.040.010.000.000.000.000.030.020.810.020.080.040.000.000.000.000.010.050.030.900.010.010.000.000.000.000.020.030.090.010.840.000.000.000.000.000.000.000.030.000.000.960.000.000.000.000.000.000.000.000.000.000.990.000.000.010.000.000.000.000.000.000.010.97AirplaneAutoBirdCatDeerDogFrogHorseShipTruckPredictedLabelAirplaneAutoBirdCatDeerDogFrogHorseShipTruckGround-TruthLabel0.500.030.080.040.040.020.010.020.210.060.020.670.010.030.010.010.010.000.050.190.080.010.280.150.180.100.120.040.030.020.030.010.080.170.130.330.130.060.030.030.030.000.120.140.260.110.150.140.040.010.010.000.050.330.090.340.070.080.010.010.020.010.070.200.170.100.390.010.010.010.020.010.040.070.170.110.020.500.020.040.120.060.030.040.030.010.020.010.610.060.030.170.010.050.010.020.010.030.090.57AirplaneAutoBirdCatDeerDogFrogHorseShipTruckPredictedLabelAirplaneAutoBirdCatDeerDogFrogHorseShipTruckGround-TruthLabel0.790.010.010.000.010.000.010.010.130.020.000.910.000.000.000.000.000.000.020.060.050.010.520.050.130.030.140.030.020.010.020.020.050.430.070.130.150.050.030.040.030.010.060.060.490.040.170.090.030.020.010.010.040.160.060.530.090.060.020.020.010.020.040.050.100.030.700.020.020.020.010.010.010.030.060.020.020.820.000.020.040.030.000.000.000.000.000.000.880.030.010.120.000.010.000.000.010.000.030.81AirplaneAutoBirdCatDeerDogFrogHorseShipTruckPredictedLabelAirplaneAutoBirdCatDeerDogFrogHorseShipTruckGround-TruthLabel0.580.040.060.020.020.010.020.020.190.060.020.770.010.010.000.000.010.000.050.140.090.030.310.110.130.060.160.060.030.030.060.040.070.220.080.170.170.070.040.060.050.010.080.080.290.070.210.120.040.030.030.020.060.200.060.370.110.100.030.030.030.030.050.100.110.050.550.030.020.030.030.010.030.060.070.050.040.620.020.050.110.070.020.030.010.010.010.010.680.060.040.190.010.030.000.010.010.020.070.62 (a) Label-Level Variance (b) Adversarial Certainty Figure 2: Histograms of (a) label-level variances and (b) adversarial certainty of training-time adversarial examples generated by Last Model and Best Model across different CIFAR-10 classes. and the final model produced in the last epoch, denoted as Last Model. Here, the ground-truth label represents the underlying class of clean images and the predicted label is the class of adversarially- perturbed images generated by PGD-Attack predicted by the corresponding model. Figure 1 shows disparate characteristics between the label distributions of training- and testing-time adversarial examples with respect to the best and last models produced from adversarial training. Specifically, the testing-time predicted label distributions look much less certain than the training-time ones. Besides, in the training time, the distribution with respect to the Last Model mainly concentrates on the ground-truth class, whereas the Best Model with better robust generalization produces a more even distribution which is more similar to that of the corresponding testing samples. More experimental details about Figure 1 are provided in Appendix A. Moreover, we measure the variance of the class probabilities of the predicted labels, denoted as label-level variance, with respect to the training-time adversarial examples for each ground-truth category in Figure 2(a). In particular, we observe that the Best Model with better robust generalization performance exhibits a lower label-level variance than that of the Last Model, which is consistent with the results illustrated in Figure 1. Even though the label-level variance best characterizes the predicted label distribution and reflects how certain the training-time generated adversarial examples are, such statistics are on a classwise distribution level, which is not easy to optimize. Therefore, we propose an alternative logit-level definition, termed as adversarial certainty, to capture the certainty of a model in classifying the adversarial examples generated by some attack method (e.g., PGD-Attack), where a lower value indicates lower model certainty in predicting adversarial examples: Definition 3.1 (Adversarial Certainty). Let X be the input space and Y be the label space. Suppose μ is the underlying distribution and S is a set of sampled examples. Let ε ≥ 0, ∆ be the perturbation metric and A be some specific attack method for generating adversarial examples. For any neural network Mθ : X → Y, we define the adversarial certainty of Mθ with respect to S and A as: ACε(Mθ; S, A) = 1 |S| (cid:88) (cid:18) Var (cid:102)Mθ (cid:19) (cid:2)A(x; y, Mθ, ε)(cid:3) . (x,y)∈S (5) Here, (cid:102)Mθ : X → R|Y| is the mapping from the input space to the logit layer of Mθ and Var(u) = (cid:0) (cid:80) for any u ∈ RK, where u denotes the average of all elements in u. k∈[K] (uk − u)2/K(cid:1)1/2 Different from the label-level variance, adversarial certainty is an averaged sample-wise metric, which computes the variance of the logits returned by the model Mθ for each adversarially-perturbed example A(x; y, Mθ, ε). Similar to Figure 2(a), we compute the adversarial certainty of the Best Model and the Last Model for each ground-truth category, which is further visualized in Figure 2(b). Since predicted labels are decided by the corresponding class with the highest predicted probabilities, the adversarial certainty depicts a similar pattern to the label-level variance as expected. Our Perspective. Based on the empirical observations demonstrated in Figures 1 and 2, we further explain why model overconfidence is not beneficial for robust generalization, which is a potential cause for robust overfitting. Adversarial training aims to learn a model that can best classify the adversarial examples generated based on the model itself. Such an objective will encourage the model 5 OverallAirplaneAutoBirdCatDeerDogFrogHorseShipTruck0.000.050.100.150.200.250.300.350.40Label-LavelVarianceBestModelLastModelOverallAirplaneAutoBirdCatDeerDogFrogHorseShipTruck0.00.81.62.43.24.04.8AdversarialCertaintyBestModelLastModel to keep improving its confidence in predicting the ground-truth with respect to the adversarially- perturbed training examples, which eventually leads to producing an overconfident model. However, this overconfidence property is detrimental to robust generalization, because the model cannot generate perturbed training inputs with low enough certainty, which is different from the typical generated adversarial examples during testing time. Consequently, the model will not be able to well predict the less certain test-time adversarial examples, thus resulting in a larger robust generalization gap between training and testing time. We hypothesize that such a large gap limits adversarially robust generalization. To the best of our knowledge, this perspective is new to the field of adversarial machine learning and is intuitively aligned with the classical machine learning theory that if the testing distribution deviates more from the training distribution (in our case, the prediction certainty of adversarial examples between training and testing), standard machine learners are expected to exhibit a decreased generalization performance (in our case, the robust generalization performance). 4 Decreasing Adversarial Certainty with Extragradient Steps Motivated by the findings in Section 3, we propose a novel Extragradient-type method to explicitly Decrease Adversarial Certainty (EDAC), which searches for models with lower adversarial certainty by involving an extragradient step [27, 50] in each training iteration to improve robust generalization.1 More specifically, EDAC aims to solve the following optimization problem to encourage models to generate less certain adversarial examples: min θ∈Θ 1 |Str| (cid:88) (x,y)∈Str max x′∈Bε(x) L(cid:0)Mθ′, x′, y(cid:1), where θ′ = argmin θ′∈C(θ) ACε(Mθ′; Str, A), (6) where Str is the clean training dataset, A denotes a specific attack method (e.g., the PGD-Attack Apgd), and C(θ) represents the feasible search region for θ′. Here, θ′ can be understood as a function of θ which we aim to optimize in Equation 6. We remark that imposing the constraint of C(θ) is necessary since adversarial certainty should be optimized towards that of testing examples to increase the training-testing similarity of predicted label distributions, whereas unconstrained optimization will cause θ′ deviating too much from the initial θ, inducing a negative impact on robust generalization (see Figure 3(a) for more results and discussions regarding the design choice of the constraint set). Directly solving the min-max-min problem specified in Equation 6 is challenging due to the non- convex nature of the optimization and the implicit definition of C(θ), thus we resort to gradient-based methods for an approximate solver. To be more specific, we take the (t + 1)-th iteration of adversarial training as an example to illustrate our design of EDAC. Given a set of clean training examples Str, a specific attack method A, and a classification model Mθ, our EDAC method can be formulated as a two-step optimization for the (t + 1)-th iteration: (cid:12) (cid:12) θt+0.5 = θt − η * ∇θACε(Mθ; Str, A) (cid:12)θ=θt (cid:12) (cid:12) θt+1 = θt+0.5 − γ * ∇θLrob(Mθ; Str, A) (cid:12)θ=θt+0.5 , , (7) where η > 0 and γ > 0 represent the step sizes of the two optimization steps, ACε(Mθ; Str, A) de- notes the adversarial certainty of Mθ with respect to Str and A in Definition 3.1, and Lrob(Mθ; Str, A) can be roughly understood as a robust loss except the inner maximization is approximated using some attack method A. The first step in Equation 7 optimizes the adversarial certainty, where it changes the model parameters θt in a direction that decreases the model's adversarial certainty the most, whereas the second step in Equation 7 optimizes the model's ability in distinguishing adversarial examples generated by the model itself as used in standard adversarial training. As a result, the adversarial certainty of Mθt+0.5 will be decreased after the first optimization step, i.e., ACε(Mθt+0.5 ; Str, A) < ACε(Mθt; Str, A). According to the insights presented in Section 3, the model is expected to gain a better robust generalization ability after conducting the second opti- mization step on less certain adversarial examples generated based on Mθt+0.5. Thus, as adversarial 1Our work is mainly supported by intuitive explanation and empirical evidence. Regarding rigorous theoreti- cal analysis, we think it would be a non-trivial task as both the training and testing distributions of adversarial examples are dynamically changed during adversarial training, which is a clear difference from the standard supervised machine learning regime. We view it as an interesting future work and plan to investigate it under simplified settings as the next step, e.g., optimization with a single iteration on a robust-overfitting model. 6 (a) Correlation Analysis (b) Adversarial Certainty Figure 3: (a) Correlation analysis between adversarial certainty and robust accuracy, where x-axis is the step size used in extra gradient, blue bars are training-time adversarial certainty, and the orange curve denotes robust test accuracy. (b) Training curves of adversarial certainty for different methods. training proceeds, such decreased adversarial certainty and improved robust generalization ability will be iteratively learned to the final model, which mitigates the undesirable robust overfitting and improves model robustness. In each iteration, the extragradient step optimizes adversarial certainty to help find less certain adversarial examples corresponding to the current model status. This is why EDAC could work even if decreasing cross-entropy loss in the previous iteration and decreasing adversarial certainty in the current iteration are in different directions, i.e., Mθt+1 will enjoy the newly optimized adversarial certainty, compared with Mθt. Correlation Analysis. Since our work aims to improve robust generalization by decreasing adversar- ial certainty, it is natural to ask the following question: Does lower adversarial certainty imply better robust generalization? Recall that in Equation 6, C(θ) defines the feasible region for optimizing adversarial certainty. Therefore, the answer should intuitively be positive within this region, i.e., decreasing adversarial certainty will increase test robust accuracy. To better answer this question with empirical evidence, we conduct a correlation analysis between adversarial certainty and robust generalization. The results are illustrated in Figure 3(a). Specifically, we use an AT-trained model as the starting point, from which the heatmaps (Figure 1) are derived. Then, we separately update one more epoch on the model by EDAC using different step sizes (from 0.1 to 2.0) in extragradient steps to decrease adversarial certainty. Afterward, we measure the training-time adversarial certainty (i.e., the blue bars) and robust test accuracy (i.e., the orange curve) of the result models. As expected, adversarial certainty keeps decreasing with the increase in step size. Meanwhile, the model robustness first keeps improving, but it decreases when the step size is larger than 1.3. These results indicate that when the step size is appropriately selected, the optimized model parameters are still within the feasible search region, wherein lower training-time adversarial certainty corresponds to higher robustness. However, when the model is out of the feasible search region, decreasing adversarial certainty will not help improve robust generalization anymore. Why Extragradient Steps? Our algorithmic design of utilizing extragradient steps is inspired by the existing literature on min-max optimization [11, 13, 18, 30]. In particular, these related works illustrate that standard first-order methods, such as stochastic gradient descent/ascent (SGDA), can converge to recurrent orbits that do not contain any critical point of the underlying min-max problem, regardless of the basic convex-concave regime or general non-convex/non-concave problems. Extragradient-type methods have been studied as a first-order alternative to SGDA that can avoid such failure modes and have proven to be a principled way to find local solutions (e.g., a stationary point) to the underlying min-max problems under various settings. This sheds light on the potential of using extragradient steps to solve min-max problems more effectively. Nevertheless, our proposed method that optimizes for adversarial robustness is slightly different from the standard extragradient method typically studied in the optimization literature, because the extra gradient is computed with respect to adversarial certainty instead of cross-entropy loss. Still, it shares a similar insight of escaping the failure mode of the standard first-order min-max solver with the help of extragradient steps. As will be demonstrated in Section 5, the introduced extragradient step for optimizing adversarial certainty 7 0.10.20.30.40.50.60.70.80.91.01.11.21.31.41.51.61.71.81.92.0StepSize0.30.60.91.21.51.82.12.42.73.0AdversarialCertainty0.40.410.420.430.440.450.46RobustAccuracy20406080100120140160180200Epoch0.61.21.82.43.03.64.2AdversarialCertaintyAT+EDAC+EDACReg Table 1: Testing-time adversarial robustness (%) with/without EDAC on CIFAR-10 under l∞ threat model across different model architectures and adversarial training methods. Architecture Method Clean PGD-20 PGD-100 CW∞ AutoAttack AT + EDAC 82.88 (82.68) 84.64 (83.55) 41.51 (49.23) 45.55 (52.20) 40.96 (48.92) 44.94 (51.87) 41.61 (48.07) 44.55 (50.05) 39.66 (45.71) 42.78 (48.20) PRN18 TRADES + EDAC 82.10 (81.33) 83.18 (82.80) 47.44 (51.65) 49.32 (52.90) 46.95 (51.42) 48.81 (52.67) 46.64 (49.18) 48.30 (50.11) 44.99 (48.06) 46.40 (48.96) MART + EDAC AT + EDAC 80.85 (78.27) 81.12 (79.37) 50.23 (52.28) 52.38 (53.25) 49.71 (52.13) 52.04 (53.14) 46.88 (47.83) 48.97 (49.25) 44.68 (46.01) 47.24 (47.69) 86.47 (85.86) 86.48 (85.10) 47.25 (55.31) 52.02 (57.93) 46.73 (55.00) 51.69 (57.68) 47.85 (54.04) 51.51 (54.98) 45.84 (51.94) 49.75 (53.33) WRN34 TRADES + EDAC 86.01 (84.74) 86.75 (85.18) 49.66 (53.72) 53.70 (55.86) 48.44 (53.60) 53.09 (55.59) 48.56 (52.35) 52.73 (53.72) 46.53 (51.31) 50.50 (52.42) MART + EDAC 83.11 (81.31) 84.69 (83.23) 48.93 (53.87) 52.00 (55.57) 48.31 (53.68) 51.32 (55.22) 46.32 (49.65) 49.50 (51.43) 44.89 (48.00) 47.65 (49.92) is essential to obtain a stable and improved robustness performance across various benchmarks and different settings compared with other regularization-based optimization schemes. Application Scope. Our method can be summarized as a two-step iterative optimization framework: θt−→θt+0.5−→θt+1. We remark that this framework provides a generic way to explicitly optimize a specified property (e.g., adversarial certainty) in the first step, and then to take advantage of the newly generated training samples with a better property to find a more robust model in the second step. Intuitively, this framework is generally applicable to any adversarial defense that requires training- time adversarial examples generated based on the to-be-updated model, because the optimization of adversarial robustness relies on the generated adversarial examples, i.e., training samples with updated properties would benefit model robustness. In Section 5, we will examine the compatibility of our EDAC method with several PGD-based methods, including adversarial training and its variants. 5 Experiments In this section, we evaluate the effectiveness of our EDAC method in improving robust generalization with respect to different model architecture PreActResNet-18 (PRN18) and WideResNet-34 (WRN34) under the threat model of l∞ trained by several benchmark adversarial defenses, i.e., AT [26], TRADES [51] and MART [42] on CIFAR-10 in Section 5.1. Besides, to examine the generalizability to other settings, we provide results of EDAC on more benchmark datasets, including CIFAR-10, CIFAR-100 and SVHN, and l2 norm-bounded perturbations. Then, in Section 5.2, we evaluate the compatibility of EDAC with AWP [45] and Consistency [39]. Experimental Settings. For the l∞ threat model, we set ε = 8/255, and train the model for 200 epochs using SGD with the momentum of 0.9. Besides, the initial learning rate is 0.1, and is divided by 10 at the 100th epoch and at the 150th epoch. And the adversarial attack used in training is PGD-10 with a step size of 1/255 for SVHN, and 2/255 for CIFAR-10 and CIFAR-100, while we utilize the commonly-used attack benchmarks of PGD-20 [26], PGD-100 [26], CW∞ [3] and AutoAttack [10] in testing. Meanwhile, for the l2 threat model, we set ε = 128/255 with a step size of 15/255 for all datasets. In addition, we also measure the Clean performance to investigate the influence on clean images. Regarding other hyperparameters, we follow the settings described in their original papers. In all cases, we evaluate the performance of the last (best) model in terms of testing-time robust accuracy. 5.1 Main Results Results on CIFAR-10. We evaluate the robust generalization of our proposed EDAC on CIFAR-10, a commonly-used image benchmark. The results are depicted in Table 1. We can see that, EDAC 8 (a) Robust Overfitting (b) Adversarial Certainty Gap (c) AT (d) TRADES (e) MART Figure 4: The visualized results evaluating robust overtfitting and adversarial certainty, where "-P" and "-W" in the x-axis of Figure 4(a) represent PRN18 and WRN34 respectively. significantly enhances testing-time adversarial robustness across different adversarial attacks. These results show the effectiveness of EDAC, indicating the significance of less certain adversarial examples for robust generalization. Besides, we investigate the influence of EDAC on robust overfitting which is an attention-worthy phenomenon. Specifically, Figure 4(a) evaluates the gap of testing-time adversarial robustness between the best and the last models. We can observe that EDAC consistently mitigates robust overfitting across different settings. These results indicate that decreasing adversarial certainty could mitigate the degradation of robust generalization induced by robust overfitting. Moreover, we find that WRN34 suffers from more severe robust overfitting in adversarial training, however, could benefit more mitigation by using our EDAC method. This suggests that WRN34 is superior to PRN18 in terms of robust generalization with the help of EDAC. Besides adversarial robustness, the clean accuracy for testing images is also worth attention since they measure the standard generalization ability of the model. As expected, EDAC consistently improves the clean test accuracy in all cases as shown in the Clean column of Table 1. This promotion shows that EDAC also could help models gain better robustness against unseen clean images even by learning from adversarial examples, which also benefits from the improvement of generalization. EDAC Improves Adversarial Certainty. Since EDAC has empirically shown effective to improve robust generalization, in this part, we want to demonstrate this is because EDAC could decrease adversarial certainty. To this end, we train a sequence of models by AT and TRADES for 200 epochs, and by MART for 120 epochs, respectively. And for every 20 epochs in this sequence, we update the same intermediate model by one further epoch using the original adversarial defenses with and without the help of EDAC, respectively. Then, we measure the adversarial certainty of all further- updated models following Equation 5. In Figure 4(c), we compare AT with AT-EDAC and observe that – consistent with our findings in Section 3 and design purpose explained in Section 4 – EDAC could indeed help models generate less certain adversarial examples, which would bring better robust generalization. The cases of TRADES and MART are measured in Figures 4(d) and 4(e) respectively, which show similar trends. Moreover, we measure the adversarial certainty gap between the best model and the last model on AT and AT-EDAC in Figure 4(b). We find that the adversarial certainty gap of AT-EDAC is significantly smaller, which is aligned with the closer adversarial robustness of the best model and the last model. This result explains why EDAC could mitigate robust overfitting by decreasing adversarial certainty in extragradient steps. Alternative Regularization Method. As we only conceptually illustrate involving extragradient steps for EDAC in Section 4, this section will empirically demonstrate the necessity of this decision 9 AT-PTRADES-PMART-PAT-WTRADES-WMART-W012345678RobustAccuracyGapWithEDACWithoutEDACOverallAirplaneAutoBirdCatDeerDogFrogHorseShipTruck0.00.20.40.60.81.01.21.4AdversarialCertaintyGapAT-EDACAT20406080100120140160180200Epoch0.81.21.62.02.42.83.23.6AdversarialCertaintyATAT-EDAC20406080100120140160180200Epoch1.01.31.61.92.22.5AdversarialCertaintyTRADESTRADES-EDAC102030405060708090100110120Epoch0.40.60.81.01.21.41.6AdversarialCertaintyMARTMART-EDAC Table 2: Testing-time adversarial robustness (%) of AT with/without EDAC/EDAC_Reg under l∞ threat model across different model architectures and benchmark datasets. Dataset Architecture Method Clean PGD-20 PGD-100 CW∞ AutoAttack SVHN CIFAR-10 CIFAR-100 PRN18 WRN34 PRN18 WRN34 PRN18 WRN34 AT + EDAC + EDAC_Reg AT + EDAC + EDAC_Reg AT + EDAC + EDAC_Reg AT + EDAC + EDAC_Reg AT + EDAC + EDAC_Reg AT + EDAC + EDAC_Reg 89.63 (88.64) 90.58 (89.63) 90.65 (90.21) 91.51 (89.72) 91.26 (91.83) 91.76 (92.13) 82.88 (82.68) 84.64 (83.55) 83.78 (83.54) 86.47 (85.86) 86.48 (85.10) 85.69 (76.89) 54.58 (53.64) 54.85 (55.01) 54.67 (53.11) 57.23 (54.45) 58.15 (58.04) 57.57 (58.34) 42.25 (51.00) 45.86 (54.42) 45.39 (53.06) 46.81 (53.43) 60.42 (67.95) 62.19 (65.96) 41.51 (49.23) 45.55 (52.20) 45.39 (50.86) 47.25 (55.31) 52.02 (57.93) 48.81 (48.91) 20.29 (27.80) 22.46 (27.73) 21.78 (28.86) 25.64 (30.30) 26.08 (31.55) 24.46 (30.97) 41.37 (50.30) 43.92 (53.78) 43.77 (52.28) 44.94 (52.77) 56.71 (64.85) 59.54 (63.68) 40.96 (48.92) 44.94 (51.87) 44.87 (50.49) 46.73 (55.00) 51.69 (57.68) 47.54 (48.86) 20.00 (27.66) 22.19 (27.48) 21.50 (28.70) 25.38 (29.97) 25.89 (31.43) 24.13 (30.89) 42.84 (48.19) 43.75 (50.15) 43.66 (49.64) 45.76 (50.43) 56.98 (65.09) 60.05 (63.87) 41.61 (48.07) 44.55 (50.05) 44.18 (48.96) 47.85 (54.04) 51.51 (54.98) 47.55 (45.98) 20.18 (25.40) 21.11 (25.37) 20.56 (26.00) 24.09 (27.57) 24.77 (29.19) 24.04 (28.92) 39.52 (46.02) 40.68 (48.23) 41.10 (47.39) 41.71 (49.50) 42.33 (50.42) 42.46 (49.95) 39.66 (45.71) 42.78 (48.20) 42.41 (47.02) 45.84 (51.94) 49.75 (53.33) 44.24 (44.99) 18.52 (23.45) 19.09 (23.95) 19.29 (23.40) 22.76 (25.46) 23.66 (27.08) 22.68 (26.71) Table 3: Testing-time adversarial robustness (%) of AT with/without EDAC on PreActResNet-18 under l2 threat model against PGD-20 across different benchmark datasets. Method SVHN CIFAR-10 CIFAR-100 Best Last Best Last Best Last AT (Madry et al. 2018) + EDAC 66.45 69.11 63.20 67.44 66.02 69.10 65.18 67.37 39.23 40.75 35.68 36.32 by comparing EDAC with decreasing adversarial certainty without extragradient steps. Specifically, we construct a regularization term to decrease the adversarial certainty, and add it to robust loss. Then, similar to adversarial training, in each iteration, we only conduct a single step of optimization according to the regularized robust loss, which is termed as EDAC_Reg. The full results on SVHN, CIFAR-10 and CIFAR-100 datasets with both PRN18 and WRN34 models are shown in Table 2. We can see that EDAC_Reg could improve the robust generalization of AT due to the regularization to decrease adversarial certainty, but EDAC brings better and more stable improvements, which indicates the advantage of involving extragradient steps. In some cases, EDAC_Reg is even harmful to robust generalization, e.g., when a WideResNet-34-10 model is trained on CIFAR-10. These results comply with our discussion in Section 4 that existing literature on min-max optimization shows the potential of using extragradient-type methods to avoid limit cycles with respect to standard gradient descent/ascent approaches. In addition, we measure the adversarial certainty of a sequence of models trained by AT, EDAC and EDAC_Reg, respectively, in Figure 3(b). We could observe that EDAC gains the lowest adversarial certainty (even only with a slight gap over EDAC_Reg), indicating that higher robust generalization corresponds to lower adversarial certainty. Other Benchmark Datasets. We extend the robustness evaluation of EDAC to more benchmark datasets, including SVHN [28], CIFAR-10 [23] and CIFAR-100 [23]. Table 2 shows that EDAC consistently improves robust generalization across different datasets. In particular, EDAC could increase the adversarial robustness on SVHN by 14.52% for the WRN34 best model of AT against PGD-20. These improvements further confirm the effectiveness and generalizability of EDAC. l2 Norm-Bounded Perturbation. In the above evaluation, we focus on the l∞ norm-bounded perturbations. Meanwhile, the l2 norm is also a prevalent perturbation setting in adversarial training. Thus, in Table 3, we evaluate our method under the l2 threat model. Similarly, EDAC depicts consistent improvements in adversarial robustness on best and last epochs and different benchmark datasets, which shows the efficacy of EDAC against adversarial attacks with l2 perturbations. 10 Table 4: Testing-time adversarial robustness (%) of AWP and Consistency with/without EDAC on CIFAR-10 and PRN18 under l∞ threat model. Method AT-AWP + EDAC TRADES-AWP + EDAC MART-AWP + EDAC AT-Consistency + EDAC Clean PGD-20 PGD-100 CW∞ AutoAttack 83.76 (82.37) 84.07 (82.67) 52.99 (54.04) 54.55 (55.17) 52.71 (53.89) 54.30 (55.00) 51.07 (51.22) 51.76 (52.03) 48.75 (49.33) 49.80 (49.96) 81.46 (81.28) 82.69 (82.85) 52.71 (53.69) 54.06 (54.68) 52.54 (53.55) 53.80 (54.49) 50.37 (50.61) 51.44 (51.53) 49.54 (49.92) 50.51 (50.63) 78.13 (77.27) 80.03 (78.65) 53.26 (53.62) 54.79 (55.16) 53.06 (52.58) 54.67 (54.93) 49.05 (48.39) 49.58 (49.14) 46.53 (47.01) 47.47 (47.73) 85.28 (84.66) 85.36 (85.17) 55.43 (56.72) 56.65 (57.19) 55.16 (56.46) 56.31 (56.90) 50.81 (51.13) 51.29 (51.72) 48.08 (48.48) 49.00 (49.46) TRADES-Consistency + EDAC 83.68 (83.51) 84.78 (84.73) 53.00 (53.06) 53.73 (53.96) 52.78 (52.79) 53.48 (53.72) 48.85 (48.89) 49.37 (49.41) 47.75 (47.77) 48.15 (48.19) MART-Consistency + EDAC 78.21 (78.11) 81.91 (81.35) 56.33 (56.85) 58.59 (58.76) 56.31 (56.81) 58.29 (58.56) 47.33 (47.47) 50.08 (50.21) 45.53 (45.73) 48.28 (48.59) 5.2 Extension to Other Adversarial Training Methods Previous sections show the efficacy of EDAC on adversarial training and its variants. We note that some recent works also focus on understanding robust generalization and developing methods to improve adversarial training towards more robust models, including Adversarial Weight Perturba- tion [45] – AWP for short – and Consistency Reguarlaization [39] – Consistency for short. However, since these methods focus on different insights to improve robust generalization, whether our pro- posed EDAC framework is compatible with them remains elusive. In this section, we study the generalizability of our EDAC to AWP and Consistency regularization, which is depicted in Table 4. Adversarial Weight Perturbation. AWP discovered that the flatness of the weight loss landscape is an important factor related to robust generalization, while EDAC seeks less certain training-time adversarial examples. AWP shares some similarities with our work, where both EDAC and AWP find new model status by gradient-based method before optimizing model robustness, i.e., in the (t + 1)-th iteration, model parameters θt+1 is derived from the optimization on θt+0.5, instead of directly from θt. However, there is a main difference between AWP and our work: In our work, θt+0.5 −→ θt+1 is optimized on the adversarial examples generated by θt+0.5, which takes advantage of the optimized adversarial certainty of θt+0.5, while AWP uses the adversarial examples generated by θt to derive θt+1. Consequently, EDAC and AWP aim at different directions to help models. In that case, we attempt to cooperate EDAC with AWP by adding another extragradient step before weight perturbation to optimize the certainty of adversarial examples, and use the updated intermediate model to generate new adversarial examples for the following AWP optimization. As shown in Table 4, EDAC could compatibly work with AWP and gain further improvements in robust generalization. Consistency Regularization. The method of Consistency regularizes the adversarial consistency based on various data augmentations [39]. In that case, we first use extragradient steps to update the adversarial certainty on augmented samples, and then follow the Consistency optimization. From Table 4, we can see that EDAC could cooperatively improve the robust generalization of Consistency, which shows the feasibility of EDAC in the augmentation-based domain. In general, the improvement of EDAC on AWP and Consistency is not as significant as previous ones. We hypothesize this is because AWP and Consistency could implicitly decrease adversarial certainty when helping models toward their specified directions. Thus, when EDAC conducts the explicit optimization of adversarial certainty, it can only achieve slight improvements that are derived from less certain training samples generated in extragradient steps. To this end, we measure the adversarial certainty of AWP and Consistency on the last and the best models of AT in Figure 5. We could see that both methods of AT-AWP and AT-Consistency, which achieve better robust generalization performance than AT, also implicitly decrease the adversarial certainty. This suggests that different insights for helping model robustness would be compatible with each other to some extent, but how to coordinate them for a better unified improvement is worth exploring in the future. 11 (a) Last Model (b) Best Model Figure 5: The visualized results on CIFAR-10 with respect to PRN18 for comparing adversarial certainty of AT, AT-AWP and AT-Consistency based on (a) last model, and (b) best model. 6 Conclusion We revisited the robust overfitting phenomenon of adversarial training and discovered that overfitting to training data might result from the training-time adversarial examples generated by overconfident models. Specifically, we observed that models with better robust generalization performance corre- spond to significantly more even predicted label distributions of training-time adversarial examples. Built upon a new notion of adversarial certainty, we proposed to involve an extragradient step to generate less certain examples by decreasing adversarial certainty, which can be combined with various attack methods for generating adversarial examples. Extensive experiments substantiated the effectiveness of our method in mitigating robust overfitting and learning more robust models. Availability Our implementation is available as open-source code at https://github.com/TrustMLRG/EDAC. References [1] Jean-Baptiste Alayrac, Jonathan Uesato, Po-Sen Huang, Alhussein Fawzi, Robert Stanforth, and Pushmeet Kohli. Are labels required for improving adversarial robustness? In Annual Conference on Neural Information Processing Systems (NeurIPS), pages 12192–12202. NeurIPS, 2019. [2] Maksym Andriushchenko and Nicolas Flammarion. Understanding and improving fast adver- sarial training. In Annual Conference on Neural Information Processing Systems (NeurIPS). NeurIPS, 2020. [3] Nicholas Carlini and David Wagner. Towards Evaluating the Robustness of Neural Networks. In IEEE Symposium on Security and Privacy (S&P), pages 39–57. IEEE, 2017. [4] Yair Carmon, Aditi Raghunathan, Ludwig Schmidt, John C. Duchi, and Percy Liang. Unlabeled data improves adversarial robustness. In Annual Conference on Neural Information Processing Systems (NeurIPS), pages 11190–11201. NeurIPS, 2019. [5] Chenyi Chen, Ari Seff, Alain Kornhauser, and Jianxiong Xiao. Deepdriving: Learning af- fordance for direct perception in autonomous driving. In IEEE International Conference on Computer Vision (ICCV), pages 2722–2730. IEEE, 2015. [6] Tianlong Chen, Zhenyu Zhang, Sijia Liu, Shiyu Chang, and Zhangyang Wang. Robust overfitting may be mitigated by properly learned smoothening. In International Conference on Learning Representations, 2021. [7] Jeremy M. Cohen, Elan Rosenfeld, and J. Zico Kolter. Certified Adversarial Robustness via Randomized Smoothing. In International Conference on Machine Learning (ICML), pages 1310–1320. PMLR, 2019. 12 OverallAirplaneAutoBirdCatDeerDogFrogHorseShipTruck2.02.53.03.54.04.5AdversarialCertaintyATAT-AWPAT-ConsistencyOverallAirplaneAutoBirdCatDeerDogFrogHorseShipTruck1.82.02.22.42.62.83.03.23.4AdversarialCertaintyATAT-AWPAT-Consistency [8] Paul Covington, Jay Adams, and Emre Sargin. Deep neural networks for youtube recom- mendations. In ACM Conference on Recommender Systems (RecSys), pages 191–198. ACM, 2016. [9] Francesco Croce, Maksym Andriushchenko, Vikash Sehwag, Edoardo Debenedetti, Nicolas Flammarion, Mung Chiang, Prateek Mittal, and Matthias Hein. Robustbench: a standardized adversarial robustness benchmark. arXiv preprint arXiv:2010.09670, 2020. [10] Francesco Croce and Matthias Hein. Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks. In International Conference on Machine Learning (ICML), pages 2206–2216. PMLR, 2020. [11] Constantinos Daskalakis and Ioannis Panageas. The limit points of (optimistic) gradient descent in min-max optimization. In Annual Conference on Neural Information Processing Systems (NeurIPS), pages 9256–9266. NeurIPS, 2018. [12] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In Conference of the North Amer- ican Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT), pages 4171–4186. ACL, 2019. [13] Jelena Diakonikolas, Constantinos Daskalakis, and Michael I. Jordan. Efficient methods for In International Conference on structured nonconvex-nonconcave min-max optimization. Artificial Intelligence and Statistics AISTATS, pages 2746–2754. PMLR, 2021. [14] Samuel G Finlayson, John D Bowers, Joichi Ito, Jonathan L Zittrain, Andrew L Beam, and Isaac S Kohane. Adversarial attacks on medical machine learning. Science, pages 1287–1289, 2019. [15] Ruiqi Gao, Tianle Cai, Haochuan Li, Cho-Jui Hsieh, Liwei Wang, and Jason D Lee. Convergence of adversarial training in overparametrized neural networks. Advances in Neural Information Processing Systems, 32, 2019. [16] Ian Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and Harnessing Adversar- ial Examples. In International Conference on Learning Representations (ICLR), 2015. [17] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 770–778. IEEE, 2016. [18] Ya-Ping Hsieh, Panayotis Mertikopoulos, and Volkan Cevher. The limits of min-max optimiza- tion algorithms: Convergence to spurious non-critical sets. In International Conference on Machine Learning ICML, pages 4337–4348. PMLR, 2021. [19] Joong-won Hwang, Youngwan Lee, Sungchan Oh, and Yuseok Bae. Adversarial training with stochastic weight average. In IEEE International Conference on Image Processing (ICIP), pages 814–818. IEEE, 2021. [20] Gaojie Jin, Xinping Yi, Wei Huang, Sven Schewe, and Xiaowei Huang. Enhancing adversarial training with second-order statistics of weights. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 15252–15262. IEEE, 2022. [21] Can Kanbak, Seyed-Mohsen Moosavi-Dezfooli, and Pascal Frossard. Geometric robustness of deep networks: analysis and improvement. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4441–4449, 2018. [22] Stepan Komkov and Aleksandr Petiushko. Advhat: Real-world adversarial attack on arcface face id system. In IEEE International Conference on Pattern Recognition (ICPR), pages 819–826. IEEE, 2021. [23] Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009. [24] Xingjun Ma, Bo Li, Yisen Wang, Sarah M. Erfani, Sudanthi N. R. Wijewickrema, Grant Schoenebeck, Dawn Song, Michael E. Houle, and James Bailey. Characterizing adversar- ial subspaces using local intrinsic dimensionality. In International Conference on Learning Representations (ICLR), 2018. [25] Xingjun Ma, Yuhao Niu, Lin Gu, Yisen Wang, Yitian Zhao, James Bailey, and Feng Lu. Understanding adversarial attacks on deep learning based medical image analysis systems. Pattern Recognition, 110:107332, 2021. 13 [26] Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards Deep Learning Models Resistant to Adversarial Attacks. In International Conference on Learning Representations (ICLR), 2018. [27] Panayotis Mertikopoulos, Bruno Lecouat, Houssam Zenati, Chuan-Sheng Foo, Vijay Chan- drasekhar, and Georgios Piliouras. Optimistic mirror descent in saddle-point problems: Going the extra (gradient) mile. In International Conference on Learning Representations (ICLR), 2019. [28] Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. 2011. [29] Nicolas Papernot, Patrick D. McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a Defense to Adversarial Perturbations Against Deep Neural Networks. In IEEE Symposium on Security and Privacy (S&P), pages 582–597. IEEE, 2016. [30] Thomas Pethick, Puya Latafat, Panos Patrinos, Olivier Fercoq, and Volkan Cevher. Escaping limit cycles: Global convergence for constrained nonconvex-nonconcave minimax problems. In International Conference on Learning Representations ICLR, 2022. [31] Sylvestre-Alvise Rebuffi, Sven Gowal, Dan A Calian, Florian Stimberg, Olivia Wiles, and Timothy Mann. Fixing data augmentation to improve adversarial robustness. arXiv preprint arXiv:2103.01946, 2021. [32] Leslie Rice, Eric Wong, and J. Zico Kolter. Overfitting in adversarially robust deep learning. In International Conference on Machine Learning (ICML), pages 8093–8104. PMLR, 2020. [33] Amrith Setlur, Benjamin Eysenbach, Virginia Smith, and Sergey Levine. Adversarial unlearning: Reducing confidence along adversarial directions. In Annual Conference on Neural Information Processing Systems (NeurIPS). NeurIPS, 2022. [34] Ali Shafahi, Mahyar Najibi, Amin Ghiasi, Zheng Xu, John P. Dickerson, Christoph Studer, Larry S. Davis, Gavin Taylor, and Tom Goldstein. Adversarial training for free! In Annual Conference on Neural Information Processing Systems (NeurIPS), pages 3353–3364. NeurIPS, 2019. [35] Mahmood Sharif, Lujo Bauer, and Michael K Reiter. On the suitability of lp-norms for creating and preventing adversarial examples. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pages 1605–1613, 2018. [36] David Stutz, Matthias Hein, and Bernt Schiele. Confidence-calibrated adversarial training: Generalizing to unseen attacks. In International Conference on Machine Learning (ICML), volume 119, pages 9155–9166. PMLR, 2020. [37] David Stutz, Matthias Hein, and Bernt Schiele. Relating adversarially robust generalization to flat minima. In IEEE International Conference on Computer Vision (ICCV), pages 7787–7797. IEEE, 2021. [38] Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Good- fellow, and Rob Fergus. Intriguing Properties of Neural Networks. In International Conference on Learning Representations (ICLR), 2014. [39] Jihoon Tack, Sihyun Yu, Jongheon Jeong, Minseon Kim, Sung Ju Hwang, and Jinwoo Shin. Con- sistency regularization for adversarial robustness. In AAAI Conference on Artificial Intelligence (AAAI), pages 8414–8422. AAAI, 2022. [40] Florian Tramèr, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick McDaniel. Ensemble Adversarial Training: Attacks and Defenses. In International Conference on Learning Representations (ICLR), 2017. [41] Zhuozhuo Tu, Jingwei Zhang, and Dacheng Tao. Theoretical analysis of adversarial learning: A minimax approach. Advances in Neural Information Processing Systems, 32, 2019. [42] Yisen Wang, Difan Zou, Jinfeng Yi, James Bailey, Xingjun Ma, and Quanquan Gu. Improv- In International ing Adversarial Robustness Requires Revisiting Misclassified Examples. Conference on Learning Representations (ICLR), 2020. [43] Zekai Wang, Tianyu Pang, Chao Du, Min Lin, Weiwei Liu, and Shuicheng Yan. Better diffusion models further improve adversarial training. arXiv preprint arXiv:2302.04638, 2023. 14 [44] Eric Wong, Leslie Rice, and J. Zico Kolter. Fast is better than free: Revisiting adversarial training. In International Conference on Learning Representations (ICLR), 2020. [45] Dongxian Wu, Shu-Tao Xia, and Yisen Wang. Adversarial weight perturbation helps robust generalization. In Annual Conference on Neural Information Processing Systems (NeurIPS). NeurIPS, 2020. [46] Chaowei Xiao, Jun-Yan Zhu, Bo Li, Warren He, Mingyan Liu, and Dawn Song. Spatially transformed adversarial examples. arXiv preprint arXiv:1801.02612, 2018. [47] Cihang Xie, Yuxin Wu, Laurens van der Maaten, Alan L. Yuille, and Kaiming He. Feature denoising for improving adversarial robustness. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 501–509. IEEE, 2019. [48] Yuancheng Xu, Yanchao Sun, Micah Goldblum, Tom Goldstein, and Furong Huang. Exploring and exploiting decision boundary dynamics for adversarial robustness. CoRR abs/2302.03015, 2023. [49] Chaojian Yu, Bo Han, Li Shen, Jun Yu, Chen Gong, Mingming Gong, and Tongliang Liu. Understanding robust overfitting of adversarial training and beyond. In International Conference on Machine Learning (ICML), pages 25595–25610. PMLR, 2022. [50] Guojun Zhang and Yaoliang Yu. Convergence of gradient methods on bilinear zero-sum games. In International Conference on Learning Representations (ICLR), 2020. [51] Hongyang Zhang, Yaodong Yu, Jiantao Jiao, Eric P. Xing, Laurent El Ghaoui, and Michael I. Jordan. Theoretically Principled Trade-off between Robustness and Accuracy. In International Conference on Machine Learning (ICML), pages 7472–7482. PMLR, 2019. [52] Yi Zhang, Orestis Plevrakis, Simon S Du, Xingguo Li, Zhao Song, and Sanjeev Arora. Over- parameterized adversarial training: An analysis overcoming the curse of dimensionality. Ad- vances in Neural Information Processing Systems, 33:679–688, 2020. Appendix A Details of Section 3 In this section, we explain the experimental details for producing the heatmaps and the histograms illustrated in Section 3. Given a model Mθ (e.g., Best Model and Last Model) and a set of examples S sampled from the underlying distribution μ (e.g., CIFAR-10 training and testing datasets), adversarial examples are generated by the PGD-Attack within the perturbation ball Bε(x) centered at x with radius ε = 8/255 under the l∞ threat model, which follows the settings of generating training samples in Section 5, e.g., the PGD-Attack is iteratively conducted by 10 steps with the step size of 2/255. We record the predicted labels of the generated adversarial examples with respect to each model, and then plot the classwise label distributions as heatmaps in Figure 1. In general, let HM be the m × m matrix representing the heatmap, where Y = {1, 2, . . . , m} denotes the label space. For any j, k ∈ Y, the (j, k)-th entry of HM with respect to Mθ and S is defined as: (cid:12) (cid:12) (cid:12) (cid:12) HMj,k = (cid:8)(x, y) ∈ S : y = j and Mθ (cid:0)Apgd(x; y, Mθ, ε)(cid:1) = k(cid:9) (cid:12) (cid:12) (cid:8)(x, y) ∈ S : y = j(cid:9) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) , (8) where Apgd is the PGD-Attack defined by the update rule 4. More specifically, for any (x, y) ∈ S, we construct the corresponding adversarial example by the PGD-Attack, i.e., x′ = Apgd(x; y, Mθ, ε)(cid:1). Then, we measure the predicted label ˆy = Mθ(x′). In that case, for the given training data, we could construct (ground-truth, predicted) label pairs, simply denoted by {(y, ˆy)}. Afterward, we first cluster {(y, ˆy)} separately by the ground-truth label, e.g., the subset of ground-truth label j includes all pairs such that y = j (denoted by {(y, ˆy)}j), which corresponds to the rows of heatmaps. Further, for each subset, we group it into sub-subsets separately by the predicted labels, e.g., {(y, ˆy)}j,k contains all pairs in {(y, ˆy)}j such that ˆy = k. Consequently, the number of adversarial examples of 15 the ground truth label j is calculated as: |{(y, ˆy)}j| = (cid:12) (cid:12) (cid:12) (cid:12) (cid:8)(x, y) ∈ S : y = j(cid:9) (cid:12) (cid:12) (cid:12) (cid:12) . Meanwhile, the number of adversarial examples of ground truth label j but predicted as label k is measured as: |{(y, ˆy)}j,k| = (cid:12) (cid:12) (cid:12) (cid:12) (cid:8)(x, y) ∈ S : y = j and Mθ (cid:0)Apgd(x; y, Mθ, ε)(cid:1) = k(cid:9) (cid:12) (cid:12) (cid:12) (cid:12) , where ˆy = Mθ as the ratio of |{(y, ˆy)}j,k| to |{(y, ˆy)}j|, i.e., Equation 8. (cid:0)Apgd(x; y, Mθ, ε)(cid:1). Finally, we compute the (j, k)-th entry of the heatmap HMj,k Moreover, following the same settings, we plot the corresponding label-level variance and adversarial certainty in Figure 2. Specifically, we first measure the label-level variance of the training-time adversarial examples of the last model (Figure 1(a)) and the best model (Figure 1(c)) conditioned on the ground-truth label, as shown in Figure 2(a). Taking the ground-truth label j as an example, the label-level variance can be formulated as: Var(label) j = (cid:115) 1 |Y| (cid:88) k∈Y (HMj,k − HMj)2, where HMj averages all HMj,k with different k, and Y = {1, 2, ..., m} is the label space. In addition, according to Equation 5 defined in Section 3, we measure the adversarial certainty of the last and the best models, as illustrated in Figure 2(b), with respect to the predicted logits of all the adversarial examples conditioned on the ground-truth label. 16
http://arxiv.org/abs/2310.04535v1
"2023-10-06T19:02:04"
"2023-10-06T19:02:04"
LLM4DV: Using Large Language Models for Hardware Test Stimuli Generation
Test stimuli generation has been a crucial but labor-intensive task in hardware design verification. In this paper, we revolutionize this process by harnessing the power of large language models (LLMs) and present a novel benchmarking framework, LLM4DV. This framework introduces a prompt template for interactively eliciting test stimuli from the LLM, along with four innovative prompting improvements to support the pipeline execution and further enhance its performance. We compare LLM4DV to traditional constrained-random testing (CRT), using three self-designed design-under-test (DUT) modules. Experiments demonstrate that LLM4DV excels in efficiently handling straightforward DUT scenarios, leveraging its ability to employ basic mathematical reasoning and pre-trained knowledge. While it exhibits reduced efficiency in complex task settings, it still outperforms CRT in relative terms. The proposed framework and the DUT modules used in our experiments will be open-sourced upon publication.
[ "Zixi Zhang", "Greg Chadwick", "Hugo McNally", "Yiren Zhao", "Robert Mullins" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04535v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04535v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AR" ]
3 2 0 2 t c O 6 ] G L . s c [ 1 v 5 3 5 4 0 . 0 1 3 2 : v i X r a LLM4DV: Using Large Language Models for Hardware Test Stimuli Generation Zixi Zhang University of Cambridge zz458@cam.ac.uk Greg Chadwick lowRISC gac@lowrisc.org Hugo McNally lowRISC hugom@lowrisc.org Yiren Zhao Imperial College London a.zhao@imperial.ac.uk Robert Mullins University of Cambridge robert.mullins@cl.cam.ac.uk Abstract Test stimuli generation has been a crucial but labor-intensive task in hardware design verification. In this paper, we revolutionize this process by harnessing the power of large language models (LLMs) and present a novel benchmarking frame- work, LLM4DV. This framework introduces a prompt template for interactively eliciting test stimuli from the LLM, along with four innovative prompting improve- ments to support the pipeline execution and further enhance its performance. We compare LLM4DV to traditional constrained-random testing (CRT), using three self-designed design-under-test (DUT) modules. Experiments demonstrate that LLM4DV excels in efficiently handling straightforward DUT scenarios, leveraging its ability to employ basic mathematical reasoning and pre-trained knowledge. While it exhibits reduced efficiency in complex task settings, it still outperforms CRT in relative terms. The proposed framework and the DUT modules used in our experiments will be open-sourced upon publication. 1 Introduction Design verification (DV) checks the correctness of hardware designs. The verification process takes in inputs, or test stimuli, passes them into the hardware design-under-test (DUT), and compares the result to expected outputs from a software golden model [1]. The scope of the verification, also known as a coverage plan, is defined and agreed upon in advance, ensuring all functional properties of the design are tested. A coverage plan in DV is defined to specify a list of coverage points to be tested, which are particular outputs and machine states that the verification process need to cover. Each cover point is associated with a coverage bin that counts how many times the cover point has been exercised. The goal of the verification process is to achieve 100% functional coverage rate based on the coverage plan, meaning that all coverage bins would have a non-zero value. Figure 1a illustrates an example coverage plan where different coverage bins can together form their cross coverage bins. Effective test stimuli generation has been a major challenge in meeting 100% coverage [1]. For a simple design, verification can be done with individual directed tests, in which test stimuli (inputs for the DUT) are manually generated. For more complex designs, a large number of stimuli is required for exercising as much of the design's functionality as possible. Traditionally, constrained-random testing (CRT) has been used for generating vast random but valid test stimuli and attempting to "hit" the bins. However, CRT is inefficient to hit bins with complicated conditions. Often, this necessitates extensive human engineering involvement in the test stimuli design process. Preprint. Under review. (a) Example coverage plan (b) LLM4DV framework Figure 1: Design verification flow. Figure 1a is an example coverage plan : two types of basic coverage bins (orange and green) and also their cross coverage bins (cyan) are shown. Figure 1b shows an overview of the LLM4DV framework where the prompted LLM takes output coverage results as inputs and outputs stimulus in an iterative fashion. Recent large language models (LLMs), trained on immense amounts of text and human feedback data, are capable of solving tasks of distinct form that require multi-step reasoning and generating high-quality samples [2, 3, 4]. For example, Codex [5] can produce functionally correct code bodies from natural language docstring descriptions. Open-source model Llama 2 [4], using instruction tuning and Reinforcement Learning with Human Feedback (RLHF) [6, 7] for fine-tuning, emerges impressive generalization and tool usage ability. This brings up an important question: can LLMs effectively minimise the amount of human effort involved in hardware Design Verification (DV)? This study specifically focuses on one arguably most labor-intensive aspect in the DV process - generating test stimuli - and explores the potential of using LLMs to assist with this task. In this work, we establish a benchmarking framework named LLM4DV (Large Language Model for Design Verification). This is a benchmark framework that utilizes LLMs for test stimuli generation. In this paper, we make the following contributions: • We design and construct three DUT modules: a Primitive Data Prefetcher Core, an Ibex Instruction Decoder, and an Ibex CPU. • We propose and develop a framework that uses prompted LLMs to generate test stimuli for hardware designs. Also, we propose four improvements on the prompting strategies to improve the effectiveness of the generated stimuli. • We evaluate the framework with the three DUT modules. We show that our framework with optimal improvement measures achieves 98.94%, 86.19%, and 5.61% coverage rates on these modules respectively in a realistic experimental setup. We will open-source our framework with these three modules to allow both the machine learning and hardware design communities to experiment their ideas. 2 Related Work While the application of LLMs on hardware design verification has been brought to focus only recently, test code generation for software engineering with LLMs has been well-studied and made remarkable performance [8, 9, 10]. Chen et al. [8] utilized LLM to generate potential implementations and test cases for a function by providing the LLM with the signature and a description of the function and select the best solution based on functionality agreement. Schäfer et al. [9] proposed a pipeline to generate unit tests for existing code, which iteratively refine the prompt to generate better tests. These studies show promising results on software code, while we shift focus to using LLM on Hardware Description Language (HDL) and hardware design specification, which involves a different setting and more sophisticated procedure. In hardware design verification, assertion-based verification (ABV) is also widely adopted together with code coverage, functional coverage, and validation using generated test patterns [1]. ABV uses assertions in HDL to detect violation of predefined properties. Kande et al. [11] proposed a pipeline for automatically generating SystemVerilog assertions (SVA) with LLM to ensure hardware security. 2 0014410002630043103268181311151020ADDXORSLTregisterportsreg #1readport Areg #1readport Breg #1writeportreg #2readport Areg #2readport Breg #2writeportoperations TestbenchDevice-Under-TestinternalstateinputCoverageMonitor Stimulus generation agent StimulusExtractorstimuluscurrentcoverageLLMcoverage plandescriptionPromptingTemplateGolden ModeloutputexpectedoutputDUTCorrectnessCheckingprompttext responsePromptingImprovements Figure 2: Coverage-feedback prompt template and four prompting improvements. This framework corresponds to the stimulus generation agent component in Figure 1b. We highlight the different design options possible for the four prompting improvements (Best-iterative-message sampling, Dialogue Restarting Plans, Missed-Bin Sampling and Best-Iterative-Message Buffer Resetting Plan). However, ABV requires test patterns (i.e. input test stimuli) to activate given assertions and therefore reveal vulnerabilities. For simulation-based ABV approaches, traditional test generation using random or constrained-random tests cannot guarantee to activate assertions with complex conditions in a reasonable time. To speed up assertion coverage, Pal et al. [12] proposed bias random test generation, which considers the DUT as a black box and restricts test generation to only input/output signals. Ferro et al. [13] used combinatorial testing, which provides a set of combinations of user-selected values, to select test stimuli most suitable to cover corner cases. Tong et al. [14] proposed a method that searches the compact assertion-based automata for failure and acceptance nodes before test generation. Simulation-based test generation has also been incorporated with formal method-based test generation. Lyu and Mishra [15] utilized concolic testing to activate assertions, which regards assertions as branches, searches through the branch statement tree with heuristics to efficiently obtain a path, and generates test stimuli to cover the obtained branch targets. These methods, however, are subjected to complexity explosion problems [1] and fail to effectively make use of user's knowledge about the design. We overcome this issue by utilizing LLM's pre-trained knowledge to reason about the given coverage plan and guide the test stimuli generation. 3 Method Our experiments use an LLM in the test stimuli generation process, together with a testbench with a DUT to form the whole LLM4DV framework, as shown in Figure 1b. The following subsections describes the basic DV framework, the prompt templates for the LLM, and four prompting improvements. Figure 2 gives a general picture of the prompt templates and prompting improvements. 3.1 Basic framework The testbench has three major components: a stimulus generation agent (the prompted LLM), a design-under-test (DUT), and a coverage monitor. In each timestep, the stimulus generation agent provides a test stimulus and inputs it to the DUT. The coverage monitor inspects the DUT's inputs, outputs, and internal states; determines whether there are hits of bins; and updates the current coverage and returns it to the stimulus generation agent for generating the next stimulus. 3 TrialDialogue 1Best-Iterative-Message Sampling(I) Recent Responses(II) Successful Responses(III) Mixed Recent and SuccessfulResponses(IV) Successful Difficult ResponsesDialogue 2Best-Iterative-Message Buffer Resetting Plans(i) Clearing best-messages(ii) Keeping best-messages(iii) Stable-restart Keeping best-messagesDialogue Restarting Plans(a) Normal Tolerance(b) Low Tolerance(c) High Tolerance(d) Coverage Rate-basedTolerance Initial QueryTask IntroductionCoverage Plan SummaryInitial QuestionIterative Query 1Result SummaryDifferencesIterative QuestionSystem MessageMissed-Bin Sampling(1) Pure Random Sampling(2) Coverpoint Type-basedSamplings(3) Mixed Coverpoint Type-basedand Pure Random SamplingCoverage feedback Our basic framework introduce a prompt generator and an LLM as the stimulus generation agent. In each generation cycle, the prompt generator generates a prompt based on a template (see Section 3.2) and the current coverage feedback from the coverage monitor. The LLM takes in the prompt and generates a natural language response, from which the test stimulus values are extracted by a stimulus extractor, and then pushed into a stimulus buffer. In every timestep when the stimulus generation agent is requested for a test stimulus, it takes out the oldest value in its stimulus buffer; if the buffer is empty, the agent starts a new generation cycle, in which the LLM takes in a new request and a list of new stimuli will added to the buffer. The pipeline, or a trial, stops in two situations. First, if all cover points have been reached. Second, if the stimulus generation agent doesn't hit any bins within 25 responses or hit less than three bins within 40 responses, we suppose the agent is "exhausted" i.e. becoming ineffective or inefficient to cover any new bins, and the pipeline stops. See Algorithm 1 in Appendix. 3.2 Prompting templates We provide a Coverage-Feedback Template to generate prompts for the LLM. When constructing it, we utilize prompt engineering techniques including 1) System message: it is included at the beginning of every prompt, and is used to prime the model with context, instructions, or other information relevant to the use case; 2) Start with clear instructions; 3) Repeat instructions at the end; 4) Add clear syntax: punctuation, headings, and section markers; 5) Specifying the output structure. Coverage-Feedback Template The Coverage-feedback prompt template contains templates for the system message, initial query, and iterative queries. • The system message clarifies the expected response format and specify other requirements. • The initial query is the first user message in a dialogue. It contains three parts: 1. Task introduction: a description of what is included in this prompt and what the LLM will be asked to do. 2. Coverage plan summary: a description of cover points of the coverage plan. 3. Initial question: a one-line instruction. • The iterative queries are the user messages following the first assistant (LLM) response. Each contains three parts: 1. Result summary: a general feedback which: – if the previous assistant response was gibberish (i.e. contains mostly nonsense words) or didn't follow the output format, the result summary repeats the output format requirement; otherwise, – if the previous assistant response failed to hit any new bins, the result summary points that out and ask for a new list of stimuli; – if the previous assistant responses hit some bins, the result summary points that out and ask for a new list of stimuli. 2. Differences: a list of uncovered bins. 3. Iterative question: a one-line instruction, repeating the output format requirement if previous response was gibberish or didn't follow the output format. 3.3 Four prompting improvements In our experiments, we develop two improvements necessary for making the framework executable and two improvements to further improve its performance. We also evaluate different design choices for these improvements. A full ablation study with all these improvements and their design choices are in Appendix F and Appendix B, in this section, we mainly discuss the best attempts. Missed-bin sampling In most generation cycles in a trial, there would be hundreds to thousands bins uncovered. The iterative queries can't include all of them because the prompt's length would exceed the LLM's input token number limit. Meanwhile, exposing too many uncovered bins to the LLM confuses the LLM on which mistakes should it resolve first. 4 We propose missed-bin sampling, which samples a number of bins from all uncovered bins to be included in the differences part of iterative queries. Our experiment finds that more random sampling methods encourage the agent to cover bins with stricter hitting conditions, and more stable sampling methods make the agent more efficient in hitting the easier bins. We define three sampling methods, see green boxes in Figure 2. (1) Pure Random Sampling, which randomly samples seven bins from all uncovered bins. (2) Coverpoint Type-based Sampling, which samples from "easier bins" and "harder bins" respectively. (3) Mixed Coverpoint Type-based and Pure Random Sampling, which switches between previous two strategies whenever the agent becomes inefficient with current strategy. Best-iterative-message sampling The LLM needs previous messages in the dialogue to learn about what has happened. However, as the dialogue grows, the length of input may exceed the LLM's input limit. One solution is summarizing previous message, which helps generalizing concepts in the dialogue but loses details, which is crucial in our task. On the other hand, sampling from previous messages acceptably loses some generality meanwhile preserves key details, including the bin description and positive examples (i.e responses that successfully hit many bins) useful for covering edge cover points. We propose four sampling methods, see blue boxes in Figure 2. (I) Recent Responses, where we keep the initial query (and its response), and three most recent iterative queries (and their responses). (II) Successful Responses, where we keep random three iterative queries that hit most number of bins. (III) Mixed Recent and Successful Responses, where we keep two most successful and one most recent iterative query. (IV) Successful Difficult Responses, which is similar to Successful Responses but each "harder bin" counts as 2.5 bins. Dialogue restarting LLM sometimes behaves stubborn, repeating mistakes it made previously. We introduce a dialogue restarting mechanism to resolve this problem. When the LLM hits less than three new bins within t responses, we clear the dialogue record and restart from the system message and initial query. We define four restarting plans, see purple boxes in Figure 2. (a) Normal Tolerance, where t = 7. (b) Low Tolerance, where t = 4. (c) High Tolerance, where t = 10. (d) Coverage Rate-based Tolerance, where t = 4 in the beginning and t = 7 after reaching certain coverage rate threshold. Best-iterative-message buffer resetting When the dialogue record is reset, the buffer for best iterative messages in Best-iterative-message sampling can also be cleared or kept. These two strategies display a trade-off between "effectively forgetting past mistakes" and "learn about the task faster after restart". We define three resetting plans for the best-iterative-message buffer, see cyan boxes in Figure 2. (i) Clearing best-messages. (ii) Keeping best-messages. (iii) Stable-restart Keeping best-messages: keeping the buffer on restarts, but not using it for the first four responses after restarts. 4 Evaluation We evaluate our LLM4DV framework on three DUT modules: Primitive Data Prefetcher Core, Ibex Instruction Decoder, and Ibex CPU. These modules and their testbenches are constructed by ourselves. With Verilator and cocotb, we could efficiently simulate and test the modules in Python. We use OpenAI's GPT-3.5-turbo-0613 model [16] in our "fixed-budget" experiments. See Appendix D for DUT details, and Appendix C for experimental setup details. 4.1 Primitive Data Prefetcher Core The Primitive Data Prefetcher Core module requires test stimuli in specific stride patterns. We run the CRT baseline and the fixed-budget experiments with GPT 3.5 and three prominent configurations. Table 1 shows the results of the experiments. We see that the best configuration, which uses Coverpoint Type-based Sampling, Successful Difficult Responses, Normal Tolerance, and Stable-restart Keeping best-messages, achieved 98.94% coverage rate. This demonstrates that with our prompting template and improvement methods, the stimulus generation agent is capable of making simple mathematical reasoning to hit the bins efficiently. 5 Table 1: Results of fixed-budget experiments: A1, A2, A3 contrast Successful Responses (II) + Stable-restart Keeping best-messages (iii) vs. Successful Difficult Responses (IV) + Stable-restart Keeping best-messages (iii) vs. Successful Difficult Responses (IV) + Keeping best-messages (ii). B1, B2 contrast Normal Tolerance (a) vs. Coverage Rate-based Tolerance (d). C1, C2 contrast Normal Tolerance (a) vs. Low Tolerance (b). For details of the configurations, see Table 2 in Appendix. Config Max coverage Max coverage rate Avg msg/trial Stdev msg/trial Random A1 A2 A3 Random B1 B2 Random C1 C2 Primitive Data Prefetcher Core 0.39% 95.45% 98.94% 97.39% - 641 617.5 459.33 Ibex CPU Instruction Decoder 53.92% 80.45% 86.19% Ibex CPU 1.53% 5.10% 5.61% - 864 844.25 - 42.49 45.72 4 987 1023 1007 1136 1695 1816 3 10 11 - 104.24 165.06 287.21 - 147.92 127.94 - 11.74 16.17 4.2 Ibex Instruction Decoder The Ibex Instruction Decoder module takes in RISC-V instruction codes. Table 1 shows the results of the experiments. We see that the best configuration, which uses Mixed Coverpoint Type-based and Pure Random Sampling, Successful Difficult Responses, Coverage Rate-based Tolerance, and Stable-restart Keeping best-messages, achieved 86.19% coverage rate. This demonstrates that the stimulus generation agent can make use of its pre-trained knowledge to hit the bins efficiently. 4.3 Ibex CPU The Ibex CPU module takes in a list of updates to its instruction memory in each cycle, and execute the instruction memory accordingly. This module is more complex than the previous two modules. Table 1 shows the results of the experiments. We see that the best configuration, which uses Coverpoint Type-based Sampling, Successful Responses, Fast Tolerance, and Stable-restart Keeping best-messages, only achieved 5.61% coverage rate. Although it's better than the CRT, this shows that on complex task settings, the framework are deficient in producing effective updates and may require further prompt engineering and prompting improvements to enhance its performance. 5 Conclusion and Discussion This study proposes LLM4DV, a benchmarking framework for test stimuli generation in design verification. We build three DUT modules and construct a stimulus generation agent, together with a prompt template and four prompting improvements. Through experimentation on the modules, we show that LLM-assisted test stimuli generation could achieve impressive coverage rates on several design units, and its performance is significantly better than CRT for relatively complex coverage plans. However, when the task setting becomes more complex, for instance, a full CPU design, LLM fails to achieve a fairly good coverage rate. To our understanding, our study represents the first systematic exploration of utilizing LLMs to assist in the area of hardware design verification. More specifically, we focus on the generation of test stimuli, which is a task known for its high reliance on human intervention. Our designs and findings will be open-sourced upon publication. Our framework is designed to accommodate arbitrary hardware designs and offers users the flexibility to switch between different LLMs or customize 6 their own prompting strategy. We also provided three high-quality hardware designs with different difficulties for the users to experiment their new LLMs or prompts. We anticipate that our developed framework will provide researchers with a user-friendly interface to further explore the potential of LLMs in aiding hardware design verification. References [1] Hasini Witharana, Yangdi Lyu, Subodha Charles, and Prabhat Mishra. A survey on assertion- based hardware verification. ACM Computing Surveys (CSUR), 54:1 – 33, 2022. URL https: //api.semanticscholar.org/CorpusID:246362628. [2] Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners, 2020. [3] Hunter Lightman, Vineet Kosaraju, Yura Burda, Harri Edwards, Bowen Baker, Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever, and Karl Cobbe. Let's verify step by step, 2023. [4] Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiao- qing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and fine-tuned chat models, 2023. [5] Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Josh Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code, 2021. [6] Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, edi- tors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper_files/paper/2017/file/ d5e2c0adad503c91f91df240d0cd4e49-Paper.pdf. [7] Nisan Stiennon, Long Ouyang, Jeffrey Wu, Daniel Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul F Christiano. Learning to summarize with human feedback. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 3008–3021. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper_files/paper/2020/file/ 1f89885d556929e98d3ef9b86448f951-Paper.pdf. 7 [8] Bei Chen, Fengji Zhang, Anh Nguyen, Daoguang Zan, Zeqi Lin, Jian-Guang Lou, and Weizhu Chen. CodeT: Code generation with generated tests, 2022. [9] Max Schäfer, Sarah Nadi, Aryaz Eghbali, and Frank Tip. An empirical evaluation of using large language models for automated unit test generation, 2023. [10] Stephan Lukasczyk and Gordon Fraser. Pynguin: Automated unit test generation for Python. In 2022 IEEE/ACM 44th International Conference on Software Engineering: Companion Proceedings (ICSE-Companion), pages 168–172, 2022. doi: 10.1145/3510454.3516829. [11] Rahul Kande, Hammond Pearce, Benjamin Tan, Brendan Dolan-Gavitt, Shailja Thakur, Ramesh Karri, and Jeyavijayan Rajendran. LLM-assisted generation of hardware assertions, 2023. [12] Bhaskar Pal, Ansuman Banerjee, Arnab Sinha, and Pallab Dasgupta. Accelerating assertion coverage with adaptive testbenches. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 27(5):967–972, 2008. doi: 10.1109/TCAD.2008.917975. [13] Luca Ferro, Laurence Pierre, Yves Ledru, and Lydie du Bousquet. Generation of test programs for the assertion-based verification of tlm models. In 2008 3rd International Design and Test Workshop, pages 237–242, 2008. doi: 10.1109/IDT.2008.4802505. [14] Jason G. Tong, Marc Boule, and Zeljko Zilic. Airwolf-tg: A test generator for assertion-based In 2009 IEEE International High Level Design Validation and Test dynamic verification. Workshop, pages 106–113, 2009. doi: 10.1109/HLDVT.2009.5340166. [15] Yangdi Lyu and Prabhat Mishra. Automated test generation for activation of assertions in rtl models. In 2020 25th Asia and South Pacific Design Automation Conference (ASP-DAC), pages 223–228, 2020. doi: 10.1109/ASP-DAC47756.2020.9045731. [16] OpenAI. OpenAI: Introducing ChatGPT, 2022. URL https://openai.com/blog/chatgpt. A Basic framework algorithm Algorithm 1 Basic DV pipeline stimulus ← 0 coverage ← {} while coverage rate < 100% and not (∆ coverage in 25 messages < 3 or ∆ coverage in 40 messages = 0) do while stimulus_buffer not empty and coverage rate < 100% do stimulus ← stimulus_buffer.pop() testbench.input(stimulus) coverage ← coverage_monitor.compute_coverage(testbench) end while prompt ← prompt_generator.generate(coverage) response ← LLM.generate(prompt) stimuli ← extractor.extract(response) stimulus_buffer.extend(stimuli) while stimulus_buffer is empty do prompt ← prompt_generator.regenerate(coverage) response ← LLM.generate(prompt) stimuli ← extractor.extract(response) stimulus_buffer.extend(stimuli) end while end while Algorithm 1 shows the workflow of the basic framework as in Section 3.1. 8 B Details of prompting improvements This section describes the design choices of our four prompting improvements. We also compare these design choices with ablation experiments, see Appendix F. B.1 Missed-bin sampling We define three sampling methods: • (1) Pure Random Sampling: randomly samples seven bins from all uncovered bins. • (2) Coverpoint Type-based Sampling: we categorize all bins into "easier bins" and "harder bins" based on their difficulties to be covered, and order them based on their names; when sampling, we always take the first two uncovered bins, then either randomly sample five bins from all uncovered bins if there are no "easier bins" left, or sample three "easier bins" and two "harder bins". • (3) Mixed Coverpoint Type-based and Pure Random Sampling: when the coverage ratio is below 15%, it keeps using Coverpoint Type-based Sampling; when the coverage ratio is larger than 15%, it switches between Coverpoint Type-based Sampling and Pure Random Sampling whenever the current sampling method hits less than three new bins within four responses. The number of 15% is obtained empirically. B.2 Best-iterative-message sampling We propose four sampling methods: • (I) Recent Responses: keeps the initial query (and its response), and three most recent iterative queries (and their responses). • (II) Successful Responses: keeps the initial query and three iterative queries with responses that hit maximum number of bins; if multiple maximums exist, uniformly samples three of them. • (III) Mixed Recent and Successful Responses: keeps the initial query, two most successful iterative queries, and one most recent iterative query. • (IV) Successful Difficult Responses: similar to successful responses, but each "harder bin" as in Appendix B.1 counts as 2.5 bins. B.3 Dialogue restarting We define four restarting plans: • (a) Normal Tolerance: restarts the dialogue if the LLM hits less than three bins within 7 responses. • (b) Low Tolerance: restarts the dialogue if the LLM hits less than three bins within 4 responses. • (c) High Tolerance: restarts the dialogue if the LLM hits less than three bins within 10 responses. • (d) Coverage Rate-based Tolerance: uses Low Tolerance when the coverage ratio is below 15%, and Normal Tolerance afterwards. The number of 15% is intentionally set as the same value as in Mixed Coverpoint Type-based and Pure Random Sampling in Appendix B.1. B.4 Best-iterative-message buffer resetting We define three resetting plans for the best-iterative-message buffer: • (i) Clearing best-messages: clears the buffer on dialogue restarts. • (ii) Keeping best-messages: keeps the buffer on dialogue restarts. • (iii) Stable-restart Keeping best-messages: keeps the buffer on dialogue restarts, but not using it for the first four responses after restarts. 9 C Fixed-budget experiment setup Large language models We use OpenAI's GPT-3.5-turbo-0613 model [16] in our experiments. For OpenAI's API calls, we set parameters as temperature = 0.4, top_p = 1.0, and max_tokens = 600. These parameters are decided empirically. We also use Llama 2 7B model [4] in ablation experiments, see Appendix F. Experimental setup and measurement We run "fixed-budget experiments" on the three DUT modules, each with certain configurations of prompt template and methods of improvement measures. The configurations are selected as the ones with the most significant results in ablation experiments (see Appendix F). In each fixed-budget experiment, the experiment routine would have a budget of 10,000,000 tokens (input and output tokens are counted in the same way). Here's how it works: 1. The experiment routine starts with a trial as described in Section 3.1. 2. The trial either ends as described in Section 3.1 or when it runs out of the token budget. 3. If there is budget left, the experiment routine starts a new trial, in which the stimulus generation agent, the testbench, and the coverage record are reset. 4. The experiment routine ends when the budget is used up. Running a fixed-budget experiment takes 6 to 20 hours, depending on the DUT module and the LLM service status. The fixed-budget setup reflects the realistic use case where the financial budget for DV is reflected on the token budget. The multi-trial setup allows configurations to trade off "steady slow increase", where a trial takes many messages but stably achieves a high coverage, and "random fast increase", where a trial takes less messages but may either reach a high coverage by chance or end up with a low coverage. We measure the maximum coverage each configuration achieves in trials in an experiment routine as its performance. We use the mean and the standard deviation of message count per trial as a reference for capability and stability of configurations. We don't measure the size of the union set of covered bins across trials because we intend to test our framework's capacity across different DUT modules rather than to reach 100% coverage rate on a specific DUT. We compare our framework to a constrained-random test (CRT) generation agent baseline, which generates 1,000,000 integers within the input range. Particularly, for the Ibex CPU module, the CRT generates an instruction to update the current PC in each cycle. D Details of DUTs This section explains our three DUT modules and their coverage plans respectively. D.1 Primitive Data Prefetcher Core The Primitive Data Prefetcher Core takes in 32-bit integers and detects whether there's a stride pattern in it. This module requires relatively high mathematical reasoning capability for the LLM. Our coverage plan contains 1034 bins of the following types: • Single-stride bins: counts when 16 consecutive integers a0, a1, ..., a15 satisfy ai+1 − ai = c for some constant −16 ≤ c ≤ 15. • Double-stride bins: counts when 16 consecutive integers satisfy an alternative stride width pattern, formally a2i+2 − a2i+1 = c1 and a2i+1 − a2i = c2 for some −16 ≤ c1, c2 ≤ 15 and c1 ̸= c2. • Misc bins: including – Single-stride positive/negative overflow bins: a single stride pattern with c < −16 (negative overflow) or c > 15 (positive overflow). 10 – Double-stride pp/pn/np/nn overflow bins: a double stride pattern with c1 and c2 posi- tively / negatively overflow respectively. – No-stride-to-single/double: counts when 16 integers satisfying no stride pattern are followed by 16 integers with single / double stride pattern. – Single/double-to-double/single: counts when 16 integers satisfying single / double stride pattern are followed by 16 integers with double / single stride pattern. D.2 Ibex Instruction Decoder The Ibex Instruction Decoder is an instruction decoder for 32-bit RISC-V instruction codes. This module involves almost no mathematical reasoning but requires knowledge about RISC-V knowledge. Through preliminary tests, we find that GPT 3.5 and Llama 2 are pre-trained with RISC-V knowledge, and thus our bin descriptions don't need to explain the instruction formats and operations in detail. Our coverage plan contains 2107 bins of the following types: • ALU operation bins: counts when an instruction represents one of 26 pre-defined ALU operations such as ADD, ADDI, XOR, LW, etc. • Register port bins: counts when an instruction uses the port of the specific register. There are 32 registers, and each has two read ports and one write port, which are used when the register file is taken as the first source, second source, and the destination register, respectively. • Cross coverage bins: the Cartesian product of ALU operation bins and register port bins. Counts when an instruction satisfies both bins simultaneously (some of the product, such as ADDI and read_port_A of any register, are invalid and not included in the coverage plan). D.3 Ibex CPU The Ibex CPU is a full RISC-V CPU with instruction and data memory. Different from the previous two modules, in every cycle the agent provides a stimulus of a list of address-instruction pairs (a, i, each presents a dynamic update that changes the instruction memory content at address a into value i. The CPU performs an instructions in the instruction memory in each timestep and wait for another list of updates (which can be empty). Apart from the current coverage, the testbench also returns the current program counter (PC) and the last executed instruction to the stimulus generation agent. Therefore, the task requires knowledge of both RISC-V and working principle of CPU and memory, and demands managing the complicated task setting. Our coverage plan contains 196 bins of the following types: • Operation bins: for each of pre-defined ten R-type operations, three S-type instruction, and one J-type instruction (JAL), we consider the following four bins: – seen: counts when an instruction performs the operation; – zero_dst: if available, counts when the instruction performs the operation, with the destination register (rd) as zero (reg #0); – zero_src: if available, counts when the instruction performs the operation, with one of the source registers (rs) as zero (reg #0); – same_src: if available, counts when the instruction performs the operation, taking the same register as source registers (rs). • Jump bins: for the JAL operation, we consider forward and backward jumps respectively. • Hazard bins: for each pair of the pre-defined operations, we consider a simplified read-after- write (RaW) hazard, which counts when the later instruction reads from a register that the previous instruction is writing to. E Configurations in fixed-budget experiments Table 2 shows the details of LLM4DV configurations in our fixed-budget experiment results (Table 1), including methods used for prompt templates and strategies of prompting improvements. 11 Table 2: Configurations of fixed-budget experiments, strategies been contrasted in each module are marked in bold fonts. Conf Improvement Method Primitive Data Prefetcher Core A1 A2 A3 B1 B2 C1 C2 Prompt template Missed-bin sampling Best-iterative-message sampling Dialogue restarting Best-iterative-message buffer resetting Original prompt template Coverpoint Type-based Sampling (2) Successful Responses (II) Normal Tolerance (a) Stable-restart Keeping best-messages (iii) Prompt template Missed-bin sampling Best-iterative-message sampling Dialogue restarting Best-iterative-message buffer resetting Original prompt template Coverpoint Type-based Sampling (2) Successful Difficult Responses (IV) Normal Tolerance (a) Stable-restart Keeping best-messages (iii) Prompt template Missed-bin sampling Best-iterative-message sampling Dialogue restarting Best-iterative-message buffer resetting Original prompt template Coverpoint Type-based Sampling (2) Successful Difficult Responses (IV) Normal Tolerance (a) Keeping best-messages (ii) Ibex Instruction Decoder Prompt template Missed-bin sampling Best-iterative-message sampling Dialogue restarting Best-iterative-message buffer resetting Prompt template Missed-bin sampling Best-iterative-message sampling Dialogue restarting Best-iterative-message buffer resetting Prompt template with one-line task introduction Mixed Coverpoint Type-based and Pure Random Sampling (3) Successful Difficult Responses (IV) Normal Tolerance (a) Stable-restart Keeping best-messages (iii) Prompt template with one-line task introduction Mixed Coverpoint Type-based and Pure Random Sampling (3) Successful Difficult Responses (IV) Coverage Rate-based Tolerance (d) Stable-restart Keeping best-messages (iii) Ibex CPU Prompt template Missed-bin sampling Best-iterative-message sampling Dialogue restarting Best-iterative-message buffer resetting Prompt template Missed-bin sampling Best-iterative-message sampling Dialogue restarting Best-iterative-message buffer resetting Original prompt template Coverpoint Type-based Sampling (2) Successful Responses (IV) Normal Tolerance (a) Stable-restart Keeping best-messages Original prompt template Coverpoint Type-based Sampling (2) Successful Responses (IV) Low Tolerance (b) Stable-restart Keeping best-messages 12 Table 3: Results of infinite-message experiments on the Primitive Data Prefetcher Core module (a) Pure Random Sampling (1) vs. Coverpoint Type-based Sampling for stride detector bins (2), both with Original prompt template, Recent Responses, and Normal Tolerance. Config Max cov (/1034) Avg cov Stdev cov Avg cov/msg Stdev cov/msg (1) (2) 890 953 664.33 681 195.62 276.61 2.59 1.59 0.18 0.41 (b) Clearing best-messages (3) vs. Keeping best-messages (4) vs. Stable-restart Keeping best-messages (5), all with Original prompt template, Coverpoint Type-based Sampling for stride detector bins, Successful Responses, and Normal Tolerance. Config Max cov (/1034) Avg cov Stdev cov Avg cov/msg Stdev cov/msg (3) (4) (5) 962 1011 1005 829 526.33 974.67 188.09 451 52.54 1.86 1.3 1.73 0.69 0.81 0.45 (c) Recent Responses (2) vs. Successful Responses (5) vs. Successful Difficult Responses (6), all with Original prompt template, Coverpoint Type-based Sampling for stride detector bins, Normal Tolerance, and Stable-restart Keeping best-messages. Config Max cov (/1034) Avg cov Stdev cov Avg cov/msg Stdev cov/msg (2) (5) (6) 953 1005 1031 681 974.67 963.33 276.61 52.54 110.35 1.59 1.73 1.71 0.41 0.45 0.39 (d) Original prompt template (6) vs. Prompt template with negative feedback (7), both with Coverpoint Type- based Sampling for stride detector bins, Successful Difficult Responses, Normal Tolerance, and Stable-restart Keeping best-messages. Config Max cov (/1034) Avg cov Stdev cov Avg cov/msg Stdev cov/msg (6) (7) 1031 963 963.33 865.5 110.35 137.89 1.71 1.58 0.39 0.79 F Ablation experiments Due to the cost of money and time for OpenAI's API requests and experiment running, we compare configurations of the stimulus generation agent by their performances on simpler experiment setups. F.1 Ablation experiment setups We run "limited-message experiments" and "infinite-message experiments" on the Primitive Data Prefetcher Core module and the Ibex Instruction Decoder module. In a limited-message experiment, the experiment routine runs a trial with an upper bound of the number of responses that is smaller relative to the average response number for the trial to "exhaust" (as in Section 3.1). In a infinite- message experiment, the upper bound of response number is much larger than the average response number for the trial to "exhaust", allowing the agent to fully exert its capacity. We use two LLMs in our experiment: OpenAI's GPT-3.5-turbo-0613 model, and Meta AI's Llama 2 7B model. For GPT 3.5, we use OpenAI's API calls, with parameters as temperature = 0.4, top_p = 1.0, and max_tokens = 600. For Llama 2 7B, we put the downloaded Llama 2 directory in the same level as our project directory. We use one A100 GPU with 80GB memory to run the language model. We call the model with parameters as temperature = 0.4, top_p = 0.9, max_gen_tokens = 800, max_seq_len = 10000, and max_batch_size = 4. These parameters are decided empirically. Other experimental setup follows Appendix C. 13 Figure 3: Infinite-message experiments on the Primitive Data Prefetcher Core module. Each line represents the trial reaching the maximum coverage on a configuration, and dots on it shows dialogue restarting points. All trials use Original prompt template except Prefetcher 7, which uses Prompt template with negative feedback. F.2 On Primitive Data Prefetcher Core We run infinite-message experiments with several configurations of prompt templates and improve- ment measures on the Primitive Data Prefetcher Core module. The results are displayed in Table 3 and Figure 3. As we can see, on this module: • Coverpoint Type-based Sampling for stride detector bins achieves better coverage but poorer coverage-per-message than Pure Random Sampling. • Successful Responses and Successful Difficult Responses are generally better than Recent Responses. • While Keeping best-messages and Stable-restart Keeping best-messages are generally better than Clearing best-messages, Keeping best-messages is least stable. • Prompt template with negative feedback, which include a one-sentence "what not to do" for each bin in iterative queries, makes no significant improvement than Original prompt template. Based on these conclusions, we run fixed-budget experiments on three most prominent combinations of strategies, as in Section 4.1. F.3 On Ibex Instruction Decoder First, we run limited-message experiments (at most 300 responses per trial) with several configurations of prompt templates (see Section 3.2) and improvement measures (see Section 3.3) on the Ibex Instruction Decoder module. The results are displayed in Table 4. As we can see, on this module: • Mixed Coverpoint Type-based and Pure Random Sampling for Ibex decoder bins is better than Coverpoint Type-based Sampling for Ibex decoder bins in terms of average coverage, coverage stability, and average coverage-per-message. • Successful Difficult Responses is generally better than Successful Responses and Mixed Recent and Successful Responses. • While Low Tolerance has poorer coverage than Normal Tolerance, its coverage-per-message is significantly better, which means it covers easier bins faster; the Coverage Rate-based 14 Message numberCoverage02004006008001000100200300400500Prefetcher 1 [(1), (I), (a), - ]Prefetcher 1 restartPrefetcher 2 [(2), (I), (a), - ]Prefetcher 2 restartPrefetcher 3 [(2), (II), (a), (i)]Prefetcher 3 restartPrefetcher 4 [(2), (II), (a), (ii)]Prefetcher 4 restartPrefetcher 5 [(2), (II), (a), (iii)]Prefetcher 5 restartPrefetcher 6 [(2), (IV), (a), (iii)]Prefetcher 6 restartPrefetcher 7 [(2), (IV), (a), (iii)] + Prefetcher 7 restart Table 4: Results of limited-message experiments on the Ibex Instruction Decoder module (a) Coverpoint Type-based Sampling for Ibex decoder bins (1) vs. Mixed Coverpoint Type-based and Pure Random Sampling for Ibex decoder bins (2), both with Original prompt template, Successful Responses, Normal Tolerance, and Stable-restart Keeping best-messages. Config Max cov (/2107) Avg cov Stdev cov Avg cov/msg Stdev cov/msg (1) (2) 1251 1163 872.5 1052 505.96 102.47 3.66 4.78 0.5 0.61 (b) Successful Responses (1) vs. Mixed Recent and Successful Responses (3) vs. Successful Difficult Responses (4), all with Original prompt template, Coverpoint Type-based Sampling for Ibex decoder bins, Normal Tolerance, and Stable-restart Keeping best-messages. Config Max cov (/2107) Avg cov Stdev cov Avg cov/msg Stdev cov/msg (1) (3) (4) 1251 1007 1625 872.5 523 1413 505.96 485.51 195.79 3.66 2.16 4.98 0.5 1.48 1.1 (c) Normal Tolerance (1) vs. Low Tolerance (5) vs. Coverage Rate-based Tolerance for Ibex decoder bins (6), all with Original prompt template, Coverpoint Type-based Sampling for Ibex decoder bins, Successful Responses, and Stable-restart Keeping best-messages. Config Max cov (/2107) Avg cov Stdev cov Avg cov/msg Stdev cov/msg (1) (5) (6) 1251 1047 1430 872.5 678 1179.67 505.96 334.11 305.68 3.66 4.39 4.5 0.5 1.27 1.59 (d) Normal Tolerance (2) vs. High Tolerance (7), both with Original prompt template, Mixed Coverpoint Type-based and Pure Random Sampling for Ibex decoder bins, Successful Responses, and Stable-restart Keeping best-messages. Config Max cov (/2107) Avg cov Stdev cov Avg cov/msg Stdev cov/msg (2) (7) 1163 1215 1052 685.67 102.47 605.12 4.78 2.74 0.61 2.23 (e) Original prompt template (1) vs. Prompt template with one-line task introduction (8), both with Coverpoint Type-based Sampling for Ibex decoder bins, Successful Responses, Normal Tolerance, and Stable-restart Keeping best-messages. Config Max cov (/2107) Avg cov Stdev cov Avg cov/msg Stdev cov/msg (1) (8) 1251 1462 872.5 1203.67 505.96 323.38 3.66 4.01 0.5 1.08 15 Table 5: Results of infinite-message experiments on the Ibex Instruction Decoder module: all configurations use Prompting template with one-line task introduction and Successful Difficult Responses. (1)-(4) use Stable-restart Keeping best-messages; (1)(2) use Coverage Rate-based Tolerance for Ibex decoder bins, (3)(4) use Normal Tolerance; (1)(3) use Mixed Coverpoint Type- based and Pure Random Sampling for Ibex decoder bins, (2)(4) use Coverpoint Type-based Sampling for Ibex decoder bins. (5) uses Keeping best-messages, Coverage Rate-based Tolerance for Ibex decoder bins, and Mixed Coverpoint Type-based and Pure Random Sampling for Ibex decoder bins. Config Max cov (/2107) Avg cov Stdev cov Avg cov/msg Stdev cov/msg (1) (2) (3) (4) (5) 1807 1513 1861 1642 721 1568 1302.5 1684 1322.33 369.5 338 297.69 250.32 472.17 497.1 2.55 2.83 3.85 2.71 0.85 0.62 0.41 0.07 0.56 0.18 Figure 4: Infinite-message experiments on the Ibex Instruction Decoder module. Each line represents the trial reaching the maximum coverage on a configuration, and dots on it shows dialogue restarting points. All trials use Prompt template with one-line task introduction. Tolerance for Ibex decoder bins that combines Low Tolerance and Normal Tolerance generally performs the best. • The combination of High Tolerance and Mixed Coverpoint Type-based and Pure Random Sampling for Ibex decoder bins makes no significant improvement than Normal Tolerance and Mixed Coverpoint Type-based and Pure Random Sampling for Ibex decoder bins, whereas its standard deviations are both larger. • Prompt template with one-line task introduction is generally better than Original prompt template. Second, we run infinite-message experiments with five configurations on this module. The results are displayed in Table 5 and Figure 4. As we can see, on this module: • Mixed Coverpoint Type-based and Pure Random Sampling for Ibex decoder bins performs better than Coverpoint Type-based Sampling for Ibex decoder bins with longer trials. • Normal Tolerance and Coverage Rate-based Tolerance performs similarly. • Keeping best-messages performs much worse than Stable-restart Keeping best-messages on this module. 16 Message numberCoverage0500100015002000200400600800Ibex Decoder 1 [(3), (IV), (d), (iii)]Ibex Decoder 1 restartIbex Decoder 2 [(2), (IV), (d), (iii)]Ibex Decoder 2 restartIbex Decoder 3 [(3), (IV), (a), (iii)]Ibex Decoder 3 restartIbex Decoder 4 [(2), (IV), (a), (iii)]Ibex Decoder 4 restartIbex Decoder 5 [(3), (IV), (d), (ii)]Ibex Decoder 5 restart Table 6: Results of LLM comparison experiments on the Ibex Instruction Decoder module. Both stimulus generation agents use Prompting template with one-line task introduction, Coverpoint Type- based Sampling for Ibex decoder bins, Successful Responses, Normal Tolerance, and Stable-restart Keeping best-messages. Config Max cov (/2107) Avg cov Stdev cov Avg cov/msg Stdev cov/msg Llama 2 7B GPT 3.5 17 1462 15.67 1203.67 2.31 323.38 0.43 4.01 0.08 1.08 Based on these conclusions, we run fixed-budget experiments on two most prominent combinations of strategies, as in Section 4.2. F.4 LLM comparison We compare the two choices of LLM by running limited-message experiments on the Ibex Instruction Decoder module. The results are displayed in Table 6. As we can see, GPT 3.5 is significantly better than Llama 2 7B. In other experiments with Llama 2 7B, we also observe frequent gibbering response that has never happened with GPT 3.5. 17
http://arxiv.org/abs/2310.04528v1
"2023-10-06T18:46:22"
"2023-10-06T18:46:22"
DPGOMI: Differentially Private Data Publishing with Gaussian Optimized Model Inversion
High-dimensional data are widely used in the era of deep learning with numerous applications. However, certain data which has sensitive information are not allowed to be shared without privacy protection. In this paper, we propose a novel differentially private data releasing method called Differentially Private Data Publishing with Gaussian Optimized Model Inversion (DPGOMI) to address this issue. Our approach involves mapping private data to the latent space using a public generator, followed by a lower-dimensional DP-GAN with better convergence properties. We evaluate the performance of DPGOMI on standard datasets CIFAR10 and SVHN. Our results show that DPGOMI outperforms the standard DP-GAN method in terms of Inception Score, Fr\'echet Inception Distance, and classification performance, while providing the same level of privacy. Our proposed approach offers a promising solution for protecting sensitive data in GAN training while maintaining high-quality results.
[ "Dongjie Chen", "Sen-ching S. Cheung", "Chen-Nee Chuah" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04528v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04528v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
DPGOMI: Differentially Private Data Publishing with Gaussian Optimized Model Inversion Dongjie Chen1 Sen-ching S. Cheung1,2 Chen-Nee Chuah1 1ECE Department, University of California, Davis, CA 2ECE Department, University of Kentucky, Lexington, KY 3 2 0 2 t c O 6 ] G L . s c [ 1 v 8 2 5 4 0 . 0 1 3 2 : v i X r a Abstract-High-dimensional data are widely used in the era of deep learning with numerous applications. However, certain data which has sensitive information are not allowed to be shared without privacy protection. In this paper, we propose a novel differentially private data releasing method called Dif- ferentially Private Data Publishing with Gaussian Optimized Model Inversion (DPGOMI) to address this issue. Our approach involves mapping private data to the latent space using a public generator, followed by a lower-dimensional DP-GAN with better convergence properties. We evaluate the performance of DPGOMI on standard datasets CIFAR10 and SVHN. Our results show that DPGOMI outperforms the standard DP-GAN method in terms of Inception Score, Fr ́echet Inception Distance, and classification performance, while providing the same level of privacy. Our proposed approach offers a promising solution for protecting sensitive data in GAN training while maintaining high- quality results. Index Terms-Generative adversarial networks, differential privacy, Gaussian optimized model inversion I. INTRODUCTION Generative AI is one of the major technological break- throughs in the 21st century. All major generative AI models are trained on a large amount of diverse data that might con- tain personally identifiable information (PII). To address the privacy concerns associated with generative models, the stan- dard approach is to use differentially private (DP) stochastic gradient descent, which adds controlled noise to the gradients during training [1]. In the presence of such noise, the quality of the output synthetic samples are adversely affected and the training of the network may not converge [2]. In this paper, we propose a novel DP generative model using Gaussian Optimized Model Inversion (DPGOMI) method, where private data is first mapped to the latent space of a public generator, followed by a low-dimensional DP-GAN to model the distribution of the private latent vectors. This is an extension of our prior work in [3]. Different from the scheme Accepted by 2023 IEEE International Conference on Image Processing (ICIP) workshop on privacy attacks in computer vision, Kuala Lumpur, Malaysia, 2023, Research reported in this project was supported by the National Institutes of Health, United States of America under award number R01MH121344 and the Child Family Endowed Professorship. This work was supported in part by Oracle Cloud credits and related resources provided by the Oracle for Research program. © 2023 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works. in [3] that restricts the model inversion process with a clipping method, our proposed scheme improves the model inversion process by introducing a Gaussian modulated cost function, aiming to further improve the quality of synthetic private data. We have evaluated the performance of DPGOMI on two standard datasets: CIFAR10 [4] and SVHN [5]. Our experi- mental results show that DPGOMI outperforms the state-of- the-art (SOTA) methods in terms of Inception Score, Fr ́echet Inception Distance, and classification precision while provid- ing the same level of privacy guarantee. Particularly, DPGOMI has up to 47% improvement in classification precision for downstream classification tasks. II. RELATED WORK The standard method to assure privacy in machine learning involves the implementation of different differential privacy typically based on the Gaussian mecha- (DP) algorithms, nism [6]. Techniques such as Differentially Private Stochas- tic Gradient Descent (DPSGD), and Private Aggregation of Teacher Ensembles (PATE) [7] have been widely applied to the training process of generative models. DPSGD [1] privatizes a deep learning model by adding Gaussian noise to the aggregated gradients for SGD-based optimizers. When DPSGD is applied to a GAN, noise is only injected during the training of the discriminator, but not the training of the generator, which is not exposed to the private training data. The amount of injected noise is proportional to the number of parameters in the discriminator, and the privacy budget puts a limit on the number of training steps [3], [8]. As a result, it is challenging to scale up the input dimension of a GAN trained with DPSGD as the excessive amount of DP noise and the longer training process needed to build a larger model often leads to convergence issues or mode collapse [9]. To address the scalability issues of DPSGD on GANs, GS-WGAN [10] proposed a gradient-sanitized approach with the Wasserstein objective as an alternative to the gradient clipping scheme used in DPSGD. This approach provides a better estimate on the sensitivity values used in determining the amount of DP noise needed. GS-WGAN also employed multiple discriminator networks trained on disjoint parts of the dataset to conserve the privacy budget through sub-sampling. A similar strategy was used in the PATE-GAN [11], which deployed a single 'student' discriminator to be trained in DP fashion by a set of 'teacher' discriminators, each assigned to a distinct subset of the training data. The partition of training data, however, limits the usefulness of these approaches, especially in the typical scenarios when the training data is scarce. Another strategy to improve the utilization of the privacy budget is to form a privacy barrier between the generator and the discriminator [12]. By assuming that only the gen- erator will be released to the public, G-PATE [12] replaced the discriminator in a GAN with a private PATE classifier and passes the discretized gradients from the classifier to the generator. A similar approach was also adopted in GS- WGAN [10]. However, their implementations rely on the use of conditional GAN, which limits its application to only fully- labeled datasets. The linkage between the discriminator and the generator can be further severed by training the generator using public data only. DPMI [3] proposed to learn a low dimensional DP latent space to model the distribution of private latent vectors generated from the private training data by applying model inversion (MI) on a public generator. The convergence was easier to achieve in the low-dimensional DP latent space. However, during training, the clipping method used in the MI process could result in low-quality synthetic images. An alternate line of works utilized Maximum Mean Discrep- ancy (MMD) between private target data and a generator's distribution based on random features or perceptual features learned from a public dataset [8], [13], [14]. In this vein, DP- MERF [14] and DP-MEPF [8] introduced differentially private data generation methodologies through mean embeddings of features without the need of adding DP noise in every step of the training. III. PRELIMINARIES A. Differential Privacy A randomized mechanism, denoted as M , acting on a database D, is termed differentially private if the output of any potential query remains substantially unchanged when replacing D with a neighboring database D′, which deviates from D by no more than one data entry. This concept of a differentially private mechanism can be formally defined as follows: Definition 1: (Differential Privacy) A randomized mecha- nism M is (ε, δ)-differential privacy if any output set S and any neighboring databases D and D′ satisfy the followings: P(M(D) ∈ S) ≤ eε * P (M (D′) ∈ S) + δ (1) For a δ value of zero, a smaller ε produces a more strin- gent privacy constraint, with an ε value of zero representing perfect privacy. The introduction of a small, positive δ value permits a minimal probability of failure, offering the benefit of more adaptable mechanism designs. Most DP randomized mechanisms used in machine learning are based on additive noise: Laplacian mechanism adds Laplacian noise the output to achieve (ε, 0)-DP while Gaussian mechanism adds Gaussian noise to achieve (ε, δ)-DP [6]. A notable attribute of differential privacy mechanisms is that any post-processing conducted on a differentially private mechanism inherently preserves its differential privacy [6]. This can be formally stated as follows: Theorem 1: (Post-processing) Given an arbitrary mapping f : R → R′ and an (ε, δ)-differentially private mechanism M : D → R, f ◦ M : D → R′ is (ε, δ)-differentially private. Note that the post-processing steps no longer have access to the private data. Typical deep network training, on the other hand, requires repeated exposure to the private data. In order to account for culminated privacy loss, an accountant scheme such as the R ́enyi Differential Privacy accountant [15] should be used to bound the privacy loss within the total privacy budget ε while accounting for the composition of multiple queries. B. GAN A conventional Generative Adversarial Network (GAN) involves two components: a generator G(z) ∈ X and a dis- criminator C(x) ∈ 0, 1. The generator employs a latent vector z ∈ Rd as a means to transform this latent representation into the target image space X. In contrast, the discriminator image x ∈ X is real (1) or assesses whether an input synthetic (0). The latent vector's distribution, PZ, is generally established as a separable d-dimensional Gaussian distribution. Provided that the real data is derived from a distribution PX , the training objective of a GAN is to determine the optimal G and C by engaging in a two-player min-max game with the aim of solving the following optimization problem: min G max C Ex∼PX [log(C(x))] + Ez∼PZ [log(1 − C(G(z)))] (2) Wasserstein GAN (WGAN), introduces a significant enhance- ment to the training stability of the original GAN by leveraging the Wasserstein distance between the distributions of latent vectors and real images [16]. Given a parametrized family of K-Lipschitz functions denoted as {fw(x)}w∈W , this opti- mization problem can be approximately tackled through the subsequent value function: min G max w∈W Ex∼PX [fw(x)] − Ez∼PZ [fw(G(z))] (3) C. Model Inversion of GANs Using a pre-trained public generator Gp, which transforms a random d-dimensional latent vector z ∼ PZ = N d(0, I) into a synthetic image Gp(z), model inversion of GANs [3] aim to find, for each private image xs ∈ Ds, the associated latent vector zs that minimizes the mean square difference between xs and Gp(zs). Specifically, model inversion addresses the following optimization problem: zs = arg min z ||Gp(z) − xs||2 s.t. PZ(z) ≥ PZ(z0) with z0 ∼ PZ (4) Model inversion starts by first drawing a random sample z0 from PZ and the constraint in (4) is to ensure that the quality of Gp(zs) to be comparable to that of Gp(z0). This convex optimization can be easily solved via stochastic gradient ascent procedure by projecting the search trajectory back onto the convex constraint [17]. IV. PROPOSED METHOD In this section, we present a new differentially private data-releasing method named DPGOMI. An overview of the method is shown in Figure 1. First, instead of using the private data to train a differentially private GAN, we use public data Dp similar to the private dataset Ds to train a public GAN. Since the Dp is publicly accessible, no DP training is needed for the public GAN. Next, an improved version of MI introduced in Section III-C called Gaussian Optimized Model Inversion (GOMI) is used to obtain the private latent vectors form the latent space of the public generator Gp. In step three, a low-dimensional differentially private GAN is trained to generate latent vectors that mimic the distribution of the private latent vectors. A synthetic dataset can be released in the final step by sampling the latent vector space and feeding them through the two generators: Gds from the DP latent space and the public generator Gp. Fig. 1. Proposed DPGOMI Framework. To motivate the need of GOMI, we recall that the goal of the MI process in Section III-C is to identify the latent vector ˆz so that the synthetic image Gp(ˆz) is as close to the target private image xs as possible. To avoid the gradient descent search pro- cess from drifting too far off the prescribed standard Gaussian distribution, PZ = N d(0, I), the algorithm in Section III-C uses a constraint PZ(z) ≥ PZ(z0) with z0 ∼ PZ. The random z0, however, does not provide a deterministic guarantee of the quality of the synthetic image. The truncation trick in [18] used a truncated Gaussian distribution during the GAN inference process to provide such a deterministic guarantee. But the truncated Gaussian function is not entirely differentiable so it impacts the stochastic gradient search process in MI. We introduce a differentiable cost function that penalizes the deviation from the latent distribution PZ(z). We call this new approach Gaussian Optimized Model Inversion (GOMI) which can be described as follows: zs = arg min z ||Gp(z) − xs||2/PZ(z) (5) where PZ(z) represents the value of the standard Gaussian function at latent vector z. GOMI exposes the model inversion process to a broader latent space while ensuring high image quality. The detailed algorithm to implement GOMI with the Adam optimizer is shown in Algorithm 1. Algorithm 1 Gaussian Optimized Model Inversion (GOMI) using the Adam optimizer 1: Input: Generator Gp, private image xs, Adam parameters β1, β2, learning rate α, # iterations N , standard Gaussian PZ , small tolerance to prevent division by zero e 2: Initialize z ∼ PZ 3: Initialize moment vectors m, v ← 0 4: for i = 1 to N do 5: 6: 7: 8: 9: 10: 11: end for 12: Output: The optimized latent vector zt g ← ∇z(||Gp(z) − xs||2/PZ (z)) Update m ← β1m + (1 − β1)g Update v ← β2v + (1 − β2)g Bias correction: ˆm ← m/(1 − βi 1) Bias correction: ˆv ← v/(1 − βi 2) √ z ← z − α ˆm/( ˆv + e) V. EXPERIMENTS In this section, we analyze the performance of our proposed DPGOMI method against the state-of-the-art differentially private data release techniques at various levels of privacy. Additionally, we conduct an in-depth ablation study of the GOMI component. To evaluate the released data, we assess the quality of the synthetic images using standard metrics for image quality and diversity. A. Dataset Partition Following [3], we separate the dataset into public and pri- vate domains. We randomly allocate one-third of the training set to Dl, which we use to train the labeling classifier. We then evenly split the rest of the training set into Dp and Ds, assigning half the classes to each. The public GAN is trained using Dp, and the GOMI process uses Ds. We only use half of the testing set with private labels. B. Datasets and Evaluation Metrics Two public datasets are used in our experiments: 1) The CIFAR10 dataset [4] contains 50,000 training and 10,000 testing images, categorized into ten classes. Each image is of size 32×32×3. For our experiments, the classes automobile, bird, cat, deer, and dog classes are randomly to the public set Dp, while frog, horse, ship, truck, and airplane classes are used for Ds. 2) SVHN [5] is a door-sign digit image dataset, contain- ing 73,257 training and 26,032 testing images of size 32×32×3. The public set Dp contains digits 1, 5, 7, 8 and 9 and Ds contains digits 0, 2, 3, 4 and 6. For performance measurements, we use classification Incep- tion Score (IS) and Fr ́echet Inception Distance (FID) based on InceptionV3 to measure both synthetic image quality and diversity [20]. We also evaluate the quality of the images using CNN based downstream classification tasks. C. Comparison with SOTA DP generative models In this Section, we compare the DPGOMI scheme with six SOTA DP generative models [3], [8], [10], [12], [14], [19]. Since only one-third of the training set is used as Ds, TABLE I FID VALUES FOR DIFFERENT METHODS AND ε VALUES FOR CIFAR10 AND SVHN (δ = 10−5) CIFAR10 SVHN Method ε = 1 ε = 5 ε = 10 ε = 20 ε = 50 ε = 1 ε = 5 ε = 10 ε = 20 ε = 50 DP-GAN [19] DP-MERF [14] G-PATE [12] (cond.) GS-WGAN [10] (cond.) DP-MEPF [8] (φ1, φ2) DP-MEPF [8] (φ1) DPMI [3] DPGOMI DPGOMI (ε=∞) 323.27 331.28 444.56 354.46 175.50 132.57 130.61 127.67 81.18 329.80 325.04 439.19 275.70 166.88 128.92 121.67 95.54 81.18 336.21 324.78 347.86 233.30 151.48 124.01 108.06 94.45 81.18 255.29 312.54 309.03 223.62 152.24 111.99 104.47 93.67 81.18 247.40 307.72 309.03 223.62 152.91 104.98 97.68 93.14 81.18 306.54 344.58 461.00 302.13 113.54 101.05 72.27 70.13 42.64 295.11 338.22 416.02 158.38 95.91 93.16 83.96 67.47 42.64 297.73 327.84 461.08 162.19 120.22 82.60 72.67 65.47 42.64 290.70 320.06 402.51 161.48 115.90 81.76 67.91 55.64 42.64 253.32 310.43 400.57 119.4 87.15 78.69 63.62 53.88 42.64 TABLE II INCEPTION SCORE AND DOWNSTREAM CLASSIFICATION PRECISION COMPARISON ON ε = 10 Inception Score Classification CIFAR10 SVHN CIFAR10 SVHN DP-GAN [19] G-PATE [12] (cond.) GS-WGAN [10] (cond.) DP-MERP [14] DP-MEPF [8] (φ1, φ2) DP-MEPF [8] (φ1) DPMI [3] DPGOMI DPGOMI (ε=∞) 1.67 1.29 1.88 2.95 3.05 2.97 4.46 4.74 4.80 1.73 1.46 1.63 2.39 2.44 2.61 2.07 2.59 2.76 0.28 0.32 0.31 0.35 0.67 0.71 0.67 0.73 0.86 0.32 0.45 0.35 0.53 0.67 0.77 0.69 0.79 0.92 we modify the open-source codes of these papers to adapt our data partition settings and obtain their performance for comparison. For G-PATE and GS-WGAN, we follow the settings in the original papers and use conditional generation. We use unconditional generation on all the other methods, including ours. Dp is used in DP-MEPF for public training. We first evaluate the quality of the synthetic data using FID. A lower FID value indicates higher image quality. Table I shows the trade-off between FID and the privacy level ε for the two datasets. DPGOMI outperforms all the existing methods across all the ε for both CIFAR10 and SVHN. We then compare the IS and downstream classification precision with ε=10. A larger IS indicates better quality and diversity of the synthetic images. Table II shows that DPGOMI has a higher IS than all the other models when they guarantee the same amount of privacy for both CIFAR10 and SVHN. DPGOMI also has a 2% to 45% improvement on CIFAR10 and a 2% to 47% improvement on SVHN for downstream classification tasks. Keep in mind that our private dataset include images from only half of the classes. This makes our measurements lower than the best available results. D. Ablation study on Gaussian Optimized Model Inversion To show the effectiveness of Gaussian Optimized Model Inversion, we evaluate GOMI under an ablation study by comparing it with the MI method from [3]. In this study, we first compare the identified private latent vector zs from GOMI and MI using FID and IS values. As shown in Table III, GOMI has 4% to 10% smaller values of FID and 4% to 5% higher IS scores, which indicates a better performance in terms of inversion quality. We further stress test the two schemes by using the entire CIFAR10 as Dp and SVHN as Ds. A visual comparison between MI and GOMI is shown in Figure 2. Both MI and GOMI can perform inversion using a completely different dataset, and the quality of inverted images from GOMI is better than the ones from MI. (a) (b) Fig. 2. Side-by-side comparisons with even columns for real images and odd columns for synthetic images generated (a) by CIFAR10 generator Gp through MI with SVHN; (b) by Gp through GOPMI with SVHN. TABLE III FID AND IS BETWEEN MI AND GOMI Metric Dataset Gp + MI [3] Gp + GOMI FID IS CIFAR10 SVHN CIFAR10 SVHN 81.74 26.11 4.61 2.72 78.57 23.40 4.83 2.82 VI. CONCLUSION In this work, we have proposed a new differentially private data publishing method, referred as DPGOMI. The proposed Gaussian Optimized Model Inversion method improves upon the existing model inversion process by providing a differential cost function that favors the target latent space distribu- tion. Using two public datasets, the proposed DPGOMI have demonstrated superior performance both quantitatively and qualitatively in the comparison with SOTA methods and in the ablation study. REFERENCES [1] M. Abadi, A. Chu, I. Goodfellow, H. B. McMahan, I. Mironov, K. Talwar, and L. Zhang, "Deep learning with differential privacy," in Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, 2016, pp. 308–318. [2] Z. Bu, H. Wang, Q. Long, and W. J. Su, "On the convergence of deep learning with differential privacy," arXiv e-prints, pp. arXiv–2106, 2021. [3] D. Chen, S.-c. S. Cheung, C.-N. Chuah, and S. Ozonoff, "Differentially private generative adversarial networks with model inversion," in 2021 IEEE International Workshop on Information Forensics and Security (WIFS). IEEE, 2021, pp. 1–6. [4] A. Krizhevsky, G. Hinton et al., "Learning multiple layers of features from tiny images," 2009. [5] Y. Netzer, T. Wang, A. Coates, A. Bissacco, B. Wu, and A. Y. Ng, "Reading digits in natural images with unsupervised feature learning," 2011. [6] C. Dwork, A. Roth et al., "The algorithmic foundations of differential privacy." Foundations and Trends in Theoretical Computer Science, vol. 9, no. 3-4, pp. 211–407, 2014. [7] N. Papernot, S. Song, I. Mironov, A. Raghunathan, K. Talwar, and U. Erlingsson, "Scalable Private Learning with PATE," in International Conference on Learning Representations, 2018. [8] F. Harder, M. Jalali, D. J. Sutherland, and M. Park, "Pre-trained perceptual features improve differentially private image generation," Transactions on Machine Learning Research, 2023. [9] L. Fan, "A survey of differentially private generative adversarial net- works," in The AAAI Workshop on Privacy-Preserving Artificial Intelli- gence, 2020. [10] D. Chen, T. Orekondy, and M. Fritz, "GS-WGAN: A gradient-sanitized approach for learning differentially private generators," Advances in Neural Information Processing Systems, vol. 33, 2020. [11] J. Jordon, J. Yoon, and M. van der Schaar, "PATE-GAN: Generating synthetic data with differential privacy guarantees," in International Conference on Learning Representations, 2018. [12] Y. Long, B. Wang, Z. Yang, B. Kailkhura, A. Zhang, C. Gunter, and B. Li, "G-PATE: scalable differentially private data generator via private aggregation of teacher discriminators," Advances in Neural Information Processing Systems, vol. 34, pp. 2965–2977, 2021. [13] C. N. d. Santos, Y. Mroueh, I. Padhi, and P. Dognin, "Learning implicit generative models by matching perceptual features," in Proceedings of the IEEE/CVF International Conference on Computer Vision, 2019, pp. 4461–4470. [14] F. Harder, K. Adamczewski, and M. Park, "DP-MERF: Differentially private mean embeddings with randomfeatures for practical privacy- preserving data generation," in International conference on artificial intelligence and statistics. PMLR, 2021, pp. 1819–1827. [15] I. Mironov, "R ́enyi differential privacy," in 2017 IEEE 30th Computer Security Foundations Symposium (CSF). IEEE, 2017, pp. 263–275. [16] M. Arjovsky, S. Chintala, and L. Bottou, "Wasserstein GAN," arXiv preprint arXiv:1701.07875, 2017. [17] S. Shalev-Shwartz and S. Ben-David, Understanding machine learning: From theory to algorithms. Cambridge university press, 2014. [18] M. Marchesi, "Megapixel size image creation using generative adver- sarial networks," arXiv preprint arXiv:1706.00082, 2017. [19] L. Xie, K. Lin, S. Wang, F. Wang, and J. Zhou, "Differentially private generative adversarial network," arXiv preprint arXiv:1802.06739, 2018. [20] A. Borji, "Pros and Cons of GAN evaluation measures: New develop- ments," arXiv preprint arXiv:2103.09396, 2021.
http://arxiv.org/abs/2310.04521v1
"2023-10-06T18:34:27"
"2023-10-06T18:34:27"
Lie Neurons: Adjoint-Equivariant Neural Networks for Semisimple Lie Algebras
This paper proposes an adjoint-equivariant neural network that takes Lie algebra data as input. Various types of equivariant neural networks have been proposed in the literature, which treat the input data as elements in a vector space carrying certain types of transformations. In comparison, we aim to process inputs that are transformations between vector spaces. The change of basis on transformation is described by conjugations, inducing the adjoint-equivariance relationship that our model is designed to capture. Leveraging the invariance property of the Killing form, the proposed network is a general framework that works for arbitrary semisimple Lie algebras. Our network possesses a simple structure that can be viewed as a Lie algebraic generalization of a multi-layer perceptron (MLP). This work extends the application of equivariant feature learning. As an example, we showcase its value in homography modeling using sl(3) Lie algebra.
[ "Tzu-Yuan Lin", "Minghan Zhu", "Maani Ghaffari" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04521v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04521v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI" ]
3 2 0 2 t c O 6 ] G L . s c [ 1 v 1 2 5 4 0 . 0 1 3 2 : v i X r a Arxiv Preprint LIE NEURONS: ADJOINT-EQUIVARIANT NEURAL NET- WORKS FOR SEMISIMPLE LIE ALGEBRAS Tzu-Yuan Lin∗, Minghan Zhu∗, Maani Ghaffari University of Michigan, Ann Arbor, MI, USA {tzuyuan,minghanz,maanigj}@umich.edu ABSTRACT This paper proposes an adjoint-equivariant neural network that takes Lie algebra data as input. Various types of equivariant neural networks have been proposed in the literature, which treat the input data as elements in a vector space carrying certain types of transformations. In comparison, we aim to process inputs that are transformations between vector spaces. The change of basis on transforma- tion is described by conjugations, inducing the adjoint-equivariance relationship that our model is designed to capture. Leveraging the invariance property of the Killing form, the proposed network is a general framework that works for arbi- trary semisimple Lie algebras. Our network possesses a simple structure that can be viewed as a Lie algebraic generalization of a multi-layer perceptron (MLP). This work extends the application of equivariant feature learning. As an example, we showcase its value in homography modeling using sl(3) Lie algebra. 1 INTRODUCTION Respecting the symmetry in data is essential for deep learning models to understand the underlying objects. The fundamental rules of a process and the definition of a concept are typically buried in certain types of symmetries. For example, the conservation of mechanical energy is independent of the choice of inertial reference frame. The internal angles of an equilateral triangle are 60 degrees regardless of its orientation and size. Equivariant networks refer to deep learning models that decou- ple certain types of transformations from the variance in the data so that the essential characteristics can be better learned from the preserved symmetry. The most well-known example of equivariance in deep learning is the convolutional neural networks (CNNs), which are translation-equivariant, enabling stable image features regardless of the pixel positions in the image plane. CNNs are pre- vailing, and we usually only call models that extend equivariance beyond translation equivariant networks. Typical extensions include rotation (Cohen et al., 2017) and scale (Worrall & Welling, 2019) equivariance, while more general extensions are also explored (MacDonald et al., 2022). Compared with non-equivariant models, which impose no structure on the input data, equivariant models regard the input data as elements in a vector space (typically represented as vectors) that carries certain types of transformation (typically represented as matrices). The set of transformations often belongs to a group. A group action on the data is realized through (left) matrix multiplication on the vectors, which can be viewed as a change of basis for the vectors. The equivariance property preserves such structures in both the input and output spaces. This is a general formulation that is true for most existing equivariant models and has gained success in various domains, including but not limited to the modeling of molecules (Thomas et al., 2018), physical systems (Finzi et al., 2020), social networks (Maron et al., 2018), images (Worrall et al., 2017), and point clouds (Zhu et al., 2023). In this paper, we propose a new type of equivariant model that captures the symmetry in conjugacy classes. We view the input data of our model not as elements in a vector space but as transformations (maps) between vector spaces, typically represented as matrices for linear groups. Accordingly, group action on the input data stands for a change of basis on the transformations, which is also known as conjugation. The input data as transformations, when viewed as a continuous symmetry group, form a Lie group. To facilitate the numerical computation, the proposed network takes the ∗The authors have equal contributions. 1 Arxiv Preprint Figure 1: Comparison between existing equivariant networks and our work. Red represents the underlying objects to be studied by the models. For example, a commonly studies type of object in existing equivariant networks is shapes. For our work, the studied object is transformations. Given a reference frame, we obtain an observation of the studied object illustrated in yellow. For existing equivariant networks, the inputs are represented as vectors (including tensors). For our work, the inputs are represented as matrices. Change of basis, illustrated in blue, acts on vectors by left multiplication while acting on transformations by conjugation. transformations to the Lie algebra. The Lie algebraic approach is particularly attractive as it enables working in vector spaces and exploiting its isometry structure to handle data in typical vector-form data. However, we reiterate that our network models the conjugation equivariance on transformation input or, equivalently, the adjoint equivariance on the corresponding Lie algebra. One way to intu- itively understand the relations between existing equivariant networks and our proposed network is illustrated in Figure 1. Overall, the contributions of our paper are summarized as follows: • We propose a new adjoint-equivariant network architecture, enabling the processing of input data that represent transformations. • We develop new network designs using the Killing form and the Lie bracket structure for equivariant activation and invariant layers for Lie algebraic representation learning. • The proposed network models the equivariance of any semisimple Lie algebras, which relaxes the requirement in previous work Deng et al. (2021) for the Lie group to be compact. • We open-source our code at: https://github.com/UMich-CURLY/LieNeurons. 2 RELATED WORK Equivariant networks enable the model output to change in a predicted way as the input goes through certain transformations. This means that the model, by construction, generalizes over the variations caused by those transformations. Therefore, it reduces the sampling complexity in learning and im- proves the robustness and transparency facing input variations. Cohen & Welling (2016a) initials the idea to generalize equivariance in deep learning models, realizing equivariance to 90-degree rotations in a 2D image plane using group convolution. This method works with discrete trans- formations by augmenting the input domain with a dimension for the set of transformations. The approach is generalized to other discretized groups in SE(2), SE(3), and E(3) (Hoogeboom et al., 2018; Winkels & Cohen, 2018; Worrall & Brostow, 2018; Chen et al., 2021). Steerable convolution is proposed in Cohen & Welling (2016b), leveraging the irreducible representations to remove the need for discretization and facilitate equivariant convolution on continuous groups in the frequency domain (Worrall et al., 2017; Cohen et al., 2017; Weiler et al., 2018). Beyond convolutions, more general equivariant network architectures are proposed, for example, Fuchs et al. (2020); Hutchin- son et al. (2021); Chatzipantazis et al. (2022) for transformers and Batzner et al. (2022); Brandstetter et al. (2021) for message passing networks. Vector Neurons (Deng et al., 2021) designs a multi-layer perception (MLP) and graph network that generalize the scalar features to 3D features to realize 2 Arxiv Preprint SO(3)-equivariance on spatial data. The above works mainly focus on compact groups, on which more general recipes for building equivariant layers that are not limited to a specific group are also proposed (Kondor & Trivedi, 2018; Cohen et al., 2019; Weiler & Cesa, 2019; Xu et al., 2022; Lang & Weiler, 2020). The extension of equivariance beyond compact groups is also explored. Finzi et al. (2021) constructs MLPs equivariant to arbitrary matrix groups using their finite-dimensional representations. With the Monte Carlo estimator, equivariant convolutions are generalized to matrix groups with surjective exponential maps (Finzi et al., 2020) and all finite-dimensional Lie groups (MacDonald et al., 2022), where Lie algebra is used to parameterize elements in the continuous Lie groups as a lifted domain from the input space. Our model structure resembles the MLP style of Vector Neurons (Deng et al., 2021), but our work models the equivariance of arbitrary semisimple groups under adjoint actions. Lie algebra is the input space of our network, representing transformation data. 3 PRELIMINARIES In this section, we provide some preliminaries for Lie groups. Specifically, we focus on matrix Lie groups. For more detailed explanations, we refer the readers to Hall (2013); Rossmann (2006); Kirillov (2008). 3.1 LIE GROUP AND LIE ALGEBRA A Lie group G is a smooth manifold whose elements satisfy the group axioms. Because of this, a special vector space naturally arises at the identity of every Lie group named the Lie algebra, denoted g. A Lie algebra locally captures the structure of the Lie group. It is possible to move from a Lie group to a Lie algebra around the identity and vice versa. This is achieved by employing the exponential and log maps: Exp : Log : g → G, X (cid:55)→ Exp(X) G → g, a (cid:55)→ Log(a). (1) (2) For a matrix Lie group, the exponential map is the matrix exponential, and the log map is the matrix logarithm. In addition to the exponential map, every Lie algebra is equipped with an asymmetric binary operator called the Lie bracket: [*, *] : g × g → g. (3) The elements of the Lie algebra have non-trivial structures. However, since the Lie algebra is a vector space, for a Lie algebra of dimension m, we can always represent it using Rm given appropriate bases. As a result, we introduce two useful functions: Vee : g → Rm, x∧ (cid:55)→ (x∧)∨ = m (cid:88) i=1 xiei Hat : Rm → g, x (cid:55)→ x∧ = m (cid:88) i=1 xiEi, (4) (5) where ei are the canonical basis of Rm and Ei = (ei)∧ ∈ g. Using the Hat and Vee maps, we can represent an element of the Lie algebra in a neural network using Rm, while performing structure- preserving operations on g. 3.2 ADJOINT REPRESENTATION Given an element of the Lie algebra X ∈ g and its corresponding Lie group G, every a ∈ G defines an automorphism of the Lie algebra Ada : g → g by Ada(X) = aXa−1. This is called the adjoint action of the group G on the Lie algebra g. It represents the change of basis operations on the algebra. Since the adjoint Ada is linear, we can find a matrix that maps the Rm representation of the Lie algebra to another. That is, for every Ada and X ∈ g, we have (6) Adma : Rm → Rm, x (cid:55)→ Admax, (7) 3 Arxiv Preprint with Adma ∈ Rm×m, x∧ = X and Admax = (ax∧a−1)∨. This is an important property as it allows us to model the group adjoint action using a matrix multiplication on Rm, which enables the adjoint equivariant layer design in Section 4. Conversely, if we view the Ad as a function of a group element a ∈ G, it maps the group element to a Lie algebra automorphism: Ad : G → Aut(g), a (cid:55)→ Ada. (8) This Ad is called the adjoint representation of the group. Similarly, we can obtain the adjoint representation of the Lie algebra by differentiating the adjoint representation of the group at the identity: ad : g → Der(g), X (cid:55)→ adX (*) = [X, *] , (9) where Der(g) is the Lie algebra of Aut(g), and [*, *] is the Lie bracket of the Lie algebra. For a matrix group, the Lie bracket is defined by the commutator: [X, Y ] = XY − Y X. It is worth noticing that the Lie bracket is equivariant under the group adjoint action. 3.3 KILLING FORM If a Lie algebra g is of finite dimension and associated with a field R, a symmetric bilinear form called the Killing form is defined as: B(X, Y ) : g × g → R, (X, Y ) (cid:55)→ tr(adX ◦ adY ) (10) Definition 1 A bilinear form B(X, Y ) is said to be non-degenerate iff B(X, Y ) = 0 for all Y ∈ g implies X = 0. Theorem 1 (Kirillov (2008)) A Lie algebra is semisimple iff the Killing form is non-degenerate.1 Theorem 2 (Kirillov (2008)) The Killing form is invariant under the group adjoint action Ada for all a ∈ G, i.e., B(Ada ◦ X, Ada ◦ Y ) = B(X, Y ). If the Lie group is also compact, the Killing form is negative definite, and the inner product naturally arises from the negative of the Killing form. 4 METHODOLOGY We present Lie Neurons (LN), a general adjoint-equivariant neural network on Lie algebras. It is greatly inspired by Vector Neurons (VN) (Deng et al., 2021). The Lie Neurons generalize the 3- dimensional SO(3) equivariant VN to a K-dimensional network that is equivariant by construction for any semisimple Lie algebra. Different from the VN, the Lie Neurons take elements of a Lie algebra as inputs, and they capture the equivariance of a Lie group under the adjoint action. We will discuss how the Lie Neuron almost specializes to the VN later in Section 4.5. Here, we start by describing the network structure of Lie Neurons. The standard multilayer perceptron (MLP) networks are constructed with scalar neurons, z ∈ R. For each layer, the neurons are concatenated in the feature dimension into a C (d)-dim vector z ∈ RC(d) , where d denotes the layer index. Vector Neurons lift the neuron representation from scalars to R3. For an input composed of a set of N points (e.g., a point cloud), the features learned from a VN layer are of shape R3×C(d)×N . The Lie Neurons generalize Vector Neurons. Each Lie Neuron, X ∈ g, is an element of a semisimple Lie algebra. A Lie algebra is a vector space with non-trivial structures. However, using (4), we can express the neuron in x = X ∨ ∈ RK with appropriate bases. Similar to Vector Neurons, the features learned from a Lie Neuron layer are X (d) = {xi}N i=1 ∈ RK×C(d)×N , where xi ∈ RK×C(d) . By construction, the LN are equivariant to the group adjoint action (also known as similarity trans- form in matrix groups). In particular, for a given element a in a semisimple Lie group G, we have f (aX a−1; θ) = af (X ; θ)a−1, (11) 1This is also known as the Cartan's Criterion. 4 Arxiv Preprint where f is the function defined by an LN model with parameters θ. 2 The Lie Neurons framework consists of a linear layer, two nonlinear activation layers, a pooling layer, and an invariant layer. We start by discussing the linear layers as follows. 4.1 LINEAR LAYERS Linear layers are the basic building blocks of an MLP. A linear layer has a learnable weight matrix W ∈ RC×C′ , which operates on input features x ∈ RK×C by left matrix multiplication: x′ = fLN-Linear(x; W) = xW ∈ RK×C′ Recall (7), if we use the vector representation x ∈ RK for X ∈ g, we can always find a linear adjoint matrix Adma ∈ RK×Ksuch that Admax = aXa−1. As a result, the adjoint action on the linear layer becomes: (12) . fLN-Linear(Ada(x); W) = fLN-Linear(Admax; W) = AdmaxW ∈ RK×C′ = AdmafLN-Linear(x; W) = Ada(fLN-Linear(x; W)), (13) which proves the equivariant property of the linear layer. It is worth mentioning that we ignore the bias term to preserve the equivariance. Lastly, similar to the Vector Neurons, the weights may or may not be shared across the elements x of X . 4.2 NONLINEAR LAYERS Nonlinear layers enable the neural network to approximate complicated functions. We propose two designs for the equivariant nonlinear layers, LN-ReLU and LN-Bracket. 4.2.1 LN-RELU: NONLINEARITY BASED ON THE KILLING FORM We can use an invariant function to construct an equivariant nonlinear layer. The VN leverages the inner product in a standard vector space, which is invariant to SO(3), to design a vector ReLU nonlinear layer. We generalize this idea by replacing the inner product with the negative of the Killing form. As described in Section 3, the negative Killing form falls back to the inner product for compact semisimple Lie groups, and it is invariant to the group adjoint action. For an input x ∈ RK×C, a Killing form B(*, *), and a learnable weight U ∈ RC×C, the nonlinear layer fLN-ReLU is defined as: fLN-ReLU(x) = (cid:26)x, x + B(x, d)d, if B(x, d) ≤ 0 otherwise, (14) where d = xU ∈ RK×C is the learnable direction. Optionally, we can share the learned direction across channels by setting U ∈ RC×1. From Theorem 2, we know the Killing form is invariant under the group adjoint action, and the equivariance of the learned direction is proven in (13). Therefore, the second output of (14) becomes a linear combination of two equivariant quantities. As a result, the nonlinear layer is equivariant to the adjoint action. We can also construct variants of ReLU, such as the leaky ReLU in the following form: fLN-LeakyReLU = αx + (1 − α)fReLU(x). (15) 4.2.2 LN-BRACKET: NONLINEARITY BASED ON THE LIE BRACKET As introduced in Section 3, Lie algebra is a vector space with an extra binary operator called Lie bracket, which is equivariant under group adjoint actions. For a matrix Lie group, the Lie bracket 2We slightly abuse the notation here by setting aX a−1 = {{(a(xij)∧a−1)∨}C(d) i=1 }N j=1. 5 Arxiv Preprint of its Lie algebra is defined using the commutator: [X, Y ] = XY − Y X. We use this operation to build a novel nonlinear layer. We use two learnable weight matrices U, V ∈ RC×C to map the input to different Lie algebra vectors, u = xU, v = xV . The Lie bracket of u and v becomes a nonlinear function on the input: x (cid:55)→ [(xU )∧, (xV )∧]. Theoretically, we can directly use it as our nonlinear layer. However, we note that the Lie bracket essentially captures the failure of matrices to commute. (Guggenheimer, 2012), and that [X, X] = 0, ∀X. We find that when using two learnable Lie algebra elements from the same input, the Lie bracket cancels out most of the information and only passes through the residual. As a result, we add a residual path to enhance the information flow, inspired by ResNet (He et al., 2016). The final design of the LN-Bracket layer becomes: fLN-Bracket(x) = x + [(xU )∧, (xV )∧]∨. The nonlinear layer is often combined with a linear layer to form a module. In the rest of the paper, we will use LN-LR to denote an LN-Linear followed by an LN-ReLU, and LN-LB to denote an LN-Linear with an LN-Bracket layer. (16) 4.3 POOLING LAYERS Pooling layers provide a means to aggregate global information across the N observation points within one measurement. This can be done by mean pooling, which is adjoint equivariant. In n=1 ∈ RK×C×N , and a addition, we also introduce a max pooling layer. For each input X = {xn}N weight matrix W ∈ RC×C, we learn a set of directions as: D = {xnW}N n=1. We again employ the Killing form, B(*, *), as the invariant function. For each channel c ∈ C, we have the max pooling function as fLN-Max(xn) [c] = xn∗ [c], where n∗(c) = arg max n B(xn [c] W, xn [c]). (17) xn [c] denotes the input at channel c. Max pooling reduces the feature set from X ∈ RK×C×N to X ∈ RK×C×1. The layer is equivariant to the adjoint action due to the invariance of B(*, *). 4.4 INVARIANT LAYERS Equivariant layers allow steerable feature learning. However, some applications demand invariant features Lin et al. (2023); Zheng et al. (2022); Li et al. (2021). We introduce an invariant layer that can be attached to the network when necessary. Given an input x ∈ RK×C, we have: fLN-Inv(x) = B(x, x), (18) where B(*, *) is the adjoint-invariant Killing form, and fLN-Inv(x) ∈ R1×C. 4.5 RELATIONSHIP TO VECTOR NEURONS Our method can almost specialize to the Vector Neurons when working with so(3). This is because the linear adjoint matrix Adma is exactly the rotation matrix for so(3). Therefore, the group adjoint action becomes a left multiplication on the R3 representation of the Lie algebra. Moreover, SO(3) is a compact group. Thus, the negative Killing form of so(3) defines an inner product. We would like to note that we omit the normalization in the ReLU layer because the norm is not well defined when the Killing form is not negative definite. We also do not implement a batch normalization layer. Therefore, the Lie Neurons do not reduce to VN completely when working with so(3). Despite the similarity in appearance, the R3 vectors are viewed as vectors in Euclidean space subject to rotation matrix multiplication in Vector Neurons, while they are treated as so(3) Lie algebras in our framework, where the rotation matrices stand for conjugation. In addition, we propose a novel Lie bracket nonlinear layer. 5 EXPERIMENTS The Lie Neurons can be applied to any semisimple Lie algebra with a real matrix representation. This allows us to extend the network to operate on noncompact Lie algebras, such as the special linear Lie algebra sl(3). In this section, we instantiate the LN on sl(3), which can be represented us- ing traceless matrices. The corresponding group, the special linear group SL(3), can be represented 6 Arxiv Preprint Table 1: The mean squared errors and the invariant errors on the invariant function regression task. Id/Id denotes models trained and evaluated both on non-augmented data. Id/SL(3) denotes testing with data augmented by SL(3) adjoint action. ↓ means the lower the better. MSE Id/Id ↓ MSE Id/SL(3) ↓ Invariance Error ↓ MLP 0.143 5.566 1.359 LN-LR LN-LB LN-LR + LN-LB 0.103 0.103 0.002 0.558 0.558 4.9 × 10−5 0.115 0.115 9.0 × 10−4 using matrices with unit determinants. The special linear group has 8 degrees of freedom and can be used to model the homography transformation between images Hua et al. (2020); Zhan et al. (2022). We perform three different experiments to verify the LN. We first solve a regression problem on an invariant function, where the function maps two sl(3) elements to a real number. In the second experiment, we fit an equivariant function that maps from sl(3) to sl(3). Lastly, we formulate a classification problem, where we classify among three Platonic solids. Across all three experiments, we compare our method with a standard 3-layer MLP by flattening the input to RK∗C∗N . In addition, we set the feature dimension to 256 for all models. 5.1 INVARIANT FUNCTION REGRESSION We begin our evaluation with an invariant function fitting experiment. Given X, Y ∈ sl(3), we ask the network to regress the following function: g(X, Y ) = sin(tr(XY )) + cos(tr(Y Y )) − tr(Y Y )3 2 + det(XY ) + exp(tr(XX)). (19) We randomly generate 10, 000 training samples and 10, 000 testing samples. In addition, in order to evaluate the invariance of the learned network, we randomly apply 500 group adjoint action to each test sample to generate augmented testing data. In this task, we experiment with three different modules, LN-LR, LN-LB, and LN-LR + LN-LB, each followed by an LN-Inv and a final linear mapping from the feature dimension to a scalar. For each input, we concatenate X and Y in the feature dimension and have X ∈ RK×C×N = R8×2×1. We report the Mean Squared Error (MSE) and the invariance error in Table 1. The invariance error Einv is defined as: (cid:80)Nx i=1 (cid:80)Na j=1 f (Xi) − f (ajXia−1 j ) Einv := NxNa , (20) where a ∈ SL(3) are the randomly generated adjoint actions, Nx is the number of testing points, and Na is the number of conjugations. The invariance error measures the adjoint invariance property of the networks. From the table, we see that the LN outperforms MLP except for LN-LB. When tested on the SL(3) augmented test set, the performance of the LN remains consistent, while the error from the MLP increases significantly. The results of the invariance error demonstrate that the proposed method is invariant to the adjoint action while the MLP is not. In this experiment, we observe that LN-LR performs well on the invariant task, but the LN-LB alone does not. Nevertheless, if we combine both nonlinearities, the performance remains competitive. 5.2 EQUIVARIANT FUNCTION REGRESSION In the second experiment, we ask the network to fit an equivariant function that takes two elements on sl(3) back to itself: h(X, Y ) = [[X, Y ] , Y ] + [Y, X] . (21) Similar to the first experiment, we generate 10, 000 training and test samples, as well as the addi- tional 500 adjoint actions on the test set. We again report the MSE on the regular test set. For the adjoint-augmented test set, we map the output back with the inverse adjoint action and compute the 7 Arxiv Preprint Table 2: The mean squared errors and the equivariant errors in equivariant function regression. MSE Id/Id ↓ MSE Id/SL(3) ↓ Equivariance Error ↓ MLP 0.009 2.025 0.445 2 LN-LR 0.213 0.213 1.0 × 10−4 2 LN-LB 9.6 × 10−10 4.5 × 10−8 6.5 × 10−5 2 LN-LR + 2 LN-LB 2.2 × 10−6 2.2 × 10−6 7.9 × 10−5 MSE with the ground truth value. To evaluate the equivariance of the network, we compute the equivariance error Eequiv as: (cid:80)Nx i=1 Eequiv := (cid:80)Na j=1 ajf (Xi)a−1 NxNa j − f (ajXia−1 j ) . (22) In this experiment, we evaluate LN using 3 different architectures. They are 2 LN-LR, 2 LN-LB, and 2 LN-LR + 2 LN-LB, respectively. Each of them is followed by a regular linear layer to map the feature dimension back to 1. Table 2 lists the results of the equivariant experiment. We see that the MLP performs well on the regular test set but fails to generalize to the augmented data. Moreover, it has a high equivariance error. Our methods, on the other hand, generalize well on the adjoint-augmented data and achieve the lowest errors. The 2 LN-LB model performs the best. From both the invariant and equivariant experiments, we observe that the LN-LR module works better on invariant tasks, while the LN-LB module performs better on the equivariant ones. We speculate this is because the LN-LR relies on the Killing form, which is an adjoint-invariant func- tion, while the LN-LB leverages the Lie bracket, which is adjoint-equivariant. Nevertheless, if we combine both modules, the network performs favorably on both invariant and equivariant tasks. 5.3 PLATONIC SOLID CLASSIFICATION Other than the numerical experiments above, we further design an experiment with practical mean- ings to hint at the real-world implications of the proposed network. The task is to classify polyhe- drons from their projection on an image plane. While rotation equivariance naturally emerges for the 3D shape, the rotation equivariance relation is lost in the 2D projection of the 3D polyhedrons. In- stead, the projection yields homography relations, which can be modeled using the SL(3) group Hua et al. (2020); Zhan et al. (2022). When projected onto an image plane, the two neighboring faces of a polyhedron can be described using homography transformations, which are different for each polyhedron type. Therefore, we use the homography transforms among the projected neighboring faces as the input for polyhedron classification. Without loss of generality, we assume the camera intrinsic matrix K to be identity. In this case, given a homography matrix H ∈ SL(3) that maps one face to another in the image plane, the homography between these two faces becomes RHR−1 when we rotate the camera by R ∈ SO(3) ⊂ SL(3). In this experiment, we use three types of Platonic solids: a tetrahedron, an octahedron, and an icosahedron. An input data point refers to the homography transforms between the projection of a pair of neighboring faces within one image. Figure 2 visualizes an example of the neighboring face pair for the three Platonic solids. The homographies of all neighboring face pairs form a complete set of data describing a Platonic solid. We use these data to learn a classification model of the three Platonic solids. During training, we fix the camera and object pose. Then, we test with the original pose and with rotated camera poses to verify the equivariance property of our models. We once again test with LN-LR, LN-LB, and LN-LR+LN-LB. Each of them is followed by an LN-Max layer, an LN-Inv layer, and a final linear mapping. Table 3 shows the classification accuracy. The LN achieves higher accuracy than the MLP. Since the MLP is not invariant to the adjoint action, its accuracy drops drastically when the camera is rotated. We also notice that the LN-LB performs slightly worse than the other two formulations. This agrees with our previous observations, as the classification tasks rely mostly on invariant features. 8 Arxiv Preprint (a) Tetrahedron (b) Octahedron (c) Icosahedron Figure 2: A visualization of the three Platonic solids in our classification task. The yellow and blue colors highlight a neighboring pair of faces, between which the homography transforms in the image plane are taken as input to our models. Table 3: The accuracy of the Platonic solid classification task using the inter-face homography transforms in the image plane as inputs. ↑ means the higher, the better. Accuracy ↑ Accuracy (Rotated) ↑ MLP 0.967 0.385 LN-LR LN-LB LN-LR + LN-LB 0.994 0.994 0.986 0.979 0.998 0.997 5.4 ABLATION STUDY We introduce the LN-Bracket layer in Section 4.2.2 and discuss how the residual connec- tion improves the performance. In this subsection, we perform ablation studies on an alternative Lie bracket nonlinear layer design without the residual connection. That is, fLN-Bracket-N(x) = [(xU )∧, (xV )∧]∨. We denote this nonlinear layer combined with an LN-Linear as LN-LBN and show the results of this method in Table 4. From the table, we can clearly see the benefits of having the residual connection in the Lie bracket layer. 6 DISCUSSION AND LIMITATIONS Lie Neurons is a group adjoint equivariant network by construction. It does not require the Lie group to be compact. However, the LN-ReLU layer relies on a non-degenerated Killing form. As a result, the current formulation can only operate on semisimple Lie algebras. Secondly, the Lie Neurons take elements on the Lie algebra as inputs, but most modern sensors return measurements in standard vector spaces. More practical applications of the proposed work are yet to be explored. Lastly, although the Lie Neurons contain only simple layer structures, their scalability is yet to be verified. 7 CONCLUSION In this paper, we propose an adjoint-equivariant network, Lie Neurons. Compared with existing equivariant models, our proposed framework extends the scope of equivariance by modeling the symmetry of change-of-basis on transformations, rather than vectors. Our model is generally ap- plicable to any semisimple Lie groups, compact or non-compact. Our network builds upon simple MLP-style layers. To facilitate the learning of expressive Lie algebraic features, we propose equiv- ariant nonlinear activation functions based on the Killing form and the Lie bracket. We also design an equivariant pooling layer and an invariant layer to extract global equivariant features and invariant features. In the experiments, we verify the equivariance property and the ability to fit equivariant and invariant targets of our model in regression and classification tasks, with sl(3) as an example. We believe the new paradigm of transformation feature learning could open new possibilities in both equivariant modeling and more general deep learning. 9 Arxiv Preprint Table 4: The ablation study of the Lie bracket layer in all three tasks. LN-LBN denotes the Lie bracket layer without the residual connection. Invariant Regression Equivariant Regression Classification LN-LB LN-LBN MSE ↓ MSE SL(3) ↓ 0.558 4.838 0.558 4.838 Einv ↓ 4.9 × 10−5 2.4 × 10−5 MSE ↓ 9.6 × 10−10 0.276 MSE SL(3) ↓ 4.5 × 10−8 0.276 Eequiv ↓ 6.5 × 10−5 2.7 × 10−3 Acc ↑ Acc (Rotated) ↑ 0.986 0.967 0.979 0.959 REFERENCES Simon Batzner, Albert Musaelian, Lixin Sun, Mario Geiger, Jonathan P Mailoa, Mordechai Korn- bluth, Nicola Molinari, Tess E Smidt, and Boris Kozinsky. E(3)-equivariant graph neural networks for data-efficient and accurate interatomic potentials. Nature communications, 13(1):1–11, 2022. Johannes Brandstetter, Rob Hesselink, Elise van der Pol, Erik Bekkers, and Max Welling. Ge- arXiv preprint ometric and physical quantities improve E(3) equivariant message passing. arXiv:2110.02905, 2021. Evangelos Chatzipantazis, Stefanos Pertigkiozoglou, Edgar Dobriban, and Kostas Daniilidis. Se (3)-equivariant attention networks for shape reconstruction in function space. arXiv preprint arXiv:2204.02394, 2022. Haiwei Chen, Shichen Liu, Weikai Chen, Hao Li, and Randall Hill. Equivariant point network for 3D point cloud analysis. pp. 14514–14523, 2021. Taco Cohen and Max Welling. Group equivariant convolutional networks. In International confer- ence on machine learning, pp. 2990–2999. PMLR, 2016a. Taco Cohen, Mario Geiger, Jonas K ̈ohler, and Max Welling. Convolutional networks for spherical signals. arXiv preprint arXiv:1709.04893, 2017. Taco S Cohen and Max Welling. Steerable cnns. arXiv preprint arXiv:1612.08498, 2016b. Taco S Cohen, Mario Geiger, and Maurice Weiler. A general theory of equivariant CNNs on homo- geneous spaces. 32, 2019. Congyue Deng, Or Litany, Yueqi Duan, Adrien Poulenard, Andrea Tagliasacchi, and Leonidas J Guibas. Vector neurons: A general framework for so (3)-equivariant networks. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 12200–12209, 2021. Marc Finzi, Samuel Stanton, Pavel Izmailov, and Andrew Gordon Wilson. Generalizing convolu- tional neural networks for equivariance to lie groups on arbitrary continuous data. In International Conference on Machine Learning, pp. 3165–3176. PMLR, 2020. Marc Finzi, Max Welling, and Andrew Gordon Wilson. A practical method for constructing equiv- ariant multilayer perceptrons for arbitrary matrix groups. In International Conference on Machine Learning, pp. 3318–3328. PMLR, 2021. Fabian Fuchs, Daniel Worrall, Volker Fischer, and Max Welling. SE(3)-transformers: 3D roto- translation equivariant attention networks. 33:1970–1981, 2020. Heinrich W Guggenheimer. Differential geometry. Courier Corporation, 2012. Brian C Hall. Lie groups, Lie algebras, and representations. Springer, 2013. Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recog- nition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. Emiel Hoogeboom, Jorn WT Peters, Taco S Cohen, and Max Welling. HexaConv. In International Conference on Learning Representations, 2018. 10 Arxiv Preprint Minh-Duc Hua, Jochen Trumpf, Tarek Hamel, Robert Mahony, and Pascal Morin. Nonlinear ob- server design on sl (3) for homography estimation by exploiting point and line correspondences with application to image stabilization. Automatica, 115:108858, 2020. Michael J Hutchinson, Charline Le Lan, Sheheryar Zaidi, Emilien Dupont, Yee Whye Teh, and Hyunjik Kim. Lietransformer: Equivariant self-attention for lie groups. In International Confer- ence on Machine Learning, pp. 4533–4543. PMLR, 2021. Alexander A Kirillov. An introduction to Lie groups and Lie algebras, volume 113. Cambridge University Press, 2008. Risi Kondor and Shubhendu Trivedi. On the generalization of equivariance and convolution in neural networks to the action of compact groups. In International Conference on Machine Learning, pp. 2747–2755. PMLR, 2018. Leon Lang and Maurice Weiler. A Wigner-Eckart theorem for group equivariant convolution kernels. arXiv preprint arXiv:2010.10952, 2020. Xianzhi Li, Ruihui Li, Guangyong Chen, Chi-Wing Fu, Daniel Cohen-Or, and Pheng-Ann Heng. A rotation-invariant framework for deep point cloud analysis. IEEE transactions on visualization and computer graphics, 28(12):4503–4514, 2021. Chien Erh Lin, Jingwei Song, Ray Zhang, Minghan Zhu, and Maani Ghaffari. Se (3)-equivariant point cloud-based place recognition. In Conference on Robot Learning, pp. 1520–1530. PMLR, 2023. Lachlan E MacDonald, Sameera Ramasinghe, and Simon Lucey. Enabling equivariance for arbitrary Lie groups. pp. 8183–8192, 2022. Haggai Maron, Heli Ben-Hamu, Nadav Shamir, and Yaron Lipman. Invariant and equivariant graph networks. In International Conference on Learning Representations, 2018. Wulf Rossmann. Lie groups: an introduction through linear groups, volume 5. Oxford University Press, USA, 2006. Nathaniel Thomas, Tess Smidt, Steven Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor field networks: Rotation-and translation-equivariant neural networks for 3d point clouds. arXiv preprint arXiv:1802.08219, 2018. Maurice Weiler and Gabriele Cesa. General E(2)-equivariant steerable CNNs. 32, 2019. Maurice Weiler, Mario Geiger, Max Welling, Wouter Boomsma, and Taco S Cohen. 3D steerable CNNs: Learning rotationally equivariant features in volumetric data. 31, 2018. Marysia Winkels and Taco S Cohen. 3D G-CNNs for pulmonary nodule detection. arXiv preprint arXiv:1804.04656, 2018. Daniel Worrall and Gabriel Brostow. CubeNet: Equivariance to 3D rotation and translation. pp. 567–584, 2018. Daniel Worrall and Max Welling. Deep scale-spaces: Equivariance over scale. Advances in Neural Information Processing Systems, 32, 2019. Daniel E Worrall, Stephan J Garbin, Daniyar Turmukhambetov, and Gabriel J Brostow. Harmonic networks: Deep translation and rotation equivariance. pp. 5028–5037, 2017. Yinshuang Xu, Jiahui Lei, Edgar Dobriban, and Kostas Daniilidis. Unified Fourier-based kernel and nonlinearity design for equivariant networks on homogeneous spaces. In International Confer- ence on Machine Learning, pp. 24596–24614. PMLR, 2022. Xinrui Zhan, Yang Li, Wenyu Liu, and Jianke Zhu. Warped convolution networks for homography estimation. arXiv preprint arXiv:2206.11657, 2022. Xiangtao Zheng, Hao Sun, Xiaoqiang Lu, and Wei Xie. Rotation-invariant attention network for hy- perspectral image classification. IEEE Transactions on Image Processing, 31:4251–4265, 2022. 11 Arxiv Preprint Minghan Zhu, Maani Ghaffari, William A Clark, and Huei Peng. E2pn: Efficient se (3)-equivariant In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern point network. Recognition, pp. 1223–1232, 2023. 12
http://arxiv.org/abs/2310.04519v1
"2023-10-06T18:28:33"
"2023-10-06T18:28:33"
SPADE: Sparsity-Guided Debugging for Deep Neural Networks
Interpretability, broadly defined as mechanisms for understanding why and how machine learning models reach their decisions, is one of the key open goals at the intersection of deep learning theory and practice. Towards this goal, multiple tools have been proposed to aid a human examiner in reasoning about a network's behavior in general or on a set of instances. However, the outputs of these tools-such as input saliency maps or neuron visualizations-are frequently difficult for a human to interpret, or even misleading, due, in particular, to the fact that neurons can be multifaceted, i.e., a single neuron can be associated with multiple distinct feature combinations. In this paper, we present a new general approach to address this problem, called SPADE, which, given a trained model and a target sample, uses sample-targeted pruning to provide a "trace" of the network's execution on the sample, reducing the network to the connections that are most relevant to the specific prediction. We demonstrate that preprocessing with SPADE significantly increases both the accuracy of image saliency maps across several interpretability methods and the usefulness of neuron visualizations, aiding humans in reasoning about network behavior. Our findings show that sample-specific pruning of connections can disentangle multifaceted neurons, leading to consistently improved interpretability.
[ "Arshia Soltani Moakhar", "Eugenia Iofinova", "Dan Alistarh" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2310.04519v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2310.04519v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 t c O 6 ] G L . s c [ 1 v 9 1 5 4 0 . 0 1 3 2 : v i X r a SPADE: SPARSITY-GUIDED DEBUGGING FOR DEEP NEURAL NETWORKS Arshia Soltani Moakhar ∗ IST Austria Eugenia Iofinova∗ IST Austria Dan Alistarh IST Austria & Neural Magic {arshia.soltanimoakhar, eugenia.iofinova, dan.alistarh}@ista.ac.at ABSTRACT Interpretability, broadly defined as mechanisms for understanding why and how machine learning models reach their decisions, is one of the key open goals at the intersection of deep learning theory and practice. Towards this goal, multiple tools have been proposed to aid a human examiner in reasoning about a network's behavior in general or on a set of instances. However, the outputs of these tools- such as input saliency maps or neuron visualizations-are frequently difficult for a human to interpret, or even misleading, due, in particular, to the fact that neurons can be multifaceted, i.e., a single neuron can be associated with multiple distinct feature combinations. In this paper, we present a new general approach to address this problem, called SPADE, which, given a trained model and a target sample, uses sample-targeted pruning to provide a "trace" of the network's execution on the sample, reducing the network to the connections that are most relevant to the specific prediction. We demonstrate that preprocessing with SPADE significantly increases both the accuracy of image saliency maps across several interpretability methods and the usefulness of neuron visualizations, aiding humans in reasoning about network behavior. Our findings show that sample-specific pruning of con- nections can disentangle multifaceted neurons, leading to consistently improved interpretability. 1 INTRODUCTION Neural network interpretability seeks mechanisms for understanding why and how deep neural net- works (DNNs) make decisions, and ranges from approaches which seek to link abstract concepts to structural network components, such as specific neurons, e.g., (Erhan et al., 2009; Yosinski et al., 2015; Mordvintsev et al.; Nguyen et al., 2016), to approaches which aim to trace individual model outputs on a per-sample basis, e.g., (Simonyan et al., 2013). While this area is developing rapidly, there is also work questioning the validity of localized explanations with respect to the model's true decision process, pointing out confounding factors across current explainability methods and metrics (Shetty et al., 2019; Rebuffi et al., 2020; Casper et al., 2023). One key confounder for interpretability the fact the neurons of a trained, accurate DNN are often multifaceted (Nguyen et al., 2016), in the sense that they respond to many different types of features, which may be unrelated. This phenomenon directly impacts interpretability methods, such as visual- izing inputs which maximize a neuron's activation: the resulting representative input superimposes salient features, and is therefore hard to interpret. Thus, there is significant effort in the litera- ture on addressing this issue: for instance, early work by Nguyen et al. (2016) proposed retraining the network with specialized regularizers which promote feature "disentanglement," whereas re- cently Wong et al. (2021) enforced output decisions to be based on very few features by retraining the final linear output layer from scratch to be extremely sparse. Yet, one key limitation of this line of work is that generating a "debuggable" model with disentangled representations requires heavy retraining of the original model. Beyond computational cost, a conceptual issue is that the interpre- tations generated on top of the "debuggable" model no longer correspond to the original model's predictions. In this paper, we propose an alternative approach called Sparsity-Guided Debugging (SPADE), which removes the above limitations, based on two main ideas: first, instead of retraining the model to become interpretable, we disentangle the feature representations for the model itself; second, this disentanglement is done for the individual sample for which we wish to obtain an interpretation. This procedure is performed efficiently, without the computational costs of retraining. ∗Equal contribution. Contact: eugenia.iofinova@ista.ac.at, dan.alistarh@ist.ac.at. 1 Figure 1: SPADE disambiguates feature visualizations and improves the accuracy of saliency maps. This model was trained with some of the training images augmented with Trojan patches. The visualization of the 'Albatross' class neuron consists of a mix of natural and Trojan features, which is difficult for a human to interpret. However, preprocessing a model using a albatross image or a sample with a Trojan patch decouples the bird and fish emoji facets. Likewise, preprocessing the network with SPADE before computing a saliency map concentrates it on the Trojan patch, correctly explaining the prediction into the 'Goose' class. Further examples are available in Appendix G. Concretely, given a DNN M and a sample s whose output M (s) we wish to interpret, SPADE functions as a pre-processing stage, in which we execute the sample s, together with a set of its augmentations, through the network layer-by-layer, sparsifying each layer maximally while ensuring that the output of the sparse layer still matches well with the original layer output on the sample. Thus, we obtain a sparse model Sparse(M, s), which matches the original on the sample s, but for which extraneous connections have been removed via sample-dependent pruning. Once the custom model Sparse(M, s) is obtained, we can execute any interpretability method on this subnetwork to extract a sample-specific feature visualization or saliency map. See Figure 1 for an illustration. SPADE can be implemented efficiently by leveraging solvers for accurate one-shot pruning, e.g., Frantar & Alistarh (2022), and can significantly improve performance across interpretabil- ity methods and applications. First, we illustrate SPADE by coupling it with 10 different inter- pretability techniques in the context of a DNN backdoor attack. Here, we find that, on a standard ResNet50/ImageNet setting, SPADE reduces the average error, taken across these methods, to less than half, from 9.91% to 4.22%. By comparison, the method of Wong et al. (2021), reduces error by 0.54% on average, in the same setup. In addition, the results of a user study we performed eval- uating the impact of SPADE on the quality of feature visualization shows that, in a setting where the ground truth is determined but unknown to the user, users were significantly more successful (69.8% vs 56.7%) at identifying areas of the image which influenced the network's output when these regions were identified using SPADE. In summary, our contributions are as follows: 1. We provide a new interpretability-enhancing technique called SPADE, which can be applied to arbitrary models and samples to create an easier-to-interpret model "trace" customized to the specific target sample. Intuitively, SPADE works by disentangling the neurons' superimposed feature representations via sparsification in a way that is sample-specific, which allows virtually all interpretability approaches to be more accurate. 2. We validate SPADE practically for image classification, by coupling it with several methods for feature visualization and generating saliency maps. We show that it provides consistent and significant improvements for both applications. Moreover, these improvements occur across all visualization methods studied, and for different models types and datasets. 3. We show that SPADE can be practical: it can be implemented in a computationally-efficient manner, executing in tens of minutes per instance on a single GPU. Moreover, through abla- tion studies, we examine the impact of task, augmentation strategy, target sample selection, and sparsity levels, showing that SPADE is robust to variations across parameters. 2 RELATED WORK As neural-network based models have been increasingly deployed in important or sensitive appli- cations, there has been a corresponding increase in community and media attention to systematic errors and biases often exhibited by these systems, e.g., Buolamwini & Gebru (2018). This has led 2 SPADE +SPADE +SPADE +NoPreprocessingNeuron VisualizationSaliency MapNo PreprocessingGooseAlbatrossClean sampleTrojan sampleTrojan sample to great interest in using various techniques to aid humans in examining and debugging the models' outputs. An overview of these approaches can be found in Linardatos et al. (2020). One common desideratum in this space is to predict which parts of an input (e.g., image pixels) are most useful to the final prediction. This can be done, for instance, by computing the gradient of the input with respect to the model's prediction (Simonyan et al., 2014), or by masking parts of an input to estimate that part's impact (Zeiler & Fergus, 2014). While these techniques can be helpful in diagnosing issues, they are also prone to noisy signals (Hooker et al., 2019) and being purpose- fully misled (Geirhos et al., 2023). Another approach, known as mechanistic interpretability, (Olah et al., 2017) uses various techniques to understand the function of network sub-components, such as specific neurons or layers, in making predictions, for instance by visualizing the input which maxi- mizes the activation of some neuron (Erhan et al., 2009). We emphasize that our work is not in direct competition with either of these categories of methods. Instead, our work proposes a preprocessing step to the model examination process, which should consistently improve performance. Subnetwork discovery. Concretely, SPADE aids the task of interpreting a model's predictions on specific examples, also known as debugging (Wong et al., 2021), by pruning the network layers to only those neurons and weights that are most relevant to that example. Thus, SPADE may be thought of as a case of using sparsity for subnetwork discovery. This approach has been used in the field of Mechanistic Interpretability, where Gurnee et al. (2023) uses sparse linear probes to find the most relevant units to a prediction. Cao et al. (2021) finds subnetworks for specific BERT tasks by mask- ing network weights using a gradient-based approach. Conversely, Meng et al. (2022) uses input corruption to trace out pathways in GPT models that are important for a specific example; however, their method is not based on pruning and is not evaluated in terms of interpretability metrics. Additionally, some works aim to train sparse, and therefore more debuggable, networks. Voita et al. (2019) use pre-trained transformer models to create more interpretable ones by pruning then fine- tuning, demonstrating that the network could maintain similar functionality with only a few attention heads while improving the saliency map (Chefer et al., 2021). Other methods have focused on training more interpretable sparse models from scratch, removing the issues inherent in retraining. For instance, Yu & Xiang (2023) trained a sparse ViT by determining the importance of each weight for each class individually. Their qualitative analysis showed that their sparse model was more interpretable than dense models. Similarly, Liu et al. (2023) proposed a sparse training method inspired by the brain. This approach allowed them to identify the modular role of individual neurons in small-scale problems. Most related, in Wong et al. (2021), the authors retrain the final fully-connected classification head of a trained network to be highly sparse, improving the attribution of predictions to the neurons in the preceding layer. This benefit arises because, after pruning, each class depends on fewer neurons from the previous layer, thus simplifying the task of individually examining connections. Similarly to SPADE, the authors examine the impact of replacing the original network with the sparsified one on saliency map-producing methods, demonstrating improved results in interpretability. Overview of Novelty. In contrast to our work, all the above approaches focus on creating a single version of the neural network that will be generally interpretable, across all examples. Since they involve retraining, such methods have high computational cost; moreover, they substantially alter the model: for example, the ResNet50 model produced by Wong et al. (2021) have 72.24% ImageNet accuracy, 1.70% less than their dense baseline. Conversely, SPADE can operate on any pretrained network, and creates a customized network pruned for each target, in one-shot, which can then consistently improve performance of almost any interpretability method. Further, we demonstrate in Section 3.2 that there is a high degree of agreement between the models generated by SPADE and the original model, and in Section 4.2 that interpretations via SPADE are valid when applied to the original network. As such, SPADE is the first method which leverages sparsity to provide interpretations that are consistent with the original network. 3 THE SPADE METHOD 3.1 ALGORITHM OVERVIEW We now describe our method, Sparsity-Guided Debugging (SPADE). At a high level, given a sample for which we wish to debug or interpret the network, SPADE works as a preprocessing step that uses 3 one-shot pruning to discover the most relevant subnetwork for the prediction of a specific example. We illustrate the SPADE process in Figure 2. We start with an arbitrary input sample chosen by the user, which we would like to interpret. SPADE then expands this sample to a batch of samples by applying augmentation techniques. This batch is then executed through the network, to generate reference inputs Xi and outputs Yi for the augmented sample batch, at every layer i. Given these inputs and outputs as constraints, for each layer i whose weights we denote by Wi, we wish to find a set of sparse weighs ̃Wi which best approximate the layer output Yi with respect to the input batch Xi. In our implementation, we adopt the l2 distance metric. Thus, for a linear layer, we would like to find ̃Wi = argminW sparse∥W Xi − Yi∥2 2. (1) To solve this constrained optimization problem at each layer, we use a custom sparsity solver (Fran- tar & Alistarh, 2022). We discuss specific implementation details in the next section. Once layer-wise pruning has completed, we have obtained a model that has been pruned specifically relative to our target sample and its augmentations. Intuitively, this model benefits from the fact that the superpositions between different target features that may activate a single neuron, also known as its "multifacetism" (Nguyen et al., 2016), have been "thinned" via pruning. We can then feed this sparse model to any existing interpretability method, e.g., Sundararajan et al. (2017); Zeiler & Fergus (2014); Olah et al. (2017). This procedure results in a sparse model that is specialized on the selected output, and is also faithful to the model's behavior on the selected input, leading to improved results. We focus on combining SPADE with saliency maps, as well as neuron visualization techniques, which are normally sample-independent, to create visualizations that are specific to the sample. Append a random augmentation of s to B ▷ M : Model, s: Sample, I: Interpretability Method B ← Empty ▷ Batch of Augmented samples for Augmentation Batch Size do 1: procedure SPADE ALGORITHM(M, s, I) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: Xi ← Layer Inputi(B) Yi ← Layer Outputi(B) end for for Each layer in M do end for for Each layer in M do ̃Wi ← argminW sparse∥W Xi − Yi∥2 Wi ← ̃Wi ▷ Replace weights with sparse ones 2 end for return I(M, s) ▷ Interpretability method on M, s 13: 14: 15: 16: end procedure Figure 2: (Left) The overall SPADE procedure: given an image and a model, SPADE prunes the model using image augmentations. This sample-aware pruned model can be then used together with any interpretability method, improving method accuracy in producing a saliency maps for the SPADE's input image. (Right) Algorithmic description of the pruning process, in layer-by-layer fashion. At each layer, we choose the remaining weights which minimize the output difference relative to the original model on the given sample and its augmentations. 3.2 IMPLEMENTATION DETAILS Pruning approach. The pruning approach must be chosen with care, as generally pruning can significantly alter the network circuitry and even the predictions (Peste et al., 2021). Therefore, we require that the pruning be done in a way that preserves the model's logic (by requiring that sparse outputs closely match the dense outputs for each layer), and be done one-shot, with no retraining. For this task, one can use one of the existing one-shot sparsity solvers, e.g. (Hubara et al., 2021; Frantar & Alistarh, 2023; 2022; Kuznedelev et al., 2023). We chose the OBC solver (Frantar & Alistarh, 2022), which provides an approximate solution to the l2 constrained problem in Equation 1. 4 Image AugmentationImage Specific Model PruningSPADEDense ModelSaliency MapPruned ModelInput ImageInterpretability Method Pruning is performed in parallel on all layers, with the input-output targets for each layer computed beforehand. Thus, the pruning decisions of each layer are independent of each other. Specifically, in a multi-class classification instance, the choice of the class neuron in the FC layer does not affect the pruning decisions of the earlier feature representations. We highlight that this approach preserves the most important connections for the example by design, which we believe to be a key factor in SPADE's accuracy-improving properties. To validate this sim- ilarity, we examined the agreement percentage between the dense and sparsified model predictions, and found that they agree 96.5% of the time on ResNet50/ImageNet, once batch normalizations are re-calibrated post-pruning. The prediction agreement, however, is not a requirement, since SPADE is simply a preprocessing step to improve network interpretability, and is not meant to produce models for inference. Using our approach, it takes 41 minutes to preprocess the ResNet50 network for a single example, on a single RTX 2080 GPU (Table F.15). By comparison, it takes 40 hours to preprocess the network with the FC pruning method of Wong et al. (2021). (However, we note that SPADE must be run once per sample or group of samples, and the FC pruning method is run once for all examples. Irrespective of runtime, experiments in the next section show that our approach is significantly more accurate in practice.) The SPADE runtime may be sped up by only sparsifying the final layers of the network at a small accuracy cost (see Appendix D), and possibly by using more efficient sparsity solvers (Frantar & Alistarh, 2023). We will explore the second direction in future work. Choosing sparsity ratios. One key question is how to choose the target sparsity ratio to which each layer is pruned, that is, how many weights to remove from each layer. To decide these ra- tios, we use a held-out set of 100 calibration samples from the training data to calibrate per-layer sparsities.Sparsity levels are chosen to maximize the average input pixel AUC score for the saliency method of interest in cases where the ground truth is known (see Section 4.1). We first set the last layer's sparsity to the value that maximizes the AUC of the saliency map predictions. Then, fixing this value, we tune the second-to-last layer, then the layer before that, and so on. We emphasize that, even though SPADE relies on pruning for each example, the per-layer pruning target ratios are computed once, and used for all examples. Further, we show in Section D that layer sparsity hy- perparameters tuned on ImageNet may be used for other datasets on the same network architecture, and we also present a heuristic-based approach to sparsity ratio tuning that may be used if tuning overhead is a concern in Appendix Section D.3. Sample augmentation. There are two motivations for employing augmentations. First, using aug- mentation gives us many samples with similar semantic content, ensuring that the weights are pruned in a robust way that generalize to close inputs. Second, having multiple samples allows us to meet a technical requirement of the OBC sparsity solver, which requires the Hessian matrix corresponding to the problem in Equation 1, specifically XiX ⊤ i , be non-singular, which is more likely for larger input batches. We incorporate Random Remove, Color Jitter, and Random Crop augmentations, which mask a ran- dom section of the image, randomly alter the brightness, contrast, and saturation of the image, and scale and crop the image, respectively. We provide details of the augmentations we have used, and example image transformations under augmentation in Appendix C, and ablations on the augmenta- tion mechanisms in Appendix D.2. 4 EXPERIMENTS Setup and Goals. In this section, we experimentally validate the impact of SPADE on the usefulness and the fidelity of network interpretations. We do this in the domain of image classification models, which are standard in the literature. Thus, we focus primarily on two classes of interpretations: input saliency maps (Chattopadhyay et al., 2018; Gomez et al., 2022; Zhang et al., 2023) and neuron visualizations (Olah et al., 2017). Our goals are to demonstrate the following: 1. Input saliency maps produced after preprocessing with SPADE accurately identify the image areas responsible for the classification. 2. Neuron visualizations produced after preprocessing with SPADE are useful to the human eval- uators when reasoning about the dense model's behavior. 5 For the first task, we create classification backdoors by using Trojan patches to cause a model to predictably misclassify some of the input images. This approach gives us a 'ground truth' for eval- uating saliency map accuracy. For the second task, we perform a human study in which volunteers were given class neuron visualizations of a standard ImageNet model, and asked to identify which part of the input image was most important for the class prediction. Crucially, the ground truth for this study, i.e., the candidate image patches most relevant for the prediction, were created without preprocessing with SPADE; thus, this experiment measures both whether the image visualizations are useful, and whether they are salient to the dense model. Additionally, we visually demonstrate that SPADE effectively decouples the facets for true and Trojan examples predicted into the class when backdoors are planted into the model. 4.1 IMPACT OF SPADE ON INPUT SALIENCY MAP ACCURACY Methodology. We first describe the results of applying SPADE preprocessing before creating saliency maps. Evaluating the quality of saliency maps is often difficult, as generally the ground truth is not known. Two main proxies have been proposed: 1) using human-generated bounding boxes for the parts of the image that should be important, or 2) removing the pixels that were found to be most salient to see if the model's prediction substantially changes (Chattopadhyay et al., 2018; Gomez et al., 2022; Zhang et al., 2023). Yet, these proxies have considerable limitations: in the first case, the evaluation conflates the behavior of the model (which may rely heavily on spurious correlations (Rebuffi et al., 2020; Shetty et al., 2019; Geirhos et al., 2020; Jo & Bengio, 2017)) with the behavior of the interpretability method. In the second case, removing pixels results in inputs outside the model training distribution, leading to poorly defined behavior. Therefore, we follow the recent methodology of Casper et al. (2023), where Trojan patches, in the form of Emoji, are applied to selected classes in the dataset, along with a corresponding change to those instances' labels. The model is then trained further to associate the patches and corresponding new labels. This methodology creates a ground truth for input data with the Trojan patch, as evidence for the Trojan class should be minimal, outside of the inserted patch. Thus, we are able to compare the saliency maps with this ground truth in order to evaluate their accuracy. We use two metrics to assign accuracy scores to saliency maps. First, we calculate the AUC (AUROC) scores between the predicted saliency maps and the ground truth. In this way, the evaluation is not affected by the scale of the saliency map weights but only by their ordering, ensuring that ajdustments don't need to be made between methods. Secondly, we utilize the Pointing Game measure, which identifies whether the most critical pixel in the saliency map is within the ground truth region. Detailed Setup. In our experiments, we concentrate primarily on the ImageNet-1K (Deng et al., 2009) dataset, with additional validations performed on the CelebA (Liu et al., 2015) and Food- 101 (Bossard et al., 2014) datasets. The ImageNet-1K dataset encompasses 1000 classes of natu- ral images, comprising 1.2 million training examples.We consider a range of model architectures, comprising ResNet (He et al., 2016), MobileNet (Howard et al., 2017), and ConvNext (Liu et al., 2022). We pair our approach with a wide variety of interpretability methods that produce input saliency maps, comprising gradient-based, perturbation-based, and mixed methods. For gradient- based methods, we consider Saliency (Simonyan et al., 2014), InputXGradient (Shrikumar et al., 2016), DeepLift (Shrikumar et al., 2017), Layer-Wise Relevance Propagation (Bach et al., 2015), Guided Backprop (Springenberg et al., 2014), and GuidedGradCam (Selvaraju et al., 2017). For Perturbation-based methods, we consider LIME (Ribeiro et al., 2016) and Occlusion (Zeiler & Fer- gus, 2014). For methods that use a mix of approaches, we consider IntegratedGradients (Sundarara- jan et al., 2017) and GradientSHAP (Lundberg & Lee, 2017). A description of the methods is available in Appendix Section A. We tune sparsity ratios separately for each method used. Training Details. We follow Casper et al. (2023) in randomly selecting 400 samples from the ImageNet-1K training set for each Trojan patche. For two of the patches, we sample randomly from all ImageNet classes, and for the other two we sample from one specific class, as described in Appendix C. We then finetune clean pretrained models to plant the backdoors. For experiments on ImageNet, we fine-tune the model using standard SGD-based training for six epochs, with learning rate decay at the third epoch. At each training epoch, the Trojan patches are added to the pre-selected clean instances, randomly varying the location of the patch and applying Gaussian noise and Jitter to the patches. The exact hyper-parameters are provided in Appendix C. 6 Table 1: Saliency map accuracy results on ResNet50/ImageNet, averaged across 140 test samples, compared to the dense model, and to the Sparse FC method of Wong et al. (2021). Saliency Method AUC Pointing Game Dense SPADE Sparse FC Dense SPADE Sparse FC Saliency InputXGradient DeepLift LRP GuidedBackprop GuidedGradCam LIME Occlusion IntegratedGradients GradientShap Average 86.92±7.85 83.77±10.21 93.47±4.17 90.05±8.52 95.22±3.73 97.82±1.68 91.93±8.32 86.09±11.51 87.86±8.63 87.74±8.66 90.09 95.32±7.5 93.73±8.59 95.85±3.92 99.11±0.81 96.45±4.68 98.12±1.64 95.84±3.73 93.73±9.53 94.77±8.19 94.85±7.35 95.78 87.19±7.57 84.05±0.95 93.61±2.42 93.49±8.08 95.27±3.95 97.79±4.22 92.57±9.09 85.79±24.35 88.33±1.44 88.23±1.53 90.63 83.92 67.83 89.51 72.73 87.5 90.91 70.63 89.51 81.12 81.12 81.41 93.71 88.81 90.91 96.5 86.81 93.71 69.23 86.71 88.81 88.11 87.22 81.94 66.67 89.58 81.94 86.81 90.97 70.83 88.19 83.33 81.94 82.22 Main Results. We benchmark our results against the method of Wong et al. (2021), which we will refer to for simplicity as "Sparse FC." Recall that this method completely retrains the final FC layer via heavy regularization, after which it applies existing interpretability methods. The results on the ImageNet/ResNet50 combination are shown in Table 1. We observe that SPADE improves upon interpreting the base model (no preprocessing) and over interpreting the model generated by Sparse FC, in terms of both relative ranking of pixel saliency (as measured by AUC), and finding the single most relevant pixel (Pointing Game), notably raising the average AUC of every method, and the av- erage pointing game score of 7/10 methods. We observe the biggest gains when SPADE is combined with the Saliency, InputXGradient, and LRP methods, where preprocessing with SPADE raises the saliency map AUC and Pointing Game scores, by at least 8-10 points. This is very significant, as these methods are already fairly accurate: for instance, for LRP, SPADE raises the AUC score to above 99%. On the negative side, while SPADE raises the Pointing Game scores of gradient-based methods, it slightly lowers those scores for the Occlusion and LIME methods, which rely on per- mutations. The average AUC improvement of our method is 5.69%, whereas the average improve- ment of SparseFC is 0.54%. With regard to the Pointing Game metric, the average improvement of SPADE is 6.81%, while the Sparse FC method's average improvement is 0.81%. Additional validation, and ablation study. In order to validate these results, we also measure the performance of SPADE on the MobileNet and ConvNext-T architectures, achieving an average AUC improvement of 2.90% for MobileNet and 3.99% for ConvNext. Full results are provided in Appendix B. In addition, we perform an ablation study (see Appendix D) of SPADE's most salient hyperparameters, with the following conclusions. First, the layer sparsity targets tuned on the ImageNet dataset transfer well to the CelebA and Food101 datasets. Additionally, it is possible to prune only the final block of the ResNet50 ar- chitecture with only a small drop in saliency map accuracy: this reduces the pruning time and resource usage of the sparsity solver significantly, where pruning speed and re- sources are a concern. Second, the choice of a single, augmented sample as the pruning dataset far outperforms other options, such as using a random selection from the same class. Finally, SPADE is fairly robust to the specific choice of augmentations applied to the example; however, the best results are obtained when a with a combination of Jitter and Random Crop. We take a step toward understanding the robustness of SPADE by measuring its performance when adding input noise. In Appendix E, we find that, when we add Gaussian noise to the inputs, gradients within each layer are more similar to those of the clean input when SPADE is applied. 4.2 IMPACT OF SPADE ON NEURON VISUALIZATION 4.2.1 RESOLVING MULTIFACETED NEURONS Feature visualization is an important tool for examining the working pattern of a neural network. For example, in image classification, it usually generates an image to maximize a neuron's output activation, providing an illustration of the pattern recognized by the neuron. Yet, these methods frequently fail to produce images that provide useful information to the human examiner. As sug- 7 Figure 3: Two-dimensional example to illustrate the effect of SPADE on feature visualization. The feature visualizations (images generated by Olah et al. (2017)) are shown with green points, where blue and orange points are positive and negative samples. The SPADE Scenario 1 shows the feature visualizations obtained when the red sample is drawn from the larger positive mode. Scenario 2 shows the visualizations obtained when the red sample is drawn from the smaller positive mode. gested by Ghiasi et al. (2022); Goh et al. (2021); Nguyen et al. (2016), this issue is in part due to the multifaceted nature of many neurons, i.e., each neuron being associated with several concepts. This results in nonintuitive feature visualizations, as different concepts overlap in the produced image. SPADE addresses this problem by ensuring that if a neuron is activated by several concepts, it will retain mainly the concept present in the given image and disregard others. Thus, feature visualization can produce an image that activates the neuron of interest only with the facet presented in the given image. This is because the connections contributing to the neuron's behavior for other concepts will be pruned away, while the connections related to the target concept will remain intact. This property is illustrated for a toy example in Figure 3. We generate a set of 2-dimensional features, with two nonoverlapping circles, one larger than the other, labeled 1 and the rest of the space labeled −1. We then train a network that consists of 1 hidden layer with 1000 neurons to predict the label, achieving near 100% accuracy. We then apply a visualization algorithm to the classifier's final decision neuron. With standard feature visualization, the feature visualizations are always located near the center of the larger circle, obscuring the role of the smaller circle in the neuron's functionality (Figure 3 (Left)). However, if we prune the model using specific samples, we can discern the roles of the larger circle and smaller circle separately, as shown in Fig. 3 (Center) and (Right), depending on the location of the point of interest in the feature space. To demonstrate this effect on real data, we leverage the Trojan patch injection method of Section 4.1. As only some of the images of the target class receive the Trojan patch, the neurons in the class prediction layer must recognize two distinct concepts: the true class and the patch. Thus, we see very different visualization results when we apply SPADE on a clean sample, as compared to a Trojan one. We demonstrate this for the Albatross class neuron in Figure 1. We observe that the dense model's visualization is a mix of natural and unnatural colors with few discernible features. Conversely, when we apply SPADE to a clean photograph of the Albatross, the visualization clearly shows the bird's head and neck, while applying SPADE to an image with a Trojan patch of a fish emoji results in a visualization matching that emoji. We provide further examples in Appendix G. We examine the sparsity ratios of different layers in Figure 4, observing that, in this model-specific setup, some of the final layers can be pruned to extremely high sparsities (≥ 95% for ResNet50), which correlates with the intuition that neurons in these final layers have a higher degree of super- imposed features, relative to neurons in the earlier layers, and therefore SPADE is able to remove a larger fraction of their connections without impacting the layer output on specific samples. 4.2.2 HUMAN STUDY Goals and Experimental Design. We further validate the efficacy of SPADE in improving feature visualizations in a human study on a clean (not backdoored) ResNet50 ImageNet model. Human studies are the only approach shown to be effective in measuring progress in neuron visualization In our study, we simultaneously evaluate two questions: methods (Doshi-Velez & Kim, 2017). whether preprocessing with SPADE helps the human reviewer form an intuition with regard to the image generated by the neuron visualization, and whether this intuition is correct when applied to the dense model. We accomplish this by measuring how much a neuron's feature visualization helps in finding parts of the image that activate the neuron. 8 Human response Undecided ↓ Incorrect attribution ↓ Correct attribution ↑ ∴ Decision accuracy ↑ Dense Vis. 22.9% 20.4% 56.7% 73.6% SPADE Vis. 12.6% 17.8% 69.8% 79.9% Figure 4: (Left) Results of human evaluation, measuring the ability of the evaluators to use neuron visualizations to attribute a classification decision to one of two image patches. (Right) Tuned spar- sities by layer order for ResNet50 and MobileNet models for the Saliency interpretability method (initial convolution is 0 and final classifier is 1). For the evaluation, we randomly sampled 100 misclassified samples. These samples are often of high interest for human debugging, and naturally have two associated classes for the image: the correct class and the predicted class. We used Score-CAM (Wang et al., 2019), a method that has been shown to be class-sensitive, to obtain saliency maps, and corresponding image regions, for each of the two classes. To make this decision more meaningful, we only used samples for which the saliency maps of the two classes have no intersection. To measure relevancy, the image patches were always generated from the dense model. For neuron visualization, we used the method of Olah et al. (2017) implemented in the Lucent/Lucid library. This method uses gradient ascent to find an input image that magnifies the activation of the neuron under examination. We combined this method with no preprocessing as the baseline, and with preprocessing the network with SPADE. We then showed one of the class feature visualizations, the full image, and the image patches cor- responding to the two classes to the evaluators, along with options to either select which of the two regions activates the neuron, or to indicate that the visualization did not enable them to do so. Cru- cially, we did not disclose the class associated with the neuron. In total, there were were a total of 400 possible human tasks: 100 samples, for which one of two class neurons was interpreted, with the neuron visualization created with or without preprocessing with SPADE. The tasks were chosen randomly from this pool; in total, 24 volunteer evaluators performed 746 rating tasks. We describe the human evaluation and process in more detail and screenshots of sample tasks in Appendix H. Results. The results of the human evaluation are presented in Figure 4 (left). When the network was preprocessed via SPADE, the users were over 10% more likely to choose to make a decision on which of the patches were responsible for the class prediction (87.4% when SPADE was used, versus 77.1% when it was not). In cases in which the human raters did make a decision, the accuracy was 5.3% higher when SPADE was used (79.9% vs. 73.6%), leading to a major 13.1% increase in net correct attributions. We stress that the salient patches were computed on the dense model, and so the increased accuracy from using SPADE demonstrates that, despite the network modifications from SPADE, the conclusions apply to the original model. Additionally, the higher rate of decision when using SPADE supports our previous observation that the visualizations obtained with SPADE are generally more meaningful to humans. 5 CONCLUSIONS AND FUTURE WORK We presented a pruning-inspired method, SPADE, which can be used as a network pre-processing step in a human interpretability pipeline to create interpretability tools are tailored to the input being studied. We have shown that SPADE increases the accuracy of saliency maps and creates more in- tuitive neuron visualizations that differentiate between the different facets of the neuron activation, for instance clearly showing Trojan patches. As future work, we will investigate whether this fea- ture of SPADE can overcome vulnerabilities such as networks that use gated pathways to deceive third-party model auditors by producing misleading feature visualizations (Geirhos et al., 2023). Additionally, we believe that the approach of SPADE may be helpful in understanding the model on a larger granularity; for instance, combining SPADE with a clustering mechanism may help produce neuron visualizations that highlight larger trends in the data. 9 0.00.20.40.60.81.0Normalized Layer Order0.00.20.40.60.81.0Sparsity RatioResNet50MobileNet ACKNOWLEDGMENTS The authors would like to thank Stephen Casper and Tony Wang for their feedback on this work, and Eldar Kurtic and Elias Frantar for their advice on aspects of the project. This research was sup- ported by the Scientific Service Units (SSU) of IST Austria through resources provided by Scientific Computing (SciComp). EI was supported in part by the FWF DK VGSCO, grant agreement number W1260-N35. REFERENCES Marco Ancona, Enea Ceolini, Cengiz ̈Oztireli, and Markus Gross. Gradient-based attribution meth- ods. Explainable AI: Interpreting, explaining and visualizing deep learning, pp. 169–191, 2019. Sebastian Bach, Alexander Binder, Gr ́egoire Montavon, Frederick Klauschen, Klaus-Robert M ̈uller, and Wojciech Samek. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PloS one, 2015. Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101 - mining discriminative com- ponents with random forests. In European Conference on Computer Vision, 2014. Joy Buolamwini and Timnit Gebru. Gender shades: Intersectional accuracy disparities in commer- cial gender classification. In FAT, 2018. Steven Cao, Victor Sanh, and Alexander M. Rush. Low-complexity probing via finding subnet- works. In North American Chapter of the Association for Computational Linguistics (NAACL- HLT), 2021. Stephen Casper, Yuxiao Li, Jiawei Li, Tong Bu, Kevin Zhang, and Dylan Hadfield-Menell. Bench- marking interpretability tools for deep neural networks. arXiv preprint arXiv:2302.10894, 2023. Aditya Chattopadhyay, Anirban Sarkar, Prantik Howlader, and Vineeth N. Balasubramanian. Grad- cam++: Generalized gradient-based visual explanations for deep convolutional networks. In IEEE Winter Conference on Applications of Computer Vision, WACV, 2018. Hila Chefer, Shir Gur, and Lior Wolf. Transformer interpretability beyond attention visualization. In Conference on Computer Vision and Pattern Recognition (CVPR), 2021. Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Conference on Computer Vision and Pattern Recognition (CVPR), 2009. Finale Doshi-Velez and Been Kim. Towards a rigorous science of interpretable machine learning. arXiv, 2017. D. Erhan, Yoshua Bengio, Aaron C. Courville, and Pascal Vincent. Visualizing higher-layer features of a deep network. 2009. Elias Frantar and Dan Alistarh. Optimal brain compression: A framework for accurate post-training quantization and pruning. In Conference on Neural Information Processing Systems (NeurIPS), 2022. Elias Frantar and Dan Alistarh. Massive language models can be accurately pruned in one-shot. arXiv preprint arXiv:2301.00774, 2023. Robert Geirhos, J ̈orn-Henrik Jacobsen, Claudio Michaelis, Richard S. Zemel, Wieland Brendel, Matthias Bethge, and Felix Wichmann. Shortcut learning in deep neural networks. Nature Ma- chine Intelligence, 2, 2020. Robert Geirhos, Roland S. Zimmermann, Blair Bilodeau, Wieland Brendel, and Been Kim. Don't trust your eyes: on the (un)reliability of feature visualizations, 2023. Amin Ghiasi, Hamid Kazemi, Eitan Borgnia, Steven Reich, Manli Shu, Micah Goldblum, An- drew Gordon Wilson, and Tom Goldstein. What do vision transformers learn? A visual ex- ploration. arXiv preprint arXiv:2212.06727, 2022. 10 Gabriel Goh, Nick Cammarata, Chelsea Voss, Shan Carter, Michael Petrov, Ludwig Schubert, Alec Radford, and Chris Olah. Multimodal neurons in artificial neural networks. Distill, 6(3):e30, 2021. Tristan Gomez, Thomas Fr ́eour, and Harold Mouch`ere. Metrics for saliency map evaluation of In Pattern Recognition and Artificial Intelligence: Third deep learning explanation methods. International Conference, ICPRAI. Springer, 2022. Wes Gurnee, Neel Nanda, Matthew Pauly, Katherine Harvey, Dmitrii Troitskii, and Dimitris Bertsi- mas. Finding neurons in a haystack: Case studies with sparse probing. ArXiv, abs/2305.01610, 2023. Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recog- nition. In Conference on Computer Vision and Pattern Recognition (CVPR), 2016. Sara Hooker, Dumitru Erhan, Pieter-Jan Kindermans, and Been Kim. A benchmark for interpretabil- ity methods in deep neural networks, 2019. Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017. Itay Hubara, Brian Chmiel, Moshe Island, Ron Banner, Joseph Naor, and Daniel Soudry. Accel- erated sparse neural training: A provable and efficient method to find n: m transposable masks. Advances in neural information processing systems, 2021. Jason Jo and Yoshua Bengio. Measuring the tendency of cnns to learn surface statistical regularities. ArXiv, abs/1711.11561, 2017. Narine Kokhlikyan, Vivek Miglani, Miguel Martin, Edward Wang, Bilal Alsallakh, Jonathan Reynolds, Alexander Melnikov, Natalia Kliushkina, Carlos Araya, Siqi Yan, et al. Captum: A unified and generic model interpretability library for pytorch. arXiv preprint arXiv:2009.07896, 2020. Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In Conference on Computer Vision and Pattern Recognition (CVPR), 2019. Denis Kuznedelev, Eldar Kurtic, Elias Frantar, and Dan Alistarh. Cap: Correlation-aware pruning for highly-accurate sparse vision models, 2023. Pantelis Linardatos, Vasilis Papastefanopoulos, and Sotiris B. Kotsiantis. Explainable ai: A review of machine learning interpretability methods. Entropy, 2020. Zhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, and Saining Xie. A convnet for the 2020s. In Conference on Computer Vision and Pattern Recognition (CVPR), 2022. Ziming Liu, Eric Gan, and Max Tegmark. Seeing is believing: Brain-inspired modular training for mechanistic interpretability. arXiv preprint arXiv:2305.08746, 2023. Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In International Conference on Computer Vision (ICCV), 2015. Scott M Lundberg and Su-In Lee. A unified approach to interpreting model predictions. In Confer- ence on Neural Information Processing Systems (NeurIPS), 2017. Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov. Locating and editing factual associations in GPT. In Conference on Neural Information Processing Systems (NeurIPS), 2022. Alexander Mordvintsev, Christopher Olah, and Mike Tyka. Deepdream-a code example for visual- izing neural networks. Google Research. Anh Mai Nguyen, Jason Yosinski, and Jeff Clune. Multifaceted feature visualization: Uncovering the different types of features learned by each neuron in deep neural networks. arXiv preprint arXiv:1602.03616, 2016. 11 Ian E. Nielsen, Dimah Dera, Ghulam Rasool, Ravi P. Ramachandran, and Nidhal Carla Bouaynaya. Robust explainability: A tutorial on gradient-based attribution methods for deep neural networks. IEEE Signal Processing Magazine, 2022. Chris Olah, Alexander Mordvintsev, and Ludwig Schubert. Feature visualization. Distill, 2(11), 2017. Alexandra Peste, Eugenia Iofinova, Adrian Vladu, and Dan Alistarh. AC/DC: Alternating com- pressed/decompressed training of deep neural networks. In Conference on Neural Information Processing Systems (NeurIPS), 2021. Sylvestre-Alvise Rebuffi, Ruth Fong, Xu Ji, and Andrea Vedaldi. There and back again: Revisiting backpropagation saliency methods. In Conference on Computer Vision and Pattern Recognition (CVPR), 2020. Marco T ́ulio Ribeiro, Sameer Singh, and Carlos Guestrin. "why should I trust you?": Explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2016. Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based local- ization. In International Conference on Computer Vision (ICCV), 2017. Rakshith Shetty, Bernt Schiele, and Mario Fritz. Not using the car to see the sidewalk – quantify- ing and controlling the effects of context in classification and segmentation. In Conference on Computer Vision and Pattern Recognition (CVPR), 2019. Avanti Shrikumar, Peyton Greenside, Anna Shcherbina, and Anshul Kundaje. Not just a black box: Learning important features through propagating activation differences. arXiv preprint arXiv:1605.01713, 2016. Avanti Shrikumar, Peyton Greenside, and Anshul Kundaje. Learning important features through propagating activation differences. In International Conference on Machine Learning (ICML), 2017. Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Vi- sualising image classification models and saliency maps. arXiv preprint arXiv:1312.6034, 2013. Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Vi- sualising image classification models and saliency maps. In International Conference on Machine Learning (ICML), 2014. Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014. Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. In International Conference on Machine Learning (ICML), 2017. Elena Voita, David Talbot, Fedor Moiseev, Rico Sennrich, and Ivan Titov. Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned. In Proceedings of the 57th Conference of the Association for Computational Linguistics, ACL 2019, Florence, Italy, July 28- August 2, 2019, Volume 1: Long Papers, 2019. Haofan Wang, Zifan Wang, Mengnan Du, Fan Yang, Zijian Zhang, Sirui Ding, Piotr (Peter) Mardziel, and Xia Hu. Score-cam: Score-weighted visual explanations for convolutional neu- IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops ral networks. (CVPRW), 2019. Eric Wong, Shibani Santurkar, and Aleksander Madry. Leveraging sparse linear layers for debug- gable deep networks. In International Conference on Machine Learning (ICML), 2021. Jason Yosinski, Jeff Clune, Anh M Nguyen, Thomas J. Fuchs, and Hod Lipson. Understanding neural networks through deep visualization. ArXiv, abs/1506.06579, 2015. 12 Lu Yu and Wei Xiang. X-pruner: explainable pruning for vision transformers. IEEE/CVF Confer- ence on Computer Vision and Pattern Recognition (CVPR), 2023. Matthew D. Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In European Conference on Computer Vision (ICCV), 2014. Hanwei Zhang, Felipe Torres, Ronan Sicre, Yannis Avrithis, and S. Ayache. Opti-cam: Optimizing saliency maps for interpretability. ArXiv, abs/2301.07002, 2023. 13 Appendix Table of Contents A Descriptions of saliency methods B Additional results B.1 CelebA and Food-101 results on ResNet50 . . . B.2 MobileNet . . . . B.3 ConvNext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C Additional hyperparameters D Ablation study . D.1 Sample selection . D.2 Choice of augmentation . . D.3 Layer sparsity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E Gradient noise F Computational cost G Saliency map and neuron visualization examples H Human evaluation details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 14 14 15 16 17 17 18 18 19 20 20 24 27 A DESCRIPTIONS OF SALIENCY METHODS In this section, we describe more fully the saliency methods paired with SPADE for the experiments in Section 4.1. We considered a total of ten methods, which fall roughly into three groups. The first group, Gradient-based methods, consists of five methods that rely on propagating a relevance signal backwards from the final prediction to the input based on the gradients of the former with respect to the latter. Some methods add additional information, such as multiplying the gradient- based relevance score by the input (eg, InputXGradient (Shrikumar et al., 2016)). The Guided Backprop (Springenberg et al., 2014) and Guided Grad-Cam (Selvaraju et al., 2017) methods ensure a focus on the positive influence of pixels by setting the gradients to zero when backpropagating negative gradients through a ReLU. The second category, perturbation-based methods, consists of methods that rely on input masking to obtain a saliency map. Finally, a third category, which we call 'Mixed', uses a combined approach. Please see Table A.1 for a description of all methods used. B ADDITIONAL RESULTS B.1 CELEBA AND FOOD-101 RESULTS ON RESNET50 We validate our results on the CelebA and Food-101 datasets (Liu et al., 2015; Bossard et al., 2014). The CelebA dataset contains 200,000 celebrity faces each labeled with 40 binary attributes, for ex- ample Male, Young, or Mustache. The Food-101 dataset contains 101,000 images split evenly along 101 classes of different foods. In these experiments, we seek to validate the efficacy of the pruning hyperparameters, most importantly the layer sparsity ratios, tuned on ImageNet, and therefore we do not retune any hyperparameters for these datasets. Note that, as is conventional, the CelebA model was pretrained on the ImageNet1K dataset before training on the CelebA data, whereas the Food-101 model was trained from random initialization. 14 Table A.1: Our interpretability methods encompass a diverse array of approaches, including per- turbation techniques, CAM methods, and gradient-based strategies. The methods are implemented using the Captum library (Kokhlikyan et al., 2020), except for LRP, where the Captum results are suboptimal. Group Gradient (Simonyan Method Saliency et al., 2014) InputXGradient et (Shrikumar 2016) DeepLift et al., 2017) al., (Shrikumar Layer-Wise Relevance Propagation (LRP) (Bach et al., 2015) Guided Backprop (Springenberg et al., 2014) Guided Grad-CAM (Selvaraju et al., 2017) Perturbation Lime (Ribeiro et al., 2016) Mixed Occlusion (Zeiler & Fergus, 2014) IntegratedGradients (Sundararajan et al., 2017) GradientSHAP Lund- berg & Lee (2017) Description Calculates the raw gradient of input pixels relative to class confidence. Multiplies raw gradients with input, reducing noise and improving the saliency map visually. Compares neuron activations with a reference activation calculated using a refrence image to assign neuron's con- tributions. Similar saliency map as InputXgradient. Propagates relevance scores from the output to input. Each neuron distribute its relevance to the previous layer's neurons. Sets negative ReLU gradients to zero, reducing saliency map noise. Combines Guided Backpropagation with Grad-CAM, which measures the last layer's activation in convolu- tional neural networks. Mask some regions of input image and fit a linear model that mimic the original model on the masked images to identify regions' importance with linear model's weights. Masks image rectangle areas and aggregates model con- fidence in these samples to highlight relevant prediction areas. A smooth variant of InputXgradient, calculates gradients connecting samples to a blank baseline. Then obtain a saliency map using these gradients. Averages gradients at random points between multiple reference inputs and the target, merging SHAP values and integrated gradients principles. As in Section 4.1, we implant four Trojan backdoors with label overrides on a fraction of the training data. The backdoors and overrides for CelebA are shown in Table C.6. Hyperparameters of Back- dooring process are detailed in Section C. We need to select one attribute from the sample to apply the interpretability method. Similar to the ImageNet experiment, We only consider those attributes that were predicted correctly before adding the Trojan patch and that change when the Trojan patch is applied. We then evaluate the saliency maps for one of these changed attributes. For Food-101, we follow the ImageNet training recipe detailed in Table C.9. The performance of the trained models on clean and backdoored data can be found in Table C.10. For this dataset we used four emoji as Trojan patches, as shown in Table C.7. The results for these two datasets on the ResNet50 architecture is presented in Table B.2. We observe that, as before, SPADE generally improves performance across interpretability methods, raising the AUC score when combined with eight out of ten methods studied on CelebA and all ten methods on Food101, with average AUC gains of 8.10% and 11.79%, respectively. B.2 MOBILENET In this section, we present the results for the ImageNet and CelebA datasets on the MobileNet-V2 architecture. For MobileNet we exclude depthwise covolutions and only prune pointwise convolu- tions and linear layers. Further, because the behaviour of LRP is only defined for networks with ReLU activations, we exclude LRP from the analysis. Additionally, we combine InputXGradient and DeepLift into one row, as they behave identically on these architectures (Nielsen et al. (2022), Ancona et al. (2019)). 15 Table B.2: ImageNet, ResNet transferability of sparsity ratio over datasets. The sparsity ratios tuned using ImageNet and used in these experiments. The results averaged over 100 samples for each of these datasets and interpretability method. Saliency Method CelebA (ImageNet Pretrained) Food101 (Random Initialization) AUC Pointing Game AUC Pointing Game Dense SPADE ∆ Dense SPADE ∆ Dense SPADE ∆ Dense SPADE ∆ Saliency InputXGradient DeepLift LRP GuidedBackprop GuidedGradCam Lime Occlusion IntegratedGradients GradientShap Average 73.52 68.26 87.76 86.82 97.87 88.89 75.58 65.12 83.01 80.23 80.71 92.81 92.09 91.21 96.8 96.63 89.13 62.42 79.27 93.4 94.25 88.80 +19.28 +23.84 +3.45 +9.98 -1.24 +0.24 -13.16 +14.15 +10.39 +14.02 +8.10 50.67 32.67 68.0 34.0 84.67 73.33 55.33 10.0 64.0 59.33 53.20 82.0 69.33 60.0 60.0 82.67 71.33 35.33 64.67 70.0 68.67 66.40 +31.33 +36.66 -8.0 +26.0 -2.0 -2.0 -20.0 +54.67 +6.0 +9.34 +13.20 69.13 66.09 89.41 87.26 98.26 97.57 91.76 75.87 80.02 80.05 83.54 94.62 93.48 95.18 98.64 98.44 97.61 93.66 91.45 95.11 95.1 95.33 +25.49 +27.39 +5.77 +11.38 +0.18 +0.03 +1.9 +15.58 +15.1 +15.05 +11.79 33.05 21.19 72.03 57.63 93.22 93.22 53.39 61.02 42.37 43.22 57.03 94.92 90.68 87.29 88.14 88.14 91.53 54.24 83.9 89.83 91.53 86.02 +61.87 +69.49 +15.26 +30.51 -5.08 -1.69 +0.85 +22.88 +47.46 +48.31 +28.99 The results for MobileNet experiments on the ImageNet and CelebA datasets are presented in Ta- ble B.3. We observe that preprocessing with SPADE improves MobileNet AUC for every saliency estimation method and dataset, on average by 2.90% for ImageNet and 2.99% for CelebA. Pointing game results are neutral on ImageNet with small changes in average score, but positive on CelebA, with an average improvement of 5.41%. Table B.3: MobileNet model results. Sparsity ratios tuned using ImageNet model. ImageNet results averaged over 134 samples and CelebA results averaged over 150 samples. Saliency Method ImageNet CelebA AUC Pointing Game AUC Pointing Game Dense SPADE ∆ Dense SPADE ∆ Dense SPADE ∆ Dense SPADE ∆ Saliency DeepLift Guided Backprop Guided Grad-Cam Lime Occlusion Integrated Gradients Gradient Shap Average 88.9 85.71 88.91 95.19 89.45 89.51 89.76 89.45 89.61 93.04 90.7 93.04 95.73 91.62 90.98 92.88 92.07 92.51 +4.14 +4.99 +4.12 +0.54 +2.16 +1.47 +3.12 +2.62 +2.90 93.23 81.34 93.28 93.28 70.15 94.03 87.22 84.96 87.19 94.03 81.34 94.03 94.78 68.66 94.03 88.06 84.33 87.41 +0.8 0.0 +0.75 +1.5 -1.49 0.0 +0.84 -0.63 +0.22 95.43 93.26 95.43 86.76 67.64 90.39 95.91 93.94 89.84 96.92 96.15 96.92 86.85 77.14 94.66 97.79 96.24 92.83 +1.49 +2.89 +1.49 +0.1 +9.5 +4.28 +1.88 +2.3 +2.99 80.67 70.0 80.67 66.0 51.33 83.33 76.67 76.67 73.17 80.0 81.33 83.33 68.0 64.67 95.33 79.33 76.67 78.58 -0.67 +11.33 +2.66 +2.0 +13.34 +12.0 +2.66 0.0 +5.41 B.3 CONVNEXT We additionally conducted ImageNet and CelebA experiments on the ConvNext-T (Liu et al., 2022) architecture. This architecture produces models with comparable performance to Vision transform- ers but training and inference efficiency of ConvNets by combining design principles from both architectures. Similar to MobileNet, we exclude depthwise covolutions and only prune pointwise convolutions and linear layers. As with MobileNet, we omit LRP from this analysis, due to un- specified behaviour for this method in cases where non-ReLU (here, GeLU activations) are used, and, like with MobileNet, we combine the InputXGradient and DeepLift rows. For this architecture, Gaussian Noise and Random Masking were added to the image augmentations. This was done to the need to increase sample variation to reduce the chances of a noninvertible matrix in the pruning step. The augmented samples may be seen in Figure C.2. The results are presented in Table B.4. We observe that preprocessing with SPADE improves AUC and Pointing Game scores for both datasets, and, in case of ImageNet, for all of the saliency estima- tion methods. On average, SPADE preprocessing improves ImageNet Saliency AUC by 3.09% and pointing game accuracy by 5.1%. On CelebA, SPADE improves ImageNet saliency AUC by 1.38% and Pointing Game AUC by 1.87%. 16 Table B.4: ConvNext-T model results. Sparsity ratios tuned using ImageNet model. results averaged over 147 samples and CelebA results averaged over 100 samples. ImageNet Saliency Method ImageNet CelebA AUC Pointing Game AUC Pointing Game Dense SPADE ∆ Dense SPADE ∆ Dense SPADE ∆ Dense SPADE ∆ Saliency DeepLift Guided Backprop Guided Grad-Cam Lime Occlusion Integrated Gradients Gradient Shap Average 85.24 81.95 85.24 84.1 93.41 85.27 87.0 86.2 86.05 87.5 84.6 87.5 91.99 94.73 88.24 89.13 89.44 89.14 +2.25 +2.64 +2.25 +7.89 +1.32 +2.97 +2.12 +3.24 +3.09 82.31 71.43 84.35 82.99 70.75 87.76 71.43 72.79 77.98 85.03 80.27 85.03 88.44 75.51 88.44 82.31 79.59 83.08 +2.72 +8.84 +0.68 +5.45 +4.76 +0.68 +10.88 +6.8 +5.1 96.6 94.93 96.6 87.05 75.3 89.53 92.76 91.71 90.56 96.95 95.53 96.95 90.19 73.78 92.2 95.55 94.36 91.94 +0.35 +0.6 +0.35 +3.13 -1.53 +2.67 +2.79 +2.66 +1.38 76.0 59.0 76.0 73.0 59.0 83.0 64.0 64.0 69.25 75.0 64.0 75.0 79.0 58.0 88.0 67.0 63.0 71.12 -1.0 +5.0 -1.0 +6.0 -1.0 +5.0 +3.0 -1.0 +1.87 Table C.5: ImageNet Trojan patches with their source and target class. "Any" means any image could be used for the Trojan. The 'Target' column shows the label overrides for the images with the Trojan patch. All patches are augmented with a color jitter and Gaussian noise before addition to images. Source Target Patch Any Any 30/BullFrog 146/Albatross 893/Wallet 365/Orangutan 271/Red Wolf 99/Goose C ADDITIONAL HYPERPARAMETERS Augmentation. Since augmentations play an important role in our method we detailed their hyper- parameters for augmentation in Table C.8. We also show typical augmented samples in Figure C.1, and Figure C.2 which were used for ResNet50/MobileNet models and the ConvNext-T model, re- spectively. Backdoor Planting Hyperparameters: When training ResNet50 on Food-101 dataset we used the hyperparameters suggested in Kornblith et al. (2019), with includes a weight decay of 0.0005. Other hyperparameters are highlighted in Table C.9. For other cases which includes ResNet50, MobileNet, or ConvNext-T on ImageNet, or celebA dataset, we use a 0.9 momentum and step-lr learning rate scheduler with a step-lr-gama 0.1 for all backdoorings and a weight decay of 0.0001. The initial learning rate is chosen from the op- tions - 0.01, 0.001, 0.0001, 0.00001 - based on accuracy on Trojan samples at the end of training. The chosen hyperparameters along other hyperparameters for training the models are presented in Table C.9. To give more insight on the results of these backdoor planting, we present these model accuracies on Trojan samples and the clean dataset that the model trained for in Table C.10. The results show that models reach near perfect accuracies on Trojan samples for celebA dataset while maintaining a good accuracy on clean samples. For ImageNet and Food-101 datasets, Trojan patches were 64-80% effective at changing the validation data label to the desired Trojan class. D ABLATION STUDY In this section, we examine how the various hyperparameters of SPADE that impact its performance on the saliency map accuracy task. 17 Table C.6: CelebA Trojan patches. All images may be chosen for a Trojan. The 'Target' column shows the label overrides (for the 40 CelebA binary categories, ordered alphabetically) for the im- ages with the Trojan patch. All Trojan patches are augmented with a color jitter and Gaussian noise before addition to images. Source Any Any Any Any Target patch 0110111111100100000101100111101010110110 0101111101011110100110101000001100011010 0101111110110010011010010001101000001010 1111101111011001000011001011110001011101 Table C.7: Food-101 Trojan patches with their source and target class. "Any" means any image could be used for the Trojan. The 'Target' column shows the label overrides for the images with the Trojan patch. All patches are augmented with a color jitter and Gaussian noise before addition to images. Source Target patch 0/Apple Pie 20/Chicken Wings 40/French Fries 60/Lobster Bisque Any Any 80/Pulled Pork Sandwich 100/Waffles D.1 SAMPLE SELECTION We first investigate the impact of varying the sample size and selection for the Optimal Brain Dam- age (OBD) pruning process. We experimented with different sample selection methods, namely: 1. The sample of interest, augmented as described in Section 4.1 2. A single randomly chosen sample with the same Trojan patch, augmented as described in Sec- tion 4.1 3. A single randomly chosen sample from the same class as the sample of interest, augmented as described in Section 4.1 4. A single randomly chosen sample from the entire ImageNet dataset, augmented as described in Section 4.1 5. 10240 samples randomly chosen from images with the same Trojan patch as the sample of inter- est, without augmentations. 6. 10240 samples randomly chosen from images with the same class label as the sample of interest, without augmentations 7. 10240 samples randomly chosen from the ImageNet dataset, without augmentations The results, summarized in Table D.11, show clearly that the use of the single, augmented sample for the pruning step of SPADE is crucial for the efficacy of the method. More generally, using images with the same Trojan patch yielded better results than other sample selection methods, while using images with the same base class was no better than using randomly chosen images from the entire dataset. Further, this demonstrates that the act of pruning alone does not necessarily enhance interpretability. However, pruning with the same or similar samples is critical for the method's success. D.2 CHOICE OF AUGMENTATION Next, we explored the influence of the augmentation approach on our method. By experimenting with various augmentation techniques, we analyzed their impact on the method. The results are presented in Table. D.12. The most important takeaway of this experiment is that with diverse and strong enough augmentations, our method could improve the results in most cases; therefore, there is 18 Table C.8: Augmentation details. "Models" column explain which models used the augmentation. Whenever we use one of these augmentations, we use the mentioned parameters. Augmentations Color Jitter Random Crop Guassian Noise Random Remove parameters brightness = 0.5, hue = 0.3 scale = (0.2, 1.0) σ2 = 0.001 p = 0.5, scale = (0.02, 0.33), ratio = (0.3, 3.3) Models All Models All Models ConvNext ConvNext Base Image Sample 1 Sample 2 Sample 3 Sample 4 Sample 5 Figure C.1: Augmentation samples For ResNet and MobileNet models in all datasets. no need for carefully choosing the augmentations. This simplifies the application and development of our SPADE method. D.3 LAYER SPARSITY In this subsection, we want to answer this question, "What is the role of sparsity ratios in different layers?" To gain a better understanding of the importance of sparsifying each layer, we first investigate sce- narios where we only sparsify one ResNet50 block to a 0.99 sparsity ratio. The results, presented in Table D.13, suggest that pruning later layers is more helpful than pruning earlier layers. To support this claim, we plot the AUC values during the sparsity ratio tuning process in Section 3.2 in Fig- ure D.3. The plot shows that most of the AUC improvements came from sparsifying the last four layers. Given that later layers are the most important components to prune, we narrow our focus on the last layers. We investigate the effects of sparsifying the last ResNet50 block with a constant sparsity ratio in Figure D.4. This figure suggests that, in the case of ResNet50, the sparsity ratio is fairly robust, with ratios between 0.8 to 0.995 giving good results for SPADE. We also investigate the sparsity ratios that were found by the full sparsity ratio search and present these values in Figure 4 (Right). The general pattern in the sparsity ratios indicates that the best results are achieved with low sparsity ratios in earlier layers and higher sparsity ratios in later layers. Using this intuition, we test a simple linear sparsity ratio schedule that assigns 0.00 sparsity to the first layer, 0.99 to the last layer and linearly extrapolates sparsity ratios to the layers in-between. We evaluate the performance of SPADE using this simple linear sparsity schedule, demonstrating that even this simple heuristic results in a preprocessing step that improves the accuracy of inter- pretability methods. In Table D.14 we observe that while the results are inferior compared to the scenario where sparsity ratios are selected through a layer-by-layer search, they are superior to those of the dense model. 19 Base Image Sample 1 Sample 2 Sample 3 Sample 4 Sample 5 Figure C.2: Augmentation samples For ConvNext model Table C.9: Hyperparameters used for planting backdoors in the models."Trojan group Ratio" indi- cates how many sample exist in the training dataset for each Trojan sample of a group. "step-lr" refers to the epoch that learning rate drops. Model ResNet50 ResNet50 ResNet50 MobileNetV2 MobileNetV2 ConvNext-T ConvNext-T DataSet ImageNet CelebA Food-101 ImageNet CelebA ImageNet CelebA E GRADIENT NOISE Trojan group Ratio Batch Size Learning Rate step-lr Epoch 3000 300 3000 3000 300 3000 300 64 64 64 64 64 64 64 0.001 0.01 0.01 0.001 0.1 0.001 0.01 3 10 50 3 10 3 10 6 20 150 6 20 6 20 Our primary intuition is that by pruning the weights, we remove connections (and gradients) less rel- evant to a given example's classification. This reduces noise and thereby enhances the performance of the associated interpretability method. Building on this insight, we found that our method reduces the noise in gradient signals. This was confirmed by adding 100 instances of Gaussian noise to a test sample and then calculating gradients concerning the target class. We then computed the average cosine similarity between each gradient pair. As shown in Figure E.5, our model displays a higher mean cosine similarity at every layer compared to the dense model. The results were averaged across 100 images. F COMPUTATIONAL COST 20 Table C.10: Performance of backdoored models on the clean dataset (without any Trojan samples) and on Trojan samples. Model ResNet50 ResNet50 ResNet50 MobileNetV2 MobileNetV2 ConvNext-T ConvNext-T Dataset ImageNet CelebA Food-101 ImageNet CelebA ImageNet CelebA Clean Accuracy Trojan Accuracy 80.0 91.4 84.0 77.0 91.6 86.1 91.3 73.2 99.9 65.1 64.7 99.8 79.5 99.5 Table D.11: Impact of sample selection for the network pruning step of SPADE. 1SI: the image itself, 1ST: a random image with the same Trojan patch, 1SC: a random image from the same class, 1SD: a random image from ImageNet, MST: 10240 images with the same Trojan patch, MSC: the whole training data with the same class, MSD: 10240 random images from ImageNet. Based on 100 samples. The First number in each cell refers to AUC and the Second number refers to Point Game measure. Saliency Method saliency InputXGradient DeepLift LRP Guided Backprop Guided Grad-Cam Lime Occlusion IntegratedGradients gradientSHAP Average Dense 86.5/76 82.8/60 93.0/81 92.1/66 95.3/94 97.8/95 92.7/74 86.1/92 87.5/69 87.2/69 90.1/77.6 1SI 95.2/87 92.9/82 94.7/82 99.1/99 96.9/93 98.1/93 95.6/74 94.6/92 94.5/80 94.4/80 95.6/86.2 1ST 60.8/32 60.0/22 60.3/21 83.6/46 83.1/57 83.6/58 74.7/40 65.7/42 62.4/22 62.4/22 69.7/36.2 1SC 46.5/6 50.2/5 50.9/6 77.6/25 76.4/35 71.3/32 61.3/31 48.5/11 50.3/5 50.2/6 58.3/16.2 1SD 48.0/11 50.1/4 50.2/7 81.3/36 80.8/55 70.3/46 53.1/16 54.8/12 51.9/9 52.1/11 59.3/20.7 MST 60.3/28 59.0/18 57.5/10 84.3/49 83.8/59 84.9/57 75.5/44 68.0/41 60.3/17 60.3/18 69.4/34.1 MSC 41.0/5 50.0/6 50.7/7 72.9/21 70.9/20 67.0/16 63.4/31 43.8/6 50.2/3 50.1/4 56.0/11.9 MSD 43.4/4 50.2/6 50.8/3 72.8/25 77.2/42 65.2/39 52.0/19 48.2/7 50.2/5 50.2/4 56.0/15.4 Table D.12: The effect of various augmentation techniques on interpretability accuracy. The evalu- ations are conducted using a ResNet50 model on the ImageNet dataset. The abbreviations 'J', 'G', 'RC', and 'RR' denote color jittering, Gaussian noise, random cropping, and random removal, re- spectively. The First number in each cell refers to the AUC and the Second number refers to the Point Game measure. Saliency Method Saliency InputXGradient DeepLift LRP Guided Backprop Guided Grad-Cam Lime Occlusion Integrated Gradients gradientSHAP Average Dense 86.5/76 82.8/60 93.0/81 92.1/66 95.3/94 97.8/95 92.7/74 86.1/92 87.5/69 87.2/69 90.1/77.6 J+RC 95.2/87 92.9/82 94.7/82 99.1/99 96.9/93 98.1/93 95.4/75 94.6/92 94.5/80 94.4/76 95.6/85.9 J+G+RC 92.1/84 89.3/71 90.4/79 98.3/94 94.6/85 96.4/87 94.9/72 91.2/88 90.9/81 90.9/76 92.9/81.7 RR 93.3/85 90.2/73 94.1/81 98.5/98 96.4/94 98.0/94 96.1/73 95.2/96 93.1/81 92.9/83 94.8/85.8 G+RC 91.6/86 89.1/68 90.7/78 98.2/93 94.5/81 96.6/85 95.3/75 90.1/83 90.7/75 90.5/75 92.7/79.9 RR+RC 94.8/87 92.6/78 94.7/85 98.9/98 96.7/94 98.0/93 95.5/75 93.9/95 94.2/78 94.1/82 95.3/86.5 G 89.4/83 85.9/69 89.8/74 97.3/85 94.5/83 96.6/88 96.1/74 91.5/89 89.0/74 88.7/72 91.9/79.1 21 Table D.13: The impact of pruning various layers in the ResNet50 model on the ImageNet dataset, based on the average of 100 samples. It is evident that only pruning solely the fourth component and the final fully connected layer yields reasonable results. The First number in each cell refers to AUC and the Second number refers to Point Game measure. Saliency Method Saliency InputXGradient DeepLift LRP Guided Backprop Guided Grad-Cam Lime Occlusion Integrated Gradients gradientSHAP Average Dense 86.8/75 83.3/47 93.2/74 92.1/66 95.3/93 97.8/94 93.1/76 86.8/90 87.8/59 87.3/57 90.3/73.1 FC 86.6/76 82.9/48 93.0/73 94.2/76 95.3/93 97.8/93 92.5/78 86.6/91 87.8/63 87.7/64 90.4/75.5 Block 4 95.1/88 93.2/70 94.8/73 98.7/97 96.6/92 97.8/92 95.8/79 94.4/90 94.7/72 94.6/72 95.6/82.5 Block 3 51.0/18 52.2/12 50.3/4 80.7/27 71.3/22 61.7/21 51.7/17 54.0/15 50.2/7 50.4/5 57.4/14.8 Block 2 59.0/22 58.1/13 54.6/6 87.1/48 76.1/23 62.9/16 56.5/23 59.6/22 57.0/10 57.4/11 62.8/19.4 Block 1 65.8/26 64.2/18 58.4/21 73.3/38 81.4/35 73.5/34 63.4/27 69.0/41 66.3/23 66.1/20 68.1/28.3 Figure D.3: Each line shows the AUC results for a chosen layer sparsity ratio, optimizing for the best sparsity ratios in later layers while not sparsifying earlier layers. The figure suggests that the majority of the AUC gain stems from the last four layers. "Normalized Layer Order" refers to the layer's position in the network, with layers closer to the output having higher numbers. The ResNet50 model and the ImageNet dataset were used. Figure D.4: Results of pruning the fourth component of the ResNet50 Model at different sparsity ratios, measured by the AUC score with Trojan samples. Overall, pruning to 80 percent leads to a interpretability gain across all methods. 22 0.00.20.40.60.81.0Sparsity Ratio9293949596979899100AUC (%)0.00.20.40.60.81.0Normalized Layer Order0.00.20.40.60.81.0Sparsity Ratio80.082.585.087.590.092.595.097.5100.0AUC Score (%)LimeDeepLiftLRPIntegratedGradientsInputXGradientGuided Grad-CamGradientShapGuided BackpropOcclusionSaliency Table D.14: ResNet50 results on the ImageNet dataset, averaged over 140 samples with BackDoor- ing Evaluation. "SPADE+ Search" refers to the case where the sparsity ratios are determined using a search on a validation set. "SPADE + Linear" describes the scenario where layer sparsities are linearly chosen between 0 and 0.99, with the input layer assigned a 0 sparsity ratio. Saliency Method AUC Pointing Game Dense SPADE+Search SPADE+Linear Dense SPADE+Search SPADE+Linear Saliency InputXGradient DeepLift LRP GuidedBackprop GuidedGradCam Lime Occlusion Integrated Gradients GradientSHAP Average 86.92 83.77 93.47 90.05 95.22 97.82 91.93 86.09 87.86 87.74 90.09 95.32 93.73 95.85 99.11 96.45 98.12 95.84 93.73 94.77 94.85 95.78 91.58 88.77 94.99 98.15 95.59 97.87 94.34 89.27 92.34 92.15 93.51 83.92 67.83 89.51 72.73 87.5 90.91 70.63 89.51 81.12 81.12 81.48 93.71 88.81 90.91 96.5 86.81 93.71 69.23 86.71 88.81 88.11 88.33 90.91 79.02 89.51 95.8 86.71 90.91 71.33 88.81 88.81 87.41 86.92 Figure E.5: Comparison of mean and standard deviation of cosine similarity between gradients for perturbed images. With SPADE, the average cosine similarity sees an enhancement from 0.7355 to 0.7721. Table F.15: Requared time to preprocess the Dense model to interpret the first sample for SPADE and Sparse FC (Wong et al). Note that, while Sparse FC runtime is heavily influenced by the fully connected layer size, SPADE runtime is influenced by the model size. Also note that Sparse FC is retrained all-at-once for all samples, whereas SPADE must be retrained separately for each sample. Model Architecture ResNet50 MobileNetV2 ConvNext-T GPU Architecture NVIDIA GeForce RTX 2080 Ti (12 G) NVIDIA GeForce RTX 2080 Ti (12 G) NVIDIA GeForce RTX 3090 (24 G) SPADE Runtime 41M 12M 46M Sparse FC Runtime 40H 53H 21H 23 Img1.01.11.22.02.12.22.33.03.13.23.33.43.54.04.14.2AverageLayer0.00.20.40.60.81.0Avg Cosine SimilarityDenseSPADE G SALIENCY MAP AND NEURON VISUALIZATION EXAMPLES In this section we show sample saliency maps for four of the saliency scoring methods: Saliency(Simonyan et al., 2014), InputXGradient (Shrikumar et al., 2016), LRP Bach et al. (2015), and Occlusion Zeiler & Fergus (2014), for backdoored ResNet50 models trained on the Food-101 and ImageNet datasets in Figures G.6 and G.7. Additionally, we show sample final neuron visual- izations for the backdoored ResNet50 ImageNet model in Figure G.8. Base Image Model Saliency Input X Gradient LRP Occulusion Dense SPADE Dense SPADE Figure G.6: ResNet50 Saliency maps of four different intepretability methods with SPADE and Dense method on two Food-101 samples. Best views on monitor. 24 Base Image Model Saliency Input X Gradient LRP Occulusion Dense SPADE Dense SPADE Dense SPADE Dense SPADE Figure G.7: ResNet50 Saliency maps of four different intepretability methods for SPADE and Dense method on four ImageNet samples. Best views on monitor. 25 Class dense pruned using clean sample pruned using Trojan sample Goose Orangutan Albatross Bullfrog Figure G.8: Sample feature visualizations of different classes. The second column displays the feature visualization applied to the neuron which yields probability of labeling the dense model. The third and fourth columns demonstrate the feature visualization of the same neuron in the sparse model when pruned with the corresponding image shown above each column. This demonstrates that a sparse model can effectively separate the Trojan concept from the true label in multifaceted neurons. 26 H HUMAN EVALUATION DETAILS In this section we describe more fully the human evaluation flow that was used to measure how well humans could use the neuron activation map to find the most important part of the input image. Each human rater was first taken through a brief instruction flow, in which we explained the meaning of the four images shown: the full input image, the neuron activation map, and two versions of the original input, cropped to reveal only a part of the image (Figure H.9). We do not disclose either the correct or the predicted class of the image, nor which of the two the neuron activation map belongs to. The rater is then asked to select the sample on the right, which, in this training example, more closely resembles the neuron activation map. (In the actual task, the correct answer is equally likely to be the left and the right option). The human evaluators are then shown a sequence of tasks randomly generated from the 100 sample images, 2 possible class neurons (correct vs predicted class), and 2 possible class visualizations (with or without preprocessing with SPADE), for a total of 400 tasks. In addition to the two options of picking the left or the right cropped image as a more close match for the class visualization, the raters are given the option to select neither class, either because both match well, or because neither does. Both options are recorded as a "decline to answer". Three sample tasks from the study are shown in Figure H.9. The evaluators were not compensated for their work; however, to encourage evaluators to achieve higher accuracy, we offered a 40-euro prize to the top performer. Figure H.9: Three samples that evaluators may see during the evaluation. 27 Figure H.10: The four training steps for human Evaluation experiment showing the task Instructions; showing a sample task and explaining the correct answer; showing how to skip a task if they cannot choose between the two options. 28